From: Guy Harris Date: Sat, 21 Jan 2017 02:59:52 +0000 (-0800) Subject: Some fixes for the new API. X-Git-Tag: libpcap-1.9.0-rc1~7 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/2c6d514e968e0273b0ecf065fc749066a0e746d3?ds=inline Some fixes for the new API. Save the result of the add_dev() call, so that the "#if 0" code could be made to work. (If it can't be made to work, it should be removed, along with the curdev variable and the assignment to it.) Don't pass dev->flags to add_dev(), as that routine expects PCAP_IF_ flags, not IFF_ flags - and we don't have the relevant IFF_ flags anyway (IFF_UP, IFF_RUNNING, IFF_LOOPBACK if that applies). --- diff --git a/pcap-dos.c b/pcap-dos.c index 20428547..457db72a 100644 --- a/pcap-dos.c +++ b/pcap-dos.c @@ -544,6 +544,7 @@ int pcap_lookupnet (const char *device, bpf_u_int32 *localnet, int pcap_platform_finddevs (pcap_if_list_t *devlistp, char *errbuf) { struct device *dev; + pcap_if_t *curdev; #if 0 /* Pkt drivers should have no addresses */ struct sockaddr_in sa_ll_1, sa_ll_2; struct sockaddr *addr, *netmask, *broadaddr, *dstaddr; @@ -562,8 +563,11 @@ int pcap_platform_finddevs (pcap_if_list_t *devlistp, char *errbuf) FLUSHK(); (*dev->close) (dev); - if (add_dev(devlistp, dev->name, dev->flags, - dev->long_name, errbuf) == NULL) + /* + * XXX - find out whether it's up or running? Does that apply here? + */ + if ((curdev = add_dev(devlistp, dev->name, 0, + dev->long_name, errbuf)) == NULL) { ret = -1; break;