summaryrefslogtreecommitdiffhomepage
path: root/pkg/abi/linux
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2021-02-08 15:47:02 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2021-09-24 18:54:58 +0000
commit96667cf4a3c30726cb4242f749afcee42ce7cd43 (patch)
treea2518b5e8aa07ca3396a8967a9d58081309808eb /pkg/abi/linux
parent12175748aba75c0b3be5b3981763c1a1f5e73763 (diff)
netlink: Implement neighbor messages
Implement dumpNeighbors, newNeigh and delNeigh. Fixes #5744
Diffstat (limited to 'pkg/abi/linux')
-rw-r--r--pkg/abi/linux/netlink_route.go64
1 files changed, 64 insertions, 0 deletions
diff --git a/pkg/abi/linux/netlink_route.go b/pkg/abi/linux/netlink_route.go
index 581a11b24..932a06bac 100644
--- a/pkg/abi/linux/netlink_route.go
+++ b/pkg/abi/linux/netlink_route.go
@@ -352,3 +352,67 @@ type RtAttr struct {
// SizeOfRtAttr is the size of RtAttr.
const SizeOfRtAttr = 4
+
+// NeighborMessage is struct ifaddrmsg, from uapi/linux/if_addr.h.
+//
+// +marshal
+type NeighborMessage struct {
+ Family uint8
+ Pad1 uint8
+ Pad2 uint16
+ IfIndex int32
+ State uint16
+ Flags uint8
+ Type uint8
+}
+
+// Neighbor attributes, from uapi/linux/if_addr.h.
+const (
+ NDA_UNSPEC = 0
+ NDA_DST = 1
+ NDA_LLADDR = 2
+ NDA_CACHEINFO = 3
+ NDA_PROBES = 4
+ NDA_VLAN = 5
+ NDA_PORT = 6
+ NDA_VNI = 7
+ NDA_IFINDEX = 8
+ NDA_MASTER = 9
+ NDA_LINK_NETNSID = 10
+ NDA_SRC_VNI = 11
+ NDA_PROTOCOL = 12 /* Originator of entry */
+)
+
+// Neighbor Cache Entry Flags, from uapi/linux/neighbour.h
+const (
+ NTF_USE = 0x01
+ NTF_SELF = 0x02
+ NTF_MASTER = 0x04
+ NTF_PROXY = 0x08 /* == ATF_PUBL */
+ NTF_EXT_LEARNED = 0x10
+ NTF_OFFLOADED = 0x20
+ NTF_STICKY = 0x40
+ NTF_ROUTER = 0x80
+)
+
+// Neighbor Cache Entry States.
+const (
+ NUD_INCOMPLETE = 0x01
+ NUD_REACHABLE = 0x02
+ NUD_STALE = 0x04
+ NUD_DELAY = 0x08
+ NUD_PROBE = 0x10
+ NUD_FAILED = 0x20
+
+ /* Dummy states */
+ NUD_NOARP = 0x40
+ NUD_PERMANENT = 0x80
+ NUD_NONE = 0x00
+)
+
+type NeighborCacheInfo struct {
+ Confirmed uint32
+ Used uint32
+ Updated uint32
+ RefCount uint32
+}