forked from Mirror/frr
bgpd: Convert all bgp_info_XXX functions to bgp_path_XXX functions
Rename all bgp_info_XXX functions to bgp_path_XXX functions Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
4b7e606625
commit
18ee831031
|
@ -91,8 +91,8 @@ struct bgp_advertise *bgp_advertise_new(void)
|
|||
void bgp_advertise_free(struct bgp_advertise *adv)
|
||||
{
|
||||
if (adv->binfo)
|
||||
bgp_info_unlock(
|
||||
adv->binfo); /* bgp_advertise bgp_info reference */
|
||||
bgp_path_info_unlock(
|
||||
adv->binfo); /* bgp_advertise bgp_path_info reference */
|
||||
XFREE(MTYPE_BGP_ADVERTISE, adv);
|
||||
}
|
||||
|
||||
|
|
|
@ -145,13 +145,13 @@ static int bgp_reuse_timer(struct thread *t)
|
|||
/* if (figure-of-merit < reuse). */
|
||||
if (bdi->penalty < damp->reuse_limit) {
|
||||
/* Reuse the route. */
|
||||
bgp_info_unset_flag(bdi->rn, bdi->binfo,
|
||||
BGP_PATH_DAMPED);
|
||||
bgp_path_info_unset_flag(bdi->rn, bdi->binfo,
|
||||
BGP_PATH_DAMPED);
|
||||
bdi->suppress_time = 0;
|
||||
|
||||
if (bdi->lastrecord == BGP_RECORD_UPDATE) {
|
||||
bgp_info_unset_flag(bdi->rn, bdi->binfo,
|
||||
BGP_PATH_HISTORY);
|
||||
bgp_path_info_unset_flag(bdi->rn, bdi->binfo,
|
||||
BGP_PATH_HISTORY);
|
||||
bgp_aggregate_increment(bgp, &bdi->rn->p,
|
||||
bdi->binfo, bdi->afi,
|
||||
bdi->safi);
|
||||
|
@ -205,7 +205,7 @@ int bgp_damp_withdraw(struct bgp_path_info *binfo, struct bgp_node *rn,
|
|||
bdi->index = -1;
|
||||
bdi->afi = afi;
|
||||
bdi->safi = safi;
|
||||
(bgp_info_extra_get(binfo))->damp_info = bdi;
|
||||
(bgp_path_info_extra_get(binfo))->damp_info = bdi;
|
||||
BGP_DAMP_LIST_ADD(damp, bdi);
|
||||
} else {
|
||||
last_penalty = bdi->penalty;
|
||||
|
@ -228,7 +228,7 @@ int bgp_damp_withdraw(struct bgp_path_info *binfo, struct bgp_node *rn,
|
|||
bdi->t_updated = t_now;
|
||||
|
||||
/* Make this route as historical status. */
|
||||
bgp_info_set_flag(rn, binfo, BGP_PATH_HISTORY);
|
||||
bgp_path_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_PATH_DAMPED)) {
|
||||
|
@ -243,7 +243,7 @@ int bgp_damp_withdraw(struct bgp_path_info *binfo, struct bgp_node *rn,
|
|||
/* 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_PATH_DAMPED);
|
||||
bgp_path_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,7 +263,7 @@ int bgp_damp_update(struct bgp_path_info *binfo, struct bgp_node *rn, afi_t afi,
|
|||
return BGP_DAMP_USED;
|
||||
|
||||
t_now = bgp_clock();
|
||||
bgp_info_unset_flag(rn, binfo, BGP_PATH_HISTORY);
|
||||
bgp_path_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);
|
||||
|
@ -273,7 +273,7 @@ int bgp_damp_update(struct bgp_path_info *binfo, struct bgp_node *rn, afi_t afi,
|
|||
status = BGP_DAMP_USED;
|
||||
else if (CHECK_FLAG(bdi->binfo->flags, BGP_PATH_DAMPED)
|
||||
&& (bdi->penalty < damp->reuse_limit)) {
|
||||
bgp_info_unset_flag(rn, binfo, BGP_PATH_DAMPED);
|
||||
bgp_path_info_unset_flag(rn, binfo, BGP_PATH_DAMPED);
|
||||
bgp_reuse_list_delete(bdi);
|
||||
BGP_DAMP_LIST_ADD(damp, bdi);
|
||||
bdi->suppress_time = 0;
|
||||
|
@ -304,7 +304,8 @@ int bgp_damp_scan(struct bgp_path_info *binfo, afi_t afi, safi_t safi)
|
|||
t_diff = t_now - bdi->suppress_time;
|
||||
|
||||
if (t_diff >= damp->max_suppress_time) {
|
||||
bgp_info_unset_flag(bdi->rn, binfo, BGP_PATH_DAMPED);
|
||||
bgp_path_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;
|
||||
|
@ -347,10 +348,11 @@ void bgp_damp_info_free(struct bgp_damp_info *bdi, int withdraw)
|
|||
else
|
||||
BGP_DAMP_LIST_DEL(damp, bdi);
|
||||
|
||||
bgp_info_unset_flag(bdi->rn, binfo, BGP_PATH_HISTORY | BGP_PATH_DAMPED);
|
||||
bgp_path_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);
|
||||
bgp_path_info_delete(bdi->rn, binfo);
|
||||
|
||||
XFREE(MTYPE_BGP_DAMP_INFO, bdi);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ struct bgp_damp_info {
|
|||
/* Time of route start to be suppressed. */
|
||||
time_t suppress_time;
|
||||
|
||||
/* Back reference to bgp_info. */
|
||||
/* Back reference to bgp_path_info. */
|
||||
struct bgp_path_info *binfo;
|
||||
|
||||
/* Back reference to bgp_node. */
|
||||
|
|
|
@ -939,7 +939,7 @@ static void evpn_delete_old_local_route(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
}
|
||||
|
||||
/* Delete route entry in the VNI route table, caller to remove. */
|
||||
bgp_info_delete(rn, old_local);
|
||||
bgp_path_info_delete(rn, old_local);
|
||||
}
|
||||
|
||||
static struct in_addr *es_vtep_new(struct in_addr vtep)
|
||||
|
@ -1070,10 +1070,10 @@ 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_PATH_SELECTED);
|
||||
bgp_path_info_unset_flag(rn, old_select, BGP_PATH_SELECTED);
|
||||
if (new_select) {
|
||||
bgp_info_set_flag(rn, new_select, BGP_PATH_SELECTED);
|
||||
bgp_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(rn, new_select, BGP_PATH_SELECTED);
|
||||
bgp_path_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED);
|
||||
UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG);
|
||||
}
|
||||
|
||||
|
@ -1093,9 +1093,9 @@ static int evpn_es_route_select_install(struct bgp *bgp,
|
|||
/* Clear any route change flags. */
|
||||
bgp_zebra_clear_route_change_flags(rn);
|
||||
|
||||
/* Reap old select bgp_info, if it has been removed */
|
||||
/* Reap old select bgp_path_info, if it has been removed */
|
||||
if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_reap(rn, old_select);
|
||||
bgp_path_info_reap(rn, old_select);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1161,10 +1161,10 @@ 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_PATH_SELECTED);
|
||||
bgp_path_info_unset_flag(rn, old_select, BGP_PATH_SELECTED);
|
||||
if (new_select) {
|
||||
bgp_info_set_flag(rn, new_select, BGP_PATH_SELECTED);
|
||||
bgp_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(rn, new_select, BGP_PATH_SELECTED);
|
||||
bgp_path_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED);
|
||||
UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG);
|
||||
}
|
||||
|
||||
|
@ -1204,9 +1204,9 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
/* Clear any route change flags. */
|
||||
bgp_zebra_clear_route_change_flags(rn);
|
||||
|
||||
/* Reap old select bgp_info, if it has been removed */
|
||||
/* Reap old select bgp_path_info, if it has been removed */
|
||||
if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_reap(rn, old_select);
|
||||
bgp_path_info_reap(rn, old_select);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1320,7 +1320,7 @@ static int update_evpn_type4_route_entry(struct bgp *bgp, struct evpnes *es,
|
|||
SET_FLAG(tmp_ri->flags, BGP_PATH_VALID);
|
||||
|
||||
/* add the newly created path to the route-node */
|
||||
bgp_info_add(rn, tmp_ri);
|
||||
bgp_path_info_add(rn, tmp_ri);
|
||||
} else {
|
||||
tmp_ri = local_ri;
|
||||
if (attrhash_cmp(tmp_ri->attr, attr)
|
||||
|
@ -1330,11 +1330,12 @@ static int update_evpn_type4_route_entry(struct bgp *bgp, struct evpnes *es,
|
|||
/* The attribute has changed.
|
||||
* Add (or update) attribute to hash. */
|
||||
attr_new = bgp_attr_intern(attr);
|
||||
bgp_info_set_flag(rn, tmp_ri, BGP_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(rn, tmp_ri,
|
||||
BGP_PATH_ATTR_CHANGED);
|
||||
|
||||
/* Restore route, if needed. */
|
||||
if (CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(rn, tmp_ri);
|
||||
bgp_path_info_restore(rn, tmp_ri);
|
||||
|
||||
/* Unintern existing, set to new. */
|
||||
bgp_attr_unintern(&tmp_ri->attr);
|
||||
|
@ -1464,13 +1465,13 @@ static int update_evpn_type5_route_entry(struct bgp *bgp_def,
|
|||
SET_FLAG(ri->flags, BGP_PATH_VALID);
|
||||
|
||||
/* Type-5 routes advertise the L3-VNI */
|
||||
bgp_info_extra_get(ri);
|
||||
bgp_path_info_extra_get(ri);
|
||||
vni2label(bgp_vrf->l3vni, &label);
|
||||
memcpy(&ri->extra->label, &label, sizeof(label));
|
||||
ri->extra->num_labels = 1;
|
||||
|
||||
/* add the route entry to route node*/
|
||||
bgp_info_add(rn, ri);
|
||||
bgp_path_info_add(rn, ri);
|
||||
} else {
|
||||
|
||||
tmp_ri = local_ri;
|
||||
|
@ -1482,11 +1483,12 @@ 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_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(rn, tmp_ri,
|
||||
BGP_PATH_ATTR_CHANGED);
|
||||
|
||||
/* Restore route, if needed. */
|
||||
if (CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(rn, tmp_ri);
|
||||
bgp_path_info_restore(rn, tmp_ri);
|
||||
|
||||
/* Unintern existing, set to new. */
|
||||
bgp_attr_unintern(&tmp_ri->attr);
|
||||
|
@ -1607,7 +1609,7 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
tmp_ri = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
|
||||
bgp->peer_self, attr_new, rn);
|
||||
SET_FLAG(tmp_ri->flags, BGP_PATH_VALID);
|
||||
bgp_info_extra_get(tmp_ri);
|
||||
bgp_path_info_extra_get(tmp_ri);
|
||||
|
||||
/* The VNI goes into the 'label' field of the route */
|
||||
vni2label(vpn->vni, &label[0]);
|
||||
|
@ -1629,7 +1631,7 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
|
||||
memcpy(&tmp_ri->extra->label, label, sizeof(label));
|
||||
tmp_ri->extra->num_labels = num_labels;
|
||||
bgp_info_add(rn, tmp_ri);
|
||||
bgp_path_info_add(rn, tmp_ri);
|
||||
} else {
|
||||
tmp_ri = local_ri;
|
||||
if (attrhash_cmp(tmp_ri->attr, attr)
|
||||
|
@ -1658,7 +1660,8 @@ 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_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(rn, tmp_ri,
|
||||
BGP_PATH_ATTR_CHANGED);
|
||||
|
||||
/* Extract MAC mobility sequence number, if any. */
|
||||
attr_new->mm_seqnum =
|
||||
|
@ -1667,7 +1670,7 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
|
||||
/* Restore route, if needed. */
|
||||
if (CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(rn, tmp_ri);
|
||||
bgp_path_info_restore(rn, tmp_ri);
|
||||
|
||||
/* Unintern existing, set to new. */
|
||||
bgp_attr_unintern(&tmp_ri->attr);
|
||||
|
@ -1796,7 +1799,7 @@ static void delete_evpn_route_entry(struct bgp *bgp, afi_t afi, safi_t safi,
|
|||
|
||||
/* Mark route for delete. */
|
||||
if (tmp_ri)
|
||||
bgp_info_delete(rn, tmp_ri);
|
||||
bgp_path_info_delete(rn, tmp_ri);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1845,7 +1848,7 @@ static int delete_evpn_type4_route(struct bgp *bgp,
|
|||
*/
|
||||
delete_evpn_route_entry(bgp, afi, safi, rn, &ri);
|
||||
if (ri)
|
||||
bgp_info_reap(rn, ri);
|
||||
bgp_path_info_reap(rn, ri);
|
||||
bgp_unlock_node(rn);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1919,7 +1922,7 @@ static int delete_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
*/
|
||||
delete_evpn_route_entry(bgp, afi, safi, rn, &ri);
|
||||
if (ri)
|
||||
bgp_info_reap(rn, ri);
|
||||
bgp_path_info_reap(rn, ri);
|
||||
bgp_unlock_node(rn);
|
||||
|
||||
return 0;
|
||||
|
@ -2100,7 +2103,7 @@ static int delete_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
|
|||
|
||||
/* Route entry in local table gets deleted immediately. */
|
||||
if (ri)
|
||||
bgp_info_reap(rn, ri);
|
||||
bgp_path_info_reap(rn, ri);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -2119,8 +2122,8 @@ static int delete_all_es_routes(struct bgp *bgp, struct evpnes *es)
|
|||
rn = bgp_route_next(rn)) {
|
||||
for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1);
|
||||
ri = nextri) {
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_info_reap(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
bgp_path_info_reap(rn, ri);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2140,8 +2143,8 @@ static int delete_all_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
|
|||
rn = bgp_route_next(rn)) {
|
||||
for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1);
|
||||
ri = nextri) {
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_info_reap(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
bgp_path_info_reap(rn, ri);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2284,9 +2287,9 @@ static int install_evpn_route_entry_in_es(struct bgp *bgp, struct evpnes *es,
|
|||
ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0,
|
||||
parent_ri->peer, attr_new, rn);
|
||||
SET_FLAG(ri->flags, BGP_PATH_VALID);
|
||||
bgp_info_extra_get(ri);
|
||||
bgp_path_info_extra_get(ri);
|
||||
ri->extra->parent = parent_ri;
|
||||
bgp_info_add(rn, ri);
|
||||
bgp_path_info_add(rn, ri);
|
||||
} else {
|
||||
if (attrhash_cmp(ri->attr, parent_ri->attr)
|
||||
&& !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) {
|
||||
|
@ -2299,7 +2302,7 @@ static int install_evpn_route_entry_in_es(struct bgp *bgp, struct evpnes *es,
|
|||
|
||||
/* Restore route, if needed. */
|
||||
if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(rn, ri);
|
||||
bgp_path_info_restore(rn, ri);
|
||||
|
||||
/* Mark if nexthop has changed. */
|
||||
if (!IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop))
|
||||
|
@ -2385,15 +2388,15 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
|
|||
ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0,
|
||||
parent_ri->peer, attr_new, rn);
|
||||
SET_FLAG(ri->flags, BGP_PATH_VALID);
|
||||
bgp_info_extra_get(ri);
|
||||
ri->extra->parent = bgp_info_lock(parent_ri);
|
||||
bgp_path_info_extra_get(ri);
|
||||
ri->extra->parent = bgp_path_info_lock(parent_ri);
|
||||
bgp_lock_node((struct bgp_node *)parent_ri->net);
|
||||
if (parent_ri->extra) {
|
||||
memcpy(&ri->extra->label, &parent_ri->extra->label,
|
||||
sizeof(ri->extra->label));
|
||||
ri->extra->num_labels = parent_ri->extra->num_labels;
|
||||
}
|
||||
bgp_info_add(rn, ri);
|
||||
bgp_path_info_add(rn, ri);
|
||||
} else {
|
||||
if (attrhash_cmp(ri->attr, &attr)
|
||||
&& !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) {
|
||||
|
@ -2406,7 +2409,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
|
|||
|
||||
/* Restore route, if needed. */
|
||||
if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(rn, ri);
|
||||
bgp_path_info_restore(rn, ri);
|
||||
|
||||
/* Mark if nexthop has changed. */
|
||||
if ((afi == AFI_IP &&
|
||||
|
@ -2460,15 +2463,15 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0,
|
||||
parent_ri->peer, attr_new, rn);
|
||||
SET_FLAG(ri->flags, BGP_PATH_VALID);
|
||||
bgp_info_extra_get(ri);
|
||||
ri->extra->parent = bgp_info_lock(parent_ri);
|
||||
bgp_path_info_extra_get(ri);
|
||||
ri->extra->parent = bgp_path_info_lock(parent_ri);
|
||||
bgp_lock_node((struct bgp_node *)parent_ri->net);
|
||||
if (parent_ri->extra) {
|
||||
memcpy(&ri->extra->label, &parent_ri->extra->label,
|
||||
sizeof(ri->extra->label));
|
||||
ri->extra->num_labels = parent_ri->extra->num_labels;
|
||||
}
|
||||
bgp_info_add(rn, ri);
|
||||
bgp_path_info_add(rn, ri);
|
||||
} else {
|
||||
if (attrhash_cmp(ri->attr, parent_ri->attr)
|
||||
&& !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) {
|
||||
|
@ -2481,7 +2484,7 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
|
||||
/* Restore route, if needed. */
|
||||
if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(rn, ri);
|
||||
bgp_path_info_restore(rn, ri);
|
||||
|
||||
/* Mark if nexthop has changed. */
|
||||
if (!IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop))
|
||||
|
@ -2528,7 +2531,7 @@ static int uninstall_evpn_route_entry_in_es(struct bgp *bgp, struct evpnes *es,
|
|||
return 0;
|
||||
|
||||
/* Mark entry for deletion */
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
|
||||
/* Perform route selection and update zebra, if required. */
|
||||
ret = evpn_es_route_select_install(bgp, es, rn);
|
||||
|
@ -2595,7 +2598,7 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
|
|||
bgp_aggregate_decrement(bgp_vrf, &rn->p, ri, afi, safi);
|
||||
|
||||
/* Mark entry for deletion */
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
|
||||
/* Perform route selection and update zebra, if required. */
|
||||
bgp_process(bgp_vrf, rn, afi, safi);
|
||||
|
@ -2634,7 +2637,7 @@ static int uninstall_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
return 0;
|
||||
|
||||
/* Mark entry for deletion */
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
|
||||
/* Perform route selection and update zebra, if required. */
|
||||
ret = evpn_route_select_install(bgp, vpn, rn);
|
||||
|
@ -5342,7 +5345,7 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id)
|
|||
}
|
||||
|
||||
/* Remove remote routes from BGT VRF even if BGP_VRF_AUTO is configured,
|
||||
* bgp_delete would not remove/decrement bgp_info of the ip_prefix
|
||||
* bgp_delete would not remove/decrement bgp_path_info of the ip_prefix
|
||||
* routes. This will uninstalling the routes from zebra and decremnt the
|
||||
* bgp info count.
|
||||
*/
|
||||
|
|
|
@ -329,7 +329,8 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
|
|||
json_object_array_add(json_paths, json_time_path);
|
||||
}
|
||||
if (display == NLRI_STRING_FORMAT_LARGE) {
|
||||
struct bgp_path_info_extra *extra = bgp_info_extra_get(binfo);
|
||||
struct bgp_path_info_extra *extra =
|
||||
bgp_path_info_extra_get(binfo);
|
||||
|
||||
if (extra->bgp_fs_pbr) {
|
||||
struct listnode *node;
|
||||
|
|
185
bgpd/bgp_mpath.c
185
bgpd/bgp_mpath.c
|
@ -113,13 +113,14 @@ static int bgp_interface_same(struct interface *ifp1, struct interface *ifp2)
|
|||
|
||||
|
||||
/*
|
||||
* bgp_info_nexthop_cmp
|
||||
* bgp_path_info_nexthop_cmp
|
||||
*
|
||||
* Compare the nexthops of two paths. Return value is less than, equal to,
|
||||
* or greater than zero if bi1 is respectively less than, equal to,
|
||||
* or greater than bi2.
|
||||
*/
|
||||
int bgp_info_nexthop_cmp(struct bgp_path_info *bi1, struct bgp_path_info *bi2)
|
||||
int bgp_path_info_nexthop_cmp(struct bgp_path_info *bi1,
|
||||
struct bgp_path_info *bi2)
|
||||
{
|
||||
int compare;
|
||||
struct in6_addr addr1, addr2;
|
||||
|
@ -182,7 +183,7 @@ int bgp_info_nexthop_cmp(struct bgp_path_info *bi1, struct bgp_path_info *bi2)
|
|||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_cmp
|
||||
* bgp_path_info_mpath_cmp
|
||||
*
|
||||
* This function determines our multipath list ordering. By ordering
|
||||
* the list we can deterministically select which paths are included
|
||||
|
@ -193,7 +194,7 @@ int bgp_info_nexthop_cmp(struct bgp_path_info *bi1, struct bgp_path_info *bi2)
|
|||
* The order of paths is determined first by received nexthop, and then
|
||||
* by peer address if the nexthops are the same.
|
||||
*/
|
||||
static int bgp_info_mpath_cmp(void *val1, void *val2)
|
||||
static int bgp_path_info_mpath_cmp(void *val1, void *val2)
|
||||
{
|
||||
struct bgp_path_info *bi1, *bi2;
|
||||
int compare;
|
||||
|
@ -201,7 +202,7 @@ static int bgp_info_mpath_cmp(void *val1, void *val2)
|
|||
bi1 = val1;
|
||||
bi2 = val2;
|
||||
|
||||
compare = bgp_info_nexthop_cmp(bi1, bi2);
|
||||
compare = bgp_path_info_nexthop_cmp(bi1, bi2);
|
||||
|
||||
if (!compare) {
|
||||
if (!bi1->peer->su_remote && !bi2->peer->su_remote)
|
||||
|
@ -228,7 +229,7 @@ void bgp_mp_list_init(struct list *mp_list)
|
|||
{
|
||||
assert(mp_list);
|
||||
memset(mp_list, 0, sizeof(struct list));
|
||||
mp_list->cmp = bgp_info_mpath_cmp;
|
||||
mp_list->cmp = bgp_path_info_mpath_cmp;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -254,11 +255,11 @@ void bgp_mp_list_add(struct list *mp_list, struct bgp_path_info *mpinfo)
|
|||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_new
|
||||
* bgp_path_info_mpath_new
|
||||
*
|
||||
* Allocate and zero memory for a new bgp_info_mpath element
|
||||
* Allocate and zero memory for a new bgp_path_info_mpath element
|
||||
*/
|
||||
static struct bgp_path_info_mpath *bgp_info_mpath_new(void)
|
||||
static struct bgp_path_info_mpath *bgp_path_info_mpath_new(void)
|
||||
{
|
||||
struct bgp_path_info_mpath *new_mpath;
|
||||
new_mpath = XCALLOC(MTYPE_BGP_MPATH_INFO,
|
||||
|
@ -267,11 +268,11 @@ static struct bgp_path_info_mpath *bgp_info_mpath_new(void)
|
|||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_free
|
||||
* bgp_path_info_mpath_free
|
||||
*
|
||||
* Release resources for a bgp_info_mpath element and zero out pointer
|
||||
* Release resources for a bgp_path_info_mpath element and zero out pointer
|
||||
*/
|
||||
void bgp_info_mpath_free(struct bgp_path_info_mpath **mpath)
|
||||
void bgp_path_info_mpath_free(struct bgp_path_info_mpath **mpath)
|
||||
{
|
||||
if (mpath && *mpath) {
|
||||
if ((*mpath)->mp_attr)
|
||||
|
@ -282,17 +283,17 @@ void bgp_info_mpath_free(struct bgp_path_info_mpath **mpath)
|
|||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_get
|
||||
* bgp_path_info_mpath_get
|
||||
*
|
||||
* Fetch the mpath element for the given bgp_info. Used for
|
||||
* Fetch the mpath element for the given bgp_path_info. Used for
|
||||
* doing lazy allocation.
|
||||
*/
|
||||
static struct bgp_path_info_mpath *
|
||||
bgp_info_mpath_get(struct bgp_path_info *binfo)
|
||||
bgp_path_info_mpath_get(struct bgp_path_info *binfo)
|
||||
{
|
||||
struct bgp_path_info_mpath *mpath;
|
||||
if (!binfo->mpath) {
|
||||
mpath = bgp_info_mpath_new();
|
||||
mpath = bgp_path_info_mpath_new();
|
||||
if (!mpath)
|
||||
return NULL;
|
||||
binfo->mpath = mpath;
|
||||
|
@ -302,18 +303,18 @@ bgp_info_mpath_get(struct bgp_path_info *binfo)
|
|||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_enqueue
|
||||
* bgp_path_info_mpath_enqueue
|
||||
*
|
||||
* Enqueue a path onto the multipath list given the previous multipath
|
||||
* list entry
|
||||
*/
|
||||
static void bgp_info_mpath_enqueue(struct bgp_path_info *prev_info,
|
||||
struct bgp_path_info *binfo)
|
||||
static void bgp_path_info_mpath_enqueue(struct bgp_path_info *prev_info,
|
||||
struct bgp_path_info *binfo)
|
||||
{
|
||||
struct bgp_path_info_mpath *prev, *mpath;
|
||||
|
||||
prev = bgp_info_mpath_get(prev_info);
|
||||
mpath = bgp_info_mpath_get(binfo);
|
||||
prev = bgp_path_info_mpath_get(prev_info);
|
||||
mpath = bgp_path_info_mpath_get(binfo);
|
||||
if (!prev || !mpath)
|
||||
return;
|
||||
|
||||
|
@ -327,11 +328,11 @@ static void bgp_info_mpath_enqueue(struct bgp_path_info *prev_info,
|
|||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_dequeue
|
||||
* bgp_path_info_mpath_dequeue
|
||||
*
|
||||
* Remove a path from the multipath list
|
||||
*/
|
||||
void bgp_info_mpath_dequeue(struct bgp_path_info *binfo)
|
||||
void bgp_path_info_mpath_dequeue(struct bgp_path_info *binfo)
|
||||
{
|
||||
struct bgp_path_info_mpath *mpath = binfo->mpath;
|
||||
if (!mpath)
|
||||
|
@ -345,11 +346,11 @@ void bgp_info_mpath_dequeue(struct bgp_path_info *binfo)
|
|||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_next
|
||||
* bgp_path_info_mpath_next
|
||||
*
|
||||
* Given a bgp_info, return the next multipath entry
|
||||
* Given a bgp_path_info, return the next multipath entry
|
||||
*/
|
||||
struct bgp_path_info *bgp_info_mpath_next(struct bgp_path_info *binfo)
|
||||
struct bgp_path_info *bgp_path_info_mpath_next(struct bgp_path_info *binfo)
|
||||
{
|
||||
if (!binfo->mpath || !binfo->mpath->mp_next)
|
||||
return NULL;
|
||||
|
@ -357,21 +358,21 @@ struct bgp_path_info *bgp_info_mpath_next(struct bgp_path_info *binfo)
|
|||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_first
|
||||
* bgp_path_info_mpath_first
|
||||
*
|
||||
* Given bestpath bgp_info, return the first multipath entry.
|
||||
* Given bestpath bgp_path_info, return the first multipath entry.
|
||||
*/
|
||||
struct bgp_path_info *bgp_info_mpath_first(struct bgp_path_info *binfo)
|
||||
struct bgp_path_info *bgp_path_info_mpath_first(struct bgp_path_info *binfo)
|
||||
{
|
||||
return bgp_info_mpath_next(binfo);
|
||||
return bgp_path_info_mpath_next(binfo);
|
||||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_count
|
||||
* bgp_path_info_mpath_count
|
||||
*
|
||||
* Given the bestpath bgp_info, return the number of multipath entries
|
||||
* Given the bestpath bgp_path_info, return the number of multipath entries
|
||||
*/
|
||||
uint32_t bgp_info_mpath_count(struct bgp_path_info *binfo)
|
||||
uint32_t bgp_path_info_mpath_count(struct bgp_path_info *binfo)
|
||||
{
|
||||
if (!binfo->mpath)
|
||||
return 0;
|
||||
|
@ -379,29 +380,29 @@ uint32_t bgp_info_mpath_count(struct bgp_path_info *binfo)
|
|||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_count_set
|
||||
* bgp_path_info_mpath_count_set
|
||||
*
|
||||
* Sets the count of multipaths into bestpath's mpath element
|
||||
*/
|
||||
static void bgp_info_mpath_count_set(struct bgp_path_info *binfo,
|
||||
uint32_t count)
|
||||
static void bgp_path_info_mpath_count_set(struct bgp_path_info *binfo,
|
||||
uint32_t count)
|
||||
{
|
||||
struct bgp_path_info_mpath *mpath;
|
||||
if (!count && !binfo->mpath)
|
||||
return;
|
||||
mpath = bgp_info_mpath_get(binfo);
|
||||
mpath = bgp_path_info_mpath_get(binfo);
|
||||
if (!mpath)
|
||||
return;
|
||||
mpath->mp_count = count;
|
||||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_attr
|
||||
* bgp_path_info_mpath_attr
|
||||
*
|
||||
* Given bestpath bgp_info, return aggregated attribute set used
|
||||
* Given bestpath bgp_path_info, return aggregated attribute set used
|
||||
* for advertising the multipath route
|
||||
*/
|
||||
struct attr *bgp_info_mpath_attr(struct bgp_path_info *binfo)
|
||||
struct attr *bgp_path_info_mpath_attr(struct bgp_path_info *binfo)
|
||||
{
|
||||
if (!binfo->mpath)
|
||||
return NULL;
|
||||
|
@ -409,31 +410,33 @@ struct attr *bgp_info_mpath_attr(struct bgp_path_info *binfo)
|
|||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_attr_set
|
||||
* bgp_path_info_mpath_attr_set
|
||||
*
|
||||
* Sets the aggregated attribute into bestpath's mpath element
|
||||
*/
|
||||
static void bgp_info_mpath_attr_set(struct bgp_path_info *binfo,
|
||||
struct attr *attr)
|
||||
static void bgp_path_info_mpath_attr_set(struct bgp_path_info *binfo,
|
||||
struct attr *attr)
|
||||
{
|
||||
struct bgp_path_info_mpath *mpath;
|
||||
if (!attr && !binfo->mpath)
|
||||
return;
|
||||
mpath = bgp_info_mpath_get(binfo);
|
||||
mpath = bgp_path_info_mpath_get(binfo);
|
||||
if (!mpath)
|
||||
return;
|
||||
mpath->mp_attr = attr;
|
||||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_update
|
||||
* bgp_path_info_mpath_update
|
||||
*
|
||||
* Compare and sync up the multipath list with the mp_list generated by
|
||||
* bgp_best_selection
|
||||
*/
|
||||
void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_path_info *new_best,
|
||||
struct bgp_path_info *old_best, struct list *mp_list,
|
||||
struct bgp_maxpaths_cfg *mpath_cfg)
|
||||
void bgp_path_info_mpath_update(struct bgp_node *rn,
|
||||
struct bgp_path_info *new_best,
|
||||
struct bgp_path_info *old_best,
|
||||
struct list *mp_list,
|
||||
struct bgp_maxpaths_cfg *mpath_cfg)
|
||||
{
|
||||
uint16_t maxpaths, mpath_count, old_mpath_count;
|
||||
struct listnode *mp_node, *mp_next_node;
|
||||
|
@ -457,17 +460,17 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_path_info *new_best,
|
|||
if (new_best) {
|
||||
mpath_count++;
|
||||
if (new_best != old_best)
|
||||
bgp_info_mpath_dequeue(new_best);
|
||||
bgp_path_info_mpath_dequeue(new_best);
|
||||
maxpaths = (new_best->peer->sort == BGP_PEER_IBGP)
|
||||
? mpath_cfg->maxpaths_ibgp
|
||||
: mpath_cfg->maxpaths_ebgp;
|
||||
}
|
||||
|
||||
if (old_best) {
|
||||
cur_mpath = bgp_info_mpath_first(old_best);
|
||||
old_mpath_count = bgp_info_mpath_count(old_best);
|
||||
bgp_info_mpath_count_set(old_best, 0);
|
||||
bgp_info_mpath_dequeue(old_best);
|
||||
cur_mpath = bgp_path_info_mpath_first(old_best);
|
||||
old_mpath_count = bgp_path_info_mpath_count(old_best);
|
||||
bgp_path_info_mpath_count_set(old_best, 0);
|
||||
bgp_path_info_mpath_dequeue(old_best);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
|
@ -499,7 +502,8 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_path_info *new_best,
|
|||
break;
|
||||
|
||||
mp_next_node = mp_node ? listnextnode(mp_node) : NULL;
|
||||
next_mpath = cur_mpath ? bgp_info_mpath_next(cur_mpath) : NULL;
|
||||
next_mpath =
|
||||
cur_mpath ? bgp_path_info_mpath_next(cur_mpath) : NULL;
|
||||
tmp_info = mp_node ? listgetdata(mp_node) : NULL;
|
||||
|
||||
if (debug)
|
||||
|
@ -515,14 +519,16 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_path_info *new_best,
|
|||
*/
|
||||
if (mp_node && (listgetdata(mp_node) == cur_mpath)) {
|
||||
list_delete_node(mp_list, mp_node);
|
||||
bgp_info_mpath_dequeue(cur_mpath);
|
||||
bgp_path_info_mpath_dequeue(cur_mpath);
|
||||
if ((mpath_count < maxpaths)
|
||||
&& bgp_info_nexthop_cmp(prev_mpath, cur_mpath)) {
|
||||
bgp_info_mpath_enqueue(prev_mpath, cur_mpath);
|
||||
&& bgp_path_info_nexthop_cmp(prev_mpath,
|
||||
cur_mpath)) {
|
||||
bgp_path_info_mpath_enqueue(prev_mpath,
|
||||
cur_mpath);
|
||||
prev_mpath = cur_mpath;
|
||||
mpath_count++;
|
||||
if (debug) {
|
||||
bgp_info_path_with_addpath_rx_str(
|
||||
bgp_path_info_path_with_addpath_rx_str(
|
||||
cur_mpath, path_buf);
|
||||
zlog_debug(
|
||||
"%s: %s is still multipath, cur count %d",
|
||||
|
@ -531,7 +537,7 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_path_info *new_best,
|
|||
} else {
|
||||
mpath_changed = 1;
|
||||
if (debug) {
|
||||
bgp_info_path_with_addpath_rx_str(
|
||||
bgp_path_info_path_with_addpath_rx_str(
|
||||
cur_mpath, path_buf);
|
||||
zlog_debug(
|
||||
"%s: remove mpath %s nexthop %s, cur count %d",
|
||||
|
@ -551,7 +557,8 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_path_info *new_best,
|
|||
|
||||
if (cur_mpath
|
||||
&& (!mp_node
|
||||
|| (bgp_info_mpath_cmp(cur_mpath, listgetdata(mp_node))
|
||||
|| (bgp_path_info_mpath_cmp(cur_mpath,
|
||||
listgetdata(mp_node))
|
||||
< 0))) {
|
||||
/*
|
||||
* If here, we have an old multipath and either the
|
||||
|
@ -560,11 +567,11 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_path_info *new_best,
|
|||
* multipath, so we need to purge this path from the
|
||||
* multipath list
|
||||
*/
|
||||
bgp_info_mpath_dequeue(cur_mpath);
|
||||
bgp_path_info_mpath_dequeue(cur_mpath);
|
||||
mpath_changed = 1;
|
||||
if (debug) {
|
||||
bgp_info_path_with_addpath_rx_str(cur_mpath,
|
||||
path_buf);
|
||||
bgp_path_info_path_with_addpath_rx_str(
|
||||
cur_mpath, path_buf);
|
||||
zlog_debug(
|
||||
"%s: remove mpath %s nexthop %s, cur count %d",
|
||||
pfx_buf, path_buf,
|
||||
|
@ -598,17 +605,19 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_path_info *new_best,
|
|||
assert(new_mpath);
|
||||
assert(prev_mpath);
|
||||
if ((mpath_count < maxpaths) && (new_mpath != new_best)
|
||||
&& bgp_info_nexthop_cmp(prev_mpath, new_mpath)) {
|
||||
&& bgp_path_info_nexthop_cmp(prev_mpath,
|
||||
new_mpath)) {
|
||||
if (new_mpath == next_mpath)
|
||||
bgp_info_mpath_next(new_mpath);
|
||||
bgp_info_mpath_dequeue(new_mpath);
|
||||
bgp_path_info_mpath_next(new_mpath);
|
||||
bgp_path_info_mpath_dequeue(new_mpath);
|
||||
|
||||
bgp_info_mpath_enqueue(prev_mpath, new_mpath);
|
||||
bgp_path_info_mpath_enqueue(prev_mpath,
|
||||
new_mpath);
|
||||
prev_mpath = new_mpath;
|
||||
mpath_changed = 1;
|
||||
mpath_count++;
|
||||
if (debug) {
|
||||
bgp_info_path_with_addpath_rx_str(
|
||||
bgp_path_info_path_with_addpath_rx_str(
|
||||
new_mpath, path_buf);
|
||||
zlog_debug(
|
||||
"%s: add mpath %s nexthop %s, cur count %d",
|
||||
|
@ -632,9 +641,9 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_path_info *new_best,
|
|||
pfx_buf, mpath_count,
|
||||
mpath_changed ? "YES" : "NO");
|
||||
|
||||
bgp_info_mpath_count_set(new_best, mpath_count - 1);
|
||||
bgp_path_info_mpath_count_set(new_best, mpath_count - 1);
|
||||
if (mpath_changed
|
||||
|| (bgp_info_mpath_count(new_best) != old_mpath_count))
|
||||
|| (bgp_path_info_mpath_count(new_best) != old_mpath_count))
|
||||
SET_FLAG(new_best->flags, BGP_PATH_MULTIPATH_CHG);
|
||||
}
|
||||
}
|
||||
|
@ -652,19 +661,19 @@ void bgp_mp_dmed_deselect(struct bgp_path_info *dmed_best)
|
|||
if (!dmed_best)
|
||||
return;
|
||||
|
||||
for (mpinfo = bgp_info_mpath_first(dmed_best); mpinfo;
|
||||
for (mpinfo = bgp_path_info_mpath_first(dmed_best); mpinfo;
|
||||
mpinfo = mpnext) {
|
||||
mpnext = bgp_info_mpath_next(mpinfo);
|
||||
bgp_info_mpath_dequeue(mpinfo);
|
||||
mpnext = bgp_path_info_mpath_next(mpinfo);
|
||||
bgp_path_info_mpath_dequeue(mpinfo);
|
||||
}
|
||||
|
||||
bgp_info_mpath_count_set(dmed_best, 0);
|
||||
bgp_path_info_mpath_count_set(dmed_best, 0);
|
||||
UNSET_FLAG(dmed_best->flags, BGP_PATH_MULTIPATH_CHG);
|
||||
assert(bgp_info_mpath_first(dmed_best) == 0);
|
||||
assert(bgp_path_info_mpath_first(dmed_best) == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* bgp_info_mpath_aggregate_update
|
||||
* bgp_path_info_mpath_aggregate_update
|
||||
*
|
||||
* Set the multipath aggregate attribute. We need to see if the
|
||||
* aggregate has changed and then set the ATTR_CHANGED flag on the
|
||||
|
@ -675,8 +684,8 @@ void bgp_mp_dmed_deselect(struct bgp_path_info *dmed_best)
|
|||
* is no change in multipath selection and no attribute change in
|
||||
* any multipath.
|
||||
*/
|
||||
void bgp_info_mpath_aggregate_update(struct bgp_path_info *new_best,
|
||||
struct bgp_path_info *old_best)
|
||||
void bgp_path_info_mpath_aggregate_update(struct bgp_path_info *new_best,
|
||||
struct bgp_path_info *old_best)
|
||||
{
|
||||
struct bgp_path_info *mpinfo;
|
||||
struct aspath *aspath;
|
||||
|
@ -689,18 +698,18 @@ void bgp_info_mpath_aggregate_update(struct bgp_path_info *new_best,
|
|||
struct attr attr = {0};
|
||||
|
||||
if (old_best && (old_best != new_best)
|
||||
&& (old_attr = bgp_info_mpath_attr(old_best))) {
|
||||
&& (old_attr = bgp_path_info_mpath_attr(old_best))) {
|
||||
bgp_attr_unintern(&old_attr);
|
||||
bgp_info_mpath_attr_set(old_best, NULL);
|
||||
bgp_path_info_mpath_attr_set(old_best, NULL);
|
||||
}
|
||||
|
||||
if (!new_best)
|
||||
return;
|
||||
|
||||
if (!bgp_info_mpath_count(new_best)) {
|
||||
if ((new_attr = bgp_info_mpath_attr(new_best))) {
|
||||
if (!bgp_path_info_mpath_count(new_best)) {
|
||||
if ((new_attr = bgp_path_info_mpath_attr(new_best))) {
|
||||
bgp_attr_unintern(&new_attr);
|
||||
bgp_info_mpath_attr_set(new_best, NULL);
|
||||
bgp_path_info_mpath_attr_set(new_best, NULL);
|
||||
SET_FLAG(new_best->flags, BGP_PATH_ATTR_CHANGED);
|
||||
}
|
||||
return;
|
||||
|
@ -721,8 +730,8 @@ void bgp_info_mpath_aggregate_update(struct bgp_path_info *new_best,
|
|||
lcomm = (attr.lcommunity) ? lcommunity_dup(attr.lcommunity)
|
||||
: NULL;
|
||||
|
||||
for (mpinfo = bgp_info_mpath_first(new_best); mpinfo;
|
||||
mpinfo = bgp_info_mpath_next(mpinfo)) {
|
||||
for (mpinfo = bgp_path_info_mpath_first(new_best); mpinfo;
|
||||
mpinfo = bgp_path_info_mpath_next(mpinfo)) {
|
||||
asmerge =
|
||||
aspath_aggregate(aspath, mpinfo->attr->aspath);
|
||||
aspath_free(aspath);
|
||||
|
@ -792,10 +801,10 @@ void bgp_info_mpath_aggregate_update(struct bgp_path_info *new_best,
|
|||
|
||||
new_attr = bgp_attr_intern(&attr);
|
||||
|
||||
if (new_attr != bgp_info_mpath_attr(new_best)) {
|
||||
if ((old_attr = bgp_info_mpath_attr(new_best)))
|
||||
if (new_attr != bgp_path_info_mpath_attr(new_best)) {
|
||||
if ((old_attr = bgp_path_info_mpath_attr(new_best)))
|
||||
bgp_attr_unintern(&old_attr);
|
||||
bgp_info_mpath_attr_set(new_best, new_attr);
|
||||
bgp_path_info_mpath_attr_set(new_best, new_attr);
|
||||
SET_FLAG(new_best->flags, BGP_PATH_ATTR_CHANGED);
|
||||
} else
|
||||
bgp_attr_unintern(&new_attr);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef _QUAGGA_BGP_MPATH_H
|
||||
#define _QUAGGA_BGP_MPATH_H
|
||||
|
||||
/* Supplemental information linked to bgp_info for keeping track of
|
||||
/* Supplemental information linked to bgp_path_info for keeping track of
|
||||
* multipath selections, lazily allocated to save memory
|
||||
*/
|
||||
struct bgp_path_info_mpath {
|
||||
|
@ -32,7 +32,7 @@ struct bgp_path_info_mpath {
|
|||
/* Points to the previous multipath or NULL on bestpath */
|
||||
struct bgp_path_info_mpath *mp_prev;
|
||||
|
||||
/* Points to bgp_info associated with this multipath info */
|
||||
/* Points to bgp_path_info associated with this multipath info */
|
||||
struct bgp_path_info *mp_info;
|
||||
|
||||
/* When attached to best path, the number of selected multipaths */
|
||||
|
@ -50,30 +50,33 @@ extern int bgp_maximum_paths_unset(struct bgp *, afi_t, safi_t, int);
|
|||
/* Functions used by bgp_best_selection to record current
|
||||
* multipath selections
|
||||
*/
|
||||
extern int bgp_info_nexthop_cmp(struct bgp_path_info *bi1,
|
||||
struct bgp_path_info *bi2);
|
||||
extern int bgp_path_info_nexthop_cmp(struct bgp_path_info *bi1,
|
||||
struct bgp_path_info *bi2);
|
||||
extern void bgp_mp_list_init(struct list *);
|
||||
extern void bgp_mp_list_clear(struct list *);
|
||||
extern void bgp_mp_list_add(struct list *mp_list, struct bgp_path_info *mpinfo);
|
||||
extern void bgp_mp_dmed_deselect(struct bgp_path_info *dmed_best);
|
||||
extern void bgp_info_mpath_update(struct bgp_node *rn,
|
||||
struct bgp_path_info *new_best,
|
||||
struct bgp_path_info *old_best,
|
||||
struct list *mp_list,
|
||||
struct bgp_maxpaths_cfg *mpath_cfg);
|
||||
extern void bgp_info_mpath_aggregate_update(struct bgp_path_info *new_best,
|
||||
struct bgp_path_info *old_best);
|
||||
extern void bgp_path_info_mpath_update(struct bgp_node *rn,
|
||||
struct bgp_path_info *new_best,
|
||||
struct bgp_path_info *old_best,
|
||||
struct list *mp_list,
|
||||
struct bgp_maxpaths_cfg *mpath_cfg);
|
||||
extern void
|
||||
bgp_path_info_mpath_aggregate_update(struct bgp_path_info *new_best,
|
||||
struct bgp_path_info *old_best);
|
||||
|
||||
/* Unlink and free multipath information associated with a bgp_info */
|
||||
extern void bgp_info_mpath_dequeue(struct bgp_path_info *path);
|
||||
extern void bgp_info_mpath_free(struct bgp_path_info_mpath **mpath);
|
||||
/* Unlink and free multipath information associated with a bgp_path_info */
|
||||
extern void bgp_path_info_mpath_dequeue(struct bgp_path_info *path);
|
||||
extern void bgp_path_info_mpath_free(struct bgp_path_info_mpath **mpath);
|
||||
|
||||
/* Walk list of multipaths associated with a best path */
|
||||
extern struct bgp_path_info *bgp_info_mpath_first(struct bgp_path_info *);
|
||||
extern struct bgp_path_info *bgp_info_mpath_next(struct bgp_path_info *);
|
||||
extern struct bgp_path_info *
|
||||
bgp_path_info_mpath_first(struct bgp_path_info *path);
|
||||
extern struct bgp_path_info *
|
||||
bgp_path_info_mpath_next(struct bgp_path_info *path);
|
||||
|
||||
/* Accessors for multipath information */
|
||||
extern uint32_t bgp_info_mpath_count(struct bgp_path_info *path);
|
||||
extern struct attr *bgp_info_mpath_attr(struct bgp_path_info *path);
|
||||
extern uint32_t bgp_path_info_mpath_count(struct bgp_path_info *path);
|
||||
extern struct attr *bgp_path_info_mpath_attr(struct bgp_path_info *path);
|
||||
|
||||
#endif /* _QUAGGA_BGP_MPATH_H */
|
||||
|
|
|
@ -441,7 +441,7 @@ static void setlabels(struct bgp_path_info *bi,
|
|||
return;
|
||||
}
|
||||
|
||||
struct bgp_path_info_extra *extra = bgp_info_extra_get(bi);
|
||||
struct bgp_path_info_extra *extra = bgp_path_info_extra_get(bi);
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < num_labels; ++i) {
|
||||
|
@ -454,7 +454,7 @@ static void setlabels(struct bgp_path_info *bi,
|
|||
}
|
||||
|
||||
/*
|
||||
* returns pointer to new bgp_info upon success
|
||||
* returns pointer to new bgp_path_info upon success
|
||||
*/
|
||||
static struct bgp_path_info *
|
||||
leak_update(struct bgp *bgp, /* destination bgp instance */
|
||||
|
@ -521,11 +521,11 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
|
|||
}
|
||||
|
||||
/* attr is changed */
|
||||
bgp_info_set_flag(bn, bi, BGP_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(bn, bi, BGP_PATH_ATTR_CHANGED);
|
||||
|
||||
/* Rewrite BGP route information. */
|
||||
if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(bn, bi);
|
||||
bgp_path_info_restore(bn, bi);
|
||||
else
|
||||
bgp_aggregate_decrement(bgp, p, bi, afi, safi);
|
||||
bgp_attr_unintern(&bi->attr);
|
||||
|
@ -539,7 +539,7 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
|
|||
setlabels(bi, label, num_labels);
|
||||
|
||||
if (nexthop_self_flag)
|
||||
bgp_info_set_flag(bn, bi, BGP_PATH_ANNC_NH_SELF);
|
||||
bgp_path_info_set_flag(bn, bi, BGP_PATH_ANNC_NH_SELF);
|
||||
|
||||
struct bgp *bgp_nexthop = bgp;
|
||||
int nh_valid;
|
||||
|
@ -565,7 +565,7 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
|
|||
bgp_nexthop->name_pretty);
|
||||
|
||||
if (nh_valid)
|
||||
bgp_info_set_flag(bn, bi, BGP_PATH_VALID);
|
||||
bgp_path_info_set_flag(bn, bi, BGP_PATH_VALID);
|
||||
|
||||
/* Process change. */
|
||||
bgp_aggregate_increment(bgp, p, bi, afi, safi);
|
||||
|
@ -583,14 +583,14 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
|
|||
bgp->peer_self, new_attr, bn);
|
||||
|
||||
if (nexthop_self_flag)
|
||||
bgp_info_set_flag(bn, new, BGP_PATH_ANNC_NH_SELF);
|
||||
bgp_path_info_set_flag(bn, new, BGP_PATH_ANNC_NH_SELF);
|
||||
|
||||
bgp_info_extra_get(new);
|
||||
bgp_path_info_extra_get(new);
|
||||
|
||||
if (num_labels)
|
||||
setlabels(new, label, num_labels);
|
||||
|
||||
new->extra->parent = bgp_info_lock(parent);
|
||||
new->extra->parent = bgp_path_info_lock(parent);
|
||||
bgp_lock_node((struct bgp_node *)((struct bgp_path_info *)parent)->net);
|
||||
if (bgp_orig)
|
||||
new->extra->bgp_orig = bgp_lock(bgp_orig);
|
||||
|
@ -626,10 +626,10 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
|
|||
__func__, (nh_valid ? "" : "not "),
|
||||
bgp_nexthop->name_pretty);
|
||||
if (nh_valid)
|
||||
bgp_info_set_flag(bn, new, BGP_PATH_VALID);
|
||||
bgp_path_info_set_flag(bn, new, BGP_PATH_VALID);
|
||||
|
||||
bgp_aggregate_increment(bgp, p, new, afi, safi);
|
||||
bgp_info_add(bn, new);
|
||||
bgp_path_info_add(bn, new);
|
||||
|
||||
bgp_unlock_node(bn);
|
||||
bgp_process(bgp, bn, afi, safi);
|
||||
|
@ -935,7 +935,7 @@ void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn, /* to */
|
|||
vpn_leak_to_vrf_withdraw(bgp_vpn, bi);
|
||||
|
||||
bgp_aggregate_decrement(bgp_vpn, p, bi, afi, safi);
|
||||
bgp_info_delete(bn, bi);
|
||||
bgp_path_info_delete(bn, bi);
|
||||
bgp_process(bgp_vpn, bn, afi, safi);
|
||||
}
|
||||
bgp_unlock_node(bn);
|
||||
|
@ -992,7 +992,7 @@ void vpn_leak_from_vrf_withdraw_all(struct bgp *bgp_vpn, /* to */
|
|||
__func__);
|
||||
bgp_aggregate_decrement(bgp_vpn, &bn->p,
|
||||
bi, afi, safi);
|
||||
bgp_info_delete(bn, bi);
|
||||
bgp_path_info_delete(bn, bi);
|
||||
bgp_process(bgp_vpn, bn, afi, safi);
|
||||
}
|
||||
}
|
||||
|
@ -1312,7 +1312,7 @@ void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn, /* from */
|
|||
if (debug)
|
||||
zlog_debug("%s: deleting bi %p", __func__, bi);
|
||||
bgp_aggregate_decrement(bgp, p, bi, afi, safi);
|
||||
bgp_info_delete(bn, bi);
|
||||
bgp_path_info_delete(bn, bi);
|
||||
bgp_process(bgp, bn, afi, safi);
|
||||
}
|
||||
bgp_unlock_node(bn);
|
||||
|
@ -1341,7 +1341,7 @@ void vpn_leak_to_vrf_withdraw_all(struct bgp *bgp_vrf, /* to */
|
|||
/* delete route */
|
||||
bgp_aggregate_decrement(bgp_vrf, &bn->p, bi,
|
||||
afi, safi);
|
||||
bgp_info_delete(bn, bi);
|
||||
bgp_path_info_delete(bn, bi);
|
||||
bgp_process(bgp_vrf, bn, afi, safi);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
|
|||
path_nh_map(ri, bnc, 1); /* updates NHT ri list reference */
|
||||
|
||||
if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID) && bnc->metric)
|
||||
(bgp_info_extra_get(ri))->igpmetric = bnc->metric;
|
||||
(bgp_path_info_extra_get(ri))->igpmetric = bnc->metric;
|
||||
else if (ri->extra)
|
||||
ri->extra->igpmetric = 0;
|
||||
} else if (peer)
|
||||
|
@ -745,9 +745,11 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
|
|||
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_PATH_VALID);
|
||||
bgp_path_info_unset_flag(rn, path,
|
||||
BGP_PATH_VALID);
|
||||
} else {
|
||||
bgp_info_set_flag(rn, path, BGP_PATH_VALID);
|
||||
bgp_path_info_set_flag(rn, path,
|
||||
BGP_PATH_VALID);
|
||||
bgp_aggregate_increment(bgp_path, &rn->p,
|
||||
path, afi, safi);
|
||||
}
|
||||
|
@ -756,7 +758,8 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
|
|||
/* Copy the metric to the path. Will be used for bestpath
|
||||
* computation */
|
||||
if (bgp_isvalid_nexthop(bnc) && bnc->metric)
|
||||
(bgp_info_extra_get(path))->igpmetric = bnc->metric;
|
||||
(bgp_path_info_extra_get(path))->igpmetric =
|
||||
bnc->metric;
|
||||
else if (path->extra)
|
||||
path->extra->igpmetric = 0;
|
||||
|
||||
|
|
|
@ -1227,9 +1227,9 @@ static void bgp_pbr_flush_entry(struct bgp *bgp, struct bgp_pbr_action *bpa,
|
|||
struct bgp_path_info *bgp_info;
|
||||
struct bgp_path_info_extra *extra;
|
||||
|
||||
/* unlink bgp_info to bpme */
|
||||
/* unlink bgp_path_info to bpme */
|
||||
bgp_info = (struct bgp_path_info *)bpme->bgp_info;
|
||||
extra = bgp_info_extra_get(bgp_info);
|
||||
extra = bgp_path_info_extra_get(bgp_info);
|
||||
if (extra->bgp_fs_pbr)
|
||||
listnode_delete(extra->bgp_fs_pbr, bpme);
|
||||
bpme->bgp_info = NULL;
|
||||
|
@ -1850,7 +1850,8 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
|
|||
|
||||
/* already installed */
|
||||
if (bpme_found) {
|
||||
struct bgp_path_info_extra *extra = bgp_info_extra_get(binfo);
|
||||
struct bgp_path_info_extra *extra =
|
||||
bgp_path_info_extra_get(binfo);
|
||||
|
||||
if (extra && extra->bgp_fs_pbr &&
|
||||
listnode_lookup(extra->bgp_fs_pbr, bpme)) {
|
||||
|
|
283
bgpd/bgp_route.c
283
bgpd/bgp_route.c
|
@ -164,8 +164,8 @@ struct bgp_node *bgp_afi_node_lookup(struct bgp_table *table, afi_t afi,
|
|||
return rn;
|
||||
}
|
||||
|
||||
/* Allocate bgp_info_extra */
|
||||
static struct bgp_path_info_extra *bgp_info_extra_new(void)
|
||||
/* Allocate bgp_path_info_extra */
|
||||
static struct bgp_path_info_extra *bgp_path_info_extra_new(void)
|
||||
{
|
||||
struct bgp_path_info_extra *new;
|
||||
new = XCALLOC(MTYPE_BGP_ROUTE_EXTRA,
|
||||
|
@ -175,7 +175,7 @@ static struct bgp_path_info_extra *bgp_info_extra_new(void)
|
|||
return new;
|
||||
}
|
||||
|
||||
static void bgp_info_extra_free(struct bgp_path_info_extra **extra)
|
||||
static void bgp_path_info_extra_free(struct bgp_path_info_extra **extra)
|
||||
{
|
||||
struct bgp_path_info_extra *e;
|
||||
|
||||
|
@ -201,14 +201,14 @@ static void bgp_info_extra_free(struct bgp_path_info_extra **extra)
|
|||
*/
|
||||
unsigned refcount;
|
||||
|
||||
bi = bgp_info_lock(bi);
|
||||
bi = bgp_path_info_lock(bi);
|
||||
refcount = bi->net->lock - 1;
|
||||
bgp_unlock_node((struct bgp_node *)bi->net);
|
||||
if (!refcount)
|
||||
bi->net = NULL;
|
||||
bgp_info_unlock(bi);
|
||||
bgp_path_info_unlock(bi);
|
||||
}
|
||||
bgp_info_unlock(e->parent);
|
||||
bgp_path_info_unlock(e->parent);
|
||||
e->parent = NULL;
|
||||
}
|
||||
|
||||
|
@ -222,44 +222,44 @@ static void bgp_info_extra_free(struct bgp_path_info_extra **extra)
|
|||
*extra = NULL;
|
||||
}
|
||||
|
||||
/* Get bgp_info extra information for the given bgp_info, lazy allocated
|
||||
* if required.
|
||||
/* Get bgp_path_info extra information for the given bgp_path_info, lazy
|
||||
* allocated if required.
|
||||
*/
|
||||
struct bgp_path_info_extra *bgp_info_extra_get(struct bgp_path_info *ri)
|
||||
struct bgp_path_info_extra *bgp_path_info_extra_get(struct bgp_path_info *ri)
|
||||
{
|
||||
if (!ri->extra)
|
||||
ri->extra = bgp_info_extra_new();
|
||||
ri->extra = bgp_path_info_extra_new();
|
||||
return ri->extra;
|
||||
}
|
||||
|
||||
/* Allocate new bgp info structure. */
|
||||
struct bgp_path_info *bgp_info_new(void)
|
||||
struct bgp_path_info *bgp_path_info_new(void)
|
||||
{
|
||||
return XCALLOC(MTYPE_BGP_ROUTE, sizeof(struct bgp_path_info));
|
||||
}
|
||||
|
||||
/* Free bgp route information. */
|
||||
static void bgp_info_free(struct bgp_path_info *binfo)
|
||||
static void bgp_path_info_free(struct bgp_path_info *binfo)
|
||||
{
|
||||
if (binfo->attr)
|
||||
bgp_attr_unintern(&binfo->attr);
|
||||
|
||||
bgp_unlink_nexthop(binfo);
|
||||
bgp_info_extra_free(&binfo->extra);
|
||||
bgp_info_mpath_free(&binfo->mpath);
|
||||
bgp_path_info_extra_free(&binfo->extra);
|
||||
bgp_path_info_mpath_free(&binfo->mpath);
|
||||
|
||||
peer_unlock(binfo->peer); /* bgp_info peer reference */
|
||||
peer_unlock(binfo->peer); /* bgp_path_info peer reference */
|
||||
|
||||
XFREE(MTYPE_BGP_ROUTE, binfo);
|
||||
}
|
||||
|
||||
struct bgp_path_info *bgp_info_lock(struct bgp_path_info *binfo)
|
||||
struct bgp_path_info *bgp_path_info_lock(struct bgp_path_info *binfo)
|
||||
{
|
||||
binfo->lock++;
|
||||
return binfo;
|
||||
}
|
||||
|
||||
struct bgp_path_info *bgp_info_unlock(struct bgp_path_info *binfo)
|
||||
struct bgp_path_info *bgp_path_info_unlock(struct bgp_path_info *binfo)
|
||||
{
|
||||
assert(binfo && binfo->lock > 0);
|
||||
binfo->lock--;
|
||||
|
@ -269,7 +269,7 @@ struct bgp_path_info *bgp_info_unlock(struct bgp_path_info *binfo)
|
|||
zlog_debug ("%s: unlocked and freeing", __func__);
|
||||
zlog_backtrace (LOG_DEBUG);
|
||||
#endif
|
||||
bgp_info_free(binfo);
|
||||
bgp_path_info_free(binfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ struct bgp_path_info *bgp_info_unlock(struct bgp_path_info *binfo)
|
|||
return binfo;
|
||||
}
|
||||
|
||||
void bgp_info_add(struct bgp_node *rn, struct bgp_path_info *ri)
|
||||
void bgp_path_info_add(struct bgp_node *rn, struct bgp_path_info *ri)
|
||||
{
|
||||
struct bgp_path_info *top;
|
||||
|
||||
|
@ -296,14 +296,14 @@ void bgp_info_add(struct bgp_node *rn, struct bgp_path_info *ri)
|
|||
top->prev = ri;
|
||||
rn->info = ri;
|
||||
|
||||
bgp_info_lock(ri);
|
||||
bgp_path_info_lock(ri);
|
||||
bgp_lock_node(rn);
|
||||
peer_lock(ri->peer); /* bgp_info peer reference */
|
||||
peer_lock(ri->peer); /* bgp_path_info peer reference */
|
||||
}
|
||||
|
||||
/* Do the actual removal of info from RIB, for use by bgp_process
|
||||
completion callback *only* */
|
||||
void bgp_info_reap(struct bgp_node *rn, struct bgp_path_info *ri)
|
||||
void bgp_path_info_reap(struct bgp_node *rn, struct bgp_path_info *ri)
|
||||
{
|
||||
if (ri->next)
|
||||
ri->next->prev = ri->prev;
|
||||
|
@ -312,24 +312,24 @@ void bgp_info_reap(struct bgp_node *rn, struct bgp_path_info *ri)
|
|||
else
|
||||
rn->info = ri->next;
|
||||
|
||||
bgp_info_mpath_dequeue(ri);
|
||||
bgp_info_unlock(ri);
|
||||
bgp_path_info_mpath_dequeue(ri);
|
||||
bgp_path_info_unlock(ri);
|
||||
bgp_unlock_node(rn);
|
||||
}
|
||||
|
||||
void bgp_info_delete(struct bgp_node *rn, struct bgp_path_info *ri)
|
||||
void bgp_path_info_delete(struct bgp_node *rn, struct bgp_path_info *ri)
|
||||
{
|
||||
bgp_info_set_flag(rn, ri, BGP_PATH_REMOVED);
|
||||
bgp_path_info_set_flag(rn, ri, BGP_PATH_REMOVED);
|
||||
/* set of previous already took care of pcount */
|
||||
UNSET_FLAG(ri->flags, BGP_PATH_VALID);
|
||||
}
|
||||
|
||||
/* undo the effects of a previous call to bgp_info_delete; typically
|
||||
/* undo the effects of a previous call to bgp_path_info_delete; typically
|
||||
called when a route is deleted and then quickly re-added before the
|
||||
deletion has been processed */
|
||||
void bgp_info_restore(struct bgp_node *rn, struct bgp_path_info *ri)
|
||||
void bgp_path_info_restore(struct bgp_node *rn, struct bgp_path_info *ri)
|
||||
{
|
||||
bgp_info_unset_flag(rn, ri, BGP_PATH_REMOVED);
|
||||
bgp_path_info_unset_flag(rn, ri, BGP_PATH_REMOVED);
|
||||
/* unset of previous already took care of pcount */
|
||||
SET_FLAG(ri->flags, BGP_PATH_VALID);
|
||||
}
|
||||
|
@ -371,11 +371,11 @@ static int bgp_label_index_differs(struct bgp_path_info *ri1,
|
|||
return (!(ri1->attr->label_index == ri2->attr->label_index));
|
||||
}
|
||||
|
||||
/* Set/unset bgp_info flags, adjusting any other state as needed.
|
||||
/* Set/unset bgp_path_info flags, adjusting any other state as needed.
|
||||
* This is here primarily to keep prefix-count in check.
|
||||
*/
|
||||
void bgp_info_set_flag(struct bgp_node *rn, struct bgp_path_info *ri,
|
||||
uint32_t flag)
|
||||
void bgp_path_info_set_flag(struct bgp_node *rn, struct bgp_path_info *ri,
|
||||
uint32_t flag)
|
||||
{
|
||||
SET_FLAG(ri->flags, flag);
|
||||
|
||||
|
@ -388,8 +388,8 @@ void bgp_info_set_flag(struct bgp_node *rn, struct bgp_path_info *ri,
|
|||
bgp_pcount_adjust(rn, ri);
|
||||
}
|
||||
|
||||
void bgp_info_unset_flag(struct bgp_node *rn, struct bgp_path_info *ri,
|
||||
uint32_t flag)
|
||||
void bgp_path_info_unset_flag(struct bgp_node *rn, struct bgp_path_info *ri,
|
||||
uint32_t flag)
|
||||
{
|
||||
UNSET_FLAG(ri->flags, flag);
|
||||
|
||||
|
@ -416,7 +416,7 @@ static uint32_t bgp_med_value(struct attr *attr, struct bgp *bgp)
|
|||
}
|
||||
}
|
||||
|
||||
void bgp_info_path_with_addpath_rx_str(struct bgp_path_info *ri, char *buf)
|
||||
void bgp_path_info_path_with_addpath_rx_str(struct bgp_path_info *ri, char *buf)
|
||||
{
|
||||
if (ri->addpath_rx_id)
|
||||
sprintf(buf, "path %s (addpath rxid %d)", ri->peer->host,
|
||||
|
@ -427,10 +427,10 @@ void bgp_info_path_with_addpath_rx_str(struct bgp_path_info *ri, char *buf)
|
|||
|
||||
/* Compare two bgp route entity. If 'new' is preferable over 'exist' return 1.
|
||||
*/
|
||||
static int bgp_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
||||
struct bgp_path_info *exist, int *paths_eq,
|
||||
struct bgp_maxpaths_cfg *mpath_cfg, int debug,
|
||||
char *pfx_buf, afi_t afi, safi_t safi)
|
||||
static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
||||
struct bgp_path_info *exist, int *paths_eq,
|
||||
struct bgp_maxpaths_cfg *mpath_cfg, int debug,
|
||||
char *pfx_buf, afi_t afi, safi_t safi)
|
||||
{
|
||||
struct attr *newattr, *existattr;
|
||||
bgp_peer_sort_t new_sort;
|
||||
|
@ -464,7 +464,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
|||
}
|
||||
|
||||
if (debug)
|
||||
bgp_info_path_with_addpath_rx_str(new, new_buf);
|
||||
bgp_path_info_path_with_addpath_rx_str(new, new_buf);
|
||||
|
||||
if (exist == NULL) {
|
||||
if (debug)
|
||||
|
@ -474,7 +474,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
|||
}
|
||||
|
||||
if (debug) {
|
||||
bgp_info_path_with_addpath_rx_str(exist, exist_buf);
|
||||
bgp_path_info_path_with_addpath_rx_str(exist, exist_buf);
|
||||
zlog_debug("%s: Comparing %s flags 0x%x with %s flags 0x%x",
|
||||
pfx_buf, new_buf, new->flags, exist_buf,
|
||||
exist->flags);
|
||||
|
@ -502,9 +502,10 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
|||
prefix2str(&new->net->p, pfx_buf,
|
||||
sizeof(*pfx_buf)
|
||||
* PREFIX2STR_BUFFER);
|
||||
bgp_info_path_with_addpath_rx_str(new, new_buf);
|
||||
bgp_info_path_with_addpath_rx_str(exist,
|
||||
exist_buf);
|
||||
bgp_path_info_path_with_addpath_rx_str(new,
|
||||
new_buf);
|
||||
bgp_path_info_path_with_addpath_rx_str(
|
||||
exist, exist_buf);
|
||||
}
|
||||
|
||||
if (newattr->sticky && !existattr->sticky) {
|
||||
|
@ -1023,14 +1024,14 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
|
|||
* is preferred, or 0 if they are the same (usually will only occur if
|
||||
* multipath is enabled
|
||||
* This version is compatible with */
|
||||
int bgp_info_cmp_compatible(struct bgp *bgp, struct bgp_path_info *new,
|
||||
struct bgp_path_info *exist, char *pfx_buf,
|
||||
afi_t afi, safi_t safi)
|
||||
int bgp_path_info_cmp_compatible(struct bgp *bgp, struct bgp_path_info *new,
|
||||
struct bgp_path_info *exist, char *pfx_buf,
|
||||
afi_t afi, safi_t safi)
|
||||
{
|
||||
int paths_eq;
|
||||
int ret;
|
||||
ret = bgp_info_cmp(bgp, new, exist, &paths_eq, NULL, 0, pfx_buf, afi,
|
||||
safi);
|
||||
ret = bgp_path_info_cmp(bgp, new, exist, &paths_eq, NULL, 0, pfx_buf,
|
||||
afi, safi);
|
||||
|
||||
if (paths_eq)
|
||||
ret = 0;
|
||||
|
@ -1406,7 +1407,8 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *ri,
|
|||
from = ri->peer;
|
||||
filter = &peer->filter[afi][safi];
|
||||
bgp = SUBGRP_INST(subgrp);
|
||||
riattr = bgp_info_mpath_count(ri) ? bgp_info_mpath_attr(ri) : ri->attr;
|
||||
riattr = bgp_path_info_mpath_count(ri) ? bgp_path_info_mpath_attr(ri)
|
||||
: ri->attr;
|
||||
|
||||
#if ENABLE_BGP_VNC
|
||||
if (((afi == AFI_IP) || (afi == AFI_IP6)) && (safi == SAFI_MPLS_VPN)
|
||||
|
@ -1868,7 +1870,8 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
|
|||
|
||||
/* Clear BGP_PATH_DMED_SELECTED for all paths */
|
||||
for (ri1 = rn->info; ri1; ri1 = ri1->next)
|
||||
bgp_info_unset_flag(rn, ri1, BGP_PATH_DMED_SELECTED);
|
||||
bgp_path_info_unset_flag(rn, ri1,
|
||||
BGP_PATH_DMED_SELECTED);
|
||||
|
||||
for (ri1 = rn->info; ri1; ri1 = ri1->next) {
|
||||
if (CHECK_FLAG(ri1->flags, BGP_PATH_DMED_CHECK))
|
||||
|
@ -1901,31 +1904,33 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
|
|||
|| aspath_cmp_left_confed(
|
||||
ri1->attr->aspath,
|
||||
ri2->attr->aspath)) {
|
||||
if (bgp_info_cmp(bgp, ri2,
|
||||
new_select,
|
||||
&paths_eq,
|
||||
mpath_cfg,
|
||||
debug, pfx_buf,
|
||||
afi, safi)) {
|
||||
bgp_info_unset_flag(
|
||||
if (bgp_path_info_cmp(
|
||||
bgp, ri2,
|
||||
new_select,
|
||||
&paths_eq,
|
||||
mpath_cfg, debug,
|
||||
pfx_buf, afi,
|
||||
safi)) {
|
||||
bgp_path_info_unset_flag(
|
||||
rn, new_select,
|
||||
BGP_PATH_DMED_SELECTED);
|
||||
new_select = ri2;
|
||||
}
|
||||
|
||||
bgp_info_set_flag(
|
||||
bgp_path_info_set_flag(
|
||||
rn, ri2,
|
||||
BGP_PATH_DMED_CHECK);
|
||||
}
|
||||
}
|
||||
}
|
||||
bgp_info_set_flag(rn, new_select, BGP_PATH_DMED_CHECK);
|
||||
bgp_info_set_flag(rn, new_select,
|
||||
BGP_PATH_DMED_SELECTED);
|
||||
bgp_path_info_set_flag(rn, new_select,
|
||||
BGP_PATH_DMED_CHECK);
|
||||
bgp_path_info_set_flag(rn, new_select,
|
||||
BGP_PATH_DMED_SELECTED);
|
||||
|
||||
if (debug) {
|
||||
bgp_info_path_with_addpath_rx_str(new_select,
|
||||
path_buf);
|
||||
bgp_path_info_path_with_addpath_rx_str(
|
||||
new_select, path_buf);
|
||||
zlog_debug("%s: %s is the bestpath from AS %u",
|
||||
pfx_buf, path_buf,
|
||||
aspath_get_first_as(
|
||||
|
@ -1948,7 +1953,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
|
|||
*/
|
||||
if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)
|
||||
&& (ri != old_select))
|
||||
bgp_info_reap(rn, ri);
|
||||
bgp_path_info_reap(rn, ri);
|
||||
|
||||
if (debug)
|
||||
zlog_debug("%s: ri %p in holddown", __func__,
|
||||
|
@ -1971,16 +1976,16 @@ 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_PATH_DMED_SELECTED))) {
|
||||
bgp_info_unset_flag(rn, ri, BGP_PATH_DMED_CHECK);
|
||||
bgp_path_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_PATH_DMED_CHECK);
|
||||
bgp_path_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)) {
|
||||
if (bgp_path_info_cmp(bgp, ri, new_select, &paths_eq, mpath_cfg,
|
||||
debug, pfx_buf, afi, safi)) {
|
||||
new_select = ri;
|
||||
}
|
||||
}
|
||||
|
@ -1991,7 +1996,8 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
|
|||
*/
|
||||
if (debug) {
|
||||
if (new_select)
|
||||
bgp_info_path_with_addpath_rx_str(new_select, path_buf);
|
||||
bgp_path_info_path_with_addpath_rx_str(new_select,
|
||||
path_buf);
|
||||
else
|
||||
sprintf(path_buf, "NONE");
|
||||
zlog_debug(
|
||||
|
@ -2005,7 +2011,8 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
|
|||
ri = nextri) {
|
||||
|
||||
if (debug)
|
||||
bgp_info_path_with_addpath_rx_str(ri, path_buf);
|
||||
bgp_path_info_path_with_addpath_rx_str(
|
||||
ri, path_buf);
|
||||
|
||||
if (ri == new_select) {
|
||||
if (debug)
|
||||
|
@ -2025,7 +2032,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
|
|||
if (ri->peer->status != Established)
|
||||
continue;
|
||||
|
||||
if (!bgp_info_nexthop_cmp(ri, new_select)) {
|
||||
if (!bgp_path_info_nexthop_cmp(ri, new_select)) {
|
||||
if (debug)
|
||||
zlog_debug(
|
||||
"%s: %s has the same nexthop as the bestpath, skip it",
|
||||
|
@ -2033,8 +2040,8 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
|
|||
continue;
|
||||
}
|
||||
|
||||
bgp_info_cmp(bgp, ri, new_select, &paths_eq, mpath_cfg,
|
||||
debug, pfx_buf, afi, safi);
|
||||
bgp_path_info_cmp(bgp, ri, new_select, &paths_eq,
|
||||
mpath_cfg, debug, pfx_buf, afi, safi);
|
||||
|
||||
if (paths_eq) {
|
||||
if (debug)
|
||||
|
@ -2046,8 +2053,9 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
|
|||
}
|
||||
}
|
||||
|
||||
bgp_info_mpath_update(rn, new_select, old_select, &mp_list, mpath_cfg);
|
||||
bgp_info_mpath_aggregate_update(new_select, old_select);
|
||||
bgp_path_info_mpath_update(rn, new_select, old_select, &mp_list,
|
||||
mpath_cfg);
|
||||
bgp_path_info_mpath_aggregate_update(new_select, old_select);
|
||||
bgp_mp_list_clear(&mp_list);
|
||||
|
||||
result->old = old_select;
|
||||
|
@ -2149,8 +2157,8 @@ int bgp_zebra_has_route_changed(struct bgp_node *rn,
|
|||
/*
|
||||
* If this is multipath, check all selected paths for any nexthop change
|
||||
*/
|
||||
for (mpinfo = bgp_info_mpath_first(selected); mpinfo;
|
||||
mpinfo = bgp_info_mpath_next(mpinfo)) {
|
||||
for (mpinfo = bgp_path_info_mpath_first(selected); mpinfo;
|
||||
mpinfo = bgp_path_info_mpath_next(mpinfo)) {
|
||||
if (CHECK_FLAG(mpinfo->flags, BGP_PATH_IGP_CHANGED)
|
||||
|| CHECK_FLAG(mpinfo->flags, BGP_PATH_ATTR_CHANGED))
|
||||
return 1;
|
||||
|
@ -2336,12 +2344,12 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
|
|||
}
|
||||
|
||||
if (old_select)
|
||||
bgp_info_unset_flag(rn, old_select, BGP_PATH_SELECTED);
|
||||
bgp_path_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_PATH_SELECTED);
|
||||
bgp_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(rn, new_select, BGP_PATH_SELECTED);
|
||||
bgp_path_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED);
|
||||
UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG);
|
||||
}
|
||||
|
||||
|
@ -2429,9 +2437,9 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
|
|||
/* Clear any route change flags. */
|
||||
bgp_zebra_clear_route_change_flags(rn);
|
||||
|
||||
/* Reap old select bgp_info, if it has been removed */
|
||||
/* Reap old select bgp_path_info, if it has been removed */
|
||||
if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_reap(rn, old_select);
|
||||
bgp_path_info_reap(rn, old_select);
|
||||
|
||||
UNSET_FLAG(rn->flags, BGP_NODE_PROCESS_SCHEDULED);
|
||||
return;
|
||||
|
@ -2680,7 +2688,7 @@ void bgp_rib_remove(struct bgp_node *rn, struct bgp_path_info *ri,
|
|||
bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi, safi);
|
||||
|
||||
if (!CHECK_FLAG(ri->flags, BGP_PATH_HISTORY))
|
||||
bgp_info_delete(rn, ri); /* keep historical info */
|
||||
bgp_path_info_delete(rn, ri); /* keep historical info */
|
||||
|
||||
bgp_process(peer->bgp, rn, afi, safi);
|
||||
}
|
||||
|
@ -2690,7 +2698,7 @@ static void bgp_rib_withdraw(struct bgp_node *rn, struct bgp_path_info *ri,
|
|||
struct prefix_rd *prd)
|
||||
{
|
||||
/* apply dampening, if result is suppressed, we'll be retaining
|
||||
* the bgp_info in the RIB for historical reference.
|
||||
* the bgp_path_info in the RIB for historical reference.
|
||||
*/
|
||||
if (CHECK_FLAG(peer->bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)
|
||||
&& peer->sort == BGP_PEER_EBGP)
|
||||
|
@ -3027,7 +3035,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
|||
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,
|
||||
|| memcmp(&(bgp_path_info_extra_get(ri))->label, label,
|
||||
num_labels * sizeof(mpls_label_t))
|
||||
== 0)
|
||||
&& (overlay_index_equal(
|
||||
|
@ -3076,8 +3084,8 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
|||
|
||||
/* graceful restart STALE flag unset. */
|
||||
if (CHECK_FLAG(ri->flags, BGP_PATH_STALE)) {
|
||||
bgp_info_unset_flag(rn, ri,
|
||||
BGP_PATH_STALE);
|
||||
bgp_path_info_unset_flag(
|
||||
rn, ri, BGP_PATH_STALE);
|
||||
bgp_process(bgp, rn, afi, safi);
|
||||
}
|
||||
}
|
||||
|
@ -3100,7 +3108,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
|||
peer->host, pfx_buf);
|
||||
}
|
||||
|
||||
bgp_info_restore(rn, ri);
|
||||
bgp_path_info_restore(rn, ri);
|
||||
}
|
||||
|
||||
/* Received Logging. */
|
||||
|
@ -3114,10 +3122,10 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
|||
|
||||
/* graceful restart STALE flag unset. */
|
||||
if (CHECK_FLAG(ri->flags, BGP_PATH_STALE))
|
||||
bgp_info_unset_flag(rn, ri, BGP_PATH_STALE);
|
||||
bgp_path_info_unset_flag(rn, ri, BGP_PATH_STALE);
|
||||
|
||||
/* The attribute is changed. */
|
||||
bgp_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED);
|
||||
bgp_path_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.
|
||||
|
@ -3197,7 +3205,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
|||
|
||||
/* Update MPLS label */
|
||||
if (has_valid_label) {
|
||||
extra = bgp_info_extra_get(ri);
|
||||
extra = bgp_path_info_extra_get(ri);
|
||||
memcpy(&extra->label, label,
|
||||
num_labels * sizeof(mpls_label_t));
|
||||
extra->num_labels = num_labels;
|
||||
|
@ -3266,7 +3274,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_PATH_VALID);
|
||||
bgp_path_info_set_flag(rn, ri, BGP_PATH_VALID);
|
||||
else {
|
||||
if (BGP_DEBUG(nht, NHT)) {
|
||||
char buf1[INET6_ADDRSTRLEN];
|
||||
|
@ -3277,10 +3285,11 @@ 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_PATH_VALID);
|
||||
bgp_path_info_unset_flag(rn, ri,
|
||||
BGP_PATH_VALID);
|
||||
}
|
||||
} else
|
||||
bgp_info_set_flag(rn, ri, BGP_PATH_VALID);
|
||||
bgp_path_info_set_flag(rn, ri, BGP_PATH_VALID);
|
||||
|
||||
#if ENABLE_BGP_VNC
|
||||
if (safi == SAFI_MPLS_VPN) {
|
||||
|
@ -3367,7 +3376,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
|||
|
||||
/* Update MPLS label */
|
||||
if (has_valid_label) {
|
||||
extra = bgp_info_extra_get(new);
|
||||
extra = bgp_path_info_extra_get(new);
|
||||
memcpy(&extra->label, label, num_labels * sizeof(mpls_label_t));
|
||||
extra->num_labels = num_labels;
|
||||
if (!(afi == AFI_L2VPN && safi == SAFI_EVPN))
|
||||
|
@ -3393,7 +3402,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_PATH_VALID);
|
||||
bgp_path_info_set_flag(rn, new, BGP_PATH_VALID);
|
||||
else {
|
||||
if (BGP_DEBUG(nht, NHT)) {
|
||||
char buf1[INET6_ADDRSTRLEN];
|
||||
|
@ -3403,10 +3412,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_PATH_VALID);
|
||||
bgp_path_info_unset_flag(rn, new, BGP_PATH_VALID);
|
||||
}
|
||||
} else
|
||||
bgp_info_set_flag(rn, new, BGP_PATH_VALID);
|
||||
bgp_path_info_set_flag(rn, new, BGP_PATH_VALID);
|
||||
|
||||
/* Addpath ID */
|
||||
new->addpath_rx_id = addpath_id;
|
||||
|
@ -3415,7 +3424,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
|||
bgp_aggregate_increment(bgp, p, new, afi, safi);
|
||||
|
||||
/* Register new BGP information. */
|
||||
bgp_info_add(rn, new);
|
||||
bgp_path_info_add(rn, new);
|
||||
|
||||
/* route_node_get lock */
|
||||
bgp_unlock_node(rn);
|
||||
|
@ -3808,7 +3817,7 @@ static wq_item_status bgp_clear_route_node(struct work_queue *wq, void *data)
|
|||
&& peer->nsf[afi][safi]
|
||||
&& !CHECK_FLAG(ri->flags, BGP_PATH_STALE)
|
||||
&& !CHECK_FLAG(ri->flags, BGP_PATH_UNUSEABLE))
|
||||
bgp_info_set_flag(rn, ri, BGP_PATH_STALE);
|
||||
bgp_path_info_set_flag(rn, ri, BGP_PATH_STALE);
|
||||
else {
|
||||
/* If this is an EVPN route, process for
|
||||
* un-import. */
|
||||
|
@ -3944,7 +3953,7 @@ static void bgp_clear_route_table(struct peer *peer, afi_t afi, safi_t safi,
|
|||
continue;
|
||||
|
||||
if (force)
|
||||
bgp_info_reap(rn, ri);
|
||||
bgp_path_info_reap(rn, ri);
|
||||
else {
|
||||
struct bgp_clear_node_queue *cnq;
|
||||
|
||||
|
@ -4106,7 +4115,7 @@ static void bgp_cleanup_table(struct bgp *bgp, struct bgp_table *table,
|
|||
if (bgp_fibupd_safi(safi))
|
||||
bgp_zebra_withdraw(&rn->p, ri,
|
||||
bgp, safi);
|
||||
bgp_info_reap(rn, ri);
|
||||
bgp_path_info_reap(rn, ri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4439,11 +4448,11 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
|
|||
return;
|
||||
} else {
|
||||
/* The attribute is changed. */
|
||||
bgp_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED);
|
||||
|
||||
/* Rewrite BGP route information. */
|
||||
if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(rn, ri);
|
||||
bgp_path_info_restore(rn, ri);
|
||||
else
|
||||
bgp_aggregate_decrement(bgp, p, ri, afi, safi);
|
||||
#if ENABLE_BGP_VNC
|
||||
|
@ -4488,8 +4497,8 @@ 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_PATH_VALID);
|
||||
bgp_path_info_set_flag(rn, ri,
|
||||
BGP_PATH_VALID);
|
||||
else {
|
||||
if (BGP_DEBUG(nht, NHT)) {
|
||||
char buf1[INET6_ADDRSTRLEN];
|
||||
|
@ -4500,8 +4509,8 @@ 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, ri,
|
||||
BGP_PATH_VALID);
|
||||
bgp_path_info_unset_flag(
|
||||
rn, ri, BGP_PATH_VALID);
|
||||
}
|
||||
} else {
|
||||
/* Delete the NHT structure if any, if we're
|
||||
|
@ -4512,7 +4521,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
|
|||
* process interaction
|
||||
*/
|
||||
bgp_unlink_nexthop(ri);
|
||||
bgp_info_set_flag(rn, ri, BGP_PATH_VALID);
|
||||
bgp_path_info_set_flag(rn, ri, BGP_PATH_VALID);
|
||||
}
|
||||
/* Process change. */
|
||||
bgp_aggregate_increment(bgp, p, ri, afi, safi);
|
||||
|
@ -4539,7 +4548,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_PATH_VALID);
|
||||
bgp_path_info_set_flag(rn, new, BGP_PATH_VALID);
|
||||
else {
|
||||
if (BGP_DEBUG(nht, NHT)) {
|
||||
char buf1[INET6_ADDRSTRLEN];
|
||||
|
@ -4549,7 +4558,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_PATH_VALID);
|
||||
bgp_path_info_unset_flag(rn, new, BGP_PATH_VALID);
|
||||
}
|
||||
} else {
|
||||
/* Delete the NHT structure if any, if we're toggling between
|
||||
|
@ -4558,14 +4567,14 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
|
|||
*/
|
||||
bgp_unlink_nexthop(new);
|
||||
|
||||
bgp_info_set_flag(rn, new, BGP_PATH_VALID);
|
||||
bgp_path_info_set_flag(rn, new, BGP_PATH_VALID);
|
||||
}
|
||||
|
||||
/* Aggregate address increment. */
|
||||
bgp_aggregate_increment(bgp, p, new, afi, safi);
|
||||
|
||||
/* Register new BGP information. */
|
||||
bgp_info_add(rn, new);
|
||||
bgp_path_info_add(rn, new);
|
||||
|
||||
/* route_node_get lock */
|
||||
bgp_unlock_node(rn);
|
||||
|
@ -4606,7 +4615,7 @@ void bgp_static_withdraw(struct bgp *bgp, struct prefix *p, afi_t afi,
|
|||
}
|
||||
bgp_aggregate_decrement(bgp, p, ri, afi, safi);
|
||||
bgp_unlink_nexthop(ri);
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
bgp_process(bgp, rn, afi, safi);
|
||||
}
|
||||
|
||||
|
@ -4644,7 +4653,7 @@ static void bgp_static_withdraw_safi(struct bgp *bgp, struct prefix *p,
|
|||
vpn_leak_to_vrf_withdraw(bgp, ri);
|
||||
}
|
||||
bgp_aggregate_decrement(bgp, p, ri, afi, safi);
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
bgp_process(bgp, rn, afi, safi);
|
||||
}
|
||||
|
||||
|
@ -4752,11 +4761,11 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
|
|||
return;
|
||||
} else {
|
||||
/* The attribute is changed. */
|
||||
bgp_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED);
|
||||
|
||||
/* Rewrite BGP route information. */
|
||||
if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(rn, ri);
|
||||
bgp_path_info_restore(rn, ri);
|
||||
else
|
||||
bgp_aggregate_decrement(bgp, p, ri, afi, safi);
|
||||
bgp_attr_unintern(&ri->attr);
|
||||
|
@ -4791,7 +4800,7 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
|
|||
new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0, bgp->peer_self,
|
||||
attr_new, rn);
|
||||
SET_FLAG(new->flags, BGP_PATH_VALID);
|
||||
new->extra = bgp_info_extra_new();
|
||||
new->extra = bgp_path_info_extra_new();
|
||||
if (num_labels) {
|
||||
new->extra->label[0] = bgp_static->label;
|
||||
new->extra->num_labels = num_labels;
|
||||
|
@ -4804,7 +4813,7 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
|
|||
bgp_aggregate_increment(bgp, p, new, afi, safi);
|
||||
|
||||
/* Register new BGP information. */
|
||||
bgp_info_add(rn, new);
|
||||
bgp_path_info_add(rn, new);
|
||||
/* route_node_get lock */
|
||||
bgp_unlock_node(rn);
|
||||
|
||||
|
@ -5090,7 +5099,7 @@ static void bgp_purge_af_static_redist_routes(struct bgp *bgp, afi_t afi,
|
|||
bgp_aggregate_decrement(bgp, &rn->p, ri, afi,
|
||||
safi);
|
||||
bgp_unlink_nexthop(ri);
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
bgp_process(bgp, rn, afi, safi);
|
||||
}
|
||||
}
|
||||
|
@ -5540,7 +5549,7 @@ static void bgp_aggregate_install(struct bgp *bgp, afi_t afi, safi_t safi,
|
|||
* Mark the old as unusable
|
||||
*/
|
||||
if (ri)
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
|
||||
new = info_make(
|
||||
ZEBRA_ROUTE_BGP, BGP_ROUTE_AGGREGATE, 0, bgp->peer_self,
|
||||
|
@ -5550,7 +5559,7 @@ static void bgp_aggregate_install(struct bgp *bgp, afi_t afi, safi_t safi,
|
|||
rn);
|
||||
SET_FLAG(new->flags, BGP_PATH_VALID);
|
||||
|
||||
bgp_info_add(rn, new);
|
||||
bgp_path_info_add(rn, new);
|
||||
bgp_process(bgp, rn, afi, safi);
|
||||
} else {
|
||||
for (ri = rn->info; ri; ri = ri->next)
|
||||
|
@ -5561,7 +5570,7 @@ static void bgp_aggregate_install(struct bgp *bgp, afi_t afi, safi_t safi,
|
|||
|
||||
/* Withdraw static BGP route from routing table. */
|
||||
if (ri) {
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
bgp_process(bgp, rn, afi, safi);
|
||||
}
|
||||
}
|
||||
|
@ -5626,9 +5635,9 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p,
|
|||
* aggregated route announcements.
|
||||
*/
|
||||
if (aggregate->summary_only) {
|
||||
(bgp_info_extra_get(ri))->suppress++;
|
||||
bgp_info_set_flag(rn, ri,
|
||||
BGP_PATH_ATTR_CHANGED);
|
||||
(bgp_path_info_extra_get(ri))->suppress++;
|
||||
bgp_path_info_set_flag(rn, ri,
|
||||
BGP_PATH_ATTR_CHANGED);
|
||||
match++;
|
||||
}
|
||||
|
||||
|
@ -5682,7 +5691,7 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p,
|
|||
aggregate->count++;
|
||||
|
||||
if (aggregate->summary_only)
|
||||
(bgp_info_extra_get(rinew))->suppress++;
|
||||
(bgp_path_info_extra_get(rinew))->suppress++;
|
||||
|
||||
if (origin < rinew->attr->origin)
|
||||
origin = rinew->attr->origin;
|
||||
|
@ -5752,7 +5761,7 @@ static void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi,
|
|||
ri->extra->suppress--;
|
||||
|
||||
if (ri->extra->suppress == 0) {
|
||||
bgp_info_set_flag(
|
||||
bgp_path_info_set_flag(
|
||||
rn, ri, BGP_PATH_ATTR_CHANGED);
|
||||
match++;
|
||||
}
|
||||
|
@ -6171,12 +6180,12 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
|
|||
return;
|
||||
} else {
|
||||
/* The attribute is changed. */
|
||||
bgp_info_set_flag(bn, bi,
|
||||
BGP_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(bn, bi,
|
||||
BGP_PATH_ATTR_CHANGED);
|
||||
|
||||
/* Rewrite BGP route information. */
|
||||
if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(bn, bi);
|
||||
bgp_path_info_restore(bn, bi);
|
||||
else
|
||||
bgp_aggregate_decrement(bgp, p, bi, afi,
|
||||
SAFI_UNICAST);
|
||||
|
@ -6207,7 +6216,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
|
|||
SET_FLAG(new->flags, BGP_PATH_VALID);
|
||||
|
||||
bgp_aggregate_increment(bgp, p, new, afi, SAFI_UNICAST);
|
||||
bgp_info_add(bn, new);
|
||||
bgp_path_info_add(bn, new);
|
||||
bgp_unlock_node(bn);
|
||||
bgp_process(bgp, bn, afi, SAFI_UNICAST);
|
||||
|
||||
|
@ -6249,7 +6258,7 @@ void bgp_redistribute_delete(struct bgp *bgp, struct prefix *p, uint8_t type,
|
|||
bgp, ri);
|
||||
}
|
||||
bgp_aggregate_decrement(bgp, p, ri, afi, SAFI_UNICAST);
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
bgp_process(bgp, rn, afi, SAFI_UNICAST);
|
||||
}
|
||||
bgp_unlock_node(rn);
|
||||
|
@ -6281,7 +6290,7 @@ void bgp_redistribute_withdraw(struct bgp *bgp, afi_t afi, int type,
|
|||
}
|
||||
bgp_aggregate_decrement(bgp, &rn->p, ri, afi,
|
||||
SAFI_UNICAST);
|
||||
bgp_info_delete(rn, ri);
|
||||
bgp_path_info_delete(rn, ri);
|
||||
bgp_process(bgp, rn, afi, SAFI_UNICAST);
|
||||
}
|
||||
}
|
||||
|
@ -6344,7 +6353,7 @@ enum bgp_display_type {
|
|||
normal_list,
|
||||
};
|
||||
|
||||
/* Print the short form route status for a bgp_info */
|
||||
/* Print the short form route status for a bgp_path_info */
|
||||
static void route_vty_short_status_out(struct vty *vty,
|
||||
struct bgp_path_info *binfo,
|
||||
json_object *json_path)
|
||||
|
@ -7872,7 +7881,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
|
|||
|
||||
if (CHECK_FLAG(binfo->flags, BGP_PATH_MULTIPATH)
|
||||
|| (CHECK_FLAG(binfo->flags, BGP_PATH_SELECTED)
|
||||
&& bgp_info_mpath_count(binfo))) {
|
||||
&& bgp_path_info_mpath_count(binfo))) {
|
||||
if (json_paths)
|
||||
json_object_boolean_true_add(json_path,
|
||||
"multipath");
|
||||
|
|
|
@ -358,19 +358,19 @@ extern void bgp_clear_stale_route(struct peer *, afi_t, safi_t);
|
|||
extern struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi,
|
||||
safi_t safi, struct prefix *p,
|
||||
struct prefix_rd *prd);
|
||||
extern struct bgp_path_info *bgp_info_lock(struct bgp_path_info *path);
|
||||
extern struct bgp_path_info *bgp_info_unlock(struct bgp_path_info *path);
|
||||
extern void bgp_info_add(struct bgp_node *rn, struct bgp_path_info *ri);
|
||||
extern void bgp_info_reap(struct bgp_node *rn, struct bgp_path_info *ri);
|
||||
extern void bgp_info_delete(struct bgp_node *rn, struct bgp_path_info *ri);
|
||||
extern struct bgp_path_info *bgp_path_info_lock(struct bgp_path_info *path);
|
||||
extern struct bgp_path_info *bgp_path_info_unlock(struct bgp_path_info *path);
|
||||
extern void bgp_path_info_add(struct bgp_node *rn, struct bgp_path_info *ri);
|
||||
extern void bgp_path_info_reap(struct bgp_node *rn, struct bgp_path_info *ri);
|
||||
extern void bgp_path_info_delete(struct bgp_node *rn, struct bgp_path_info *ri);
|
||||
extern struct bgp_path_info_extra *
|
||||
bgp_info_extra_get(struct bgp_path_info *path);
|
||||
extern void bgp_info_set_flag(struct bgp_node *rn, struct bgp_path_info *path,
|
||||
uint32_t flag);
|
||||
extern void bgp_info_unset_flag(struct bgp_node *rn, struct bgp_path_info *path,
|
||||
uint32_t flag);
|
||||
extern void bgp_info_path_with_addpath_rx_str(struct bgp_path_info *ri,
|
||||
char *buf);
|
||||
bgp_path_info_extra_get(struct bgp_path_info *path);
|
||||
extern void bgp_path_info_set_flag(struct bgp_node *rn,
|
||||
struct bgp_path_info *path, uint32_t flag);
|
||||
extern void bgp_path_info_unset_flag(struct bgp_node *rn,
|
||||
struct bgp_path_info *path, uint32_t flag);
|
||||
extern void bgp_path_info_path_with_addpath_rx_str(struct bgp_path_info *ri,
|
||||
char *buf);
|
||||
|
||||
extern int bgp_nlri_parse_ip(struct peer *, struct attr *, struct bgp_nlri *);
|
||||
|
||||
|
@ -472,12 +472,14 @@ extern void bgp_process_queues_drain_immediate(void);
|
|||
extern struct bgp_node *bgp_afi_node_lookup(struct bgp_table *table, afi_t afi,
|
||||
safi_t safi, struct prefix *p,
|
||||
struct prefix_rd *prd);
|
||||
extern struct bgp_path_info *bgp_info_new(void);
|
||||
extern void bgp_info_restore(struct bgp_node *rn, struct bgp_path_info *path);
|
||||
extern struct bgp_path_info *bgp_path_info_new(void);
|
||||
extern void bgp_path_info_restore(struct bgp_node *rn,
|
||||
struct bgp_path_info *path);
|
||||
|
||||
extern int bgp_info_cmp_compatible(struct bgp *bgp, struct bgp_path_info *new,
|
||||
struct bgp_path_info *exist, char *pfx_buf,
|
||||
afi_t afi, safi_t safi);
|
||||
extern int bgp_path_info_cmp_compatible(struct bgp *bgp,
|
||||
struct bgp_path_info *new,
|
||||
struct bgp_path_info *exist,
|
||||
char *pfx_buf, afi_t afi, safi_t safi);
|
||||
extern void bgp_attr_add_gshut_community(struct attr *attr);
|
||||
|
||||
extern void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
|
||||
|
|
|
@ -233,7 +233,7 @@ struct bgp_match_peer_compiled {
|
|||
/* 'match peer (A.B.C.D|X:X::X:X|WORD)' */
|
||||
|
||||
/* Compares the peer specified in the 'match peer' clause with the peer
|
||||
received in bgp_info->peer. If it is the same, or if the peer structure
|
||||
received in bgp_path_info->peer. If it is the same, or if the peer structure
|
||||
received is a peer_group containing it, returns RMAP_MATCH. */
|
||||
static route_map_result_t route_match_peer(void *rule,
|
||||
const struct prefix *prefix,
|
||||
|
@ -354,7 +354,7 @@ static route_map_result_t route_match_command(void *rule,
|
|||
|
||||
zlog_debug("Set up prefix table");
|
||||
/*
|
||||
* Setup the bgp_info information
|
||||
* Setup the bgp_path_info information
|
||||
*/
|
||||
lua_newtable(L);
|
||||
lua_pushinteger(L, info->attr->med);
|
||||
|
|
|
@ -454,7 +454,7 @@ void bgp_adj_out_set_subgroup(struct bgp_node *rn,
|
|||
adv->rn = rn;
|
||||
assert(adv->binfo == NULL);
|
||||
/* bgp_path_info adj_out reference */
|
||||
adv->binfo = bgp_info_lock(binfo);
|
||||
adv->binfo = bgp_path_info_lock(binfo);
|
||||
|
||||
if (attr)
|
||||
adv->baa = bgp_advertise_intern(subgrp->hash, attr);
|
||||
|
|
|
@ -925,8 +925,8 @@ bool bgp_zebra_nexthop_set(union sockunion *local, union sockunion *remote,
|
|||
return true;
|
||||
}
|
||||
|
||||
static struct in6_addr *bgp_info_to_ipv6_nexthop(struct bgp_path_info *info,
|
||||
ifindex_t *ifindex)
|
||||
static struct in6_addr *
|
||||
bgp_path_info_to_ipv6_nexthop(struct bgp_path_info *info, ifindex_t *ifindex)
|
||||
{
|
||||
struct in6_addr *nexthop = NULL;
|
||||
|
||||
|
@ -994,7 +994,7 @@ static int bgp_table_map_apply(struct route_map *map, struct prefix *p,
|
|||
ifindex_t ifindex;
|
||||
struct in6_addr *nexthop;
|
||||
|
||||
nexthop = bgp_info_to_ipv6_nexthop(info, &ifindex);
|
||||
nexthop = bgp_path_info_to_ipv6_nexthop(info, &ifindex);
|
||||
zlog_debug(
|
||||
"Zebra rmap deny: IPv6 route %s/%d nexthop %s",
|
||||
inet_ntop(AF_INET6, &p->u.prefix6, buf[0],
|
||||
|
@ -1265,7 +1265,7 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
|
|||
|
||||
/* Metric is currently based on the best-path only */
|
||||
metric = info->attr->med;
|
||||
for (mpinfo = info; mpinfo; mpinfo = bgp_info_mpath_next(mpinfo)) {
|
||||
for (mpinfo = info; mpinfo; mpinfo = bgp_path_info_mpath_next(mpinfo)) {
|
||||
if (valid_nh_count >= multipath_num)
|
||||
break;
|
||||
|
||||
|
@ -1355,8 +1355,8 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
|
|||
tag = mpinfo_cp->attr->tag;
|
||||
}
|
||||
}
|
||||
nexthop = bgp_info_to_ipv6_nexthop(mpinfo_cp,
|
||||
&ifindex);
|
||||
nexthop = bgp_path_info_to_ipv6_nexthop(mpinfo_cp,
|
||||
&ifindex);
|
||||
nh_updated = update_ipv6nh_for_route_install(
|
||||
nh_othervrf, nexthop, ifindex,
|
||||
mpinfo, info, is_evpn, api_nh);
|
||||
|
@ -1702,8 +1702,8 @@ int bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red,
|
|||
ri->attr = bgp_attr_intern(&new_attr);
|
||||
bgp_attr_unintern(&old_attr);
|
||||
|
||||
bgp_info_set_flag(rn, ri,
|
||||
BGP_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(rn, ri,
|
||||
BGP_PATH_ATTR_CHANGED);
|
||||
bgp_process(bgp, rn, afi, SAFI_UNICAST);
|
||||
}
|
||||
}
|
||||
|
@ -2090,7 +2090,7 @@ static int ipset_entry_notify_owner(int command, struct zclient *zclient,
|
|||
__PRETTY_FUNCTION__);
|
||||
/* link bgp_info to bpme */
|
||||
bgp_info = (struct bgp_path_info *)bgp_pbime->bgp_info;
|
||||
extra = bgp_info_extra_get(bgp_info);
|
||||
extra = bgp_path_info_extra_get(bgp_info);
|
||||
if (extra->bgp_fs_pbr == NULL)
|
||||
extra->bgp_fs_pbr = list_new();
|
||||
listnode_add(extra->bgp_fs_pbr, bgp_pbime);
|
||||
|
|
|
@ -488,7 +488,7 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
|
|||
}
|
||||
|
||||
bgp_aggregate_decrement(bgp, p, bi, afi, safi);
|
||||
bgp_info_delete(bn, bi);
|
||||
bgp_path_info_delete(bn, bi);
|
||||
bgp_process(bgp, bn, afi, safi);
|
||||
} else {
|
||||
vnc_zlog_debug_verbose(
|
||||
|
@ -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_PATH_ATTR_CHANGED);
|
||||
bgp_path_info_set_flag(bn, bi, BGP_PATH_ATTR_CHANGED);
|
||||
|
||||
if (safi == SAFI_MPLS_VPN) {
|
||||
struct bgp_node *prn = NULL;
|
||||
|
@ -1029,7 +1029,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
|
|||
|
||||
/* Rewrite BGP route information. */
|
||||
if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
|
||||
bgp_info_restore(bn, bi);
|
||||
bgp_path_info_restore(bn, bi);
|
||||
else
|
||||
bgp_aggregate_decrement(bgp, p, bi, afi, safi);
|
||||
bgp_attr_unintern(&bi->attr);
|
||||
|
@ -1066,7 +1066,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
|
|||
}
|
||||
|
||||
|
||||
new = bgp_info_new();
|
||||
new = bgp_path_info_new();
|
||||
new->type = type;
|
||||
new->sub_type = sub_type;
|
||||
new->peer = rfd->peer;
|
||||
|
@ -1075,7 +1075,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
|
|||
new->uptime = bgp_clock();
|
||||
|
||||
/* save backref to rfapi handle */
|
||||
assert(bgp_info_extra_get(new));
|
||||
assert(bgp_path_info_extra_get(new));
|
||||
new->extra->vnc.export.rfapi_handle = (void *)rfd;
|
||||
encode_label(label_val, &new->extra->label[0]);
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
|
|||
}
|
||||
|
||||
bgp_aggregate_increment(bgp, p, new, afi, safi);
|
||||
bgp_info_add(bn, new);
|
||||
bgp_path_info_add(bn, new);
|
||||
|
||||
if (safi == SAFI_MPLS_VPN) {
|
||||
struct bgp_node *prn = NULL;
|
||||
|
|
|
@ -509,14 +509,14 @@ static struct bgp_path_info *rfapiBgpInfoCreate(struct attr *attr,
|
|||
{
|
||||
struct bgp_path_info *new;
|
||||
|
||||
new = bgp_info_new();
|
||||
new = bgp_path_info_new();
|
||||
assert(new);
|
||||
|
||||
if (attr) {
|
||||
if (!new->attr)
|
||||
new->attr = bgp_attr_intern(attr);
|
||||
}
|
||||
bgp_info_extra_get(new);
|
||||
bgp_path_info_extra_get(new);
|
||||
if (prd) {
|
||||
new->extra->vnc.import.rd = *prd;
|
||||
rfapi_time(&new->extra->vnc.import.create_time);
|
||||
|
@ -2021,8 +2021,8 @@ static void rfapiBgpInfoAttachSorted(struct agg_node *rn,
|
|||
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)
|
||||
|| bgp_path_info_cmp_compatible(bgp, info_new, next,
|
||||
pfx_buf, afi, safi)
|
||||
== -1) { /* -1 if 1st is better */
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -660,7 +660,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
|
|||
pb->ubi = info;
|
||||
pb->upfx = *prefix;
|
||||
|
||||
bgp_info_lock(info); /* skiplist refers to it */
|
||||
bgp_path_info_lock(info); /* skiplist refers to it */
|
||||
skiplist_insert(bgp->rfapi->resolve_nve_nexthop, &pb->hpfx, pb);
|
||||
|
||||
/*
|
||||
|
@ -1354,7 +1354,7 @@ vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp, afi_t afi,
|
|||
while (!rc) {
|
||||
if (pb->ubi == info) {
|
||||
skiplist_delete(sl, &pfx_unicast_nexthop, pb);
|
||||
bgp_info_unlock(info);
|
||||
bgp_path_info_unlock(info);
|
||||
break;
|
||||
}
|
||||
rc = skiplist_next_value(sl, &pfx_unicast_nexthop, (void *)&pb,
|
||||
|
@ -1829,7 +1829,7 @@ static void vnc_import_bgp_exterior_add_route_it(
|
|||
RFAPI_MONITOR_EXTERIOR(rn)->source,
|
||||
info, pfx_mon)) {
|
||||
|
||||
bgp_info_lock(info);
|
||||
bgp_path_info_lock(info);
|
||||
}
|
||||
}
|
||||
par = agg_node_parent(rn);
|
||||
|
@ -1847,7 +1847,7 @@ static void vnc_import_bgp_exterior_add_route_it(
|
|||
if (!skiplist_insert(it->monitor_exterior_orphans, info,
|
||||
pfx_mon)) {
|
||||
|
||||
bgp_info_lock(info);
|
||||
bgp_path_info_lock(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1986,7 +1986,8 @@ void vnc_import_bgp_exterior_del_route(
|
|||
->source,
|
||||
info, NULL)) {
|
||||
|
||||
bgp_info_unlock(info);
|
||||
bgp_path_info_unlock(
|
||||
info);
|
||||
agg_unlock_node(
|
||||
rn); /* sl entry
|
||||
*/
|
||||
|
@ -2023,7 +2024,7 @@ void vnc_import_bgp_exterior_del_route(
|
|||
if (!skiplist_delete(it->monitor_exterior_orphans, info,
|
||||
NULL)) {
|
||||
|
||||
bgp_info_unlock(info);
|
||||
bgp_path_info_unlock(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2949,7 +2950,7 @@ void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi)
|
|||
(void *)&pb)) {
|
||||
info = pb->ubi;
|
||||
skiplist_delete_first(bgp->rfapi->resolve_nve_nexthop);
|
||||
bgp_info_unlock(info);
|
||||
bgp_path_info_unlock(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue