23 lines
802 B
Diff
23 lines
802 B
Diff
|
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",
|