Subject: lib/9929: pcap_lookupdev picks up interfaces that are not attached to BPF
To: None <gnats-bugs@gnats.netbsd.org>
From: None <itojun@itojun.org>
List: netbsd-bugs
Date: 04/18/2000 19:58:13
>Number: 9929
>Category: lib
>Synopsis: pcap_lookupdev picks up interfaces that are not attached to BPF
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Apr 18 19:59:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Jun-ichiro itojun Hagino
>Release: all versions latest current
>Organization:
itojun.org
>Environment:
NetBSD starfruit.itojun.org 1.4X NetBSD 1.4X (STARFRUIT) #182: Mon Apr 17 00:15:03 JST 2000 itojun@starfruit.itojun.org:/usr/home/itojun/NetBSD/src/sys/arch/i386/compile/STARFRUIT i386
>Description:
from manpage for pcap_lookupdev(3) :
> pcap_lookupdev() returns a pointer to a network device
> suitable for use with pcap_open_live() and pcap_lookup-
> net(). If there is an error, NULL is returned and errbuf
> is filled in with with an appropriate error message.
however, pcap_lookupdev() picks up interfaces that do not call
bpfattach(). it looks unsuitable for me to pick up an interface
that will fail on pcap_open_live().
>How-To-Repeat:
on laptop,
# tcpdump -n
tcpdump will pick up eon0 as interface, and since eon0 does not
call bpfattach, it will fail.
>Fix:
try calling pcap_open_live() in pcap_lookupdev() loop, return only if
pcap_open_live() is successful.
the bug is actually from LBL libpcap. we should fix it for libpcap in
tcpdump.org (where libpcap is maintained now) and then bring it
back to netbsd-current.
>Release-Note:
>Audit-Trail:
>Unformatted: