I found a bug in libpcap 1.1.1 pcap-linux.c scan_sys_class_net.
pcap_findalldevs was failing when I used bonding device under CentOS 5.4.
In /sys/class/net, I see 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.
--- pcap-linux.c.org 2010-04-27 14:33:23.000000000 -0500
+++ pcap-linux.c 2010-04-27 14:33:52.000000000 -0500
@@ -1883,7 +1883,7 @@
*/
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",
patch for scan_sys_class_net
Checked in and pushed to the main and 1.1 branches.
Administrators of the "libpcap" SourceForge project have superseded this tracker item (formerly artifact 2993250, now patch 48) with issue 244 of the "libpcap" GitHub project.