mirror of https://github.com/vishvananda/netlink
Add support for NDA_FLAGS_EXT neighboring attribute
This allows to set NTF_EXT_MANAGED neighbor flag for managed neighbor entries as per kernel commit 7482e3841d52 ("net, neigh: Add NTF_MANAGED flag for managed neighbor entries"). The flag then indicates to the kernel that the neighbor entry should be periodically probed for keeping the entry in NUD_REACHABLE state iff possible. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
fc5a223eaf
commit
b08d99c0d0
1
neigh.go
1
neigh.go
|
@ -12,6 +12,7 @@ type Neigh struct {
|
||||||
State int
|
State int
|
||||||
Type int
|
Type int
|
||||||
Flags int
|
Flags int
|
||||||
|
FlagsExt int
|
||||||
IP net.IP
|
IP net.IP
|
||||||
HardwareAddr net.HardwareAddr
|
HardwareAddr net.HardwareAddr
|
||||||
LLIPAddr net.IP //Used in the case of NHRP
|
LLIPAddr net.IP //Used in the case of NHRP
|
||||||
|
|
|
@ -24,7 +24,11 @@ const (
|
||||||
NDA_MASTER
|
NDA_MASTER
|
||||||
NDA_LINK_NETNSID
|
NDA_LINK_NETNSID
|
||||||
NDA_SRC_VNI
|
NDA_SRC_VNI
|
||||||
NDA_MAX = NDA_SRC_VNI
|
NDA_PROTOCOL
|
||||||
|
NDA_NH_ID
|
||||||
|
NDA_FDB_EXT_ATTRS
|
||||||
|
NDA_FLAGS_EXT
|
||||||
|
NDA_MAX = NDA_FLAGS_EXT
|
||||||
)
|
)
|
||||||
|
|
||||||
// Neighbor Cache Entry States.
|
// Neighbor Cache Entry States.
|
||||||
|
@ -47,9 +51,16 @@ const (
|
||||||
NTF_MASTER = 0x04
|
NTF_MASTER = 0x04
|
||||||
NTF_PROXY = 0x08
|
NTF_PROXY = 0x08
|
||||||
NTF_EXT_LEARNED = 0x10
|
NTF_EXT_LEARNED = 0x10
|
||||||
|
NTF_OFFLOADED = 0x20
|
||||||
|
NTF_STICKY = 0x40
|
||||||
NTF_ROUTER = 0x80
|
NTF_ROUTER = 0x80
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Extended Neighbor Flags
|
||||||
|
const (
|
||||||
|
NTF_EXT_MANAGED = 0x00000001
|
||||||
|
)
|
||||||
|
|
||||||
// Ndmsg is for adding, removing or receiving information about a neighbor table entry
|
// Ndmsg is for adding, removing or receiving information about a neighbor table entry
|
||||||
type Ndmsg struct {
|
type Ndmsg struct {
|
||||||
Family uint8
|
Family uint8
|
||||||
|
@ -168,6 +179,11 @@ func neighHandle(neigh *Neigh, req *nl.NetlinkRequest) error {
|
||||||
req.AddData(hwData)
|
req.AddData(hwData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if neigh.FlagsExt != 0 {
|
||||||
|
flagsExtData := nl.NewRtAttr(NDA_FLAGS_EXT, nl.Uint32Attr(uint32(neigh.FlagsExt)))
|
||||||
|
req.AddData(flagsExtData)
|
||||||
|
}
|
||||||
|
|
||||||
if neigh.Vlan != 0 {
|
if neigh.Vlan != 0 {
|
||||||
vlanData := nl.NewRtAttr(NDA_VLAN, nl.Uint16Attr(uint16(neigh.Vlan)))
|
vlanData := nl.NewRtAttr(NDA_VLAN, nl.Uint16Attr(uint16(neigh.Vlan)))
|
||||||
req.AddData(vlanData)
|
req.AddData(vlanData)
|
||||||
|
@ -306,6 +322,8 @@ func NeighDeserialize(m []byte) (*Neigh, error) {
|
||||||
} else {
|
} else {
|
||||||
neigh.HardwareAddr = net.HardwareAddr(attr.Value)
|
neigh.HardwareAddr = net.HardwareAddr(attr.Value)
|
||||||
}
|
}
|
||||||
|
case NDA_FLAGS_EXT:
|
||||||
|
neigh.FlagsExt = int(native.Uint32(attr.Value[0:4]))
|
||||||
case NDA_VLAN:
|
case NDA_VLAN:
|
||||||
neigh.Vlan = int(native.Uint16(attr.Value[0:2]))
|
neigh.Vlan = int(native.Uint16(attr.Value[0:2]))
|
||||||
case NDA_VNI:
|
case NDA_VNI:
|
||||||
|
|
Loading…
Reference in New Issue