From 824b43d3a13fbb663a2ccdf7b34439a1f319d1cd Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Fri, 22 Apr 2011 12:55:15 +0200 Subject: [PATCH] ignore /sys/net/dev files on ENODEV (#693943) --- libpcap-nodev.patch | 36 ++++++++++++++++++++++++++++++++++++ libpcap.spec | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 libpcap-nodev.patch diff --git a/libpcap-nodev.patch b/libpcap-nodev.patch new file mode 100644 index 0000000..f31becd --- /dev/null +++ b/libpcap-nodev.patch @@ -0,0 +1,36 @@ +commit 02096148c9c407502697cfefbc0aed50eb820bbd +Author: andy-1 +Date: Tue Apr 27 23:33:23 2010 -0700 + + 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 0d23783..6efc188 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 af12543..de3239a 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", diff --git a/libpcap.spec b/libpcap.spec index 7e6f228..e8df5f6 100644 --- a/libpcap.spec +++ b/libpcap.spec @@ -13,6 +13,7 @@ Source: http://www.tcpdump.org/release/%{name}-%{version}.tar.gz Patch1: libpcap-man.patch Patch2: libpcap-multilib.patch Patch3: libpcap-s390.patch +Patch4: libpcap-nodev.patch %description Libpcap provides a portable framework for low-level network @@ -49,6 +50,7 @@ resources needed for developing libpcap applications. %patch1 -p1 -b .man %patch2 -p1 -b .multilib %patch3 -p1 -b .s390 +%patch4 -p1 -b .nodev #sparc needs -fPIC %ifarch %{sparc}