[I sent the following yesterday but it didn't reach the list so I'm resending with a different from address.]
Hi, There's an unfortunate namespace conflict between the usbnet driver in Linux and libpcap's usbmon pseudo-interfaces: both use usbX names, which leads to surprising results when trying to capture (Ethernet) packets on a USB Ethernet device: since the interface name contains 'usb', pcap_create() assumes that it should do USB capture. This is usually not what the user wants. Changing libpcap's names to 'usbmonX' (which is what the following patch does) would avoid this problem. (For context, see Debian bug report #520259: http://bugs.debian.org/520259) Subject: [PATCH] Change USB device prefix to 'usbmon' Ethernet USB devices (supported by the usbnet driver in Linux) are by default named 'usbX', which is also what libpcap uses for its usbmon pseudo-interfaces. To avoid this namespace conflict, change libpcap's USB interface prefix to 'usbmon'. --- inet.c | 2 +- pcap-linux.c | 2 +- pcap-usb-linux.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/inet.c b/inet.c index 9cd7df7..11efbf4 100644 --- a/inet.c +++ b/inet.c @@ -669,7 +669,7 @@ pcap_lookupnet(device, netp, maskp, errbuf) || strstr(device, "bluetooth") != NULL #endif #ifdef PCAP_SUPPORT_USB - || strstr(device, "usb") != NULL + || strstr(device, "usbmon") != NULL #endif ) { *netp = *maskp = 0; diff --git a/pcap-linux.c b/pcap-linux.c index 43dfe92..9314eec 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -324,7 +324,7 @@ pcap_create(const char *device, char *ebuf) #endif #ifdef PCAP_SUPPORT_USB - if (strstr(device, "usb")) { + if (strstr(device, "usbmon")) { return usb_create(device, ebuf); } #endif diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index 93c3f6d..358865c 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -64,7 +64,7 @@ static const char rcsid[] _U_ = #include <linux/usbdevice_fs.h> #endif -#define USB_IFACE "usb" +#define USB_IFACE "usbmon" #define USB_TEXT_DIR "/sys/kernel/debug/usbmon" #define SYS_USB_BUS_DIR "/sys/bus/usb/devices" #define PROC_USB_BUS_DIR "/proc/bus/usb" -- Romain Francoise <rfranco...@debian.org> http://people.debian.org/~rfrancoise/ - This is the tcpdump-workers list. Visit https://cod.sandelman.ca/ to unsubscribe.