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);
}
/* 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);
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;
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)) {
/* 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);
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);
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;
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;
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);
}
/* 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. */
}
/* 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)
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);
}
/* 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;
}
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);
}
/* 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;
}
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)
/* 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);
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;
/* 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);
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]);
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)
/* 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 =
/* 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);
/* Mark route for delete. */
if (tmp_ri)
- bgp_info_delete(rn, tmp_ri);
+ bgp_path_info_delete(rn, tmp_ri);
}
*/
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;
}
*/
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;
/* Route entry in local table gets deleted immediately. */
if (ri)
- bgp_info_reap(rn, ri);
+ bgp_path_info_reap(rn, ri);
}
return 0;
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);
}
}
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);
}
}
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)) {
/* 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))
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)) {
/* 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 &&
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)) {
/* 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))
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);
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);
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);
}
/* 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.
*/
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;
/*
- * 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;
}
/*
- * 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
* 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;
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)
{
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;
}
/*
}
/*
- * 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,
}
/*
- * 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)
}
/*
- * 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;
}
/*
- * 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;
}
/*
- * 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)
}
/*
- * 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;
}
/*
- * 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;
}
/*
- * 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;
}
/*
- * 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;
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)
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)
*/
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",
} 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",
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
* 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,
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",
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);
}
}
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
* 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;
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;
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);
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);
#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 {
/* 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 */
/* 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 */
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) {
}
/*
- * 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 */
}
/* 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);
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;
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);
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);
__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);
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);
__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);
}
}
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);
/* 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);
}
}
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)
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);
}
/* 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;
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;
/* 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)) {
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,
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;
*/
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;
}
*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--;
zlog_debug ("%s: unlocked and freeing", __func__);
zlog_backtrace (LOG_DEBUG);
#endif
- bgp_info_free(binfo);
+ bgp_path_info_free(binfo);
return NULL;
}
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;
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;
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);
}
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);
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);
}
}
-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,
/* 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;
}
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)
}
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);
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) {
* 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;
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)
/* 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))
|| 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(
*/
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__,
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;
}
}
*/
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(
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)
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",
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)
}
}
- 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;
/*
* 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;
}
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);
}
/* 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;
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);
}
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)
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(
/* 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);
}
}
peer->host, pfx_buf);
}
- bgp_info_restore(rn, ri);
+ bgp_path_info_restore(rn, ri);
}
/* Received Logging. */
/* 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.
/* 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;
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];
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) {
/* 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))
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];
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;
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);
&& 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. */
continue;
if (force)
- bgp_info_reap(rn, ri);
+ bgp_path_info_reap(rn, ri);
else {
struct bgp_clear_node_queue *cnq;
if (bgp_fibupd_safi(safi))
bgp_zebra_withdraw(&rn->p, ri,
bgp, safi);
- bgp_info_reap(rn, ri);
+ bgp_path_info_reap(rn, ri);
}
}
}
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
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];
"%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
* 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);
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];
"%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
*/
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);
}
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);
}
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);
}
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);
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;
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);
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);
}
}
* 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,
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)
/* 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);
}
}
* 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++;
}
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;
ri->extra->suppress--;
if (ri->extra->suppress == 0) {
- bgp_info_set_flag(
+ bgp_path_info_set_flag(
rn, ri, BGP_PATH_ATTR_CHANGED);
match++;
}
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);
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);
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);
}
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);
}
}
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)
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");
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 *);
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 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 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_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,
/* '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,
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);
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);
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;
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],
/* 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;
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);
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);
}
}
__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);
}
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(
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;
/* 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);
}
- new = bgp_info_new();
+ new = bgp_path_info_new();
new->type = type;
new->sub_type = sub_type;
new->peer = rfd->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]);
}
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;
{
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);
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;
}
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);
/*
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,
RFAPI_MONITOR_EXTERIOR(rn)->source,
info, pfx_mon)) {
- bgp_info_lock(info);
+ bgp_path_info_lock(info);
}
}
par = agg_node_parent(rn);
if (!skiplist_insert(it->monitor_exterior_orphans, info,
pfx_mon)) {
- bgp_info_lock(info);
+ bgp_path_info_lock(info);
}
}
}
->source,
info, NULL)) {
- bgp_info_unlock(info);
+ bgp_path_info_unlock(
+ info);
agg_unlock_node(
rn); /* sl entry
*/
if (!skiplist_delete(it->monitor_exterior_orphans, info,
NULL)) {
- bgp_info_unlock(info);
+ bgp_path_info_unlock(info);
}
}
}
(void *)&pb)) {
info = pb->ubi;
skiplist_delete_first(bgp->rfapi->resolve_nve_nexthop);
- bgp_info_unlock(info);
+ bgp_path_info_unlock(info);
}
}