Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 47976
b: refs/heads/master
c: 067d781
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Lever authored and Linus Torvalds committed Feb 12, 2007
1 parent 8687f6d commit 83742ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e79eff1f90826b207b1152fc87aa97fa74fb7f9c
refs/heads/master: 067d7817310569f7b76ca08c4d071ca95ad4c1d3
3 changes: 3 additions & 0 deletions trunk/include/linux/sunrpc/svcsock.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ struct svc_sock {

/* cache of various info for TCP sockets */
void *sk_info_authunix;

struct sockaddr_storage sk_remote; /* remote peer's address */
int sk_remotelen; /* length of address */
};

/*
Expand Down
14 changes: 8 additions & 6 deletions trunk/net/sunrpc/svcsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,13 @@ svc_recv_available(struct svc_sock *svsk)
static int
svc_recvfrom(struct svc_rqst *rqstp, struct kvec *iov, int nr, int buflen)
{
struct svc_sock *svsk = rqstp->rq_sock;
struct msghdr msg;
struct socket *sock;
int len, alen;
int len;

rqstp->rq_addrlen = sizeof(rqstp->rq_addr);
sock = rqstp->rq_sock->sk_sock;
sock = svsk->sk_sock;

msg.msg_name = &rqstp->rq_addr;
msg.msg_namelen = sizeof(rqstp->rq_addr);
Expand All @@ -585,11 +586,9 @@ svc_recvfrom(struct svc_rqst *rqstp, struct kvec *iov, int nr, int buflen)
len = kernel_recvmsg(sock, &msg, iov, nr, buflen, MSG_DONTWAIT);

/* sock_recvmsg doesn't fill in the name/namelen, so we must..
* possibly we should cache this in the svc_sock structure
* at accept time. FIXME
*/
alen = sizeof(rqstp->rq_addr);
kernel_getpeername(sock, (struct sockaddr *)&rqstp->rq_addr, &alen);
memcpy(&rqstp->rq_addr, &svsk->sk_remote, svsk->sk_remotelen);
rqstp->rq_addrlen = svsk->sk_remotelen;

dprintk("svc: socket %p recvfrom(%p, %Zu) = %d\n",
rqstp->rq_sock, iov[0].iov_base, iov[0].iov_len, len);
Expand Down Expand Up @@ -938,6 +937,9 @@ svc_tcp_accept(struct svc_sock *svsk)
if (!(newsvsk = svc_setup_socket(serv, newsock, &err,
(SVC_SOCK_ANONYMOUS | SVC_SOCK_TEMPORARY))))
goto failed;
memcpy(&newsvsk->sk_remote, &sin, slen);
newsvsk->sk_remotelen = slen;

svc_sock_received(newsvsk);

/* make sure that we don't have too many active connections.
Expand Down

0 comments on commit 83742ba

Please sign in to comment.