mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-14 03:43:42 +00:00
netlink: add L2 bridge/bond/vlan intermediate drivers
This adds three new L2 (intermediate) drivers for bridge/bond/vlan.
Theses drivers are incomplete but illustrate how to stack L2 drivers.
Here are some examples of how these driver would stack with the cy243439
driver:
Bridge: bridge two cyw43 devices together, connecting the two LANs:
cyw43_0 := cyw43439.NewDevice(...)
cyw43_1 := cyw43439.NewDevice(...)
bridge := NewBridge([]netlink.Netlinker{cyw43_0, cyw43_1})
stack := tcpip.NewStack(bridge)
netdev.UseNetdev(stack)
Bond: bond two cyw43 devices together, creating one logical device.
The first physical device is primary, the second is backup (fail-over)
device:
cyw43_0 := cyw43439.NewDevice(...) // primary
cyw43_1 := cyw43439.NewDevice(...) // secondary (backup)
bond := NewBond([]netlink.Netlinker{cyw43_0, cyw43_1})
stack := tcpip.NewStack(bond)
netdev.UseNetdev(stack)
Vlan: add tagged VLAN ID=100 to cyw43:
cyw43 := cyw43439.NewDevice(...)
vlan100 := NewVlan(100, cyw43)
stack := tcpip.NewStack(vlan100)
netdev.UseNetdev(stack)
This commit is contained in:
+1
-1
@@ -99,5 +99,5 @@ type Netlinker interface {
|
||||
|
||||
// RecvEth callback function for receiving Ethernet pkt
|
||||
// TODO describe content of pkt
|
||||
RecvEthFunc(func(pkt []byte) error)
|
||||
RecvEthFunc(cb func(pkt []byte) error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user