kNFSd - 2 of 3 - Make sure nfsd replies from the address the request was sent to.
Subsystems (3)
PATCH 1/1 kNFSd - 2 of 3 - Make sure nfsd replies from the address the request was sent to.
### Comments for ChangeSet
This is important on multi-homes hosts.
----------- Diffstat output ------------
./include/linux/sunrpc/svc.h | 2 ++ ./net/sunrpc/svcsock.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
include/linux/sunrpc/svc.h renamed from include/linux/sunrpc/svc.h~current~ +2 -0
@@ -131,6 +131,8 @@ struct svc_rqst { rq_secure :1 ;/* secure port */ +__u32 rq_daddr;/* dest addr of request - reply from here */ +void * rq_argp;/* decoded arguments */ void * rq_resp;/* xdr'd results */
net/sunrpc/svcsock.c renamed from net/sunrpc/svcsock.c~current~ +13 -3
@@ -353,6 +353,9 @@ svc_sendto(struct svc_rqst *rqstp, strucstruct svc_sock *svsk = rqstp->rq_sock;struct socket *sock = svsk->sk_sock;int slen; +struct {struct cmsghdr cmh; +struct in_pktinfo pki; + } cm;int len =0 ;int result;int size;
@@ -364,16 +367,22 @@ svc_sendto(struct svc_rqst *rqstp, struc slen = xdr->len;if (rqstp->rq_prot ==IPPROTO_UDP ) { -/* set the destination */ +/* set the source and destination */ struct msghdr msg; msg.msg_name = &rqstp->rq_addr; msg.msg_namelen =sizeof (rqstp->rq_addr); msg.msg_iov =NULL ; msg.msg_iovlen =0 ; - msg.msg_control =NULL ; - msg.msg_controllen =0 ; msg.msg_flags =MSG_MORE ; + msg.msg_control = &cm; + msg.msg_controllen =sizeof (cm); + cm.cmh.cmsg_len =sizeof (cm); + cm.cmh.cmsg_level =SOL_IP ; + cm.cmh.cmsg_type =IP_PKTINFO ; + cm.pki.ipi_ifindex =0 ; + cm.pki.ipi_spec_dst.s_addr = rqstp->rq_daddr; +if (sock_sendmsg (sock, &msg,0 ) <0 ) goto out; }
@@ -594,6 +603,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) rqstp->rq_addr.sin_family =AF_INET ; rqstp->rq_addr.sin_port = skb->h.uh->source; rqstp->rq_addr.sin_addr.s_addr = skb->nh.iph->saddr; + rqstp->rq_daddr = skb->nh.iph->daddr; svsk->sk_sk->sk_stamp = skb->stamp;
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs