diff options
| -rw-r--r-- | bgpd/bgp_advertise.h | 12 | ||||
| -rw-r--r-- | bgpd/bgp_damp.c | 38 | ||||
| -rw-r--r-- | bgpd/bgp_evpn.c | 90 | ||||
| -rw-r--r-- | bgpd/bgp_mpath.c | 14 | ||||
| -rw-r--r-- | bgpd/bgp_mplsvpn.c | 17 | ||||
| -rw-r--r-- | bgpd/bgp_nht.c | 10 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 316 | ||||
| -rw-r--r-- | bgpd/bgp_route.h | 46 | ||||
| -rw-r--r-- | bgpd/bgp_updgrp.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_updgrp_adv.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_zebra.c | 4 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi.c | 8 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_import.c | 61 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_vty.c | 12 | ||||
| -rw-r--r-- | bgpd/rfapi/vnc_export_bgp.c | 2 | ||||
| -rw-r--r-- | bgpd/rfapi/vnc_import_bgp.c | 16 | ||||
| -rw-r--r-- | tests/bgpd/test_mpath.c | 8 |
17 files changed, 328 insertions, 330 deletions
diff --git a/bgpd/bgp_advertise.h b/bgpd/bgp_advertise.h index 920cca6301..7d551603f2 100644 --- a/bgpd/bgp_advertise.h +++ b/bgpd/bgp_advertise.h @@ -113,7 +113,7 @@ struct bgp_synchronize { }; /* BGP adjacency linked list. */ -#define BGP_INFO_ADD(N, A, TYPE) \ +#define BGP_PATH_INFO_ADD(N, A, TYPE) \ do { \ (A)->prev = NULL; \ (A)->next = (N)->TYPE; \ @@ -122,7 +122,7 @@ struct bgp_synchronize { (N)->TYPE = (A); \ } while (0) -#define BGP_INFO_DEL(N, A, TYPE) \ +#define BGP_PATH_INFO_DEL(N, A, TYPE) \ do { \ if ((A)->next) \ (A)->next->prev = (A)->prev; \ @@ -132,10 +132,10 @@ struct bgp_synchronize { (N)->TYPE = (A)->next; \ } while (0) -#define BGP_ADJ_IN_ADD(N,A) BGP_INFO_ADD(N,A,adj_in) -#define BGP_ADJ_IN_DEL(N,A) BGP_INFO_DEL(N,A,adj_in) -#define BGP_ADJ_OUT_ADD(N,A) BGP_INFO_ADD(N,A,adj_out) -#define BGP_ADJ_OUT_DEL(N,A) BGP_INFO_DEL(N,A,adj_out) +#define BGP_ADJ_IN_ADD(N, A) BGP_PATH_INFO_ADD(N, A, adj_in) +#define BGP_ADJ_IN_DEL(N, A) BGP_PATH_INFO_DEL(N, A, adj_in) +#define BGP_ADJ_OUT_ADD(N, A) BGP_PATH_INFO_ADD(N, A, adj_out) +#define BGP_ADJ_OUT_DEL(N, A) BGP_PATH_INFO_DEL(N, A, adj_out) #define BGP_ADV_FIFO_ADD(F, N) \ do { \ diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index 5ffab0bf4f..f7b16bda1d 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -42,8 +42,8 @@ static struct bgp_damp_config *damp = &bgp_damp_cfg; /* Utility macro to add and delete BGP dampening information to no used list. */ -#define BGP_DAMP_LIST_ADD(N,A) BGP_INFO_ADD(N,A,no_reuse_list) -#define BGP_DAMP_LIST_DEL(N,A) BGP_INFO_DEL(N,A,no_reuse_list) +#define BGP_DAMP_LIST_ADD(N, A) BGP_PATH_INFO_ADD(N, A, no_reuse_list) +#define BGP_DAMP_LIST_DEL(N, A) BGP_PATH_INFO_DEL(N, A, no_reuse_list) /* Calculate reuse list index by penalty value. */ static int bgp_reuse_index(int penalty) @@ -146,12 +146,12 @@ static int bgp_reuse_timer(struct thread *t) if (bdi->penalty < damp->reuse_limit) { /* Reuse the route. */ bgp_info_unset_flag(bdi->rn, bdi->binfo, - BGP_INFO_DAMPED); + BGP_PATH_DAMPED); bdi->suppress_time = 0; if (bdi->lastrecord == BGP_RECORD_UPDATE) { bgp_info_unset_flag(bdi->rn, bdi->binfo, - BGP_INFO_HISTORY); + BGP_PATH_HISTORY); bgp_aggregate_increment(bgp, &bdi->rn->p, bdi->binfo, bdi->afi, bdi->safi); @@ -228,10 +228,10 @@ int bgp_damp_withdraw(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi, bdi->t_updated = t_now; /* Make this route as historical status. */ - bgp_info_set_flag(rn, binfo, BGP_INFO_HISTORY); + bgp_info_set_flag(rn, binfo, BGP_PATH_HISTORY); /* Remove the route from a reuse list if it is on one. */ - if (CHECK_FLAG(bdi->binfo->flags, BGP_INFO_DAMPED)) { + if (CHECK_FLAG(bdi->binfo->flags, BGP_PATH_DAMPED)) { /* If decay rate isn't equal to 0, reinsert brn. */ if (bdi->penalty != last_penalty && bdi->index >= 0) { bgp_reuse_list_delete(bdi); @@ -243,7 +243,7 @@ int bgp_damp_withdraw(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi, /* If not suppressed before, do annonunce this withdraw and insert into reuse_list. */ if (bdi->penalty >= damp->suppress_value) { - bgp_info_set_flag(rn, binfo, BGP_INFO_DAMPED); + bgp_info_set_flag(rn, binfo, BGP_PATH_DAMPED); bdi->suppress_time = t_now; BGP_DAMP_LIST_DEL(damp, bdi); bgp_reuse_list_add(bdi); @@ -263,17 +263,17 @@ int bgp_damp_update(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi, return BGP_DAMP_USED; t_now = bgp_clock(); - bgp_info_unset_flag(rn, binfo, BGP_INFO_HISTORY); + bgp_info_unset_flag(rn, binfo, BGP_PATH_HISTORY); bdi->lastrecord = BGP_RECORD_UPDATE; bdi->penalty = bgp_damp_decay(t_now - bdi->t_updated, bdi->penalty); - if (!CHECK_FLAG(bdi->binfo->flags, BGP_INFO_DAMPED) + if (!CHECK_FLAG(bdi->binfo->flags, BGP_PATH_DAMPED) && (bdi->penalty < damp->suppress_value)) status = BGP_DAMP_USED; - else if (CHECK_FLAG(bdi->binfo->flags, BGP_INFO_DAMPED) + else if (CHECK_FLAG(bdi->binfo->flags, BGP_PATH_DAMPED) && (bdi->penalty < damp->reuse_limit)) { - bgp_info_unset_flag(rn, binfo, BGP_INFO_DAMPED); + bgp_info_unset_flag(rn, binfo, BGP_PATH_DAMPED); bgp_reuse_list_delete(bdi); BGP_DAMP_LIST_ADD(damp, bdi); bdi->suppress_time = 0; @@ -300,11 +300,11 @@ int bgp_damp_scan(struct bgp_info *binfo, afi_t afi, safi_t safi) t_now = bgp_clock(); bdi = binfo->extra->damp_info; - if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)) { + if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED)) { t_diff = t_now - bdi->suppress_time; if (t_diff >= damp->max_suppress_time) { - bgp_info_unset_flag(bdi->rn, binfo, BGP_INFO_DAMPED); + bgp_info_unset_flag(bdi->rn, binfo, BGP_PATH_DAMPED); bgp_reuse_list_delete(bdi); BGP_DAMP_LIST_ADD(damp, bdi); bdi->penalty = damp->reuse_limit; @@ -342,12 +342,12 @@ void bgp_damp_info_free(struct bgp_damp_info *bdi, int withdraw) binfo = bdi->binfo; binfo->extra->damp_info = NULL; - if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED)) bgp_reuse_list_delete(bdi); else BGP_DAMP_LIST_DEL(damp, bdi); - bgp_info_unset_flag(bdi->rn, binfo, BGP_INFO_HISTORY | BGP_INFO_DAMPED); + bgp_info_unset_flag(bdi->rn, binfo, BGP_PATH_HISTORY | BGP_PATH_DAMPED); if (bdi->lastrecord == BGP_RECORD_WITHDRAW && withdraw) bgp_info_delete(bdi->rn, binfo); @@ -618,8 +618,8 @@ void bgp_damp_info_vty(struct vty *vty, struct bgp_info *binfo, peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, 1, json_path); - if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED) - && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED) + && !CHECK_FLAG(binfo->flags, BGP_PATH_HISTORY)) bgp_get_reuse_time(penalty, timebuf, BGP_UPTIME_LEN, 1, json_path); } else { @@ -629,8 +629,8 @@ void bgp_damp_info_vty(struct vty *vty, struct bgp_info *binfo, peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, 0, json_path)); - if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED) - && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED) + && !CHECK_FLAG(binfo->flags, BGP_PATH_HISTORY)) vty_out(vty, ", reuse in %s", bgp_get_reuse_time(penalty, timebuf, BGP_UPTIME_LEN, 0, diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index c350015cc4..cda02075d7 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -1048,14 +1048,14 @@ static int evpn_es_route_select_install(struct bgp *bgp, && old_select->type == ZEBRA_ROUTE_BGP && old_select->sub_type == BGP_ROUTE_IMPORTED && !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR) - && !CHECK_FLAG(old_select->flags, BGP_INFO_ATTR_CHANGED) + && !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED) && !bgp->addpath_tx_used[afi][safi]) { if (bgp_zebra_has_route_changed(rn, old_select)) { ret = evpn_es_install_vtep(bgp, es, (struct prefix_evpn *)&rn->p, old_select->attr->nexthop); } - UNSET_FLAG(old_select->flags, BGP_INFO_MULTIPATH_CHG); + UNSET_FLAG(old_select->flags, BGP_PATH_MULTIPATH_CHG); bgp_zebra_clear_route_change_flags(rn); return ret; } @@ -1071,11 +1071,11 @@ static int evpn_es_route_select_install(struct bgp *bgp, bgp_bump_version(rn); if (old_select) - bgp_info_unset_flag(rn, old_select, BGP_INFO_SELECTED); + bgp_info_unset_flag(rn, old_select, BGP_PATH_SELECTED); if (new_select) { - bgp_info_set_flag(rn, new_select, BGP_INFO_SELECTED); - bgp_info_unset_flag(rn, new_select, BGP_INFO_ATTR_CHANGED); - UNSET_FLAG(new_select->flags, BGP_INFO_MULTIPATH_CHG); + bgp_info_set_flag(rn, new_select, BGP_PATH_SELECTED); + bgp_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED); + UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG); } if (new_select && new_select->type == ZEBRA_ROUTE_BGP @@ -1095,7 +1095,7 @@ static int evpn_es_route_select_install(struct bgp *bgp, bgp_zebra_clear_route_change_flags(rn); /* Reap old select bgp_info, if it has been removed */ - if (old_select && CHECK_FLAG(old_select->flags, BGP_INFO_REMOVED)) + if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED)) bgp_info_reap(rn, old_select); return ret; @@ -1131,7 +1131,7 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, && old_select->type == ZEBRA_ROUTE_BGP && old_select->sub_type == BGP_ROUTE_IMPORTED && !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR) - && !CHECK_FLAG(old_select->flags, BGP_INFO_ATTR_CHANGED) + && !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED) && !bgp->addpath_tx_used[afi][safi]) { if (bgp_zebra_has_route_changed(rn, old_select)) { if (old_select->attr->sticky) @@ -1147,7 +1147,7 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, old_select->attr->nexthop, flags, mac_mobility_seqnum(old_select->attr)); } - UNSET_FLAG(old_select->flags, BGP_INFO_MULTIPATH_CHG); + UNSET_FLAG(old_select->flags, BGP_PATH_MULTIPATH_CHG); bgp_zebra_clear_route_change_flags(rn); return ret; } @@ -1162,11 +1162,11 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, bgp_bump_version(rn); if (old_select) - bgp_info_unset_flag(rn, old_select, BGP_INFO_SELECTED); + bgp_info_unset_flag(rn, old_select, BGP_PATH_SELECTED); if (new_select) { - bgp_info_set_flag(rn, new_select, BGP_INFO_SELECTED); - bgp_info_unset_flag(rn, new_select, BGP_INFO_ATTR_CHANGED); - UNSET_FLAG(new_select->flags, BGP_INFO_MULTIPATH_CHG); + bgp_info_set_flag(rn, new_select, BGP_PATH_SELECTED); + bgp_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED); + UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG); } if (new_select && new_select->type == ZEBRA_ROUTE_BGP @@ -1206,7 +1206,7 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, bgp_zebra_clear_route_change_flags(rn); /* Reap old select bgp_info, if it has been removed */ - if (old_select && CHECK_FLAG(old_select->flags, BGP_INFO_REMOVED)) + if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED)) bgp_info_reap(rn, old_select); return ret; @@ -1289,9 +1289,9 @@ static int update_evpn_type4_route_entry(struct bgp *bgp, tmp_ri->type == ZEBRA_ROUTE_BGP && tmp_ri->sub_type == BGP_ROUTE_STATIC) local_ri = tmp_ri; - if (tmp_ri->type == ZEBRA_ROUTE_BGP && - tmp_ri->sub_type == BGP_ROUTE_IMPORTED && - CHECK_FLAG(tmp_ri->flags, BGP_INFO_VALID)) + if (tmp_ri->type == ZEBRA_ROUTE_BGP + && tmp_ri->sub_type == BGP_ROUTE_IMPORTED + && CHECK_FLAG(tmp_ri->flags, BGP_PATH_VALID)) remote_ri = tmp_ri; } @@ -1321,23 +1321,23 @@ static int update_evpn_type4_route_entry(struct bgp *bgp, /* Create new route with its attribute. */ tmp_ri = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0, bgp->peer_self, attr_new, rn); - SET_FLAG(tmp_ri->flags, BGP_INFO_VALID); + SET_FLAG(tmp_ri->flags, BGP_PATH_VALID); /* add the newly created path to the route-node */ bgp_info_add(rn, tmp_ri); } else { tmp_ri = local_ri; if (attrhash_cmp(tmp_ri->attr, attr) - && !CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED)) + && !CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED)) *route_changed = 0; else { /* The attribute has changed. * Add (or update) attribute to hash. */ attr_new = bgp_attr_intern(attr); - bgp_info_set_flag(rn, tmp_ri, BGP_INFO_ATTR_CHANGED); + bgp_info_set_flag(rn, tmp_ri, BGP_PATH_ATTR_CHANGED); /* Restore route, if needed. */ - if (CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED)) bgp_info_restore(rn, tmp_ri); /* Unintern existing, set to new. */ @@ -1465,7 +1465,7 @@ static int update_evpn_type5_route_entry(struct bgp *bgp_def, /* create the route info from attribute */ ri = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0, bgp_def->peer_self, attr_new, rn); - SET_FLAG(ri->flags, BGP_INFO_VALID); + SET_FLAG(ri->flags, BGP_PATH_VALID); /* Type-5 routes advertise the L3-VNI */ bgp_info_extra_get(ri); @@ -1486,10 +1486,10 @@ static int update_evpn_type5_route_entry(struct bgp *bgp_def, /* The attribute has changed. */ /* Add (or update) attribute to hash. */ attr_new = bgp_attr_intern(attr); - bgp_info_set_flag(rn, tmp_ri, BGP_INFO_ATTR_CHANGED); + bgp_info_set_flag(rn, tmp_ri, BGP_PATH_ATTR_CHANGED); /* Restore route, if needed. */ - if (CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED)) bgp_info_restore(rn, tmp_ri); /* Unintern existing, set to new. */ @@ -1610,7 +1610,7 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, /* Create new route with its attribute. */ tmp_ri = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0, bgp->peer_self, attr_new, rn); - SET_FLAG(tmp_ri->flags, BGP_INFO_VALID); + SET_FLAG(tmp_ri->flags, BGP_PATH_VALID); bgp_info_extra_get(tmp_ri); /* The VNI goes into the 'label' field of the route */ @@ -1637,7 +1637,7 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, } else { tmp_ri = local_ri; if (attrhash_cmp(tmp_ri->attr, attr) - && !CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED)) + && !CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED)) route_change = 0; else { /* @@ -1662,7 +1662,7 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, /* The attribute has changed. */ /* Add (or update) attribute to hash. */ attr_new = bgp_attr_intern(attr); - bgp_info_set_flag(rn, tmp_ri, BGP_INFO_ATTR_CHANGED); + bgp_info_set_flag(rn, tmp_ri, BGP_PATH_ATTR_CHANGED); /* Extract MAC mobility sequence number, if any. */ attr_new->mm_seqnum = @@ -1670,7 +1670,7 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, attr_new->sticky = sticky; /* Restore route, if needed. */ - if (CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED)) bgp_info_restore(rn, tmp_ri); /* Unintern existing, set to new. */ @@ -2289,13 +2289,13 @@ static int install_evpn_route_entry_in_es(struct bgp *bgp, /* Create new route with its attribute. */ ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0, parent_ri->peer, attr_new, rn); - SET_FLAG(ri->flags, BGP_INFO_VALID); + SET_FLAG(ri->flags, BGP_PATH_VALID); bgp_info_extra_get(ri); ri->extra->parent = parent_ri; bgp_info_add(rn, ri); } else { if (attrhash_cmp(ri->attr, parent_ri->attr) - && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) { + && !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) { bgp_unlock_node(rn); return 0; } @@ -2304,12 +2304,12 @@ static int install_evpn_route_entry_in_es(struct bgp *bgp, attr_new = bgp_attr_intern(parent_ri->attr); /* Restore route, if needed. */ - if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) bgp_info_restore(rn, ri); /* Mark if nexthop has changed. */ if (!IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop)) - SET_FLAG(ri->flags, BGP_INFO_IGP_CHANGED); + SET_FLAG(ri->flags, BGP_PATH_IGP_CHANGED); /* Unintern existing, set to new. */ bgp_attr_unintern(&ri->attr); @@ -2390,7 +2390,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, /* Create new route with its attribute. */ ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0, parent_ri->peer, attr_new, rn); - SET_FLAG(ri->flags, BGP_INFO_VALID); + SET_FLAG(ri->flags, BGP_PATH_VALID); bgp_info_extra_get(ri); ri->extra->parent = bgp_info_lock(parent_ri); bgp_lock_node((struct bgp_node *)parent_ri->net); @@ -2402,7 +2402,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, bgp_info_add(rn, ri); } else { if (attrhash_cmp(ri->attr, &attr) - && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) { + && !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) { bgp_unlock_node(rn); return 0; } @@ -2411,7 +2411,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, attr_new = bgp_attr_intern(&attr); /* Restore route, if needed. */ - if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) bgp_info_restore(rn, ri); /* Mark if nexthop has changed. */ @@ -2420,7 +2420,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, (afi == AFI_IP6 && !IPV6_ADDR_SAME(&ri->attr->mp_nexthop_global, &attr_new->mp_nexthop_global))) - SET_FLAG(ri->flags, BGP_INFO_IGP_CHANGED); + SET_FLAG(ri->flags, BGP_PATH_IGP_CHANGED); /* Unintern existing, set to new. */ bgp_attr_unintern(&ri->attr); @@ -2465,7 +2465,7 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, /* Create new route with its attribute. */ ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0, parent_ri->peer, attr_new, rn); - SET_FLAG(ri->flags, BGP_INFO_VALID); + SET_FLAG(ri->flags, BGP_PATH_VALID); bgp_info_extra_get(ri); ri->extra->parent = bgp_info_lock(parent_ri); bgp_lock_node((struct bgp_node *)parent_ri->net); @@ -2477,7 +2477,7 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, bgp_info_add(rn, ri); } else { if (attrhash_cmp(ri->attr, parent_ri->attr) - && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) { + && !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) { bgp_unlock_node(rn); return 0; } @@ -2486,12 +2486,12 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, attr_new = bgp_attr_intern(parent_ri->attr); /* Restore route, if needed. */ - if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) bgp_info_restore(rn, ri); /* Mark if nexthop has changed. */ if (!IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop)) - SET_FLAG(ri->flags, BGP_INFO_IGP_CHANGED); + SET_FLAG(ri->flags, BGP_PATH_IGP_CHANGED); /* Unintern existing, set to new. */ bgp_attr_unintern(&ri->attr); @@ -2836,7 +2836,7 @@ static int install_uninstall_routes_for_es(struct bgp *bgp, * Consider "valid" remote routes applicable for * this ES. */ - if (!(CHECK_FLAG(ri->flags, BGP_INFO_VALID) + if (!(CHECK_FLAG(ri->flags, BGP_PATH_VALID) && ri->type == ZEBRA_ROUTE_BGP && ri->sub_type == BGP_ROUTE_NORMAL)) continue; @@ -2918,7 +2918,7 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install) /* Consider "valid" remote routes applicable for * this VRF. */ - if (!(CHECK_FLAG(ri->flags, BGP_INFO_VALID) + if (!(CHECK_FLAG(ri->flags, BGP_PATH_VALID) && ri->type == ZEBRA_ROUTE_BGP && ri->sub_type == BGP_ROUTE_NORMAL)) continue; @@ -2992,7 +2992,7 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp, for (ri = rn->info; ri; ri = ri->next) { /* Consider "valid" remote routes applicable for * this VNI. */ - if (!(CHECK_FLAG(ri->flags, BGP_INFO_VALID) + if (!(CHECK_FLAG(ri->flags, BGP_PATH_VALID) && ri->type == ZEBRA_ROUTE_BGP && ri->sub_type == BGP_ROUTE_NORMAL)) continue; @@ -4097,7 +4097,7 @@ void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf, afi_t afi, safi_t safi) /* Only care about "selected" routes - non-imported. */ /* TODO: Support for AddPath for EVPN. */ for (ri = rn->info; ri; ri = ri->next) { - if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) + if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED) && (!ri->extra || !ri->extra->parent)) { bgp_evpn_withdraw_type5_route(bgp_vrf, &rn->p, afi, safi); @@ -4147,7 +4147,7 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi, * TODO: Support for AddPath for EVPN. */ for (ri = rn->info; ri; ri = ri->next) { - if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) + if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED) && (!ri->extra || !ri->extra->parent)) { /* apply the route-map */ diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 333d09806e..6d31682777 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -322,7 +322,7 @@ static void bgp_info_mpath_enqueue(struct bgp_info *prev_info, prev->mp_next->mp_prev = mpath; prev->mp_next = mpath; - SET_FLAG(binfo->flags, BGP_INFO_MULTIPATH); + SET_FLAG(binfo->flags, BGP_PATH_MULTIPATH); } /* @@ -340,7 +340,7 @@ void bgp_info_mpath_dequeue(struct bgp_info *binfo) if (mpath->mp_next) mpath->mp_next->mp_prev = mpath->mp_prev; mpath->mp_next = mpath->mp_prev = NULL; - UNSET_FLAG(binfo->flags, BGP_INFO_MULTIPATH); + UNSET_FLAG(binfo->flags, BGP_PATH_MULTIPATH); } /* @@ -632,14 +632,14 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best, bgp_info_mpath_count_set(new_best, mpath_count - 1); if (mpath_changed || (bgp_info_mpath_count(new_best) != old_mpath_count)) - SET_FLAG(new_best->flags, BGP_INFO_MULTIPATH_CHG); + SET_FLAG(new_best->flags, BGP_PATH_MULTIPATH_CHG); } } /* * bgp_mp_dmed_deselect * - * Clean up multipath information for BGP_INFO_DMED_SELECTED path that + * Clean up multipath information for BGP_PATH_DMED_SELECTED path that * is not selected as best path */ void bgp_mp_dmed_deselect(struct bgp_info *dmed_best) @@ -656,7 +656,7 @@ void bgp_mp_dmed_deselect(struct bgp_info *dmed_best) } bgp_info_mpath_count_set(dmed_best, 0); - UNSET_FLAG(dmed_best->flags, BGP_INFO_MULTIPATH_CHG); + UNSET_FLAG(dmed_best->flags, BGP_PATH_MULTIPATH_CHG); assert(bgp_info_mpath_first(dmed_best) == 0); } @@ -698,7 +698,7 @@ void bgp_info_mpath_aggregate_update(struct bgp_info *new_best, if ((new_attr = bgp_info_mpath_attr(new_best))) { bgp_attr_unintern(&new_attr); bgp_info_mpath_attr_set(new_best, NULL); - SET_FLAG(new_best->flags, BGP_INFO_ATTR_CHANGED); + SET_FLAG(new_best->flags, BGP_PATH_ATTR_CHANGED); } return; } @@ -793,7 +793,7 @@ void bgp_info_mpath_aggregate_update(struct bgp_info *new_best, if ((old_attr = bgp_info_mpath_attr(new_best))) bgp_attr_unintern(&old_attr); bgp_info_mpath_attr_set(new_best, new_attr); - SET_FLAG(new_best->flags, BGP_INFO_ATTR_CHANGED); + SET_FLAG(new_best->flags, BGP_PATH_ATTR_CHANGED); } else bgp_attr_unintern(&new_attr); } diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 276945cbf6..a9df2f5f89 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -516,9 +516,8 @@ leak_update( if (bi) { bool labelssame = labels_same(bi, label, num_labels); - if (attrhash_cmp(bi->attr, new_attr) - && labelssame - && !CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) { + if (attrhash_cmp(bi->attr, new_attr) && labelssame + && !CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) { bgp_attr_unintern(&new_attr); if (debug) @@ -530,10 +529,10 @@ leak_update( } /* attr is changed */ - bgp_info_set_flag(bn, bi, BGP_INFO_ATTR_CHANGED); + bgp_info_set_flag(bn, bi, BGP_PATH_ATTR_CHANGED); /* Rewrite BGP route information. */ - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) bgp_info_restore(bn, bi); else bgp_aggregate_decrement(bgp, p, bi, afi, safi); @@ -548,7 +547,7 @@ leak_update( setlabels(bi, label, num_labels); if (nexthop_self_flag) - bgp_info_set_flag(bn, bi, BGP_INFO_ANNC_NH_SELF); + bgp_info_set_flag(bn, bi, BGP_PATH_ANNC_NH_SELF); struct bgp *bgp_nexthop = bgp; int nh_valid; @@ -574,7 +573,7 @@ leak_update( bgp_nexthop->name_pretty); if (nh_valid) - bgp_info_set_flag(bn, bi, BGP_INFO_VALID); + bgp_info_set_flag(bn, bi, BGP_PATH_VALID); /* Process change. */ bgp_aggregate_increment(bgp, p, bi, afi, safi); @@ -592,7 +591,7 @@ leak_update( bgp->peer_self, new_attr, bn); if (nexthop_self_flag) - bgp_info_set_flag(bn, new, BGP_INFO_ANNC_NH_SELF); + bgp_info_set_flag(bn, new, BGP_PATH_ANNC_NH_SELF); bgp_info_extra_get(new); @@ -635,7 +634,7 @@ leak_update( __func__, (nh_valid ? "" : "not "), bgp_nexthop->name_pretty); if (nh_valid) - bgp_info_set_flag(bn, new, BGP_INFO_VALID); + bgp_info_set_flag(bn, new, BGP_PATH_VALID); bgp_aggregate_increment(bgp, p, new, afi, safi); bgp_info_add(bn, new); diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index c94c707157..d90e32dab1 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -740,14 +740,14 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc) (bnc_is_valid_nexthop ? "" : "not ")); } - if ((CHECK_FLAG(path->flags, BGP_INFO_VALID) ? 1 : 0) + if ((CHECK_FLAG(path->flags, BGP_PATH_VALID) ? 1 : 0) != bnc_is_valid_nexthop) { - if (CHECK_FLAG(path->flags, BGP_INFO_VALID)) { + if (CHECK_FLAG(path->flags, BGP_PATH_VALID)) { bgp_aggregate_decrement(bgp_path, &rn->p, path, afi, safi); - bgp_info_unset_flag(rn, path, BGP_INFO_VALID); + bgp_info_unset_flag(rn, path, BGP_PATH_VALID); } else { - bgp_info_set_flag(rn, path, BGP_INFO_VALID); + bgp_info_set_flag(rn, path, BGP_PATH_VALID); bgp_aggregate_increment(bgp_path, &rn->p, path, afi, safi); } @@ -762,7 +762,7 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc) if (CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_METRIC_CHANGED) || CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_CHANGED)) - SET_FLAG(path->flags, BGP_INFO_IGP_CHANGED); + SET_FLAG(path->flags, BGP_PATH_IGP_CHANGED); bgp_process(bgp_path, rn, afi, safi); } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index a46a7634ef..647b2a73fa 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -318,9 +318,9 @@ void bgp_info_reap(struct bgp_node *rn, struct bgp_info *ri) void bgp_info_delete(struct bgp_node *rn, struct bgp_info *ri) { - bgp_info_set_flag(rn, ri, BGP_INFO_REMOVED); + bgp_info_set_flag(rn, ri, BGP_PATH_REMOVED); /* set of previous already took care of pcount */ - UNSET_FLAG(ri->flags, BGP_INFO_VALID); + UNSET_FLAG(ri->flags, BGP_PATH_VALID); } /* undo the effects of a previous call to bgp_info_delete; typically @@ -328,9 +328,9 @@ void bgp_info_delete(struct bgp_node *rn, struct bgp_info *ri) deletion has been processed */ void bgp_info_restore(struct bgp_node *rn, struct bgp_info *ri) { - bgp_info_unset_flag(rn, ri, BGP_INFO_REMOVED); + bgp_info_unset_flag(rn, ri, BGP_PATH_REMOVED); /* unset of previous already took care of pcount */ - SET_FLAG(ri->flags, BGP_INFO_VALID); + SET_FLAG(ri->flags, BGP_PATH_VALID); } /* Adjust pcount as required */ @@ -346,10 +346,10 @@ static void bgp_pcount_adjust(struct bgp_node *rn, struct bgp_info *ri) if (ri->peer == ri->peer->bgp->peer_self) return; - if (!BGP_INFO_COUNTABLE(ri) - && CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) { + if (!BGP_PATH_COUNTABLE(ri) + && CHECK_FLAG(ri->flags, BGP_PATH_COUNTED)) { - UNSET_FLAG(ri->flags, BGP_INFO_COUNTED); + UNSET_FLAG(ri->flags, BGP_PATH_COUNTED); /* slight hack, but more robust against errors. */ if (ri->peer->pcount[table->afi][table->safi]) @@ -357,9 +357,9 @@ static void bgp_pcount_adjust(struct bgp_node *rn, struct bgp_info *ri) else flog_err(EC_LIB_DEVELOPMENT, "Asked to decrement 0 prefix count for peer"); - } else if (BGP_INFO_COUNTABLE(ri) - && !CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) { - SET_FLAG(ri->flags, BGP_INFO_COUNTED); + } else if (BGP_PATH_COUNTABLE(ri) + && !CHECK_FLAG(ri->flags, BGP_PATH_COUNTED)) { + SET_FLAG(ri->flags, BGP_PATH_COUNTED); ri->peer->pcount[table->afi][table->safi]++; } } @@ -379,7 +379,7 @@ void bgp_info_set_flag(struct bgp_node *rn, struct bgp_info *ri, uint32_t flag) /* early bath if we know it's not a flag that changes countability state */ if (!CHECK_FLAG(flag, - BGP_INFO_VALID | BGP_INFO_HISTORY | BGP_INFO_REMOVED)) + BGP_PATH_VALID | BGP_PATH_HISTORY | BGP_PATH_REMOVED)) return; bgp_pcount_adjust(rn, ri); @@ -393,7 +393,7 @@ void bgp_info_unset_flag(struct bgp_node *rn, struct bgp_info *ri, /* early bath if we know it's not a flag that changes countability state */ if (!CHECK_FLAG(flag, - BGP_INFO_VALID | BGP_INFO_HISTORY | BGP_INFO_REMOVED)) + BGP_PATH_VALID | BGP_PATH_HISTORY | BGP_PATH_REMOVED)) return; bgp_pcount_adjust(rn, ri); @@ -896,7 +896,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new, preferred route based on the additional decision criteria below. */ if (!bgp_flag_check(bgp, BGP_FLAG_COMPARE_ROUTER_ID) && new_sort == BGP_PEER_EBGP && exist_sort == BGP_PEER_EBGP) { - if (CHECK_FLAG(new->flags, BGP_INFO_SELECTED)) { + if (CHECK_FLAG(new->flags, BGP_PATH_SELECTED)) { if (debug) zlog_debug( "%s: %s wins over %s due to oldest external", @@ -904,7 +904,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new, return 1; } - if (CHECK_FLAG(exist->flags, BGP_INFO_SELECTED)) { + if (CHECK_FLAG(exist->flags, BGP_PATH_SELECTED)) { if (debug) zlog_debug( "%s: %s loses to %s due to oldest external", @@ -969,7 +969,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new, /* Do this only if neither path is "stale" as stale paths do not have * valid peer information (as the connection may or may not be up). */ - if (CHECK_FLAG(exist->flags, BGP_INFO_STALE)) { + if (CHECK_FLAG(exist->flags, BGP_PATH_STALE)) { if (debug) zlog_debug( "%s: %s wins over %s due to latter path being STALE", @@ -977,7 +977,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new, return 1; } - if (CHECK_FLAG(new->flags, BGP_INFO_STALE)) { + if (CHECK_FLAG(new->flags, BGP_PATH_STALE)) { if (debug) zlog_debug( "%s: %s loses to %s due to former path being STALE", @@ -1434,16 +1434,16 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri, /* With addpath we may be asked to TX all kinds of paths so make sure * ri is valid */ - if (!CHECK_FLAG(ri->flags, BGP_INFO_VALID) - || CHECK_FLAG(ri->flags, BGP_INFO_HISTORY) - || CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) { + if (!CHECK_FLAG(ri->flags, BGP_PATH_VALID) + || CHECK_FLAG(ri->flags, BGP_PATH_HISTORY) + || CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) { return 0; } /* If this is not the bestpath then check to see if there is an enabled * addpath * feature that requires us to advertise it */ - if (!CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) { + if (!CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) { if (!bgp_addpath_tx_path(peer, afi, safi, ri)) { return 0; } @@ -1801,7 +1801,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri, ? AF_INET6 : p->family), attr); - } else if (CHECK_FLAG(ri->flags, BGP_INFO_ANNC_NH_SELF)) { + } else if (CHECK_FLAG(ri->flags, BGP_PATH_ANNC_NH_SELF)) { /* * This flag is used for leaked vpn-vrf routes */ @@ -1812,7 +1812,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri, if (bgp_debug_update(NULL, p, subgrp->update_group, 0)) zlog_debug( - "%s: BGP_INFO_ANNC_NH_SELF, family=%s", + "%s: BGP_PATH_ANNC_NH_SELF, family=%s", __func__, family2str(family)); subgroup_announce_reset_nhop(family, attr); } @@ -1862,14 +1862,14 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn, new_select = NULL; if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) { - /* Clear BGP_INFO_DMED_SELECTED for all paths */ + /* Clear BGP_PATH_DMED_SELECTED for all paths */ for (ri1 = rn->info; ri1; ri1 = ri1->next) - bgp_info_unset_flag(rn, ri1, BGP_INFO_DMED_SELECTED); + bgp_info_unset_flag(rn, ri1, BGP_PATH_DMED_SELECTED); for (ri1 = rn->info; ri1; ri1 = ri1->next) { - if (CHECK_FLAG(ri1->flags, BGP_INFO_DMED_CHECK)) + if (CHECK_FLAG(ri1->flags, BGP_PATH_DMED_CHECK)) continue; - if (BGP_INFO_HOLDDOWN(ri1)) + if (BGP_PATH_HOLDDOWN(ri1)) continue; if (ri1->peer && ri1->peer != bgp->peer_self) if (ri1->peer->status != Established) @@ -1879,9 +1879,9 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn, if (ri1->next) { for (ri2 = ri1->next; ri2; ri2 = ri2->next) { if (CHECK_FLAG(ri2->flags, - BGP_INFO_DMED_CHECK)) + BGP_PATH_DMED_CHECK)) continue; - if (BGP_INFO_HOLDDOWN(ri2)) + if (BGP_PATH_HOLDDOWN(ri2)) continue; if (ri2->peer && ri2->peer != bgp->peer_self @@ -1905,19 +1905,19 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn, afi, safi)) { bgp_info_unset_flag( rn, new_select, - BGP_INFO_DMED_SELECTED); + BGP_PATH_DMED_SELECTED); new_select = ri2; } bgp_info_set_flag( rn, ri2, - BGP_INFO_DMED_CHECK); + BGP_PATH_DMED_CHECK); } } } - bgp_info_set_flag(rn, new_select, BGP_INFO_DMED_CHECK); + bgp_info_set_flag(rn, new_select, BGP_PATH_DMED_CHECK); bgp_info_set_flag(rn, new_select, - BGP_INFO_DMED_SELECTED); + BGP_PATH_DMED_SELECTED); if (debug) { bgp_info_path_with_addpath_rx_str(new_select, @@ -1935,14 +1935,14 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn, new_select = NULL; for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1); ri = nextri) { - if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) + if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) old_select = ri; - if (BGP_INFO_HOLDDOWN(ri)) { + if (BGP_PATH_HOLDDOWN(ri)) { /* reap REMOVED routes, if needs be * selected route must stay for a while longer though */ - if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED) + if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED) && (ri != old_select)) bgp_info_reap(rn, ri); @@ -1966,14 +1966,14 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn, } if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED) - && (!CHECK_FLAG(ri->flags, BGP_INFO_DMED_SELECTED))) { - bgp_info_unset_flag(rn, ri, BGP_INFO_DMED_CHECK); + && (!CHECK_FLAG(ri->flags, BGP_PATH_DMED_SELECTED))) { + bgp_info_unset_flag(rn, ri, BGP_PATH_DMED_CHECK); if (debug) zlog_debug("%s: ri %p dmed", __func__, ri); continue; } - bgp_info_unset_flag(rn, ri, BGP_INFO_DMED_CHECK); + bgp_info_unset_flag(rn, ri, BGP_PATH_DMED_CHECK); if (bgp_info_cmp(bgp, ri, new_select, &paths_eq, mpath_cfg, debug, pfx_buf, afi, safi)) { @@ -2012,7 +2012,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn, continue; } - if (BGP_INFO_HOLDDOWN(ri)) + if (BGP_PATH_HOLDDOWN(ri)) continue; if (ri->peer && ri->peer != bgp->peer_self @@ -2115,10 +2115,10 @@ void bgp_zebra_clear_route_change_flags(struct bgp_node *rn) struct bgp_info *ri; for (ri = rn->info; ri; ri = ri->next) { - if (BGP_INFO_HOLDDOWN(ri)) + if (BGP_PATH_HOLDDOWN(ri)) continue; - UNSET_FLAG(ri->flags, BGP_INFO_IGP_CHANGED); - UNSET_FLAG(ri->flags, BGP_INFO_ATTR_CHANGED); + UNSET_FLAG(ri->flags, BGP_PATH_IGP_CHANGED); + UNSET_FLAG(ri->flags, BGP_PATH_ATTR_CHANGED); } } @@ -2137,8 +2137,8 @@ int bgp_zebra_has_route_changed(struct bgp_node *rn, struct bgp_info *selected) * we handle the case of BGP nexthop change. This is the behavior * when the best path has an attribute change anyway. */ - if (CHECK_FLAG(selected->flags, BGP_INFO_IGP_CHANGED) - || CHECK_FLAG(selected->flags, BGP_INFO_MULTIPATH_CHG)) + if (CHECK_FLAG(selected->flags, BGP_PATH_IGP_CHANGED) + || CHECK_FLAG(selected->flags, BGP_PATH_MULTIPATH_CHG)) return 1; /* @@ -2146,8 +2146,8 @@ int bgp_zebra_has_route_changed(struct bgp_node *rn, struct bgp_info *selected) */ for (mpinfo = bgp_info_mpath_first(selected); mpinfo; mpinfo = bgp_info_mpath_next(mpinfo)) { - if (CHECK_FLAG(mpinfo->flags, BGP_INFO_IGP_CHANGED) - || CHECK_FLAG(mpinfo->flags, BGP_INFO_ATTR_CHANGED)) + if (CHECK_FLAG(mpinfo->flags, BGP_PATH_IGP_CHANGED) + || CHECK_FLAG(mpinfo->flags, BGP_PATH_ATTR_CHANGED)) return 1; } @@ -2269,7 +2269,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn, */ if (old_select && old_select == new_select && !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR) - && !CHECK_FLAG(old_select->flags, BGP_INFO_ATTR_CHANGED) + && !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED) && !bgp->addpath_tx_used[afi][safi]) { if (bgp_zebra_has_route_changed(rn, old_select)) { #if ENABLE_BGP_VNC @@ -2288,12 +2288,12 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn, bgp, afi, safi); } } - UNSET_FLAG(old_select->flags, BGP_INFO_MULTIPATH_CHG); + UNSET_FLAG(old_select->flags, BGP_PATH_MULTIPATH_CHG); bgp_zebra_clear_route_change_flags(rn); /* If there is a change of interest to peers, reannounce the * route. */ - if (CHECK_FLAG(old_select->flags, BGP_INFO_ATTR_CHANGED) + if (CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED) || CHECK_FLAG(rn->flags, BGP_NODE_LABEL_CHANGED)) { group_announce_route(bgp, afi, safi, rn, new_select); @@ -2304,7 +2304,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn, SAFI_LABELED_UNICAST, rn, new_select); - UNSET_FLAG(old_select->flags, BGP_INFO_ATTR_CHANGED); + UNSET_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED); UNSET_FLAG(rn->flags, BGP_NODE_LABEL_CHANGED); } @@ -2331,13 +2331,13 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn, } if (old_select) - bgp_info_unset_flag(rn, old_select, BGP_INFO_SELECTED); + bgp_info_unset_flag(rn, old_select, BGP_PATH_SELECTED); if (new_select) { if (debug) zlog_debug("%s: setting SELECTED flag", __func__); - bgp_info_set_flag(rn, new_select, BGP_INFO_SELECTED); - bgp_info_unset_flag(rn, new_select, BGP_INFO_ATTR_CHANGED); - UNSET_FLAG(new_select->flags, BGP_INFO_MULTIPATH_CHG); + bgp_info_set_flag(rn, new_select, BGP_PATH_SELECTED); + bgp_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED); + UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG); } #if ENABLE_BGP_VNC @@ -2425,7 +2425,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn, bgp_zebra_clear_route_change_flags(rn); /* Reap old select bgp_info, if it has been removed */ - if (old_select && CHECK_FLAG(old_select->flags, BGP_INFO_REMOVED)) + if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED)) bgp_info_reap(rn, old_select); UNSET_FLAG(rn->flags, BGP_NODE_PROCESS_SCHEDULED); @@ -2674,7 +2674,7 @@ void bgp_rib_remove(struct bgp_node *rn, struct bgp_info *ri, struct peer *peer, { bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi, safi); - if (!CHECK_FLAG(ri->flags, BGP_INFO_HISTORY)) + if (!CHECK_FLAG(ri->flags, BGP_PATH_HISTORY)) bgp_info_delete(rn, ri); /* keep historical info */ bgp_process(peer->bgp, rn, afi, safi); @@ -2712,7 +2712,7 @@ static void bgp_rib_withdraw(struct bgp_node *rn, struct bgp_info *ri, bgp_unlock_node(prn); } if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) { - if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) { + if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) { vnc_import_bgp_del_route(peer->bgp, &rn->p, ri); vnc_import_bgp_exterior_del_route(peer->bgp, &rn->p, @@ -3019,7 +3019,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, same_attr = attrhash_cmp(ri->attr, attr_new); /* Same attribute comes in. */ - if (!CHECK_FLAG(ri->flags, BGP_INFO_REMOVED) + if (!CHECK_FLAG(ri->flags, BGP_PATH_REMOVED) && attrhash_cmp(ri->attr, attr_new) && (!has_valid_label || memcmp(&(bgp_info_extra_get(ri))->label, label, @@ -3031,7 +3031,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING) && peer->sort == BGP_PEER_EBGP - && CHECK_FLAG(ri->flags, BGP_INFO_HISTORY)) { + && CHECK_FLAG(ri->flags, BGP_PATH_HISTORY)) { if (bgp_debug_update(peer, p, NULL, 1)) { bgp_debug_rdpfxpath2str( afi, safi, prd, p, label, @@ -3070,9 +3070,9 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, } /* graceful restart STALE flag unset. */ - if (CHECK_FLAG(ri->flags, BGP_INFO_STALE)) { + if (CHECK_FLAG(ri->flags, BGP_PATH_STALE)) { bgp_info_unset_flag(rn, ri, - BGP_INFO_STALE); + BGP_PATH_STALE); bgp_process(bgp, rn, afi, safi); } } @@ -3084,7 +3084,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, } /* Withdraw/Announce before we fully processed the withdraw */ - if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) { + if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) { if (bgp_debug_update(peer, p, NULL, 1)) { bgp_debug_rdpfxpath2str( afi, safi, prd, p, label, num_labels, @@ -3108,11 +3108,11 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, } /* graceful restart STALE flag unset. */ - if (CHECK_FLAG(ri->flags, BGP_INFO_STALE)) - bgp_info_unset_flag(rn, ri, BGP_INFO_STALE); + if (CHECK_FLAG(ri->flags, BGP_PATH_STALE)) + bgp_info_unset_flag(rn, ri, BGP_PATH_STALE); /* The attribute is changed. */ - bgp_info_set_flag(rn, ri, BGP_INFO_ATTR_CHANGED); + bgp_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED); /* implicit withdraw, decrement aggregate and pcount here. * only if update is accepted, they'll increment below. @@ -3125,7 +3125,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, /* This is implicit withdraw so we should update dampening information. */ - if (!CHECK_FLAG(ri->flags, BGP_INFO_HISTORY)) + if (!CHECK_FLAG(ri->flags, BGP_PATH_HISTORY)) bgp_damp_withdraw(ri, rn, afi, safi, 1); } #if ENABLE_BGP_VNC @@ -3145,7 +3145,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, } if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) { - if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) { + if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) { /* * Implicit withdraw case. */ @@ -3261,7 +3261,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, afi, ri, NULL, connected) || CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD)) - bgp_info_set_flag(rn, ri, BGP_INFO_VALID); + bgp_info_set_flag(rn, ri, BGP_PATH_VALID); else { if (BGP_DEBUG(nht, NHT)) { char buf1[INET6_ADDRSTRLEN]; @@ -3272,10 +3272,10 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, zlog_debug("%s(%s): NH unresolved", __FUNCTION__, buf1); } - bgp_info_unset_flag(rn, ri, BGP_INFO_VALID); + bgp_info_unset_flag(rn, ri, BGP_PATH_VALID); } } else - bgp_info_set_flag(rn, ri, BGP_INFO_VALID); + bgp_info_set_flag(rn, ri, BGP_PATH_VALID); #if ENABLE_BGP_VNC if (safi == SAFI_MPLS_VPN) { @@ -3388,7 +3388,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, if (bgp_find_or_add_nexthop(bgp, bgp, afi, new, NULL, connected) || CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD)) - bgp_info_set_flag(rn, new, BGP_INFO_VALID); + bgp_info_set_flag(rn, new, BGP_PATH_VALID); else { if (BGP_DEBUG(nht, NHT)) { char buf1[INET6_ADDRSTRLEN]; @@ -3398,10 +3398,10 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, zlog_debug("%s(%s): NH unresolved", __FUNCTION__, buf1); } - bgp_info_unset_flag(rn, new, BGP_INFO_VALID); + bgp_info_unset_flag(rn, new, BGP_PATH_VALID); } } else - bgp_info_set_flag(rn, new, BGP_INFO_VALID); + bgp_info_set_flag(rn, new, BGP_PATH_VALID); /* Addpath ID */ new->addpath_rx_id = addpath_id; @@ -3589,7 +3589,7 @@ int bgp_withdraw(struct peer *peer, struct prefix *p, uint32_t addpath_id, } /* Withdraw specified route from routing table. */ - if (ri && !CHECK_FLAG(ri->flags, BGP_INFO_HISTORY)) { + if (ri && !CHECK_FLAG(ri->flags, BGP_PATH_HISTORY)) { bgp_rib_withdraw(rn, ri, peer, afi, safi, prd); if (SAFI_UNICAST == safi && (bgp->inst_type == BGP_INSTANCE_TYPE_VRF @@ -3801,9 +3801,9 @@ static wq_item_status bgp_clear_route_node(struct work_queue *wq, void *data) /* graceful restart STALE flag set. */ if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT) && peer->nsf[afi][safi] - && !CHECK_FLAG(ri->flags, BGP_INFO_STALE) - && !CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE)) - bgp_info_set_flag(rn, ri, BGP_INFO_STALE); + && !CHECK_FLAG(ri->flags, BGP_PATH_STALE) + && !CHECK_FLAG(ri->flags, BGP_PATH_UNUSEABLE)) + bgp_info_set_flag(rn, ri, BGP_PATH_STALE); else { /* If this is an EVPN route, process for * un-import. */ @@ -4061,7 +4061,7 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi) if (ri->peer != peer) continue; if (!CHECK_FLAG(ri->flags, - BGP_INFO_STALE)) + BGP_PATH_STALE)) break; bgp_rib_remove(rm, ri, peer, afi, safi); @@ -4074,7 +4074,7 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi) for (ri = rn->info; ri; ri = ri->next) { if (ri->peer != peer) continue; - if (!CHECK_FLAG(ri->flags, BGP_INFO_STALE)) + if (!CHECK_FLAG(ri->flags, BGP_PATH_STALE)) break; bgp_rib_remove(rn, ri, peer, afi, safi); break; @@ -4092,7 +4092,7 @@ static void bgp_cleanup_table(struct bgp *bgp, struct bgp_table *table, for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) for (ri = rn->info; ri; ri = next) { next = ri->next; - if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) + if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED) && ri->type == ZEBRA_ROUTE_BGP && (ri->sub_type == BGP_ROUTE_NORMAL || ri->sub_type == BGP_ROUTE_AGGREGATE @@ -4426,7 +4426,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p, if (ri) { if (attrhash_cmp(ri->attr, attr_new) - && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED) + && !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED) && !bgp_flag_check(bgp, BGP_FLAG_FORCE_STATIC_PROCESS)) { bgp_unlock_node(rn); bgp_attr_unintern(&attr_new); @@ -4434,17 +4434,17 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p, return; } else { /* The attribute is changed. */ - bgp_info_set_flag(rn, ri, BGP_INFO_ATTR_CHANGED); + bgp_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED); /* Rewrite BGP route information. */ - if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) bgp_info_restore(rn, ri); else bgp_aggregate_decrement(bgp, p, ri, afi, safi); #if ENABLE_BGP_VNC if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) { - if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) { + if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) { /* * Implicit withdraw case. * We have to do this before ri is @@ -4484,7 +4484,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p, if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, afi, ri, NULL, 0)) bgp_info_set_flag(rn, ri, - BGP_INFO_VALID); + BGP_PATH_VALID); else { if (BGP_DEBUG(nht, NHT)) { char buf1[INET6_ADDRSTRLEN]; @@ -4496,7 +4496,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p, __FUNCTION__, buf1); } bgp_info_unset_flag(rn, ri, - BGP_INFO_VALID); + BGP_PATH_VALID); } } else { /* Delete the NHT structure if any, if we're @@ -4507,7 +4507,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p, * process interaction */ bgp_unlink_nexthop(ri); - bgp_info_set_flag(rn, ri, BGP_INFO_VALID); + bgp_info_set_flag(rn, ri, BGP_PATH_VALID); } /* Process change. */ bgp_aggregate_increment(bgp, p, ri, afi, safi); @@ -4534,7 +4534,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p, if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK) && (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST)) { if (bgp_find_or_add_nexthop(bgp, bgp, afi, new, NULL, 0)) - bgp_info_set_flag(rn, new, BGP_INFO_VALID); + bgp_info_set_flag(rn, new, BGP_PATH_VALID); else { if (BGP_DEBUG(nht, NHT)) { char buf1[INET6_ADDRSTRLEN]; @@ -4544,7 +4544,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p, "%s(%s): Route not in table, not advertising", __FUNCTION__, buf1); } - bgp_info_unset_flag(rn, new, BGP_INFO_VALID); + bgp_info_unset_flag(rn, new, BGP_PATH_VALID); } } else { /* Delete the NHT structure if any, if we're toggling between @@ -4553,7 +4553,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p, */ bgp_unlink_nexthop(new); - bgp_info_set_flag(rn, new, BGP_INFO_VALID); + bgp_info_set_flag(rn, new, BGP_PATH_VALID); } /* Aggregate address increment. */ @@ -4740,17 +4740,17 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p, memset(&add, 0, sizeof(union gw_addr)); if (attrhash_cmp(ri->attr, attr_new) && overlay_index_equal(afi, ri, bgp_static->eth_s_id, &add) - && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) { + && !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) { bgp_unlock_node(rn); bgp_attr_unintern(&attr_new); aspath_unintern(&attr.aspath); return; } else { /* The attribute is changed. */ - bgp_info_set_flag(rn, ri, BGP_INFO_ATTR_CHANGED); + bgp_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED); /* Rewrite BGP route information. */ - if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) bgp_info_restore(rn, ri); else bgp_aggregate_decrement(bgp, p, ri, afi, safi); @@ -4785,7 +4785,7 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p, /* Make new BGP info. */ new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0, bgp->peer_self, attr_new, rn); - SET_FLAG(new->flags, BGP_INFO_VALID); + SET_FLAG(new->flags, BGP_PATH_VALID); new->extra = bgp_info_extra_new(); if (num_labels) { new->extra->label[0] = bgp_static->label; @@ -5488,7 +5488,7 @@ static int bgp_aggregate_info_same(struct bgp_info *ri, uint8_t origin, if (!community_cmp(ri->attr->community, comm)) return 0; - if (!CHECK_FLAG(ri->flags, BGP_INFO_VALID)) + if (!CHECK_FLAG(ri->flags, BGP_PATH_VALID)) return 0; return 1; @@ -5543,7 +5543,7 @@ static void bgp_aggregate_install(struct bgp *bgp, afi_t afi, safi_t safi, community, aggregate->as_set, atomic_aggregate), rn); - SET_FLAG(new->flags, BGP_INFO_VALID); + SET_FLAG(new->flags, BGP_PATH_VALID); bgp_info_add(rn, new); bgp_process(bgp, rn, afi, safi); @@ -5603,7 +5603,7 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p, match = 0; for (ri = rn->info; ri; ri = ri->next) { - if (BGP_INFO_HOLDDOWN(ri)) + if (BGP_PATH_HOLDDOWN(ri)) continue; if (del && ri == del) @@ -5623,7 +5623,7 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p, if (aggregate->summary_only) { (bgp_info_extra_get(ri))->suppress++; bgp_info_set_flag(rn, ri, - BGP_INFO_ATTR_CHANGED); + BGP_PATH_ATTR_CHANGED); match++; } @@ -5737,7 +5737,7 @@ static void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi, match = 0; for (ri = rn->info; ri; ri = ri->next) { - if (BGP_INFO_HOLDDOWN(ri)) + if (BGP_PATH_HOLDDOWN(ri)) continue; if (ri->sub_type == BGP_ROUTE_AGGREGATE) @@ -5748,7 +5748,7 @@ static void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi, if (ri->extra->suppress == 0) { bgp_info_set_flag( - rn, ri, BGP_INFO_ATTR_CHANGED); + rn, ri, BGP_PATH_ATTR_CHANGED); match++; } } @@ -5779,7 +5779,7 @@ void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p, if (p->prefixlen == 0) return; - if (BGP_INFO_HOLDDOWN(ri)) + if (BGP_PATH_HOLDDOWN(ri)) return; child = bgp_node_get(table, p); @@ -6159,7 +6159,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, /* Ensure the (source route) type is updated. */ bi->type = type; if (attrhash_cmp(bi->attr, new_attr) - && !CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) { + && !CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) { bgp_attr_unintern(&new_attr); aspath_unintern(&attr.aspath); bgp_unlock_node(bn); @@ -6167,10 +6167,10 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, } else { /* The attribute is changed. */ bgp_info_set_flag(bn, bi, - BGP_INFO_ATTR_CHANGED); + BGP_PATH_ATTR_CHANGED); /* Rewrite BGP route information. */ - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) bgp_info_restore(bn, bi); else bgp_aggregate_decrement(bgp, p, bi, afi, @@ -6199,7 +6199,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, new = info_make(type, BGP_ROUTE_REDISTRIBUTE, instance, bgp->peer_self, new_attr, bn); - SET_FLAG(new->flags, BGP_INFO_VALID); + SET_FLAG(new->flags, BGP_PATH_VALID); bgp_aggregate_increment(bgp, p, new, afi, SAFI_UNICAST); bgp_info_add(bn, new); @@ -6346,30 +6346,30 @@ static void route_vty_short_status_out(struct vty *vty, struct bgp_info *binfo, if (json_path) { /* Route status display. */ - if (CHECK_FLAG(binfo->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_REMOVED)) json_object_boolean_true_add(json_path, "removed"); - if (CHECK_FLAG(binfo->flags, BGP_INFO_STALE)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_STALE)) json_object_boolean_true_add(json_path, "stale"); if (binfo->extra && binfo->extra->suppress) json_object_boolean_true_add(json_path, "suppressed"); - if (CHECK_FLAG(binfo->flags, BGP_INFO_VALID) - && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_VALID) + && !CHECK_FLAG(binfo->flags, BGP_PATH_HISTORY)) json_object_boolean_true_add(json_path, "valid"); /* Selected */ - if (CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_HISTORY)) json_object_boolean_true_add(json_path, "history"); - if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED)) json_object_boolean_true_add(json_path, "damped"); - if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_SELECTED)) json_object_boolean_true_add(json_path, "bestpath"); - if (CHECK_FLAG(binfo->flags, BGP_INFO_MULTIPATH)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_MULTIPATH)) json_object_boolean_true_add(json_path, "multipath"); /* Internal route. */ @@ -6385,26 +6385,26 @@ static void route_vty_short_status_out(struct vty *vty, struct bgp_info *binfo, } /* Route status display. */ - if (CHECK_FLAG(binfo->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_REMOVED)) vty_out(vty, "R"); - else if (CHECK_FLAG(binfo->flags, BGP_INFO_STALE)) + else if (CHECK_FLAG(binfo->flags, BGP_PATH_STALE)) vty_out(vty, "S"); else if (binfo->extra && binfo->extra->suppress) vty_out(vty, "s"); - else if (CHECK_FLAG(binfo->flags, BGP_INFO_VALID) - && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) + else if (CHECK_FLAG(binfo->flags, BGP_PATH_VALID) + && !CHECK_FLAG(binfo->flags, BGP_PATH_HISTORY)) vty_out(vty, "*"); else vty_out(vty, " "); /* Selected */ - if (CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) + if (CHECK_FLAG(binfo->flags, BGP_PATH_HISTORY)) vty_out(vty, "h"); - else if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)) + else if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED)) vty_out(vty, "d"); - else if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED)) + else if (CHECK_FLAG(binfo->flags, BGP_PATH_SELECTED)) vty_out(vty, ">"); - else if (CHECK_FLAG(binfo->flags, BGP_INFO_MULTIPATH)) + else if (CHECK_FLAG(binfo->flags, BGP_PATH_MULTIPATH)) vty_out(vty, "="); else vty_out(vty, " "); @@ -6427,9 +6427,8 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo, json_object *json_nexthop_global = NULL; json_object *json_nexthop_ll = NULL; char vrf_id_str[VRF_NAMSIZ] = {0}; - bool nexthop_self = CHECK_FLAG(binfo->flags, BGP_INFO_ANNC_NH_SELF) - ? true - : false; + bool nexthop_self = + CHECK_FLAG(binfo->flags, BGP_PATH_ANNC_NH_SELF) ? true : false; bool nexthop_othervrf = false; vrf_id_t nexthop_vrfid = VRF_DEFAULT; const char *nexthop_vrfname = "Default"; @@ -7222,8 +7221,8 @@ static void flap_route_vty_out(struct vty *vty, struct prefix *p, vty_out(vty, "%s ", peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, 0, NULL)); - if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED) - && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) { + if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED) + && !CHECK_FLAG(binfo->flags, BGP_PATH_HISTORY)) { if (use_json) bgp_damp_reuse_time_vty(vty, binfo, timebuf, BGP_UPTIME_LEN, use_json, json); @@ -7343,9 +7342,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, int addpath_capable; int has_adj; unsigned int first_as; - bool nexthop_self = CHECK_FLAG(binfo->flags, BGP_INFO_ANNC_NH_SELF) - ? true - : false; + bool nexthop_self = + CHECK_FLAG(binfo->flags, BGP_PATH_ANNC_NH_SELF) ? true : false; if (json_paths) { json_path = json_object_new_object(); @@ -7403,7 +7401,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, } } - if (CHECK_FLAG(binfo->flags, BGP_INFO_REMOVED)) { + if (CHECK_FLAG(binfo->flags, BGP_PATH_REMOVED)) { if (json_paths) json_object_boolean_true_add(json_path, "removed"); @@ -7411,7 +7409,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, vty_out(vty, ", (removed)"); } - if (CHECK_FLAG(binfo->flags, BGP_INFO_STALE)) { + if (CHECK_FLAG(binfo->flags, BGP_PATH_STALE)) { if (json_paths) json_object_boolean_true_add(json_path, "stale"); @@ -7452,13 +7450,13 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, vty_out(vty, ", (Received from a RS-client)"); } - if (CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) { + if (CHECK_FLAG(binfo->flags, BGP_PATH_HISTORY)) { if (json_paths) json_object_boolean_true_add( json_path, "dampeningHistoryEntry"); else vty_out(vty, ", (history entry)"); - } else if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)) { + } else if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED)) { if (json_paths) json_object_boolean_true_add( json_path, "dampeningSuppressed"); @@ -7520,7 +7518,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, } /* Display the IGP cost or 'inaccessible' */ - if (!CHECK_FLAG(binfo->flags, BGP_INFO_VALID)) { + if (!CHECK_FLAG(binfo->flags, BGP_PATH_VALID)) { if (json_paths) json_object_boolean_false_add( json_nexthop_global, "accessible"); @@ -7778,13 +7776,13 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, attr->tag); } - if (!CHECK_FLAG(binfo->flags, BGP_INFO_VALID)) { + if (!CHECK_FLAG(binfo->flags, BGP_PATH_VALID)) { if (json_paths) json_object_boolean_false_add(json_path, "valid"); else vty_out(vty, ", invalid"); - } else if (!CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) { + } else if (!CHECK_FLAG(binfo->flags, BGP_PATH_HISTORY)) { if (json_paths) json_object_boolean_true_add(json_path, "valid"); @@ -7864,8 +7862,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, vty_out(vty, ", atomic-aggregate"); } - if (CHECK_FLAG(binfo->flags, BGP_INFO_MULTIPATH) - || (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED) + if (CHECK_FLAG(binfo->flags, BGP_PATH_MULTIPATH) + || (CHECK_FLAG(binfo->flags, BGP_PATH_SELECTED) && bgp_info_mpath_count(binfo))) { if (json_paths) json_object_boolean_true_add(json_path, @@ -7875,7 +7873,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, } // Mark the bestpath(s) - if (CHECK_FLAG(binfo->flags, BGP_INFO_DMED_SELECTED)) { + if (CHECK_FLAG(binfo->flags, BGP_PATH_DMED_SELECTED)) { first_as = aspath_get_first_as(attr->aspath); if (json_paths) { @@ -7894,7 +7892,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, } } - if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED)) { + if (CHECK_FLAG(binfo->flags, BGP_PATH_SELECTED)) { if (json_paths) { if (!json_bestpath) json_bestpath = @@ -8077,7 +8075,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, if ((addpath_capable && has_adj) || (!addpath_capable && has_adj && CHECK_FLAG(binfo->flags, - BGP_INFO_SELECTED))) { + BGP_PATH_SELECTED))) { if (json_path && !json_adv_to) json_adv_to = json_object_new_object(); @@ -8365,8 +8363,8 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, } if (type == bgp_show_type_dampend_paths || type == bgp_show_type_damp_neighbor) { - if (!CHECK_FLAG(ri->flags, BGP_INFO_DAMPED) - || CHECK_FLAG(ri->flags, BGP_INFO_HISTORY)) + if (!CHECK_FLAG(ri->flags, BGP_PATH_DAMPED) + || CHECK_FLAG(ri->flags, BGP_PATH_HISTORY)) continue; } @@ -8662,7 +8660,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp, for (ri = rn->info; ri; ri = ri->next) { count++; - if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) { + if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) { best = count; if (ri->extra && ri->extra->suppress) suppress = 1; @@ -8852,12 +8850,12 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp, if (pathtype == BGP_PATH_SHOW_ALL || (pathtype == BGP_PATH_SHOW_BESTPATH && CHECK_FLAG(ri->flags, - BGP_INFO_SELECTED)) + BGP_PATH_SELECTED)) || (pathtype == BGP_PATH_SHOW_MULTIPATH && (CHECK_FLAG(ri->flags, - BGP_INFO_MULTIPATH) + BGP_PATH_MULTIPATH) || CHECK_FLAG(ri->flags, - BGP_INFO_SELECTED)))) + BGP_PATH_SELECTED)))) route_vty_out_detail(vty, bgp, &rm->p, ri, AFI_IP, safi, json_paths); @@ -8891,15 +8889,15 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp, == BGP_PATH_SHOW_BESTPATH && CHECK_FLAG( ri->flags, - BGP_INFO_SELECTED)) + BGP_PATH_SELECTED)) || (pathtype == BGP_PATH_SHOW_MULTIPATH && (CHECK_FLAG( ri->flags, - BGP_INFO_MULTIPATH) + BGP_PATH_MULTIPATH) || CHECK_FLAG( ri->flags, - BGP_INFO_SELECTED)))) + BGP_PATH_SELECTED)))) route_vty_out_detail( vty, bgp, &rn->p, ri, afi, safi, json_paths); @@ -9901,27 +9899,27 @@ static int bgp_peer_count_walker(struct thread *t) pc->count[PCOUNT_ALL]++; - if (CHECK_FLAG(ri->flags, BGP_INFO_DAMPED)) + if (CHECK_FLAG(ri->flags, BGP_PATH_DAMPED)) pc->count[PCOUNT_DAMPED]++; - if (CHECK_FLAG(ri->flags, BGP_INFO_HISTORY)) + if (CHECK_FLAG(ri->flags, BGP_PATH_HISTORY)) pc->count[PCOUNT_HISTORY]++; - if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) pc->count[PCOUNT_REMOVED]++; - if (CHECK_FLAG(ri->flags, BGP_INFO_STALE)) + if (CHECK_FLAG(ri->flags, BGP_PATH_STALE)) pc->count[PCOUNT_STALE]++; - if (CHECK_FLAG(ri->flags, BGP_INFO_VALID)) + if (CHECK_FLAG(ri->flags, BGP_PATH_VALID)) pc->count[PCOUNT_VALID]++; - if (!CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE)) + if (!CHECK_FLAG(ri->flags, BGP_PATH_UNUSEABLE)) pc->count[PCOUNT_PFCNT]++; - if (CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) { + if (CHECK_FLAG(ri->flags, BGP_PATH_COUNTED)) { pc->count[PCOUNT_COUNTED]++; - if (CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE)) + if (CHECK_FLAG(ri->flags, BGP_PATH_UNUSEABLE)) flog_err( EC_LIB_DEVELOPMENT, "Attempting to count but flags say it is unusable"); } else { - if (!CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE)) + if (!CHECK_FLAG(ri->flags, BGP_PATH_UNUSEABLE)) flog_err( EC_LIB_DEVELOPMENT, "Not counted but flags say we should"); diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index c644ab62f7..ebfe0278fa 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -185,21 +185,21 @@ struct bgp_info { /* BGP information status. */ uint16_t flags; -#define BGP_INFO_IGP_CHANGED (1 << 0) -#define BGP_INFO_DAMPED (1 << 1) -#define BGP_INFO_HISTORY (1 << 2) -#define BGP_INFO_SELECTED (1 << 3) -#define BGP_INFO_VALID (1 << 4) -#define BGP_INFO_ATTR_CHANGED (1 << 5) -#define BGP_INFO_DMED_CHECK (1 << 6) -#define BGP_INFO_DMED_SELECTED (1 << 7) -#define BGP_INFO_STALE (1 << 8) -#define BGP_INFO_REMOVED (1 << 9) -#define BGP_INFO_COUNTED (1 << 10) -#define BGP_INFO_MULTIPATH (1 << 11) -#define BGP_INFO_MULTIPATH_CHG (1 << 12) -#define BGP_INFO_RIB_ATTR_CHG (1 << 13) -#define BGP_INFO_ANNC_NH_SELF (1 << 14) +#define BGP_PATH_IGP_CHANGED (1 << 0) +#define BGP_PATH_DAMPED (1 << 1) +#define BGP_PATH_HISTORY (1 << 2) +#define BGP_PATH_SELECTED (1 << 3) +#define BGP_PATH_VALID (1 << 4) +#define BGP_PATH_ATTR_CHANGED (1 << 5) +#define BGP_PATH_DMED_CHECK (1 << 6) +#define BGP_PATH_DMED_SELECTED (1 << 7) +#define BGP_PATH_STALE (1 << 8) +#define BGP_PATH_REMOVED (1 << 9) +#define BGP_PATH_COUNTED (1 << 10) +#define BGP_PATH_MULTIPATH (1 << 11) +#define BGP_PATH_MULTIPATH_CHG (1 << 12) +#define BGP_PATH_RIB_ATTR_CHG (1 << 13) +#define BGP_PATH_ANNC_NH_SELF (1 << 14) /* BGP route type. This can be static, RIP, OSPF, BGP etc. */ uint8_t type; @@ -277,20 +277,20 @@ struct bgp_static { #define BGP_ATTR_NEXTHOP_AFI_IP6(attr) \ (!CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) \ && ((attr)->mp_nexthop_len == 16 || (attr)->mp_nexthop_len == 32)) -#define BGP_INFO_COUNTABLE(BI) \ - (!CHECK_FLAG((BI)->flags, BGP_INFO_HISTORY) \ - && !CHECK_FLAG((BI)->flags, BGP_INFO_REMOVED)) +#define BGP_PATH_COUNTABLE(BI) \ + (!CHECK_FLAG((BI)->flags, BGP_PATH_HISTORY) \ + && !CHECK_FLAG((BI)->flags, BGP_PATH_REMOVED)) /* Flags which indicate a route is unuseable in some form */ -#define BGP_INFO_UNUSEABLE \ - (BGP_INFO_HISTORY | BGP_INFO_DAMPED | BGP_INFO_REMOVED) +#define BGP_PATH_UNUSEABLE \ + (BGP_PATH_HISTORY | BGP_PATH_DAMPED | BGP_PATH_REMOVED) /* Macro to check BGP information is alive or not. Sadly, * not equivalent to just checking previous, because of the * sense of the additional VALID flag. */ -#define BGP_INFO_HOLDDOWN(BI) \ - (!CHECK_FLAG((BI)->flags, BGP_INFO_VALID) \ - || CHECK_FLAG((BI)->flags, BGP_INFO_UNUSEABLE)) +#define BGP_PATH_HOLDDOWN(BI) \ + (!CHECK_FLAG((BI)->flags, BGP_PATH_VALID) \ + || CHECK_FLAG((BI)->flags, BGP_PATH_UNUSEABLE)) #define DISTRIBUTE_IN_NAME(F) ((F)->dlist[FILTER_IN].name) #define DISTRIBUTE_IN(F) ((F)->dlist[FILTER_IN].alist) diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index 7f7b4a893f..e2e25e50f5 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -1912,7 +1912,7 @@ int bgp_addpath_tx_path(struct peer *peer, afi_t afi, safi_t safi, if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS) - && CHECK_FLAG(ri->flags, BGP_INFO_DMED_SELECTED)) + && CHECK_FLAG(ri->flags, BGP_PATH_DMED_SELECTED)) return 1; return 0; diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index 6ffb1d448b..e4fda568e8 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -594,7 +594,7 @@ void subgroup_announce_table(struct update_subgroup *subgrp, for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) for (ri = rn->info; ri; ri = ri->next) - if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) + if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED) || (addpath_capable && bgp_addpath_tx_path(peer, afi, safi, ri))) { if (subgroup_announce_check(rn, ri, subgrp, diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 5a5c7c9861..1b6364ca9a 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1480,7 +1480,7 @@ void bgp_zebra_announce_table(struct bgp *bgp, afi_t afi, safi_t safi) for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) for (ri = rn->info; ri; ri = ri->next) - if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) && + if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED) && (ri->type == ZEBRA_ROUTE_BGP && (ri->sub_type == BGP_ROUTE_NORMAL @@ -1704,7 +1704,7 @@ int bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red, bgp_attr_unintern(&old_attr); bgp_info_set_flag(rn, ri, - BGP_INFO_ATTR_CHANGED); + BGP_PATH_ATTR_CHANGED); bgp_process(bgp, rn, afi, SAFI_UNICAST); } } diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index c7c2239db7..0845f2d825 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -999,7 +999,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */ } if (attrhash_cmp(bi->attr, new_attr) - && !CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) { + && !CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) { bgp_attr_unintern(&new_attr); bgp_unlock_node(bn); @@ -1010,7 +1010,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */ goto done; } else { /* The attribute is changed. */ - bgp_info_set_flag(bn, bi, BGP_INFO_ATTR_CHANGED); + bgp_info_set_flag(bn, bi, BGP_PATH_ATTR_CHANGED); if (safi == SAFI_MPLS_VPN) { struct bgp_node *prn = NULL; @@ -1028,7 +1028,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */ } /* Rewrite BGP route information. */ - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) bgp_info_restore(bn, bi); else bgp_aggregate_decrement(bgp, p, bi, afi, safi); @@ -1070,7 +1070,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */ new->type = type; new->sub_type = sub_type; new->peer = rfd->peer; - SET_FLAG(new->flags, BGP_INFO_VALID); + SET_FLAG(new->flags, BGP_PATH_VALID); new->attr = new_attr; new->uptime = bgp_clock(); diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 398de6b3a1..da617f53a6 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -157,7 +157,7 @@ void rfapiCheckRouteCount() next = bi->next; if (CHECK_FLAG(bi->flags, - BGP_INFO_REMOVED)) { + BGP_PATH_REMOVED)) { ++holddown_count; } else { @@ -891,7 +891,7 @@ static void rfapiBgpInfoChainFree(struct bgp_info *bi) * If there is a timer waiting to delete this bi, cancel * the timer and delete immediately */ - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED) && bi->extra->vnc.import.timer) { struct thread *t = @@ -1490,7 +1490,7 @@ int rfapiHasNonRemovedRoutes(struct agg_node *rn) for (bi = rn->info; bi; bi = bi->next) { struct prefix pfx; - if (!CHECK_FLAG(bi->flags, BGP_INFO_REMOVED) + if (!CHECK_FLAG(bi->flags, BGP_PATH_REMOVED) && (bi->extra && !rfapiGetUnAddrOfVpnBi(bi, &pfx))) { return 1; @@ -1513,7 +1513,7 @@ void rfapiDumpNode(struct agg_node *rn) int ctrc = rfapiGetUnAddrOfVpnBi(bi, &pfx); int nr; - if (!CHECK_FLAG(bi->flags, BGP_INFO_REMOVED) + if (!CHECK_FLAG(bi->flags, BGP_PATH_REMOVED) && (bi->extra && !ctrc)) { nr = 1; @@ -1567,7 +1567,7 @@ static int rfapiNhlAddNodeRoutes( struct prefix pfx_vn; struct prefix *newpfx; - if (removed && !CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) { + if (removed && !CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) { #if DEBUG_RETURNED_NHL vnc_zlog_debug_verbose( "%s: want holddown, this route not holddown, skip", @@ -1575,7 +1575,7 @@ static int rfapiNhlAddNodeRoutes( #endif continue; } - if (!removed && CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) { + if (!removed && CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) { continue; } @@ -1748,8 +1748,8 @@ static int rfapiNhlAddSubtree( * Construct an rfapi nexthop list based on the routes attached to * the specified node. * - * If there are any routes that do NOT have BGP_INFO_REMOVED set, - * return those only. If there are ONLY routes with BGP_INFO_REMOVED, + * If there are any routes that do NOT have BGP_PATH_REMOVED set, + * return those only. If there are ONLY routes with BGP_PATH_REMOVED, * then return those, and also include all the non-removed routes from the * next less-specific node (i.e., this node's parent) at the end. */ @@ -2015,8 +2015,9 @@ static void rfapiBgpInfoAttachSorted(struct agg_node *rn, for (prev = NULL, next = rn->info; next; prev = next, next = next->next) { - if (!bgp || (!CHECK_FLAG(info_new->flags, BGP_INFO_REMOVED) - && CHECK_FLAG(next->flags, BGP_INFO_REMOVED)) + if (!bgp + || (!CHECK_FLAG(info_new->flags, BGP_PATH_REMOVED) + && CHECK_FLAG(next->flags, BGP_PATH_REMOVED)) || bgp_info_cmp_compatible(bgp, info_new, next, pfx_buf, afi, safi) == -1) { /* -1 if 1st is better */ @@ -2443,7 +2444,7 @@ static int rfapiWithdrawTimerVPN(struct thread *t) /* * Remove the route (doubly-linked) */ - if (CHECK_FLAG(bi->flags, BGP_INFO_VALID) + if (CHECK_FLAG(bi->flags, BGP_PATH_VALID) && VALID_INTERIOR_TYPE(bi->type)) RFAPI_MONITOR_EXTERIOR(wcb->node)->valid_interior_count--; @@ -2680,9 +2681,9 @@ static int rfapiWithdrawEncapUpdateCachedUn( vpn_bi->extra->vnc.import.un_family = 0; memset(&vpn_bi->extra->vnc.import.un, 0, sizeof(vpn_bi->extra->vnc.import.un)); - if (CHECK_FLAG(vpn_bi->flags, BGP_INFO_VALID)) { + if (CHECK_FLAG(vpn_bi->flags, BGP_PATH_VALID)) { if (rfapiGetVncTunnelUnAddr(vpn_bi->attr, NULL)) { - UNSET_FLAG(vpn_bi->flags, BGP_INFO_VALID); + UNSET_FLAG(vpn_bi->flags, BGP_PATH_VALID); if (VALID_INTERIOR_TYPE(vpn_bi->type)) RFAPI_MONITOR_EXTERIOR(vpn_rn) ->valid_interior_count--; @@ -2701,8 +2702,8 @@ static int rfapiWithdrawEncapUpdateCachedUn( return 1; } rfapiCopyUnEncap2VPN(encap_bi, vpn_bi); - if (!CHECK_FLAG(vpn_bi->flags, BGP_INFO_VALID)) { - SET_FLAG(vpn_bi->flags, BGP_INFO_VALID); + if (!CHECK_FLAG(vpn_bi->flags, BGP_PATH_VALID)) { + SET_FLAG(vpn_bi->flags, BGP_PATH_VALID); if (VALID_INTERIOR_TYPE(vpn_bi->type)) RFAPI_MONITOR_EXTERIOR(vpn_rn) ->valid_interior_count++; @@ -2807,7 +2808,7 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table, uint32_t lifetime; struct rfapi_withdraw *wcb; - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) { + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) { /* * Already on the path to being withdrawn, * should already have a timer set up to @@ -2824,7 +2825,7 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table, /* * withdrawn routes get to hang around for a while */ - SET_FLAG(bi->flags, BGP_INFO_REMOVED); + SET_FLAG(bi->flags, BGP_PATH_REMOVED); /* set timer to remove the route later */ lifetime = rfapiGetHolddownFromLifetime(lifetime); @@ -2874,7 +2875,7 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table, &bi->extra->vnc.import.timer); } - /* re-sort route list (BGP_INFO_REMOVED routes are last) */ + /* re-sort route list (BGP_PATH_REMOVED routes are last) */ if (((struct bgp_info *)rn->info)->next) { rfapiBgpInfoDetach(rn, bi); rfapiBgpInfoAttachSorted(rn, bi, afi, safi); @@ -3136,7 +3137,7 @@ static void rfapiBgpInfoFilteredImportEncap( * a previous withdraw, we must cancel its * timer. */ - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED) && bi->extra->vnc.import.timer) { struct thread *t = @@ -3213,7 +3214,7 @@ static void rfapiBgpInfoFilteredImportEncap( int un_match = 0; next = bi->next; - if (!CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (!CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) continue; /* @@ -3290,8 +3291,8 @@ static void rfapiBgpInfoFilteredImportEncap( * the address family of the cached UN address field. */ rfapiCopyUnEncap2VPN(info_new, m->bi); - if (!CHECK_FLAG(m->bi->flags, BGP_INFO_VALID)) { - SET_FLAG(m->bi->flags, BGP_INFO_VALID); + if (!CHECK_FLAG(m->bi->flags, BGP_PATH_VALID)) { + SET_FLAG(m->bi->flags, BGP_PATH_VALID); if (VALID_INTERIOR_TYPE(m->bi->type)) RFAPI_MONITOR_EXTERIOR(m->node) ->valid_interior_count++; @@ -3558,7 +3559,7 @@ void rfapiBgpInfoFilteredImportVPN( if (action == FIF_ACTION_WITHDRAW) { int washolddown = - CHECK_FLAG(bi->flags, BGP_INFO_REMOVED); + CHECK_FLAG(bi->flags, BGP_PATH_REMOVED); vnc_zlog_debug_verbose( "%s: withdrawing at prefix %s/%d%s", @@ -3599,7 +3600,7 @@ void rfapiBgpInfoFilteredImportVPN( * a previous withdraw, we must cancel its * timer. */ - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED) && bi->extra->vnc.import.timer) { struct thread *t = @@ -3636,7 +3637,7 @@ void rfapiBgpInfoFilteredImportVPN( * processing */ if (CHECK_FLAG(bi->flags, - BGP_INFO_VALID) + BGP_PATH_VALID) && VALID_INTERIOR_TYPE(bi->type)) RFAPI_MONITOR_EXTERIOR(rn) ->valid_interior_count--; @@ -3718,7 +3719,7 @@ void rfapiBgpInfoFilteredImportVPN( if (!rfapiGetUnAddrOfVpnBi(info_new, NULL)) { if (VALID_INTERIOR_TYPE(info_new->type)) RFAPI_MONITOR_EXTERIOR(rn)->valid_interior_count++; - SET_FLAG(info_new->flags, BGP_INFO_VALID); + SET_FLAG(info_new->flags, BGP_PATH_VALID); } RFAPI_UPDATE_ITABLE_COUNT(info_new, import_table, afi, 1); vnc_import_bgp_exterior_add_route_interior(bgp, import_table, rn, @@ -3794,7 +3795,7 @@ void rfapiBgpInfoFilteredImportVPN( /* * Must be holddown */ - if (!CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (!CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) continue; /* @@ -4140,7 +4141,7 @@ static void rfapiProcessPeerDownRt(struct peer *peer, for (bi = rn->info; bi; bi = bi->next) { if (bi->peer == peer) { - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) { + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) { /* already in holddown, skip */ continue; } @@ -4244,7 +4245,7 @@ static void rfapiBgpTableFilteredImport(struct bgp *bgp, uint32_t label = 0; if (CHECK_FLAG(bi->flags, - BGP_INFO_REMOVED)) + BGP_PATH_REMOVED)) continue; if (bi->extra) @@ -4552,7 +4553,7 @@ static void rfapiDeleteRemotePrefixesIt( * a previous withdraw, we must cancel its * timer. */ - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) { + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) { if (!delete_holddown) continue; if (bi->extra->vnc.import.timer) { diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 1af9479a6a..cae004c2e1 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -506,7 +506,7 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi) if (!bi) return; - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED) && bi->extra + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED) && bi->extra && bi->extra->vnc.import.timer) { struct thread *t = (struct thread *)bi->extra->vnc.import.timer; r = snprintf(p, REMAIN, " [%4lu] ", @@ -619,7 +619,7 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi) r = snprintf(p, REMAIN, " p@%p", bi->peer); INCP; - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) { + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) { r = snprintf(p, REMAIN, " HD=yes"); INCP; } else { @@ -1113,7 +1113,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream, fp(out, "%-10s ", buf_lifetime); } - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED) && bi->extra + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED) && bi->extra && bi->extra->vnc.import.timer) { uint32_t remaining; @@ -1247,11 +1247,11 @@ static int rfapiShowRemoteRegistrationsIt(struct bgp *bgp, void *stream, } if (show_expiring - && !CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + && !CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) continue; if (!show_expiring - && CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + && CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) continue; if (bi->type == ZEBRA_ROUTE_BGP_DIRECT @@ -1543,7 +1543,7 @@ void rfapiPrintAdvertisedInfo(struct vty *vty, struct rfapi_descriptor *rfd, struct prefix_rd *prd; /* - * Find the bgp_info in the RIB corresponding to this + * Find the bgp_path in the RIB corresponding to this * prefix and rfd */ diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index 6fcae17a8a..af1e25a180 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -259,7 +259,7 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn, for (ubi = urn->info; ubi; ubi = ubi->next) { struct prefix unicast_nexthop; - if (CHECK_FLAG(ubi->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(ubi->flags, BGP_PATH_REMOVED)) continue; rfapiUnicastNexthop2Prefix(afi, ubi->attr, &unicast_nexthop); diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index 8a286d1377..fed876ad8a 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -452,7 +452,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi( return; } - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) return; vncHDResolveNve.peer = bi->peer; @@ -1253,7 +1253,7 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_bi( return; } - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) return; vncHDResolveNve.peer = bi->peer; @@ -1658,9 +1658,9 @@ static int is_usable_interior_route(struct bgp_info *bi_interior) #endif return 0; } - if (!CHECK_FLAG(bi_interior->flags, BGP_INFO_VALID)) { + if (!CHECK_FLAG(bi_interior->flags, BGP_PATH_VALID)) { #if DEBUG_IS_USABLE_INTERIOR - vnc_zlog_debug_verbose("%s: NO: BGP_INFO_VALID not set", + vnc_zlog_debug_verbose("%s: NO: BGP_PATH_VALID not set", __func__); #endif return 0; @@ -2772,7 +2772,7 @@ void vnc_import_bgp_redist_enable(struct bgp *bgp, afi_t afi) for (bi = rn->info; bi; bi = bi->next) { - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) continue; vnc_import_bgp_add_route(bgp, &rn->p, bi); @@ -2812,7 +2812,7 @@ void vnc_import_bgp_exterior_redist_enable(struct bgp *bgp, afi_t afi) for (bi = rn->info; bi; bi = bi->next) { - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) continue; vnc_import_bgp_exterior_add_route(bgp_exterior, &rn->p, @@ -2857,7 +2857,7 @@ void vnc_import_bgp_exterior_redist_enable_it( for (bi = rn->info; bi; bi = bi->next) { - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) continue; vnc_import_bgp_exterior_add_route_it( @@ -2989,7 +2989,7 @@ void vnc_import_bgp_exterior_redist_disable(struct bgp *bgp, afi_t afi) for (bi = rn->info; bi; bi = bi->next) { - if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) + if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) continue; vnc_import_bgp_exterior_del_route(bgp_exterior, diff --git a/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c index 42f7d76759..bc6c06aa90 100644 --- a/tests/bgpd/test_mpath.c +++ b/tests/bgpd/test_mpath.c @@ -322,10 +322,10 @@ static int run_bgp_info_mpath_update(testcase_t *t) EXPECT_TRUE(bgp_info_mpath_count(new_best) == 2, test_result); mpath = bgp_info_mpath_first(new_best); EXPECT_TRUE(mpath == &test_mp_list_info[0], test_result); - EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result); + EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_PATH_MULTIPATH), test_result); mpath = bgp_info_mpath_next(mpath); EXPECT_TRUE(mpath == &test_mp_list_info[1], test_result); - EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result); + EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_PATH_MULTIPATH), test_result); bgp_mp_list_add(&mp_list, &test_mp_list_info[0]); bgp_mp_list_add(&mp_list, &test_mp_list_info[1]); @@ -336,8 +336,8 @@ static int run_bgp_info_mpath_update(testcase_t *t) EXPECT_TRUE(bgp_info_mpath_count(new_best) == 1, test_result); mpath = bgp_info_mpath_first(new_best); EXPECT_TRUE(mpath == &test_mp_list_info[1], test_result); - EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result); - EXPECT_TRUE(!CHECK_FLAG(test_mp_list_info[0].flags, BGP_INFO_MULTIPATH), + EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_PATH_MULTIPATH), test_result); + EXPECT_TRUE(!CHECK_FLAG(test_mp_list_info[0].flags, BGP_PATH_MULTIPATH), test_result); return test_result; |
