FreeBSD Switching Features

So I've been playing with a FreeBSD virtual setup to test network functionality, and the routing is awesome, especially vlan subinterfaces.

Now I'm trying to make the FreeBSD machine behave as a network switch. One way to do that is to create a bridge and add all the ports to the bridge. This also trunks all VLANs as I discovered.

My two issues are:
  1. Figuring out how to only permit certain VLANs via a specific port (make a port only 'tagged' (or trunk allowed in Cisco-speak) on vlans 30-50, for example)
  2. Figuring out how to set a port to be 'native' (or 'untagged' in HP-speak) on a vlan. So, for example, if a packet came in without a vlan tag on em0, having FreeBSD tag that packet with vlan 5 before processing it, so it is as if the packet came in on em0.5.
Does anyone have any tips on where I could make this work?

The main reason I ask is that for a senior design project I am considering adding certain features to the FreeBSD network stack to be able to create logical switches and routers to which ports are assigned, and I'm trying to see if maybe some of the functionality I haven't figured out how to implement is already there, even if I'm unaware of it.

Thanks!

-gns

EDIT: IOW, for those who are familiar with switch configurations, I'm essentially asking if the following switch config is replicable using FreeBSD native network stack:

em0 - native vlan 4
em1 - trunk pvid vlan 4, trunk allowed vlan 40-90
em2 - trunk pvid vlan 1, trunk allowed vlan 40-90
 
My two issues are:
  1. Figuring out how to only permit certain VLANs via a specific port (make a port only 'tagged' (or trunk allowed in Cisco-speak) on vlans 30-50, for example)
  2. Figuring out how to set a port to be 'native' (or 'untagged' in HP-speak) on a vlan. So, for example, if a packet came in without a vlan tag on em0, having FreeBSD tag that packet with vlan 5 before processing it, so it is as if the packet came in on em0.5.
Does anyone have any tips on where I could make this work?
I don't think you'll be able to do this with a plain FreeBSD bridge(4).
 
I wonder if it is worth developing a separate switch(4) kernel interface to implement those features.

I could probably mostly do it, but I would probably need guidance from the developers. How would I go about talking to them once I have a working implementation put together?

-gns
 
Back
Top