[PATCH] Bug Fix: link_compare: move af_data_compare to the end

roopa at cumulusnetworks.com roopa at cumulusnetworks.com
Fri Feb 15 13:26:29 EST 2013


From: roopa <roopa at cumulusnetworks.com>

In the current code if rtnl_link_af_data_compare returns value > 0
we mark PROTINFO attribute in the diff mask and return without
comparing flags.

This patch makes af_data to be the last thing we compare.

Signed-off-by: Roopa Prabhu <roopa at cumulusnetworks.com>
Reviewed-by: Nolan Leake <nolan at cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm at cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok at cumulusnetworks.com>
---
 lib/route/link.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/route/link.c b/lib/route/link.c
index 7450545..77dd7f1 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -867,6 +867,12 @@ static int link_compare(struct nl_object *_a, struct nl_object *_b,
 	diff |= LINK_DIFF(NUM_RX_QUEUES,a->l_num_rx_queues != b->l_num_rx_queues);
 	diff |= LINK_DIFF(GROUP,	a->l_group != b->l_group);
 
+	if (flags & LOOSE_COMPARISON)
+		diff |= LINK_DIFF(FLAGS,
+				  (a->l_flags ^ b->l_flags) & b->l_flag_mask);
+	else
+		diff |= LINK_DIFF(FLAGS, a->l_flags != b->l_flags);
+
 	/*
 	 * Compare LINK_ATTR_PROTINFO af_data
 	 */
@@ -875,12 +881,6 @@ static int link_compare(struct nl_object *_a, struct nl_object *_b,
 			goto protinfo_mismatch;
 	}
 
-	if (flags & LOOSE_COMPARISON)
-		diff |= LINK_DIFF(FLAGS,
-				  (a->l_flags ^ b->l_flags) & b->l_flag_mask);
-	else
-		diff |= LINK_DIFF(FLAGS, a->l_flags != b->l_flags);
-
 out:
 	return diff;
 
-- 
1.7.2.5




More information about the libnl mailing list