X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/69fcdc66ba2b352ea1c79277d3815e55f7c8ab34..4e145de1143f597ef8277b51c5524af1e994f277:/tests/valgrindtest.c diff --git a/tests/valgrindtest.c b/tests/valgrindtest.c index 9d9e9a29..6bb6d4f6 100644 --- a/tests/valgrindtest.c +++ b/tests/valgrindtest.c @@ -64,7 +64,7 @@ The Regents of the University of California. All rights reserved.\n"; #include #include -#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) {