LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File libpcap-1.1.1-scanif.patch of Package libpcap (Project home:Friseer:openSUSE:server)

pcap_findalldevs was failing when use bonding device.

In /sys/class/net, there are these for bonding:
drwxr-xr-x 4 root root 0 Apr 27 16:12 bond0
-rw-r--r-- 1 root root 4096 Apr 27 16:11 bonding_masters

When scan_sys_class_net encounters the bonding_masters file, the ioctl below fails with "no device".

This patch fixes it.
Index: pcap-linux.c
===================================================================
--- pcap-linux.c
+++ pcap-linux.c
@@ -1883,7 +1883,7 @@ scan_sys_class_net(pcap_if_t **devlistp,
 		 */
 		strncpy(ifrflags.ifr_name, name, sizeof(ifrflags.ifr_name));
 		if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifrflags) < 0) {
-			if (errno == ENXIO)
+			if (errno == ENXIO || errno == ENODEV)
 				continue;
 			(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
 			    "SIOCGIFFLAGS: %.*s: %s",