netconfig: don’t try to add bridge to itself

This commit is contained in:
Michael Stapelberg 2021-06-12 22:24:38 +02:00
parent bfb94377f4
commit b88ddd41c3

View File

@ -271,6 +271,11 @@ func applyBridges(cfg *InterfaceConfig) error {
if !interfaces[addr] {
continue
}
if attr.Name == bridge.Name {
// Dont try to add the bridge to itself: the bridge will take
// the MAC address of the first interface.
continue
}
log.Printf("adding interface %s to bridge %s", attr.Name, bridge.Name)
if err := netlink.LinkSetMaster(l, bridgeLink); err != nil {
return fmt.Errorf("LinkSetMaster(%s): %v", attr.Name, err)