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 <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2019-05-14 10:37:45 -07:00
parent 89dc316029
commit f932ce865f

View File

@ -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: