]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
Default to first interface from pcap_findalldevs()
[tcpdump] / tcpdump.c
index ca46638e1662e64fa00f09eaf1126716e30dfd68..a0c627c66361cb9cc2f2fd3f76fbc31db2fc9c98 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1291,7 +1291,12 @@ main(int argc, char **argv)
                 * We're doing a live capture.
                 */
                if (device == NULL) {
+#ifdef HAVE_PCAP_FINDALLDEVS
+                       if (pcap_findalldevs(&devpointer, ebuf) >= 0 && devpointer != NULL)
+                               device = devpointer->name;
+#else /* HAVE_PCAP_FINDALLDEVS */
                        device = pcap_lookupdev(ebuf);
+#endif
                        if (device == NULL)
                                error("%s", ebuf);
                }