tcpdump mailing list archives

select() regression in libpcap-devel?


From: Mike Kershaw <dragorn () nerv-un net>
Date: Tue, 23 Jun 2009 22:34:50 -0400

I've noticed this a few times, and got reminded of it again recently...

It seems that libpcap-devel did something to the get_selectable_fd()
which causes tools that use it to go into a fast spin on select - the fd
is always 'hot', but there isn't always a packet.  I've noticed this
most with Kismet (or at least, people have complained to me most with
regards to Kismet) but I've seen it happen with wireshark and tcpdump on
my system too when a libpcap-devel is loaded.

My basic pcap usage:

configure wifi device for rfmon
pcap_open
get_selectable_fd
select()
pcap_dispatch cnt=1  when FD is hot

I *do* get packets, but I get them at 100% cpu load, since pcap_dispatch
dumps when it doesn't have a pending packet, but the fd is hot anyhow.

(This now actually hits my error catcher where 100 fd highs in a row
with no packets triggers a shutdown of the source, since libpcap-1.0.0
seems to not return errors in pcap_dispatch when a netdev is removed (ie
usb unplugged or driver crash) and instead returns a 'hot' FD constantly
as well... this is a separate issue however :).

I know the cnt=1 is suboptimal and at some point I'll get around to
rewriting my packet chain to handle it while preserving my other timing,
but it's not the real issue.

-m

-- 
Mike Kershaw/Dragorn <dragorn () kismetwireless net>
GPG Fingerprint: 3546 89DF 3C9D ED80 3381  A661 D7B2 8822 738B BDB1

"Yes, yes, LORD OF HUMANS!  I will rule you ALL with an iron fist!  YOU!
OBEY THE FIST!"
      -- Invader Zim  

Attachment: _bin
Description:


Current thread: