[PATCH] neigh: Add support for NTF_SELF
David Ahern
dsa at cumulusnetworks.com
Tue Oct 27 15:39:55 PDT 2015
Signed-off-by: Roopa Prabhu <roopa at cumulusnetworks.com>
Signed-off-by: David Ahern <dsa at cumulusnetworks.com>
---
include/linux-private/linux/neighbour.h | 3 +++
lib/route/neigh.c | 19 +++++++++++++------
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/include/linux-private/linux/neighbour.h b/include/linux-private/linux/neighbour.h
index c261b3c1b393..3a6b3e885797 100644
--- a/include/linux-private/linux/neighbour.h
+++ b/include/linux-private/linux/neighbour.h
@@ -34,6 +34,9 @@ enum {
#define NTF_PROXY 0x08 /* == ATF_PUBL */
#define NTF_ROUTER 0x80
+#define NTF_SELF 0x02
+#define NTF_MASTER 0x04
+
/*
* Neighbor Cache Entry States.
*/
diff --git a/lib/route/neigh.c b/lib/route/neigh.c
index ca7e6937c779..ab07ec9cc8d3 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);
}
--
2.1.4
More information about the libnl
mailing list