Subject: Adding a layered virtual interface (not streams!)
To: None <tech-net@netbsd.org>
From: Andrew Gillham <gillhaa@ghost.whirlpool.com>
List: tech-net
Date: 02/22/1999 23:21:42
Hello,

I'm a wannabe kernel hacker, so forgive any stupid questions.
I would like to find out what it would take to insert/implement an 
interface layer between a low-level driver (ethernet, perhaps 'de')
and the 'ether' code in if_ethersubr.c.  My goal would be to create
a virtual driver (or several) that has multiple physical interfaces
attached to it.  Ideally the virtual interface would be capable of
talking Fast EtherChannel with a Cisco switch.  Another possible
implementation would be a 'bvi' or Bridged Virtual Interface that
is a routable interface to a bridge group of multiple ethernets.
Of course that assumes bridging support. :)

So what I'm thinking of, is something like this.
Autoconfig:
	pseudo-device ve attached. 've0', 've1', etc. ("Virtual Ethernet")
	-- or --
	pseudo-device eth attached. 'eth0', 'eth1', etc. (ala linux)
	-- or --
	pseudo-device bvi attached. 'bvi0', 'bvi1', etc.
	pseudo-device fec attached. 'fec0', 'fec1', etc.
	pseudo-device gec attached. 'gec0', 'gec1', etc.

	hardware device de0 attached.
	hardware device de1 attached.
	hardware device de2 attached.
	hardware device de3 attached.

/etc/netstart ideas:
	"cisco fast|gig etherchannel"
	ifconfig de0 media 100basetx mediaopt full-duplex
	ifconfig de1 media 100basetx mediaopt full-duplex
	ifconfig ve0 -attach de0
	ifconfig ve0 -attach de1
	ifconfig ve0 -attach de2
	ifconfig ve0 -attach de3
	ifconfig ve0 -mode fec
	ifconfig ve0 inet 10.1.1.1 ...

	"bridging" (and "integrated routing and bridging")
	ifconfig ve0 -attach de0
	ifconfig ve0 -attach de1
	ifconfig ve0 -attach de2
	ifconfig ve0 -mode bridge
	ifconfig ve0 inet 10.1.1.1 ...	 (bridges de0/de1/de2 subnets)
	ifconfig de3 inet 10.1.2.1 ...   (routes from de3 to ve0, etc)

	"ve0/eth0 alias"
	ifconfig ve0 -attach de0
	ifconfig ve0 inet 10.1.1.1 ...   (ve0 or eth0 is an alias)

So, I've got grand ideas.. :)  Anyway, I'm not sure how to go about
wedging this concept into the kernel.  I would want to have the virtual
ethernet or 've' driver attach itself as a "normal" ethernet interface,
and have the physical devices "attacheable" to it.  Without the ability
to detach/re-attach interfaces, I can only imagine having to hardcode
the configuration in the device driver. (and, I'm not even sure the code
for detach/re-attach will do what I think it will)  This would be much
like the checks for bpf, except the device would attach to only the
've' driver if it was configured to.

I would like to solicit feedback on this whole concept, and perhaps some
tips/pointers/smacks on the head/whatever to help me figure how to get
something like this working!

Thanks.

-Andrew
-- 
-----------------------------------------------------------------
Andrew Gillham                            | This space left blank
gillham@whirlpool.com                     | inadvertently.
I speak for myself, not for my employer.  | Contact the publisher.