bisdn / basebox

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

properly take over ip configuration on bridge/bond attachment #314

Closed rubensfig closed 3 years ago

rubensfig commented 3 years ago

Properly take over configured IP addresses and routes on (first) attachment to bond and bridge interfaces.

Description

Currently the code does checks for ip and route configuration if it applies to interfaces linked to port interfaces, and ignores if it it doesn't. This makes sense at first, but breaks if the configuration might get added before port interfaces do get attached.

We do attempt to take over IP address configuration on bond interfaces, but miss configuration on linked vlan interfaces, and all configuration on bridge interfaces. Configured routes are completely ignored.

This PR attempts fixing the situation by expanding the code adding the ip addresses to also check all linked vlan interfaces, check the route cache for routes, and also call this on initial attachment to the bridge.

Motivation and Context

Currently IP configuration on vlan interfaces can get lost on the following order of network events:

  1. create bridge
  2. create SVI on top of bridge
  3. add ip addresss to SVI
  4. set bridge as master for port interfaces

At step three we will see that the brige has no port interfaces, so we ignore the IP address, but then at step 4 we don't scan the interface and add the IP address later.

So we need to be ready to take over the configuration on attachment.

How Has This Been Tested?

A pipeline was run on Questone 2A