Module Name:    src
Committed By:   sborrill
Date:           Mon Oct  5 11:16:12 UTC 2009

Modified Files:
        src/dist/libpcap [netbsd-5]: inet.c

Log Message:
Pull up the following revision(s) (requested by bouyer in ticket #1039):
        dist/libpcap/inet.c:    revision 1.3
Fix pcap_lookupnet(): reset ifr before SIOCGIFNETMASK. Without it we get
back a bogus netmask.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.26.1 src/dist/libpcap/inet.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/libpcap/inet.c
diff -u src/dist/libpcap/inet.c:1.2 src/dist/libpcap/inet.c:1.2.26.1
--- src/dist/libpcap/inet.c:1.2	Mon Feb 27 15:53:24 2006
+++ src/dist/libpcap/inet.c	Mon Oct  5 11:16:11 2009
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /cvsroot/src/dist/libpcap/inet.c,v 1.2 2006/02/27 15:53:24 drochner Exp $ (LBL)";
+    "@(#) $Header: /cvsroot/src/dist/libpcap/inet.c,v 1.2.26.1 2009/10/05 11:16:11 sborrill Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -573,6 +573,12 @@
 	}
 	sin4 = (struct sockaddr_in *)&ifr.ifr_addr;
 	*netp = sin4->sin_addr.s_addr;
+	memset(&ifr, 0, sizeof(ifr));
+#ifdef linux
+	/* XXX Work around Linux kernel bug */
+	ifr.ifr_addr.sa_family = AF_INET;
+#endif
+	(void)strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
 	if (ioctl(fd, SIOCGIFNETMASK, (char *)&ifr) < 0) {
 		(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
 		    "SIOCGIFNETMASK: %s: %s", device, pcap_strerror(errno));

Reply via email to