Subject: Re: /dev/tap and tcpdump don't go together very well?
To: Greg Troxel <gdt@ir.bbn.com>
From: Rhialto <rhialto@falu.nl>
List: current-users
Date: 04/11/2007 21:23:58
On Tue 10 Apr 2007 at 10:33:55 -0400, Greg Troxel wrote:
> This is why you want to use a bridge to connect the physical Ethernet to
> the virtual Ethernet that has the tap0 (on the host) and the emulated
> machine's interface.

I am now trying to code something like that, and I am struck with the
strangely different way that one has to create a bridge(4) compared to
creating a tap(4).

For a tap(4), one open(2)s /dev/tap, and asks with
ioctl(,TAPGIFNAME,...) which number one got.

Same, more or less, with bpf(4) except that the number isn't
interesting. The old way was to try /dev/bpf0, /dev/bpf1, etc, until
successful.

bridge(4) is a lot more inconvenient. There is only
ioctl(,SIOCIFCREATE,) and you must try it with bridge0, bridge1, etc,
until successful.

And yet, ifconfig -C lists bridge as a cloning device.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert      -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl        -- Cetero censeo "authored" delendum esse.