[PATCH 1/1] fixup! neigh: add support for NDA_VLAN nl attribute

Thomas Haller thaller at redhat.com
Sun Mar 22 14:16:44 PDT 2015


Signed-off-by: Thomas Haller <thaller at redhat.com>
---
Hi Jonas,

I think, this needs also these changes, doesn't it?

Otherwise, your patch looks good to me, I would include it to
upcoming 3.2.26 release.

Thomas

 lib/route/neigh.c | 8 ++++++++
 libnl-route-3.sym | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/lib/route/neigh.c b/lib/route/neigh.c
index b830dc3..1a0da93 100644
--- a/lib/route/neigh.c
+++ b/lib/route/neigh.c
@@ -269,6 +269,7 @@ static int neigh_compare(struct nl_object *_a, struct nl_object *_b,
 	diff |= NEIGH_DIFF(LLADDR,	nl_addr_cmp(a->n_lladdr, b->n_lladdr));
 	diff |= NEIGH_DIFF(DST,		nl_addr_cmp(a->n_dst, b->n_dst));
 	diff |= NEIGH_DIFF(MASTER,	a->n_master != b->n_master);
+	diff |= NEIGH_DIFF(VLAN,	a->n_vlan != b->n_vlan);
 
 	if (flags & LOOSE_COMPARISON) {
 		diff |= NEIGH_DIFF(STATE,
@@ -295,6 +296,8 @@ static const struct trans_tbl neigh_attrs[] = {
 	__ADD(NEIGH_ATTR_FAMILY, family),
 	__ADD(NEIGH_ATTR_TYPE, type),
 	__ADD(NEIGH_ATTR_PROBES, probes),
+	__ADD(NEIGH_ATTR_MASTER, master),
+	__ADD(NEIGH_ATTR_VLAN, vlan),
 };
 
 static char *neigh_attrs2str(int attrs, char *buf, size_t len)
@@ -400,6 +403,11 @@ int rtnl_neigh_parse(struct nlmsghdr *n, struct rtnl_neigh **result)
 		neigh->ce_mask |= NEIGH_ATTR_PROBES;
 	}
 
+	if (tb[NDA_VLAN]) {
+		neigh->n_vlan = nla_get_u16(tb[NDA_VLAN]);
+		neigh->ce_mask |= NEIGH_ATTR_VLAN;
+	}
+
 	/*
 	 * Get the bridge index for AF_BRIDGE family entries
 	 */
diff --git a/libnl-route-3.sym b/libnl-route-3.sym
index 03b7c4e..ad2ed36 100644
--- a/libnl-route-3.sym
+++ b/libnl-route-3.sym
@@ -858,6 +858,8 @@ local:
 
 libnl_3_2_26 {
 global:
+	rtnl_neigh_get_vlan;
+	rtnl_neigh_set_vlan;
 	rtnl_skbedit_get_action;
 	rtnl_skbedit_get_mark;
 	rtnl_skbedit_get_priority;
-- 
1.9.3




More information about the libnl mailing list