diff --git a/staticd/static_nht.c b/staticd/static_nht.c index 9af30a587..2aa0db59f 100644 --- a/staticd/static_nht.c +++ b/staticd/static_nht.c @@ -37,8 +37,6 @@ static void static_nht_update_safi(struct prefix *p, uint32_t nh_num, struct static_route *si; struct static_vrf *svrf; struct route_node *rn; - bool orig; - bool reinstall; svrf = vrf->info; if (!svrf) @@ -49,7 +47,6 @@ static void static_nht_update_safi(struct prefix *p, uint32_t nh_num, return; for (rn = route_top(stable); rn; rn = route_next(rn)) { - reinstall = false; for (si = rn->info; si; si = si->next) { if (si->nh_vrf_id != nh_vrf_id) continue; @@ -60,7 +57,6 @@ static void static_nht_update_safi(struct prefix *p, uint32_t nh_num, && si->type != STATIC_IPV6_GATEWAY_IFNAME) continue; - orig = si->nh_valid; if (p->family == AF_INET && p->u.prefix4.s_addr == si->addr.ipv4.s_addr) si->nh_valid = !!nh_num; @@ -69,14 +65,7 @@ static void static_nht_update_safi(struct prefix *p, uint32_t nh_num, && memcmp(&p->u.prefix6, &si->addr.ipv6, 16) == 0) si->nh_valid = !!nh_num; - if (orig != si->nh_valid) - reinstall = true; - - if (reinstall) { - static_zebra_route_add(rn, si, vrf->vrf_id, - safi, true); - reinstall = false; - } + static_zebra_route_add(rn, si, vrf->vrf_id, safi, true); } } } diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 5f397eb8c..6f65f8ab7 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -759,7 +759,7 @@ static void zebra_rnh_eval_nexthop_entry(struct zebra_vrf *zvrf, afi_t afi, * change. */ zebra_rnh_remove_from_routing_table(rnh); - if (!prefix_same(&rnh->resolved_route, prn ? NULL : &prn->p)) { + if (!prefix_same(&rnh->resolved_route, prn ? &prn->p : NULL)) { if (prn) prefix_copy(&rnh->resolved_route, &prn->p); else { @@ -965,7 +965,6 @@ static void copy_state(struct rnh *rnh, struct route_entry *re, static int compare_state(struct route_entry *r1, struct route_entry *r2) { - if (!r1 && !r2) return 0; @@ -981,8 +980,7 @@ static int compare_state(struct route_entry *r1, struct route_entry *r2) if (r1->nexthop_num != r2->nexthop_num) return 1; - if (CHECK_FLAG(r1->status, ROUTE_ENTRY_NEXTHOPS_CHANGED) - || CHECK_FLAG(r1->status, ROUTE_ENTRY_LABELS_CHANGED)) + if (nexthop_group_hash(&r1->ng) != nexthop_group_hash(&r2->ng)) return 1; return 0;