Nexthop Tracking and Static route fix (#4602)

Nexthop Tracking and Static route fix
This commit is contained in:
David Lamparter 2019-06-26 20:37:55 +02:00 committed by GitHub
commit b86c7ab7ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 16 deletions

View File

@ -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);
}
}
}

View File

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