I am trying to learn how to implement virtual interfaces using the Tap driver.
So far my understanding is that using the tap driver I can create a virtual interface and then have a userspace program attach to this interface to analyse the data coming into this device.
Now what if I attach a cisco switch to my LAN interface using a TRUNK link, forward all the packets coming into the LAN interface to the virtual tap interface and then in my program attached to this interface do some coding to analyze the vlan tag in the packet and only allow certain vlans to be forwarded to the WAN interface?
Does this sound plausible or is there is flaw in my basic understanding?
Update: Now that I have played more with it I have few more questions:
So i have my tun interface created (tun0) that does receive packets. With these packets I am doing some filtering (allowing/dropping) based on the "SRC MAC Address" in the ethernet frame. The question, how do I send the allowed packets to one of my WAN interfaces (eth0) now?