summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-12-02 01:23:47 +0100
committerTom Gundersen <teg@jklm.no>2014-12-02 10:19:52 +0100
commite559b38493e6e0bc0214af2bce5aa940a8a15006 (patch)
tree1c5539efffeb5c085f5218ee9cdacac1e444bb6d /src
parent64918838d566058b7cec72d13f4524de0a64a8e3 (diff)
sd-rtnl: add typesystem for RTM_*NEIGH
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-rtnl/rtnl-types.c22
-rw-r--r--src/systemd/sd-rtnl.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c
index b6c483c3b1..a1db2ab76c 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -329,6 +329,25 @@ static const NLTypeSystem rtnl_route_type_system = {
.types = rtnl_route_types,
};
+static const NLType rtnl_neigh_types[NDA_MAX + 1] = {
+ [NDA_DST] = { .type = NLA_IN_ADDR },
+ [NDA_LLADDR] = { .type = NLA_ETHER_ADDR },
+/*
+ NDA_CACHEINFO,
+ NDA_PROBES,
+ NDA_VLAN,
+ NDA_PORT
+ NDA_VNI
+ NDA_IFINDEX
+ NDA_MASTER
+*/
+};
+
+static const NLTypeSystem rtnl_neigh_type_system = {
+ .max = ELEMENTSOF(rtnl_neigh_types) - 1,
+ .types = rtnl_neigh_types,
+};
+
static const NLType rtnl_types[RTM_MAX + 1] = {
[NLMSG_ERROR] = { .type = NLA_META, .size = sizeof(struct nlmsgerr) },
[RTM_NEWLINK] = { .type = NLA_NESTED, .type_system = &rtnl_link_type_system, .size = sizeof(struct ifinfomsg) },
@@ -341,6 +360,9 @@ static const NLType rtnl_types[RTM_MAX + 1] = {
[RTM_NEWROUTE] = { .type = NLA_NESTED, .type_system = &rtnl_route_type_system, .size = sizeof(struct rtmsg) },
[RTM_DELROUTE] = { .type = NLA_NESTED, .type_system = &rtnl_route_type_system, .size = sizeof(struct rtmsg) },
[RTM_GETROUTE] = { .type = NLA_NESTED, .type_system = &rtnl_route_type_system, .size = sizeof(struct rtmsg) },
+ [RTM_NEWNEIGH] = { .type = NLA_NESTED, .type_system = &rtnl_neigh_type_system, .size = sizeof(struct ndmsg) },
+ [RTM_DELNEIGH] = { .type = NLA_NESTED, .type_system = &rtnl_neigh_type_system, .size = sizeof(struct ndmsg) },
+ [RTM_GETNEIGH] = { .type = NLA_NESTED, .type_system = &rtnl_neigh_type_system, .size = sizeof(struct ndmsg) },
};
const NLTypeSystem rtnl_type_system = {
diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h
index 0d17b16eb0..14eb9b802e 100644
--- a/src/systemd/sd-rtnl.h
+++ b/src/systemd/sd-rtnl.h
@@ -26,6 +26,7 @@
#include <netinet/in.h>
#include <netinet/ether.h>
#include <linux/rtnetlink.h>
+#include <linux/neighbour.h>
#include "sd-event.h"
#include "_sd-common.h"