From f932ce865fa1edc91c1f16856682705d82d92d65 Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Tue, 14 May 2019 10:37:45 -0700 Subject: [PATCH] lib: nexthop-cmp return if gateways don't match Fix the cmp check the so that it returns the result if the gateways don't match. Signed-off-by: Stephen Worley --- lib/nexthop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nexthop.c b/lib/nexthop.c index 120968f436..2f7ba7e3d0 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -92,13 +92,13 @@ int nexthop_cmp(const struct nexthop *next1, const struct nexthop *next2) break; case NEXTHOP_TYPE_IPV6: ret = memcmp(&next1->gate, &next2->gate, sizeof(union g_addr)); - if (!ret) + if (ret) return ret; break; case NEXTHOP_TYPE_IPV4_IFINDEX: case NEXTHOP_TYPE_IPV6_IFINDEX: ret = memcmp(&next1->gate, &next2->gate, sizeof(union g_addr)); - if (!ret) + if (ret) return ret; /* Intentional Fall-Through */ case NEXTHOP_TYPE_IFINDEX: -- 2.39.5