bisdn / basebox

A tiny OpenFlow controller for OF-DPA switches.
Mozilla Public License 2.0
45 stars 9 forks source link

nl_bond: make sure to add the default vlan to new members if needed #324

Closed KanjiMonster closed 3 years ago

KanjiMonster commented 3 years ago

When adding an IP address to an interface, we need to add vlan flows for the untagged vlan. Since the assignment flows require physical ports, we need to have them for all bond members.

Currently we do not add or a remove them when adding new members, so the following flow would fail:

sudo ip link add name bond1 type bond mode active-backup sudo ip link set port1 master bond1 sudo ip address add 10.0.0.1/24 dev bond1 sudo ip link set port2 master bond1

To fix this, add a new helper to know if a (bond) interface has any ip addresses configured, and add the default vlan configuration to the port in that case.

client_flowtable_dump 10 output:

Before:

Table ID 10 (VLAN): Retrieving all entries. Max entries = 12288, Current entries = 3. -- inPort = 1 (Physical) vlanId:mask = 0x0000:0x1fff (VLAN 0) | GoTo = 20 (Termination MAC) newVlanId = 0x1001 (VLAN 1) -- inPort = 1 (Physical) vlanId:mask = 0x1001:0x1fff (VLAN 1) | GoTo = 20 (Termination MAC) -- inPort = 1 (Trunk) vlanId:mask = 0x1001:0x1fff (VLAN 1) | GoTo = 20 (Termination MAC)

After:

Table ID 10 (VLAN): Retrieving all entries. Max entries = 12288, Current entries = 5. -- inPort = 1 (Physical) vlanId:mask = 0x0000:0x1fff (VLAN 0) | GoTo = 20 (Termination MAC) newVlanId = 0x1001 (VLAN 1) -- inPort = 1 (Physical) vlanId:mask = 0x1001:0x1fff (VLAN 1) | GoTo = 20 (Termination MAC) -- inPort = 2 (Physical) vlanId:mask = 0x0000:0x1fff (VLAN 0) | GoTo = 20 (Termination MAC) newVlanId = 0x1001 (VLAN 1) -- inPort = 2 (Physical) vlanId:mask = 0x1001:0x1fff (VLAN 1) | GoTo = 20 (Termination MAC) -- inPort = 1 (Trunk) vlanId:mask = 0x1001:0x1fff (VLAN 1) | GoTo = 20 (Termination MAC)

Signed-off-by: Jonas Gorski jonas.gorski@bisdn.de