about summary refs log tree commit diff
path: root/sunrpc/svc_udp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-27 08:01:47 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-27 08:01:47 +0000
commitd148ed257ab179a6a408bc1668e2effb447726bd (patch)
treedc1c20da057af92f4170187c6bbf0959a1afe1ea /sunrpc/svc_udp.c
parent695799feb3e640323ec86b469517f87ca16e99ff (diff)
downloadglibc-d148ed257ab179a6a408bc1668e2effb447726bd.tar.gz
glibc-d148ed257ab179a6a408bc1668e2effb447726bd.tar.xz
glibc-d148ed257ab179a6a408bc1668e2effb447726bd.zip
Update.
2003-02-27  Ulrich Drepper  <drepper@redhat.com>

	* sunrpc/svc_udp.c (svcudp_recv): Remove all control messages
	except the PKTINFO.  Reset interface in PKTINFO.

	* elf/elf.h: Add new R_PPC64_* relocs for TLS.
	* elf/tls-macros.h [__powerpc64__] (TLS_LE, TLS_IE, TLS_LD, TLS_GD):
	Define.
	* sysdeps/powerpc/elf/libc-start.c (__libc_start_main):
Diffstat (limited to 'sunrpc/svc_udp.c')
-rw-r--r--sunrpc/svc_udp.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index 0410e9c008..cb1d70558e 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -258,7 +258,29 @@ again:
 			      - sizeof (struct iovec) - sizeof (struct msghdr);
       rlen = __recvmsg (xprt->xp_sock, mesgp, 0);
       if (rlen >= 0)
-	len = mesgp->msg_namelen;
+	{
+	  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 cmsghdr)
+				   + 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