bisdn / basebox

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

Handle MAC address changes on tap interfaces #323

Closed rubensfig closed 3 years ago

rubensfig commented 3 years ago

Description

This PR adds handling of changing MAC addresses on the TAP interfaces. When doing commands like,

$ ip link set PORT address MAC_ADDRESS 

The linux mac address will change to the one specified. When this change is triggered, kernel sends two notifications, the first one related to the change of the address itself. The next one will be flushing the ip neighs on the interface.

The changing of mac addresses on the tap interfaces is relevant when there are IP addresses/ neighs/ routes configured on the interface. baseboxd must pick up the notification and change the entries in the termination mac table and egress l3 unicast group. Since there are maps following the entries in these tables, and associated refcounts, they must also be updated.

Motivation and Context

Setting new mac addresses in tap interfaces is a management operation that should be supported in baseboxd. After the mac are reset, connectivity should still continue. For example, since https://github.com/systemd/systemd/commit/550c8784c5, the mac addresses will be reset on baseboxd startup. If there are races between baseboxd setting the ASIC entries and the rewrite of the mac address, that can potentially leave pending entries in the asic, making the system unusable.

How Has This Been Tested?