reassing 516089 libpcap0.8 1.0.0-1
retitle 516089 libpcap0.8: Can't get USB bus index...
thanks

(The original bug report was misleading, please don't bother reading it.)

It is impossible to open a device which contains "usb" in the middle of its name.


$ cat pcapbug.c

#include <pcap/pcap.h>

int main(int argc, char **argv)
{
     char error_buffer[PCAP_ERRBUF_SIZE];
     pcap_t *handle;
     if (argc != 2)
     {
       fprintf(stderr, "pcapbug <iface>\n");
       return 1;
     }
     handle = pcap_open_live(argv[1], BUFSIZ, 1, 10, error_buffer);
     if (handle == NULL)
     {
       fprintf(stderr, "%s\n", error_buffer);
       return 1;
     }
     return 0;
}

$ gcc -Wall pcapbug.c -o pcapbug -l pcap

$ ./pcapbug busby
Can't get USB bus index from busby

--
Jakub Wilk
diff --git a/pcap-linux.c b/pcap-linux.c
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -304,25 +304,25 @@
 		device = "any";
 
 #ifdef HAVE_DAG_API
-	if (strstr(device, "dag")) {
+	if (strstr(device, "dag") == device) {
 		return dag_create(device, ebuf);
 	}
 #endif /* HAVE_DAG_API */
 
 #ifdef HAVE_SEPTEL_API
-	if (strstr(device, "septel")) {
+	if (strstr(device, "septel") == device) {
 		return septel_create(device, ebuf);
 	}
 #endif /* HAVE_SEPTEL_API */
 
 #ifdef PCAP_SUPPORT_BT
-	if (strstr(device, "bluetooth")) {
+	if (strstr(device, "bluetooth") == device) {
 		return bt_create(device, ebuf);
 	}
 #endif
 
 #ifdef PCAP_SUPPORT_USB
-	if (strstr(device, "usb")) {
+	if (strstr(device, "usb") == device) {
 		return usb_create(device, ebuf);
 	}
 #endif

Reply via email to