51 lines
1.1 KiB
Text
51 lines
1.1 KiB
Text
|
hunks 1/2: ioctl is needed on !linux
|
||
|
|
||
|
hunk 3: pcap_findalldevs() doesn't include controllers dumpable via
|
||
|
usbpcap, do a separate lookup and add to the list
|
||
|
|
||
|
Index: capture/capture-pcap-util.c
|
||
|
--- capture/capture-pcap-util.c.orig
|
||
|
+++ capture/capture-pcap-util.c
|
||
|
@@ -30,6 +30,8 @@
|
||
|
#include <dlfcn.h>
|
||
|
#endif
|
||
|
|
||
|
+#include <sys/ioctl.h>
|
||
|
+
|
||
|
#include "ws_attributes.h"
|
||
|
|
||
|
/*
|
||
|
@@ -44,8 +46,6 @@
|
||
|
*/
|
||
|
#if defined(HAVE_PCAP_CREATE) && defined(__linux__)
|
||
|
|
||
|
-#include <sys/ioctl.h>
|
||
|
-
|
||
|
/*
|
||
|
* If we're building for a Linux version that supports bonding,
|
||
|
* HAVE_BONDING will be defined.
|
||
|
@@ -689,6 +689,23 @@ get_interface_list_findalldevs(int *err, char **err_st
|
||
|
if_info_ip(if_info, dev);
|
||
|
}
|
||
|
pcap_freealldevs(alldevs);
|
||
|
+
|
||
|
+#ifdef __OpenBSD__
|
||
|
+ int i, f;
|
||
|
+ char buf[50];
|
||
|
+ for (i = 0; i < 10; i++) {
|
||
|
+ snprintf(buf, sizeof buf, "/dev/usb%d", i);
|
||
|
+ f = open(buf, O_RDONLY);
|
||
|
+ if (f >= 0) {
|
||
|
+ snprintf(buf, sizeof buf, "usb%d", i);
|
||
|
+ if_info = if_info_new(buf, "USB", FALSE);
|
||
|
+ il = g_list_append(il, if_info);
|
||
|
+ close(f);
|
||
|
+ } else if (errno == ENOENT || errno == ENXIO) {
|
||
|
+ continue;
|
||
|
+ }
|
||
|
+ }
|
||
|
+#endif
|
||
|
|
||
|
return il;
|
||
|
}
|