mirror of
https://github.com/vishvananda/netlink
synced 2025-01-07 07:29:50 +00:00
a1c9a648f7
When subscribing to neigh updates, the updates for all neigh protocol families are received. However when listExisting is set, the request is made with AF_UNSPEC family, this request does not include AF_BRIDGE entries. This patch add a second request for AF_BRIDGE entries. Add test for existing AF_BRIDGE entry and make expectNeighUpdate take a slice of expected updates Creates a VXLAN interface for this test as its AF_BRIDGE entries looks a lot like usual ones Also add support for latest (2014+) neighbour attributes NDA_MASTER was added back in 2014, it indicates whether a neigh entry is linked to a master interface and index of this interface. The other entries, namely NDA_LINK_NETNSID and NDA_SRC_VNI were added later and will need extra handling. Signed-off-by: Nicolas Belouin <nicolas.belouin@gandi.net>
33 lines
638 B
Go
33 lines
638 B
Go
package netlink
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
)
|
|
|
|
// Neigh represents a link layer neighbor from netlink.
|
|
type Neigh struct {
|
|
LinkIndex int
|
|
Family int
|
|
State int
|
|
Type int
|
|
Flags int
|
|
IP net.IP
|
|
HardwareAddr net.HardwareAddr
|
|
LLIPAddr net.IP //Used in the case of NHRP
|
|
Vlan int
|
|
VNI int
|
|
MasterIndex int
|
|
}
|
|
|
|
// String returns $ip/$hwaddr $label
|
|
func (neigh *Neigh) String() string {
|
|
return fmt.Sprintf("%s %s", neigh.IP, neigh.HardwareAddr)
|
|
}
|
|
|
|
// NeighUpdate is sent when a neighbor changes - type is RTM_NEWNEIGH or RTM_DELNEIGH.
|
|
type NeighUpdate struct {
|
|
Type uint16
|
|
Neigh
|
|
}
|