diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2015-10-27 22:39:55 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-11-01 17:18:16 (GMT) |
commit | 5f044aca765fa6620b389b50deee9cf49c1efe35 (patch) | |
tree | f400911b3713d5a564398ed0cef5d15836475b9a | |
parent | 493bbd13e6d96c61e844dd1c04aa7218d0b7da08 (diff) | |
download | libnl-5f044aca765fa6620b389b50deee9cf49c1efe35.zip libnl-5f044aca765fa6620b389b50deee9cf49c1efe35.tar.gz libnl-5f044aca765fa6620b389b50deee9cf49c1efe35.tar.bz2 |
neigh: add support for NTF_SELF
http://lists.infradead.org/pipermail/libnl/2015-October/001995.html
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | include/linux-private/linux/neighbour.h | 2 | ||||
-rw-r--r-- | lib/route/neigh.c | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/include/linux-private/linux/neighbour.h b/include/linux-private/linux/neighbour.h index c261b3c..969f352 100644 --- a/include/linux-private/linux/neighbour.h +++ b/include/linux-private/linux/neighbour.h @@ -31,6 +31,8 @@ enum { */ #define NTF_USE 0x01 +#define NTF_SELF 0x02 +#define NTF_MASTER 0x04 #define NTF_PROXY 0x08 /* == ATF_PUBL */ #define NTF_ROUTER 0x80 diff --git a/lib/route/neigh.c b/lib/route/neigh.c index ca7e693..ab07ec9 100644 --- a/lib/route/neigh.c +++ b/lib/route/neigh.c @@ -233,10 +233,14 @@ static void neigh_keygen(struct nl_object *obj, uint32_t *hashkey, return; } nkey->n_family = neigh->n_family; - if (neigh->n_family == AF_BRIDGE) - nkey->n_ifindex = neigh->n_master; - else + if (neigh->n_family == AF_BRIDGE) { + if (neigh->n_flags & NTF_SELF) + nkey->n_ifindex = neigh->n_ifindex; + else + nkey->n_ifindex = neigh->n_master; + } else nkey->n_ifindex = neigh->n_ifindex; + if (addr) memcpy(nkey->n_addr, nl_addr_get_binary_addr(addr), @@ -310,9 +314,12 @@ static uint32_t neigh_id_attrs_get(struct nl_object *obj) { struct rtnl_neigh *neigh = (struct rtnl_neigh *)obj; - if (neigh->n_family == AF_BRIDGE) - return (NEIGH_ATTR_LLADDR | NEIGH_ATTR_FAMILY | NEIGH_ATTR_MASTER); - else + if (neigh->n_family == AF_BRIDGE) { + if (neigh->n_flags & NTF_SELF) + return (NEIGH_ATTR_LLADDR | NEIGH_ATTR_FAMILY | NEIGH_ATTR_IFINDEX); + else + return (NEIGH_ATTR_LLADDR | NEIGH_ATTR_FAMILY | NEIGH_ATTR_MASTER); + } else return (NEIGH_ATTR_IFINDEX | NEIGH_ATTR_DST | NEIGH_ATTR_FAMILY); } |