[PATCH 3/3] route/link/vxlan: Add support for link_info compare
David Ahern
dsa at cumulusnetworks.com
Fri Oct 30 15:08:41 PDT 2015
Signed-off-by: Balki Raman <ramanb at cumulusnetworks.com>
Signed-off-by: David Ahern <dsa at cumulusnetworks.com>
---
lib/route/link/vxlan.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/lib/route/link/vxlan.c b/lib/route/link/vxlan.c
index 7e4fe5e30116..dc7be20ecaae 100644
--- a/lib/route/link/vxlan.c
+++ b/lib/route/link/vxlan.c
@@ -400,6 +400,32 @@ static int vxlan_put_attrs(struct nl_msg *msg, struct rtnl_link *link)
return 0;
}
+static int vxlan_compare(struct rtnl_link *link_a, struct rtnl_link *link_b,
+ uint32_t attrs, int flags)
+{
+ struct vxlan_info *a = link_a->l_info;
+ struct vxlan_info *b = link_b->l_info;
+ int diff = 0;
+
+#define VXLAN_DIFF(ATTR, EXPR) ATTR_DIFF(attrs, VXLAN_ATTR_##ATTR, a, b, EXPR)
+
+ diff |= VXLAN_DIFF(ID, a->vxi_id != b->vxi_id);
+ diff |= VXLAN_DIFF(GROUP, a->vxi_group != b->vxi_group);
+ diff |= VXLAN_DIFF(LINK, a->vxi_link != b->vxi_link);
+ diff |= VXLAN_DIFF(LOCAL, a->vxi_local != b->vxi_local);
+ diff |= VXLAN_DIFF(TOS, a->vxi_tos != b->vxi_tos);
+ diff |= VXLAN_DIFF(TTL, a->vxi_ttl != b->vxi_ttl);
+ diff |= VXLAN_DIFF(LEARNING, a->vxi_learning != b->vxi_learning);
+ diff |= VXLAN_DIFF(AGEING, a->vxi_ageing != b->vxi_ageing);
+ diff |= VXLAN_DIFF(PORT_RANGE,
+ a->vxi_port_range.low != b->vxi_port_range.low);
+ diff |= VXLAN_DIFF(PORT_RANGE,
+ a->vxi_port_range.high != b->vxi_port_range.high);
+#undef VXLAN_DIFF
+
+ return diff;
+}
+
static struct rtnl_link_info_ops vxlan_info_ops = {
.io_name = "vxlan",
.io_alloc = vxlan_alloc,
@@ -411,6 +437,7 @@ static struct rtnl_link_info_ops vxlan_info_ops = {
.io_clone = vxlan_clone,
.io_put_attrs = vxlan_put_attrs,
.io_free = vxlan_free,
+ .io_compare = vxlan_compare,
};
/** @cond SKIP */
--
2.1.4
More information about the libnl
mailing list