Hello all,
I have a problem with libpcap, which may or may not be a problem with
BPF but
I thought I'd ask here anyhow, to make sure.
I'm writing an application that listens promiscuously to an interface
and which also
generates packets on the same interface. It is not multithreaded so it
needs to be
able to "poll" for packets without blocking. The problem I'm having is that
pcap_dispatch() sometimes blocks forever, waiting for packets to arrive.
I've
read about this behaviour and the fact that it is something attributed
to BPF, but
the messages I've read have been fairly old (the latest was written in
2002 I think)
and have spoken about previous FreeBSD versions. The pcap manpage is not
very
clear on the subject, IMHO, but it *seems* as if it should work on
FreeBSD 4.11,
which is what I'm using. Another interesting thing I've noticed is that
pcap_dispatch()
only seems to block occasionally when I'm dumping packets from a Intel em(4)
(1000Mbit/GE) interface, not when I use the fxp(4) or rl(4) 100 Mbit/s
interfaces.
On FreeBSD 5.4, however, things seem to work with em(4) interfaces too.
And yes, I have tried using pcap_setnonblocking(), aswell as getting a
selectable
file descriptor and selecting on it before reading, with and without
looking at the
return values from select(). And, like I wrote above, the program works
on FreeBSD
5.4 + em, but not on FreeBSD 4.11 + em.
Can anyone give me some ideas about where I should be looking to find/fix
this problem or if there is any probably workaround?
Thanks,
/Ragnar
-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.