diff options
Diffstat (limited to 'lib/nexthop.c')
| -rw-r--r-- | lib/nexthop.c | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c index 0ea72d03e1..b2fa945690 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -202,43 +202,6 @@ int nexthop_cmp(const struct nexthop *next1, const struct nexthop *next2) return ret; } -bool nexthop_same_firsthop(const struct nexthop *next1, - const struct nexthop *next2) -{ - /* Map the TYPE_IPx types to TYPE_IPx_IFINDEX */ - int type1 = NEXTHOP_FIRSTHOPTYPE(next1->type); - int type2 = NEXTHOP_FIRSTHOPTYPE(next2->type); - - if (type1 != type2) - return false; - - if (next1->vrf_id != next2->vrf_id) - return false; - - switch (type1) { - case NEXTHOP_TYPE_IPV4_IFINDEX: - if (!IPV4_ADDR_SAME(&next1->gate.ipv4, &next2->gate.ipv4)) - return false; - if (next1->ifindex != next2->ifindex) - return false; - break; - case NEXTHOP_TYPE_IFINDEX: - if (next1->ifindex != next2->ifindex) - return false; - break; - case NEXTHOP_TYPE_IPV6_IFINDEX: - if (!IPV6_ADDR_SAME(&next1->gate.ipv6, &next2->gate.ipv6)) - return false; - if (next1->ifindex != next2->ifindex) - return false; - break; - default: - /* do nothing */ - break; - } - return true; -} - /* * nexthop_type_to_str */ @@ -468,13 +431,13 @@ const char *nexthop2str(const struct nexthop *nexthop, char *str, int size) break; case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV4_IFINDEX: - snprintf(str, size, "%s if %u", inet_ntoa(nexthop->gate.ipv4), - nexthop->ifindex); + snprintfrr(str, size, "%pI4 if %u", &nexthop->gate.ipv4, + nexthop->ifindex); break; case NEXTHOP_TYPE_IPV6: case NEXTHOP_TYPE_IPV6_IFINDEX: - snprintf(str, size, "%s if %u", inet6_ntoa(nexthop->gate.ipv6), - nexthop->ifindex); + snprintfrr(str, size, "%pI6 if %u", &nexthop->gate.ipv6, + nexthop->ifindex); break; case NEXTHOP_TYPE_BLACKHOLE: snprintf(str, size, "blackhole"); |
