tcpdump mailing list archives

pcap_lookupdev returning NULL


From: Vaughan Wickham via tcpdump-workers <tcpdump-workers () lists tcpdump org>
Date: Thu, 5 Nov 2020 01:30:34 +0000

--- Begin Message --- From: Vaughan Wickham <vw () zen net au>
Date: Thu, 5 Nov 2020 01:30:34 +0000
Hello,

I am a pcap newbie, so this is certain to be a mistake on my part; I'm just looking for advice on where to look.

When I run the following code:

#include <stdio.h>
#include <stdlib.h>
#include <pcap.h>

                int main(int argc, char *argv[])
                {
                                char *dev, errbuf[PCAP_ERRBUF_SIZE];

                                dev = pcap_lookupdev(errbuf);
                                if (dev == NULL)
                                {
                                                fprintf(stderr, "Couldn't find default device: %s\n", errbuf);
                                                return(2);
                                }
                                printf("Device: %s\n", dev);
                                return(0);
                }

dev == NULL

dev should be eth0

I'm using CentOS v7

The following packages are installed


  *   libpcap.x86_64
  *   libpcap-devel.x86_64

Would appreciate suggestions on what else to check / try?

Regards,
Vaughan

--- End Message ---
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Current thread: