From: andy-1 Date: Wed, 28 Apr 2010 06:33:23 +0000 (-0700) Subject: Ignore /sys/net/dev files if we get ENODEV for them, not just ENXIO. X-Git-Tag: libpcap-1.2.1~85^2~60 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/073a8b37f97b684a34d29800400879e4e902ff63?ds=sidebyside Ignore /sys/net/dev files if we get ENODEV for them, not just ENXIO. Both of them are indications that there's no such interface, so the file probably corresponds to something other than a device. Reviewed-By: Guy Harris --- diff --git a/CREDITS b/CREDITS index 0d237833..6efc1888 100644 --- a/CREDITS +++ b/CREDITS @@ -15,6 +15,7 @@ Additional people who have contributed patches: Alexey Kuznetsov Alon Bar-Lev Andrew Brown + Antti Kantee Arien Vijn Arkadiusz Miskiewicz diff --git a/pcap-linux.c b/pcap-linux.c index af125433..de3239aa 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -1883,7 +1883,7 @@ scan_sys_class_net(pcap_if_t **devlistp, char *errbuf) */ 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",