f-42: netif: MAC de la passerelle NAT, retrait d'une entrée FDB locale #42

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-29 13:54:31 +01:00
commit 205c04eb34
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
4 changed files with 69 additions and 1 deletions

View file

@ -4,6 +4,7 @@ package netif
import (
"bytes"
"errors"
"net"
"syscall"
@ -49,3 +50,14 @@ func BridgeHasLocalMAC(bridge string, mac net.HardwareAddr) (bool, error) {
}
return hasBridgeLocalMAC(entries, link.Attrs().Index, mac), nil
}
func BridgeDelLocalMACIfExists(bridge string, mac net.HardwareAddr) error {
link, err := netlink.LinkByName(bridge)
if err != nil {
return err
}
if err := netlink.NeighDel(bridgeLocalEntry(link.Attrs().Index, mac)); err != nil && !errors.Is(err, syscall.ENOENT) {
return err
}
return nil
}