static struct bgp_path_info *
bgp_dump_route_node_record(int afi, struct bgp_node *rn,
- struct bgp_path_info *info, unsigned int seq)
+ struct bgp_path_info *path, unsigned int seq)
{
struct stream *obuf;
size_t sizep;
stream_putw(obuf, 0);
endp = stream_get_endp(obuf);
- for (; info; info = info->next) {
+ for (; path; path = path->next) {
size_t cur_endp;
/* Peer index */
- stream_putw(obuf, info->peer->table_dump_index);
+ stream_putw(obuf, path->peer->table_dump_index);
/* Originated */
- stream_putl(obuf, time(NULL) - (bgp_clock() - info->uptime));
+ stream_putl(obuf, time(NULL) - (bgp_clock() - path->uptime));
/* Dump attribute. */
/* Skip prefix & AFI/SAFI for MP_NLRI */
- bgp_dump_routes_attr(obuf, info->attr, &rn->p);
+ bgp_dump_routes_attr(obuf, path->attr, &rn->p);
cur_endp = stream_get_endp(obuf);
if (cur_endp > BGP_MAX_PACKET_SIZE + BGP_DUMP_MSG_HEADER
bgp_dump_set_size(obuf, MSG_TABLE_DUMP_V2);
fwrite(STREAM_DATA(obuf), stream_get_endp(obuf), 1, bgp_dump_routes.fp);
- return info;
+ return path;
}
static unsigned int bgp_dump_routes_func(int afi, int first_run,
unsigned int seq)
{
- struct bgp_path_info *info;
+ struct bgp_path_info *path;
struct bgp_node *rn;
struct bgp *bgp;
struct bgp_table *table;
table = bgp->rib[afi][SAFI_UNICAST];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- info = rn->info;
- while (info) {
- info = bgp_dump_route_node_record(afi, rn, info, seq);
+ path = rn->info;
+ while (path) {
+ path = bgp_dump_route_node_record(afi, rn, path, seq);
seq++;
}
}
*/
static void delete_evpn_route_entry(struct bgp *bgp, afi_t afi, safi_t safi,
struct bgp_node *rn,
- struct bgp_path_info **ri);
+ struct bgp_path_info **pi);
static int delete_all_vni_routes(struct bgp *bgp, struct bgpevpn *vpn);
/*
struct bgp_path_info *old_local)
{
struct bgp_node *global_rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
(struct prefix *)&rn->p, &vpn->prd);
if (global_rn) {
/* Delete route entry in the global EVPN table. */
- delete_evpn_route_entry(bgp, afi, safi, global_rn, &ri);
+ delete_evpn_route_entry(bgp, afi, safi, global_rn, &pi);
/* Schedule for processing - withdraws to peers happen from
* this table.
*/
- if (ri)
+ if (pi)
bgp_process(bgp, global_rn, afi, safi);
bgp_unlock_node(global_rn);
}
*/
static int evpn_route_is_def_gw(struct bgp *bgp, struct bgp_node *rn)
{
- struct bgp_path_info *tmp_ri = NULL;
- struct bgp_path_info *local_ri = NULL;
+ struct bgp_path_info *tmp_pi = NULL;
+ struct bgp_path_info *local_pi = NULL;
- local_ri = NULL;
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
- local_ri = tmp_ri;
+ local_pi = NULL;
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
+ local_pi = tmp_pi;
}
- if (!local_ri)
+ if (!local_pi)
return 0;
- return local_ri->attr->default_gw;
+ return local_pi->attr->default_gw;
}
*/
static int evpn_route_is_sticky(struct bgp *bgp, struct bgp_node *rn)
{
- struct bgp_path_info *tmp_ri;
- struct bgp_path_info *local_ri;
+ struct bgp_path_info *tmp_pi;
+ struct bgp_path_info *local_pi;
- local_ri = NULL;
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
- local_ri = tmp_ri;
+ local_pi = NULL;
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
+ local_pi = tmp_pi;
}
- if (!local_ri)
+ if (!local_pi)
return 0;
- return local_ri->attr->sticky;
+ return local_pi->attr->sticky;
}
/*
{
char buf[ESI_STR_LEN];
char buf1[INET6_ADDRSTRLEN];
- struct bgp_path_info *tmp_ri = NULL;
- struct bgp_path_info *local_ri = NULL; /* local route entry if any */
- struct bgp_path_info *remote_ri = NULL; /* remote route entry if any */
+ struct bgp_path_info *tmp_pi = NULL;
+ struct bgp_path_info *local_pi = NULL; /* local route entry if any */
+ struct bgp_path_info *remote_pi = NULL; /* remote route entry if any */
struct attr *attr_new = NULL;
struct prefix_evpn *evp = NULL;
evp = (struct prefix_evpn *)&rn->p;
/* locate the local and remote entries if any */
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp->peer_self &&
- tmp_ri->type == ZEBRA_ROUTE_BGP &&
- tmp_ri->sub_type == BGP_ROUTE_STATIC)
- local_ri = tmp_ri;
- if (tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_IMPORTED
- && CHECK_FLAG(tmp_ri->flags, BGP_PATH_VALID))
- remote_ri = tmp_ri;
- }
-
- /* we don't expect to see a remote_ri at this point.
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
+ local_pi = tmp_pi;
+ if (tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_IMPORTED
+ && CHECK_FLAG(tmp_pi->flags, BGP_PATH_VALID))
+ remote_pi = tmp_pi;
+ }
+
+ /* we don't expect to see a remote_pi at this point.
* An ES route has esi + vtep_ip as the key,
* We shouldn't see the same route from any other vtep.
*/
- if (remote_ri) {
+ if (remote_pi) {
flog_err(
EC_BGP_ES_INVALID,
"%u ERROR: local es route for ESI: %s Vtep %s also learnt from remote",
return -1;
}
- if (!local_ri && !add)
+ if (!local_pi && !add)
return 0;
/* create or update the entry */
- if (!local_ri) {
+ if (!local_pi) {
/* Add or update attribute to hash */
attr_new = bgp_attr_intern(attr);
/* Create new route with its attribute. */
- tmp_ri = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC,
- 0, bgp->peer_self, attr_new, rn);
- SET_FLAG(tmp_ri->flags, BGP_PATH_VALID);
+ tmp_pi = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
+ bgp->peer_self, attr_new, rn);
+ SET_FLAG(tmp_pi->flags, BGP_PATH_VALID);
/* add the newly created path to the route-node */
- bgp_path_info_add(rn, tmp_ri);
+ bgp_path_info_add(rn, tmp_pi);
} else {
- tmp_ri = local_ri;
- if (attrhash_cmp(tmp_ri->attr, attr)
- && !CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED))
+ tmp_pi = local_pi;
+ if (attrhash_cmp(tmp_pi->attr, attr)
+ && !CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
*route_changed = 0;
else {
/* The attribute has changed.
* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(attr);
- bgp_path_info_set_flag(rn, tmp_ri,
+ bgp_path_info_set_flag(rn, tmp_pi,
BGP_PATH_ATTR_CHANGED);
/* Restore route, if needed. */
- if (CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(rn, tmp_ri);
+ if (CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, tmp_pi);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&tmp_ri->attr);
- tmp_ri->attr = attr_new;
- tmp_ri->uptime = bgp_clock();
+ bgp_attr_unintern(&tmp_pi->attr);
+ tmp_pi->attr = attr_new;
+ tmp_pi->uptime = bgp_clock();
}
}
/* Return back the route entry. */
- *ri = tmp_ri;
+ *ri = tmp_pi;
return 0;
}
struct attr attr;
struct attr *attr_new = NULL;
struct bgp_node *rn = NULL;
- struct bgp_path_info *ri = NULL;
+ struct bgp_path_info *pi = NULL;
memset(&attr, 0, sizeof(struct attr));
rn = bgp_node_get(es->route_table, (struct prefix *)p);
/* Create or update route entry. */
- ret = update_evpn_type4_route_entry(bgp, es, afi, safi, rn,
- &attr, 1, &ri,
- &route_changed);
+ ret = update_evpn_type4_route_entry(bgp, es, afi, safi, rn, &attr, 1,
+ &pi, &route_changed);
if (ret != 0) {
flog_err(EC_BGP_ES_INVALID,
"%u ERROR: Failed to updated ES route ESI: %s VTEP %s",
ipaddr2str(&es->originator_ip, buf1, sizeof(buf1)));
}
- assert(ri);
- attr_new = ri->attr;
+ assert(pi);
+ attr_new = pi->attr;
/* Perform route selection;
* this is just to set the flags correctly
* Prefix-level) similar to L3VPN routes.
*/
if (route_changed) {
- struct bgp_path_info *global_ri;
+ struct bgp_path_info *global_pi;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
(struct prefix *)p, &es->prd);
- update_evpn_type4_route_entry(bgp, es, afi, safi,
- rn, attr_new,
- 1, &global_ri,
- &route_changed);
+ update_evpn_type4_route_entry(bgp, es, afi, safi, rn, attr_new,
+ 1, &global_pi, &route_changed);
/* Schedule for processing and unlock node. */
bgp_process(bgp, rn, afi, safi);
struct attr *attr, int *route_changed)
{
struct attr *attr_new = NULL;
- struct bgp_path_info *ri = NULL;
+ struct bgp_path_info *pi = NULL;
mpls_label_t label = MPLS_INVALID_LABEL;
- struct bgp_path_info *local_ri = NULL;
- struct bgp_path_info *tmp_ri = NULL;
+ struct bgp_path_info *local_pi = NULL;
+ struct bgp_path_info *tmp_pi = NULL;
*route_changed = 0;
/* locate the local route entry if any */
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp_def->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
- local_ri = tmp_ri;
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp_def->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
+ local_pi = tmp_pi;
}
/*
* create a new route entry if one doesnt exist.
* Otherwise see if route attr has changed
*/
- if (!local_ri) {
+ if (!local_pi) {
/* route has changed as this is the first entry */
*route_changed = 1;
attr_new = bgp_attr_intern(attr);
/* create the route info from attribute */
- ri = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
+ pi = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
bgp_def->peer_self, attr_new, rn);
- SET_FLAG(ri->flags, BGP_PATH_VALID);
+ SET_FLAG(pi->flags, BGP_PATH_VALID);
/* Type-5 routes advertise the L3-VNI */
- bgp_path_info_extra_get(ri);
+ bgp_path_info_extra_get(pi);
vni2label(bgp_vrf->l3vni, &label);
- memcpy(&ri->extra->label, &label, sizeof(label));
- ri->extra->num_labels = 1;
+ memcpy(&pi->extra->label, &label, sizeof(label));
+ pi->extra->num_labels = 1;
/* add the route entry to route node*/
- bgp_path_info_add(rn, ri);
+ bgp_path_info_add(rn, pi);
} else {
- tmp_ri = local_ri;
- if (!attrhash_cmp(tmp_ri->attr, attr)) {
+ tmp_pi = local_pi;
+ if (!attrhash_cmp(tmp_pi->attr, attr)) {
/* attribute changed */
*route_changed = 1;
/* The attribute has changed. */
/* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(attr);
- bgp_path_info_set_flag(rn, tmp_ri,
+ bgp_path_info_set_flag(rn, tmp_pi,
BGP_PATH_ATTR_CHANGED);
/* Restore route, if needed. */
- if (CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(rn, tmp_ri);
+ if (CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, tmp_pi);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&tmp_ri->attr);
- tmp_ri->attr = attr_new;
- tmp_ri->uptime = bgp_clock();
+ bgp_attr_unintern(&tmp_pi->attr);
+ tmp_pi->attr = attr_new;
+ tmp_pi->uptime = bgp_clock();
}
}
return 0;
static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
afi_t afi, safi_t safi, struct bgp_node *rn,
struct attr *attr, int add,
- struct bgp_path_info **ri, uint8_t flags,
+ struct bgp_path_info **pi, uint8_t flags,
uint32_t seq)
{
- struct bgp_path_info *tmp_ri;
- struct bgp_path_info *local_ri;
+ struct bgp_path_info *tmp_pi;
+ struct bgp_path_info *local_pi;
struct attr *attr_new;
mpls_label_t label[BGP_MAX_LABELS];
uint32_t num_labels = 1;
uint8_t sticky = 0;
struct prefix_evpn *evp;
- *ri = NULL;
+ *pi = NULL;
evp = (struct prefix_evpn *)&rn->p;
memset(&label, 0, sizeof(label));
/* See if this is an update of an existing route, or a new add. */
- local_ri = NULL;
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
- local_ri = tmp_ri;
+ local_pi = NULL;
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
+ local_pi = tmp_pi;
}
/* If route doesn't exist already, create a new one, if told to.
* Otherwise act based on whether the attributes of the route have
* changed or not.
*/
- if (!local_ri && !add)
+ if (!local_pi && !add)
return 0;
/* For non-GW MACs, update MAC mobility seq number, if needed. */
if (seq && !CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW))
add_mac_mobility_to_attr(seq, attr);
- if (!local_ri) {
+ if (!local_pi) {
/* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(attr);
attr_new->sticky = sticky;
/* Create new route with its attribute. */
- tmp_ri = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
+ tmp_pi = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
bgp->peer_self, attr_new, rn);
- SET_FLAG(tmp_ri->flags, BGP_PATH_VALID);
- bgp_path_info_extra_get(tmp_ri);
+ SET_FLAG(tmp_pi->flags, BGP_PATH_VALID);
+ bgp_path_info_extra_get(tmp_pi);
/* 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_path_info_add(rn, tmp_ri);
+ memcpy(&tmp_pi->extra->label, label, sizeof(label));
+ tmp_pi->extra->num_labels = num_labels;
+ bgp_path_info_add(rn, tmp_pi);
} else {
- tmp_ri = local_ri;
- if (attrhash_cmp(tmp_ri->attr, attr)
- && !CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED))
+ tmp_pi = local_pi;
+ if (attrhash_cmp(tmp_pi->attr, attr)
+ && !CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
route_change = 0;
else {
/*
num_labels++;
}
}
- memcpy(&tmp_ri->extra->label, label, sizeof(label));
- tmp_ri->extra->num_labels = num_labels;
+ memcpy(&tmp_pi->extra->label, label, sizeof(label));
+ tmp_pi->extra->num_labels = num_labels;
/* The attribute has changed. */
/* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(attr);
- bgp_path_info_set_flag(rn, tmp_ri,
+ bgp_path_info_set_flag(rn, tmp_pi,
BGP_PATH_ATTR_CHANGED);
/* Extract MAC mobility sequence number, if any. */
attr_new->sticky = sticky;
/* Restore route, if needed. */
- if (CHECK_FLAG(tmp_ri->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(rn, tmp_ri);
+ if (CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, tmp_pi);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&tmp_ri->attr);
- tmp_ri->attr = attr_new;
- tmp_ri->uptime = bgp_clock();
+ bgp_attr_unintern(&tmp_pi->attr);
+ tmp_pi->attr = attr_new;
+ tmp_pi->uptime = bgp_clock();
}
}
/* Return back the route entry. */
- *ri = tmp_ri;
+ *pi = tmp_pi;
return route_change;
}
struct attr attr;
struct attr *attr_new;
int add_l3_ecomm = 0;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
int route_change;
/* Create or update route entry. */
route_change = update_evpn_route_entry(bgp, vpn, afi, safi, rn, &attr,
- 1, &ri, flags, seq);
- assert(ri);
- attr_new = ri->attr;
+ 1, &pi, flags, seq);
+ assert(pi);
+ attr_new = pi->attr;
/* Perform route selection; this is just to set the flags correctly
* as local route in the VNI always wins.
* Prefix-level) similar to L3VPN routes.
*/
if (route_change) {
- struct bgp_path_info *global_ri;
+ struct bgp_path_info *global_pi;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
(struct prefix *)p, &vpn->prd);
update_evpn_route_entry(bgp, vpn, afi, safi, rn, attr_new, 1,
- &global_ri, flags, seq);
+ &global_pi, flags, seq);
/* Schedule for processing and unlock node. */
bgp_process(bgp, rn, afi, safi);
*/
static void delete_evpn_route_entry(struct bgp *bgp, afi_t afi, safi_t safi,
struct bgp_node *rn,
- struct bgp_path_info **ri)
+ struct bgp_path_info **pi)
{
- struct bgp_path_info *tmp_ri;
+ struct bgp_path_info *tmp_pi;
- *ri = NULL;
+ *pi = NULL;
/* Now, find matching route. */
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next)
- if (tmp_ri->peer == bgp->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next)
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
break;
- *ri = tmp_ri;
+ *pi = tmp_pi;
/* Mark route for delete. */
- if (tmp_ri)
- bgp_path_info_delete(rn, tmp_ri);
+ if (tmp_pi)
+ bgp_path_info_delete(rn, tmp_pi);
}
{
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_node *rn = NULL; /* rn in esi table */
struct bgp_node *global_rn = NULL; /* rn in global table */
if (global_rn) {
/* Delete route entry in the global EVPN table. */
- delete_evpn_route_entry(bgp, afi, safi,
- global_rn, &ri);
+ delete_evpn_route_entry(bgp, afi, safi, global_rn, &pi);
/* Schedule for processing - withdraws to peers happen from
* this table.
*/
- if (ri)
+ if (pi)
bgp_process(bgp, global_rn, afi, safi);
bgp_unlock_node(global_rn);
}
* Delete route entry in the ESI route table.
* This can just be removed.
*/
- delete_evpn_route_entry(bgp, afi, safi, rn, &ri);
- if (ri)
- bgp_path_info_reap(rn, ri);
+ delete_evpn_route_entry(bgp, afi, safi, rn, &pi);
+ if (pi)
+ bgp_path_info_reap(rn, pi);
bgp_unlock_node(rn);
return 0;
}
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
struct bgp_node *rn = NULL;
- struct bgp_path_info *ri = NULL;
+ struct bgp_path_info *pi = NULL;
struct bgp *bgp_def = NULL; /* default bgp instance */
bgp_def = bgp_get_default();
if (!rn)
return 0;
- delete_evpn_route_entry(bgp_def, afi, safi, rn, &ri);
- if (ri)
+ delete_evpn_route_entry(bgp_def, afi, safi, rn, &pi);
+ if (pi)
bgp_process(bgp_def, rn, afi, safi);
bgp_unlock_node(rn);
return 0;
struct prefix_evpn *p)
{
struct bgp_node *rn, *global_rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
(struct prefix *)p, &vpn->prd);
if (global_rn) {
/* Delete route entry in the global EVPN table. */
- delete_evpn_route_entry(bgp, afi, safi, global_rn, &ri);
+ delete_evpn_route_entry(bgp, afi, safi, global_rn, &pi);
/* Schedule for processing - withdraws to peers happen from
* this table.
*/
- if (ri)
+ if (pi)
bgp_process(bgp, global_rn, afi, safi);
bgp_unlock_node(global_rn);
}
/* Delete route entry in the VNI route table. This can just be removed.
*/
- delete_evpn_route_entry(bgp, afi, safi, rn, &ri);
- if (ri)
- bgp_path_info_reap(rn, ri);
+ delete_evpn_route_entry(bgp, afi, safi, rn, &pi);
+ if (pi)
+ bgp_path_info_reap(rn, pi);
bgp_unlock_node(rn);
return 0;
afi_t afi;
safi_t safi;
struct bgp_node *rn;
- struct bgp_path_info *ri, *tmp_ri;
+ struct bgp_path_info *pi, *tmp_pi;
struct attr attr;
struct attr *attr_new;
uint32_t seq;
rn = bgp_route_next(rn)) {
struct prefix_evpn *evp = (struct prefix_evpn *)&rn->p;
struct bgp_node *rd_rn;
- struct bgp_path_info *global_ri;
+ struct bgp_path_info *global_pi;
if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
continue;
/* Identify local route. */
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
break;
}
- if (!tmp_ri)
+ if (!tmp_pi)
continue;
/*
/* Set up extended community. */
build_evpn_route_extcomm(vpn, &attr, add_l3_ecomm);
- seq = mac_mobility_seqnum(tmp_ri->attr);
+ seq = mac_mobility_seqnum(tmp_pi->attr);
/* Update the route entry. */
- update_evpn_route_entry(bgp, vpn, afi, safi, rn,
- &attr, 0, &ri, 0, seq);
+ update_evpn_route_entry(bgp, vpn, afi, safi, rn, &attr, 0, &pi,
+ 0, seq);
/* Perform route selection; this is just to set the flags
* correctly as local route in the VNI always wins.
*/
evpn_route_select_install(bgp, vpn, rn);
- attr_new = ri->attr;
+ attr_new = pi->attr;
/* Update route in global routing table. */
rd_rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
(struct prefix *)evp, &vpn->prd);
assert(rd_rn);
update_evpn_route_entry(bgp, vpn, afi, safi, rd_rn, attr_new, 0,
- &global_ri, 0,
+ &global_pi, 0,
mac_mobility_seqnum(attr_new));
/* Schedule for processing and unlock node. */
safi_t safi;
struct bgp_node *rdrn, *rn;
struct bgp_table *table;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
afi = AFI_L2VPN;
safi = SAFI_EVPN;
if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
continue;
- delete_evpn_route_entry(bgp, afi, safi, rn, &ri);
- if (ri)
+ delete_evpn_route_entry(bgp, afi, safi, rn, &pi);
+ if (pi)
bgp_process(bgp, rn, afi, safi);
}
}
afi_t afi;
safi_t safi;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
afi = AFI_L2VPN;
safi = SAFI_EVPN;
if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
continue;
- delete_evpn_route_entry(bgp, afi, safi, rn, &ri);
+ delete_evpn_route_entry(bgp, afi, safi, rn, &pi);
/* Route entry in local table gets deleted immediately. */
- if (ri)
- bgp_path_info_reap(rn, ri);
+ if (pi)
+ bgp_path_info_reap(rn, pi);
}
return 0;
static int delete_all_es_routes(struct bgp *bgp, struct evpnes *es)
{
struct bgp_node *rn;
- struct bgp_path_info *ri, *nextri;
+ struct bgp_path_info *pi, *nextpi;
/* Walk this ES's route table and delete all routes. */
for (rn = bgp_table_top(es->route_table); rn;
rn = bgp_route_next(rn)) {
- for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1);
- ri = nextri) {
- bgp_path_info_delete(rn, ri);
- bgp_path_info_reap(rn, ri);
+ for (pi = rn->info; (pi != NULL) && (nextpi = pi->next, 1);
+ pi = nextpi) {
+ bgp_path_info_delete(rn, pi);
+ bgp_path_info_reap(rn, pi);
}
}
static int delete_all_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
{
struct bgp_node *rn;
- struct bgp_path_info *ri, *nextri;
+ struct bgp_path_info *pi, *nextpi;
/* Walk this VNI's route table and delete all routes. */
for (rn = bgp_table_top(vpn->route_table); rn;
rn = bgp_route_next(rn)) {
- for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1);
- ri = nextri) {
- bgp_path_info_delete(rn, ri);
- bgp_path_info_reap(rn, ri);
+ for (pi = rn->info; (pi != NULL) && (nextpi = pi->next, 1);
+ pi = nextpi) {
+ bgp_path_info_delete(rn, pi);
+ bgp_path_info_reap(rn, pi);
}
}
/* Install EVPN route entry in ES */
static int install_evpn_route_entry_in_es(struct bgp *bgp, struct evpnes *es,
struct prefix_evpn *p,
- struct bgp_path_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
int ret = 0;
struct bgp_node *rn = NULL;
- struct bgp_path_info *ri = NULL;
+ struct bgp_path_info *pi = NULL;
struct attr *attr_new = NULL;
/* Create (or fetch) route within the VNI.
rn = bgp_node_get(es->route_table, (struct prefix *)p);
/* Check if route entry is already present. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra
- && (struct bgp_path_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri) {
+ if (!pi) {
/* Add (or update) attribute to hash. */
- attr_new = bgp_attr_intern(parent_ri->attr);
+ attr_new = bgp_attr_intern(parent_pi->attr);
/* Create new route with its attribute. */
- ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0,
- parent_ri->peer, attr_new, rn);
- SET_FLAG(ri->flags, BGP_PATH_VALID);
- bgp_path_info_extra_get(ri);
- ri->extra->parent = parent_ri;
- bgp_path_info_add(rn, ri);
+ pi = info_make(parent_pi->type, BGP_ROUTE_IMPORTED, 0,
+ parent_pi->peer, attr_new, rn);
+ SET_FLAG(pi->flags, BGP_PATH_VALID);
+ bgp_path_info_extra_get(pi);
+ pi->extra->parent = parent_pi;
+ bgp_path_info_add(rn, pi);
} else {
- if (attrhash_cmp(ri->attr, parent_ri->attr)
- && !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) {
+ if (attrhash_cmp(pi->attr, parent_pi->attr)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
bgp_unlock_node(rn);
return 0;
}
/* The attribute has changed. */
/* Add (or update) attribute to hash. */
- attr_new = bgp_attr_intern(parent_ri->attr);
+ attr_new = bgp_attr_intern(parent_pi->attr);
/* Restore route, if needed. */
- if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, pi);
/* Mark if nexthop has changed. */
- if (!IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop))
- SET_FLAG(ri->flags, BGP_PATH_IGP_CHANGED);
+ if (!IPV4_ADDR_SAME(&pi->attr->nexthop, &attr_new->nexthop))
+ SET_FLAG(pi->flags, BGP_PATH_IGP_CHANGED);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
- ri->uptime = bgp_clock();
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
+ pi->uptime = bgp_clock();
}
/* Perform route selection and update zebra, if required. */
*/
static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
struct prefix_evpn *evp,
- struct bgp_path_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct attr attr;
struct attr *attr_new;
int ret = 0;
* address for the rest of the code to flow through. In the case of IPv4,
* make sure to set the flag for next hop attribute.
*/
- bgp_attr_dup(&attr, parent_ri->attr);
+ bgp_attr_dup(&attr, parent_pi->attr);
if (afi == AFI_IP6)
evpn_convert_nexthop_to_ipv6(&attr);
else
attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
/* Check if route entry is already present. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra
- && (struct bgp_path_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri) {
+ if (!pi) {
/* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(&attr);
/* Create new route with its attribute. */
- ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0,
- parent_ri->peer, attr_new, rn);
- SET_FLAG(ri->flags, BGP_PATH_VALID);
- 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;
+ pi = info_make(parent_pi->type, BGP_ROUTE_IMPORTED, 0,
+ parent_pi->peer, attr_new, rn);
+ SET_FLAG(pi->flags, BGP_PATH_VALID);
+ bgp_path_info_extra_get(pi);
+ pi->extra->parent = bgp_path_info_lock(parent_pi);
+ bgp_lock_node((struct bgp_node *)parent_pi->net);
+ if (parent_pi->extra) {
+ memcpy(&pi->extra->label, &parent_pi->extra->label,
+ sizeof(pi->extra->label));
+ pi->extra->num_labels = parent_pi->extra->num_labels;
}
- bgp_path_info_add(rn, ri);
+ bgp_path_info_add(rn, pi);
} else {
- if (attrhash_cmp(ri->attr, &attr)
- && !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) {
+ if (attrhash_cmp(pi->attr, &attr)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
bgp_unlock_node(rn);
return 0;
}
attr_new = bgp_attr_intern(&attr);
/* Restore route, if needed. */
- if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, pi);
/* Mark if nexthop has changed. */
- if ((afi == AFI_IP &&
- !IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop)) ||
- (afi == AFI_IP6 &&
- !IPV6_ADDR_SAME(&ri->attr->mp_nexthop_global,
- &attr_new->mp_nexthop_global)))
- SET_FLAG(ri->flags, BGP_PATH_IGP_CHANGED);
+ if ((afi == AFI_IP
+ && !IPV4_ADDR_SAME(&pi->attr->nexthop, &attr_new->nexthop))
+ || (afi == AFI_IP6
+ && !IPV6_ADDR_SAME(&pi->attr->mp_nexthop_global,
+ &attr_new->mp_nexthop_global)))
+ SET_FLAG(pi->flags, BGP_PATH_IGP_CHANGED);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
- ri->uptime = bgp_clock();
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
+ pi->uptime = bgp_clock();
}
- bgp_aggregate_increment(bgp_vrf, &rn->p, ri, afi, safi);
+ bgp_aggregate_increment(bgp_vrf, &rn->p, pi, afi, safi);
/* Perform route selection and update zebra, if required. */
bgp_process(bgp_vrf, rn, afi, safi);
*/
static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
struct prefix_evpn *p,
- struct bgp_path_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct attr *attr_new;
int ret;
rn = bgp_node_get(vpn->route_table, (struct prefix *)p);
/* Check if route entry is already present. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra
- && (struct bgp_path_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri) {
+ if (!pi) {
/* Add (or update) attribute to hash. */
- attr_new = bgp_attr_intern(parent_ri->attr);
+ attr_new = bgp_attr_intern(parent_pi->attr);
/* Create new route with its attribute. */
- ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0,
- parent_ri->peer, attr_new, rn);
- SET_FLAG(ri->flags, BGP_PATH_VALID);
- 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;
+ pi = info_make(parent_pi->type, BGP_ROUTE_IMPORTED, 0,
+ parent_pi->peer, attr_new, rn);
+ SET_FLAG(pi->flags, BGP_PATH_VALID);
+ bgp_path_info_extra_get(pi);
+ pi->extra->parent = bgp_path_info_lock(parent_pi);
+ bgp_lock_node((struct bgp_node *)parent_pi->net);
+ if (parent_pi->extra) {
+ memcpy(&pi->extra->label, &parent_pi->extra->label,
+ sizeof(pi->extra->label));
+ pi->extra->num_labels = parent_pi->extra->num_labels;
}
- bgp_path_info_add(rn, ri);
+ bgp_path_info_add(rn, pi);
} else {
- if (attrhash_cmp(ri->attr, parent_ri->attr)
- && !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) {
+ if (attrhash_cmp(pi->attr, parent_pi->attr)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
bgp_unlock_node(rn);
return 0;
}
/* The attribute has changed. */
/* Add (or update) attribute to hash. */
- attr_new = bgp_attr_intern(parent_ri->attr);
+ attr_new = bgp_attr_intern(parent_pi->attr);
/* Restore route, if needed. */
- if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, pi);
/* Mark if nexthop has changed. */
- if (!IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop))
- SET_FLAG(ri->flags, BGP_PATH_IGP_CHANGED);
+ if (!IPV4_ADDR_SAME(&pi->attr->nexthop, &attr_new->nexthop))
+ SET_FLAG(pi->flags, BGP_PATH_IGP_CHANGED);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
- ri->uptime = bgp_clock();
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
+ pi->uptime = bgp_clock();
}
/* Perform route selection and update zebra, if required. */
/* Uninstall EVPN route entry from ES route table */
static int uninstall_evpn_route_entry_in_es(struct bgp *bgp, struct evpnes *es,
struct prefix_evpn *p,
- struct bgp_path_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
int ret;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
if (!es->route_table)
return 0;
return 0;
/* Find matching route entry. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra
- && (struct bgp_path_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri)
+ if (!pi)
return 0;
/* Mark entry for deletion */
- bgp_path_info_delete(rn, ri);
+ bgp_path_info_delete(rn, pi);
/* Perform route selection and update zebra, if required. */
ret = evpn_es_route_select_install(bgp, es, rn);
*/
static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
struct prefix_evpn *evp,
- struct bgp_path_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
int ret = 0;
struct prefix p;
struct prefix *pp = &p;
return 0;
/* Find matching route entry. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra
- && (struct bgp_path_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri)
+ if (!pi)
return 0;
- bgp_aggregate_decrement(bgp_vrf, &rn->p, ri, afi, safi);
+ bgp_aggregate_decrement(bgp_vrf, &rn->p, pi, afi, safi);
/* Mark entry for deletion */
- bgp_path_info_delete(rn, ri);
+ bgp_path_info_delete(rn, pi);
/* Perform route selection and update zebra, if required. */
bgp_process(bgp_vrf, rn, afi, safi);
*/
static int uninstall_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
struct prefix_evpn *p,
- struct bgp_path_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
int ret;
/* Locate route within the VNI. */
return 0;
/* Find matching route entry. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra
- && (struct bgp_path_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri)
+ if (!pi)
return 0;
/* Mark entry for deletion */
- bgp_path_info_delete(rn, ri);
+ bgp_path_info_delete(rn, pi);
/* Perform route selection and update zebra, if required. */
ret = evpn_route_select_install(bgp, vpn, rn);
* imported into the VRF i.e., RTs match.
*/
static int is_route_matching_for_vrf(struct bgp *bgp_vrf,
- struct bgp_path_info *ri)
+ struct bgp_path_info *pi)
{
- struct attr *attr = ri->attr;
+ struct attr *attr = pi->attr;
struct ecommunity *ecom;
int i;
* imported into the VNI i.e., RTs match.
*/
static int is_route_matching_for_vni(struct bgp *bgp, struct bgpevpn *vpn,
- struct bgp_path_info *ri)
+ struct bgp_path_info *pi)
{
- struct attr *attr = ri->attr;
+ struct attr *attr = pi->attr;
struct ecommunity *ecom;
int i;
char buf1[ESI_STR_LEN];
struct bgp_node *rd_rn, *rn;
struct bgp_table *table;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
afi = AFI_L2VPN;
safi = SAFI_EVPN;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
struct prefix_evpn *evp = (struct prefix_evpn *)&rn->p;
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
/*
* Consider "valid" remote routes applicable for
* this ES.
*/
- if (!(CHECK_FLAG(ri->flags, BGP_PATH_VALID)
- && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_NORMAL))
+ if (!(CHECK_FLAG(pi->flags, BGP_PATH_VALID)
+ && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_NORMAL))
continue;
if (!is_prefix_matching_for_es(evp, es))
if (install)
ret = install_evpn_route_entry_in_es(
- bgp, es, evp, ri);
+ bgp, es, evp, pi);
else
ret = uninstall_evpn_route_entry_in_es(
- bgp, es, evp, ri);
+ bgp, es, evp, pi);
if (ret) {
flog_err(
safi_t safi;
struct bgp_node *rd_rn, *rn;
struct bgp_table *table;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
int ret;
char buf[PREFIX_STRLEN];
struct bgp *bgp_def = NULL;
|| is_evpn_prefix_ipaddr_v6(evp)))
continue;
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
/* Consider "valid" remote routes applicable for
* this VRF.
*/
- if (!(CHECK_FLAG(ri->flags, BGP_PATH_VALID)
- && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_NORMAL))
+ if (!(CHECK_FLAG(pi->flags, BGP_PATH_VALID)
+ && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_NORMAL))
continue;
- if (is_route_matching_for_vrf(bgp_vrf, ri)) {
+ if (is_route_matching_for_vrf(bgp_vrf, pi)) {
if (install)
ret = install_evpn_route_entry_in_vrf(
- bgp_vrf, evp, ri);
+ bgp_vrf, evp, pi);
else
ret = uninstall_evpn_route_entry_in_vrf(
- bgp_vrf, evp, ri);
+ bgp_vrf, evp, pi);
if (ret) {
flog_err(
safi_t safi;
struct bgp_node *rd_rn, *rn;
struct bgp_table *table;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
int ret;
afi = AFI_L2VPN;
if (evp->prefix.route_type != rtype)
continue;
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
/* Consider "valid" remote routes applicable for
* this VNI. */
- if (!(CHECK_FLAG(ri->flags, BGP_PATH_VALID)
- && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_NORMAL))
+ if (!(CHECK_FLAG(pi->flags, BGP_PATH_VALID)
+ && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_NORMAL))
continue;
- if (is_route_matching_for_vni(bgp, vpn, ri)) {
+ if (is_route_matching_for_vni(bgp, vpn, pi)) {
if (install)
ret = install_evpn_route_entry(
- bgp, vpn, evp, ri);
+ bgp, vpn, evp, pi);
else
ret = uninstall_evpn_route_entry(
- bgp, vpn, evp, ri);
+ bgp, vpn, evp, pi);
if (ret) {
flog_err(
static int install_uninstall_route_in_es(struct bgp *bgp, struct evpnes *es,
afi_t afi, safi_t safi,
struct prefix_evpn *evp,
- struct bgp_path_info *ri, int install)
+ struct bgp_path_info *pi, int install)
{
int ret = 0;
char buf[ESI_STR_LEN];
if (install)
- ret = install_evpn_route_entry_in_es(bgp, es, evp, ri);
+ ret = install_evpn_route_entry_in_es(bgp, es, evp, pi);
else
- ret = uninstall_evpn_route_entry_in_es(bgp, es, evp, ri);
+ ret = uninstall_evpn_route_entry_in_es(bgp, es, evp, pi);
if (ret) {
flog_err(
*/
static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi,
safi_t safi, struct prefix_evpn *evp,
- struct bgp_path_info *ri,
+ struct bgp_path_info *pi,
struct list *vrfs, int install)
{
char buf[PREFIX2STR_BUFFER];
int ret;
if (install)
- ret = install_evpn_route_entry_in_vrf(bgp_vrf, evp, ri);
+ ret = install_evpn_route_entry_in_vrf(bgp_vrf, evp, pi);
else
ret = uninstall_evpn_route_entry_in_vrf(bgp_vrf, evp,
- ri);
+ pi);
if (ret) {
flog_err(EC_BGP_EVPN_FAIL,
*/
static int install_uninstall_route_in_vnis(struct bgp *bgp, afi_t afi,
safi_t safi, struct prefix_evpn *evp,
- struct bgp_path_info *ri,
+ struct bgp_path_info *pi,
struct list *vnis, int install)
{
struct bgpevpn *vpn;
continue;
if (install)
- ret = install_evpn_route_entry(bgp, vpn, evp, ri);
+ ret = install_evpn_route_entry(bgp, vpn, evp, pi);
else
- ret = uninstall_evpn_route_entry(bgp, vpn, evp, ri);
+ ret = uninstall_evpn_route_entry(bgp, vpn, evp, pi);
if (ret) {
flog_err(EC_BGP_EVPN_FAIL,
*/
static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
struct prefix *p,
- struct bgp_path_info *ri, int import)
+ struct bgp_path_info *pi, int import)
{
struct prefix_evpn *evp = (struct prefix_evpn *)p;
- struct attr *attr = ri->attr;
+ struct attr *attr = pi->attr;
struct ecommunity *ecom;
int i;
irt = lookup_import_rt(bgp, eval);
if (irt)
- install_uninstall_route_in_vnis(bgp, afi, safi,
- evp, ri,
- irt->vnis,
- import);
+ install_uninstall_route_in_vnis(
+ bgp, afi, safi, evp, pi, irt->vnis,
+ import);
vrf_irt = lookup_vrf_import_rt(eval);
if (vrf_irt)
- install_uninstall_route_in_vrfs(bgp, afi, safi,
- evp, ri,
- vrf_irt->vrfs,
- import);
+ install_uninstall_route_in_vrfs(
+ bgp, afi, safi, evp, pi, vrf_irt->vrfs,
+ import);
/* Also check for non-exact match.
* In this, we mask out the AS and
}
if (irt)
- install_uninstall_route_in_vnis(bgp, afi, safi,
- evp, ri,
- irt->vnis,
- import);
+ install_uninstall_route_in_vnis(
+ bgp, afi, safi, evp, pi, irt->vnis,
+ import);
if (vrf_irt)
- install_uninstall_route_in_vrfs(bgp, afi, safi,
- evp, ri,
- vrf_irt->vrfs,
- import);
+ install_uninstall_route_in_vrfs(
+ bgp, afi, safi, evp, pi, vrf_irt->vrfs,
+ import);
}
/* es route is imported into the es table */
*/
es = bgp_evpn_lookup_es(bgp, &evp->prefix.es_addr.esi);
if (es && is_es_local(es))
- install_uninstall_route_in_es(bgp, es,
- afi, safi,
- evp, ri, import);
+ install_uninstall_route_in_es(
+ bgp, es, afi, safi, evp, pi, import);
}
}
{
struct prefix_evpn p;
struct bgp_node *rn, *global_rn;
- struct bgp_path_info *ri, *global_ri;
+ struct bgp_path_info *pi, *global_pi;
struct attr *attr;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
rn = bgp_node_lookup(vpn->route_table, (struct prefix *)&p);
if (!rn) /* unexpected */
return 0;
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
- if (!ri) /* unexpected */
+ if (!pi) /* unexpected */
return 0;
- attr = ri->attr;
+ attr = pi->attr;
global_rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
(struct prefix *)&p, &vpn->prd);
- update_evpn_route_entry(bgp, vpn, afi, safi, global_rn, attr, 1, &ri,
- 0, mac_mobility_seqnum(attr));
+ update_evpn_route_entry(bgp, vpn, afi, safi, global_rn, attr, 1, &pi, 0,
+ mac_mobility_seqnum(attr));
/* Schedule for processing and unlock node. */
bgp_process(bgp, global_rn, afi, safi);
if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
continue;
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self
- && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self
+ && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
- if (!ri)
+ if (!pi)
continue;
/* Create route in global routing table using this route entry's
* attribute.
*/
- attr = ri->attr;
+ attr = pi->attr;
global_rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
(struct prefix *)evp, &vpn->prd);
assert(global_rn);
update_evpn_route_entry(bgp, vpn, afi, safi, global_rn, attr, 1,
- &global_ri, 0,
+ &global_pi, 0,
mac_mobility_seqnum(attr));
/* Schedule for processing and unlock node. */
int ret;
struct prefix_evpn p;
struct bgp_node *global_rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
(struct prefix *)&p, &vpn->prd);
if (global_rn) {
/* Delete route entry in the global EVPN table. */
- delete_evpn_route_entry(bgp, afi, safi, global_rn, &ri);
+ delete_evpn_route_entry(bgp, afi, safi, global_rn, &pi);
/* Schedule for processing - withdraws to peers happen from
* this table.
*/
- if (ri)
+ if (pi)
bgp_process(bgp, global_rn, afi, safi);
bgp_unlock_node(global_rn);
}
{
struct bgp_table *table = NULL;
struct bgp_node *rn = NULL;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
table = bgp_vrf->rib[afi][safi];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
/* Only care about "selected" routes - non-imported. */
/* TODO: Support for AddPath for EVPN. */
- for (ri = rn->info; ri; ri = ri->next) {
- if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)
- && (!ri->extra || !ri->extra->parent)) {
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)
+ && (!pi->extra || !pi->extra->parent)) {
bgp_evpn_withdraw_type5_route(bgp_vrf, &rn->p,
afi, safi);
break;
{
struct bgp_table *table = NULL;
struct bgp_node *rn = NULL;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
table = bgp_vrf->rib[afi][safi];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
* attribute. Also, we only consider "non-imported" routes.
* TODO: Support for AddPath for EVPN.
*/
- for (ri = rn->info; ri; ri = ri->next) {
- if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)
- && (!ri->extra || !ri->extra->parent)) {
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)
+ && (!pi->extra || !pi->extra->parent)) {
/* apply the route-map */
if (bgp_vrf->adv_cmd_rmap[afi][safi].map) {
ret = route_map_apply(
bgp_vrf->adv_cmd_rmap[afi][safi]
.map,
- &rn->p, RMAP_BGP, ri);
+ &rn->p, RMAP_BGP, pi);
if (ret == RMAP_DENYMATCH)
continue;
}
bgp_evpn_advertise_type5_route(
- bgp_vrf, &rn->p, ri->attr, afi, safi);
+ bgp_vrf, &rn->p, pi->attr, afi, safi);
break;
}
}
* Import evpn route from global table to VNI/VRF/ESI.
*/
int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct prefix *p, struct bgp_path_info *ri)
+ struct prefix *p, struct bgp_path_info *pi)
{
- return install_uninstall_evpn_route(bgp, afi, safi, p, ri, 1);
+ return install_uninstall_evpn_route(bgp, afi, safi, p, pi, 1);
}
/*
* Unimport evpn route from VNI/VRF/ESI.
*/
int bgp_evpn_unimport_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct prefix *p, struct bgp_path_info *ri)
+ struct prefix *p, struct bgp_path_info *pi)
{
- return install_uninstall_evpn_route(bgp, afi, safi, p, ri, 0);
+ return install_uninstall_evpn_route(bgp, afi, safi, p, pi, 0);
}
/* filter routes which have martian next hops */
safi_t safi;
struct bgp_node *rd_rn, *rn;
struct bgp_table *table;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
afi = AFI_L2VPN;
safi = SAFI_EVPN;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
/* Consider "valid" remote routes applicable for
* this VNI. */
- if (!(ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_NORMAL))
+ if (!(pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_NORMAL))
continue;
- if (bgp_nexthop_self(bgp, ri->attr->nexthop)) {
+ if (bgp_nexthop_self(bgp, pi->attr->nexthop)) {
char attr_str[BUFSIZ];
char pbuf[PREFIX_STRLEN];
- bgp_dump_attr(ri->attr, attr_str,
+ bgp_dump_attr(pi->attr, attr_str,
BUFSIZ);
- if (bgp_debug_update(ri->peer, &rn->p,
+ if (bgp_debug_update(pi->peer, &rn->p,
NULL, 1))
zlog_debug(
"%u: prefix %s with attr %s - DENIED due to martian or self nexthop",
attr_str);
bgp_evpn_unimport_route(bgp, afi, safi,
- &rn->p, ri);
+ &rn->p, pi);
- bgp_rib_remove(rn, ri, ri->peer, afi,
+ bgp_rib_remove(rn, pi, pi->peer, afi,
safi);
}
}
{
int header = 1;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
uint32_t prefix_cnt, path_cnt;
uint64_t tbl_ver;
/* For EVPN, the prefix is displayed for each path (to fit in
* with code that already exists).
*/
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (json)
json_path = json_object_new_array();
- route_vty_out(vty, &rn->p, ri, 0, SAFI_EVPN, json_path);
+ route_vty_out(vty, &rn->p, pi, 0, SAFI_EVPN, json_path);
if (json)
json_object_array_add(json_paths, json_path);
json_object *json)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_table *table;
int header = 1;
uint64_t tbl_ver;
/* For EVPN, the prefix is displayed for each path (to fit in
* with code that already exists).
*/
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (vtep_ip.s_addr
&& !IPV4_ADDR_SAME(&(vtep_ip),
- &(ri->attr->nexthop)))
+ &(pi->attr->nexthop)))
continue;
if (json)
json_path = json_object_new_array();
- route_vty_out(vty, &rn->p, ri, 0, SAFI_EVPN, json_path);
+ route_vty_out(vty, &rn->p, pi, 0, SAFI_EVPN, json_path);
if (json)
json_object_array_add(json_paths, json_path);
struct bgp_table *table;
struct bgp_node *rn;
struct bgp_node *rm;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
int rd_header;
int header = 1;
tbl_ver = table->version;
for (rm = bgp_table_top(table); rm; rm = bgp_route_next(rm))
- for (ri = rm->info; ri; ri = ri->next) {
+ for (pi = rm->info; pi; pi = pi->next) {
total_count++;
if (type == bgp_show_type_neighbor) {
union sockunion *su = output_arg;
- if (ri->peer->su_remote == NULL
+ if (pi->peer->su_remote == NULL
|| !sockunion_same(
- ri->peer->su_remote, su))
+ pi->peer->su_remote, su))
continue;
}
if (header == 0) {
else
json_array = NULL;
if (option == SHOW_DISPLAY_TAGS)
- route_vty_out_tag(vty, &rm->p, ri, 0,
+ route_vty_out_tag(vty, &rm->p, pi, 0,
SAFI_EVPN,
json_array);
else if (option == SHOW_DISPLAY_OVERLAY)
- route_vty_out_overlay(vty, &rm->p, ri,
+ route_vty_out_overlay(vty, &rm->p, pi,
0, json_array);
else
- route_vty_out(vty, &rm->p, ri, 0,
+ route_vty_out(vty, &rm->p, pi, 0,
SAFI_EVPN, json_array);
output_count++;
}
struct bgpevpn *vpn;
struct prefix_evpn p;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
uint32_t path_cnt = 0;
afi_t afi;
safi_t safi;
route_vty_out_detail_header(vty, bgp, rn, NULL, afi, safi, json);
/* Display each path for this prefix. */
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (json)
json_path = json_object_new_array();
- route_vty_out_detail(vty, bgp, &rn->p, ri, afi, safi,
+ route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi,
json_path);
if (json)
struct bgpevpn *vpn;
struct prefix_evpn p;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
uint32_t path_cnt = 0;
afi_t afi;
safi_t safi;
route_vty_out_detail_header(vty, bgp, rn, NULL, afi, safi, json);
/* Display each path for this prefix. */
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (json)
json_path = json_object_new_array();
- route_vty_out_detail(vty, bgp, &rn->p, ri, afi, safi,
+ route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi,
json_path);
if (json)
{
struct prefix_evpn p;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
afi_t afi;
safi_t safi;
uint32_t path_cnt = 0;
json_paths = json_object_new_array();
/* Display each path for this prefix. */
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (json)
json_path = json_object_new_array();
- route_vty_out_detail(vty, bgp, &rn->p, ri, afi, safi,
+ route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi,
json_path);
if (json)
struct bgp_node *rd_rn;
struct bgp_table *table;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
int rd_header = 1;
afi_t afi;
safi_t safi;
json_paths = json_object_new_array();
/* Display each path for this prefix. */
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (json)
json_path = json_object_new_array();
- route_vty_out_detail(vty, bgp, &rn->p, ri, afi, safi,
+ route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi,
json_path);
if (json)
struct bgp_node *rd_rn;
struct bgp_table *table;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
int header = 1;
int rd_header;
afi_t afi;
* fit in
* with code that already exists).
*/
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
path_cnt++;
add_prefix_to_json = 1;
if (json)
json_path = json_object_new_array();
- route_vty_out(vty, &rn->p, ri, 0, SAFI_EVPN,
+ route_vty_out(vty, &rn->p, pi, 0, SAFI_EVPN,
json_path);
if (json)
void *output_arg, bool use_json, int is_last,
unsigned long *output_cum, unsigned long *total_cum)
{
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_node *rn;
unsigned long total_count = 0;
json_object *json_paths = NULL;
json_paths = json_object_new_array();
display = NLRI_STRING_FORMAT_JSON;
}
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
total_count++;
- route_vty_out_flowspec(vty, &rn->p,
- ri, display,
+ route_vty_out_flowspec(vty, &rn->p, pi, display,
json_paths);
-
}
if (use_json) {
vty_out(vty, "%s\n",
return 1;
}
-mpls_label_t bgp_adv_label(struct bgp_node *rn, struct bgp_path_info *ri,
+mpls_label_t bgp_adv_label(struct bgp_node *rn, struct bgp_path_info *pi,
struct peer *to, afi_t afi, safi_t safi)
{
struct peer *from;
mpls_label_t remote_label;
int reflect;
- if (!rn || !ri || !to)
+ if (!rn || !pi || !to)
return MPLS_INVALID_LABEL;
- remote_label = ri->extra ? ri->extra->label[0] : MPLS_INVALID_LABEL;
- from = ri->peer;
+ remote_label = pi->extra ? pi->extra->label[0] : MPLS_INVALID_LABEL;
+ from = pi->peer;
reflect =
((from->sort == BGP_PEER_IBGP) && (to->sort == BGP_PEER_IBGP));
return rn->local_label;
}
-void bgp_reg_dereg_for_label(struct bgp_node *rn, struct bgp_path_info *ri,
+void bgp_reg_dereg_for_label(struct bgp_node *rn, struct bgp_path_info *pi,
int reg)
{
struct stream *s;
stream_putw(s, PREFIX_FAMILY(p));
stream_put_prefix(s, p);
if (reg) {
- assert(ri);
- if (ri->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) {
- if (ri->attr->label_index != BGP_INVALID_LABEL_INDEX) {
+ assert(pi);
+ if (pi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) {
+ if (pi->attr->label_index != BGP_INVALID_LABEL_INDEX) {
flags |= ZEBRA_FEC_REGISTER_LABEL_INDEX;
- stream_putl(s, ri->attr->label_index);
+ stream_putl(s, pi->attr->label_index);
}
}
SET_FLAG(rn->flags, BGP_NODE_REGISTERED_FOR_LABEL);
struct peer;
extern void bgp_reg_dereg_for_label(struct bgp_node *rn,
- struct bgp_path_info *ri, int reg);
+ struct bgp_path_info *pi, int reg);
extern int bgp_parse_fec_update(void);
-extern mpls_label_t bgp_adv_label(struct bgp_node *rn, struct bgp_path_info *ri,
+extern mpls_label_t bgp_adv_label(struct bgp_node *rn, struct bgp_path_info *pi,
struct peer *to, afi_t afi, safi_t safi);
extern int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
}
static inline void bgp_register_for_label(struct bgp_node *rn,
- struct bgp_path_info *ri)
+ struct bgp_path_info *pi)
{
- bgp_reg_dereg_for_label(rn, ri, 1);
+ bgp_reg_dereg_for_label(rn, pi, 1);
}
static inline void bgp_unregister_for_label(struct bgp_node *rn)
* 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.
+ * or greater than zero if bpi1 is respectively less than, equal to,
+ * or greater than bpi2.
*/
-int bgp_path_info_nexthop_cmp(struct bgp_path_info *bi1,
- struct bgp_path_info *bi2)
+int bgp_path_info_nexthop_cmp(struct bgp_path_info *bpi1,
+ struct bgp_path_info *bpi2)
{
int compare;
struct in6_addr addr1, addr2;
- compare = IPV4_ADDR_CMP(&bi1->attr->nexthop, &bi2->attr->nexthop);
+ compare = IPV4_ADDR_CMP(&bpi1->attr->nexthop, &bpi2->attr->nexthop);
if (!compare) {
- if (bi1->attr->mp_nexthop_len == bi2->attr->mp_nexthop_len) {
- switch (bi1->attr->mp_nexthop_len) {
+ if (bpi1->attr->mp_nexthop_len == bpi2->attr->mp_nexthop_len) {
+ switch (bpi1->attr->mp_nexthop_len) {
case BGP_ATTR_NHLEN_IPV4:
case BGP_ATTR_NHLEN_VPNV4:
compare = IPV4_ADDR_CMP(
- &bi1->attr->mp_nexthop_global_in,
- &bi2->attr->mp_nexthop_global_in);
+ &bpi1->attr->mp_nexthop_global_in,
+ &bpi2->attr->mp_nexthop_global_in);
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL:
case BGP_ATTR_NHLEN_VPNV6_GLOBAL:
compare = IPV6_ADDR_CMP(
- &bi1->attr->mp_nexthop_global,
- &bi2->attr->mp_nexthop_global);
+ &bpi1->attr->mp_nexthop_global,
+ &bpi2->attr->mp_nexthop_global);
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL:
- addr1 = (bi1->attr->mp_nexthop_prefer_global)
- ? bi1->attr->mp_nexthop_global
- : bi1->attr->mp_nexthop_local;
- addr2 = (bi2->attr->mp_nexthop_prefer_global)
- ? bi2->attr->mp_nexthop_global
- : bi2->attr->mp_nexthop_local;
-
- if (!bi1->attr->mp_nexthop_prefer_global
- && !bi2->attr->mp_nexthop_prefer_global)
+ addr1 = (bpi1->attr->mp_nexthop_prefer_global)
+ ? bpi1->attr->mp_nexthop_global
+ : bpi1->attr->mp_nexthop_local;
+ addr2 = (bpi2->attr->mp_nexthop_prefer_global)
+ ? bpi2->attr->mp_nexthop_global
+ : bpi2->attr->mp_nexthop_local;
+
+ if (!bpi1->attr->mp_nexthop_prefer_global
+ && !bpi2->attr->mp_nexthop_prefer_global)
compare = !bgp_interface_same(
- bi1->peer->ifp, bi2->peer->ifp);
+ bpi1->peer->ifp,
+ bpi2->peer->ifp);
if (!compare)
compare = IPV6_ADDR_CMP(&addr1, &addr2);
* link-local
* nexthops but another IPv6 peer only sends you global
*/
- else if (bi1->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL
- || bi1->attr->mp_nexthop_len
+ else if (bpi1->attr->mp_nexthop_len
+ == BGP_ATTR_NHLEN_IPV6_GLOBAL
+ || bpi1->attr->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
- compare = IPV6_ADDR_CMP(&bi1->attr->mp_nexthop_global,
- &bi2->attr->mp_nexthop_global);
+ compare = IPV6_ADDR_CMP(&bpi1->attr->mp_nexthop_global,
+ &bpi2->attr->mp_nexthop_global);
if (!compare) {
- if (bi1->attr->mp_nexthop_len
- < bi2->attr->mp_nexthop_len)
+ if (bpi1->attr->mp_nexthop_len
+ < bpi2->attr->mp_nexthop_len)
compare = -1;
else
compare = 1;
*/
static int bgp_path_info_mpath_cmp(void *val1, void *val2)
{
- struct bgp_path_info *bi1, *bi2;
+ struct bgp_path_info *bpi1, *bpi2;
int compare;
- bi1 = val1;
- bi2 = val2;
+ bpi1 = val1;
+ bpi2 = val2;
- compare = bgp_path_info_nexthop_cmp(bi1, bi2);
+ compare = bgp_path_info_nexthop_cmp(bpi1, bpi2);
if (!compare) {
- if (!bi1->peer->su_remote && !bi2->peer->su_remote)
+ if (!bpi1->peer->su_remote && !bpi2->peer->su_remote)
compare = 0;
- else if (!bi1->peer->su_remote)
+ else if (!bpi1->peer->su_remote)
compare = 1;
- else if (!bi2->peer->su_remote)
+ else if (!bpi2->peer->su_remote)
compare = -1;
else
- compare = sockunion_cmp(bi1->peer->su_remote,
- bi2->peer->su_remote);
+ compare = sockunion_cmp(bpi1->peer->su_remote,
+ bpi2->peer->su_remote);
}
return compare;
/* Functions used by bgp_best_selection to record current
* multipath selections
*/
-extern int bgp_path_info_nexthop_cmp(struct bgp_path_info *bi1,
- struct bgp_path_info *bi2);
+extern int bgp_path_info_nexthop_cmp(struct bgp_path_info *bpi1,
+ struct bgp_path_info *bpi2);
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);
return 0;
}
-static bool labels_same(struct bgp_path_info *bi, mpls_label_t *label,
+static bool labels_same(struct bgp_path_info *bpi, mpls_label_t *label,
uint32_t n)
{
uint32_t i;
- if (!bi->extra) {
+ if (!bpi->extra) {
if (!n)
return true;
else
return false;
}
- if (n != bi->extra->num_labels)
+ if (n != bpi->extra->num_labels)
return false;
for (i = 0; i < n; ++i) {
- if (label[i] != bi->extra->label[i])
+ if (label[i] != bpi->extra->label[i])
return false;
}
return true;
/*
* make encoded route labels match specified encoded label set
*/
-static void setlabels(struct bgp_path_info *bi,
+static void setlabels(struct bgp_path_info *bpi,
mpls_label_t *label, /* array of labels */
uint32_t num_labels)
{
assert(num_labels <= BGP_MAX_LABELS);
if (!num_labels) {
- if (bi->extra)
- bi->extra->num_labels = 0;
+ if (bpi->extra)
+ bpi->extra->num_labels = 0;
return;
}
- struct bgp_path_info_extra *extra = bgp_path_info_extra_get(bi);
+ struct bgp_path_info_extra *extra = bgp_path_info_extra_get(bpi);
uint32_t i;
for (i = 0; i < num_labels; ++i) {
static struct bgp_path_info *
leak_update(struct bgp *bgp, /* destination bgp instance */
struct bgp_node *bn, struct attr *new_attr, /* already interned */
- afi_t afi, safi_t safi, struct bgp_path_info *source_bi,
+ afi_t afi, safi_t safi, struct bgp_path_info *source_bpi,
mpls_label_t *label, uint32_t num_labels, void *parent,
struct bgp *bgp_orig, struct prefix *nexthop_orig,
int nexthop_self_flag, int debug)
{
struct prefix *p = &bn->p;
- struct bgp_path_info *bi;
- struct bgp_path_info *bi_ultimate;
+ struct bgp_path_info *bpi;
+ struct bgp_path_info *bpi_ultimate;
struct bgp_path_info *new;
char buf_prefix[PREFIX_STRLEN];
if (debug) {
prefix2str(&bn->p, buf_prefix, sizeof(buf_prefix));
zlog_debug("%s: entry: leak-to=%s, p=%s, type=%d, sub_type=%d",
- __func__, bgp->name_pretty, buf_prefix,
- source_bi->type, source_bi->sub_type);
+ __func__, bgp->name_pretty, buf_prefix,
+ source_bpi->type, source_bpi->sub_type);
}
/*
* should have nexthop tracking, we must find the ultimate
* parent so we can check its sub_type.
*
- * As of now, source_bi may at most be a second-generation route
+ * As of now, source_bpi may at most be a second-generation route
* (only one hop back to ultimate parent for vrf-vpn-vrf scheme).
* Using a loop here supports more complex intra-bgp import-export
* schemes that could be implemented in the future.
*
*/
- for (bi_ultimate = source_bi;
- bi_ultimate->extra && bi_ultimate->extra->parent;
- bi_ultimate = bi_ultimate->extra->parent)
- ;
+ for (bpi_ultimate = source_bpi;
+ bpi_ultimate->extra && bpi_ultimate->extra->parent;
+ bpi_ultimate = bpi_ultimate->extra->parent)
+ ;
/*
* match parent
*/
- for (bi = bn->info; bi; bi = bi->next) {
- if (bi->extra && bi->extra->parent == parent)
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
+ if (bpi->extra && bpi->extra->parent == parent)
break;
}
- if (bi) {
- bool labelssame = labels_same(bi, label, num_labels);
+ if (bpi) {
+ bool labelssame = labels_same(bpi, label, num_labels);
- if (attrhash_cmp(bi->attr, new_attr) && labelssame
- && !CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) {
+ if (attrhash_cmp(bpi->attr, new_attr) && labelssame
+ && !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
bgp_attr_unintern(&new_attr);
if (debug)
}
/* attr is changed */
- bgp_path_info_set_flag(bn, bi, BGP_PATH_ATTR_CHANGED);
+ bgp_path_info_set_flag(bn, bpi, BGP_PATH_ATTR_CHANGED);
/* Rewrite BGP route information. */
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(bn, bi);
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(bn, bpi);
else
- bgp_aggregate_decrement(bgp, p, bi, afi, safi);
- bgp_attr_unintern(&bi->attr);
- bi->attr = new_attr;
- bi->uptime = bgp_clock();
+ bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
+ bgp_attr_unintern(&bpi->attr);
+ bpi->attr = new_attr;
+ bpi->uptime = bgp_clock();
/*
* rewrite labels
*/
if (!labelssame)
- setlabels(bi, label, num_labels);
+ setlabels(bpi, label, num_labels);
if (nexthop_self_flag)
- bgp_path_info_set_flag(bn, bi, BGP_PATH_ANNC_NH_SELF);
+ bgp_path_info_set_flag(bn, bpi, BGP_PATH_ANNC_NH_SELF);
struct bgp *bgp_nexthop = bgp;
int nh_valid;
- if (bi->extra && bi->extra->bgp_orig)
- bgp_nexthop = bi->extra->bgp_orig;
+ if (bpi->extra && bpi->extra->bgp_orig)
+ bgp_nexthop = bpi->extra->bgp_orig;
/* No nexthop tracking for redistributed routes */
- if (bi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)
+ if (bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)
nh_valid = 1;
else
/*
* TBD do we need to do anything about the
* 'connected' parameter?
*/
- nh_valid = bgp_find_or_add_nexthop(
- bgp, bgp_nexthop,
- afi, bi, NULL, 0);
+ nh_valid = bgp_find_or_add_nexthop(bgp, bgp_nexthop,
+ afi, bpi, NULL, 0);
if (debug)
zlog_debug("%s: nexthop is %svalid (in vrf %s)",
bgp_nexthop->name_pretty);
if (nh_valid)
- bgp_path_info_set_flag(bn, bi, BGP_PATH_VALID);
+ bgp_path_info_set_flag(bn, bpi, BGP_PATH_VALID);
/* Process change. */
- bgp_aggregate_increment(bgp, p, bi, afi, safi);
+ bgp_aggregate_increment(bgp, p, bpi, afi, safi);
bgp_process(bgp, bn, afi, safi);
bgp_unlock_node(bn);
zlog_debug("%s: ->%s: %s Found route, changed attr",
__func__, bgp->name_pretty, buf_prefix);
- return bi;
+ return bpi;
}
new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_IMPORTED, 0,
* their originating protocols will do the tracking and
* withdraw those routes if the nexthops become unreachable
*/
- if (bi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)
+ if (bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)
nh_valid = 1;
else
/*
/* cf vnc_import_bgp_add_route_mode_nvegroup() and add_vnc_route() */
void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
struct bgp *bgp_vrf, /* from */
- struct bgp_path_info *info_vrf) /* route */
+ struct bgp_path_info *path_vrf) /* route */
{
int debug = BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF);
- struct prefix *p = &info_vrf->net->p;
+ struct prefix *p = &path_vrf->net->p;
afi_t afi = family2afi(p->family);
struct attr static_attr = {0};
struct attr *new_attr = NULL;
if (debug)
zlog_debug("%s: from vrf %s", __func__, bgp_vrf->name_pretty);
- if (debug && info_vrf->attr->ecommunity) {
- char *s = ecommunity_ecom2str(info_vrf->attr->ecommunity,
+ if (debug && path_vrf->attr->ecommunity) {
+ char *s = ecommunity_ecom2str(path_vrf->attr->ecommunity,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- zlog_debug("%s: %s info_vrf->type=%d, EC{%s}", __func__,
- bgp_vrf->name, info_vrf->type, s);
+ zlog_debug("%s: %s path_vrf->type=%d, EC{%s}", __func__,
+ bgp_vrf->name, path_vrf->type, s);
XFREE(MTYPE_ECOMMUNITY_STR, s);
}
}
/* loop check - should not be an imported route. */
- if (info_vrf->extra && info_vrf->extra->bgp_orig)
+ if (path_vrf->extra && path_vrf->extra->bgp_orig)
return;
return;
}
- bgp_attr_dup(&static_attr, info_vrf->attr); /* shallow copy */
+ bgp_attr_dup(&static_attr, path_vrf->attr); /* shallow copy */
/*
* route map handling
* IPv4 nexthops as the attr has been copied
* otherwise.
*/
- if (afi == AFI_IP &&
- !BGP_ATTR_NEXTHOP_AFI_IP6(info_vrf->attr)) {
+ if (afi == AFI_IP
+ && !BGP_ATTR_NEXTHOP_AFI_IP6(path_vrf->attr)) {
static_attr.mp_nexthop_global_in.s_addr =
static_attr.nexthop.s_addr;
static_attr.mp_nexthop_len = 4;
struct bgp_path_info *new_info;
- new_info = leak_update(bgp_vpn, bn, new_attr, afi, safi, info_vrf,
- &label, 1, info_vrf, bgp_vrf, NULL,
+ new_info = leak_update(bgp_vpn, bn, new_attr, afi, safi, path_vrf,
+ &label, 1, path_vrf, bgp_vrf, NULL,
nexthop_self_flag, debug);
/*
void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn, /* to */
struct bgp *bgp_vrf, /* from */
- struct bgp_path_info *info_vrf) /* route */
+ struct bgp_path_info *path_vrf) /* route */
{
int debug = BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF);
- struct prefix *p = &info_vrf->net->p;
+ struct prefix *p = &path_vrf->net->p;
afi_t afi = family2afi(p->family);
safi_t safi = SAFI_MPLS_VPN;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct bgp_node *bn;
const char *debugmsg;
char buf_prefix[PREFIX_STRLEN];
zlog_debug(
"%s: entry: leak-from=%s, p=%s, type=%d, sub_type=%d",
__func__, bgp_vrf->name_pretty, buf_prefix,
- info_vrf->type, info_vrf->sub_type);
+ path_vrf->type, path_vrf->sub_type);
}
- if (info_vrf->sub_type != BGP_ROUTE_NORMAL
- && info_vrf->sub_type != BGP_ROUTE_STATIC
- && info_vrf->sub_type != BGP_ROUTE_REDISTRIBUTE) {
+ if (path_vrf->sub_type != BGP_ROUTE_NORMAL
+ && path_vrf->sub_type != BGP_ROUTE_STATIC
+ && path_vrf->sub_type != BGP_ROUTE_REDISTRIBUTE) {
if (debug)
zlog_debug("%s: wrong sub_type %d", __func__,
- info_vrf->sub_type);
+ path_vrf->sub_type);
return;
}
if (!bgp_vpn)
}
if (debug)
- zlog_debug("%s: withdrawing (info_vrf=%p)", __func__, info_vrf);
+ zlog_debug("%s: withdrawing (path_vrf=%p)", __func__, path_vrf);
bn = bgp_afi_node_get(bgp_vpn->rib[afi][safi], afi, safi, p,
&(bgp_vrf->vpn_policy[afi].tovpn_rd));
/*
* vrf -> vpn
- * match original bi imported from
+ * match original bpi imported from
*/
- for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) {
- if (bi->extra && bi->extra->parent == info_vrf) {
+ for (bpi = (bn ? bn->info : NULL); bpi; bpi = bpi->next) {
+ if (bpi->extra && bpi->extra->parent == path_vrf) {
break;
}
}
- if (bi) {
+ if (bpi) {
/* withdraw from looped vrfs as well */
- vpn_leak_to_vrf_withdraw(bgp_vpn, bi);
+ vpn_leak_to_vrf_withdraw(bgp_vpn, bpi);
- bgp_aggregate_decrement(bgp_vpn, p, bi, afi, safi);
- bgp_path_info_delete(bn, bi);
+ bgp_aggregate_decrement(bgp_vpn, p, bpi, afi, safi);
+ bgp_path_info_delete(bn, bpi);
bgp_process(bgp_vpn, bn, afi, safi);
}
bgp_unlock_node(bn);
safi_t safi = SAFI_MPLS_VPN;
/*
- * Walk vpn table, delete bi with bgp_orig == bgp_vrf
+ * Walk vpn table, delete bpi with bgp_orig == bgp_vrf
*/
for (prn = bgp_table_top(bgp_vpn->rib[afi][safi]); prn;
prn = bgp_route_next(prn)) {
struct bgp_table *table;
struct bgp_node *bn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
/* This is the per-RD table of prefixes */
table = prn->info;
prefix2str(&bn->p, buf, sizeof(buf)));
}
- for (bi = bn->info; bi; bi = bi->next) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
if (debug)
zlog_debug("%s: type %d, sub_type %d",
- __func__, bi->type,
- bi->sub_type);
- if (bi->sub_type != BGP_ROUTE_IMPORTED)
+ __func__, bpi->type,
+ bpi->sub_type);
+ if (bpi->sub_type != BGP_ROUTE_IMPORTED)
continue;
- if (!bi->extra)
+ if (!bpi->extra)
continue;
- if ((struct bgp *)bi->extra->bgp_orig
+ if ((struct bgp *)bpi->extra->bgp_orig
== bgp_vrf) {
/* delete route */
if (debug)
zlog_debug("%s: deleting it\n",
__func__);
bgp_aggregate_decrement(bgp_vpn, &bn->p,
- bi, afi, safi);
- bgp_path_info_delete(bn, bi);
+ bpi, afi, safi);
+ bgp_path_info_delete(bn, bpi);
bgp_process(bgp_vpn, bn, afi, safi);
}
}
afi_t afi)
{
struct bgp_node *bn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
int debug = BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF);
if (debug)
if (debug)
zlog_debug("%s: node=%p", __func__, bn);
- for (bi = bn->info; bi; bi = bi->next) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
if (debug)
zlog_debug(
"%s: calling vpn_leak_from_vrf_update",
__func__);
- vpn_leak_from_vrf_update(bgp_vpn, bgp_vrf, bi);
+ vpn_leak_from_vrf_update(bgp_vpn, bgp_vrf, bpi);
}
}
}
static void
vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
struct bgp *bgp_vpn, /* from */
- struct bgp_path_info *info_vpn) /* route */
+ struct bgp_path_info *path_vpn) /* route */
{
- struct prefix *p = &info_vpn->net->p;
+ struct prefix *p = &path_vpn->net->p;
afi_t afi = family2afi(p->family);
struct attr static_attr = {0};
mpls_label_t *pLabels = NULL;
uint32_t num_labels = 0;
int nexthop_self_flag = 1;
- struct bgp_path_info *bi_ultimate = NULL;
+ struct bgp_path_info *bpi_ultimate = NULL;
int origin_local = 0;
struct bgp *src_vrf;
/* Check for intersection of route targets */
if (!ecom_intersect(
bgp_vrf->vpn_policy[afi].rtlist[BGP_VPN_POLICY_DIR_FROMVPN],
- info_vpn->attr->ecommunity)) {
+ path_vpn->attr->ecommunity)) {
return;
}
zlog_debug("%s: updating to vrf %s", __func__,
bgp_vrf->name_pretty);
- bgp_attr_dup(&static_attr, info_vpn->attr); /* shallow copy */
+ bgp_attr_dup(&static_attr, path_vpn->attr); /* shallow copy */
/*
* Nexthop: stash and clear
* Stash it for later label resolution by vrf ingress path and then
* overwrite with 0, i.e., "me", for the sake of vrf advertisement.
*/
- uint8_t nhfamily = NEXTHOP_FAMILY(info_vpn->attr->mp_nexthop_len);
+ uint8_t nhfamily = NEXTHOP_FAMILY(path_vpn->attr->mp_nexthop_len);
memset(&nexthop_orig, 0, sizeof(nexthop_orig));
nexthop_orig.family = nhfamily;
switch (nhfamily) {
case AF_INET:
/* save */
- nexthop_orig.u.prefix4 = info_vpn->attr->mp_nexthop_global_in;
+ nexthop_orig.u.prefix4 = path_vpn->attr->mp_nexthop_global_in;
nexthop_orig.prefixlen = 32;
if (CHECK_FLAG(bgp_vrf->af_flags[afi][safi],
nexthop_orig.u.prefix4.s_addr;
static_attr.mp_nexthop_global_in =
- info_vpn->attr->mp_nexthop_global_in;
+ path_vpn->attr->mp_nexthop_global_in;
static_attr.mp_nexthop_len =
- info_vpn->attr->mp_nexthop_len;
+ path_vpn->attr->mp_nexthop_len;
}
static_attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
break;
case AF_INET6:
/* save */
- nexthop_orig.u.prefix6 = info_vpn->attr->mp_nexthop_global;
+ nexthop_orig.u.prefix6 = path_vpn->attr->mp_nexthop_global;
nexthop_orig.prefixlen = 128;
if (CHECK_FLAG(bgp_vrf->af_flags[afi][safi],
if (!CHECK_FLAG(bgp_vrf->af_flags[afi][safi],
BGP_CONFIG_VRF_TO_VRF_IMPORT)) {
/* work back to original route */
- for (bi_ultimate = info_vpn;
- bi_ultimate->extra && bi_ultimate->extra->parent;
- bi_ultimate = bi_ultimate->extra->parent)
+ for (bpi_ultimate = path_vpn;
+ bpi_ultimate->extra && bpi_ultimate->extra->parent;
+ bpi_ultimate = bpi_ultimate->extra->parent)
;
/*
* if original route was unicast,
* then it did not arrive over vpn
*/
- if (bi_ultimate->net) {
+ if (bpi_ultimate->net) {
struct bgp_table *table;
- table = bgp_node_table(bi_ultimate->net);
+ table = bgp_node_table(bpi_ultimate->net);
if (table && (table->safi == SAFI_UNICAST))
origin_local = 1;
}
/* copy labels */
- if (!origin_local &&
- info_vpn->extra && info_vpn->extra->num_labels) {
- num_labels = info_vpn->extra->num_labels;
+ if (!origin_local && path_vpn->extra
+ && path_vpn->extra->num_labels) {
+ num_labels = path_vpn->extra->num_labels;
if (num_labels > BGP_MAX_LABELS)
num_labels = BGP_MAX_LABELS;
- pLabels = info_vpn->extra->label;
+ pLabels = path_vpn->extra->label;
}
}
* For VRF-2-VRF route-leaking,
* the source will be the originating VRF.
*/
- if (info_vpn->extra && info_vpn->extra->bgp_orig)
- src_vrf = info_vpn->extra->bgp_orig;
+ if (path_vpn->extra && path_vpn->extra->bgp_orig)
+ src_vrf = path_vpn->extra->bgp_orig;
else
src_vrf = bgp_vpn;
- leak_update(bgp_vrf, bn, new_attr, afi, safi, info_vpn,
- pLabels, num_labels,
- info_vpn, /* parent */
- src_vrf, &nexthop_orig, nexthop_self_flag, debug);
+ leak_update(bgp_vrf, bn, new_attr, afi, safi, path_vpn, pLabels,
+ num_labels, path_vpn, /* parent */
+ src_vrf, &nexthop_orig, nexthop_self_flag, debug);
}
void vpn_leak_to_vrf_update(struct bgp *bgp_vpn, /* from */
- struct bgp_path_info *info_vpn) /* route */
+ struct bgp_path_info *path_vpn) /* route */
{
struct listnode *mnode, *mnnode;
struct bgp *bgp;
int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
if (debug)
- zlog_debug("%s: start (info_vpn=%p)", __func__, info_vpn);
+ zlog_debug("%s: start (path_vpn=%p)", __func__, path_vpn);
/* Loop over VRFs */
for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp)) {
- if (!info_vpn->extra
- || info_vpn->extra->bgp_orig != bgp) { /* no loop */
- vpn_leak_to_vrf_update_onevrf(bgp, bgp_vpn, info_vpn);
+ if (!path_vpn->extra
+ || path_vpn->extra->bgp_orig != bgp) { /* no loop */
+ vpn_leak_to_vrf_update_onevrf(bgp, bgp_vpn, path_vpn);
}
}
}
void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn, /* from */
- struct bgp_path_info *info_vpn) /* route */
+ struct bgp_path_info *path_vpn) /* route */
{
struct prefix *p;
afi_t afi;
struct bgp *bgp;
struct listnode *mnode, *mnnode;
struct bgp_node *bn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
const char *debugmsg;
char buf_prefix[PREFIX_STRLEN];
int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
if (debug) {
- prefix2str(&info_vpn->net->p, buf_prefix, sizeof(buf_prefix));
- zlog_debug("%s: entry: p=%s, type=%d, sub_type=%d",
- __func__, buf_prefix,
- info_vpn->type, info_vpn->sub_type);
+ prefix2str(&path_vpn->net->p, buf_prefix, sizeof(buf_prefix));
+ zlog_debug("%s: entry: p=%s, type=%d, sub_type=%d", __func__,
+ buf_prefix, path_vpn->type, path_vpn->sub_type);
}
if (debug)
- zlog_debug("%s: start (info_vpn=%p)", __func__, info_vpn);
+ zlog_debug("%s: start (path_vpn=%p)", __func__, path_vpn);
- if (!info_vpn->net) {
+ if (!path_vpn->net) {
#if ENABLE_BGP_VNC
- /* BGP_ROUTE_RFP routes do not have info_vpn->net set (yet) */
- if (info_vpn->type == ZEBRA_ROUTE_BGP &&
- info_vpn->sub_type == BGP_ROUTE_RFP) {
+ /* BGP_ROUTE_RFP routes do not have path_vpn->net set (yet) */
+ if (path_vpn->type == ZEBRA_ROUTE_BGP
+ && path_vpn->sub_type == BGP_ROUTE_RFP) {
return;
}
#endif
if (debug)
- zlog_debug("%s: info_vpn->net unexpectedly NULL, no prefix, bailing",
+ zlog_debug(
+ "%s: path_vpn->net unexpectedly NULL, no prefix, bailing",
__func__);
return;
}
- p = &info_vpn->net->p;
+ p = &path_vpn->net->p;
afi = family2afi(p->family);
/* Loop over VRFs */
/* Check for intersection of route targets */
if (!ecom_intersect(bgp->vpn_policy[afi]
.rtlist[BGP_VPN_POLICY_DIR_FROMVPN],
- info_vpn->attr->ecommunity)) {
+ path_vpn->attr->ecommunity)) {
continue;
}
bgp->name_pretty);
bn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, NULL);
- for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) {
- if (bi->extra
- && (struct bgp_path_info *)bi->extra->parent
- == info_vpn) {
+ for (bpi = (bn ? bn->info : NULL); bpi; bpi = bpi->next) {
+ if (bpi->extra
+ && (struct bgp_path_info *)bpi->extra->parent
+ == path_vpn) {
break;
}
}
- if (bi) {
+ if (bpi) {
if (debug)
- zlog_debug("%s: deleting bi %p", __func__, bi);
- bgp_aggregate_decrement(bgp, p, bi, afi, safi);
- bgp_path_info_delete(bn, bi);
+ zlog_debug("%s: deleting bpi %p", __func__,
+ bpi);
+ bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
+ bgp_path_info_delete(bn, bpi);
bgp_process(bgp, bn, afi, safi);
}
bgp_unlock_node(bn);
afi_t afi)
{
struct bgp_node *bn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
safi_t safi = SAFI_UNICAST;
int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
if (debug)
zlog_debug("%s: entry", __func__);
/*
- * Walk vrf table, delete bi with bgp_orig in a different vrf
+ * Walk vrf table, delete bpi with bgp_orig in a different vrf
*/
for (bn = bgp_table_top(bgp_vrf->rib[afi][safi]); bn;
bn = bgp_route_next(bn)) {
- for (bi = bn->info; bi; bi = bi->next) {
- if (bi->extra && bi->extra->bgp_orig != bgp_vrf) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
+ if (bpi->extra && bpi->extra->bgp_orig != bgp_vrf) {
/* delete route */
- bgp_aggregate_decrement(bgp_vrf, &bn->p, bi,
+ bgp_aggregate_decrement(bgp_vrf, &bn->p, bpi,
afi, safi);
- bgp_path_info_delete(bn, bi);
+ bgp_path_info_delete(bn, bpi);
bgp_process(bgp_vrf, bn, afi, safi);
}
}
struct bgp_table *table;
struct bgp_node *bn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
memset(&prd, 0, sizeof(prd));
prd.family = AF_UNSPEC;
for (bn = bgp_table_top(table); bn; bn = bgp_route_next(bn)) {
- for (bi = bn->info; bi; bi = bi->next) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
- if (bi->extra && bi->extra->bgp_orig == bgp_vrf)
+ if (bpi->extra
+ && bpi->extra->bgp_orig == bgp_vrf)
continue;
vpn_leak_to_vrf_update_onevrf(bgp_vrf, bgp_vpn,
- bi);
+ bpi);
}
}
}
int tags, bool use_json);
extern void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, struct bgp *bgp_vrf,
- struct bgp_path_info *info_vrf);
+ struct bgp_path_info *path_vrf);
extern void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn, struct bgp *bgp_vrf,
- struct bgp_path_info *info_vrf);
+ struct bgp_path_info *path_vrf);
extern void vpn_leak_from_vrf_withdraw_all(struct bgp *bgp_vpn,
struct bgp *bgp_vrf, afi_t afi);
afi_t afi);
extern void vpn_leak_to_vrf_update(struct bgp *bgp_vpn,
- struct bgp_path_info *info_vpn);
+ struct bgp_path_info *path_vpn);
extern void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn,
- struct bgp_path_info *info_vpn);
+ struct bgp_path_info *path_vpn);
extern void vpn_leak_zebra_vrf_label_update(struct bgp *bgp, afi_t afi);
extern void vpn_leak_zebra_vrf_label_withdraw(struct bgp *bgp, afi_t afi);
static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc,
int is_bgp_static_route);
static void evaluate_paths(struct bgp_nexthop_cache *bnc);
-static int make_prefix(int afi, struct bgp_path_info *ri, struct prefix *p);
+static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p);
static void path_nh_map(struct bgp_path_info *path,
struct bgp_nexthop_cache *bnc, int keep);
* we need both the bgp_route and bgp_nexthop pointers.
*/
int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
- afi_t afi, struct bgp_path_info *ri,
+ afi_t afi, struct bgp_path_info *pi,
struct peer *peer, int connected)
{
struct bgp_node *rn;
struct prefix p;
int is_bgp_static_route = 0;
- if (ri) {
- is_bgp_static_route = ((ri->type == ZEBRA_ROUTE_BGP)
- && (ri->sub_type == BGP_ROUTE_STATIC))
+ if (pi) {
+ is_bgp_static_route = ((pi->type == ZEBRA_ROUTE_BGP)
+ && (pi->sub_type == BGP_ROUTE_STATIC))
? 1
: 0;
to derive
address-family from the next-hop. */
if (!is_bgp_static_route)
- afi = BGP_ATTR_NEXTHOP_AFI_IP6(ri->attr) ? AFI_IP6
+ afi = BGP_ATTR_NEXTHOP_AFI_IP6(pi->attr) ? AFI_IP6
: AFI_IP;
/* This will return TRUE if the global IPv6 NH is a link local
* addr */
- if (make_prefix(afi, ri, &p) < 0)
+ if (make_prefix(afi, pi, &p) < 0)
return 1;
} else if (peer) {
if (!sockunion2hostprefix(&peer->su, &p)) {
bnc->flags |= BGP_NEXTHOP_VALID;
} else if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED))
register_zebra_rnh(bnc, is_bgp_static_route);
- if (ri && ri->nexthop != bnc) {
+ if (pi && pi->nexthop != bnc) {
/* Unlink from existing nexthop cache, if any. This will also
* free
* the nexthop cache entry, if appropriate.
*/
- bgp_unlink_nexthop(ri);
+ bgp_unlink_nexthop(pi);
- path_nh_map(ri, bnc, 1); /* updates NHT ri list reference */
+ path_nh_map(pi, bnc, 1); /* updates NHT pi list reference */
if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID) && bnc->metric)
- (bgp_path_info_extra_get(ri))->igpmetric = bnc->metric;
- else if (ri->extra)
- ri->extra->igpmetric = 0;
+ (bgp_path_info_extra_get(pi))->igpmetric = bnc->metric;
+ else if (pi->extra)
+ pi->extra->igpmetric = 0;
} else if (peer)
bnc->nht_info = (void *)peer; /* NHT peer reference */
* make_prefix - make a prefix structure from the path (essentially
* path's node.
*/
-static int make_prefix(int afi, struct bgp_path_info *ri, struct prefix *p)
+static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p)
{
- int is_bgp_static = ((ri->type == ZEBRA_ROUTE_BGP)
- && (ri->sub_type == BGP_ROUTE_STATIC))
+ int is_bgp_static = ((pi->type == ZEBRA_ROUTE_BGP)
+ && (pi->sub_type == BGP_ROUTE_STATIC))
? 1
: 0;
case AFI_IP:
p->family = AF_INET;
if (is_bgp_static) {
- p->u.prefix4 = ri->net->p.u.prefix4;
- p->prefixlen = ri->net->p.prefixlen;
+ p->u.prefix4 = pi->net->p.u.prefix4;
+ p->prefixlen = pi->net->p.prefixlen;
} else {
- p->u.prefix4 = ri->attr->nexthop;
+ p->u.prefix4 = pi->attr->nexthop;
p->prefixlen = IPV4_MAX_BITLEN;
}
break;
p->family = AF_INET6;
if (is_bgp_static) {
- p->u.prefix6 = ri->net->p.u.prefix6;
- p->prefixlen = ri->net->p.prefixlen;
+ p->u.prefix6 = pi->net->p.u.prefix6;
+ p->prefixlen = pi->net->p.prefixlen;
} else {
- p->u.prefix6 = ri->attr->mp_nexthop_global;
+ p->u.prefix6 = pi->attr->mp_nexthop_global;
p->prefixlen = IPV6_MAX_BITLEN;
}
break;
/* return -1 if build or validation failed */
static int bgp_pbr_build_and_validate_entry(struct prefix *p,
- struct bgp_path_info *info,
+ struct bgp_path_info *path,
struct bgp_pbr_entry_main *api)
{
int ret;
if (ret < 0)
return -1;
/* extract actiosn from flowspec ecom list */
- if (info && info->attr && info->attr->ecommunity) {
- ecom = info->attr->ecommunity;
+ if (path && path->attr && path->attr->ecommunity) {
+ ecom = path->attr->ecommunity;
for (i = 0; i < ecom->size; i++) {
ecom_eval = (struct ecommunity_val *)
(ecom->val + (i * ECOMMUNITY_SIZE));
(char)ECOMMUNITY_REDIRECT_IP_NH)) {
api_action->action = ACTION_REDIRECT_IP;
api_action->u.zr.redirect_ip_v4.s_addr =
- info->attr->nexthop.s_addr;
+ path->attr->nexthop.s_addr;
api_action->u.zr.duplicate = ecom_eval->val[7];
} else {
if (ecom_eval->val[0] !=
e->damp_info = NULL;
if (e->parent) {
- struct bgp_path_info *bi = (struct bgp_path_info *)e->parent;
+ struct bgp_path_info *bpi = (struct bgp_path_info *)e->parent;
- if (bi->net) {
+ if (bpi->net) {
/* FIXME: since multiple e may have the same e->parent
* and e->parent->net is holding a refcount for each
* of them, we need to do some fudging here.
*
- * WARNING: if bi->net->lock drops to 0, bi may be
- * freed as well (because bi->net was holding the
- * last reference to bi) => write after free!
+ * WARNING: if bpi->net->lock drops to 0, bpi may be
+ * freed as well (because bpi->net was holding the
+ * last reference to bpi) => write after free!
*/
unsigned refcount;
- bi = bgp_path_info_lock(bi);
- refcount = bi->net->lock - 1;
- bgp_unlock_node((struct bgp_node *)bi->net);
+ bpi = bgp_path_info_lock(bpi);
+ refcount = bpi->net->lock - 1;
+ bgp_unlock_node((struct bgp_node *)bpi->net);
if (!refcount)
- bi->net = NULL;
- bgp_path_info_unlock(bi);
+ bpi->net = NULL;
+ bgp_path_info_unlock(bpi);
}
bgp_path_info_unlock(e->parent);
e->parent = NULL;
/* Get bgp_path_info extra information for the given bgp_path_info, lazy
* allocated if required.
*/
-struct bgp_path_info_extra *bgp_path_info_extra_get(struct bgp_path_info *ri)
+struct bgp_path_info_extra *bgp_path_info_extra_get(struct bgp_path_info *pi)
{
- if (!ri->extra)
- ri->extra = bgp_path_info_extra_new();
- return ri->extra;
+ if (!pi->extra)
+ pi->extra = bgp_path_info_extra_new();
+ return pi->extra;
}
/* Allocate new bgp info structure. */
return path;
}
-void bgp_path_info_add(struct bgp_node *rn, struct bgp_path_info *ri)
+void bgp_path_info_add(struct bgp_node *rn, struct bgp_path_info *pi)
{
struct bgp_path_info *top;
top = rn->info;
- ri->next = rn->info;
- ri->prev = NULL;
+ pi->next = rn->info;
+ pi->prev = NULL;
if (top)
- top->prev = ri;
- rn->info = ri;
+ top->prev = pi;
+ rn->info = pi;
- bgp_path_info_lock(ri);
+ bgp_path_info_lock(pi);
bgp_lock_node(rn);
- peer_lock(ri->peer); /* bgp_path_info peer reference */
+ peer_lock(pi->peer); /* bgp_path_info peer reference */
}
/* Do the actual removal of info from RIB, for use by bgp_process
completion callback *only* */
-void bgp_path_info_reap(struct bgp_node *rn, struct bgp_path_info *ri)
+void bgp_path_info_reap(struct bgp_node *rn, struct bgp_path_info *pi)
{
- if (ri->next)
- ri->next->prev = ri->prev;
- if (ri->prev)
- ri->prev->next = ri->next;
+ if (pi->next)
+ pi->next->prev = pi->prev;
+ if (pi->prev)
+ pi->prev->next = pi->next;
else
- rn->info = ri->next;
+ rn->info = pi->next;
- bgp_path_info_mpath_dequeue(ri);
- bgp_path_info_unlock(ri);
+ bgp_path_info_mpath_dequeue(pi);
+ bgp_path_info_unlock(pi);
bgp_unlock_node(rn);
}
-void bgp_path_info_delete(struct bgp_node *rn, struct bgp_path_info *ri)
+void bgp_path_info_delete(struct bgp_node *rn, struct bgp_path_info *pi)
{
- bgp_path_info_set_flag(rn, ri, BGP_PATH_REMOVED);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_REMOVED);
/* set of previous already took care of pcount */
- UNSET_FLAG(ri->flags, BGP_PATH_VALID);
+ UNSET_FLAG(pi->flags, BGP_PATH_VALID);
}
/* 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_path_info_restore(struct bgp_node *rn, struct bgp_path_info *ri)
+void bgp_path_info_restore(struct bgp_node *rn, struct bgp_path_info *pi)
{
- bgp_path_info_unset_flag(rn, ri, BGP_PATH_REMOVED);
+ bgp_path_info_unset_flag(rn, pi, BGP_PATH_REMOVED);
/* unset of previous already took care of pcount */
- SET_FLAG(ri->flags, BGP_PATH_VALID);
+ SET_FLAG(pi->flags, BGP_PATH_VALID);
}
/* Adjust pcount as required */
-static void bgp_pcount_adjust(struct bgp_node *rn, struct bgp_path_info *ri)
+static void bgp_pcount_adjust(struct bgp_node *rn, struct bgp_path_info *pi)
{
struct bgp_table *table;
assert(rn && bgp_node_table(rn));
- assert(ri && ri->peer && ri->peer->bgp);
+ assert(pi && pi->peer && pi->peer->bgp);
table = bgp_node_table(rn);
- if (ri->peer == ri->peer->bgp->peer_self)
+ if (pi->peer == pi->peer->bgp->peer_self)
return;
- if (!BGP_PATH_COUNTABLE(ri)
- && CHECK_FLAG(ri->flags, BGP_PATH_COUNTED)) {
+ if (!BGP_PATH_COUNTABLE(pi)
+ && CHECK_FLAG(pi->flags, BGP_PATH_COUNTED)) {
- UNSET_FLAG(ri->flags, BGP_PATH_COUNTED);
+ UNSET_FLAG(pi->flags, BGP_PATH_COUNTED);
/* slight hack, but more robust against errors. */
- if (ri->peer->pcount[table->afi][table->safi])
- ri->peer->pcount[table->afi][table->safi]--;
+ if (pi->peer->pcount[table->afi][table->safi])
+ pi->peer->pcount[table->afi][table->safi]--;
else
flog_err(EC_LIB_DEVELOPMENT,
"Asked to decrement 0 prefix count for peer");
- } else if (BGP_PATH_COUNTABLE(ri)
- && !CHECK_FLAG(ri->flags, BGP_PATH_COUNTED)) {
- SET_FLAG(ri->flags, BGP_PATH_COUNTED);
- ri->peer->pcount[table->afi][table->safi]++;
+ } else if (BGP_PATH_COUNTABLE(pi)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_COUNTED)) {
+ SET_FLAG(pi->flags, BGP_PATH_COUNTED);
+ pi->peer->pcount[table->afi][table->safi]++;
}
}
-static int bgp_label_index_differs(struct bgp_path_info *ri1,
- struct bgp_path_info *ri2)
+static int bgp_label_index_differs(struct bgp_path_info *pi1,
+ struct bgp_path_info *pi2)
{
- return (!(ri1->attr->label_index == ri2->attr->label_index));
+ return (!(pi1->attr->label_index == pi2->attr->label_index));
}
/* Set/unset bgp_path_info flags, adjusting any other state as needed.
* This is here primarily to keep prefix-count in check.
*/
-void bgp_path_info_set_flag(struct bgp_node *rn, struct bgp_path_info *ri,
+void bgp_path_info_set_flag(struct bgp_node *rn, struct bgp_path_info *pi,
uint32_t flag)
{
- SET_FLAG(ri->flags, flag);
+ SET_FLAG(pi->flags, flag);
/* early bath if we know it's not a flag that changes countability state
*/
BGP_PATH_VALID | BGP_PATH_HISTORY | BGP_PATH_REMOVED))
return;
- bgp_pcount_adjust(rn, ri);
+ bgp_pcount_adjust(rn, pi);
}
-void bgp_path_info_unset_flag(struct bgp_node *rn, struct bgp_path_info *ri,
+void bgp_path_info_unset_flag(struct bgp_node *rn, struct bgp_path_info *pi,
uint32_t flag)
{
- UNSET_FLAG(ri->flags, flag);
+ UNSET_FLAG(pi->flags, flag);
/* early bath if we know it's not a flag that changes countability state
*/
BGP_PATH_VALID | BGP_PATH_HISTORY | BGP_PATH_REMOVED))
return;
- bgp_pcount_adjust(rn, ri);
+ bgp_pcount_adjust(rn, pi);
}
/* Get MED value. If MED value is missing and "bgp bestpath
}
}
-void bgp_path_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 *pi, char *buf)
{
- if (ri->addpath_rx_id)
- sprintf(buf, "path %s (addpath rxid %d)", ri->peer->host,
- ri->addpath_rx_id);
+ if (pi->addpath_rx_id)
+ sprintf(buf, "path %s (addpath rxid %d)", pi->peer->host,
+ pi->addpath_rx_id);
else
- sprintf(buf, "path %s", ri->peer->host);
+ sprintf(buf, "path %s", pi->peer->host);
}
/* Compare two bgp route entity. If 'new' is preferable over 'exist' return 1.
const char *rmap_name)
{
struct bgp_filter *filter;
- struct bgp_path_info info;
+ struct bgp_path_info rmap_path;
route_map_result_t ret;
struct route_map *rmap = NULL;
/* Route map apply. */
if (rmap) {
- memset(&info, 0, sizeof(struct bgp_path_info));
+ memset(&rmap_path, 0, sizeof(struct bgp_path_info));
/* Duplicate current value to new strucutre for modification. */
- info.peer = peer;
- info.attr = attr;
+ rmap_path.peer = peer;
+ rmap_path.attr = attr;
SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN);
/* Apply BGP route map to the attribute. */
- ret = route_map_apply(rmap, p, RMAP_BGP, &info);
+ ret = route_map_apply(rmap, p, RMAP_BGP, &rmap_path);
peer->rmap_type = 0;
struct attr *attr, afi_t afi, safi_t safi,
const char *rmap_name)
{
- struct bgp_path_info info;
+ struct bgp_path_info rmap_path;
route_map_result_t ret;
struct route_map *rmap = NULL;
uint8_t rmap_type;
if (rmap == NULL)
return RMAP_DENY;
- memset(&info, 0, sizeof(struct bgp_path_info));
+ memset(&rmap_path, 0, sizeof(struct bgp_path_info));
/* Route map apply. */
/* Duplicate current value to new strucutre for modification. */
- info.peer = peer;
- info.attr = attr;
+ rmap_path.peer = peer;
+ rmap_path.attr = attr;
rmap_type = peer->rmap_type;
SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT);
/* Apply BGP route map to the attribute. */
- ret = route_map_apply(rmap, p, RMAP_BGP, &info);
+ ret = route_map_apply(rmap, p, RMAP_BGP, &rmap_path);
peer->rmap_type = rmap_type;
memset(&attr->mp_nexthop_global_in, 0, BGP_ATTR_NHLEN_IPV4);
}
-int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *ri,
+int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi,
struct update_subgroup *subgrp, struct prefix *p,
struct attr *attr)
{
struct peer *peer;
struct peer *onlypeer;
struct bgp *bgp;
- struct attr *riattr;
+ struct attr *piattr;
char buf[PREFIX_STRLEN];
int ret;
int transparent;
if (CHECK_FLAG(peer->flags, PEER_FLAG_LONESOUL))
onlypeer = SUBGRP_PFIRST(subgrp)->peer;
- from = ri->peer;
+ from = pi->peer;
filter = &peer->filter[afi][safi];
bgp = SUBGRP_INST(subgrp);
- riattr = bgp_path_info_mpath_count(ri) ? bgp_path_info_mpath_attr(ri)
- : ri->attr;
+ piattr = bgp_path_info_mpath_count(pi) ? bgp_path_info_mpath_attr(pi)
+ : pi->attr;
#if ENABLE_BGP_VNC
if (((afi == AFI_IP) || (afi == AFI_IP6)) && (safi == SAFI_MPLS_VPN)
- && ((ri->type == ZEBRA_ROUTE_BGP_DIRECT)
- || (ri->type == ZEBRA_ROUTE_BGP_DIRECT_EXT))) {
+ && ((pi->type == ZEBRA_ROUTE_BGP_DIRECT)
+ || (pi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT))) {
/*
* direct and direct_ext type routes originate internally even
if (((afi == AFI_IP) || (afi == AFI_IP6))
&& ((safi == SAFI_MPLS_VPN) || (safi == SAFI_UNICAST))
- && (ri->type == ZEBRA_ROUTE_BGP)
- && (ri->sub_type == BGP_ROUTE_IMPORTED)) {
+ && (pi->type == ZEBRA_ROUTE_BGP)
+ && (pi->sub_type == BGP_ROUTE_IMPORTED)) {
/* Applies to routes leaked vpn->vrf and vrf->vpn */
}
/* With addpath we may be asked to TX all kinds of paths so make sure
- * ri is valid */
- if (!CHECK_FLAG(ri->flags, BGP_PATH_VALID)
- || CHECK_FLAG(ri->flags, BGP_PATH_HISTORY)
- || CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) {
+ * pi is valid */
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID)
+ || CHECK_FLAG(pi->flags, BGP_PATH_HISTORY)
+ || CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
return 0;
}
/* If this is not the bestpath then check to see if there is an enabled
* addpath
* feature that requires us to advertise it */
- if (!CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) {
- if (!bgp_addpath_tx_path(peer, afi, safi, ri)) {
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
+ if (!bgp_addpath_tx_path(peer, afi, safi, pi)) {
return 0;
}
}
/* Aggregate-address suppress check. */
- if (ri->extra && ri->extra->suppress)
+ if (pi->extra && pi->extra->suppress)
if (!UNSUPPRESS_MAP_NAME(filter)) {
return 0;
}
* off box as that the RT and RD created are localy
* significant and globaly useless.
*/
- if (safi == SAFI_MPLS_VPN && ri->extra && ri->extra->num_labels
- && ri->extra->label[0] == BGP_PREVENT_VRF_2_VRF_LEAK)
+ if (safi == SAFI_MPLS_VPN && pi->extra && pi->extra->num_labels
+ && pi->extra->label[0] == BGP_PREVENT_VRF_2_VRF_LEAK)
return 0;
/* If it's labeled safi, make sure the route has a valid label. */
if (safi == SAFI_LABELED_UNICAST) {
- mpls_label_t label = bgp_adv_label(rn, ri, peer, afi, safi);
+ mpls_label_t label = bgp_adv_label(rn, pi, peer, afi, safi);
if (!bgp_is_valid_label(&label)) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug("u%" PRIu64 ":s%" PRIu64
transparent = 0;
/* If community is not disabled check the no-export and local. */
- if (!transparent && bgp_community_filter(peer, riattr)) {
+ if (!transparent && bgp_community_filter(peer, piattr)) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug(
"subgrpannouncecheck: community filter check fail");
/* If the attribute has originator-id and it is same as remote
peer's id. */
- if (onlypeer && riattr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)
- && (IPV4_ADDR_SAME(&onlypeer->remote_id, &riattr->originator_id))) {
+ if (onlypeer && piattr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)
+ && (IPV4_ADDR_SAME(&onlypeer->remote_id, &piattr->originator_id))) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug(
"%s [Update:SEND] %s originator-id is same as "
}
/* Output filter check. */
- if (bgp_output_filter(peer, p, riattr, afi, safi) == FILTER_DENY) {
+ if (bgp_output_filter(peer, p, piattr, afi, safi) == FILTER_DENY) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug("%s [Update:SEND] %s is filtered",
peer->host, prefix2str(p, buf, sizeof(buf)));
#ifdef BGP_SEND_ASPATH_CHECK
/* AS path loop check. */
- if (onlypeer && aspath_loop_check(riattr->aspath, onlypeer->as)) {
+ if (onlypeer && aspath_loop_check(piattr->aspath, onlypeer->as)) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug(
"%s [Update:SEND] suppress announcement to peer AS %u "
/* If we're a CONFED we need to loop check the CONFED ID too */
if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) {
- if (aspath_loop_check(riattr->aspath, bgp->confed_id)) {
+ if (aspath_loop_check(piattr->aspath, bgp->confed_id)) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug(
"%s [Update:SEND] suppress announcement to peer AS %u"
}
/* For modify attribute, copy it to temporary structure. */
- bgp_attr_dup(attr, riattr);
+ bgp_attr_dup(attr, piattr);
/* If local-preference is not set. */
if ((peer->sort == BGP_PEER_IBGP || peer->sort == BGP_PEER_CONFED)
bgp_peer_as_override(bgp, afi, safi, peer, attr);
/* Route map & unsuppress-map apply. */
- if (ROUTE_MAP_OUT_NAME(filter) || (ri->extra && ri->extra->suppress)) {
- struct bgp_path_info info;
- struct bgp_path_info_extra dummy_info_extra;
+ if (ROUTE_MAP_OUT_NAME(filter) || (pi->extra && pi->extra->suppress)) {
+ struct bgp_path_info rmap_path;
+ struct bgp_path_info_extra dummy_rmap_path_extra;
struct attr dummy_attr;
- memset(&info, 0, sizeof(struct bgp_path_info));
- info.peer = peer;
- info.attr = attr;
+ memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ rmap_path.peer = peer;
+ rmap_path.attr = attr;
- if (ri->extra) {
- memcpy(&dummy_info_extra, ri->extra,
+ if (pi->extra) {
+ memcpy(&dummy_rmap_path_extra, pi->extra,
sizeof(struct bgp_path_info_extra));
- info.extra = &dummy_info_extra;
+ rmap_path.extra = &dummy_rmap_path_extra;
}
/* don't confuse inbound and outbound setting */
&& !bgp_flag_check(bgp,
BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
bgp_attr_dup(&dummy_attr, attr);
- info.attr = &dummy_attr;
+ rmap_path.attr = &dummy_attr;
}
SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT);
- if (ri->extra && ri->extra->suppress)
+ if (pi->extra && pi->extra->suppress)
ret = route_map_apply(UNSUPPRESS_MAP(filter), p,
- RMAP_BGP, &info);
+ RMAP_BGP, &rmap_path);
else
ret = route_map_apply(ROUTE_MAP_OUT(filter), p,
- RMAP_BGP, &info);
+ RMAP_BGP, &rmap_path);
peer->rmap_type = 0;
* it is configured as 'peer-address'.
*/
if (!bgp_rmap_nhop_changed(attr->rmap_change_flags,
- riattr->rmap_change_flags)
+ piattr->rmap_change_flags)
&& !transparent
&& !CHECK_FLAG(peer->af_flags[afi][safi],
PEER_FLAG_NEXTHOP_UNCHANGED)) {
* Note: 3rd party nexthop currently implemented for
* IPv4 only.
*/
- if (!bgp_subgrp_multiaccess_check_v4(riattr->nexthop,
+ if (!bgp_subgrp_multiaccess_check_v4(piattr->nexthop,
subgrp))
subgroup_announce_reset_nhop(
(peer_cap_enhe(peer, afi, safi)
? AF_INET6
: p->family),
attr);
- } else if (CHECK_FLAG(ri->flags, BGP_PATH_ANNC_NH_SELF)) {
+ } else if (CHECK_FLAG(pi->flags, BGP_PATH_ANNC_NH_SELF)) {
/*
* This flag is used for leaked vpn-vrf routes
*/
{
struct bgp_path_info *new_select;
struct bgp_path_info *old_select;
- struct bgp_path_info *ri;
- struct bgp_path_info *ri1;
- struct bgp_path_info *ri2;
- struct bgp_path_info *nextri = NULL;
+ struct bgp_path_info *pi;
+ struct bgp_path_info *pi1;
+ struct bgp_path_info *pi2;
+ struct bgp_path_info *nextpi = NULL;
int paths_eq, do_mpath, debug;
struct list mp_list;
char pfx_buf[PREFIX2STR_BUFFER];
if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) {
/* Clear BGP_PATH_DMED_SELECTED for all paths */
- for (ri1 = rn->info; ri1; ri1 = ri1->next)
- bgp_path_info_unset_flag(rn, ri1,
+ for (pi1 = rn->info; pi1; pi1 = pi1->next)
+ bgp_path_info_unset_flag(rn, pi1,
BGP_PATH_DMED_SELECTED);
- for (ri1 = rn->info; ri1; ri1 = ri1->next) {
- if (CHECK_FLAG(ri1->flags, BGP_PATH_DMED_CHECK))
+ for (pi1 = rn->info; pi1; pi1 = pi1->next) {
+ if (CHECK_FLAG(pi1->flags, BGP_PATH_DMED_CHECK))
continue;
- if (BGP_PATH_HOLDDOWN(ri1))
+ if (BGP_PATH_HOLDDOWN(pi1))
continue;
- if (ri1->peer && ri1->peer != bgp->peer_self)
- if (ri1->peer->status != Established)
+ if (pi1->peer && pi1->peer != bgp->peer_self)
+ if (pi1->peer->status != Established)
continue;
- new_select = ri1;
- if (ri1->next) {
- for (ri2 = ri1->next; ri2; ri2 = ri2->next) {
- if (CHECK_FLAG(ri2->flags,
+ new_select = pi1;
+ if (pi1->next) {
+ for (pi2 = pi1->next; pi2; pi2 = pi2->next) {
+ if (CHECK_FLAG(pi2->flags,
BGP_PATH_DMED_CHECK))
continue;
- if (BGP_PATH_HOLDDOWN(ri2))
+ if (BGP_PATH_HOLDDOWN(pi2))
continue;
- if (ri2->peer
- && ri2->peer != bgp->peer_self
+ if (pi2->peer
+ && pi2->peer != bgp->peer_self
&& !CHECK_FLAG(
- ri2->peer->sflags,
+ pi2->peer->sflags,
PEER_STATUS_NSF_WAIT))
- if (ri2->peer->status
+ if (pi2->peer->status
!= Established)
continue;
- if (aspath_cmp_left(ri1->attr->aspath,
- ri2->attr->aspath)
+ if (aspath_cmp_left(pi1->attr->aspath,
+ pi2->attr->aspath)
|| aspath_cmp_left_confed(
- ri1->attr->aspath,
- ri2->attr->aspath)) {
+ pi1->attr->aspath,
+ pi2->attr->aspath)) {
if (bgp_path_info_cmp(
- bgp, ri2,
+ bgp, pi2,
new_select,
&paths_eq,
mpath_cfg, debug,
bgp_path_info_unset_flag(
rn, new_select,
BGP_PATH_DMED_SELECTED);
- new_select = ri2;
+ new_select = pi2;
}
bgp_path_info_set_flag(
- rn, ri2,
+ rn, pi2,
BGP_PATH_DMED_CHECK);
}
}
/* Check old selected route and new selected route. */
old_select = NULL;
new_select = NULL;
- for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1);
- ri = nextri) {
- if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED))
- old_select = ri;
+ for (pi = rn->info; (pi != NULL) && (nextpi = pi->next, 1);
+ pi = nextpi) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED))
+ old_select = pi;
- if (BGP_PATH_HOLDDOWN(ri)) {
+ if (BGP_PATH_HOLDDOWN(pi)) {
/* reap REMOVED routes, if needs be
* selected route must stay for a while longer though
*/
- if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)
- && (ri != old_select))
- bgp_path_info_reap(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)
+ && (pi != old_select))
+ bgp_path_info_reap(rn, pi);
if (debug)
- zlog_debug("%s: ri %p in holddown", __func__,
- ri);
+ zlog_debug("%s: pi %p in holddown", __func__,
+ pi);
continue;
}
- if (ri->peer && ri->peer != bgp->peer_self
- && !CHECK_FLAG(ri->peer->sflags, PEER_STATUS_NSF_WAIT))
- if (ri->peer->status != Established) {
+ if (pi->peer && pi->peer != bgp->peer_self
+ && !CHECK_FLAG(pi->peer->sflags, PEER_STATUS_NSF_WAIT))
+ if (pi->peer->status != Established) {
if (debug)
zlog_debug(
- "%s: ri %p non self peer %s not estab state",
- __func__, ri, ri->peer->host);
+ "%s: pi %p non self peer %s not estab state",
+ __func__, pi, pi->peer->host);
continue;
}
if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)
- && (!CHECK_FLAG(ri->flags, BGP_PATH_DMED_SELECTED))) {
- bgp_path_info_unset_flag(rn, ri, BGP_PATH_DMED_CHECK);
+ && (!CHECK_FLAG(pi->flags, BGP_PATH_DMED_SELECTED))) {
+ bgp_path_info_unset_flag(rn, pi, BGP_PATH_DMED_CHECK);
if (debug)
- zlog_debug("%s: ri %p dmed", __func__, ri);
+ zlog_debug("%s: pi %p dmed", __func__, pi);
continue;
}
- bgp_path_info_unset_flag(rn, ri, BGP_PATH_DMED_CHECK);
+ bgp_path_info_unset_flag(rn, pi, BGP_PATH_DMED_CHECK);
- if (bgp_path_info_cmp(bgp, ri, new_select, &paths_eq, mpath_cfg,
+ if (bgp_path_info_cmp(bgp, pi, new_select, &paths_eq, mpath_cfg,
debug, pfx_buf, afi, safi)) {
- new_select = ri;
+ new_select = pi;
}
}
}
if (do_mpath && new_select) {
- for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1);
- ri = nextri) {
+ for (pi = rn->info; (pi != NULL) && (nextpi = pi->next, 1);
+ pi = nextpi) {
if (debug)
bgp_path_info_path_with_addpath_rx_str(
- ri, path_buf);
+ pi, path_buf);
- if (ri == new_select) {
+ if (pi == new_select) {
if (debug)
zlog_debug(
"%s: %s is the bestpath, add to the multipath list",
pfx_buf, path_buf);
- bgp_mp_list_add(&mp_list, ri);
+ bgp_mp_list_add(&mp_list, pi);
continue;
}
- if (BGP_PATH_HOLDDOWN(ri))
+ if (BGP_PATH_HOLDDOWN(pi))
continue;
- if (ri->peer && ri->peer != bgp->peer_self
- && !CHECK_FLAG(ri->peer->sflags,
+ if (pi->peer && pi->peer != bgp->peer_self
+ && !CHECK_FLAG(pi->peer->sflags,
PEER_STATUS_NSF_WAIT))
- if (ri->peer->status != Established)
+ if (pi->peer->status != Established)
continue;
- if (!bgp_path_info_nexthop_cmp(ri, new_select)) {
+ if (!bgp_path_info_nexthop_cmp(pi, new_select)) {
if (debug)
zlog_debug(
"%s: %s has the same nexthop as the bestpath, skip it",
continue;
}
- bgp_path_info_cmp(bgp, ri, new_select, &paths_eq,
+ bgp_path_info_cmp(bgp, pi, new_select, &paths_eq,
mpath_cfg, debug, pfx_buf, afi, safi);
if (paths_eq) {
zlog_debug(
"%s: %s is equivalent to the bestpath, add to the multipath list",
pfx_buf, path_buf);
- bgp_mp_list_add(&mp_list, ri);
+ bgp_mp_list_add(&mp_list, pi);
}
}
}
*/
void bgp_zebra_clear_route_change_flags(struct bgp_node *rn)
{
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
- for (ri = rn->info; ri; ri = ri->next) {
- if (BGP_PATH_HOLDDOWN(ri))
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (BGP_PATH_HOLDDOWN(pi))
continue;
- UNSET_FLAG(ri->flags, BGP_PATH_IGP_CHANGED);
- UNSET_FLAG(ri->flags, BGP_PATH_ATTR_CHANGED);
+ UNSET_FLAG(pi->flags, BGP_PATH_IGP_CHANGED);
+ UNSET_FLAG(pi->flags, BGP_PATH_ATTR_CHANGED);
}
}
/* Unconditionally remove the route from the RIB, without taking
* damping into consideration (eg, because the session went down)
*/
-void bgp_rib_remove(struct bgp_node *rn, struct bgp_path_info *ri,
+void bgp_rib_remove(struct bgp_node *rn, struct bgp_path_info *pi,
struct peer *peer, afi_t afi, safi_t safi)
{
- bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi, safi);
+ bgp_aggregate_decrement(peer->bgp, &rn->p, pi, afi, safi);
- if (!CHECK_FLAG(ri->flags, BGP_PATH_HISTORY))
- bgp_path_info_delete(rn, ri); /* keep historical info */
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_HISTORY))
+ bgp_path_info_delete(rn, pi); /* keep historical info */
bgp_process(peer->bgp, rn, afi, safi);
}
-static void bgp_rib_withdraw(struct bgp_node *rn, struct bgp_path_info *ri,
+static void bgp_rib_withdraw(struct bgp_node *rn, struct bgp_path_info *pi,
struct peer *peer, afi_t afi, safi_t safi,
struct prefix_rd *prd)
{
*/
if (CHECK_FLAG(peer->bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)
&& peer->sort == BGP_PEER_EBGP)
- if ((bgp_damp_withdraw(ri, rn, afi, safi, 0))
+ if ((bgp_damp_withdraw(pi, rn, afi, safi, 0))
== BGP_DAMP_SUPPRESSED) {
- bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi,
+ bgp_aggregate_decrement(peer->bgp, &rn->p, pi, afi,
safi);
return;
}
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
- peer->bgp, prd, table, &rn->p, ri);
+ peer->bgp, prd, table, &rn->p, pi);
}
bgp_unlock_node(prn);
}
if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) {
- if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
- vnc_import_bgp_del_route(peer->bgp, &rn->p, ri);
+ vnc_import_bgp_del_route(peer->bgp, &rn->p, pi);
vnc_import_bgp_exterior_del_route(peer->bgp, &rn->p,
- ri);
+ pi);
}
}
#endif
/* If this is an EVPN route, process for un-import. */
if (safi == SAFI_EVPN)
- bgp_evpn_unimport_route(peer->bgp, afi, safi, &rn->p, ri);
+ bgp_evpn_unimport_route(peer->bgp, afi, safi, &rn->p, pi);
- bgp_rib_remove(rn, ri, peer, afi, safi);
+ bgp_rib_remove(rn, pi, peer, afi, safi);
}
struct bgp_path_info *info_make(int type, int sub_type, unsigned short instance,
}
}
-static bool overlay_index_equal(afi_t afi, struct bgp_path_info *info,
+static bool overlay_index_equal(afi_t afi, struct bgp_path_info *path,
struct eth_segment_id *eth_s_id,
union gw_addr *gw_ip)
{
- struct eth_segment_id *info_eth_s_id, *info_eth_s_id_remote;
- union gw_addr *info_gw_ip, *info_gw_ip_remote;
+ struct eth_segment_id *path_eth_s_id, *path_eth_s_id_remote;
+ union gw_addr *path_gw_ip, *path_gw_ip_remote;
union {
struct eth_segment_id esi;
union gw_addr ip;
if (afi != AFI_L2VPN)
return true;
- if (!info->attr) {
+ if (!path->attr) {
memset(&temp, 0, sizeof(temp));
- info_eth_s_id = &temp.esi;
- info_gw_ip = &temp.ip;
+ path_eth_s_id = &temp.esi;
+ path_gw_ip = &temp.ip;
if (eth_s_id == NULL && gw_ip == NULL)
return true;
} else {
- info_eth_s_id = &(info->attr->evpn_overlay.eth_s_id);
- info_gw_ip = &(info->attr->evpn_overlay.gw_ip);
+ path_eth_s_id = &(path->attr->evpn_overlay.eth_s_id);
+ path_gw_ip = &(path->attr->evpn_overlay.gw_ip);
}
if (gw_ip == NULL) {
memset(&temp, 0, sizeof(temp));
- info_gw_ip_remote = &temp.ip;
+ path_gw_ip_remote = &temp.ip;
} else
- info_gw_ip_remote = gw_ip;
+ path_gw_ip_remote = gw_ip;
if (eth_s_id == NULL) {
memset(&temp, 0, sizeof(temp));
- info_eth_s_id_remote = &temp.esi;
+ path_eth_s_id_remote = &temp.esi;
} else
- info_eth_s_id_remote = eth_s_id;
+ path_eth_s_id_remote = eth_s_id;
- if (!memcmp(info_gw_ip, info_gw_ip_remote, sizeof(union gw_addr)))
+ if (!memcmp(path_gw_ip, path_gw_ip_remote, sizeof(union gw_addr)))
return false;
- return !memcmp(info_eth_s_id, info_eth_s_id_remote,
+ return !memcmp(path_eth_s_id, path_eth_s_id_remote,
sizeof(struct eth_segment_id));
}
struct bgp *bgp;
struct attr new_attr;
struct attr *attr_new;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_path_info *new;
struct bgp_path_info_extra *extra;
const char *reason;
bgp_adj_in_set(rn, peer, attr, addpath_id);
/* Check previously received route. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == peer && ri->type == type
- && ri->sub_type == sub_type
- && ri->addpath_rx_id == addpath_id)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == peer && pi->type == type
+ && pi->sub_type == sub_type
+ && pi->addpath_rx_id == addpath_id)
break;
/* AS path local-as loop check. */
attr_new = bgp_attr_intern(&new_attr);
/* If the update is implicit withdraw. */
- if (ri) {
- ri->uptime = bgp_clock();
- same_attr = attrhash_cmp(ri->attr, attr_new);
+ if (pi) {
+ pi->uptime = bgp_clock();
+ same_attr = attrhash_cmp(pi->attr, attr_new);
/* Same attribute comes in. */
- if (!CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)
- && attrhash_cmp(ri->attr, attr_new)
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)
+ && attrhash_cmp(pi->attr, attr_new)
&& (!has_valid_label
- || memcmp(&(bgp_path_info_extra_get(ri))->label, label,
+ || memcmp(&(bgp_path_info_extra_get(pi))->label, label,
num_labels * sizeof(mpls_label_t))
== 0)
&& (overlay_index_equal(
- afi, ri, evpn == NULL ? NULL : &evpn->eth_s_id,
+ afi, pi, evpn == NULL ? NULL : &evpn->eth_s_id,
evpn == NULL ? NULL : &evpn->gw_ip))) {
if (CHECK_FLAG(bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING)
&& peer->sort == BGP_PEER_EBGP
- && CHECK_FLAG(ri->flags, BGP_PATH_HISTORY)) {
+ && CHECK_FLAG(pi->flags, BGP_PATH_HISTORY)) {
if (bgp_debug_update(peer, p, NULL, 1)) {
bgp_debug_rdpfxpath2str(
afi, safi, prd, p, label,
pfx_buf);
}
- if (bgp_damp_update(ri, rn, afi, safi)
+ if (bgp_damp_update(pi, rn, afi, safi)
!= BGP_DAMP_SUPPRESSED) {
- bgp_aggregate_increment(bgp, p, ri, afi,
+ bgp_aggregate_increment(bgp, p, pi, afi,
safi);
bgp_process(bgp, rn, afi, safi);
}
}
/* graceful restart STALE flag unset. */
- if (CHECK_FLAG(ri->flags, BGP_PATH_STALE)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_STALE)) {
bgp_path_info_unset_flag(
- rn, ri, BGP_PATH_STALE);
+ rn, pi, BGP_PATH_STALE);
bgp_process(bgp, rn, afi, safi);
}
}
}
/* Withdraw/Announce before we fully processed the withdraw */
- if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
if (bgp_debug_update(peer, p, NULL, 1)) {
bgp_debug_rdpfxpath2str(
afi, safi, prd, p, label, num_labels,
peer->host, pfx_buf);
}
- bgp_path_info_restore(rn, ri);
+ bgp_path_info_restore(rn, pi);
}
/* Received Logging. */
}
/* graceful restart STALE flag unset. */
- if (CHECK_FLAG(ri->flags, BGP_PATH_STALE))
- bgp_path_info_unset_flag(rn, ri, BGP_PATH_STALE);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_STALE))
+ bgp_path_info_unset_flag(rn, pi, BGP_PATH_STALE);
/* The attribute is changed. */
- bgp_path_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_ATTR_CHANGED);
/* implicit withdraw, decrement aggregate and pcount here.
* only if update is accepted, they'll increment below.
*/
- bgp_aggregate_decrement(bgp, p, ri, afi, safi);
+ bgp_aggregate_decrement(bgp, p, pi, afi, safi);
/* Update bgp route dampening information. */
if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)
/* This is implicit withdraw so we should update
dampening
information. */
- if (!CHECK_FLAG(ri->flags, BGP_PATH_HISTORY))
- bgp_damp_withdraw(ri, rn, afi, safi, 1);
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_HISTORY))
+ bgp_damp_withdraw(pi, rn, afi, safi, 1);
}
#if ENABLE_BGP_VNC
if (safi == SAFI_MPLS_VPN) {
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
- bgp, prd, table, p, ri);
+ bgp, prd, table, p, pi);
}
bgp_unlock_node(prn);
}
if ((afi == AFI_IP || afi == AFI_IP6)
&& (safi == SAFI_UNICAST)) {
- if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
/*
* Implicit withdraw case.
*/
++vnc_implicit_withdraw;
- vnc_import_bgp_del_route(bgp, p, ri);
- vnc_import_bgp_exterior_del_route(bgp, p, ri);
+ vnc_import_bgp_del_route(bgp, p, pi);
+ vnc_import_bgp_exterior_del_route(bgp, p, pi);
}
}
#endif
* community.
*/
if (safi == SAFI_EVPN && !same_attr) {
- if ((ri->attr->flag
+ if ((pi->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES))
&& (attr_new->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES))) {
int cmp;
- cmp = ecommunity_cmp(ri->attr->ecommunity,
+ cmp = ecommunity_cmp(pi->attr->ecommunity,
attr_new->ecommunity);
if (!cmp) {
if (bgp_debug_update(peer, p, NULL, 1))
zlog_debug(
"Change in EXT-COMM, existing %s new %s",
ecommunity_str(
- ri->attr->ecommunity),
+ pi->attr->ecommunity),
ecommunity_str(
attr_new->ecommunity));
bgp_evpn_unimport_route(bgp, afi, safi,
- p, ri);
+ p, pi);
}
}
}
/* Update to new attribute. */
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
/* Update MPLS label */
if (has_valid_label) {
- extra = bgp_path_info_extra_get(ri);
+ extra = bgp_path_info_extra_get(pi);
memcpy(&extra->label, label,
num_labels * sizeof(mpls_label_t));
extra->num_labels = num_labels;
* changes) which
* trigger re-importation of the entire RIB.
*/
- vnc_import_bgp_add_route(bgp, p, ri);
- vnc_import_bgp_exterior_add_route(bgp, p, ri);
+ vnc_import_bgp_add_route(bgp, p, pi);
+ vnc_import_bgp_exterior_add_route(bgp, p, pi);
}
}
#endif
/* Update Overlay Index */
if (afi == AFI_L2VPN) {
overlay_index_update(
- ri->attr, evpn == NULL ? NULL : &evpn->eth_s_id,
+ pi->attr, evpn == NULL ? NULL : &evpn->eth_s_id,
evpn == NULL ? NULL : &evpn->gw_ip);
}
if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)
&& peer->sort == BGP_PEER_EBGP) {
/* Now we do normal update dampening. */
- ret = bgp_damp_update(ri, rn, afi, safi);
+ ret = bgp_damp_update(pi, rn, afi, safi);
if (ret == BGP_DAMP_SUPPRESSED) {
bgp_unlock_node(rn);
return 0;
struct bgp *bgp_nexthop = bgp;
- if (ri->extra && ri->extra->bgp_orig)
- bgp_nexthop = ri->extra->bgp_orig;
+ if (pi->extra && pi->extra->bgp_orig)
+ bgp_nexthop = pi->extra->bgp_orig;
- if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, afi,
- ri, NULL, connected)
+ if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, afi, pi,
+ NULL, connected)
|| CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD))
- bgp_path_info_set_flag(rn, ri, BGP_PATH_VALID);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_VALID);
else {
if (BGP_DEBUG(nht, NHT)) {
char buf1[INET6_ADDRSTRLEN];
zlog_debug("%s(%s): NH unresolved",
__FUNCTION__, buf1);
}
- bgp_path_info_unset_flag(rn, ri,
+ bgp_path_info_unset_flag(rn, pi,
BGP_PATH_VALID);
}
} else
- bgp_path_info_set_flag(rn, ri, BGP_PATH_VALID);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_VALID);
#if ENABLE_BGP_VNC
if (safi == SAFI_MPLS_VPN) {
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
- bgp, prd, table, p, ri);
+ bgp, prd, table, p, pi);
}
bgp_unlock_node(prn);
}
* the attributes for the route in the VNI(s).
*/
if (safi == SAFI_EVPN && !same_attr)
- bgp_evpn_import_route(bgp, afi, safi, p, ri);
+ bgp_evpn_import_route(bgp, afi, safi, p, pi);
/* Process change. */
- bgp_aggregate_increment(bgp, p, ri, afi, safi);
+ bgp_aggregate_increment(bgp, p, pi, afi, safi);
bgp_process(bgp, rn, afi, safi);
bgp_unlock_node(rn);
&& (bgp->inst_type == BGP_INSTANCE_TYPE_VRF
|| bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_from_vrf_update(bgp_get_default(), bgp, ri);
+ vpn_leak_from_vrf_update(bgp_get_default(), bgp, pi);
}
if ((SAFI_MPLS_VPN == safi)
&& (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_to_vrf_update(bgp, ri);
+ vpn_leak_to_vrf_update(bgp, pi);
}
#if ENABLE_BGP_VNC
peer->host, pfx_buf, reason);
}
- if (ri) {
+ if (pi) {
/* If this is an EVPN route, un-import it as it is now filtered.
*/
if (safi == SAFI_EVPN)
- bgp_evpn_unimport_route(bgp, afi, safi, p, ri);
+ bgp_evpn_unimport_route(bgp, afi, safi, p, pi);
if (SAFI_UNICAST == safi
&& (bgp->inst_type == BGP_INSTANCE_TYPE_VRF
|| bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, ri);
+ vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, pi);
}
if ((SAFI_MPLS_VPN == safi)
&& (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_to_vrf_withdraw(bgp, ri);
+ vpn_leak_to_vrf_withdraw(bgp, pi);
}
- bgp_rib_remove(rn, ri, peer, afi, safi);
+ bgp_rib_remove(rn, pi, peer, afi, safi);
}
bgp_unlock_node(rn);
struct bgp *bgp;
char pfx_buf[BGP_PRD_PATH_STRLEN];
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
#if ENABLE_BGP_VNC
if ((SAFI_MPLS_VPN == safi) || (SAFI_ENCAP == safi)) {
}
/* Lookup withdrawn route. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == peer && ri->type == type
- && ri->sub_type == sub_type
- && ri->addpath_rx_id == addpath_id)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == peer && pi->type == type
+ && pi->sub_type == sub_type
+ && pi->addpath_rx_id == addpath_id)
break;
/* Logging. */
}
/* Withdraw specified route from routing table. */
- if (ri && !CHECK_FLAG(ri->flags, BGP_PATH_HISTORY)) {
- bgp_rib_withdraw(rn, ri, peer, afi, safi, prd);
+ if (pi && !CHECK_FLAG(pi->flags, BGP_PATH_HISTORY)) {
+ bgp_rib_withdraw(rn, pi, peer, afi, safi, prd);
if (SAFI_UNICAST == safi
&& (bgp->inst_type == BGP_INSTANCE_TYPE_VRF
|| bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, ri);
+ vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, pi);
}
if ((SAFI_MPLS_VPN == safi)
&& (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_to_vrf_withdraw(bgp, ri);
+ vpn_leak_to_vrf_withdraw(bgp, pi);
}
} else if (bgp_debug_update(peer, p, NULL, 1)) {
bgp_debug_rdpfxpath2str(afi, safi, prd, p, label, num_labels,
if (ain->peer != peer)
continue;
- struct bgp_path_info *ri = rn->info;
+ struct bgp_path_info *pi = rn->info;
uint32_t num_labels = 0;
mpls_label_t *label_pnt = NULL;
- if (ri && ri->extra)
- num_labels = ri->extra->num_labels;
+ if (pi && pi->extra)
+ num_labels = pi->extra->num_labels;
if (num_labels)
- label_pnt = &ri->extra->label[0];
+ label_pnt = &pi->extra->label[0];
ret = bgp_update(peer, &rn->p, ain->addpath_rx_id,
ain->attr, afi, safi, ZEBRA_ROUTE_BGP,
struct bgp_clear_node_queue *cnq = data;
struct bgp_node *rn = cnq->rn;
struct peer *peer = wq->spec.data;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp *bgp;
afi_t afi = bgp_node_table(rn)->afi;
safi_t safi = bgp_node_table(rn)->safi;
/* It is possible that we have multiple paths for a prefix from a peer
* if that peer is using AddPath.
*/
- for (ri = rn->info; ri; ri = ri->next) {
- if (ri->peer != peer)
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (pi->peer != peer)
continue;
/* graceful restart STALE flag set. */
if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)
&& peer->nsf[afi][safi]
- && !CHECK_FLAG(ri->flags, BGP_PATH_STALE)
- && !CHECK_FLAG(ri->flags, BGP_PATH_UNUSEABLE))
- bgp_path_info_set_flag(rn, ri, BGP_PATH_STALE);
+ && !CHECK_FLAG(pi->flags, BGP_PATH_STALE)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_UNUSEABLE))
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_STALE);
else {
/* If this is an EVPN route, process for
* un-import. */
if (safi == SAFI_EVPN)
- bgp_evpn_unimport_route(bgp, afi, safi,
- &rn->p, ri);
+ bgp_evpn_unimport_route(bgp, afi, safi, &rn->p,
+ pi);
/* Handle withdraw for VRF route-leaking and L3VPN */
if (SAFI_UNICAST == safi
&& (bgp->inst_type == BGP_INSTANCE_TYPE_VRF ||
bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
vpn_leak_from_vrf_withdraw(bgp_get_default(),
- bgp, ri);
+ bgp, pi);
}
if (SAFI_MPLS_VPN == safi &&
bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
- vpn_leak_to_vrf_withdraw(bgp, ri);
+ vpn_leak_to_vrf_withdraw(bgp, pi);
}
- bgp_rib_remove(rn, ri, peer, afi, safi);
+ bgp_rib_remove(rn, pi, peer, afi, safi);
}
}
return WQ_SUCCESS;
return;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- struct bgp_path_info *ri, *next;
+ struct bgp_path_info *pi, *next;
struct bgp_adj_in *ain;
struct bgp_adj_in *ain_next;
ain = ain_next;
}
- for (ri = rn->info; ri; ri = next) {
- next = ri->next;
- if (ri->peer != peer)
+ for (pi = rn->info; pi; pi = next) {
+ next = pi->next;
+ if (pi->peer != peer)
continue;
if (force)
- bgp_path_info_reap(rn, ri);
+ bgp_path_info_reap(rn, pi);
else {
struct bgp_clear_node_queue *cnq;
void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_table *table;
if (safi == SAFI_MPLS_VPN) {
for (rm = bgp_table_top(table); rm;
rm = bgp_route_next(rm))
- for (ri = rm->info; ri; ri = ri->next) {
- if (ri->peer != peer)
+ for (pi = rm->info; pi; pi = pi->next) {
+ if (pi->peer != peer)
continue;
- if (!CHECK_FLAG(ri->flags,
+ if (!CHECK_FLAG(pi->flags,
BGP_PATH_STALE))
break;
- bgp_rib_remove(rm, ri, peer, afi, safi);
+ bgp_rib_remove(rm, pi, peer, afi, safi);
break;
}
}
} else {
for (rn = bgp_table_top(peer->bgp->rib[afi][safi]); rn;
rn = bgp_route_next(rn))
- for (ri = rn->info; ri; ri = ri->next) {
- if (ri->peer != peer)
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (pi->peer != peer)
continue;
- if (!CHECK_FLAG(ri->flags, BGP_PATH_STALE))
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_STALE))
break;
- bgp_rib_remove(rn, ri, peer, afi, safi);
+ bgp_rib_remove(rn, pi, peer, afi, safi);
break;
}
}
safi_t safi)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_path_info *next;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
- for (ri = rn->info; ri; ri = next) {
- next = ri->next;
- if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)
- && ri->type == ZEBRA_ROUTE_BGP
- && (ri->sub_type == BGP_ROUTE_NORMAL
- || ri->sub_type == BGP_ROUTE_AGGREGATE
- || ri->sub_type == BGP_ROUTE_IMPORTED)) {
+ for (pi = rn->info; pi; pi = next) {
+ next = pi->next;
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)
+ && pi->type == ZEBRA_ROUTE_BGP
+ && (pi->sub_type == BGP_ROUTE_NORMAL
+ || pi->sub_type == BGP_ROUTE_AGGREGATE
+ || pi->sub_type == BGP_ROUTE_IMPORTED)) {
if (bgp_fibupd_safi(safi))
- bgp_zebra_withdraw(&rn->p, ri,
- bgp, safi);
- bgp_path_info_reap(rn, ri);
+ bgp_zebra_withdraw(&rn->p, pi, bgp,
+ safi);
+ bgp_path_info_reap(rn, pi);
}
}
}
struct bgp_static *bgp_static, afi_t afi, safi_t safi)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_path_info *new;
- struct bgp_path_info info;
+ struct bgp_path_info rmap_path;
struct attr attr;
struct attr *attr_new;
int ret;
if (bgp_static->rmap.name) {
struct attr attr_tmp = attr;
- memset(&info, 0, sizeof(struct bgp_path_info));
- info.peer = bgp->peer_self;
- info.attr = &attr_tmp;
+ memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ rmap_path.peer = bgp->peer_self;
+ rmap_path.attr = &attr_tmp;
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK);
- ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP, &info);
+ ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP,
+ &rmap_path);
bgp->peer_self->rmap_type = 0;
attr_new = bgp_attr_intern(&attr);
}
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
- if (ri) {
- if (attrhash_cmp(ri->attr, attr_new)
- && !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)
+ if (pi) {
+ if (attrhash_cmp(pi->attr, attr_new)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)
&& !bgp_flag_check(bgp, BGP_FLAG_FORCE_STATIC_PROCESS)) {
bgp_unlock_node(rn);
bgp_attr_unintern(&attr_new);
return;
} else {
/* The attribute is changed. */
- bgp_path_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_ATTR_CHANGED);
/* Rewrite BGP route information. */
- if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, pi);
else
- bgp_aggregate_decrement(bgp, p, ri, afi, safi);
+ bgp_aggregate_decrement(bgp, p, pi, afi, safi);
#if ENABLE_BGP_VNC
if ((afi == AFI_IP || afi == AFI_IP6)
&& (safi == SAFI_UNICAST)) {
- if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
/*
* Implicit withdraw case.
- * We have to do this before ri is
+ * We have to do this before pi is
* changed
*/
++vnc_implicit_withdraw;
- vnc_import_bgp_del_route(bgp, p, ri);
+ vnc_import_bgp_del_route(bgp, p, pi);
vnc_import_bgp_exterior_del_route(
- bgp, p, ri);
+ bgp, p, pi);
}
}
#endif
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
- ri->uptime = bgp_clock();
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
+ pi->uptime = bgp_clock();
#if ENABLE_BGP_VNC
if ((afi == AFI_IP || afi == AFI_IP6)
&& (safi == SAFI_UNICAST)) {
if (vnc_implicit_withdraw) {
- vnc_import_bgp_add_route(bgp, p, ri);
+ vnc_import_bgp_add_route(bgp, p, pi);
vnc_import_bgp_exterior_add_route(
- bgp, p, ri);
+ bgp, p, pi);
}
}
#endif
struct bgp *bgp_nexthop = bgp;
- if (ri->extra && ri->extra->bgp_orig)
- bgp_nexthop = ri->extra->bgp_orig;
+ if (pi->extra && pi->extra->bgp_orig)
+ bgp_nexthop = pi->extra->bgp_orig;
if (bgp_find_or_add_nexthop(bgp, bgp_nexthop,
- afi, ri, NULL, 0))
- bgp_path_info_set_flag(rn, ri,
+ afi, pi, NULL, 0))
+ bgp_path_info_set_flag(rn, pi,
BGP_PATH_VALID);
else {
if (BGP_DEBUG(nht, NHT)) {
__FUNCTION__, buf1);
}
bgp_path_info_unset_flag(
- rn, ri, BGP_PATH_VALID);
+ rn, pi, BGP_PATH_VALID);
}
} else {
/* Delete the NHT structure if any, if we're
* from NHT to avoid overloading NHT and the
* process interaction
*/
- bgp_unlink_nexthop(ri);
- bgp_path_info_set_flag(rn, ri, BGP_PATH_VALID);
+ bgp_unlink_nexthop(pi);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_VALID);
}
/* Process change. */
- bgp_aggregate_increment(bgp, p, ri, afi, safi);
+ bgp_aggregate_increment(bgp, p, pi, afi, safi);
bgp_process(bgp, rn, afi, safi);
if (SAFI_UNICAST == safi
|| bgp->inst_type
== BGP_INSTANCE_TYPE_DEFAULT)) {
vpn_leak_from_vrf_update(bgp_get_default(), bgp,
- ri);
+ pi);
}
bgp_unlock_node(rn);
safi_t safi)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, NULL);
/* Check selected route and self inserted route. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
/* Withdraw static BGP route from routing table. */
- if (ri) {
+ if (pi) {
if (SAFI_UNICAST == safi
&& (bgp->inst_type == BGP_INSTANCE_TYPE_VRF
|| bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, ri);
+ vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, pi);
}
- bgp_aggregate_decrement(bgp, p, ri, afi, safi);
- bgp_unlink_nexthop(ri);
- bgp_path_info_delete(rn, ri);
+ bgp_aggregate_decrement(bgp, p, pi, afi, safi);
+ bgp_unlink_nexthop(pi);
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, safi);
}
struct prefix_rd *prd)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
/* Check selected route and self inserted route. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
/* Withdraw static BGP route from routing table. */
- if (ri) {
+ if (pi) {
#if ENABLE_BGP_VNC
rfapiProcessWithdraw(
- ri->peer, NULL, p, prd, ri->attr, afi, safi, ri->type,
+ pi->peer, NULL, p, prd, pi->attr, afi, safi, pi->type,
1); /* Kill, since it is an administrative change */
#endif
if (SAFI_MPLS_VPN == safi
&& bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
- vpn_leak_to_vrf_withdraw(bgp, ri);
+ vpn_leak_to_vrf_withdraw(bgp, pi);
}
- bgp_aggregate_decrement(bgp, p, ri, afi, safi);
- bgp_path_info_delete(rn, ri);
+ bgp_aggregate_decrement(bgp, p, pi, afi, safi);
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, safi);
}
struct bgp_path_info *new;
struct attr *attr_new;
struct attr attr = {0};
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
#if ENABLE_BGP_VNC
mpls_label_t label = 0;
#endif
/* Apply route-map. */
if (bgp_static->rmap.name) {
struct attr attr_tmp = attr;
- struct bgp_path_info info;
+ struct bgp_path_info rmap_path;
int ret;
- info.peer = bgp->peer_self;
- info.attr = &attr_tmp;
+ rmap_path.peer = bgp->peer_self;
+ rmap_path.attr = &attr_tmp;
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK);
- ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP, &info);
+ ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP,
+ &rmap_path);
bgp->peer_self->rmap_type = 0;
attr_new = bgp_attr_intern(&attr);
}
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
- if (ri) {
+ if (pi) {
memset(&add, 0, sizeof(union gw_addr));
- if (attrhash_cmp(ri->attr, attr_new)
- && overlay_index_equal(afi, ri, bgp_static->eth_s_id, &add)
- && !CHECK_FLAG(ri->flags, BGP_PATH_REMOVED)) {
+ if (attrhash_cmp(pi->attr, attr_new)
+ && overlay_index_equal(afi, pi, bgp_static->eth_s_id, &add)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
bgp_unlock_node(rn);
bgp_attr_unintern(&attr_new);
aspath_unintern(&attr.aspath);
return;
} else {
/* The attribute is changed. */
- bgp_path_info_set_flag(rn, ri, BGP_PATH_ATTR_CHANGED);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_ATTR_CHANGED);
/* Rewrite BGP route information. */
- if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, pi);
else
- bgp_aggregate_decrement(bgp, p, ri, afi, safi);
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
- ri->uptime = bgp_clock();
+ bgp_aggregate_decrement(bgp, p, pi, afi, safi);
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
+ pi->uptime = bgp_clock();
#if ENABLE_BGP_VNC
- if (ri->extra)
- label = decode_label(&ri->extra->label[0]);
+ if (pi->extra)
+ label = decode_label(&pi->extra->label[0]);
#endif
/* Process change. */
- bgp_aggregate_increment(bgp, p, ri, afi, safi);
+ bgp_aggregate_increment(bgp, p, pi, afi, safi);
bgp_process(bgp, rn, afi, safi);
if (SAFI_MPLS_VPN == safi
&& bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
- vpn_leak_to_vrf_update(bgp, ri);
+ vpn_leak_to_vrf_update(bgp, pi);
}
#if ENABLE_BGP_VNC
- rfapiProcessUpdate(ri->peer, NULL, p, &bgp_static->prd,
- ri->attr, afi, safi, ri->type,
- ri->sub_type, &label);
+ rfapiProcessUpdate(pi->peer, NULL, p, &bgp_static->prd,
+ pi->attr, afi, safi, pi->type,
+ pi->sub_type, &label);
#endif
bgp_unlock_node(rn);
aspath_unintern(&attr.aspath);
{
struct bgp_table *table;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
table = bgp->rib[afi][safi];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- for (ri = rn->info; ri; ri = ri->next) {
- if (ri->peer == bgp->peer_self
- && ((ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
- || (ri->type != ZEBRA_ROUTE_BGP
- && ri->sub_type
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (pi->peer == bgp->peer_self
+ && ((pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
+ || (pi->type != ZEBRA_ROUTE_BGP
+ && pi->sub_type
== BGP_ROUTE_REDISTRIBUTE))) {
- bgp_aggregate_decrement(bgp, &rn->p, ri, afi,
+ bgp_aggregate_decrement(bgp, &rn->p, pi, afi,
safi);
- bgp_unlink_nexthop(ri);
- bgp_path_info_delete(rn, ri);
+ bgp_unlink_nexthop(pi);
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, safi);
}
}
XFREE(MTYPE_BGP_AGGREGATE, aggregate);
}
-static int bgp_aggregate_info_same(struct bgp_path_info *ri, uint8_t origin,
+static int bgp_aggregate_info_same(struct bgp_path_info *pi, uint8_t origin,
struct aspath *aspath,
struct community *comm)
{
if (!ae)
ae = aspath_empty();
- if (!ri)
+ if (!pi)
return 0;
- if (origin != ri->attr->origin)
+ if (origin != pi->attr->origin)
return 0;
- if (!aspath_cmp(ri->attr->aspath, (aspath) ? aspath : ae))
+ if (!aspath_cmp(pi->attr->aspath, (aspath) ? aspath : ae))
return 0;
- if (!community_cmp(ri->attr->community, comm))
+ if (!community_cmp(pi->attr->community, comm))
return 0;
- if (!CHECK_FLAG(ri->flags, BGP_PATH_VALID))
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID))
return 0;
return 1;
{
struct bgp_node *rn;
struct bgp_table *table;
- struct bgp_path_info *ri, *new;
+ struct bgp_path_info *pi, *new;
table = bgp->rib[afi][safi];
rn = bgp_node_get(table, p);
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_AGGREGATE)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_AGGREGATE)
break;
if (aggregate->count > 0) {
/*
* Mark the old as unusable
*/
- if (ri)
- bgp_path_info_delete(rn, ri);
+ if (pi)
+ bgp_path_info_delete(rn, pi);
new = info_make(
ZEBRA_ROUTE_BGP, BGP_ROUTE_AGGREGATE, 0, bgp->peer_self,
bgp_path_info_add(rn, new);
bgp_process(bgp, rn, afi, safi);
} else {
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self
- && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_AGGREGATE)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self
+ && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_AGGREGATE)
break;
/* Withdraw static BGP route from routing table. */
- if (ri) {
- bgp_path_info_delete(rn, ri);
+ if (pi) {
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, safi);
}
}
/* Update an aggregate as routes are added/removed from the BGP table */
static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p,
- struct bgp_path_info *rinew, afi_t afi,
+ struct bgp_path_info *pinew, afi_t afi,
safi_t safi, struct bgp_path_info *del,
struct bgp_aggregate *aggregate)
{
struct aspath *asmerge = NULL;
struct community *community = NULL;
struct community *commerge = NULL;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
unsigned long match = 0;
uint8_t atomic_aggregate = 0;
match = 0;
- for (ri = rn->info; ri; ri = ri->next) {
- if (BGP_PATH_HOLDDOWN(ri))
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (BGP_PATH_HOLDDOWN(pi))
continue;
- if (del && ri == del)
+ if (del && pi == del)
continue;
- if (ri->attr->flag
+ if (pi->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE))
atomic_aggregate = 1;
- if (ri->sub_type == BGP_ROUTE_AGGREGATE)
+ if (pi->sub_type == BGP_ROUTE_AGGREGATE)
continue;
/*
* aggregated route announcements.
*/
if (aggregate->summary_only) {
- (bgp_path_info_extra_get(ri))->suppress++;
- bgp_path_info_set_flag(rn, ri,
+ (bgp_path_info_extra_get(pi))->suppress++;
+ bgp_path_info_set_flag(rn, pi,
BGP_PATH_ATTR_CHANGED);
match++;
}
* route MUST have the ORIGIN attribute with the value
* EGP.
*/
- if (origin < ri->attr->origin)
- origin = ri->attr->origin;
+ if (origin < pi->attr->origin)
+ origin = pi->attr->origin;
if (!aggregate->as_set)
continue;
*/
if (aspath) {
asmerge = aspath_aggregate(aspath,
- ri->attr->aspath);
+ pi->attr->aspath);
aspath_free(aspath);
aspath = asmerge;
} else
- aspath = aspath_dup(ri->attr->aspath);
+ aspath = aspath_dup(pi->attr->aspath);
- if (!ri->attr->community)
+ if (!pi->attr->community)
continue;
if (community) {
commerge = community_merge(community,
- ri->attr->community);
+ pi->attr->community);
community = community_uniq_sort(commerge);
community_free(commerge);
} else
- community = community_dup(ri->attr->community);
+ community = community_dup(pi->attr->community);
}
if (match)
bgp_process(bgp, rn, afi, safi);
}
bgp_unlock_node(top);
- if (rinew) {
+ if (pinew) {
aggregate->count++;
if (aggregate->summary_only)
- (bgp_path_info_extra_get(rinew))->suppress++;
+ (bgp_path_info_extra_get(pinew))->suppress++;
- if (origin < rinew->attr->origin)
- origin = rinew->attr->origin;
+ if (origin < pinew->attr->origin)
+ origin = pinew->attr->origin;
if (aggregate->as_set) {
if (aspath) {
asmerge = aspath_aggregate(aspath,
- rinew->attr->aspath);
+ pinew->attr->aspath);
aspath_free(aspath);
aspath = asmerge;
} else
- aspath = aspath_dup(rinew->attr->aspath);
+ aspath = aspath_dup(pinew->attr->aspath);
- if (rinew->attr->community) {
+ if (pinew->attr->community) {
if (community) {
commerge = community_merge(
community,
- rinew->attr->community);
+ pinew->attr->community);
community =
community_uniq_sort(commerge);
community_free(commerge);
} else
community = community_dup(
- rinew->attr->community);
+ pinew->attr->community);
}
}
}
struct bgp_table *table;
struct bgp_node *top;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
unsigned long match;
table = bgp->rib[afi][safi];
continue;
match = 0;
- for (ri = rn->info; ri; ri = ri->next) {
- if (BGP_PATH_HOLDDOWN(ri))
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (BGP_PATH_HOLDDOWN(pi))
continue;
- if (ri->sub_type == BGP_ROUTE_AGGREGATE)
+ if (pi->sub_type == BGP_ROUTE_AGGREGATE)
continue;
- if (aggregate->summary_only && ri->extra) {
- ri->extra->suppress--;
+ if (aggregate->summary_only && pi->extra) {
+ pi->extra->suppress--;
- if (ri->extra->suppress == 0) {
+ if (pi->extra->suppress == 0) {
bgp_path_info_set_flag(
- rn, ri, BGP_PATH_ATTR_CHANGED);
+ rn, pi, BGP_PATH_ATTR_CHANGED);
match++;
}
}
}
void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p,
- struct bgp_path_info *ri, afi_t afi, safi_t safi)
+ struct bgp_path_info *pi, afi_t afi, safi_t safi)
{
struct bgp_node *child;
struct bgp_node *rn;
if (p->prefixlen == 0)
return;
- if (BGP_PATH_HOLDDOWN(ri))
+ if (BGP_PATH_HOLDDOWN(pi))
return;
child = bgp_node_get(table, p);
aggregate = bgp_aggregate_get_node_info(rn);
if (aggregate != NULL && rn->p.prefixlen < p->prefixlen) {
bgp_aggregate_delete(bgp, &rn->p, afi, safi, aggregate);
- bgp_aggregate_route(bgp, &rn->p, ri, afi, safi, NULL,
+ bgp_aggregate_route(bgp, &rn->p, pi, afi, safi, NULL,
aggregate);
}
}
route_tag_t tag)
{
struct bgp_path_info *new;
- struct bgp_path_info *bi;
- struct bgp_path_info info;
+ struct bgp_path_info *bpi;
+ struct bgp_path_info rmap_path;
struct bgp_node *bn;
struct attr attr;
struct attr *new_attr;
/* Apply route-map. */
if (red->rmap.name) {
- memset(&info, 0, sizeof(struct bgp_path_info));
- info.peer = bgp->peer_self;
- info.attr = &attr_new;
+ memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ rmap_path.peer = bgp->peer_self;
+ rmap_path.attr = &attr_new;
SET_FLAG(bgp->peer_self->rmap_type,
PEER_RMAP_TYPE_REDISTRIBUTE);
ret = route_map_apply(red->rmap.map, p, RMAP_BGP,
- &info);
+ &rmap_path);
bgp->peer_self->rmap_type = 0;
new_attr = bgp_attr_intern(&attr_new);
- for (bi = bn->info; bi; bi = bi->next)
- if (bi->peer == bgp->peer_self
- && bi->sub_type == BGP_ROUTE_REDISTRIBUTE)
+ for (bpi = bn->info; bpi; bpi = bpi->next)
+ if (bpi->peer == bgp->peer_self
+ && bpi->sub_type == BGP_ROUTE_REDISTRIBUTE)
break;
- if (bi) {
+ if (bpi) {
/* Ensure the (source route) type is updated. */
- bi->type = type;
- if (attrhash_cmp(bi->attr, new_attr)
- && !CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) {
+ bpi->type = type;
+ if (attrhash_cmp(bpi->attr, new_attr)
+ && !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
bgp_attr_unintern(&new_attr);
aspath_unintern(&attr.aspath);
bgp_unlock_node(bn);
return;
} else {
/* The attribute is changed. */
- bgp_path_info_set_flag(bn, bi,
+ bgp_path_info_set_flag(bn, bpi,
BGP_PATH_ATTR_CHANGED);
/* Rewrite BGP route information. */
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(bn, bi);
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(bn, bpi);
else
- bgp_aggregate_decrement(bgp, p, bi, afi,
- SAFI_UNICAST);
- bgp_attr_unintern(&bi->attr);
- bi->attr = new_attr;
- bi->uptime = bgp_clock();
+ bgp_aggregate_decrement(
+ bgp, p, bpi, afi, SAFI_UNICAST);
+ bgp_attr_unintern(&bpi->attr);
+ bpi->attr = new_attr;
+ bpi->uptime = bgp_clock();
/* Process change. */
- bgp_aggregate_increment(bgp, p, bi, afi,
+ bgp_aggregate_increment(bgp, p, bpi, afi,
SAFI_UNICAST);
bgp_process(bgp, bn, afi, SAFI_UNICAST);
bgp_unlock_node(bn);
== BGP_INSTANCE_TYPE_DEFAULT)) {
vpn_leak_from_vrf_update(
- bgp_get_default(), bgp, bi);
+ bgp_get_default(), bgp, bpi);
}
return;
}
{
afi_t afi;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_redist *red;
afi = family2afi(p->family);
rn = bgp_afi_node_get(bgp->rib[afi][SAFI_UNICAST], afi,
SAFI_UNICAST, p, NULL);
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == type)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == type)
break;
- if (ri) {
+ if (pi) {
if ((bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
|| (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
vpn_leak_from_vrf_withdraw(bgp_get_default(),
- bgp, ri);
+ bgp, pi);
}
- bgp_aggregate_decrement(bgp, p, ri, afi, SAFI_UNICAST);
- bgp_path_info_delete(rn, ri);
+ bgp_aggregate_decrement(bgp, p, pi, afi, SAFI_UNICAST);
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, SAFI_UNICAST);
}
bgp_unlock_node(rn);
unsigned short instance)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_table *table;
table = bgp->rib[afi][SAFI_UNICAST];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == type
- && ri->instance == instance)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == type
+ && pi->instance == instance)
break;
- if (ri) {
+ if (pi) {
if ((bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
|| (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
vpn_leak_from_vrf_withdraw(bgp_get_default(),
- bgp, ri);
+ bgp, pi);
}
- bgp_aggregate_decrement(bgp, &rn->p, ri, afi,
+ bgp_aggregate_decrement(bgp, &rn->p, pi, afi,
SAFI_UNICAST);
- bgp_path_info_delete(rn, ri);
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, SAFI_UNICAST);
}
}
unsigned long *total_cum,
unsigned long *json_header_depth)
{
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_node *rn;
int header = 1;
int display;
else
json_paths = NULL;
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
total_count++;
if (type == bgp_show_type_flap_statistics
|| type == bgp_show_type_flap_neighbor
|| type == bgp_show_type_dampend_paths
|| type == bgp_show_type_damp_neighbor) {
- if (!(ri->extra && ri->extra->damp_info))
+ if (!(pi->extra && pi->extra->damp_info))
continue;
}
if (type == bgp_show_type_regexp) {
regex_t *regex = output_arg;
- if (bgp_regexec(regex, ri->attr->aspath)
+ if (bgp_regexec(regex, pi->attr->aspath)
== REG_NOMATCH)
continue;
}
if (type == bgp_show_type_filter_list) {
struct as_list *as_list = output_arg;
- if (as_list_apply(as_list, ri->attr->aspath)
+ if (as_list_apply(as_list, pi->attr->aspath)
!= AS_FILTER_PERMIT)
continue;
}
struct attr dummy_attr;
int ret;
- bgp_attr_dup(&dummy_attr, ri->attr);
+ bgp_attr_dup(&dummy_attr, pi->attr);
- path.peer = ri->peer;
+ path.peer = pi->peer;
path.attr = &dummy_attr;
ret = route_map_apply(rmap, &rn->p, RMAP_BGP,
|| type == bgp_show_type_damp_neighbor) {
union sockunion *su = output_arg;
- if (ri->peer == NULL
- || ri->peer->su_remote == NULL
- || !sockunion_same(ri->peer->su_remote, su))
+ if (pi->peer == NULL
+ || pi->peer->su_remote == NULL
+ || !sockunion_same(pi->peer->su_remote, su))
continue;
}
if (type == bgp_show_type_cidr_only) {
continue;
}
if (type == bgp_show_type_community_all) {
- if (!ri->attr->community)
+ if (!pi->attr->community)
continue;
}
if (type == bgp_show_type_community) {
struct community *com = output_arg;
- if (!ri->attr->community
- || !community_match(ri->attr->community,
+ if (!pi->attr->community
+ || !community_match(pi->attr->community,
com))
continue;
}
if (type == bgp_show_type_community_exact) {
struct community *com = output_arg;
- if (!ri->attr->community
- || !community_cmp(ri->attr->community, com))
+ if (!pi->attr->community
+ || !community_cmp(pi->attr->community, com))
continue;
}
if (type == bgp_show_type_community_list) {
struct community_list *list = output_arg;
- if (!community_list_match(ri->attr->community,
+ if (!community_list_match(pi->attr->community,
list))
continue;
}
struct community_list *list = output_arg;
if (!community_list_exact_match(
- ri->attr->community, list))
+ pi->attr->community, list))
continue;
}
if (type == bgp_show_type_lcommunity) {
struct lcommunity *lcom = output_arg;
- if (!ri->attr->lcommunity
- || !lcommunity_match(ri->attr->lcommunity,
+ if (!pi->attr->lcommunity
+ || !lcommunity_match(pi->attr->lcommunity,
lcom))
continue;
}
if (type == bgp_show_type_lcommunity_list) {
struct community_list *list = output_arg;
- if (!lcommunity_list_match(ri->attr->lcommunity,
+ if (!lcommunity_list_match(pi->attr->lcommunity,
list))
continue;
}
if (type == bgp_show_type_lcommunity_all) {
- if (!ri->attr->lcommunity)
+ if (!pi->attr->lcommunity)
continue;
}
if (type == bgp_show_type_dampend_paths
|| type == bgp_show_type_damp_neighbor) {
- if (!CHECK_FLAG(ri->flags, BGP_PATH_DAMPED)
- || CHECK_FLAG(ri->flags, BGP_PATH_HISTORY))
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_DAMPED)
+ || CHECK_FLAG(pi->flags, BGP_PATH_HISTORY))
continue;
}
}
if (type == bgp_show_type_dampend_paths
|| type == bgp_show_type_damp_neighbor)
- damp_route_vty_out(vty, &rn->p, ri, display,
+ damp_route_vty_out(vty, &rn->p, pi, display,
safi, use_json, json_paths);
else if (type == bgp_show_type_flap_statistics
|| type == bgp_show_type_flap_neighbor)
- flap_route_vty_out(vty, &rn->p, ri, display,
+ flap_route_vty_out(vty, &rn->p, pi, display,
safi, use_json, json_paths);
else
- route_vty_out(vty, &rn->p, ri, display, safi,
+ route_vty_out(vty, &rn->p, pi, display, safi,
json_paths);
display++;
}
struct bgp_node *rn, struct prefix_rd *prd,
afi_t afi, safi_t safi, json_object *json)
{
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct prefix *p;
struct peer *peer;
struct listnode *node, *nnode;
vty_out(vty, "not allocated\n");
}
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
count++;
- if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
best = count;
- if (ri->extra && ri->extra->suppress)
+ if (pi->extra && pi->extra->suppress)
suppress = 1;
- if (ri->attr->community == NULL)
+ if (pi->attr->community == NULL)
continue;
no_advertise += community_include(
- ri->attr->community, COMMUNITY_NO_ADVERTISE);
- no_export += community_include(ri->attr->community,
+ pi->attr->community, COMMUNITY_NO_ADVERTISE);
+ no_export += community_include(pi->attr->community,
COMMUNITY_NO_EXPORT);
- local_as += community_include(ri->attr->community,
+ local_as += community_include(pi->attr->community,
COMMUNITY_LOCAL_AS);
- accept_own += community_include(ri->attr->community,
+ accept_own += community_include(pi->attr->community,
COMMUNITY_ACCEPT_OWN);
route_filter_translated_v4 += community_include(
- ri->attr->community,
+ pi->attr->community,
COMMUNITY_ROUTE_FILTER_TRANSLATED_v4);
route_filter_translated_v6 += community_include(
- ri->attr->community,
+ pi->attr->community,
COMMUNITY_ROUTE_FILTER_TRANSLATED_v6);
route_filter_v4 += community_include(
- ri->attr->community, COMMUNITY_ROUTE_FILTER_v4);
+ pi->attr->community, COMMUNITY_ROUTE_FILTER_v4);
route_filter_v6 += community_include(
- ri->attr->community, COMMUNITY_ROUTE_FILTER_v6);
- llgr_stale += community_include(ri->attr->community,
+ pi->attr->community, COMMUNITY_ROUTE_FILTER_v6);
+ llgr_stale += community_include(pi->attr->community,
COMMUNITY_LLGR_STALE);
- no_llgr += community_include(ri->attr->community,
+ no_llgr += community_include(pi->attr->community,
COMMUNITY_NO_LLGR);
accept_own_nexthop +=
- community_include(ri->attr->community,
+ community_include(pi->attr->community,
COMMUNITY_ACCEPT_OWN_NEXTHOP);
- blackhole += community_include(ri->attr->community,
+ blackhole += community_include(pi->attr->community,
COMMUNITY_BLACKHOLE);
- no_peer += community_include(ri->attr->community,
+ no_peer += community_include(pi->attr->community,
COMMUNITY_NO_PEER);
}
}
struct prefix match;
struct bgp_node *rn;
struct bgp_node *rm;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_table *table;
json_object *json = NULL;
json_object *json_paths = NULL;
continue;
}
- for (ri = rm->info; ri; ri = ri->next) {
+ for (pi = rm->info; pi; pi = pi->next) {
if (header) {
route_vty_out_detail_header(
vty, bgp, rm,
if (pathtype == BGP_PATH_SHOW_ALL
|| (pathtype == BGP_PATH_SHOW_BESTPATH
- && CHECK_FLAG(ri->flags,
+ && CHECK_FLAG(pi->flags,
BGP_PATH_SELECTED))
|| (pathtype == BGP_PATH_SHOW_MULTIPATH
- && (CHECK_FLAG(ri->flags,
+ && (CHECK_FLAG(pi->flags,
BGP_PATH_MULTIPATH)
- || CHECK_FLAG(ri->flags,
+ || CHECK_FLAG(pi->flags,
BGP_PATH_SELECTED))))
route_vty_out_detail(vty, bgp, &rm->p,
- ri, AFI_IP, safi,
+ pi, AFI_IP, safi,
json_paths);
}
if ((rn = bgp_node_match(rib, &match)) != NULL) {
if (!prefix_check
|| rn->p.prefixlen == match.prefixlen) {
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
if (header) {
route_vty_out_detail_header(
vty, bgp, rn, NULL, afi,
|| (pathtype
== BGP_PATH_SHOW_BESTPATH
&& CHECK_FLAG(
- ri->flags,
+ pi->flags,
BGP_PATH_SELECTED))
|| (pathtype
== BGP_PATH_SHOW_MULTIPATH
&& (CHECK_FLAG(
- ri->flags,
+ pi->flags,
BGP_PATH_MULTIPATH)
|| CHECK_FLAG(
- ri->flags,
+ pi->flags,
BGP_PATH_SELECTED))))
route_vty_out_detail(
- vty, bgp, &rn->p, ri,
+ vty, bgp, &rn->p, pi,
afi, safi, json_paths);
}
}
ts->counts[BGP_STATS_MAXBITLEN] = space;
for (rn = top; rn; rn = bgp_route_next(rn)) {
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
struct bgp_node *prn = bgp_node_parent_nolock(rn);
- unsigned int rinum = 0;
+ unsigned int pinum = 0;
if (rn == top)
continue;
} else if (prn->info)
ts->counts[BGP_STATS_MAX_AGGREGATEABLE]++;
- for (ri = rn->info; ri; ri = ri->next) {
- rinum++;
+ for (pi = rn->info; pi; pi = pi->next) {
+ pinum++;
ts->counts[BGP_STATS_RIB]++;
- if (ri->attr
- && (CHECK_FLAG(ri->attr->flag,
+ if (pi->attr
+ && (CHECK_FLAG(pi->attr->flag,
ATTR_FLAG_BIT(
BGP_ATTR_ATOMIC_AGGREGATE))))
ts->counts[BGP_STATS_AGGREGATES]++;
/* as-path stats */
- if (ri->attr && ri->attr->aspath) {
+ if (pi->attr && pi->attr->aspath) {
unsigned int hops =
- aspath_count_hops(ri->attr->aspath);
+ aspath_count_hops(pi->attr->aspath);
unsigned int size =
- aspath_size(ri->attr->aspath);
- as_t highest = aspath_highest(ri->attr->aspath);
+ aspath_size(pi->attr->aspath);
+ as_t highest = aspath_highest(pi->attr->aspath);
ts->counts[BGP_STATS_ASPATH_COUNT]++;
for (rn = bgp_table_top(pc->table); rn; rn = bgp_route_next(rn)) {
struct bgp_adj_in *ain;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
for (ain = rn->adj_in; ain; ain = ain->next)
if (ain->peer == peer)
pc->count[PCOUNT_ADJ_IN]++;
- for (ri = rn->info; ri; ri = ri->next) {
- if (ri->peer != peer)
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (pi->peer != peer)
continue;
pc->count[PCOUNT_ALL]++;
- if (CHECK_FLAG(ri->flags, BGP_PATH_DAMPED))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_DAMPED))
pc->count[PCOUNT_DAMPED]++;
- if (CHECK_FLAG(ri->flags, BGP_PATH_HISTORY))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_HISTORY))
pc->count[PCOUNT_HISTORY]++;
- if (CHECK_FLAG(ri->flags, BGP_PATH_REMOVED))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
pc->count[PCOUNT_REMOVED]++;
- if (CHECK_FLAG(ri->flags, BGP_PATH_STALE))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_STALE))
pc->count[PCOUNT_STALE]++;
- if (CHECK_FLAG(ri->flags, BGP_PATH_VALID))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_VALID))
pc->count[PCOUNT_VALID]++;
- if (!CHECK_FLAG(ri->flags, BGP_PATH_UNUSEABLE))
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_UNUSEABLE))
pc->count[PCOUNT_PFCNT]++;
- if (CHECK_FLAG(ri->flags, BGP_PATH_COUNTED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_COUNTED)) {
pc->count[PCOUNT_COUNTED]++;
- if (CHECK_FLAG(ri->flags, BGP_PATH_UNUSEABLE))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_UNUSEABLE))
flog_err(
EC_LIB_DEVELOPMENT,
"Attempting to count but flags say it is unusable");
} else {
- if (!CHECK_FLAG(ri->flags, BGP_PATH_UNUSEABLE))
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_UNUSEABLE))
flog_err(
EC_LIB_DEVELOPMENT,
"Not counted but flags say we should");
}
/* Apply BGP information to distance method. */
-uint8_t bgp_distance_apply(struct prefix *p, struct bgp_path_info *rinfo,
+uint8_t bgp_distance_apply(struct prefix *p, struct bgp_path_info *pinfo,
afi_t afi, safi_t safi, struct bgp *bgp)
{
struct bgp_node *rn;
if (!bgp)
return 0;
- peer = rinfo->peer;
+ peer = pinfo->peer;
/* Check source address. */
sockunion2hostprefix(&peer->su, &q);
struct prefix match;
struct bgp_node *rn;
struct bgp_node *rm;
- struct bgp_path_info *ri;
- struct bgp_path_info *ri_temp;
+ struct bgp_path_info *pi;
+ struct bgp_path_info *pi_temp;
struct bgp *bgp;
struct bgp_table *table;
if (!prefix_check
|| rm->p.prefixlen == match.prefixlen) {
- ri = rm->info;
- while (ri) {
- if (ri->extra && ri->extra->damp_info) {
- ri_temp = ri->next;
+ pi = rm->info;
+ while (pi) {
+ if (pi->extra && pi->extra->damp_info) {
+ pi_temp = pi->next;
bgp_damp_info_free(
- ri->extra->damp_info,
+ pi->extra->damp_info,
1);
- ri = ri_temp;
+ pi = pi_temp;
} else
- ri = ri->next;
+ pi = pi->next;
}
}
!= NULL) {
if (!prefix_check
|| rn->p.prefixlen == match.prefixlen) {
- ri = rn->info;
- while (ri) {
- if (ri->extra && ri->extra->damp_info) {
- ri_temp = ri->next;
+ pi = rn->info;
+ while (pi) {
+ if (pi->extra && pi->extra->damp_info) {
+ pi_temp = pi->next;
bgp_damp_info_free(
- ri->extra->damp_info,
+ pi->extra->damp_info,
1);
- ri = ri_temp;
+ pi = pi_temp;
} else
- ri = ri->next;
+ pi = pi->next;
}
}
}
/* Prototypes. */
-extern void bgp_rib_remove(struct bgp_node *rn, struct bgp_path_info *ri,
+extern void bgp_rib_remove(struct bgp_node *rn, struct bgp_path_info *pi,
struct peer *peer, afi_t afi, safi_t safi);
extern void bgp_process_queue_init(void);
extern void bgp_route_init(void);
struct prefix_rd *prd);
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 void bgp_path_info_add(struct bgp_node *rn, struct bgp_path_info *pi);
+extern void bgp_path_info_reap(struct bgp_node *rn, struct bgp_path_info *pi);
+extern void bgp_path_info_delete(struct bgp_node *rn, struct bgp_path_info *pi);
extern struct bgp_path_info_extra *
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,
+extern void bgp_path_info_path_with_addpath_rx_str(struct bgp_path_info *pi,
char *buf);
extern int bgp_nlri_parse_ip(struct peer *, struct attr *, struct bgp_nlri *);
uint32_t addpath_tx_id);
extern int subgroup_announce_check(struct bgp_node *rn,
- struct bgp_path_info *ri,
+ struct bgp_path_info *pi,
struct update_subgroup *subgrp,
struct prefix *p, struct attr *attr);
u_int32_t locpref = 0;
u_int32_t newlocpref = 0;
enum lua_rm_status lrm_status;
- struct bgp_path_info *info = (struct bgp_path_info *)object;
+ struct bgp_path_info *path = (struct bgp_path_info *)object;
lua_State *L = lua_initialize("/etc/frr/lua.scr");
if (L == NULL)
* Setup the bgp_path_info information
*/
lua_newtable(L);
- lua_pushinteger(L, info->attr->med);
+ lua_pushinteger(L, path->attr->med);
lua_setfield(L, -2, "metric");
- lua_pushinteger(L, info->attr->nh_ifindex);
+ lua_pushinteger(L, path->attr->nh_ifindex);
lua_setfield(L, -2, "ifindex");
- lua_pushstring(L, info->attr->aspath->str);
+ lua_pushstring(L, path->attr->aspath->str);
lua_setfield(L, -2, "aspath");
- lua_pushinteger(L, info->attr->local_pref);
+ lua_pushinteger(L, path->attr->local_pref);
lua_setfield(L, -2, "localpref");
- zlog_debug("%s %d", info->attr->aspath->str, info->attr->nh_ifindex);
+ zlog_debug("%s %d", path->attr->aspath->str, path->attr->nh_ifindex);
lua_setglobal(L, "nexthop");
zlog_debug("Set up nexthop information");
case LUA_RM_MATCH_AND_CHANGE:
zlog_debug("MATCH AND CHANGE");
lua_getglobal(L, "nexthop");
- info->attr->med = get_integer(L, "metric");
+ path->attr->med = get_integer(L, "metric");
/*
* This needs to be abstraced with the set function
*/
- if (info->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
- locpref = info->attr->local_pref;
+ if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
+ locpref = path->attr->local_pref;
newlocpref = get_integer(L, "localpref");
if (newlocpref != locpref) {
- info->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
- info->attr->local_pref = newlocpref;
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
+ path->attr->local_pref = newlocpref;
}
status = RMAP_MATCH;
break;
void *object)
{
struct interface *ifp;
- struct bgp_path_info *info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
- info = object;
+ path = object;
- if (!info || !info->attr)
+ if (!path || !path->attr)
return RMAP_NOMATCH;
ifp = if_lookup_by_name_all_vrf((char *)rule);
- if (ifp == NULL || ifp->ifindex != info->attr->nh_ifindex)
+ if (ifp == NULL || ifp->ifindex != path->attr->nh_ifindex)
return RMAP_NOMATCH;
return RMAP_MATCH;
* configured addpath-tx knob
*/
int bgp_addpath_tx_path(struct peer *peer, afi_t afi, safi_t safi,
- struct bgp_path_info *ri)
+ struct bgp_path_info *pi)
{
if (CHECK_FLAG(peer->af_flags[afi][safi],
PEER_FLAG_ADDPATH_TX_ALL_PATHS))
if (CHECK_FLAG(peer->af_flags[afi][safi],
PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)
- && CHECK_FLAG(ri->flags, BGP_PATH_DMED_SELECTED))
+ && CHECK_FLAG(pi->flags, BGP_PATH_DMED_SELECTED))
return 1;
return 0;
struct updwalk_context {
struct vty *vty;
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
uint64_t updgrp_id;
uint64_t subgrp_id;
bgp_policy_type_e policy_type;
extern void subgroup_default_originate(struct update_subgroup *subgrp,
int withdraw);
extern void group_announce_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct bgp_node *rn, struct bgp_path_info *ri);
+ struct bgp_node *rn, struct bgp_path_info *pi);
extern void subgroup_clear_table(struct update_subgroup *subgrp);
extern void update_group_announce(struct bgp *bgp);
extern void update_group_announce_rrclients(struct bgp *bgp);
extern void update_bgp_group_free(struct bgp *bgp);
extern int bgp_addpath_encode_tx(struct peer *peer, afi_t afi, safi_t safi);
extern int bgp_addpath_tx_path(struct peer *peer, afi_t afi, safi_t safi,
- struct bgp_path_info *ri);
+ struct bgp_path_info *pi);
/*
* Inline functions
{
struct updwalk_context *ctx = arg;
struct update_subgroup *subgrp;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
afi_t afi;
safi_t safi;
struct peer *peer;
adj_next = adj->next;
if (adj->subgroup == subgrp) {
- for (ri = ctx->rn->info; ri;
- ri = ri->next) {
- if (ri->addpath_tx_id
+ for (pi = ctx->rn->info; pi;
+ pi = pi->next) {
+ if (pi->addpath_tx_id
== adj->addpath_tx_id) {
break;
}
}
- if (!ri) {
+ if (!pi) {
subgroup_process_announce_selected(
subgrp, NULL,
ctx->rn,
}
}
- for (ri = ctx->rn->info; ri; ri = ri->next) {
+ for (pi = ctx->rn->info; pi; pi = pi->next) {
/* Skip the bestpath for now */
- if (ri == ctx->ri)
+ if (pi == ctx->pi)
continue;
subgroup_process_announce_selected(
- subgrp, ri, ctx->rn,
- ri->addpath_tx_id);
+ subgrp, pi, ctx->rn,
+ pi->addpath_tx_id);
}
/* Process the bestpath last so the "show [ip]
* bgp neighbor x.x.x.x advertised"
* output shows the attributes from the bestpath
*/
- if (ctx->ri)
+ if (ctx->pi)
subgroup_process_announce_selected(
- subgrp, ctx->ri, ctx->rn,
- ctx->ri->addpath_tx_id);
+ subgrp, ctx->pi, ctx->rn,
+ ctx->pi->addpath_tx_id);
}
/* An update-group that does not use addpath */
else {
- if (ctx->ri) {
+ if (ctx->pi) {
subgroup_process_announce_selected(
- subgrp, ctx->ri, ctx->rn,
- ctx->ri->addpath_tx_id);
+ subgrp, ctx->pi, ctx->rn,
+ ctx->pi->addpath_tx_id);
} else {
/* Find the addpath_tx_id of the path we
* had advertised and
* input route.
*/
void group_announce_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct bgp_node *rn, struct bgp_path_info *ri)
+ struct bgp_node *rn, struct bgp_path_info *pi)
{
struct updwalk_context ctx;
- ctx.ri = ri;
+ ctx.pi = pi;
ctx.rn = rn;
update_group_af_walk(bgp, afi, safi, group_announce_route_walkcb, &ctx);
}
}
static struct in6_addr *
-bgp_path_info_to_ipv6_nexthop(struct bgp_path_info *info, ifindex_t *ifindex)
+bgp_path_info_to_ipv6_nexthop(struct bgp_path_info *path, ifindex_t *ifindex)
{
struct in6_addr *nexthop = NULL;
/* Only global address nexthop exists. */
- if (info->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL) {
- nexthop = &info->attr->mp_nexthop_global;
+ if (path->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL) {
+ nexthop = &path->attr->mp_nexthop_global;
if (IN6_IS_ADDR_LINKLOCAL(nexthop))
- *ifindex = info->attr->nh_ifindex;
-
+ *ifindex = path->attr->nh_ifindex;
}
/* If both global and link-local address present. */
- if (info->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
+ if (path->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
/* Check if route-map is set to prefer global over link-local */
- if (info->attr->mp_nexthop_prefer_global) {
- nexthop = &info->attr->mp_nexthop_global;
+ if (path->attr->mp_nexthop_prefer_global) {
+ nexthop = &path->attr->mp_nexthop_global;
if (IN6_IS_ADDR_LINKLOCAL(nexthop))
- *ifindex = info->attr->nh_ifindex;
+ *ifindex = path->attr->nh_ifindex;
} else {
/* Workaround for Cisco's nexthop bug. */
if (IN6_IS_ADDR_UNSPECIFIED(
- &info->attr->mp_nexthop_global)
- && info->peer->su_remote->sa.sa_family
+ &path->attr->mp_nexthop_global)
+ && path->peer->su_remote->sa.sa_family
== AF_INET6) {
nexthop =
- &info->peer->su_remote->sin6.sin6_addr;
+ &path->peer->su_remote->sin6.sin6_addr;
if (IN6_IS_ADDR_LINKLOCAL(nexthop))
- *ifindex = info->peer->nexthop.ifp
+ *ifindex = path->peer->nexthop.ifp
->ifindex;
} else {
- nexthop = &info->attr->mp_nexthop_local;
+ nexthop = &path->attr->mp_nexthop_local;
if (IN6_IS_ADDR_LINKLOCAL(nexthop))
- *ifindex = info->attr->nh_lla_ifindex;
+ *ifindex = path->attr->nh_lla_ifindex;
}
}
}
}
static int bgp_table_map_apply(struct route_map *map, struct prefix *p,
- struct bgp_path_info *info)
+ struct bgp_path_info *path)
{
route_map_result_t ret;
- ret = route_map_apply(map, p, RMAP_BGP, info);
- bgp_attr_flush(info->attr);
+ ret = route_map_apply(map, p, RMAP_BGP, path);
+ bgp_attr_flush(path->attr);
if (ret != RMAP_DENYMATCH)
return 1;
inet_ntop(AF_INET, &p->u.prefix4, buf[0],
sizeof(buf[0])),
p->prefixlen,
- inet_ntop(AF_INET, &info->attr->nexthop, buf[1],
+ inet_ntop(AF_INET, &path->attr->nexthop, buf[1],
sizeof(buf[1])));
}
if (p->family == AF_INET6) {
ifindex_t ifindex;
struct in6_addr *nexthop;
- nexthop = bgp_path_info_to_ipv6_nexthop(info, &ifindex);
+ nexthop = bgp_path_info_to_ipv6_nexthop(path, &ifindex);
zlog_debug(
"Zebra rmap deny: IPv6 route %s/%d nexthop %s",
inet_ntop(AF_INET6, &p->u.prefix6, buf[0],
static int
update_ipv6nh_for_route_install(int nh_othervrf, struct in6_addr *nexthop,
- ifindex_t ifindex, struct bgp_path_info *ri,
- struct bgp_path_info *best_ri, bool is_evpn,
+ ifindex_t ifindex, struct bgp_path_info *pi,
+ struct bgp_path_info *best_pi, bool is_evpn,
struct zapi_nexthop *api_nh)
{
struct attr *attr;
- attr = ri->attr;
+ attr = pi->attr;
if (is_evpn)
api_nh->type = NEXTHOP_TYPE_IPV6_IFINDEX;
}
} else {
if (IN6_IS_ADDR_LINKLOCAL(nexthop)) {
- if (ri == best_ri &&
- attr->mp_nexthop_len
- == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
- if (ri->peer->nexthop.ifp)
- ifindex = ri->peer->nexthop.ifp
- ->ifindex;
+ if (pi == best_pi
+ && attr->mp_nexthop_len
+ == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ if (pi->peer->nexthop.ifp)
+ ifindex =
+ pi->peer->nexthop.ifp->ifindex;
if (!ifindex) {
- if (ri->peer->conf_if)
- ifindex = ri->peer->ifp->ifindex;
- else if (ri->peer->ifname)
+ if (pi->peer->conf_if)
+ ifindex = pi->peer->ifp->ifindex;
+ else if (pi->peer->ifname)
ifindex = ifname2ifindex(
- ri->peer->ifname,
- ri->peer->bgp->vrf_id);
- else if (ri->peer->nexthop.ifp)
- ifindex = ri->peer->nexthop.ifp
- ->ifindex;
+ pi->peer->ifname,
+ pi->peer->bgp->vrf_id);
+ else if (pi->peer->nexthop.ifp)
+ ifindex =
+ pi->peer->nexthop.ifp->ifindex;
}
if (ifindex == 0)
{
struct bgp_node *rn;
struct bgp_table *table;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
/* Don't try to install if we're not connected to Zebra or Zebra doesn't
* know of this instance.
return;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
- for (ri = rn->info; ri; ri = ri->next)
- if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED) &&
+ for (pi = rn->info; pi; pi = pi->next)
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED) &&
- (ri->type == ZEBRA_ROUTE_BGP
- && (ri->sub_type == BGP_ROUTE_NORMAL
- || ri->sub_type == BGP_ROUTE_IMPORTED)))
+ (pi->type == ZEBRA_ROUTE_BGP
+ && (pi->sub_type == BGP_ROUTE_NORMAL
+ || pi->sub_type == BGP_ROUTE_IMPORTED)))
- bgp_zebra_announce(rn, &rn->p, ri, bgp, afi,
+ bgp_zebra_announce(rn, &rn->p, pi, bgp, afi,
safi);
}
afi_t afi, int type, uint32_t metric)
{
struct bgp_node *rn;
- struct bgp_path_info *ri;
+ struct bgp_path_info *pi;
if (red->redist_metric_flag && red->redist_metric == metric)
return 0;
for (rn = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); rn;
rn = bgp_route_next(rn)) {
- for (ri = rn->info; ri; ri = ri->next) {
- if (ri->sub_type == BGP_ROUTE_REDISTRIBUTE
- && ri->type == type
- && ri->instance == red->instance) {
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (pi->sub_type == BGP_ROUTE_REDISTRIBUTE
+ && pi->type == type
+ && pi->instance == red->instance) {
struct attr *old_attr;
struct attr new_attr;
- bgp_attr_dup(&new_attr, ri->attr);
+ bgp_attr_dup(&new_attr, pi->attr);
new_attr.med = red->redist_metric;
- old_attr = ri->attr;
- ri->attr = bgp_attr_intern(&new_attr);
+ old_attr = pi->attr;
+ pi->attr = bgp_attr_intern(&new_attr);
bgp_attr_unintern(&old_attr);
- bgp_path_info_set_flag(rn, ri,
+ bgp_path_info_set_flag(rn, pi,
BGP_PATH_ATTR_CHANGED);
bgp_process(bgp, rn, afi, SAFI_UNICAST);
}
{
afi_t afi; /* of the VN address */
struct bgp_node *bn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
char buf[PREFIX_STRLEN];
char buf2[RD_ADDRSTRLEN];
struct prefix_rd prd0;
__func__, peer, buf, prefix_rd2str(prd, buf2, sizeof(buf2)),
afi, safi, bn, (bn ? bn->info : NULL));
- for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) {
+ for (bpi = (bn ? bn->info : NULL); bpi; bpi = bpi->next) {
vnc_zlog_debug_verbose(
- "%s: trying bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p, local_pref=%u",
- __func__, bi, bi->peer, bi->type, bi->sub_type,
- (bi->extra ? bi->extra->vnc.export.rfapi_handle : NULL),
- ((bi->attr
- && CHECK_FLAG(bi->attr->flag,
+ "%s: trying bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p, local_pref=%u",
+ __func__, bpi, bpi->peer, bpi->type, bpi->sub_type,
+ (bpi->extra ? bpi->extra->vnc.export.rfapi_handle
+ : NULL),
+ ((bpi->attr
+ && CHECK_FLAG(bpi->attr->flag,
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)))
- ? bi->attr->local_pref
+ ? bpi->attr->local_pref
: 0));
- if (bi->peer == peer && bi->type == type
- && bi->sub_type == sub_type && bi->extra
- && bi->extra->vnc.export.rfapi_handle == (void *)rfd) {
+ if (bpi->peer == peer && bpi->type == type
+ && bpi->sub_type == sub_type && bpi->extra
+ && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
vnc_zlog_debug_verbose("%s: matched it", __func__);
* route. Leave the route itself in place.
* TBD add return code reporting of success/failure
*/
- if (!bi || !bi->extra
- || !bi->extra->vnc.export.local_nexthops) {
+ if (!bpi || !bpi->extra
+ || !bpi->extra->vnc.export.local_nexthops) {
/*
* no local nexthops
*/
struct listnode *node;
struct rfapi_nexthop *pLnh = NULL;
- for (ALL_LIST_ELEMENTS_RO(bi->extra->vnc.export.local_nexthops,
+ for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc.export.local_nexthops,
node, pLnh)) {
if (prefix_same(&pLnh->addr, &lnh->addr)) {
}
if (pLnh) {
- listnode_delete(bi->extra->vnc.export.local_nexthops,
+ listnode_delete(bpi->extra->vnc.export.local_nexthops,
pLnh);
/* silly rabbit, listnode_delete doesn't invoke
*/
rfapiProcessWithdraw(peer, rfd, p, prd, NULL, afi, safi, type, kill);
- if (bi) {
+ if (bpi) {
prefix2str(p, buf, sizeof(buf));
vnc_zlog_debug_verbose(
"%s: Found route (safi=%d) to delete at prefix %s",
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
- bgp, prd, table, p, bi);
+ bgp, prd, table, p, bpi);
}
bgp_unlock_node(prn);
}
/*
* Delete local_nexthops list
*/
- if (bi->extra && bi->extra->vnc.export.local_nexthops) {
- list_delete(
- &bi->extra->vnc.export.local_nexthops);
+ if (bpi->extra && bpi->extra->vnc.export.local_nexthops) {
+ list_delete(&bpi->extra->vnc.export.local_nexthops);
}
- bgp_aggregate_decrement(bgp, p, bi, afi, safi);
- bgp_path_info_delete(bn, bi);
+ bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
+ bgp_path_info_delete(bn, bpi);
bgp_process(bgp, bn, afi, safi);
} else {
vnc_zlog_debug_verbose(
{
afi_t afi; /* of the VN address */
struct bgp_path_info *new;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct bgp_node *bn;
struct attr attr = {0};
* ecommunity: POINTS TO interned/refcounted dynamic 2-part AS attr
* aspath: POINTS TO interned/refcounted hashed block
*/
- for (bi = bn->info; bi; bi = bi->next) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
/* probably only need to check
- * bi->extra->vnc.export.rfapi_handle */
- if (bi->peer == rfd->peer && bi->type == type
- && bi->sub_type == sub_type && bi->extra
- && bi->extra->vnc.export.rfapi_handle == (void *)rfd) {
+ * bpi->extra->vnc.export.rfapi_handle */
+ if (bpi->peer == rfd->peer && bpi->type == type
+ && bpi->sub_type == sub_type && bpi->extra
+ && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
break;
}
}
- if (bi) {
+ if (bpi) {
/*
* Adding new local_nexthop, which does not by itself change
* what is advertised via BGP
*/
if (lnh) {
- if (!bi->extra->vnc.export.local_nexthops) {
+ if (!bpi->extra->vnc.export.local_nexthops) {
/* TBD make arrangements to free when needed */
- bi->extra->vnc.export.local_nexthops =
+ bpi->extra->vnc.export.local_nexthops =
list_new();
- bi->extra->vnc.export.local_nexthops->del =
+ bpi->extra->vnc.export.local_nexthops->del =
rfapi_nexthop_free;
}
struct rfapi_nexthop *pLnh = NULL;
for (ALL_LIST_ELEMENTS_RO(
- bi->extra->vnc.export.local_nexthops, node,
- pLnh)) {
+ bpi->extra->vnc.export.local_nexthops,
+ node, pLnh)) {
if (prefix_same(&pLnh->addr, &lnh->addr)) {
break;
if (!pLnh) {
pLnh = rfapi_nexthop_new(lnh);
listnode_add(
- bi->extra->vnc.export.local_nexthops,
+ bpi->extra->vnc.export.local_nexthops,
pLnh);
}
}
- if (attrhash_cmp(bi->attr, new_attr)
- && !CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) {
+ if (attrhash_cmp(bpi->attr, new_attr)
+ && !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
bgp_attr_unintern(&new_attr);
bgp_unlock_node(bn);
goto done;
} else {
/* The attribute is changed. */
- bgp_path_info_set_flag(bn, bi, BGP_PATH_ATTR_CHANGED);
+ bgp_path_info_set_flag(bn, bpi, BGP_PATH_ATTR_CHANGED);
if (safi == SAFI_MPLS_VPN) {
struct bgp_node *prn = NULL;
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
- bgp, prd, table, p, bi);
+ bgp, prd, table, p, bpi);
}
bgp_unlock_node(prn);
}
/* Rewrite BGP route information. */
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
- bgp_path_info_restore(bn, bi);
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(bn, bpi);
else
- bgp_aggregate_decrement(bgp, p, bi, afi, safi);
- bgp_attr_unintern(&bi->attr);
- bi->attr = new_attr;
- bi->uptime = bgp_clock();
+ bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
+ bgp_attr_unintern(&bpi->attr);
+ bpi->attr = new_attr;
+ bpi->uptime = bgp_clock();
if (safi == SAFI_MPLS_VPN) {
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
- bgp, prd, table, p, bi);
+ bgp, prd, table, p, bpi);
}
bgp_unlock_node(prn);
}
/* Process change. */
- bgp_aggregate_increment(bgp, p, bi, afi, safi);
+ bgp_aggregate_increment(bgp, p, bpi, afi, safi);
bgp_process(bgp, bn, afi, safi);
bgp_unlock_node(bn);
{
struct bgp_node *rdn;
struct bgp_node *rn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
if (!bgp)
return;
if (!rn->info)
continue;
fprintf(stderr, "%s: rn=%p\n", __func__, rn);
- for (bi = rn->info; bi; bi = bi->next) {
- rfapiPrintBi((void *)2, bi); /* 2 => stderr */
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
+ rfapiPrintBi((void *)2, bpi); /* 2 => stderr */
}
}
}
if (!rn->info)
continue;
fprintf(stderr, "%s: rn=%p\n", __func__, rn);
- for (bi = rn->info; bi; bi = bi->next) {
- rfapiPrintBi((void *)2, bi); /* 2 => stderr */
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
+ rfapiPrintBi((void *)2, bpi); /* 2 => stderr */
}
}
}
extern void rfapi_vty_out_vncinfo(struct vty *vty, struct prefix *p,
- struct bgp_path_info *bi, safi_t safi);
+ struct bgp_path_info *bpi, safi_t safi);
extern void vnc_direct_bgp_vpn_enable(struct bgp *bgp, afi_t afi);
for (rn = agg_route_top(rt); rn;
rn = agg_route_next(rn)) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct bgp_path_info *next;
- for (bi = rn->info; bi; bi = next) {
- next = bi->next;
+ for (bpi = rn->info; bpi; bpi = next) {
+ next = bpi->next;
- if (CHECK_FLAG(bi->flags,
+ if (CHECK_FLAG(bpi->flags,
BGP_PATH_REMOVED)) {
++holddown_count;
} else {
- if (RFAPI_LOCAL_BI(bi)) {
+ if (RFAPI_LOCAL_BI(bpi)) {
++local_count;
} else {
if (RFAPI_DIRECT_IMPORT_BI(
- bi)) {
+ bpi)) {
++imported_count;
} else {
++remote_count;
*/
void rfapiCheckRefcount(struct agg_node *rn, safi_t safi, int lockoffset)
{
- unsigned int count_bi = 0;
+ unsigned int count_bpi = 0;
unsigned int count_monitor = 0;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct rfapi_monitor_encap *hme;
struct rfapi_monitor_vpn *hmv;
- for (bi = rn->info; bi; bi = bi->next)
- ++count_bi;
+ for (bpi = rn->info; bpi; bpi = bpi->next)
+ ++count_bpi;
if (rn->aggregate) {
}
}
- if (count_bi + count_monitor + lockoffset != rn->lock) {
+ if (count_bpi + count_monitor + lockoffset != rn->lock) {
vnc_zlog_debug_verbose(
- "%s: count_bi=%d, count_monitor=%d, lockoffset=%d, rn->lock=%d",
- __func__, count_bi, count_monitor, lockoffset,
+ "%s: count_bpi=%d, count_monitor=%d, lockoffset=%d, rn->lock=%d",
+ __func__, count_bpi, count_monitor, lockoffset,
rn->lock);
assert(0);
}
/*
* Get UN address wherever it might be
*/
-int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bi, struct prefix *p)
+int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p)
{
/* If it's in this route's VNC attribute, we're done */
- if (!rfapiGetVncTunnelUnAddr(bi->attr, p))
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, p))
return 0;
/*
* Otherwise, see if it's cached from a corresponding ENCAP SAFI
* advertisement
*/
- if (bi->extra) {
- switch (bi->extra->vnc.import.un_family) {
+ if (bpi->extra) {
+ switch (bpi->extra->vnc.import.un_family) {
case AF_INET:
if (p) {
- p->family = bi->extra->vnc.import.un_family;
- p->u.prefix4 = bi->extra->vnc.import.un.addr4;
+ p->family = bpi->extra->vnc.import.un_family;
+ p->u.prefix4 = bpi->extra->vnc.import.un.addr4;
p->prefixlen = 32;
}
return 0;
case AF_INET6:
if (p) {
- p->family = bi->extra->vnc.import.un_family;
- p->u.prefix6 = bi->extra->vnc.import.un.addr6;
+ p->family = bpi->extra->vnc.import.un_family;
+ p->u.prefix6 = bpi->extra->vnc.import.un.addr6;
p->prefixlen = 128;
}
return 0;
p->family = 0;
#if DEBUG_ENCAP_MONITOR
vnc_zlog_debug_verbose(
- "%s: bi->extra->vnc.import.un_family is 0, no UN addr",
+ "%s: bpi->extra->vnc.import.un_family is 0, no UN addr",
__func__);
#endif
break;
static struct rfapi_monitor_vpn *
rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset)
{
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct agg_node *par;
struct rfapi_monitor_vpn *m;
struct rfapi_monitor_vpn *mlast;
#endif
/*
- * 1. If there is at least one bi (either regular route or
+ * 1. If there is at least one bpi (either regular route or
* route marked as withdrawn, with a pending timer) at
* original_node with a valid UN address, we're done. Return.
*/
- for (bi = original_vpn_node->info; bi; bi = bi->next) {
+ for (bpi = original_vpn_node->info; bpi; bpi = bpi->next) {
struct prefix pfx;
- if (!rfapiGetUnAddrOfVpnBi(bi, &pfx)) {
+ if (!rfapiGetUnAddrOfVpnBi(bpi, &pfx)) {
#if DEBUG_MONITOR_MOVE_SHORTER
vnc_zlog_debug_verbose(
"%s: have valid UN at original node, no change",
*/
for (par = agg_node_parent(original_vpn_node); par;
par = agg_node_parent(par)) {
- for (bi = par->info; bi; bi = bi->next) {
+ for (bpi = par->info; bpi; bpi = bpi->next) {
struct prefix pfx;
- if (!rfapiGetUnAddrOfVpnBi(bi, &pfx)) {
+ if (!rfapiGetUnAddrOfVpnBi(bpi, &pfx)) {
break;
}
}
- if (bi)
+ if (bpi)
break;
}
{
struct rfapi_monitor_vpn *monitor;
struct rfapi_monitor_vpn *mlast;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct agg_node *par;
RFAPI_CHECK_REFCOUNT(new_vpn_node, SAFI_MPLS_VPN, 0);
/*
* Make sure we have at least one valid route at the new node
*/
- for (bi = new_vpn_node->info; bi; bi = bi->next) {
+ for (bpi = new_vpn_node->info; bpi; bpi = bpi->next) {
struct prefix pfx;
- if (!rfapiGetUnAddrOfVpnBi(bi, &pfx))
+ if (!rfapiGetUnAddrOfVpnBi(bpi, &pfx))
break;
}
- if (!bi) {
+ if (!bpi) {
vnc_zlog_debug_verbose(
"%s: no valid routes at node %p, so not attempting moves",
__func__, new_vpn_node);
}
-static void rfapiBgpInfoChainFree(struct bgp_path_info *bi)
+static void rfapiBgpInfoChainFree(struct bgp_path_info *bpi)
{
struct bgp_path_info *next;
- while (bi) {
+ while (bpi) {
/*
- * If there is a timer waiting to delete this bi, cancel
+ * If there is a timer waiting to delete this bpi, cancel
* the timer and delete immediately
*/
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)
- && bi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
+ && bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi->extra->vnc.import.timer;
+ (struct thread *)bpi->extra->vnc.import.timer;
struct rfapi_withdraw *wcb = t->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t);
}
- next = bi->next;
- bi->next = NULL;
- rfapiBgpInfoFree(bi);
- bi = next;
+ next = bpi->next;
+ bpi->next = NULL;
+ rfapiBgpInfoFree(bpi);
+ bpi = next;
}
}
return ENOENT;
}
-static int rfapiVpnBiNhEqualsPt(struct bgp_path_info *bi,
+static int rfapiVpnBiNhEqualsPt(struct bgp_path_info *bpi,
struct rfapi_ip_addr *hpt)
{
uint8_t family;
- if (!hpt || !bi)
+ if (!hpt || !bpi)
return 0;
- family = BGP_MP_NEXTHOP_FAMILY(bi->attr->mp_nexthop_len);
+ family = BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len);
if (hpt->addr_family != family)
return 0;
switch (family) {
case AF_INET:
- if (bi->attr->mp_nexthop_global_in.s_addr
+ if (bpi->attr->mp_nexthop_global_in.s_addr
!= hpt->addr.v4.s_addr)
return 0;
break;
case AF_INET6:
- if (IPV6_ADDR_CMP(&bi->attr->mp_nexthop_global, &hpt->addr.v6))
+ if (IPV6_ADDR_CMP(&bpi->attr->mp_nexthop_global, &hpt->addr.v6))
return 0;
break;
/*
* Compare 2 VPN BIs. Return true if they have the same VN and UN addresses
*/
-static int rfapiVpnBiSamePtUn(struct bgp_path_info *bi1,
- struct bgp_path_info *bi2)
+static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
+ struct bgp_path_info *bpi2)
{
struct prefix pfx_un1;
struct prefix pfx_un2;
- if (!bi1 || !bi2)
+ if (!bpi1 || !bpi2)
return 0;
- if (!bi1->attr || !bi2->attr)
+ if (!bpi1->attr || !bpi2->attr)
return 0;
/*
* VN address comparisons
*/
- if (BGP_MP_NEXTHOP_FAMILY(bi1->attr->mp_nexthop_len)
- != BGP_MP_NEXTHOP_FAMILY(bi2->attr->mp_nexthop_len)) {
+ if (BGP_MP_NEXTHOP_FAMILY(bpi1->attr->mp_nexthop_len)
+ != BGP_MP_NEXTHOP_FAMILY(bpi2->attr->mp_nexthop_len)) {
return 0;
}
- switch (BGP_MP_NEXTHOP_FAMILY(bi1->attr->mp_nexthop_len)) {
+ switch (BGP_MP_NEXTHOP_FAMILY(bpi1->attr->mp_nexthop_len)) {
case AF_INET:
- if (bi1->attr->mp_nexthop_global_in.s_addr
- != bi2->attr->mp_nexthop_global_in.s_addr)
+ if (bpi1->attr->mp_nexthop_global_in.s_addr
+ != bpi2->attr->mp_nexthop_global_in.s_addr)
return 0;
break;
case AF_INET6:
- if (IPV6_ADDR_CMP(&bi1->attr->mp_nexthop_global,
- &bi2->attr->mp_nexthop_global))
+ if (IPV6_ADDR_CMP(&bpi1->attr->mp_nexthop_global,
+ &bpi2->attr->mp_nexthop_global))
return 0;
break;
/*
* UN address comparisons
*/
- if (rfapiGetVncTunnelUnAddr(bi1->attr, &pfx_un1)) {
- if (bi1->extra) {
- pfx_un1.family = bi1->extra->vnc.import.un_family;
- switch (bi1->extra->vnc.import.un_family) {
+ if (rfapiGetVncTunnelUnAddr(bpi1->attr, &pfx_un1)) {
+ if (bpi1->extra) {
+ pfx_un1.family = bpi1->extra->vnc.import.un_family;
+ switch (bpi1->extra->vnc.import.un_family) {
case AF_INET:
pfx_un1.u.prefix4 =
- bi1->extra->vnc.import.un.addr4;
+ bpi1->extra->vnc.import.un.addr4;
break;
case AF_INET6:
pfx_un1.u.prefix6 =
- bi1->extra->vnc.import.un.addr6;
+ bpi1->extra->vnc.import.un.addr6;
break;
default:
pfx_un1.family = 0;
}
}
- if (rfapiGetVncTunnelUnAddr(bi2->attr, &pfx_un2)) {
- if (bi2->extra) {
- pfx_un2.family = bi2->extra->vnc.import.un_family;
- switch (bi2->extra->vnc.import.un_family) {
+ if (rfapiGetVncTunnelUnAddr(bpi2->attr, &pfx_un2)) {
+ if (bpi2->extra) {
+ pfx_un2.family = bpi2->extra->vnc.import.un_family;
+ switch (bpi2->extra->vnc.import.un_family) {
case AF_INET:
pfx_un2.u.prefix4 =
- bi2->extra->vnc.import.un.addr4;
+ bpi2->extra->vnc.import.un.addr4;
break;
case AF_INET6:
pfx_un2.u.prefix6 =
- bi2->extra->vnc.import.un.addr6;
+ bpi2->extra->vnc.import.un.addr6;
break;
default:
pfx_un2.family = 0;
static struct rfapi_next_hop_entry *
rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
- struct bgp_path_info *bi, /* route to encode */
- uint32_t lifetime, /* use this in nhe */
- struct agg_node *rn) /* req for L2 eth addr */
+ struct bgp_path_info *bpi, /* route to encode */
+ uint32_t lifetime, /* use this in nhe */
+ struct agg_node *rn) /* req for L2 eth addr */
{
struct rfapi_next_hop_entry *new;
int have_vnc_tunnel_un = 0;
#if DEBUG_ENCAP_MONITOR
- vnc_zlog_debug_verbose("%s: entry, bi %p, rn %p", __func__, bi, rn);
+ vnc_zlog_debug_verbose("%s: entry, bpi %p, rn %p", __func__, bpi, rn);
#endif
new = XCALLOC(MTYPE_RFAPI_NEXTHOP, sizeof(struct rfapi_next_hop_entry));
new->prefix = *rprefix;
- if (bi->extra
- && decode_rd_type(bi->extra->vnc.import.rd.val)
+ if (bpi->extra
+ && decode_rd_type(bpi->extra->vnc.import.rd.val)
== RD_TYPE_VNC_ETH) {
/* ethernet */
memcpy(&vo->v.l2addr.macaddr, &rn->p.u.prefix_eth.octet,
ETH_ALEN);
/* only low 3 bytes of this are significant */
- if (bi->attr) {
+ if (bpi->attr) {
(void)rfapiEcommunityGetLNI(
- bi->attr->ecommunity,
+ bpi->attr->ecommunity,
&vo->v.l2addr.logical_net_id);
(void)rfapiEcommunityGetEthernetTag(
- bi->attr->ecommunity, &vo->v.l2addr.tag_id);
+ bpi->attr->ecommunity, &vo->v.l2addr.tag_id);
}
/* local_nve_id comes from lower byte of RD type */
- vo->v.l2addr.local_nve_id = bi->extra->vnc.import.rd.val[1];
+ vo->v.l2addr.local_nve_id = bpi->extra->vnc.import.rd.val[1];
/* label comes from MP_REACH_NLRI label */
- vo->v.l2addr.label = decode_label(&bi->extra->label[0]);
+ vo->v.l2addr.label = decode_label(&bpi->extra->label[0]);
new->vn_options = vo;
* If there is an auxiliary prefix (i.e., host IP address),
* use it as the nexthop prefix instead of the query prefix
*/
- if (bi->extra->vnc.import.aux_prefix.family) {
- rfapiQprefix2Rprefix(&bi->extra->vnc.import.aux_prefix,
+ if (bpi->extra->vnc.import.aux_prefix.family) {
+ rfapiQprefix2Rprefix(&bpi->extra->vnc.import.aux_prefix,
&new->prefix);
}
}
- if (bi->attr) {
+ if (bpi->attr) {
bgp_encap_types tun_type;
- new->prefix.cost = rfapiRfpCost(bi->attr);
+ new->prefix.cost = rfapiRfpCost(bpi->attr);
struct bgp_attr_encap_subtlv *pEncap;
- switch (BGP_MP_NEXTHOP_FAMILY(bi->attr->mp_nexthop_len)) {
+ switch (BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len)) {
case AF_INET:
new->vn_address.addr_family = AF_INET;
new->vn_address.addr.v4 =
- bi->attr->mp_nexthop_global_in;
+ bpi->attr->mp_nexthop_global_in;
break;
case AF_INET6:
new->vn_address.addr_family = AF_INET6;
- new->vn_address.addr.v6 = bi->attr->mp_nexthop_global;
+ new->vn_address.addr.v6 = bpi->attr->mp_nexthop_global;
break;
default:
zlog_warn("%s: invalid vpn nexthop length: %d",
- __func__, bi->attr->mp_nexthop_len);
+ __func__, bpi->attr->mp_nexthop_len);
rfapi_free_next_hop_list(new);
return NULL;
}
- for (pEncap = bi->attr->vnc_subtlvs; pEncap;
+ for (pEncap = bpi->attr->vnc_subtlvs; pEncap;
pEncap = pEncap->next) {
switch (pEncap->type) {
case BGP_VNC_SUBTLV_TYPE_LIFETIME:
}
}
- rfapiGetTunnelType(bi->attr, &tun_type);
+ rfapiGetTunnelType(bpi->attr, &tun_type);
if (tun_type == BGP_ENCAP_TYPE_MPLS) {
struct prefix p;
/* MPLS carries UN address in next hop */
- rfapiNexthop2Prefix(bi->attr, &p);
+ rfapiNexthop2Prefix(bpi->attr, &p);
if (p.family != 0) {
rfapiQprefix2Raddr(&p, &new->un_address);
have_vnc_tunnel_un = 1;
}
}
- for (pEncap = bi->attr->encap_subtlvs; pEncap;
+ for (pEncap = bpi->attr->encap_subtlvs; pEncap;
pEncap = pEncap->next) {
switch (pEncap->type) {
case BGP_ENCAP_SUBTLV_TYPE_REMOTE_ENDPOINT:
default:
zlog_warn(
- "%s: invalid tunnel subtlv UN addr length (%d) for bi %p",
- __func__, pEncap->length, bi);
+ "%s: invalid tunnel subtlv UN addr length (%d) for bpi %p",
+ __func__, pEncap->length, bpi);
}
break;
}
}
- new->un_options = rfapi_encap_tlv_to_un_option(bi->attr);
+ new->un_options = rfapi_encap_tlv_to_un_option(bpi->attr);
#if DEBUG_ENCAP_MONITOR
vnc_zlog_debug_verbose("%s: line %d: have_vnc_tunnel_un=%d",
__func__, __LINE__, have_vnc_tunnel_un);
#endif
- if (!have_vnc_tunnel_un && bi->extra) {
+ if (!have_vnc_tunnel_un && bpi->extra) {
/*
* use cached UN address from ENCAP route
*/
new->un_address.addr_family =
- bi->extra->vnc.import.un_family;
+ bpi->extra->vnc.import.un_family;
switch (new->un_address.addr_family) {
case AF_INET:
new->un_address.addr.v4 =
- bi->extra->vnc.import.un.addr4;
+ bpi->extra->vnc.import.un.addr4;
break;
case AF_INET6:
new->un_address.addr.v6 =
- bi->extra->vnc.import.un.addr6;
+ bpi->extra->vnc.import.un.addr6;
break;
default:
zlog_warn(
- "%s: invalid UN addr family (%d) for bi %p",
+ "%s: invalid UN addr family (%d) for bpi %p",
__func__, new->un_address.addr_family,
- bi);
+ bpi);
rfapi_free_next_hop_list(new);
return NULL;
break;
int rfapiHasNonRemovedRoutes(struct agg_node *rn)
{
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
struct prefix pfx;
- if (!CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)
- && (bi->extra && !rfapiGetUnAddrOfVpnBi(bi, &pfx))) {
+ if (!CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
+ && (bpi->extra && !rfapiGetUnAddrOfVpnBi(bpi, &pfx))) {
return 1;
}
*/
void rfapiDumpNode(struct agg_node *rn)
{
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
vnc_zlog_debug_verbose("%s: rn=%p", __func__, rn);
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
struct prefix pfx;
- int ctrc = rfapiGetUnAddrOfVpnBi(bi, &pfx);
+ int ctrc = rfapiGetUnAddrOfVpnBi(bpi, &pfx);
int nr;
- if (!CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)
- && (bi->extra && !ctrc)) {
+ if (!CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
+ && (bpi->extra && !ctrc)) {
nr = 1;
} else {
}
vnc_zlog_debug_verbose(
- " bi=%p, nr=%d, flags=0x%x, extra=%p, ctrc=%d", bi, nr,
- bi->flags, bi->extra, ctrc);
+ " bpi=%p, nr=%d, flags=0x%x, extra=%p, ctrc=%d", bpi,
+ nr, bpi->flags, bpi->extra, ctrc);
}
}
#endif
struct agg_node *rfd_rib_node, /* preload this NVE rib node */
struct prefix *pfx_target_original) /* query target */
{
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct rfapi_next_hop_entry *new;
struct prefix pfx_un;
struct skiplist *seen_nexthops;
seen_nexthops =
skiplist_new(0, vnc_prefix_cmp, (void (*)(void *))prefix_free);
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
struct prefix pfx_vn;
struct prefix *newpfx;
- if (removed && !CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) {
+ if (removed && !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
#if DEBUG_RETURNED_NHL
vnc_zlog_debug_verbose(
"%s: want holddown, this route not holddown, skip",
#endif
continue;
}
- if (!removed && CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) {
+ if (!removed && CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
continue;
}
- if (!bi->extra) {
+ if (!bpi->extra) {
continue;
}
/*
* Check for excluded VN address
*/
- if (rfapiVpnBiNhEqualsPt(bi, exclude_vnaddr))
+ if (rfapiVpnBiNhEqualsPt(bpi, exclude_vnaddr))
continue;
/*
if (is_l2) {
/* L2 routes: semantic nexthop in aux_prefix; VN addr
* ain't it */
- pfx_vn = bi->extra->vnc.import.aux_prefix;
+ pfx_vn = bpi->extra->vnc.import.aux_prefix;
} else {
- rfapiNexthop2Prefix(bi->attr, &pfx_vn);
+ rfapiNexthop2Prefix(bpi->attr, &pfx_vn);
}
if (!skiplist_search(seen_nexthops, &pfx_vn, NULL)) {
#if DEBUG_RETURNED_NHL
continue;
}
- if (rfapiGetUnAddrOfVpnBi(bi, &pfx_un)) {
+ if (rfapiGetUnAddrOfVpnBi(bpi, &pfx_un)) {
#if DEBUG_ENCAP_MONITOR
vnc_zlog_debug_verbose(
- "%s: failed to get UN address of this VPN bi",
+ "%s: failed to get UN address of this VPN bpi",
__func__);
#endif
continue;
*newpfx = pfx_vn;
skiplist_insert(seen_nexthops, newpfx, newpfx);
- new = rfapiRouteInfo2NextHopEntry(rprefix, bi, lifetime, rn);
+ new = rfapiRouteInfo2NextHopEntry(rprefix, bpi, lifetime, rn);
if (new) {
if (rfapiRibPreloadBi(rfd_rib_node, &pfx_vn, &pfx_un,
- lifetime, bi)) {
+ lifetime, bpi)) {
/* duplicate filtered by RIB */
rfapi_free_next_hop_list(new);
new = NULL;
}
/*
- * Insert a new bi to the imported route table node,
- * keeping the list of BIs sorted best route first
+ * Insert a new bpi to the imported route table node,
+ * keeping the list of BPIs sorted best route first
*/
static void rfapiBgpInfoAttachSorted(struct agg_node *rn,
struct bgp_path_info *info_new, afi_t afi,
bgp_attr_intern(info_new->attr);
}
-static void rfapiBgpInfoDetach(struct agg_node *rn, struct bgp_path_info *bi)
+static void rfapiBgpInfoDetach(struct agg_node *rn, struct bgp_path_info *bpi)
{
/*
* Remove the route (doubly-linked)
*/
- // bgp_attr_unintern (&bi->attr);
- if (bi->next)
- bi->next->prev = bi->prev;
- if (bi->prev)
- bi->prev->next = bi->next;
+ // bgp_attr_unintern (&bpi->attr);
+ if (bpi->next)
+ bpi->next->prev = bpi->prev;
+ if (bpi->prev)
+ bpi->prev->next = bpi->next;
else
- rn->info = bi->next;
+ rn->info = bpi->next;
}
/*
*/
static int rfapi_bi_peer_rd_cmp(void *b1, void *b2)
{
- struct bgp_path_info *bi1 = b1;
- struct bgp_path_info *bi2 = b2;
+ struct bgp_path_info *bpi1 = b1;
+ struct bgp_path_info *bpi2 = b2;
/*
* Compare peers
*/
- if (bi1->peer < bi2->peer)
+ if (bpi1->peer < bpi2->peer)
return -1;
- if (bi1->peer > bi2->peer)
+ if (bpi1->peer > bpi2->peer)
return 1;
/*
* compare RDs
*/
- return vnc_prefix_cmp((struct prefix *)&bi1->extra->vnc.import.rd,
- (struct prefix *)&bi2->extra->vnc.import.rd);
+ return vnc_prefix_cmp((struct prefix *)&bpi1->extra->vnc.import.rd,
+ (struct prefix *)&bpi2->extra->vnc.import.rd);
}
/*
* For L2-indexed import tables
- * The BIs in these tables should ALWAYS have an aux_prefix set because
+ * The BPIs in these tables should ALWAYS have an aux_prefix set because
* they arrive via IPv4 or IPv6 advertisements.
*/
static int rfapi_bi_peer_rd_aux_cmp(void *b1, void *b2)
{
- struct bgp_path_info *bi1 = b1;
- struct bgp_path_info *bi2 = b2;
+ struct bgp_path_info *bpi1 = b1;
+ struct bgp_path_info *bpi2 = b2;
int rc;
/*
* Compare peers
*/
- if (bi1->peer < bi2->peer)
+ if (bpi1->peer < bpi2->peer)
return -1;
- if (bi1->peer > bi2->peer)
+ if (bpi1->peer > bpi2->peer)
return 1;
/*
* compare RDs
*/
- rc = vnc_prefix_cmp((struct prefix *)&bi1->extra->vnc.import.rd,
- (struct prefix *)&bi2->extra->vnc.import.rd);
+ rc = vnc_prefix_cmp((struct prefix *)&bpi1->extra->vnc.import.rd,
+ (struct prefix *)&bpi2->extra->vnc.import.rd);
if (rc) {
return rc;
}
*
* Use presence of aux_prefix with AF=ethernet and prefixlen=1
* as magic value to signify explicit wildcarding of the aux_prefix.
- * This magic value will not appear in bona fide bi entries in
- * the import table, but is allowed in the "fake" bi used to
+ * This magic value will not appear in bona fide bpi entries in
+ * the import table, but is allowed in the "fake" bpi used to
* probe the table when searching. (We have to test both b1 and b2
* because there is no guarantee of the order the test key and
* the real key will be passed)
*/
- if ((bi1->extra->vnc.import.aux_prefix.family == AF_ETHERNET
- && (bi1->extra->vnc.import.aux_prefix.prefixlen == 1))
- || (bi2->extra->vnc.import.aux_prefix.family == AF_ETHERNET
- && (bi2->extra->vnc.import.aux_prefix.prefixlen == 1))) {
+ if ((bpi1->extra->vnc.import.aux_prefix.family == AF_ETHERNET
+ && (bpi1->extra->vnc.import.aux_prefix.prefixlen == 1))
+ || (bpi2->extra->vnc.import.aux_prefix.family == AF_ETHERNET
+ && (bpi2->extra->vnc.import.aux_prefix.prefixlen == 1))) {
/*
* wildcard aux address specified
return 0;
}
- return vnc_prefix_cmp(&bi1->extra->vnc.import.aux_prefix,
- &bi2->extra->vnc.import.aux_prefix);
+ return vnc_prefix_cmp(&bpi1->extra->vnc.import.aux_prefix,
+ &bpi2->extra->vnc.import.aux_prefix);
}
* Index on RD and Peer
*/
static void rfapiItBiIndexAdd(struct agg_node *rn, /* Import table VPN node */
- struct bgp_path_info *bi) /* new BI */
+ struct bgp_path_info *bpi) /* new BPI */
{
struct skiplist *sl;
assert(rn);
- assert(bi);
- assert(bi->extra);
+ assert(bpi);
+ assert(bpi->extra);
{
char buf[RD_ADDRSTRLEN];
- vnc_zlog_debug_verbose("%s: bi %p, peer %p, rd %s", __func__,
- bi, bi->peer,
- prefix_rd2str(&bi->extra->vnc.import.rd,
+ vnc_zlog_debug_verbose("%s: bpi %p, peer %p, rd %s", __func__,
+ bpi, bpi->peer,
+ prefix_rd2str(&bpi->extra->vnc.import.rd,
buf, sizeof(buf)));
}
RFAPI_IT_EXTRA_GET(rn)->u.vpn.idx_rd = sl;
agg_lock_node(rn); /* for skiplist */
}
- assert(!skiplist_insert(sl, (void *)bi, (void *)bi));
+ assert(!skiplist_insert(sl, (void *)bpi, (void *)bpi));
agg_lock_node(rn); /* for skiplist entry */
- /* NB: BIs in import tables are not refcounted */
+ /* NB: BPIs in import tables are not refcounted */
}
static void rfapiItBiIndexDump(struct agg_node *rn)
} else
strncpy(buf_aux_pfx, "(none)", PREFIX_STRLEN);
- vnc_zlog_debug_verbose("bi %p, peer %p, rd %s, aux_prefix %s",
+ vnc_zlog_debug_verbose("bpi %p, peer %p, rd %s, aux_prefix %s",
k, k->peer, buf, buf_aux_pfx);
}
}
{
struct skiplist *sl;
int rc;
- struct bgp_path_info bi_fake;
- struct bgp_path_info_extra bi_extra;
- struct bgp_path_info *bi_result;
+ struct bgp_path_info bpi_fake;
+ struct bgp_path_info_extra bpi_extra;
+ struct bgp_path_info *bpi_result;
sl = RFAPI_RDINDEX(rn);
if (!sl)
vnc_zlog_debug_verbose("%s: short list algorithm", __func__);
#endif
/* if short list, linear search might be faster */
- for (bi_result = rn->info; bi_result;
- bi_result = bi_result->next) {
+ for (bpi_result = rn->info; bpi_result;
+ bpi_result = bpi_result->next) {
#if DEBUG_BI_SEARCH
{
char buf[RD_ADDRSTRLEN];
vnc_zlog_debug_verbose(
- "%s: bi has prd=%s, peer=%p", __func__,
- prefix_rd2str(&bi_result->extra->vnc
+ "%s: bpi has prd=%s, peer=%p", __func__,
+ prefix_rd2str(&bpi_result->extra->vnc
.import.rd,
buf, sizeof(buf)),
- bi_result->peer);
+ bpi_result->peer);
}
#endif
- if (peer == bi_result->peer
- && !prefix_cmp((struct prefix *)&bi_result->extra
+ if (peer == bpi_result->peer
+ && !prefix_cmp((struct prefix *)&bpi_result->extra
->vnc.import.rd,
(struct prefix *)prd)) {
__func__);
#endif
if (!aux_prefix
- || !prefix_cmp(aux_prefix,
- &bi_result->extra->vnc.import
- .aux_prefix)) {
+ || !prefix_cmp(
+ aux_prefix,
+ &bpi_result->extra->vnc.import
+ .aux_prefix)) {
#if DEBUG_BI_SEARCH
vnc_zlog_debug_verbose("%s: match",
}
}
}
- return bi_result;
+ return bpi_result;
}
- bi_fake.peer = peer;
- bi_fake.extra = &bi_extra;
- bi_fake.extra->vnc.import.rd = *(struct prefix_rd *)prd;
+ bpi_fake.peer = peer;
+ bpi_fake.extra = &bpi_extra;
+ bpi_fake.extra->vnc.import.rd = *(struct prefix_rd *)prd;
if (aux_prefix) {
- bi_fake.extra->vnc.import.aux_prefix = *aux_prefix;
+ bpi_fake.extra->vnc.import.aux_prefix = *aux_prefix;
} else {
/* wildcard */
- bi_fake.extra->vnc.import.aux_prefix.family = AF_ETHERNET;
- bi_fake.extra->vnc.import.aux_prefix.prefixlen = 1;
+ bpi_fake.extra->vnc.import.aux_prefix.family = AF_ETHERNET;
+ bpi_fake.extra->vnc.import.aux_prefix.prefixlen = 1;
}
- rc = skiplist_search(sl, (void *)&bi_fake, (void *)&bi_result);
+ rc = skiplist_search(sl, (void *)&bpi_fake, (void *)&bpi_result);
if (rc) {
#if DEBUG_BI_SEARCH
}
#if DEBUG_BI_SEARCH
- vnc_zlog_debug_verbose("%s: matched bi=%p", __func__, bi_result);
+ vnc_zlog_debug_verbose("%s: matched bpi=%p", __func__, bpi_result);
#endif
- return bi_result;
+ return bpi_result;
}
static void rfapiItBiIndexDel(struct agg_node *rn, /* Import table VPN node */
- struct bgp_path_info *bi) /* old BI */
+ struct bgp_path_info *bpi) /* old BPI */
{
struct skiplist *sl;
int rc;
{
char buf[RD_ADDRSTRLEN];
- vnc_zlog_debug_verbose("%s: bi %p, peer %p, rd %s", __func__,
- bi, bi->peer,
- prefix_rd2str(&bi->extra->vnc.import.rd,
+ vnc_zlog_debug_verbose("%s: bpi %p, peer %p, rd %s", __func__,
+ bpi, bpi->peer,
+ prefix_rd2str(&bpi->extra->vnc.import.rd,
buf, sizeof(buf)));
}
sl = RFAPI_RDINDEX(rn);
assert(sl);
- rc = skiplist_delete(sl, (void *)(bi), (void *)bi);
+ rc = skiplist_delete(sl, (void *)(bpi), (void *)bpi);
if (rc) {
rfapiItBiIndexDump(rn);
}
agg_unlock_node(rn); /* for skiplist entry */
- /* NB: BIs in import tables are not refcounted */
+ /* NB: BPIs in import tables are not refcounted */
}
/*
*/
static void
rfapiMonitorEncapAdd(struct rfapi_import_table *import_table,
- struct prefix *p, /* VN address */
- struct agg_node *vpn_rn, /* VPN node */
- struct bgp_path_info *vpn_bi) /* VPN bi/route */
+ struct prefix *p, /* VN address */
+ struct agg_node *vpn_rn, /* VPN node */
+ struct bgp_path_info *vpn_bpi) /* VPN bpi/route */
{
afi_t afi = family2afi(p->family);
struct agg_node *rn;
assert(m);
m->node = vpn_rn;
- m->bi = vpn_bi;
+ m->bpi = vpn_bpi;
m->rn = rn;
/* insert to encap node's list */
RFAPI_MONITOR_ENCAP_W_ALLOC(rn) = m;
/* for easy lookup when deleting vpn route */
- vpn_bi->extra->vnc.import.hme = m;
+ vpn_bpi->extra->vnc.import.hme = m;
vnc_zlog_debug_verbose(
- "%s: it=%p, vpn_bi=%p, afi=%d, encap rn=%p, setting vpn_bi->extra->vnc.import.hme=%p",
- __func__, import_table, vpn_bi, afi, rn, m);
+ "%s: it=%p, vpn_bpi=%p, afi=%d, encap rn=%p, setting vpn_bpi->extra->vnc.import.hme=%p",
+ __func__, import_table, vpn_bpi, afi, rn, m);
RFAPI_CHECK_REFCOUNT(rn, SAFI_ENCAP, 0);
- bgp_attr_intern(vpn_bi->attr);
+ bgp_attr_intern(vpn_bpi->attr);
}
-static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bi)
+static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi)
{
/*
* Remove encap monitor
*/
- vnc_zlog_debug_verbose("%s: vpn_bi=%p", __func__, vpn_bi);
- if (vpn_bi->extra) {
- struct rfapi_monitor_encap *hme = vpn_bi->extra->vnc.import.hme;
+ vnc_zlog_debug_verbose("%s: vpn_bpi=%p", __func__, vpn_bpi);
+ if (vpn_bpi->extra) {
+ struct rfapi_monitor_encap *hme =
+ vpn_bpi->extra->vnc.import.hme;
if (hme) {
agg_unlock_node(hme->rn); /* decr ref count */
XFREE(MTYPE_RFAPI_MONITOR_ENCAP, hme);
- vpn_bi->extra->vnc.import.hme = NULL;
+ vpn_bpi->extra->vnc.import.hme = NULL;
}
}
}
static int rfapiWithdrawTimerVPN(struct thread *t)
{
struct rfapi_withdraw *wcb = t->arg;
- struct bgp_path_info *bi = wcb->info;
+ struct bgp_path_info *bpi = wcb->info;
struct bgp *bgp = bgp_get_default();
struct rfapi_monitor_vpn *moved;
afi_t afi;
assert(wcb->node);
- assert(bi);
+ assert(bpi);
assert(wcb->import_table);
- assert(bi->extra);
+ assert(bpi->extra);
RFAPI_CHECK_REFCOUNT(wcb->node, SAFI_MPLS_VPN, wcb->lockoffset);
char buf[BUFSIZ];
vnc_zlog_debug_verbose(
- "%s: removing bi %p at prefix %s/%d", __func__, bi,
+ "%s: removing bpi %p at prefix %s/%d", __func__, bpi,
rfapi_ntop(wcb->node->p.family, &wcb->node->p.u.prefix,
buf, BUFSIZ),
wcb->node->p.prefixlen);
/*
* Remove the route (doubly-linked)
*/
- if (CHECK_FLAG(bi->flags, BGP_PATH_VALID)
- && VALID_INTERIOR_TYPE(bi->type))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_VALID)
+ && VALID_INTERIOR_TYPE(bpi->type))
RFAPI_MONITOR_EXTERIOR(wcb->node)->valid_interior_count--;
afi = family2afi(wcb->node->p.family);
wcb->import_table->holddown_count[afi] -= 1; /* keep count consistent */
- rfapiItBiIndexDel(wcb->node, bi);
- rfapiBgpInfoDetach(wcb->node, bi); /* with removed bi */
+ rfapiItBiIndexDel(wcb->node, bpi);
+ rfapiBgpInfoDetach(wcb->node, bpi); /* with removed bpi */
vnc_import_bgp_exterior_del_route_interior(bgp, wcb->import_table,
- wcb->node, bi);
+ wcb->node, bpi);
/*
& BGP_VNC_CONFIG_RESPONSE_REMOVAL_DISABLE)) {
int has_valid_duplicate = 0;
- struct bgp_path_info *bii;
+ struct bgp_path_info *bpii;
/*
* First check if there are any OTHER routes at this node
* there are (e.g., from other peers), then the route isn't
* really gone, so skip sending a response removal message.
*/
- for (bii = wcb->node->info; bii; bii = bii->next) {
- if (rfapiVpnBiSamePtUn(bi, bii)) {
+ for (bpii = wcb->node->info; bpii; bpii = bpii->next) {
+ if (rfapiVpnBiSamePtUn(bpi, bpii)) {
has_valid_duplicate = 1;
break;
}
}
}
- rfapiMonitorEncapDelete(bi);
+ rfapiMonitorEncapDelete(bpi);
/*
* If there are no VPN monitors at this VPN Node A,
done:
/*
- * Free VPN bi
+ * Free VPN bpi
*/
- rfapiBgpInfoFree(bi);
+ rfapiBgpInfoFree(bpi);
wcb->info = NULL;
/*
return 1;
}
-static void rfapiCopyUnEncap2VPN(struct bgp_path_info *encap_bi,
- struct bgp_path_info *vpn_bi)
+static void rfapiCopyUnEncap2VPN(struct bgp_path_info *encap_bpi,
+ struct bgp_path_info *vpn_bpi)
{
- if (!encap_bi->attr) {
- zlog_warn("%s: no encap bi attr/extra, can't copy UN address",
+ if (!encap_bpi->attr) {
+ zlog_warn("%s: no encap bpi attr/extra, can't copy UN address",
__func__);
return;
}
- if (!vpn_bi || !vpn_bi->extra) {
- zlog_warn("%s: no vpn bi attr/extra, can't copy UN address",
+ if (!vpn_bpi || !vpn_bpi->extra) {
+ zlog_warn("%s: no vpn bpi attr/extra, can't copy UN address",
__func__);
return;
}
- switch (BGP_MP_NEXTHOP_FAMILY(encap_bi->attr->mp_nexthop_len)) {
+ switch (BGP_MP_NEXTHOP_FAMILY(encap_bpi->attr->mp_nexthop_len)) {
case AF_INET:
/*
* instrumentation to debug segfault of 091127
*/
- vnc_zlog_debug_verbose("%s: vpn_bi=%p", __func__, vpn_bi);
- if (vpn_bi) {
- vnc_zlog_debug_verbose("%s: vpn_bi->extra=%p", __func__,
- vpn_bi->extra);
+ vnc_zlog_debug_verbose("%s: vpn_bpi=%p", __func__, vpn_bpi);
+ if (vpn_bpi) {
+ vnc_zlog_debug_verbose("%s: vpn_bpi->extra=%p",
+ __func__, vpn_bpi->extra);
}
- vpn_bi->extra->vnc.import.un_family = AF_INET;
- vpn_bi->extra->vnc.import.un.addr4 =
- encap_bi->attr->mp_nexthop_global_in;
+ vpn_bpi->extra->vnc.import.un_family = AF_INET;
+ vpn_bpi->extra->vnc.import.un.addr4 =
+ encap_bpi->attr->mp_nexthop_global_in;
break;
case AF_INET6:
- vpn_bi->extra->vnc.import.un_family = AF_INET6;
- vpn_bi->extra->vnc.import.un.addr6 =
- encap_bi->attr->mp_nexthop_global;
+ vpn_bpi->extra->vnc.import.un_family = AF_INET6;
+ vpn_bpi->extra->vnc.import.un.addr6 =
+ encap_bpi->attr->mp_nexthop_global;
break;
default:
zlog_warn("%s: invalid encap nexthop length: %d", __func__,
- encap_bi->attr->mp_nexthop_len);
- vpn_bi->extra->vnc.import.un_family = 0;
+ encap_bpi->attr->mp_nexthop_len);
+ vpn_bpi->extra->vnc.import.un_family = 0;
break;
}
}
/*
* returns 0 on success, nonzero on error
*/
-static int rfapiWithdrawEncapUpdateCachedUn(
- struct rfapi_import_table *import_table, struct bgp_path_info *encap_bi,
- struct agg_node *vpn_rn, struct bgp_path_info *vpn_bi)
+static int
+rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table,
+ struct bgp_path_info *encap_bpi,
+ struct agg_node *vpn_rn,
+ struct bgp_path_info *vpn_bpi)
{
- if (!encap_bi) {
+ if (!encap_bpi) {
/*
* clear cached UN address
*/
- if (!vpn_bi || !vpn_bi->extra) {
+ if (!vpn_bpi || !vpn_bpi->extra) {
zlog_warn(
- "%s: missing VPN bi/extra, can't clear UN addr",
+ "%s: missing VPN bpi/extra, can't clear UN addr",
__func__);
return 1;
}
- vpn_bi->extra->vnc.import.un_family = 0;
- memset(&vpn_bi->extra->vnc.import.un, 0,
- sizeof(vpn_bi->extra->vnc.import.un));
- if (CHECK_FLAG(vpn_bi->flags, BGP_PATH_VALID)) {
- if (rfapiGetVncTunnelUnAddr(vpn_bi->attr, NULL)) {
- UNSET_FLAG(vpn_bi->flags, BGP_PATH_VALID);
- if (VALID_INTERIOR_TYPE(vpn_bi->type))
+ vpn_bpi->extra->vnc.import.un_family = 0;
+ memset(&vpn_bpi->extra->vnc.import.un, 0,
+ sizeof(vpn_bpi->extra->vnc.import.un));
+ if (CHECK_FLAG(vpn_bpi->flags, BGP_PATH_VALID)) {
+ if (rfapiGetVncTunnelUnAddr(vpn_bpi->attr, NULL)) {
+ UNSET_FLAG(vpn_bpi->flags, BGP_PATH_VALID);
+ if (VALID_INTERIOR_TYPE(vpn_bpi->type))
RFAPI_MONITOR_EXTERIOR(vpn_rn)
->valid_interior_count--;
/* signal interior route withdrawal to
* import-exterior */
vnc_import_bgp_exterior_del_route_interior(
bgp_get_default(), import_table, vpn_rn,
- vpn_bi);
+ vpn_bpi);
}
}
} else {
- if (!vpn_bi) {
- zlog_warn("%s: missing VPN bi, can't clear UN addr",
+ if (!vpn_bpi) {
+ zlog_warn("%s: missing VPN bpi, can't clear UN addr",
__func__);
return 1;
}
- rfapiCopyUnEncap2VPN(encap_bi, vpn_bi);
- if (!CHECK_FLAG(vpn_bi->flags, BGP_PATH_VALID)) {
- SET_FLAG(vpn_bi->flags, BGP_PATH_VALID);
- if (VALID_INTERIOR_TYPE(vpn_bi->type))
+ rfapiCopyUnEncap2VPN(encap_bpi, vpn_bpi);
+ if (!CHECK_FLAG(vpn_bpi->flags, BGP_PATH_VALID)) {
+ SET_FLAG(vpn_bpi->flags, BGP_PATH_VALID);
+ if (VALID_INTERIOR_TYPE(vpn_bpi->type))
RFAPI_MONITOR_EXTERIOR(vpn_rn)
->valid_interior_count++;
/* signal interior route withdrawal to import-exterior
*/
vnc_import_bgp_exterior_add_route_interior(
bgp_get_default(), import_table, vpn_rn,
- vpn_bi);
+ vpn_bpi);
}
}
return 0;
static int rfapiWithdrawTimerEncap(struct thread *t)
{
struct rfapi_withdraw *wcb = t->arg;
- struct bgp_path_info *bi = wcb->info;
+ struct bgp_path_info *bpi = wcb->info;
int was_first_route = 0;
struct rfapi_monitor_encap *em;
struct skiplist *vpn_node_sl = skiplist_new(0, NULL, NULL);
assert(wcb->node);
- assert(bi);
+ assert(bpi);
assert(wcb->import_table);
RFAPI_CHECK_REFCOUNT(wcb->node, SAFI_ENCAP, 0);
- if (wcb->node->info == bi)
+ if (wcb->node->info == bpi)
was_first_route = 1;
/*
- * Remove the route/bi and free it
+ * Remove the route/bpi and free it
*/
- rfapiBgpInfoDetach(wcb->node, bi);
- rfapiBgpInfoFree(bi);
+ rfapiBgpInfoDetach(wcb->node, bpi);
+ rfapiBgpInfoFree(bpi);
if (!was_first_route)
goto done;
for (em = RFAPI_MONITOR_ENCAP(wcb->node); em; em = em->next) {
/*
- * Update monitoring VPN BIs with new encap info at the
- * head of the encap bi chain (which could be NULL after
- * removing the expiring bi above)
+ * Update monitoring VPN BPIs with new encap info at the
+ * head of the encap bpi chain (which could be NULL after
+ * removing the expiring bpi above)
*/
if (rfapiWithdrawEncapUpdateCachedUn(wcb->import_table,
wcb->node->info, em->node,
- em->bi))
+ em->bpi))
continue;
/*
*/
static void
rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
- struct agg_node *rn, struct bgp_path_info *bi,
+ struct agg_node *rn, struct bgp_path_info *bpi,
afi_t afi, safi_t safi,
int (*timer_service_func)(struct thread *))
{
uint32_t lifetime;
struct rfapi_withdraw *wcb;
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
/*
* Already on the path to being withdrawn,
* should already have a timer set up to
return;
}
- rfapiGetVncLifetime(bi->attr, &lifetime);
+ rfapiGetVncLifetime(bpi->attr, &lifetime);
vnc_zlog_debug_verbose("%s: VNC lifetime is %u", __func__, lifetime);
/*
* withdrawn routes get to hang around for a while
*/
- SET_FLAG(bi->flags, BGP_PATH_REMOVED);
+ SET_FLAG(bpi->flags, BGP_PATH_REMOVED);
/* set timer to remove the route later */
lifetime = rfapiGetHolddownFromLifetime(lifetime);
wcb = XCALLOC(MTYPE_RFAPI_WITHDRAW, sizeof(struct rfapi_withdraw));
assert(wcb);
wcb->node = rn;
- wcb->info = bi;
+ wcb->info = bpi;
wcb->import_table = import_table;
- bgp_attr_intern(bi->attr);
+ bgp_attr_intern(bpi->attr);
if (VNC_DEBUG(VERBOSE)) {
vnc_zlog_debug_verbose(
- "%s: wcb values: node=%p, info=%p, import_table=%p (bi follows)",
+ "%s: wcb values: node=%p, info=%p, import_table=%p (bpi follows)",
__func__, wcb->node, wcb->info, wcb->import_table);
- rfapiPrintBi(NULL, bi);
+ rfapiPrintBi(NULL, bpi);
}
- assert(bi->extra);
+ assert(bpi->extra);
if (lifetime > UINT32_MAX / 1001) {
/* sub-optimal case, but will probably never happen */
- bi->extra->vnc.import.timer = NULL;
+ bpi->extra->vnc.import.timer = NULL;
thread_add_timer(bm->master, timer_service_func, wcb, lifetime,
- &bi->extra->vnc.import.timer);
+ &bpi->extra->vnc.import.timer);
} else {
static uint32_t jitter;
uint32_t lifetime_msec;
lifetime_msec = (lifetime * 1000) + jitter;
- bi->extra->vnc.import.timer = NULL;
+ bpi->extra->vnc.import.timer = NULL;
thread_add_timer_msec(bm->master, timer_service_func, wcb,
lifetime_msec,
- &bi->extra->vnc.import.timer);
+ &bpi->extra->vnc.import.timer);
}
/* re-sort route list (BGP_PATH_REMOVED routes are last) */
if (((struct bgp_path_info *)rn->info)->next) {
- rfapiBgpInfoDetach(rn, bi);
- rfapiBgpInfoAttachSorted(rn, bi, afi, safi);
+ rfapiBgpInfoDetach(rn, bpi);
+ rfapiBgpInfoAttachSorted(rn, bpi, afi, safi);
}
}
static void rfapiExpireEncapNow(struct rfapi_import_table *it,
- struct agg_node *rn, struct bgp_path_info *bi)
+ struct agg_node *rn, struct bgp_path_info *bpi)
{
struct rfapi_withdraw *wcb;
struct thread t;
* pretend we're an expiring timer
*/
wcb = XCALLOC(MTYPE_RFAPI_WITHDRAW, sizeof(struct rfapi_withdraw));
- wcb->info = bi;
+ wcb->info = bpi;
wcb->node = rn;
wcb->import_table = it;
memset(&t, 0, sizeof(t));
struct agg_table *rt = NULL;
struct agg_node *rn;
struct bgp_path_info *info_new;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct bgp_path_info *next;
char buf[BUFSIZ];
- struct prefix p_firstbi_old;
- struct prefix p_firstbi_new;
+ struct prefix p_firstbpi_old;
+ struct prefix p_firstbpi_new;
int replacing = 0;
const char *action_str = NULL;
struct prefix un_prefix;
"%s: entry: %s: prefix %s/%d", __func__, action_str,
inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ), p->prefixlen);
- memset(&p_firstbi_old, 0, sizeof(p_firstbi_old));
- memset(&p_firstbi_new, 0, sizeof(p_firstbi_new));
+ memset(&p_firstbpi_old, 0, sizeof(p_firstbpi_old));
+ memset(&p_firstbpi_new, 0, sizeof(p_firstbpi_new));
if (action == FIF_ACTION_UPDATE) {
/*
/*
- * capture nexthop of first bi
+ * capture nexthop of first bpi
*/
if (rn->info) {
rfapiNexthop2Prefix(
((struct bgp_path_info *)(rn->info))->attr,
- &p_firstbi_old);
+ &p_firstbpi_old);
}
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
/*
* Does this bgp_path_info refer to the same route
* as we are trying to add?
*/
- vnc_zlog_debug_verbose("%s: comparing BI %p", __func__,
- bi);
+ vnc_zlog_debug_verbose("%s: comparing BPI %p", __func__,
+ bpi);
/*
* Compare RDs
*
- * RD of import table bi is in bi->extra->vnc.import.rd
- * RD of info_orig is in prd
+ * RD of import table bpi is in
+ * bpi->extra->vnc.import.rd RD of info_orig is in prd
*/
- if (!bi->extra) {
- vnc_zlog_debug_verbose("%s: no bi->extra",
+ if (!bpi->extra) {
+ vnc_zlog_debug_verbose("%s: no bpi->extra",
__func__);
continue;
}
if (prefix_cmp(
- (struct prefix *)&bi->extra->vnc.import.rd,
+ (struct prefix *)&bpi->extra->vnc.import.rd,
(struct prefix *)prd)) {
vnc_zlog_debug_verbose("%s: prd does not match",
/*
* Compare peers
*/
- if (bi->peer != peer) {
+ if (bpi->peer != peer) {
vnc_zlog_debug_verbose(
"%s: peer does not match", __func__);
continue;
}
- vnc_zlog_debug_verbose("%s: found matching bi",
+ vnc_zlog_debug_verbose("%s: found matching bpi",
__func__);
- /* Same route. Delete this bi, replace with new one */
+ /* Same route. Delete this bpi, replace with new one */
if (action == FIF_ACTION_WITHDRAW) {
rn->p.prefixlen);
rfapiBiStartWithdrawTimer(
- import_table, rn, bi, afi, SAFI_ENCAP,
+ import_table, rn, bpi, afi, SAFI_ENCAP,
rfapiWithdrawTimerEncap);
} else {
* a previous withdraw, we must cancel its
* timer.
*/
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)
- && bi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
+ && bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi->extra->vnc
+ (struct thread *)bpi->extra->vnc
.import.timer;
struct rfapi_withdraw *wcb = t->arg;
}
if (action == FIF_ACTION_UPDATE) {
- rfapiBgpInfoDetach(rn, bi);
- rfapiBgpInfoFree(bi);
+ rfapiBgpInfoDetach(rn, bpi);
+ rfapiBgpInfoFree(bpi);
replacing = 1;
} else {
/*
* Kill: do export stuff when removing
- * bi
+ * bpi
*/
struct rfapi_withdraw *wcb;
struct thread t;
wcb = XCALLOC(
MTYPE_RFAPI_WITHDRAW,
sizeof(struct rfapi_withdraw));
- wcb->info = bi;
+ wcb->info = bpi;
wcb->node = rn;
wcb->import_table = import_table;
memset(&t, 0, sizeof(t));
if (rn) {
if (!replacing)
- agg_lock_node(rn); /* incr ref count for new BI */
+ agg_lock_node(rn); /* incr ref count for new BPI */
} else {
rn = agg_node_get(rt, p);
}
* Delete holddown routes from same NVE. See details in
* rfapiBgpInfoFilteredImportVPN()
*/
- for (bi = info_new->next; bi; bi = next) {
+ for (bpi = info_new->next; bpi; bpi = next) {
struct prefix pfx_un;
int un_match = 0;
- next = bi->next;
- if (!CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
+ next = bpi->next;
+ if (!CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
/*
* of the route node)
*/
- if (!rfapiGetNexthop(bi->attr, &pfx_un)
+ if (!rfapiGetNexthop(bpi->attr, &pfx_un)
&& prefix_same(&pfx_un, &un_prefix)) {
un_match = 1;
continue;
vnc_zlog_debug_verbose(
- "%s: removing holddown bi matching NVE of new route",
+ "%s: removing holddown bpi matching NVE of new route",
__func__);
- if (bi->extra->vnc.import.timer) {
+ if (bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi->extra->vnc.import.timer;
+ (struct thread *)bpi->extra->vnc.import.timer;
struct rfapi_withdraw *wcb = t->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t);
}
- rfapiExpireEncapNow(import_table, rn, bi);
+ rfapiExpireEncapNow(import_table, rn, bpi);
}
rfapiNexthop2Prefix(((struct bgp_path_info *)(rn->info))->attr,
- &p_firstbi_new);
+ &p_firstbpi_new);
/*
* If the nexthop address of the selected Encap route (i.e.,
* routes that refer to this Encap route and possibly force
* rfapi callbacks.
*/
- if (rfapiAttrNexthopAddrDifferent(&p_firstbi_old, &p_firstbi_new)) {
+ if (rfapiAttrNexthopAddrDifferent(&p_firstbpi_old, &p_firstbpi_new)) {
struct rfapi_monitor_encap *m;
struct rfapi_monitor_encap *mnext;
for (m = RFAPI_MONITOR_ENCAP(rn); m; m = m->next) {
/*
- * For each referenced bi/route, copy the ENCAP route's
+ * For each referenced bpi/route, copy the ENCAP route's
* nexthop to the VPN route's cached UN address field
* and set
* the address family of the cached UN address field.
*/
- rfapiCopyUnEncap2VPN(info_new, m->bi);
- if (!CHECK_FLAG(m->bi->flags, BGP_PATH_VALID)) {
- SET_FLAG(m->bi->flags, BGP_PATH_VALID);
- if (VALID_INTERIOR_TYPE(m->bi->type))
+ rfapiCopyUnEncap2VPN(info_new, m->bpi);
+ if (!CHECK_FLAG(m->bpi->flags, BGP_PATH_VALID)) {
+ SET_FLAG(m->bpi->flags, BGP_PATH_VALID);
+ if (VALID_INTERIOR_TYPE(m->bpi->type))
RFAPI_MONITOR_EXTERIOR(m->node)
->valid_interior_count++;
vnc_import_bgp_exterior_add_route_interior(
- bgp, import_table, m->node, m->bi);
+ bgp, import_table, m->node, m->bpi);
}
/*
}
static void rfapiExpireVpnNow(struct rfapi_import_table *it,
- struct agg_node *rn, struct bgp_path_info *bi,
+ struct agg_node *rn, struct bgp_path_info *bpi,
int lockoffset)
{
struct rfapi_withdraw *wcb;
* pretend we're an expiring timer
*/
wcb = XCALLOC(MTYPE_RFAPI_WITHDRAW, sizeof(struct rfapi_withdraw));
- wcb->info = bi;
+ wcb->info = bpi;
wcb->node = rn;
wcb->import_table = it;
wcb->lockoffset = lockoffset;
struct agg_node *rn;
struct agg_node *n;
struct bgp_path_info *info_new;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct bgp_path_info *next;
char buf[BUFSIZ];
struct prefix vn_prefix;
/*
* Look for same route (will have same RD and peer)
*/
- bi = rfapiItBiIndexSearch(rn, prd, peer, aux_prefix);
+ bpi = rfapiItBiIndexSearch(rn, prd, peer, aux_prefix);
- if (bi) {
+ if (bpi) {
/*
* This was an old test when we iterated over the
- * BIs linearly. Since we're now looking up with
+ * BPIs linearly. Since we're now looking up with
* RD and peer, comparing types should not be
* needed. Changed to assertion.
*
* Compare types. Doing so prevents a RFP-originated
* route from matching an imported route, for example.
*/
- if (VNC_DEBUG(VERBOSE) && bi->type != type)
+ if (VNC_DEBUG(VERBOSE) && bpi->type != type)
/* should be handled by RDs, but warn for now */
- zlog_warn("%s: type mismatch! (bi=%d, arg=%d)",
- __func__, bi->type, type);
+ zlog_warn("%s: type mismatch! (bpi=%d, arg=%d)",
+ __func__, bpi->type, type);
- vnc_zlog_debug_verbose("%s: found matching bi",
+ vnc_zlog_debug_verbose("%s: found matching bpi",
__func__);
/*
* holddown
*/
if (import_table == bgp->rfapi->it_ce) {
- vnc_direct_bgp_del_route_ce(bgp, rn, bi);
+ vnc_direct_bgp_del_route_ce(bgp, rn, bpi);
if (action == FIF_ACTION_WITHDRAW)
action = FIF_ACTION_KILL;
}
if (action == FIF_ACTION_WITHDRAW) {
- int washolddown =
- CHECK_FLAG(bi->flags, BGP_PATH_REMOVED);
+ int washolddown = CHECK_FLAG(bpi->flags,
+ BGP_PATH_REMOVED);
vnc_zlog_debug_verbose(
"%s: withdrawing at prefix %s/%d%s",
VNC_ITRCCK;
if (!washolddown) {
rfapiBiStartWithdrawTimer(
- import_table, rn, bi, afi,
+ import_table, rn, bpi, afi,
SAFI_MPLS_VPN,
rfapiWithdrawTimerVPN);
RFAPI_UPDATE_ITABLE_COUNT(
- bi, import_table, afi, -1);
+ bpi, import_table, afi, -1);
import_table->holddown_count[afi] += 1;
}
VNC_ITRCCK;
* a previous withdraw, we must cancel its
* timer.
*/
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)
- && bi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
+ && bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi->extra->vnc
+ (struct thread *)bpi->extra->vnc
.import.timer;
struct rfapi_withdraw *wcb = t->arg;
import_table->holddown_count[afi] -= 1;
RFAPI_UPDATE_ITABLE_COUNT(
- bi, import_table, afi, 1);
+ bpi, import_table, afi, 1);
}
/*
* decrement remote count (if route is remote)
* because
* we are going to remove it below
*/
- RFAPI_UPDATE_ITABLE_COUNT(bi, import_table, afi,
- -1);
+ RFAPI_UPDATE_ITABLE_COUNT(bpi, import_table,
+ afi, -1);
if (action == FIF_ACTION_UPDATE) {
replacing = 1;
* make copy of original nexthop so we
* can see if it changed
*/
- rfapiGetNexthop(bi->attr,
+ rfapiGetNexthop(bpi->attr,
&original_nexthop);
/*
- * remove bi without doing any export
+ * remove bpi without doing any export
* processing
*/
- if (CHECK_FLAG(bi->flags,
+ if (CHECK_FLAG(bpi->flags,
BGP_PATH_VALID)
- && VALID_INTERIOR_TYPE(bi->type))
+ && VALID_INTERIOR_TYPE(bpi->type))
RFAPI_MONITOR_EXTERIOR(rn)
->valid_interior_count--;
- rfapiItBiIndexDel(rn, bi);
- rfapiBgpInfoDetach(rn, bi);
- rfapiMonitorEncapDelete(bi);
+ rfapiItBiIndexDel(rn, bpi);
+ rfapiBgpInfoDetach(rn, bpi);
+ rfapiMonitorEncapDelete(bpi);
vnc_import_bgp_exterior_del_route_interior(
- bgp, import_table, rn, bi);
- rfapiBgpInfoFree(bi);
+ bgp, import_table, rn, bpi);
+ rfapiBgpInfoFree(bpi);
} else {
/* Kill */
/*
- * remove bi and do export processing
+ * remove bpi and do export processing
*/
import_table->holddown_count[afi] += 1;
- rfapiExpireVpnNow(import_table, rn, bi,
+ rfapiExpireVpnNow(import_table, rn, bpi,
0);
}
}
/*
* For ethernet routes, if there is an accompanying IP address,
- * save it in the bi
+ * save it in the bpi
*/
if ((AFI_L2VPN == afi) && aux_prefix) {
- vnc_zlog_debug_verbose("%s: setting BI's aux_prefix", __func__);
+ vnc_zlog_debug_verbose("%s: setting BPI's aux_prefix",
+ __func__);
info_new->extra->vnc.import.aux_prefix = *aux_prefix;
}
vnc_zlog_debug_verbose(
- "%s: inserting bi %p at prefix %s/%d #%d", __func__, info_new,
+ "%s: inserting bpi %p at prefix %s/%d #%d", __func__, info_new,
rfapi_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ),
rn->p.prefixlen, rn->lock);
* by the fresh route).
*/
/*
- * We know that the new bi will have been inserted before any routes
+ * We know that the new bpi will have been inserted before any routes
* in holddown, so we can skip any that came before it
*/
- for (bi = info_new->next; bi; bi = next) {
+ for (bpi = info_new->next; bpi; bpi = next) {
struct prefix pfx_vn;
struct prefix pfx_un;
int un_match = 0;
int remote_peer_match = 0;
- next = bi->next;
+ next = bpi->next;
/*
* Must be holddown
*/
- if (!CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
+ if (!CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
/*
* Must match VN address (nexthop of VPN route)
*/
- if (rfapiGetNexthop(bi->attr, &pfx_vn))
+ if (rfapiGetNexthop(bpi->attr, &pfx_vn))
continue;
if (!prefix_same(&pfx_vn, &vn_prefix))
continue;
if (un_prefix_valid && /* new route UN addr */
- !rfapiGetUnAddrOfVpnBi(bi, &pfx_un)
+ !rfapiGetUnAddrOfVpnBi(bpi, &pfx_un)
&& /* old route UN addr */
prefix_same(&pfx_un, &un_prefix)) { /* compare */
un_match = 1;
}
- if (!RFAPI_LOCAL_BI(bi) && !RFAPI_LOCAL_BI(info_new)
- && sockunion_same(&bi->peer->su, &info_new->peer->su)) {
+ if (!RFAPI_LOCAL_BI(bpi) && !RFAPI_LOCAL_BI(info_new)
+ && sockunion_same(&bpi->peer->su, &info_new->peer->su)) {
/* old & new are both remote, same peer */
remote_peer_match = 1;
}
continue;
vnc_zlog_debug_verbose(
- "%s: removing holddown bi matching NVE of new route",
+ "%s: removing holddown bpi matching NVE of new route",
__func__);
- if (bi->extra->vnc.import.timer) {
+ if (bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi->extra->vnc.import.timer;
+ (struct thread *)bpi->extra->vnc.import.timer;
struct rfapi_withdraw *wcb = t->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t);
}
- rfapiExpireVpnNow(import_table, rn, bi, 0);
+ rfapiExpireVpnNow(import_table, rn, bpi, 0);
}
if (!original_had_routes) {
* routes expiring at the same time due to peer drop.
*/
/*
- * 1. Visit all BIs in all ENCAP import tables.
+ * 1. Visit all BPIs in all ENCAP import tables.
*
- * a. If a bi's peer is the failed peer, remove the bi.
- * b. If the removed ENCAP bi was first in the list of
- * BIs at this ENCAP node, loop over all monitors
+ * a. If a bpi's peer is the failed peer, remove the bpi.
+ * b. If the removed ENCAP bpi was first in the list of
+ * BPIs at this ENCAP node, loop over all monitors
* at this node:
*
* (1) for each ENCAP monitor, loop over all its
* VPN node monitors and set their RFAPI_MON_FLAG_NEEDCALLBACK
* flags.
*
- * 2. Visit all BIs in all VPN import tables.
- * a. If a bi's peer is the failed peer, remove the bi.
+ * 2. Visit all BPIs in all VPN import tables.
+ * a. If a bpi's peer is the failed peer, remove the bpi.
* b. loop over all the VPN node monitors and set their
* RFAPI_MON_FLAG_NEEDCALLBACK flags
- * c. If there are no BIs left at this VPN node,
+ * c. If there are no BPIs left at this VPN node,
*
*/
afi_t afi, safi_t safi)
{
struct agg_node *rn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct agg_table *rt;
int (*timer_service_func)(struct thread *);
for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) {
- for (bi = rn->info; bi; bi = bi->next) {
- if (bi->peer == peer) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
+ if (bpi->peer == peer) {
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
/* already in holddown, skip */
continue;
}
if (safi == SAFI_MPLS_VPN) {
RFAPI_UPDATE_ITABLE_COUNT(
- bi, import_table, afi, -1);
+ bpi, import_table, afi, -1);
import_table->holddown_count[afi] += 1;
}
- rfapiBiStartWithdrawTimer(import_table, rn, bi,
+ rfapiBiStartWithdrawTimer(import_table, rn, bpi,
afi, safi,
timer_service_func);
}
return;
/*
- * 1. Visit all BIs in all ENCAP import tables.
- * Start withdraw timer on the BIs that match peer.
+ * 1. Visit all BPIs in all ENCAP import tables.
+ * Start withdraw timer on the BPIs that match peer.
*
- * 2. Visit All BIs in all VPN import tables.
- * Start withdraw timer on the BIs that match peer.
+ * 2. Visit All BPIs in all VPN import tables.
+ * Start withdraw timer on the BPIs that match peer.
*/
bgp = bgp_get_default(); /* assume 1 instance for now */
for (rn2 = bgp_table_top(rn1->info); rn2;
rn2 = bgp_route_next(rn2)) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn2->info; bi; bi = bi->next) {
+ for (bpi = rn2->info; bpi; bpi = bpi->next) {
uint32_t label = 0;
- if (CHECK_FLAG(bi->flags,
+ if (CHECK_FLAG(bpi->flags,
BGP_PATH_REMOVED))
continue;
- if (bi->extra)
+ if (bpi->extra)
label = decode_label(
- &bi->extra->label[0]);
+ &bpi->extra->label[0]);
(*rfapiBgpInfoFilteredImportFunction(
safi))(
it, /* which import table */
- FIF_ACTION_UPDATE, bi->peer,
+ FIF_ACTION_UPDATE, bpi->peer,
NULL, &rn2->p, /* prefix */
NULL, afi,
(struct prefix_rd *)&rn1->p,
- bi->attr, bi->type,
- bi->sub_type, &label);
+ bpi->attr, bpi->type,
+ bpi->sub_type, &label);
}
}
}
afi);
for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct bgp_path_info *next;
if (VNC_DEBUG(IMPORT_DEL_REMOTE)) {
/* TBD is this valid for afi == AFI_L2VPN? */
RFAPI_CHECK_REFCOUNT(rn, SAFI_MPLS_VPN, 1);
- for (bi = rn->info; bi; bi = next) {
- next = bi->next;
+ for (bpi = rn->info; bpi; bpi = next) {
+ next = bpi->next;
struct prefix qpt;
struct prefix qct;
int qct_valid = 0;
int is_active = 0;
- vnc_zlog_debug_verbose("%s: examining bi %p",
- __func__, bi);
+ vnc_zlog_debug_verbose("%s: examining bpi %p",
+ __func__, bpi);
- if (bi->attr) {
- if (!rfapiGetNexthop(bi->attr, &qpt))
+ if (bpi->attr) {
+ if (!rfapiGetNexthop(bpi->attr, &qpt))
qpt_valid = 1;
}
if (vn) {
}
}
- if (!rfapiGetUnAddrOfVpnBi(bi, &qct))
+ if (!rfapiGetUnAddrOfVpnBi(bpi, &qct))
qct_valid = 1;
if (un) {
/*
- * Blow bi away
+ * Blow bpi away
*/
/*
* If this route is waiting to be deleted
* a previous withdraw, we must cancel its
* timer.
*/
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
if (!delete_holddown)
continue;
- if (bi->extra->vnc.import.timer) {
+ if (bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi
+ (struct thread *)bpi
->extra->vnc
.import.timer;
struct rfapi_withdraw *wcb =
->holddown_count[afi] -=
1;
RFAPI_UPDATE_ITABLE_COUNT(
- bi, wcb->import_table,
+ bpi, wcb->import_table,
afi, 1);
XFREE(MTYPE_RFAPI_WITHDRAW,
wcb);
}
vnc_zlog_debug_verbose(
- "%s: deleting bi %p (qct_valid=%d, qpt_valid=%d, delete_holddown=%d, delete_active=%d)",
- __func__, bi, qct_valid, qpt_valid,
+ "%s: deleting bpi %p (qct_valid=%d, qpt_valid=%d, delete_holddown=%d, delete_active=%d)",
+ __func__, bpi, qct_valid, qpt_valid,
delete_holddown, delete_active);
}
vnc_direct_bgp_rh_del_route(bgp, afi, &rn->p,
- bi->peer);
+ bpi->peer);
- RFAPI_UPDATE_ITABLE_COUNT(bi, it, afi, -1);
+ RFAPI_UPDATE_ITABLE_COUNT(bpi, it, afi, -1);
it->holddown_count[afi] += 1;
- rfapiExpireVpnNow(it, rn, bi, 1);
+ rfapiExpireVpnNow(it, rn, bpi, 1);
vnc_zlog_debug_verbose(
"%s: incrementing count (is_active=%d)",
int imported_count[AFI_MAX];
};
-#define RFAPI_LOCAL_BI(bi) \
- (((bi)->type == ZEBRA_ROUTE_BGP) && ((bi)->sub_type == BGP_ROUTE_RFP))
+#define RFAPI_LOCAL_BI(bpi) \
+ (((bpi)->type == ZEBRA_ROUTE_BGP) && ((bpi)->sub_type == BGP_ROUTE_RFP))
-#define RFAPI_DIRECT_IMPORT_BI(bi) \
- (((bi)->type == ZEBRA_ROUTE_BGP_DIRECT) \
- || ((bi)->type == ZEBRA_ROUTE_BGP_DIRECT_EXT))
+#define RFAPI_DIRECT_IMPORT_BI(bpi) \
+ (((bpi)->type == ZEBRA_ROUTE_BGP_DIRECT) \
+ || ((bpi)->type == ZEBRA_ROUTE_BGP_DIRECT_EXT))
-#define RFAPI_UPDATE_ITABLE_COUNT(bi, itable, afi, cnt) \
- if (RFAPI_LOCAL_BI(bi)) { \
+#define RFAPI_UPDATE_ITABLE_COUNT(bpi, itable, afi, cnt) \
+ if (RFAPI_LOCAL_BI(bpi)) { \
(itable)->local_count[(afi)] += (cnt); \
} else { \
- if (RFAPI_DIRECT_IMPORT_BI(bi)) \
+ if (RFAPI_DIRECT_IMPORT_BI(bpi)) \
(itable)->imported_count[(afi)] += (cnt); \
else \
(itable)->remote_count[(afi)] += (cnt); \
extern void rfapiCheckRouteCount(void);
/*
- * Print BI in an Import Table
+ * Print BPI in an Import Table
*/
-extern void rfapiPrintBi(void *stream, struct bgp_path_info *bi);
+extern void rfapiPrintBi(void *stream, struct bgp_path_info *bpi);
extern void rfapiShowImportTable(void *stream, const char *label,
struct agg_table *rt, int isvpn);
extern int rfapiProcessDeferredClose(struct thread *t);
-extern int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bi, struct prefix *p);
+extern int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p);
extern void rfapiNexthop2Prefix(struct attr *attr, struct prefix *p);
agg_unlock_node(rn);
}
if (hie->u.vpn.idx_rd) {
- /* looping through bi->extra->vnc.import.rd is tbd */
+ /* looping through bpi->extra->vnc.import.rd is tbd */
while (!skiplist_delete_first(hie->u.vpn.idx_rd)) {
agg_unlock_node(rn);
}
for (rn = agg_node_match(rfd->import_table->imported_vpn[afi], p);
rn;) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct prefix pfx_dummy;
/* TBD update this code to use new valid_interior_count */
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
/*
* If there is a cached ENCAP UN address, it's a usable
* VPN route
*/
- if (bi->extra && bi->extra->vnc.import.un_family) {
+ if (bpi->extra && bpi->extra->vnc.import.un_family) {
break;
}
* address,
* it's a usable VPN route.
*/
- if (!rfapiGetVncTunnelUnAddr(bi->attr, &pfx_dummy)) {
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, &pfx_dummy)) {
break;
}
}
- if (bi)
+ if (bpi)
break;
agg_unlock_node(rn);
struct rfapi_monitor_encap *next;
struct rfapi_monitor_encap *prev;
struct agg_node *node; /* VPN node */
- struct bgp_path_info *bi; /* VPN bi */
+ struct bgp_path_info *bpi; /* VPN bpi */
struct agg_node *rn; /* parent node */
};
* Encap TLV */
int valid_interior_count;
- /* unicast exterior routes, key=bi,
+ /* unicast exterior routes, key=bpi,
* val=allocated prefix */
struct skiplist *source;
} e;
/*
* Copies struct bgp_path_info to struct rfapi_info, except for rk fields and un
*/
-static void rfapiRibBi2Ri(struct bgp_path_info *bi, struct rfapi_info *ri,
+static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri,
uint32_t lifetime)
{
struct bgp_attr_encap_subtlv *pEncap;
- ri->cost = rfapiRfpCost(bi->attr);
+ ri->cost = rfapiRfpCost(bpi->attr);
ri->lifetime = lifetime;
/* This loop based on rfapiRouteInfo2NextHopEntry() */
- for (pEncap = bi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next) {
+ for (pEncap = bpi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next) {
struct bgp_tea_options *hop;
switch (pEncap->type) {
}
rfapi_un_options_free(ri->un_options); /* maybe free old version */
- ri->un_options = rfapi_encap_tlv_to_un_option(bi->attr);
+ ri->un_options = rfapi_encap_tlv_to_un_option(bpi->attr);
/*
* VN options
*/
- if (bi->extra
- && decode_rd_type(bi->extra->vnc.import.rd.val)
+ if (bpi->extra
+ && decode_rd_type(bpi->extra->vnc.import.rd.val)
== RD_TYPE_VNC_ETH) {
/* ethernet route */
vo->type = RFAPI_VN_OPTION_TYPE_L2ADDR;
- /* copy from RD already stored in bi, so we don't need it_node
+ /* copy from RD already stored in bpi, so we don't need it_node
*/
- memcpy(&vo->v.l2addr.macaddr, bi->extra->vnc.import.rd.val + 2,
+ memcpy(&vo->v.l2addr.macaddr, bpi->extra->vnc.import.rd.val + 2,
ETH_ALEN);
- (void)rfapiEcommunityGetLNI(bi->attr->ecommunity,
+ (void)rfapiEcommunityGetLNI(bpi->attr->ecommunity,
&vo->v.l2addr.logical_net_id);
- (void)rfapiEcommunityGetEthernetTag(bi->attr->ecommunity,
+ (void)rfapiEcommunityGetEthernetTag(bpi->attr->ecommunity,
&vo->v.l2addr.tag_id);
/* local_nve_id comes from RD */
- vo->v.l2addr.local_nve_id = bi->extra->vnc.import.rd.val[1];
+ vo->v.l2addr.local_nve_id = bpi->extra->vnc.import.rd.val[1];
/* label comes from MP_REACH_NLRI label */
- vo->v.l2addr.label = decode_label(&bi->extra->label[0]);
+ vo->v.l2addr.label = decode_label(&bpi->extra->label[0]);
rfapi_vn_options_free(
ri->vn_options); /* maybe free old version */
/*
* If there is an auxiliary IP address (L2 can have it), copy it
*/
- if (bi->extra && bi->extra->vnc.import.aux_prefix.family) {
- ri->rk.aux_prefix = bi->extra->vnc.import.aux_prefix;
+ if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
+ ri->rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
}
}
int rfapiRibPreloadBi(
struct agg_node *rfd_rib_node, /* NULL = don't preload or filter */
struct prefix *pfx_vn, struct prefix *pfx_un, uint32_t lifetime,
- struct bgp_path_info *bi)
+ struct bgp_path_info *bpi)
{
struct rfapi_descriptor *rfd;
struct skiplist *slRibPt = NULL;
memset((void *)&rk, 0, sizeof(rk));
rk.vn = *pfx_vn;
- rk.rd = bi->extra->vnc.import.rd;
+ rk.rd = bpi->extra->vnc.import.rd;
/*
* If there is an auxiliary IP address (L2 can have it), copy it
*/
- if (bi->extra->vnc.import.aux_prefix.family) {
- rk.aux_prefix = bi->extra->vnc.import.aux_prefix;
+ if (bpi->extra->vnc.import.aux_prefix.family) {
+ rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
}
/*
/* found: update contents of existing route in RIB */
ori->un = *pfx_un;
- rfapiRibBi2Ri(bi, ori, lifetime);
+ rfapiRibBi2Ri(bpi, ori, lifetime);
} else {
/* not found: add new route to RIB */
ori = rfapi_info_new();
ori->rk = rk;
ori->un = *pfx_un;
- rfapiRibBi2Ri(bi, ori, lifetime);
+ rfapiRibBi2Ri(bpi, ori, lifetime);
if (!slRibPt) {
slRibPt = skiplist_new(0, rfapi_rib_key_cmp, NULL);
struct agg_node *it_node, uint32_t lifetime)
{
struct prefix *prefix;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct agg_node *pn;
afi_t afi;
uint32_t queued_flag;
}
/*
- * The BIs in the import table are already sorted by cost
+ * The BPIs in the import table are already sorted by cost
*/
- for (bi = it_node->info; bi; bi = bi->next) {
+ for (bpi = it_node->info; bpi; bpi = bpi->next) {
struct rfapi_info *ri;
struct prefix pfx_nh;
- if (!bi->attr) {
+ if (!bpi->attr) {
/* shouldn't happen */
/* TBD increment error stats counter */
continue;
}
- if (!bi->extra) {
+ if (!bpi->extra) {
/* shouldn't happen */
/* TBD increment error stats counter */
continue;
}
- rfapiNexthop2Prefix(bi->attr, &pfx_nh);
+ rfapiNexthop2Prefix(bpi->attr, &pfx_nh);
/*
* Omit route if nexthop is self
ri = rfapi_info_new();
ri->rk.vn = pfx_nh;
- ri->rk.rd = bi->extra->vnc.import.rd;
+ ri->rk.rd = bpi->extra->vnc.import.rd;
/*
* If there is an auxiliary IP address (L2 can have it), copy it
*/
- if (bi->extra->vnc.import.aux_prefix.family) {
- ri->rk.aux_prefix = bi->extra->vnc.import.aux_prefix;
+ if (bpi->extra->vnc.import.aux_prefix.family) {
+ ri->rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
}
- if (rfapiGetUnAddrOfVpnBi(bi, &ri->un)) {
+ if (rfapiGetUnAddrOfVpnBi(bpi, &ri->un)) {
rfapi_info_free(ri);
continue;
}
continue;
}
- rfapiRibBi2Ri(bi, ri, lifetime);
+ rfapiRibBi2Ri(bpi, ri, lifetime);
if (!pn->info) {
pn->info = list_new();
extern int rfapiRibPreloadBi(struct agg_node *rfd_rib_node,
struct prefix *pfx_vn, struct prefix *pfx_un,
- uint32_t lifetime, struct bgp_path_info *bi);
+ uint32_t lifetime, struct bgp_path_info *bpi);
extern struct rfapi_next_hop_entry *
rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd,
/* called from bgpd/bgp_vty.c'route_vty_out() */
void rfapi_vty_out_vncinfo(struct vty *vty, struct prefix *p,
- struct bgp_path_info *bi, safi_t safi)
+ struct bgp_path_info *bpi, safi_t safi)
{
char *s;
uint32_t lifetime;
if (safi == SAFI_MPLS_VPN) {
struct prefix pfx_un;
- if (!rfapiGetVncTunnelUnAddr(bi->attr, &pfx_un)) {
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, &pfx_un)) {
char buf[BUFSIZ];
vty_out(vty, "UN=%s",
inet_ntop(pfx_un.family, pfx_un.u.val, buf,
}
}
- if (bi->attr && bi->attr->ecommunity) {
- s = ecommunity_ecom2str(bi->attr->ecommunity,
+ if (bpi->attr && bpi->attr->ecommunity) {
+ s = ecommunity_ecom2str(bpi->attr->ecommunity,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
vty_out(vty, " EC{%s}", s);
XFREE(MTYPE_ECOMMUNITY_STR, s);
}
- if (bi->extra != NULL) {
- if (bi->extra->label[0] == BGP_PREVENT_VRF_2_VRF_LEAK)
+ if (bpi->extra != NULL) {
+ if (bpi->extra->label[0] == BGP_PREVENT_VRF_2_VRF_LEAK)
vty_out(vty, " label=VRF2VRF");
else
vty_out(vty, " label=%u",
- decode_label(&bi->extra->label[0]));
+ decode_label(&bpi->extra->label[0]));
}
- if (!rfapiGetVncLifetime(bi->attr, &lifetime)) {
+ if (!rfapiGetVncLifetime(bpi->attr, &lifetime)) {
vty_out(vty, " life=%d", lifetime);
}
- vty_out(vty, " type=%s, subtype=%d", zebra_route_string(bi->type),
- bi->sub_type);
+ vty_out(vty, " type=%s, subtype=%d", zebra_route_string(bpi->type),
+ bpi->sub_type);
vty_out(vty, "%s", HVTYNL);
}
}
/*
- * Print BI in an Import Table
+ * Print BPI in an Import Table
*/
-void rfapiPrintBi(void *stream, struct bgp_path_info *bi)
+void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
{
char buf[BUFSIZ];
char *s;
if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0)
return;
- if (!bi)
+ if (!bpi)
return;
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED) && bi->extra
- && bi->extra->vnc.import.timer) {
- struct thread *t = (struct thread *)bi->extra->vnc.import.timer;
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra
+ && bpi->extra->vnc.import.timer) {
+ struct thread *t =
+ (struct thread *)bpi->extra->vnc.import.timer;
r = snprintf(p, REMAIN, " [%4lu] ",
thread_timer_remain_second(t));
INCP;
INCP;
}
- if (bi->extra) {
+ if (bpi->extra) {
/* TBD This valid only for SAFI_MPLS_VPN, but not for encap */
- if (decode_rd_type(bi->extra->vnc.import.rd.val)
+ if (decode_rd_type(bpi->extra->vnc.import.rd.val)
== RD_TYPE_VNC_ETH) {
has_macaddr = 1;
- memcpy(macaddr.octet, bi->extra->vnc.import.rd.val + 2,
+ memcpy(macaddr.octet, bpi->extra->vnc.import.rd.val + 2,
6);
- l2hid = bi->extra->vnc.import.rd.val[1];
+ l2hid = bpi->extra->vnc.import.rd.val[1];
}
}
* RFP option sizes (they are opaque values)
* extended communities (RTs)
*/
- if (bi->attr) {
+ if (bpi->attr) {
uint32_t lifetime;
int printed_1st_gol = 0;
struct bgp_attr_encap_subtlv *pEncap;
struct prefix pfx_un;
- int af = BGP_MP_NEXTHOP_FAMILY(bi->attr->mp_nexthop_len);
+ int af = BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len);
/* Nexthop */
if (af == AF_INET) {
r = snprintf(p, REMAIN, "%s",
inet_ntop(AF_INET,
- &bi->attr->mp_nexthop_global_in,
+ &bpi->attr->mp_nexthop_global_in,
buf, BUFSIZ));
INCP;
} else if (af == AF_INET6) {
r = snprintf(p, REMAIN, "%s",
inet_ntop(AF_INET6,
- &bi->attr->mp_nexthop_global,
+ &bpi->attr->mp_nexthop_global,
buf, BUFSIZ));
INCP;
} else {
/*
* VNC tunnel subtlv, if present, contains UN address
*/
- if (!rfapiGetVncTunnelUnAddr(bi->attr, &pfx_un)) {
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, &pfx_un)) {
r = snprintf(p, REMAIN, " un=%s",
inet_ntop(pfx_un.family, pfx_un.u.val, buf,
BUFSIZ));
}
/* Lifetime */
- if (rfapiGetVncLifetime(bi->attr, &lifetime)) {
+ if (rfapiGetVncLifetime(bpi->attr, &lifetime)) {
r = snprintf(p, REMAIN, " nolife");
INCP;
} else {
}
/* RFP option lengths */
- for (pEncap = bi->attr->vnc_subtlvs; pEncap;
+ for (pEncap = bpi->attr->vnc_subtlvs; pEncap;
pEncap = pEncap->next) {
if (pEncap->type == BGP_VNC_SUBTLV_TYPE_RFPOPTION) {
}
/* RT list */
- if (bi->attr->ecommunity) {
- s = ecommunity_ecom2str(bi->attr->ecommunity,
+ if (bpi->attr->ecommunity) {
+ s = ecommunity_ecom2str(bpi->attr->ecommunity,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
r = snprintf(p, REMAIN, " %s", s);
INCP;
}
}
- r = snprintf(p, REMAIN, " bi@%p", bi);
+ r = snprintf(p, REMAIN, " bpi@%p", bpi);
INCP;
- r = snprintf(p, REMAIN, " p@%p", bi->peer);
+ r = snprintf(p, REMAIN, " p@%p", bpi->peer);
INCP;
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED)) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
r = snprintf(p, REMAIN, " HD=yes");
INCP;
} else {
INCP;
}
- if (bi->attr) {
+ if (bpi->attr) {
- if (bi->attr->weight) {
- r = snprintf(p, REMAIN, " W=%d", bi->attr->weight);
+ if (bpi->attr->weight) {
+ r = snprintf(p, REMAIN, " W=%d", bpi->attr->weight);
INCP;
}
- if (bi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
- r = snprintf(p, REMAIN, " LP=%d", bi->attr->local_pref);
+ if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
+ r = snprintf(p, REMAIN, " LP=%d",
+ bpi->attr->local_pref);
INCP;
} else {
r = snprintf(p, REMAIN, " LP=unset");
}
}
- r = snprintf(p, REMAIN, " %c:%u", zebra_route_char(bi->type),
- bi->sub_type);
+ r = snprintf(p, REMAIN, " %c:%u", zebra_route_char(bpi->type),
+ bpi->sub_type);
INCP;
fp(out, "%s%s", line, HVTYNL);
HVTYNL);
}
- if (!rfapiGetL2o(bi->attr, &l2o_buf)) {
+ if (!rfapiGetL2o(bpi->attr, &l2o_buf)) {
fp(out,
" L2O ETH=%02x:%02x:%02x:%02x:%02x:%02x LBL=%d LNI=%d LHI=%hhu%s",
l2o_buf.macaddr.octet[0], l2o_buf.macaddr.octet[1],
l2o_buf.label, l2o_buf.logical_net_id, l2o_buf.local_nve_id,
HVTYNL);
}
- if (bi->extra && bi->extra->vnc.import.aux_prefix.family) {
+ if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
const char *sp;
- sp = rfapi_ntop(bi->extra->vnc.import.aux_prefix.family,
- &bi->extra->vnc.import.aux_prefix.u.prefix, buf,
- BUFSIZ);
+ sp = rfapi_ntop(bpi->extra->vnc.import.aux_prefix.family,
+ &bpi->extra->vnc.import.aux_prefix.u.prefix,
+ buf, BUFSIZ);
buf[BUFSIZ - 1] = 0;
if (sp) {
fp(out, " IP: %s%s", sp, HVTYNL);
}
{
struct rfapi_un_option *uo =
- rfapi_encap_tlv_to_un_option(bi->attr);
+ rfapi_encap_tlv_to_un_option(bpi->attr);
if (uo) {
rfapi_print_tunneltype_option(stream, 8, &uo->v.tunnel);
rfapi_un_options_free(uo);
if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0)
return;
- fp(out, " Mon m=%p, next=%p, node=%p, bi=%p%s", m, m->next, m->node,
- m->bi, HVTYNL);
+ fp(out, " Mon m=%p, next=%p, node=%p, bpi=%p%s", m, m->next, m->node,
+ m->bpi, HVTYNL);
}
void rfapiShowItNode(void *stream, struct agg_node *rn)
{
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
char buf[BUFSIZ];
int (*fp)(void *, const char *, ...);
rfapi_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ),
rn->p.prefixlen, rn, rn->lock, HVTYNL);
- for (bi = rn->info; bi; bi = bi->next) {
- rfapiPrintBi(stream, bi);
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
+ rfapiPrintBi(stream, bpi);
}
/* doesn't show montors */
fp(out, "Import Table [%s]%s", label, HVTYNL);
for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
if (rn->p.family == AF_ETHERNET) {
rfapiEthAddr2Str(&rn->p.u.prefix_eth, buf, BUFSIZ);
rn->lock - 1, /* account for loop iterator locking */
HVTYNL);
- for (bi = rn->info; bi; bi = bi->next) {
- rfapiPrintBi(stream, bi);
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
+ rfapiPrintBi(stream, bpi);
}
if (isvpn) {
}
static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
- struct agg_node *rn, struct bgp_path_info *bi)
+ struct agg_node *rn, struct bgp_path_info *bpi)
{
int (*fp)(void *, const char *, ...);
struct vty *vty;
* UN addr
*/
buf_un[0] = 0;
- if (!rfapiGetUnAddrOfVpnBi(bi, &pfx_un)) {
+ if (!rfapiGetUnAddrOfVpnBi(bpi, &pfx_un)) {
snprintf(buf_un, BUFSIZ, "%s",
inet_ntop(pfx_un.family, &pfx_un.u.prefix, buf_ntop,
BUFSIZ));
}
- rfapiGetTunnelType(bi->attr, &tun_type);
+ rfapiGetTunnelType(bpi->attr, &tun_type);
/*
* VN addr
*/
buf_vn[0] = 0;
- rfapiNexthop2Prefix(bi->attr, &pfx_vn);
+ rfapiNexthop2Prefix(bpi->attr, &pfx_vn);
if (tun_type == BGP_ENCAP_TYPE_MPLS) {
/* MPLS carries un in nrli next hop (same as vn for IP tunnels)
*/
snprintf(buf_un, BUFSIZ, "%s",
inet_ntop(pfx_vn.family, &pfx_vn.u.prefix, buf_ntop,
BUFSIZ));
- if (bi->extra) {
- uint32_t l = decode_label(&bi->extra->label[0]);
+ if (bpi->extra) {
+ uint32_t l = decode_label(&bpi->extra->label[0]);
snprintf(buf_vn, BUFSIZ, "Label: %d", l);
} else /* should never happen */
{
* See rfapi_import.c'rfapiRouteInfo2NextHopEntry() for conversion
* back to cost.
*/
- if (bi->attr) {
+ if (bpi->attr) {
uint32_t local_pref;
- if (bi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
- local_pref = bi->attr->local_pref;
+ if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
+ local_pref = bpi->attr->local_pref;
else
local_pref = 0;
cost = (local_pref > 255) ? 0 : 255 - local_pref;
/* Lifetime */
/* NB rfapiGetVncLifetime sets infinite value when returning !0 */
- if (rfapiGetVncLifetime(bi->attr, &lifetime)
+ if (rfapiGetVncLifetime(bpi->attr, &lifetime)
|| (lifetime == RFAPI_INFINITE_LIFETIME)) {
fp(out, "%-10s ", "infinite");
fp(out, "%-10s ", buf_lifetime);
}
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED) && bi->extra
- && bi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra
+ && bpi->extra->vnc.import.timer) {
uint32_t remaining;
time_t age;
char buf_age[BUFSIZ];
- struct thread *t = (struct thread *)bi->extra->vnc.import.timer;
+ struct thread *t =
+ (struct thread *)bpi->extra->vnc.import.timer;
remaining = thread_timer_remain_second(t);
#if RFAPI_REGISTRATIONS_REPORT_AGE
fp(out, "%-10s ", buf_age);
- } else if (RFAPI_LOCAL_BI(bi)) {
+ } else if (RFAPI_LOCAL_BI(bpi)) {
char buf_age[BUFSIZ];
- if (bi->extra && bi->extra->vnc.import.create_time) {
- rfapiFormatAge(bi->extra->vnc.import.create_time,
+ if (bpi->extra && bpi->extra->vnc.import.create_time) {
+ rfapiFormatAge(bpi->extra->vnc.import.create_time,
buf_age, BUFSIZ);
} else {
buf_age[0] = '?';
* print that on the next line
*/
- if (bi->extra && bi->extra->vnc.import.aux_prefix.family) {
+ if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
const char *sp;
sp = rfapi_ntop(
- bi->extra->vnc.import.aux_prefix.family,
- &bi->extra->vnc.import.aux_prefix.u.prefix,
+ bpi->extra->vnc.import.aux_prefix.family,
+ &bpi->extra->vnc.import.aux_prefix.u.prefix,
buf_ntop, BUFSIZ);
buf_ntop[BUFSIZ - 1] = 0;
}
}
}
- if (tun_type != BGP_ENCAP_TYPE_MPLS && bi->extra) {
- uint32_t l = decode_label(&bi->extra->label[0]);
+ if (tun_type != BGP_ENCAP_TYPE_MPLS && bpi->extra) {
+ uint32_t l = decode_label(&bpi->extra->label[0]);
if (!MPLS_LABEL_IS_NULL(l)) {
fp(out, " Label: %d", l);
if (nlines == 1)
for (rn = agg_route_top(it->imported_vpn[afi]); rn;
rn = agg_route_next(rn)) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
int count_only;
/* allow for wider or more narrow mask from user */
else
count_only = 0;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
- if (!show_local && RFAPI_LOCAL_BI(bi)) {
+ if (!show_local && RFAPI_LOCAL_BI(bpi)) {
/* local route from RFP */
continue;
}
- if (!show_remote && !RFAPI_LOCAL_BI(bi)) {
+ if (!show_remote && !RFAPI_LOCAL_BI(bpi)) {
/* remote route */
continue;
}
if (show_expiring
- && !CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
+ && !CHECK_FLAG(bpi->flags,
+ BGP_PATH_REMOVED))
continue;
if (!show_expiring
- && CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
+ && CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
- if (bi->type == ZEBRA_ROUTE_BGP_DIRECT
- || bi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT) {
+ if (bpi->type == ZEBRA_ROUTE_BGP_DIRECT
+ || bpi->type
+ == ZEBRA_ROUTE_BGP_DIRECT_EXT) {
if (!show_imported)
continue;
} else {
type = "Holddown";
} else {
if (RFAPI_LOCAL_BI(
- bi)) {
+ bpi)) {
type = "Local";
} else {
type = "Remote";
"Lifetime", agetype, HVTYNL);
}
printed += rfapiPrintRemoteRegBi(bgp, stream,
- rn, bi);
+ rn, bpi);
}
}
}
{
afi_t afi; /* of the VN address */
struct bgp_node *bn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
uint8_t type = ZEBRA_ROUTE_BGP;
struct bgp *bgp;
int printed = 0;
vty_out(vty, " bn=%p%s", bn, HVTYNL);
- for (bi = bn->info; bi; bi = bi->next) {
- if (bi->peer == rfd->peer && bi->type == type
- && bi->sub_type == BGP_ROUTE_RFP && bi->extra
- && bi->extra->vnc.export.rfapi_handle == (void *)rfd) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
+ if (bpi->peer == rfd->peer && bpi->type == type
+ && bpi->sub_type == BGP_ROUTE_RFP && bpi->extra
+ && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
- rfapiPrintBi(vty, bi);
+ rfapiPrintBi(vty, bpi);
printed = 1;
}
}
void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
- struct bgp_path_info *bi)
+ struct bgp_path_info *bpi)
{
- struct attr *attr = bi->attr;
- struct peer *peer = bi->peer;
+ struct attr *attr = bpi->attr;
+ struct peer *peer = bpi->peer;
struct prefix *prefix = &rn->p;
afi_t afi = family2afi(prefix->family);
struct bgp_node *urn;
- struct bgp_path_info *ubi;
+ struct bgp_path_info *ubpi;
struct attr hattr;
struct attr *iattr;
struct prefix ce_nexthop;
return;
}
- if ((bi->type != ZEBRA_ROUTE_BGP)
- || (bi->sub_type != BGP_ROUTE_NORMAL
- && bi->sub_type != BGP_ROUTE_RFP
- && bi->sub_type != BGP_ROUTE_STATIC)) {
+ if ((bpi->type != ZEBRA_ROUTE_BGP)
+ || (bpi->sub_type != BGP_ROUTE_NORMAL
+ && bpi->sub_type != BGP_ROUTE_RFP
+ && bpi->sub_type != BGP_ROUTE_STATIC)) {
vnc_zlog_debug_verbose(
"%s: wrong route type/sub_type for export, skipping",
*/
urn = bgp_afi_node_get(bgp->rib[afi][SAFI_UNICAST], afi, SAFI_UNICAST,
prefix, NULL);
- for (ubi = urn->info; ubi; ubi = ubi->next) {
+ for (ubpi = urn->info; ubpi; ubpi = ubpi->next) {
struct prefix unicast_nexthop;
- if (CHECK_FLAG(ubi->flags, BGP_PATH_REMOVED))
+ if (CHECK_FLAG(ubpi->flags, BGP_PATH_REMOVED))
continue;
- rfapiUnicastNexthop2Prefix(afi, ubi->attr, &unicast_nexthop);
+ rfapiUnicastNexthop2Prefix(afi, ubpi->attr, &unicast_nexthop);
- if (ubi->type == ZEBRA_ROUTE_VNC_DIRECT
- && ubi->sub_type == BGP_ROUTE_REDISTRIBUTE
- && ubi->peer == peer
+ if (ubpi->type == ZEBRA_ROUTE_VNC_DIRECT
+ && ubpi->sub_type == BGP_ROUTE_REDISTRIBUTE
+ && ubpi->peer == peer
&& prefix_same(&unicast_nexthop, &ce_nexthop)) {
vnc_zlog_debug_verbose(
* "Withdrawing a Route" export process
*/
void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
- struct bgp_path_info *bi)
+ struct bgp_path_info *bpi)
{
afi_t afi = family2afi(rn->p.family);
- struct bgp_path_info *vbi;
+ struct bgp_path_info *vbpi;
struct prefix ce_nexthop;
if (!afi) {
* This works only for IPv4 because IPv6 addresses are too big
* to fit in an extended community
*/
- if (getce(bgp, bi->attr, &ce_nexthop)) {
+ if (getce(bgp, bpi->attr, &ce_nexthop)) {
vnc_zlog_debug_verbose("%s: EC has no encoded CE, skipping",
__func__);
return;
* route from the unicast RIB
*/
- for (vbi = rn->info; vbi; vbi = vbi->next) {
+ for (vbpi = rn->info; vbpi; vbpi = vbpi->next) {
struct prefix ce;
- if (bi == vbi)
+ if (bpi == vbpi)
continue;
- if (bi->peer != vbi->peer)
+ if (bpi->peer != vbpi->peer)
continue;
- if (getce(bgp, vbi->attr, &ce))
+ if (getce(bgp, vbpi->attr, &ce))
continue;
if (prefix_same(&ce, &ce_nexthop)) {
vnc_zlog_debug_verbose(
/*
* withdraw the route
*/
- bgp_withdraw(bi->peer, &rn->p, 0, /* addpath_id */
- NULL, /* attr, ignored */
+ bgp_withdraw(bpi->peer, &rn->p, 0, /* addpath_id */
+ NULL, /* attr, ignored */
afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */
NULL, 0, NULL); /* tag not used for unicast */
static struct ecommunity *vnc_route_origin_ecom(struct agg_node *rn)
{
struct ecommunity *new;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
if (!rn->info)
return NULL;
new = ecommunity_new();
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
struct ecommunity_val roec;
- switch (BGP_MP_NEXTHOP_FAMILY(bi->attr->mp_nexthop_len)) {
+ switch (BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len)) {
case AF_INET:
memset(&roec, 0, sizeof(roec));
roec.val[0] = 0x01;
roec.val[1] = 0x03;
memcpy(roec.val + 2,
- &bi->attr->mp_nexthop_global_in.s_addr, 4);
+ &bpi->attr->mp_nexthop_global_in.s_addr, 4);
roec.val[6] = 0;
roec.val[7] = 0;
ecommunity_add_val(new, &roec);
/*
* "Adding a Route" export process
- * TBD do we need to check bi->type and bi->sub_type here, or does
+ * TBD do we need to check bpi->type and bpi->sub_type here, or does
* caller do it?
*/
void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
/*
* "Withdrawing a Route" export process
- * TBD do we need to check bi->type and bi->sub_type here, or does
+ * TBD do we need to check bpi->type and bpi->sub_type here, or does
* caller do it?
*/
void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi,
#include "rfapi_private.h"
extern void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
- struct bgp_path_info *bi);
+ struct bgp_path_info *bpi);
extern void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
- struct bgp_path_info *bi);
+ struct bgp_path_info *bpi);
extern void vnc_direct_bgp_add_prefix(struct bgp *bgp,
struct rfapi_import_table *import_table,
struct prefix_bag {
struct prefix hpfx; /* ce address = unicast nexthop */
struct prefix upfx; /* unicast prefix */
- struct bgp_path_info *ubi; /* unicast route */
+ struct bgp_path_info *ubpi; /* unicast route */
};
static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
prefix2str(&pb->upfx, ubuf, sizeof(ubuf));
vnc_zlog_debug_verbose(
- "RHN Entry %d (q=%p): kpfx=%s, upfx=%s, hpfx=%s, ubi=%p",
- ++count, p, kbuf, ubuf, hbuf, pb->ubi);
+ "RHN Entry %d (q=%p): kpfx=%s, upfx=%s, hpfx=%s, ubpi=%p",
+ ++count, p, kbuf, ubuf, hbuf, pb->ubpi);
}
}
#endif
afi = family2afi(pb->upfx.family);
- rfapiUnicastNexthop2Prefix(afi, pb->ubi->attr,
+ rfapiUnicastNexthop2Prefix(afi, pb->ubpi->attr,
&pfx_orig_nexthop);
- /* pb->hpfx, pb->ubi nexthop, pkey should all reflect the same
+ /* pb->hpfx, pb->ubpi nexthop, pkey should all reflect the same
* pfx */
assert(!vnc_prefix_cmp(&pb->hpfx, pkey));
if (vnc_prefix_cmp(&pb->hpfx, &pfx_orig_nexthop)) {
prefix2str(&pb->hpfx, str_nve_pfx, sizeof(str_nve_pfx));
vnc_zlog_debug_verbose(
- "%s: %s: FATAL: resolve_nve_nexthop list item bi nexthop %s != nve pfx %s",
+ "%s: %s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
__func__, tag, str_onh, str_nve_pfx);
assert(0);
}
static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
- struct bgp *bgp, afi_t afi, struct bgp_path_info *bi, /* VPN bi */
- struct prefix_rd *prd, /* RD */
+ struct bgp *bgp, afi_t afi, struct bgp_path_info *bpi, /* VPN bpi */
+ struct prefix_rd *prd, /* RD */
struct prefix *prefix, /* unicast route prefix */
uint32_t *local_pref, /* NULL = no local_pref */
uint32_t *med, /* NULL = no med */
vnc_zlog_debug_verbose("%s: entry", __func__);
- if (bi->type != ZEBRA_ROUTE_BGP && bi->type != ZEBRA_ROUTE_BGP_DIRECT) {
+ if (bpi->type != ZEBRA_ROUTE_BGP
+ && bpi->type != ZEBRA_ROUTE_BGP_DIRECT) {
return;
}
- if (bi->sub_type != BGP_ROUTE_NORMAL && bi->sub_type != BGP_ROUTE_STATIC
- && bi->sub_type != BGP_ROUTE_RFP) {
+ if (bpi->sub_type != BGP_ROUTE_NORMAL
+ && bpi->sub_type != BGP_ROUTE_STATIC
+ && bpi->sub_type != BGP_ROUTE_RFP) {
return;
}
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
return;
- vncHDResolveNve.peer = bi->peer;
- if (!rfapiGetVncTunnelUnAddr(bi->attr, &un)) {
+ vncHDResolveNve.peer = bpi->peer;
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, &un)) {
if (rfapiQprefix2Raddr(&un, &vncHDResolveNve.un_addr))
return;
} else {
}
/* Use nexthop of VPN route as nexthop of constructed route */
- rfapiNexthop2Prefix(bi->attr, &nexthop);
+ rfapiNexthop2Prefix(bpi->attr, &nexthop);
rfapiQprefix2Raddr(&nexthop, &nexthop_h);
- if (rfapiGetVncLifetime(bi->attr, &lifetime)) {
+ if (rfapiGetVncLifetime(bpi->attr, &lifetime)) {
plifetime = NULL;
} else {
plifetime = &lifetime;
}
- if (bi->attr) {
- encaptlvs = bi->attr->vnc_subtlvs;
- if (bi->attr->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED
- && bi->attr->encap_tunneltype != BGP_ENCAP_TYPE_MPLS) {
+ if (bpi->attr) {
+ encaptlvs = bpi->attr->vnc_subtlvs;
+ if (bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED
+ && bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_MPLS) {
if (opt != NULL)
opt->next = &optary[cur_opt];
opt = &optary[cur_opt++];
memset(opt, 0, sizeof(struct rfapi_un_option));
opt->type = RFAPI_UN_OPTION_TYPE_TUNNELTYPE;
- opt->v.tunnel.type = bi->attr->encap_tunneltype;
- /* TBD parse bi->attr->extra->encap_subtlvs */
+ opt->v.tunnel.type = bpi->attr->encap_tunneltype;
+ /* TBD parse bpi->attr->extra->encap_subtlvs */
}
} else {
encaptlvs = NULL;
struct ecommunity *new_ecom = ecommunity_dup(ecom);
- if (bi->attr && bi->attr->ecommunity)
- ecommunity_merge(new_ecom, bi->attr->ecommunity);
+ if (bpi->attr && bpi->attr->ecommunity)
+ ecommunity_merge(new_ecom, bpi->attr->ecommunity);
- if (bi->extra)
- label = decode_label(&bi->extra->label[0]);
+ if (bpi->extra)
+ label = decode_label(&bpi->extra->label[0]);
add_vnc_route(&vncHDResolveNve, bgp, SAFI_MPLS_VPN,
prefix, /* unicast route prefix */
struct bgp_table *table_rd, /* per-rd VPN route table */
afi_t afi, struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
struct ecommunity *ecom, /* generated ecoms */
- uint32_t *local_pref, /* NULL = no local_pref */
- uint32_t *med, /* NULL = no med */
- struct prefix *ubi_nexthop) /* unicast nexthop */
+ uint32_t *local_pref, /* NULL = no local_pref */
+ uint32_t *med, /* NULL = no med */
+ struct prefix *ubpi_nexthop) /* unicast nexthop */
{
struct bgp_node *bn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
if (!table_rd)
return;
{
char str_nh[PREFIX_STRLEN];
- prefix2str(ubi_nexthop, str_nh, sizeof(str_nh));
+ prefix2str(ubpi_nexthop, str_nh, sizeof(str_nh));
- vnc_zlog_debug_verbose("%s: ubi_nexthop=%s", __func__, str_nh);
+ vnc_zlog_debug_verbose("%s: ubpi_nexthop=%s", __func__, str_nh);
}
/* exact match */
- bn = bgp_node_lookup(table_rd, ubi_nexthop);
+ bn = bgp_node_lookup(table_rd, ubpi_nexthop);
if (!bn) {
vnc_zlog_debug_verbose(
- "%s: no match in RD's table for ubi_nexthop", __func__);
+ "%s: no match in RD's table for ubpi_nexthop",
+ __func__);
return;
}
/* Iterate over bgp_path_info items at this node */
- for (bi = bn->info; bi; bi = bi->next) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
- bgp, afi, bi, /* VPN bi */
+ bgp, afi, bpi, /* VPN bpi */
prd, prefix, local_pref, med, ecom);
}
pb = XCALLOC(MTYPE_RFAPI_PREFIX_BAG, sizeof(struct prefix_bag));
pb->hpfx = pfx_unicast_nexthop;
- pb->ubi = info;
+ pb->ubpi = info;
pb->upfx = *prefix;
bgp_path_info_lock(info); /* skiplist refers to it */
}
static void vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
- struct bgp *bgp, afi_t afi, struct bgp_path_info *bi, /* VPN bi */
- struct prefix_rd *prd, /* RD */
+ struct bgp *bgp, afi_t afi, struct bgp_path_info *bpi, /* VPN bpi */
+ struct prefix_rd *prd, /* RD */
struct prefix *prefix) /* unicast route prefix */
{
struct prefix un;
- if (bi->type != ZEBRA_ROUTE_BGP && bi->type != ZEBRA_ROUTE_BGP_DIRECT) {
+ if (bpi->type != ZEBRA_ROUTE_BGP
+ && bpi->type != ZEBRA_ROUTE_BGP_DIRECT) {
return;
}
- if (bi->sub_type != BGP_ROUTE_NORMAL && bi->sub_type != BGP_ROUTE_STATIC
- && bi->sub_type != BGP_ROUTE_RFP) {
+ if (bpi->sub_type != BGP_ROUTE_NORMAL
+ && bpi->sub_type != BGP_ROUTE_STATIC
+ && bpi->sub_type != BGP_ROUTE_RFP) {
return;
}
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
return;
- vncHDResolveNve.peer = bi->peer;
- if (!rfapiGetVncTunnelUnAddr(bi->attr, &un)) {
+ vncHDResolveNve.peer = bpi->peer;
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, &un)) {
if (rfapiQprefix2Raddr(&un, &vncHDResolveNve.un_addr))
return;
} else {
struct prefix_rd *prd,
struct bgp_table *table_rd, /* per-rd VPN route table */
afi_t afi, struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
- struct prefix *ubi_nexthop) /* unicast bi's nexthop */
+ struct prefix *ubpi_nexthop) /* unicast bpi's nexthop */
{
struct bgp_node *bn;
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
if (!table_rd)
return;
{
char str_nh[PREFIX_STRLEN];
- prefix2str(ubi_nexthop, str_nh, sizeof(str_nh));
- vnc_zlog_debug_verbose("%s: ubi_nexthop=%s", __func__, str_nh);
+ prefix2str(ubpi_nexthop, str_nh, sizeof(str_nh));
+ vnc_zlog_debug_verbose("%s: ubpi_nexthop=%s", __func__, str_nh);
}
/* exact match */
- bn = bgp_node_lookup(table_rd, ubi_nexthop);
+ bn = bgp_node_lookup(table_rd, ubpi_nexthop);
if (!bn) {
vnc_zlog_debug_verbose(
- "%s: no match in RD's table for ubi_nexthop", __func__);
+ "%s: no match in RD's table for ubpi_nexthop",
+ __func__);
return;
}
/* Iterate over bgp_path_info items at this node */
- for (bi = bn->info; bi; bi = bi->next) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
- bgp, afi, bi, /* VPN bi */
- prd, /* VPN RD */
- prefix); /* unicast route prefix */
+ bgp, afi, bpi, /* VPN bpi */
+ prd, /* VPN RD */
+ prefix); /* unicast route prefix */
}
bgp_unlock_node(bn);
rc = skiplist_first_value(sl, &pfx_unicast_nexthop, (void *)&pb,
&cursor);
while (!rc) {
- if (pb->ubi == info) {
+ if (pb->ubpi == info) {
skiplist_delete(sl, &pfx_unicast_nexthop, pb);
bgp_path_info_unlock(info);
break;
***********************************************************************/
/*
- * Should be called whan a bi is added to VPN RIB. This function
+ * Should be called whan a bpi is added to VPN RIB. This function
* will check if it is a host route and return immediately if not.
*/
void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */
- struct bgp_path_info *bi) /* new VPN host route */
+ struct bgp_path_info *bpi) /* new VPN host route */
{
afi_t afi = family2afi(prefix->family);
struct skiplist *sl = NULL;
prefix2str(&pb->upfx, ubuf, sizeof(ubuf));
vnc_zlog_debug_any(
- "%s: examining RHN Entry (q=%p): upfx=%s, hpfx=%s, ubi=%p",
- __func__, cursor, ubuf, hbuf, pb->ubi);
+ "%s: examining RHN Entry (q=%p): upfx=%s, hpfx=%s, ubpi=%p",
+ __func__, cursor, ubuf, hbuf, pb->ubpi);
}
- if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubi, &ecom,
+ if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubpi, &ecom,
&pfx_unicast_nexthop)) {
vnc_zlog_debug_verbose(
__func__);
continue;
}
- local_pref = calc_local_pref(pb->ubi->attr, pb->ubi->peer);
+ local_pref = calc_local_pref(pb->ubpi->attr, pb->ubpi->peer);
- if (pb->ubi->attr
- && (pb->ubi->attr->flag
+ if (pb->ubpi->attr
+ && (pb->ubpi->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))) {
- med = &pb->ubi->attr->med;
+ med = &pb->ubpi->attr->med;
}
/*
prefix2str(prefix, str_nve_pfx, sizeof(str_nve_pfx));
vnc_zlog_debug_verbose(
- "%s: FATAL: resolve_nve_nexthop list item bi nexthop %s != nve pfx %s",
+ "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
__func__, str_unh, str_nve_pfx);
assert(0);
}
vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
- bgp, afi, bi, /* VPN bi */
+ bgp, afi, bpi, /* VPN bpi */
prd, &pb->upfx, /* unicast prefix */
&local_pref, med, ecom);
struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */
- struct bgp_path_info *bi) /* old VPN host route */
+ struct bgp_path_info *bpi) /* old VPN host route */
{
afi_t afi = family2afi(prefix->family);
struct skiplist *sl = NULL;
memset(&pfx_unicast_nexthop, 0,
sizeof(struct prefix)); /* keep valgrind happy */
- if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubi, &ecom,
+ if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubpi, &ecom,
&pfx_unicast_nexthop)) {
vnc_zlog_debug_verbose(
prefix2str(prefix, str_nve_pfx, sizeof(str_nve_pfx));
vnc_zlog_debug_verbose(
- "%s: FATAL: resolve_nve_nexthop list item bi nexthop %s != nve pfx %s",
+ "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
__func__, str_unh, str_nve_pfx);
assert(0);
}
vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
- bgp, afi, bi, prd, &pb->upfx);
+ bgp, afi, bpi, prd, &pb->upfx);
if (ecom)
ecommunity_free(&ecom);
#define DEBUG_IS_USABLE_INTERIOR 1
-static int is_usable_interior_route(struct bgp_path_info *bi_interior)
+static int is_usable_interior_route(struct bgp_path_info *bpi_interior)
{
- if (!VALID_INTERIOR_TYPE(bi_interior->type)) {
+ if (!VALID_INTERIOR_TYPE(bpi_interior->type)) {
#if DEBUG_IS_USABLE_INTERIOR
vnc_zlog_debug_verbose(
"%s: NO: type %d is not valid interior type", __func__,
- bi_interior->type);
+ bpi_interior->type);
#endif
return 0;
}
- if (!CHECK_FLAG(bi_interior->flags, BGP_PATH_VALID)) {
+ if (!CHECK_FLAG(bpi_interior->flags, BGP_PATH_VALID)) {
#if DEBUG_IS_USABLE_INTERIOR
vnc_zlog_debug_verbose("%s: NO: BGP_PATH_VALID not set",
__func__);
struct agg_table *table;
struct agg_node *rn;
struct agg_node *par;
- struct bgp_path_info *bi_interior;
+ struct bgp_path_info *bpi_interior;
int have_usable_route;
vnc_zlog_debug_verbose("%s: doing it %p", __func__, it);
vnc_zlog_debug_verbose("%s: it %p trying rn %p",
__func__, it, rn);
- for (bi_interior = rn->info; bi_interior;
- bi_interior = bi_interior->next) {
+ for (bpi_interior = rn->info; bpi_interior;
+ bpi_interior = bpi_interior->next) {
struct prefix_rd *prd;
struct attr new_attr;
uint32_t label = 0;
- if (!is_usable_interior_route(bi_interior))
+ if (!is_usable_interior_route(bpi_interior))
continue;
vnc_zlog_debug_verbose(
- "%s: usable: bi_interior %p", __func__,
- bi_interior);
+ "%s: usable: bpi_interior %p", __func__,
+ bpi_interior);
/*
* have a legitimate route to exterior's nexthop
*/
have_usable_route = 1;
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import
.rd;
label = decode_label(
- &bi_interior->extra->label[0]);
+ &bpi_interior->extra->label[0]);
} else
prd = NULL;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bi_interior->attr);
+ bgp_attr_dup(&new_attr, bpi_interior->attr);
if (info->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
new_attr.local_pref =
rfapiBgpInfoFilteredImportVPN(
it, FIF_ACTION_UPDATE,
- bi_interior->peer, NULL, /* rfd */
+ bpi_interior->peer, NULL, /* rfd */
prefix, NULL, afi, prd, &new_attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
struct agg_table *table;
struct agg_node *rn;
struct agg_node *par;
- struct bgp_path_info *bi_interior;
+ struct bgp_path_info *bpi_interior;
int have_usable_route;
table = it->imported_vpn[afi];
have_usable_route = 0;
(!have_usable_route) && rn;) {
- for (bi_interior = rn->info; bi_interior;
- bi_interior = bi_interior->next) {
+ for (bpi_interior = rn->info; bpi_interior;
+ bpi_interior = bpi_interior->next) {
struct prefix_rd *prd;
uint32_t label = 0;
- if (!is_usable_interior_route(bi_interior))
+ if (!is_usable_interior_route(bpi_interior))
continue;
/*
*/
have_usable_route = 1;
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import
.rd;
label = decode_label(
- &bi_interior->extra->label[0]);
+ &bpi_interior->extra->label[0]);
} else
prd = NULL;
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_KILL, bi_interior->peer,
+ it, FIF_ACTION_KILL, bpi_interior->peer,
NULL, /* rfd */
prefix, NULL, afi, prd,
- bi_interior->attr,
+ bpi_interior->attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
*/
void vnc_import_bgp_exterior_add_route_interior(
struct bgp *bgp, struct rfapi_import_table *it,
- struct agg_node *rn_interior, /* VPN IT node */
- struct bgp_path_info *bi_interior) /* VPN IT route */
+ struct agg_node *rn_interior, /* VPN IT node */
+ struct bgp_path_info *bpi_interior) /* VPN IT route */
{
afi_t afi = family2afi(rn_interior->p.family);
struct agg_node *par;
- struct bgp_path_info *bi_exterior;
+ struct bgp_path_info *bpi_exterior;
struct prefix *pfx_exterior; /* exterior pfx */
void *cursor;
int rc;
vnc_zlog_debug_verbose("%s: entry", __func__);
- if (!is_usable_interior_route(bi_interior)) {
+ if (!is_usable_interior_route(bpi_interior)) {
vnc_zlog_debug_verbose(
"%s: not usable interior route, skipping", __func__);
return;
char str_pfx[PREFIX_STRLEN];
prefix2str(&rn_interior->p, str_pfx, sizeof(str_pfx));
- vnc_zlog_debug_verbose("%s: interior prefix=%s, bi type=%d",
- __func__, str_pfx, bi_interior->type);
+ vnc_zlog_debug_verbose("%s: interior prefix=%s, bpi type=%d",
+ __func__, str_pfx, bpi_interior->type);
}
if (RFAPI_HAS_MONITOR_EXTERIOR(rn_interior)) {
cursor = NULL;
for (rc = skiplist_next(
RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, (void **)&pfx_exterior,
+ (void **)&bpi_exterior, (void **)&pfx_exterior,
&cursor);
!rc; rc = skiplist_next(
RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, (void **)&pfx_exterior,
- &cursor)) {
+ (void **)&bpi_exterior,
+ (void **)&pfx_exterior, &cursor)) {
struct prefix_rd *prd;
struct attr new_attr;
++count; /* debugging */
- assert(bi_exterior);
+ assert(bpi_exterior);
assert(pfx_exterior);
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import.rd;
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import.rd;
label = decode_label(
- &bi_interior->extra->label[0]);
+ &bpi_interior->extra->label[0]);
} else
prd = NULL;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bi_interior->attr);
- if (bi_exterior
- && (bi_exterior->attr->flag
+ bgp_attr_dup(&new_attr, bpi_interior->attr);
+ if (bpi_exterior
+ && (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
new_attr.local_pref =
- bi_exterior->attr->local_pref;
+ bpi_exterior->attr->local_pref;
new_attr.flag |=
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
}
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_UPDATE, bi_interior->peer,
+ it, FIF_ACTION_UPDATE, bpi_interior->peer,
NULL, /* rfd */
pfx_exterior, NULL, afi, prd, &new_attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
/* check monitors at par for possible pulldown */
cursor = NULL;
for (rc = skiplist_next(RFAPI_MONITOR_EXTERIOR(par)->source,
- (void **)&bi_exterior,
+ (void **)&bpi_exterior,
(void **)&pfx_exterior, &cursor);
!rc;
rc = skiplist_next(RFAPI_MONITOR_EXTERIOR(par)->source,
- (void **)&bi_exterior,
+ (void **)&bpi_exterior,
(void **)&pfx_exterior, &cursor)) {
struct prefix pfx_nexthop;
sizeof(struct prefix)); /* keep valgrind happy */
/* check original nexthop for prefix match */
- rfapiUnicastNexthop2Prefix(afi, bi_exterior->attr,
+ rfapiUnicastNexthop2Prefix(afi, bpi_exterior->attr,
&pfx_nexthop);
if (prefix_match(&rn_interior->p, &pfx_nexthop)) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
struct prefix_rd *prd;
struct attr new_attr;
uint32_t label = 0;
skiplist_insert(
RFAPI_MONITOR_EXTERIOR(rn_interior)
->source,
- bi_exterior, pfx_mon);
+ bpi_exterior, pfx_mon);
agg_lock_node(rn_interior);
/*
* Delete constructed exterior routes based on
* parent routes.
*/
- for (bi = par->info; bi; bi = bi->next) {
+ for (bpi = par->info; bpi; bpi = bpi->next) {
- if (bi->extra) {
- prd = &bi->extra->vnc.import.rd;
+ if (bpi->extra) {
+ prd = &bpi->extra->vnc.import
+ .rd;
label = decode_label(
- &bi->extra->label[0]);
+ &bpi->extra->label[0]);
} else
prd = NULL;
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_KILL, bi->peer,
+ it, FIF_ACTION_KILL, bpi->peer,
NULL, /* rfd */
pfx_exterior, NULL, afi, prd,
- bi->attr,
+ bpi->attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
}
* Add constructed exterior routes based on
* the new interior route at longer prefix.
*/
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import
.rd;
label = decode_label(
- &bi_interior->extra->label[0]);
+ &bpi_interior->extra->label[0]);
} else
prd = NULL;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bi_interior->attr);
- if (bi_exterior
- && (bi_exterior->attr->flag
+ bgp_attr_dup(&new_attr, bpi_interior->attr);
+ if (bpi_exterior
+ && (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
new_attr.local_pref =
- bi_exterior->attr->local_pref;
+ bpi_exterior->attr->local_pref;
new_attr.flag |= ATTR_FLAG_BIT(
BGP_ATTR_LOCAL_PREF);
}
rfapiBgpInfoFilteredImportVPN(
it, FIF_ACTION_UPDATE,
- bi_interior->peer, NULL, /* rfd */
+ bpi_interior->peer, NULL, /* rfd */
pfx_exterior, NULL, afi, prd, &new_attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
cursor = NULL;
for (rc = skiplist_next(
RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, NULL, &cursor);
+ (void **)&bpi_exterior, NULL, &cursor);
!rc; rc = skiplist_next(
RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, NULL, &cursor)) {
+ (void **)&bpi_exterior, NULL, &cursor)) {
skiplist_delete(RFAPI_MONITOR_EXTERIOR(par)->source,
- bi_exterior, NULL);
+ bpi_exterior, NULL);
agg_unlock_node(par); /* sl entry */
}
if (skiplist_empty(RFAPI_MONITOR_EXTERIOR(par)->source)) {
cursor = NULL;
list_adopted = NULL;
for (rc = skiplist_next(it->monitor_exterior_orphans,
- (void **)&bi_exterior, (void **)&pfx_exterior,
+ (void **)&bpi_exterior, (void **)&pfx_exterior,
&cursor);
!rc; rc = skiplist_next(it->monitor_exterior_orphans,
- (void **)&bi_exterior,
+ (void **)&bpi_exterior,
(void **)&pfx_exterior, &cursor)) {
struct prefix pfx_nexthop;
}
/* check original nexthop for prefix match */
- rfapiUnicastNexthop2Prefix(afi, bi_exterior->attr,
+ rfapiUnicastNexthop2Prefix(afi, bpi_exterior->attr,
&pfx_nexthop);
if (prefix_match(&rn_interior->p, &pfx_nexthop)) {
}
skiplist_insert(
RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- bi_exterior, pfx_mon);
+ bpi_exterior, pfx_mon);
agg_lock_node(rn_interior); /* sl entry */
if (!list_adopted) {
list_adopted = list_new();
}
- listnode_add(list_adopted, bi_exterior);
+ listnode_add(list_adopted, bpi_exterior);
/*
* Add constructed exterior routes based on the
* new interior route at the longer prefix.
*/
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import.rd;
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import.rd;
label = decode_label(
- &bi_interior->extra->label[0]);
+ &bpi_interior->extra->label[0]);
} else
prd = NULL;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bi_interior->attr);
- if (bi_exterior
- && (bi_exterior->attr->flag
+ bgp_attr_dup(&new_attr, bpi_interior->attr);
+ if (bpi_exterior
+ && (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
new_attr.local_pref =
- bi_exterior->attr->local_pref;
+ bpi_exterior->attr->local_pref;
new_attr.flag |=
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
}
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_UPDATE, bi_interior->peer,
+ it, FIF_ACTION_UPDATE, bpi_interior->peer,
NULL, /* rfd */
pfx_exterior, NULL, afi, prd, &new_attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
}
if (list_adopted) {
struct listnode *node;
- struct agg_node *an_bi_exterior;
+ struct agg_node *an_bpi_exterior;
- for (ALL_LIST_ELEMENTS_RO(list_adopted, node, an_bi_exterior)) {
+ for (ALL_LIST_ELEMENTS_RO(list_adopted, node,
+ an_bpi_exterior)) {
skiplist_delete(it->monitor_exterior_orphans,
- an_bi_exterior, NULL);
+ an_bpi_exterior, NULL);
}
list_delete(&list_adopted);
}
/*
* This function should be called after an interior VPN route
* has been deleted from an import_table.
- * bi_interior must still be valid, but it must already be detached
+ * bpi_interior must still be valid, but it must already be detached
* from its route node and the route node's valid_interior_count
* must already be decremented.
*
*/
void vnc_import_bgp_exterior_del_route_interior(
struct bgp *bgp, struct rfapi_import_table *it,
- struct agg_node *rn_interior, /* VPN IT node */
- struct bgp_path_info *bi_interior) /* VPN IT route */
+ struct agg_node *rn_interior, /* VPN IT node */
+ struct bgp_path_info *bpi_interior) /* VPN IT route */
{
afi_t afi = family2afi(rn_interior->p.family);
struct agg_node *par;
- struct bgp_path_info *bi_exterior;
+ struct bgp_path_info *bpi_exterior;
struct prefix *pfx_exterior; /* exterior pfx */
void *cursor;
int rc;
- if (!VALID_INTERIOR_TYPE(bi_interior->type)) {
+ if (!VALID_INTERIOR_TYPE(bpi_interior->type)) {
vnc_zlog_debug_verbose(
"%s: type %d not valid interior type, skipping",
- __func__, bi_interior->type);
+ __func__, bpi_interior->type);
return;
}
prefix2str(&rn_interior->p, str_pfx, sizeof(str_pfx));
- vnc_zlog_debug_verbose("%s: interior prefix=%s, bi type=%d",
- __func__, str_pfx, bi_interior->type);
+ vnc_zlog_debug_verbose("%s: interior prefix=%s, bpi type=%d",
+ __func__, str_pfx, bpi_interior->type);
}
/*
*/
cursor = NULL;
for (rc = skiplist_next(RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, (void **)&pfx_exterior,
+ (void **)&bpi_exterior, (void **)&pfx_exterior,
&cursor);
!rc;
rc = skiplist_next(RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, (void **)&pfx_exterior,
+ (void **)&bpi_exterior, (void **)&pfx_exterior,
&cursor)) {
struct prefix_rd *prd;
uint32_t label = 0;
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import.rd;
- label = decode_label(&bi_interior->extra->label[0]);
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import.rd;
+ label = decode_label(&bpi_interior->extra->label[0]);
} else
prd = NULL;
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_KILL, bi_interior->peer, NULL, /* rfd */
- pfx_exterior, NULL, afi, prd, bi_interior->attr,
+ it, FIF_ACTION_KILL, bpi_interior->peer, NULL, /* rfd */
+ pfx_exterior, NULL, afi, prd, bpi_interior->attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT, BGP_ROUTE_REDISTRIBUTE,
&label);
}
* We will use and delete every element of the source skiplist
*/
while (!skiplist_first(RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, (void **)&pfx_exterior)) {
+ (void **)&bpi_exterior,
+ (void **)&pfx_exterior)) {
struct prefix *pfx_mon = prefix_new();
if (par) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
/*
* Add monitor to parent node
agg_lock_node(par); /* sl */
}
skiplist_insert(RFAPI_MONITOR_EXTERIOR(par)->source,
- bi_exterior, pfx_mon);
+ bpi_exterior, pfx_mon);
agg_lock_node(par); /* sl entry */
/* Add constructed exterior routes based on parent */
- for (bi = par->info; bi; bi = bi->next) {
+ for (bpi = par->info; bpi; bpi = bpi->next) {
struct prefix_rd *prd;
struct attr new_attr;
uint32_t label = 0;
- if (bi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT)
+ if (bpi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT)
continue;
- if (bi->extra) {
- prd = &bi->extra->vnc.import.rd;
+ if (bpi->extra) {
+ prd = &bpi->extra->vnc.import.rd;
label = decode_label(
- &bi->extra->label[0]);
+ &bpi->extra->label[0]);
} else
prd = NULL;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bi->attr);
- if (bi_exterior
- && (bi_exterior->attr->flag
+ bgp_attr_dup(&new_attr, bpi->attr);
+ if (bpi_exterior
+ && (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
new_attr.local_pref =
- bi_exterior->attr->local_pref;
+ bpi_exterior->attr->local_pref;
new_attr.flag |= ATTR_FLAG_BIT(
BGP_ATTR_LOCAL_PREF);
}
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_UPDATE, bi->peer,
+ it, FIF_ACTION_UPDATE, bpi->peer,
NULL, /* rfd */
pfx_exterior, NULL, afi, prd, &new_attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
* in orphan list to await future route.
*/
skiplist_insert(it->monitor_exterior_orphans,
- bi_exterior, pfx_mon);
+ bpi_exterior, pfx_mon);
}
skiplist_delete_first(
for (rn = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); rn;
rn = bgp_route_next(rn)) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
- vnc_import_bgp_add_route(bgp, &rn->p, bi);
+ vnc_import_bgp_add_route(bgp, &rn->p, bpi);
}
}
vnc_zlog_debug_verbose(
for (rn = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]); rn;
rn = bgp_route_next(rn)) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
vnc_import_bgp_exterior_add_route(bgp_exterior, &rn->p,
- bi);
+ bpi);
}
}
vnc_zlog_debug_verbose(
for (rn = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]); rn;
rn = bgp_route_next(rn)) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
vnc_import_bgp_exterior_add_route_it(
- bgp_exterior, &rn->p, bi, it_only);
+ bgp_exterior, &rn->p, bpi, it_only);
}
}
}
for (rn2 = bgp_table_top(rn1->info); rn2;
rn2 = bgp_route_next(rn2)) {
- struct bgp_path_info *bi;
- struct bgp_path_info *nextbi;
+ struct bgp_path_info *bpi;
+ struct bgp_path_info *nextbpi;
- for (bi = rn2->info; bi; bi = nextbi) {
+ for (bpi = rn2->info; bpi; bpi = nextbpi) {
- nextbi = bi->next;
+ nextbpi = bpi->next;
- if (bi->type
+ if (bpi->type
== ZEBRA_ROUTE_BGP_DIRECT) {
struct rfapi_descriptor *rfd;
- vncHDBgpDirect.peer = bi->peer;
+ vncHDBgpDirect.peer = bpi->peer;
- assert(bi->extra);
+ assert(bpi->extra);
- rfd = bi->extra->vnc.export
+ rfd = bpi->extra->vnc.export
.rfapi_handle;
vnc_zlog_debug_verbose(
- "%s: deleting bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p [passing rfd=%p]",
- __func__, bi, bi->peer,
- bi->type, bi->sub_type,
- (bi->extra
- ? bi->extra
+ "%s: deleting bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p [passing rfd=%p]",
+ __func__, bpi,
+ bpi->peer, bpi->type,
+ bpi->sub_type,
+ (bpi->extra
+ ? bpi->extra
->vnc
.export
.rfapi_handle
del_vnc_route(
- rfd, bi->peer, bgp,
+ rfd, bpi->peer, bgp,
SAFI_MPLS_VPN, &rn2->p,
(struct prefix_rd *)&rn1
->p,
- bi->type, bi->sub_type,
- NULL, 1); /* kill */
+ bpi->type,
+ bpi->sub_type, NULL,
+ 1); /* kill */
vncHDBgpDirect.peer = NULL;
}
struct bgp_path_info *info;
while (!skiplist_first(bgp->rfapi->resolve_nve_nexthop, NULL,
(void *)&pb)) {
- info = pb->ubi;
+ info = pb->ubpi;
skiplist_delete_first(bgp->rfapi->resolve_nve_nexthop);
bgp_path_info_unlock(info);
}
for (rn = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]);
rn; rn = bgp_route_next(rn)) {
- struct bgp_path_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
- if (CHECK_FLAG(bi->flags, BGP_PATH_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
vnc_import_bgp_exterior_del_route(bgp_exterior,
- &rn->p, bi);
+ &rn->p, bpi);
}
}
#if DEBUG_RHN_LIST
struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */
- struct bgp_path_info *bi); /* new VPN host route */
+ struct bgp_path_info *bpi); /* new VPN host route */
extern void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */
- struct bgp_path_info *bi); /* old VPN host route */
+ struct bgp_path_info *bpi); /* old VPN host route */
#endif /* _QUAGGA_RFAPI_VNC_IMPORT_BGP_H_ */
extern void vnc_import_bgp_exterior_add_route_interior(
struct bgp *bgp, struct rfapi_import_table *it,
- struct agg_node *rn_interior, /* VPN IT node */
- struct bgp_path_info *bi_interior); /* VPN IT route */
+ struct agg_node *rn_interior, /* VPN IT node */
+ struct bgp_path_info *bpi_interior); /* VPN IT route */
extern void vnc_import_bgp_exterior_del_route_interior(
struct bgp *bgp, struct rfapi_import_table *it,
- struct agg_node *rn_interior, /* VPN IT node */
- struct bgp_path_info *bi_interior); /* VPN IT route */
+ struct agg_node *rn_interior, /* VPN IT node */
+ struct bgp_path_info *bpi_interior); /* VPN IT route */
extern void
vnc_import_bgp_exterior_redist_enable_it(struct bgp *bgp, afi_t afi,