Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Sep 2003 00:52:41 -0700
From:      Lev Walkin <vlm@netli.com>
To:        Dmitry Morozovsky <marck@rinet.ru>
Cc:        hackers@freebsd.org
Subject:   Re: if bpf fd's select()able?
Message-ID:  <3F5C3549.8050607@netli.com>
In-Reply-To: <20030908113632.R55683@woozle.rinet.ru>
References:  <20030907233940.M18589@woozle.rinet.ru> <3F5BB991.2050601@netli.com> <20030908113632.R55683@woozle.rinet.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Dmitry Morozovsky wrote:
> On Sun, 7 Sep 2003, Lev Walkin wrote:
> 
> LW> > [all below is for 4-STABLE]
> LW> >
> LW> > I'm trying to write effective arp scanner for multi-interface router (esp.
> LW> > multi-vlan); I plan to use multiple bpf devices attached to different
> LW> > interfaces emitting ARP requests and filters listening to ARP replies; the most
> LW> > natural way to multiplex them for me is select().
> LW> >
> LW> > However, my tests show that select()ing bpf fd does not lead to trigger packets
> LW> > available to bpf filter; the process hangs in select state while parallel
> LW> > tcpdump process shows packets desired *and* is in bpf state.
> LW> >
> LW> > Am I missing something "base"? References (surely, I'd already read
> LW> > manpages for bpf, pcap and related -- but did I still missed something
> LW> > serious?) would be greatly appreciated.
> LW>
> LW> Yes, you're missing the interactive mode.
> LW> Refer to BIOCIMMEDIATE in the bpf(4) manual page.
> 
> Unfortunately not ;-)

Fortunately, yes.

> 	if (ioctl(fd, BIOCPROMISC, NULL) == -1)
> 		err(1, "can't set promisc mode");
> 	if (ioctl(fd, BIOCIMMEDIATE, &yes) == -1)
> 		err(1, "can't set IMMEDIATE mode");

Are you sure that "yes" variable holds the truth value?

-- 
Lev Walkin
vlm@netli.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F5C3549.8050607>