From 68787acabe47234d8621a20f201ad95724632685 Mon Sep 17 00:00:00 2001 From: William Robinet Date: Fri, 28 Aug 2020 18:24:47 +0200 Subject: [PATCH] Fix deprecation warning from libcap 1.9.1 --- base/pcap-snoop.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/base/pcap-snoop.c b/base/pcap-snoop.c index e965294..bab93fb 100644 --- a/base/pcap-snoop.c +++ b/base/pcap-snoop.c @@ -283,6 +283,7 @@ int main(argc,argv) extern char *optarg; extern int optind; #endif + pcap_if_t *interfaces; char *interface_name=0; char *file=0; char *filter=0; @@ -382,7 +383,11 @@ int main(argc,argv) if(!file){ if(!interface_name){ - interface_name=pcap_lookupdev(errbuf); + if(pcap_findalldevs(&interfaces,errbuf)==-1) { + fprintf(stderr,"PCAP: %s\n",errbuf); + err_exit("Aborting",-1); + } + interface_name=interfaces->name; if(!interface_name){ fprintf(stderr,"PCAP: %s\n",errbuf); err_exit("Aborting",-1);