clausklein / rpms / tftp

Forked from rpms/tftp 5 years ago
Clone

Blame SOURCES/tftp-hpa-5.2-pktinfo.patch

c5edeb
diff -up tftp-hpa-5.2/tftpd/recvfrom.c.test tftp-hpa-5.2/tftpd/recvfrom.c
c5edeb
--- tftp-hpa-5.2/tftpd/recvfrom.c.test	2011-12-11 23:13:52.000000000 +0100
c5edeb
+++ tftp-hpa-5.2/tftpd/recvfrom.c	2012-01-04 10:05:17.852042256 +0100
c5edeb
@@ -149,16 +149,16 @@ myrecvfrom(int s, void *buf, int len, un
c5edeb
 
c5edeb
     /* Try to enable getting the return address */
c5edeb
 #ifdef IP_RECVDSTADDR
c5edeb
-    if (from->sa_family == AF_INET)
c5edeb
+    if (from->sa_family == AF_INET || !from->sa_family)
c5edeb
         setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
c5edeb
 #endif
c5edeb
 #ifdef IP_PKTINFO
c5edeb
-    if (from->sa_family == AF_INET)
c5edeb
+    if (from->sa_family == AF_INET || !from->sa_family)
c5edeb
         setsockopt(s, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on));
c5edeb
 #endif
c5edeb
 #ifdef HAVE_IPV6
c5edeb
 #ifdef IPV6_RECVPKTINFO
c5edeb
-    if (from->sa_family == AF_INET6)
c5edeb
+    if (from->sa_family == AF_INET6 || !from->sa_family)
c5edeb
         setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on));
c5edeb
 #endif
c5edeb
 #endif