Thankyou for making that clear.
I am currently working towards testing a patch that will fix the
behaviour of glibc.
Currently the sunrpc/svc_udp.c code asks for an IP_PKTINFO from
recvmsg, and passes it verbatim down through sendmsg.
My patch checks that the returned data looks believable and, if it
does, zeros the ipi_ifindex field.
NeilBrown
--- sunrpc/svc_udp.c.orig 2003-02-19 11:25:20.000000000 +1100
+++ sunrpc/svc_udp.c 2003-02-19 14:28:46.000000000 +1100
@@ -256,8 +256,26 @@
mesgp->msg_controllen = sizeof(xprt->xp_pad)
- sizeof (struct iovec) - sizeof (struct msghdr);
rlen = recvmsg (xprt->xp_sock, mesgp, 0);
- if (rlen >= 0)
- len = mesgp->msg_namelen;
+ if (rlen >= 0) {
+ struct cmsghdr *cmsg;
+ len = mesgp->msg_namelen;
+ cmsg = CMSG_FIRSTHDR(mesgp);
+ if (cmsg == NULL ||
+ CMSG_NXTHDR(mesgp, cmsg) != NULL ||
+ cmsg->cmsg_level != SOL_IP ||
+ cmsg->cmsg_type != IP_PKTINFO ||
+ cmsg->cmsg_len != sizeof(struct in_pktinfo)) {
+ /* Not a simple IP_PKTINFO, ignore it */
+ mesgp->msg_control = NULL;
+ mesgp->msg_controllen = 0;
+ } else {
+ /* it was a simple IP_PKTIFO as we expected,
+ * Discard the interface field
+ */
+ struct in_pktinfo *pkti = CMSG_DATA(cmsg);
+ pkti->ipi_ifindex = 0;
+ }
+ }
}
else
#endif
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/