Fix always false comparison in lib/route/route_obj.c:route_compare()

Michele Baldessari michele at acksyn.org
Tue Aug 28 14:28:28 EDT 2012


Hi Thomas,

I assume the below fix is correct. I just noticed that odd looking if
statement while glancing over the code.

Cheers,
Michele


commit 97ba06af5c97412edd8794c4b36ee3204c288283
Author: Michele Baldessari <michele at acksyn.org>
Date:   Tue Aug 28 20:21:53 2012 +0200

    Fix the always false if (a->rt_nr_nh != a->rt_nr_nh) test and compare
    properly the a and b structs

diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c
index 685a926..40a157e 100644
--- a/lib/route/route_obj.c
+++ b/lib/route/route_obj.c
@@ -335,7 +335,7 @@ static int route_compare(struct nl_object *_a, struct nl_object *_b,
 		diff |= ROUTE_DIFF(FLAGS,
 			  (a->rt_flags ^ b->rt_flags) & b->rt_flag_mask);
 	} else {
-		if (a->rt_nr_nh != a->rt_nr_nh)
+		if (a->rt_nr_nh != b->rt_nr_nh)
 			goto nh_mismatch;
 
 		/* search for a dup in each nh of a */

-- 
Michele Baldessari            <michele at acksyn.org>
C2A5 9DA3 9961 4FFB E01B  D0BC DDD4 DCCB 7515 5C6D



More information about the libnl mailing list