networkd: add FDB support

This commit is contained in:
Alin Rauta
2014-12-18 15:28:16 +01:00
committed by Tom Gundersen
parent c2551e7105
commit b98b483bac
10 changed files with 402 additions and 11 deletions
+55 -1
View File
@@ -220,6 +220,58 @@ int sd_rtnl_message_new_route(sd_rtnl *rtnl, sd_rtnl_message **ret,
return 0;
}
int sd_rtnl_message_neigh_set_flags(sd_rtnl_message *m, uint8_t flags) {
struct ndmsg *ndm;
assert_return(m, -EINVAL);
assert_return(m->hdr, -EINVAL);
assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
ndm = NLMSG_DATA(m->hdr);
ndm->ndm_flags |= flags;
return 0;
}
int sd_rtnl_message_neigh_set_state(sd_rtnl_message *m, uint16_t state) {
struct ndmsg *ndm;
assert_return(m, -EINVAL);
assert_return(m->hdr, -EINVAL);
assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
ndm = NLMSG_DATA(m->hdr);
ndm->ndm_state |= state;
return 0;
}
int sd_rtnl_message_neigh_get_flags(sd_rtnl_message *m, uint8_t *flags) {
struct ndmsg *ndm;
assert_return(m, -EINVAL);
assert_return(m->hdr, -EINVAL);
assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
ndm = NLMSG_DATA(m->hdr);
*flags = ndm->ndm_flags;
return 0;
}
int sd_rtnl_message_neigh_get_state(sd_rtnl_message *m, uint16_t *state) {
struct ndmsg *ndm;
assert_return(m, -EINVAL);
assert_return(m->hdr, -EINVAL);
assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
ndm = NLMSG_DATA(m->hdr);
*state = ndm->ndm_state;
return 0;
}
int sd_rtnl_message_neigh_get_family(sd_rtnl_message *m, int *family) {
struct ndmsg *ndm;
@@ -255,7 +307,9 @@ int sd_rtnl_message_new_neigh(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t nlm
int r;
assert_return(rtnl_message_type_is_neigh(nlmsg_type), -EINVAL);
assert_return(ndm_family == AF_INET || ndm_family == AF_INET6, -EINVAL);
assert_return(ndm_family == AF_INET ||
ndm_family == AF_INET6 ||
ndm_family == PF_BRIDGE, -EINVAL);
assert_return(ret, -EINVAL);
r = message_new(rtnl, ret, nlmsg_type);
+6 -9
View File
@@ -332,15 +332,12 @@ static const NLTypeSystem rtnl_route_type_system = {
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
*/
[NDA_CACHEINFO] = { .type = NLA_CACHE_INFO, .size = sizeof(struct nda_cacheinfo) },
[NDA_PROBES] = { .type = NLA_U32 },
[NDA_VLAN] = { .type = NLA_U16 },
[NDA_PORT] = { .type = NLA_U16 },
[NDA_VNI] = { .type = NLA_U32 },
[NDA_IFINDEX] = { .type = NLA_U32 },
};
static const NLTypeSystem rtnl_neigh_type_system = {