netlink
netlink copied to clipboard
Documentation / Tutorial for bridge fdb append
I'm trying to replicate the following command using this library:
bridge fdb append to 00:00:00:00:00:00 dst 10.225.152.85 dev vxlan0
The documentation of NeighAppend says:
NeighAppend will append an entry to FDB. Equivalent to: bridge fdb append...
I tried the following snippet:
link, err := netlink.LinkByName("vxlan0")
if err != nil {
return err
}
neigh := &netlink.Neigh{
LinkIndex: link.Attrs().Index,
State: netlink.NUD_PERMANENT,
IP: net.IPv4(10, 225, 152, 85),
HardwareAddr: net.HardwareAddr{0, 0, 0, 0, 0, 0},
}
if err := netlink.NeighAppend(neigh); err != nil {
return err
}
Expected behaviour
A bridge fdb entry like the following is added (output of bridge fdb show):
00:00:00:00:00:00 dev vxlan0 dst 10.225.152.85 self permanent
Actual result
No entry are added to the bridge fdb. The following neighbor is added to the arp table instead (output of ip neigh show):
10.225.152.85 dev vxlan0 lladdr 00:00:00:00:00:00 PERMANENT
The #439 is a similar question. In the issue, an user advises to use AF_BRIDGE as family. I tried
neigh := &netlink.Neigh{
LinkIndex: link.Attrs().Index,
State: netlink.NUD_PERMANENT,
IP: net.IPv4(10, 225, 152, 85),
HardwareAddr: net.HardwareAddr{0, 0, 0, 0, 0, 0},
Family: unix.AF_BRIDGE
}
but it doesn't work. The error "operatation not supported" is retrieved in this case.
The #439 is a similar question. In the issue, an user advises to use AF_BRIDGE as family. I tried
neigh := &netlink.Neigh{ LinkIndex: link.Attrs().Index, State: netlink.NUD_PERMANENT, IP: net.IPv4(10, 225, 152, 85), HardwareAddr: net.HardwareAddr{0, 0, 0, 0, 0, 0}, Family: unix.AF_BRIDGE }but it doesn't work. The error "operatation not supported" is retrieved in this case.
Has this problem been solved? @ekoops I've come across the same problem now.
The #439 is a similar question. In the issue, an user advises to use AF_BRIDGE as family. I tried
neigh := &netlink.Neigh{ LinkIndex: link.Attrs().Index, State: netlink.NUD_PERMANENT, IP: net.IPv4(10, 225, 152, 85), HardwareAddr: net.HardwareAddr{0, 0, 0, 0, 0, 0}, Family: unix.AF_BRIDGE }but it doesn't work. The error "operatation not supported" is retrieved in this case.
Has this problem been solved? @ekoops I've come across the same problem now.
I didn't find a solution. Since nobody answered, one year ago I opted for a simple exec.Command as you can see here: https://github.com/polycube-network/polykube/blob/master/node/vxlan.go#L227
Not an elegant solution, but if you don't have any much time to spent on it, it could help.