]> The Tcpdump Group git mirrors - libpcap/blobdiff - tests/valgrindtest.c
Clean up the ether_hostton() stuff.
[libpcap] / tests / valgrindtest.c
index 9d9e9a29e0fe96fd7dd13fe57a34e450f0b10459..6bb6d4f6d839c6fedc408585f5ab4337f0b9461a 100644 (file)
@@ -64,7 +64,7 @@ The Regents of the University of California.  All rights reserved.\n";
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include "../funcattrs.h"
+#include "pcap/funcattrs.h"
 
 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 /* BSD-flavored OS - use BPF */
@@ -232,6 +232,7 @@ main(int argc, char **argv)
        char ebuf[PCAP_ERRBUF_SIZE];
        char *infile;
        char *cmdbuf;
+       pcap_if_t *devlist;
        pcap_t *pd;
        int status = 0;
        int pcap_fd;
@@ -286,11 +287,12 @@ main(int argc, char **argv)
                 * No interface specified; get whatever pcap_lookupdev()
                 * finds.
                 */
-               device = pcap_lookupdev(ebuf);
-               if (device == NULL) {
-                       error("couldn't find interface to use: %s",
-                           ebuf);
-               }
+               if (pcap_findalldevs(&devlist, ebuf) == -1)
+                       error("%s", ebuf);
+               if (devlist == NULL)
+                       error("no interfaces available for capture");
+               device = strdup(devlist->name);
+               pcap_freealldevs(devlist);
        }
 
        if (infile != NULL) {