From 78fba41bd810ce6e8976077c37644e9d23b9f69d Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Tue, 14 May 2019 10:48:26 -0700 Subject: [PATCH] lib,zebra,bgpd: Remove nexthop_same_no_recurse() The functions nexthop_same() does not check the resolved nexthops so I don't think this function is even needed anymore. Signed-off-by: Stephen Worley --- bgpd/bgp_nht.c | 3 +-- lib/nexthop.c | 36 ------------------------------------ lib/nexthop.h | 2 -- zebra/zebra_rib.c | 2 +- 4 files changed, 2 insertions(+), 41 deletions(-) diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 7e721db49..fdfa15b44 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -474,8 +474,7 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id) continue; for (oldnh = bnc->nexthop; oldnh; oldnh = oldnh->next) - if (nexthop_same_no_recurse(oldnh, nexthop) && - nexthop_labels_match(oldnh, nexthop)) + if (nexthop_same(oldnh, nexthop)) break; if (!oldnh) diff --git a/lib/nexthop.c b/lib/nexthop.c index 7cc77a767..123684b51 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -126,42 +126,6 @@ int nexthop_cmp(const struct nexthop *next1, const struct nexthop *next2) return ret; } -/* check if nexthops are same, non-recursive */ -int nexthop_same_no_recurse(const struct nexthop *next1, - const struct nexthop *next2) -{ - if (next1->type != next2->type) - return 0; - - switch (next1->type) { - case NEXTHOP_TYPE_IPV4: - case NEXTHOP_TYPE_IPV4_IFINDEX: - if (!IPV4_ADDR_SAME(&next1->gate.ipv4, &next2->gate.ipv4)) - return 0; - if (next1->ifindex && (next1->ifindex != next2->ifindex)) - return 0; - break; - case NEXTHOP_TYPE_IFINDEX: - if (next1->ifindex != next2->ifindex) - return 0; - break; - case NEXTHOP_TYPE_IPV6: - if (!IPV6_ADDR_SAME(&next1->gate.ipv6, &next2->gate.ipv6)) - return 0; - break; - case NEXTHOP_TYPE_IPV6_IFINDEX: - if (!IPV6_ADDR_SAME(&next1->gate.ipv6, &next2->gate.ipv6)) - return 0; - if (next1->ifindex != next2->ifindex) - return 0; - break; - default: - /* do nothing */ - break; - } - return 1; -} - int nexthop_same_firsthop(struct nexthop *next1, struct nexthop *next2) { int type1 = NEXTHOP_FIRSTHOPTYPE(next1->type); diff --git a/lib/nexthop.h b/lib/nexthop.h index 1bc305583..48efc762c 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -142,8 +142,6 @@ extern bool nexthop_same(const struct nexthop *nh1, const struct nexthop *nh2); extern int nexthop_cmp(const struct nexthop *nh1, const struct nexthop *nh2); extern const char *nexthop_type_to_str(enum nexthop_types_t nh_type); -extern int nexthop_same_no_recurse(const struct nexthop *next1, - const struct nexthop *next2); extern bool nexthop_labels_match(const struct nexthop *nh1, const struct nexthop *nh2); extern int nexthop_same_firsthop(struct nexthop *next1, struct nexthop *next2); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 8f2731666..297fc7e7e 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2855,7 +2855,7 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, break; } for (ALL_NEXTHOPS(re->ng, rtnh)) - if (nexthop_same_no_recurse(rtnh, nh)) { + if (nexthop_same(rtnh, nh)) { same = re; break; } -- 2.39.2