|| (safi == SAFI_EVPN)) {
prn = bgp_node_get(table, (struct prefix *)prd);
- if (prn->info == NULL)
- prn->info = bgp_table_init(table->bgp, afi, safi);
+ if (!bgp_node_has_bgp_path_info_data(prn))
+ bgp_node_set_bgp_table_info(
+ prn, bgp_table_init(table->bgp, afi, safi));
else
bgp_unlock_node(prn);
- table = prn->info;
+ table = bgp_node_get_bgp_table_info(prn);
}
rn = bgp_node_get(table, p);
if (!prn)
return NULL;
- if (prn->info == NULL) {
+ if (!bgp_node_has_bgp_path_info_data(prn)) {
bgp_unlock_node(prn);
return NULL;
}
- table = prn->info;
+ table = bgp_node_get_bgp_table_info(prn);
}
rn = bgp_node_lookup(table, p);
return new;
}
-static void bgp_path_info_extra_free(struct bgp_path_info_extra **extra)
+void bgp_path_info_extra_free(struct bgp_path_info_extra **extra)
{
struct bgp_path_info_extra *e;
{
struct bgp_path_info *top;
- top = rn->info;
+ top = bgp_node_get_bgp_path_info(rn);
- pi->next = rn->info;
+ pi->next = top;
pi->prev = NULL;
if (top)
top->prev = pi;
- rn->info = pi;
+ bgp_node_set_bgp_path_info(rn, pi);
bgp_path_info_lock(pi);
bgp_lock_node(rn);
if (pi->prev)
pi->prev->next = pi->next;
else
- rn->info = pi->next;
+ bgp_node_set_bgp_path_info(rn, pi->next);
bgp_path_info_mpath_dequeue(pi);
bgp_path_info_unlock(pi);
if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) {
/* Clear BGP_PATH_DMED_SELECTED for all paths */
- for (pi1 = rn->info; pi1; pi1 = pi1->next)
+ for (pi1 = bgp_node_get_bgp_path_info(rn); pi1;
+ pi1 = pi1->next)
bgp_path_info_unset_flag(rn, pi1,
BGP_PATH_DMED_SELECTED);
- for (pi1 = rn->info; pi1; pi1 = pi1->next) {
+ for (pi1 = bgp_node_get_bgp_path_info(rn); pi1;
+ pi1 = pi1->next) {
if (CHECK_FLAG(pi1->flags, BGP_PATH_DMED_CHECK))
continue;
if (BGP_PATH_HOLDDOWN(pi1))
/* Check old selected route and new selected route. */
old_select = NULL;
new_select = NULL;
- for (pi = rn->info; (pi != NULL) && (nextpi = pi->next, 1);
- pi = nextpi) {
+ for (pi = bgp_node_get_bgp_path_info(rn);
+ (pi != NULL) && (nextpi = pi->next, 1); pi = nextpi) {
if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED))
old_select = pi;
}
if (do_mpath && new_select) {
- for (pi = rn->info; (pi != NULL) && (nextpi = pi->next, 1);
- pi = nextpi) {
+ for (pi = bgp_node_get_bgp_path_info(rn);
+ (pi != NULL) && (nextpi = pi->next, 1); pi = nextpi) {
if (debug)
bgp_path_info_path_with_addpath_rx_str(
{
struct bgp_path_info *pi;
- for (pi = rn->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) {
if (BGP_PATH_HOLDDOWN(pi))
continue;
UNSET_FLAG(pi->flags, BGP_PATH_IGP_CHANGED);
prn = bgp_node_get(peer->bgp->rib[afi][safi],
(struct prefix *)prd);
- if (prn->info) {
- table = (struct bgp_table *)(prn->info);
+ if (bgp_node_has_bgp_path_info_data(prn)) {
+ table = bgp_node_get_bgp_table_info(prn);
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
peer->bgp, prd, table, &rn->p, pi);
bgp_adj_in_set(rn, peer, attr, addpath_id);
/* Check previously received route. */
- for (pi = rn->info; pi; pi = pi->next)
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next)
if (pi->peer == peer && pi->type == type
&& pi->sub_type == sub_type
&& pi->addpath_rx_id == addpath_id)
prn = bgp_node_get(bgp->rib[afi][safi],
(struct prefix *)prd);
- if (prn->info) {
- table = (struct bgp_table *)(prn->info);
+ if (bgp_node_has_bgp_path_info_data(prn)) {
+ table = bgp_node_get_bgp_table_info(prn);
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
bgp, prd, table, p, pi);
prn = bgp_node_get(bgp->rib[afi][safi],
(struct prefix *)prd);
- if (prn->info) {
- table = (struct bgp_table *)(prn->info);
+ if (bgp_node_has_bgp_path_info_data(prn)) {
+ table = bgp_node_get_bgp_table_info(prn);
vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
bgp, prd, table, p, pi);
struct bgp_table *table = NULL;
prn = bgp_node_get(bgp->rib[afi][safi], (struct prefix *)prd);
- if (prn->info) {
- table = (struct bgp_table *)(prn->info);
+ if (bgp_node_has_bgp_path_info_data(prn)) {
+ table = bgp_node_get_bgp_table_info(prn);
vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
bgp, prd, table, p, new);
}
/* Lookup withdrawn route. */
- for (pi = rn->info; pi; pi = pi->next)
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next)
if (pi->peer == peer && pi->type == type
&& pi->sub_type == sub_type
&& pi->addpath_rx_id == addpath_id)
if (ain->peer != peer)
continue;
- struct bgp_path_info *pi = rn->info;
+ struct bgp_path_info *pi =
+ bgp_node_get_bgp_path_info(rn);
uint32_t num_labels = 0;
mpls_label_t *label_pnt = NULL;
bgp_soft_reconfig_table(peer, afi, safi, NULL, NULL);
else
for (rn = bgp_table_top(peer->bgp->rib[afi][safi]); rn;
- rn = bgp_route_next(rn))
- if ((table = rn->info) != NULL) {
+ rn = bgp_route_next(rn)) {
+ table = bgp_node_get_bgp_table_info(rn);
+ if (table != NULL) {
struct prefix_rd prd;
+
prd.family = AF_UNSPEC;
prd.prefixlen = 64;
memcpy(&prd.val, rn->p.u.val, 8);
bgp_soft_reconfig_table(peer, afi, safi, table,
&prd);
}
+ }
}
/* It is possible that we have multiple paths for a prefix from a peer
* if that peer is using AddPath.
*/
- for (pi = rn->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) {
if (pi->peer != peer)
continue;
ain = ain_next;
}
- for (pi = rn->info; pi; pi = next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = next) {
next = pi->next;
if (pi->peer != peer)
continue;
bgp_clear_route_table(peer, afi, safi, NULL);
else
for (rn = bgp_table_top(peer->bgp->rib[afi][safi]); rn;
- rn = bgp_route_next(rn))
- if ((table = rn->info) != NULL)
- bgp_clear_route_table(peer, afi, safi, table);
+ rn = bgp_route_next(rn)) {
+ table = bgp_node_get_bgp_table_info(rn);
+ if (!table)
+ continue;
+
+ bgp_clear_route_table(peer, afi, safi, table);
+ }
/* unlock if no nodes got added to the clear-node-queue. */
if (!peer->clear_node_queue->thread)
struct bgp_node *rm;
/* look for neighbor in tables */
- if ((table = rn->info) == NULL)
+ table = bgp_node_get_bgp_table_info(rn);
+ if (!table)
continue;
for (rm = bgp_table_top(table); rm;
rm = bgp_route_next(rm))
- for (pi = rm->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rm); pi;
+ pi = pi->next) {
if (pi->peer != peer)
continue;
if (!CHECK_FLAG(pi->flags,
} else {
for (rn = bgp_table_top(peer->bgp->rib[afi][safi]); rn;
rn = bgp_route_next(rn))
- for (pi = rn->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi;
+ pi = pi->next) {
if (pi->peer != peer)
continue;
if (!CHECK_FLAG(pi->flags, BGP_PATH_STALE))
struct bgp_path_info *next;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
- for (pi = rn->info; pi; pi = next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = next) {
next = pi->next;
if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)
&& pi->type == ZEBRA_ROUTE_BGP
{
afi_t afi;
struct bgp_node *rn;
+ struct bgp_table *table;
for (afi = AFI_IP; afi < AFI_MAX; ++afi) {
if (afi == AFI_L2VPN)
safi = SAFI_MPLS_VPN;
for (rn = bgp_table_top(bgp->rib[afi][safi]); rn;
rn = bgp_route_next(rn)) {
- if (rn->info) {
- bgp_cleanup_table(bgp,
- (struct bgp_table *)(rn->info),
- safi);
- bgp_table_finish((struct bgp_table **)&(
- rn->info));
- rn->info = NULL;
+ table = bgp_node_get_bgp_table_info(rn);
+ if (table != NULL) {
+ bgp_cleanup_table(bgp, table, safi);
+ bgp_table_finish(&table);
+ bgp_node_set_bgp_table_info(rn, NULL);
bgp_unlock_node(rn);
}
}
safi = SAFI_ENCAP;
for (rn = bgp_table_top(bgp->rib[afi][safi]); rn;
rn = bgp_route_next(rn)) {
- if (rn->info) {
- bgp_cleanup_table(bgp,
- (struct bgp_table *)(rn->info),
- safi);
- bgp_table_finish((struct bgp_table **)&(
- rn->info));
- rn->info = NULL;
+ table = bgp_node_get_bgp_table_info(rn);
+ if (table != NULL) {
+ bgp_cleanup_table(bgp, table, safi);
+ bgp_table_finish(&table);
+ bgp_node_set_bgp_table_info(rn, NULL);
bgp_unlock_node(rn);
}
}
}
for (rn = bgp_table_top(bgp->rib[AFI_L2VPN][SAFI_EVPN]); rn;
rn = bgp_route_next(rn)) {
- if (rn->info) {
- bgp_cleanup_table(bgp,
- (struct bgp_table *)(rn->info),
- SAFI_EVPN);
- bgp_table_finish((struct bgp_table **)&(rn->info));
- rn->info = NULL;
+ table = bgp_node_get_bgp_table_info(rn);
+ if (table != NULL) {
+ bgp_cleanup_table(bgp, table, SAFI_EVPN);
+ bgp_table_finish(&table);
+ bgp_node_set_bgp_table_info(rn, NULL);
bgp_unlock_node(rn);
}
}
attr_new = bgp_attr_intern(&attr);
}
- for (pi = rn->info; pi; pi = pi->next)
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next)
if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
&& pi->sub_type == BGP_ROUTE_STATIC)
break;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, NULL);
/* Check selected route and self inserted route. */
- for (pi = rn->info; pi; pi = pi->next)
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next)
if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
&& pi->sub_type == BGP_ROUTE_STATIC)
break;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
/* Check selected route and self inserted route. */
- for (pi = rn->info; pi; pi = pi->next)
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next)
if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
&& pi->sub_type == BGP_ROUTE_STATIC)
break;
attr_new = bgp_attr_intern(&attr);
}
- for (pi = rn->info; pi; pi = pi->next)
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next)
if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
&& pi->sub_type == BGP_ROUTE_STATIC)
break;
return CMD_WARNING_CONFIG_FAILED;
}
- bgp_static = bgp_static_get_node_info(rn);
+ bgp_static = bgp_node_get_bgp_static_info(rn);
if ((label_index != BGP_INVALID_LABEL_INDEX)
&& (label_index != bgp_static->label_index)) {
/* Clear configuration. */
bgp_static_free(bgp_static);
- bgp_static_set_node_info(rn, NULL);
+ bgp_node_set_bgp_static_info(rn, NULL);
bgp_unlock_node(rn);
bgp_unlock_node(rn);
} else {
/* Set BGP static route configuration. */
rn = bgp_node_get(bgp->route[afi][safi], &p);
- bgp_static = bgp_static_get_node_info(rn);
+ bgp_static = bgp_node_get_bgp_static_info(rn);
if (bgp_static) {
/* Configuration change. */
/* Label index cannot be changed. */
bgp_static->rmap.map =
route_map_lookup_by_name(rmap);
}
- bgp_static_set_node_info(rn, bgp_static);
+ bgp_node_set_bgp_static_info(rn, bgp_static);
}
bgp_static->valid = 1;
FOREACH_AFI_SAFI (afi, safi)
for (rn = bgp_table_top(bgp->route[afi][safi]); rn;
rn = bgp_route_next(rn)) {
- if (rn->info == NULL)
+ if (!bgp_node_has_bgp_path_info_data(rn))
continue;
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)
|| (safi == SAFI_EVPN)) {
- table = rn->info;
+ table = bgp_node_get_bgp_table_info(rn);
for (rm = bgp_table_top(table); rm;
rm = bgp_route_next(rm)) {
bgp_static =
- bgp_static_get_node_info(rm);
+ bgp_node_get_bgp_static_info(
+ rm);
bgp_static_update_safi(bgp, &rm->p,
bgp_static, afi,
safi);
}
} else {
- bgp_static_update(bgp, &rn->p,
- bgp_static_get_node_info(rn),
- afi, safi);
+ bgp_static_update(
+ bgp, &rn->p,
+ bgp_node_get_bgp_static_info(rn), afi,
+ safi);
}
}
}
FOREACH_AFI_SAFI (afi, safi)
for (rn = bgp_table_top(bgp->route[afi][safi]); rn;
rn = bgp_route_next(rn)) {
- if (rn->info == NULL)
+ if (!bgp_node_has_bgp_path_info_data(rn))
continue;
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)
|| (safi == SAFI_EVPN)) {
- table = rn->info;
+ table = bgp_node_get_bgp_table_info(rn);
for (rm = bgp_table_top(table); rm;
rm = bgp_route_next(rm)) {
bgp_static =
- bgp_static_get_node_info(rm);
+ bgp_node_get_bgp_static_info(
+ rm);
bgp_static_withdraw_safi(
bgp, &rm->p, AFI_IP, safi,
(struct prefix_rd *)&rn->p);
bgp_static_free(bgp_static);
- bgp_static_set_node_info(rn, NULL);
+ bgp_node_set_bgp_static_info(rn, NULL);
bgp_unlock_node(rn);
}
} else {
- bgp_static = bgp_static_get_node_info(rn);
+ bgp_static = bgp_node_get_bgp_static_info(rn);
bgp_static_withdraw(bgp, &rn->p, afi, safi);
bgp_static_free(bgp_static);
- bgp_static_set_node_info(rn, NULL);
+ bgp_node_set_bgp_static_info(rn, NULL);
bgp_unlock_node(rn);
}
}
FOREACH_AFI_SAFI (afi, safi) {
for (rn = bgp_table_top(bgp->route[afi][safi]); rn;
rn = bgp_route_next(rn)) {
- if (rn->info == NULL)
+ if (!bgp_node_has_bgp_path_info_data(rn))
continue;
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)
|| (safi == SAFI_EVPN)) {
- table = rn->info;
+ table = bgp_node_get_bgp_table_info(rn);
for (rm = bgp_table_top(table); rm;
rm = bgp_route_next(rm)) {
bgp_static =
- bgp_static_get_node_info(rm);
+ bgp_node_get_bgp_static_info(
+ rm);
bgp_static_update_safi(bgp, &rm->p,
bgp_static, afi,
safi);
}
} else {
- bgp_static = bgp_static_get_node_info(rn);
+ bgp_static = bgp_node_get_bgp_static_info(rn);
bgp_static_update(bgp, &rn->p, bgp_static, afi,
safi);
}
table = bgp->rib[afi][safi];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- for (pi = rn->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) {
if (pi->peer == bgp->peer_self
&& ((pi->type == ZEBRA_ROUTE_BGP
&& pi->sub_type == BGP_ROUTE_STATIC)
}
}
prn = bgp_node_get(bgp->route[afi][safi], (struct prefix *)&prd);
- if (prn->info == NULL)
- prn->info = bgp_table_init(bgp, afi, safi);
+ if (!bgp_node_has_bgp_path_info_data(prn))
+ bgp_node_set_bgp_table_info(prn,
+ bgp_table_init(bgp, afi, safi));
else
bgp_unlock_node(prn);
- table = prn->info;
+ table = bgp_node_get_bgp_table_info(prn);
rn = bgp_node_get(table, &p);
- if (rn->info) {
+ if (bgp_node_has_bgp_path_info_data(rn)) {
vty_out(vty, "%% Same network configuration exists\n");
bgp_unlock_node(rn);
} else {
if (gwip)
prefix_copy(&bgp_static->gatewayIp, &gw_ip);
}
- bgp_static_set_node_info(rn, bgp_static);
+ bgp_node_set_bgp_static_info(rn, bgp_static);
bgp_static->valid = 1;
bgp_static_update_safi(bgp, &p, bgp_static, afi, safi);
}
prn = bgp_node_get(bgp->route[afi][safi], (struct prefix *)&prd);
- if (prn->info == NULL)
- prn->info = bgp_table_init(bgp, afi, safi);
+ if (!bgp_node_has_bgp_path_info_data(prn))
+ bgp_node_set_bgp_table_info(prn,
+ bgp_table_init(bgp, afi, safi));
else
bgp_unlock_node(prn);
- table = prn->info;
+ table = bgp_node_get_bgp_table_info(prn);
rn = bgp_node_lookup(table, &p);
if (rn) {
bgp_static_withdraw_safi(bgp, &p, afi, safi, &prd);
- bgp_static = bgp_static_get_node_info(rn);
+ bgp_static = bgp_node_get_bgp_static_info(rn);
bgp_static_free(bgp_static);
- bgp_static_set_node_info(rn, NULL);
+ bgp_node_set_bgp_static_info(rn, NULL);
bgp_unlock_node(rn);
bgp_unlock_node(rn);
} else
{
struct bgp_node *rn;
struct bgp_table *table;
- struct bgp_path_info *pi, *new;
+ struct bgp_path_info *pi, *orig, *new;
table = bgp->rib[afi][safi];
rn = bgp_node_get(table, p);
- for (pi = rn->info; pi; pi = pi->next)
+ for (orig = pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next)
if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
&& pi->sub_type == BGP_ROUTE_AGGREGATE)
break;
* If the aggregate information has not changed
* no need to re-install it again.
*/
- if (bgp_aggregate_info_same(rn->info, origin, aspath, community,
+ if (bgp_aggregate_info_same(orig, origin, aspath, community,
ecommunity, lcommunity)) {
bgp_unlock_node(rn);
bgp_path_info_add(rn, new);
bgp_process(bgp, rn, afi, safi);
} else {
- for (pi = rn->info; pi; pi = pi->next)
+ for (pi = orig; pi; pi = pi->next)
if (pi->peer == bgp->peer_self
&& pi->type == ZEBRA_ROUTE_BGP
&& pi->sub_type == BGP_ROUTE_AGGREGATE)
match = 0;
- for (pi = rn->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) {
if (BGP_PATH_HOLDDOWN(pi))
continue;
continue;
match = 0;
- for (pi = rn->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) {
if (BGP_PATH_HOLDDOWN(pi))
continue;
/* Aggregate address configuration check. */
for (rn = child; rn; rn = bgp_node_parent_nolock(rn)) {
- aggregate = bgp_aggregate_get_node_info(rn);
+ aggregate = bgp_node_get_bgp_aggregate_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, pi, afi, safi, NULL,
/* Aggregate address configuration check. */
for (rn = child; rn; rn = bgp_node_parent_nolock(rn)) {
- aggregate = bgp_aggregate_get_node_info(rn);
+ aggregate = bgp_node_get_bgp_aggregate_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, NULL, afi, safi, del,
return CMD_WARNING_CONFIG_FAILED;
}
- aggregate = bgp_aggregate_get_node_info(rn);
+ aggregate = bgp_node_get_bgp_aggregate_info(rn);
bgp_aggregate_delete(bgp, &p, afi, safi, aggregate);
bgp_aggregate_install(bgp, afi, safi, &p, 0, NULL, NULL,
NULL, NULL, 0, aggregate);
/* Unlock aggregate address configuration. */
- bgp_aggregate_set_node_info(rn, NULL);
+ bgp_node_set_bgp_aggregate_info(rn, NULL);
bgp_aggregate_free(aggregate);
bgp_unlock_node(rn);
bgp_unlock_node(rn);
/* Old configuration check. */
rn = bgp_node_get(bgp->aggregate[afi][safi], &p);
- if (rn->info) {
+ if (bgp_node_has_bgp_path_info_data(rn)) {
vty_out(vty, "There is already same aggregate network.\n");
/* try to remove the old entry */
ret = bgp_aggregate_unset(vty, prefix_str, afi, safi);
aggregate->summary_only = summary_only;
aggregate->as_set = as_set;
aggregate->safi = safi;
- bgp_aggregate_set_node_info(rn, aggregate);
+ bgp_node_set_bgp_aggregate_info(rn, aggregate);
/* Aggregate address insert into BGP routing table. */
bgp_aggregate_route(bgp, &p, NULL, afi, safi, NULL, aggregate);
new_attr = bgp_attr_intern(&attr_new);
- for (bpi = bn->info; bpi; bpi = bpi->next)
+ for (bpi = bgp_node_get_bgp_path_info(bn); bpi;
+ bpi = bpi->next)
if (bpi->peer == bgp->peer_self
&& bpi->sub_type == BGP_ROUTE_REDISTRIBUTE)
break;
rn = bgp_afi_node_get(bgp->rib[afi][SAFI_UNICAST], afi,
SAFI_UNICAST, p, NULL);
- for (pi = rn->info; pi; pi = pi->next)
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next)
if (pi->peer == bgp->peer_self && pi->type == type)
break;
table = bgp->rib[afi][SAFI_UNICAST];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- for (pi = rn->info; pi; pi = pi->next)
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next)
if (pi->peer == bgp->peer_self && pi->type == type
&& pi->instance == instance)
break;
CHECK_FLAG(path->flags, BGP_PATH_ANNC_NH_SELF) ? true : false;
bool nexthop_othervrf = false;
vrf_id_t nexthop_vrfid = VRF_DEFAULT;
- const char *nexthop_vrfname = "Default";
+ const char *nexthop_vrfname = VRF_DEFAULT_NAME;
if (json_paths)
json_path = json_object_new_object();
if (path->extra->bgp_orig->inst_type
== BGP_INSTANCE_TYPE_DEFAULT)
- vn = "Default";
+ vn = VRF_DEFAULT_NAME;
else
vn = path->extra->bgp_orig->name;
if (use_json && !*json_header_depth) {
vty_out(vty,
"{\n \"vrfId\": %d,\n \"vrfName\": \"%s\",\n \"tableVersion\": %" PRId64
- ",\n \"routerId\": \"%s\",\n \"routes\": { ",
+ ",\n \"routerId\": \"%s\",\n \"defaultLocPrf\": %u,\n"
+ " \"localAS\": %u,\n \"routes\": { ",
bgp->vrf_id == VRF_UNKNOWN ? -1 : (int)bgp->vrf_id,
bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT
? VRF_DEFAULT_NAME
: bgp->name,
- table->version, inet_ntoa(bgp->router_id));
+ table->version, inet_ntoa(bgp->router_id),
+ bgp->default_local_pref, bgp->as);
*json_header_depth = 2;
if (rd) {
vty_out(vty, " \"routeDistinguishers\" : {");
/* Start processing of routes. */
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- if (rn->info == NULL)
+ pi = bgp_node_get_bgp_path_info(rn);
+ if (pi == NULL)
continue;
display = 0;
else
json_paths = NULL;
- for (pi = rn->info; pi; pi = pi->next) {
+ for (; pi; pi = pi->next) {
total_count++;
if (type == bgp_show_type_flap_statistics
|| type == bgp_show_type_flap_neighbor
else
vty_out(vty, "%u", bgp->vrf_id);
vty_out(vty, "\n");
+ vty_out(vty, "Default local pref %u, ",
+ bgp->default_local_pref);
+ vty_out(vty, "local AS %u\n", bgp->as);
vty_out(vty, BGP_SHOW_SCODE_HEADER);
vty_out(vty, BGP_SHOW_NCODE_HEADER);
vty_out(vty, BGP_SHOW_OCODE_HEADER);
unsigned long output_cum = 0;
unsigned long total_cum = 0;
unsigned long json_header_depth = 0;
+ struct bgp_table *itable;
bool show_msg;
show_msg = (!use_json && type == bgp_show_type_normal);
next = bgp_route_next(rn);
if (prd_match && memcmp(rn->p.u.val, prd_match->val, 8) != 0)
continue;
- if (rn->info != NULL) {
+
+ itable = bgp_node_get_bgp_table_info(rn);
+ if (itable != NULL) {
struct prefix_rd prd;
char rd[RD_ADDRSTRLEN];
memcpy(&prd, &(rn->p), sizeof(struct prefix_rd));
prefix_rd2str(&prd, rd, sizeof(rd));
- bgp_show_table(vty, bgp, safi, rn->info, type,
- output_arg, use_json, rd, next == NULL,
- &output_cum, &total_cum,
- &json_header_depth);
+ bgp_show_table(vty, bgp, safi, itable, type, output_arg,
+ use_json, rd, next == NULL, &output_cum,
+ &total_cum, &json_header_depth);
if (next == NULL)
show_msg = false;
}
vty_out(vty, "not allocated\n");
}
- for (pi = rn->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) {
count++;
if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
best = count;
for (rn = bgp_table_top(rib); rn; rn = bgp_route_next(rn)) {
if (prd && memcmp(rn->p.u.val, prd->val, 8) != 0)
continue;
-
- if ((table = rn->info) == NULL)
+ table = bgp_node_get_bgp_table_info(rn);
+ if (!table)
continue;
header = 1;
continue;
}
- for (pi = rm->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rm); pi;
+ pi = pi->next) {
if (header) {
route_vty_out_detail_header(
vty, bgp, rm,
if ((rn = bgp_node_match(rib, &match)) != NULL) {
if (!prefix_check
|| rn->p.prefixlen == match.prefixlen) {
- for (pi = rn->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi;
+ pi = pi->next) {
if (header) {
route_vty_out_detail_header(
vty, bgp, rn, NULL, afi,
if (rn == top)
continue;
- if (!rn->info)
+ if (!bgp_node_has_bgp_path_info_data(rn))
continue;
ts->counts[BGP_STATS_PREFIXES]++;
#endif
/* check if the prefix is included by any other announcements */
- while (prn && !prn->info)
+ while (prn && !bgp_node_has_bgp_path_info_data(prn))
prn = bgp_node_parent_nolock(prn);
if (prn == NULL || prn == top) {
if (space)
ts->total_space +=
pow(2.0, space - rn->p.prefixlen);
- } else if (prn->info)
+ } else if (bgp_node_has_bgp_path_info_data(prn))
ts->counts[BGP_STATS_MAX_AGGREGATEABLE]++;
- for (pi = rn->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) {
pinum++;
ts->counts[BGP_STATS_RIB]++;
if (ain->peer == peer)
pc->count[PCOUNT_ADJ_IN]++;
- for (pi = rn->info; pi; pi = pi->next) {
+ for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) {
+
if (pi->peer != peer)
continue;
table->version);
json_object_string_add(json, "bgpLocalRouterId",
inet_ntoa(bgp->router_id));
+ json_object_int_add(json, "defaultLocPrf",
+ bgp->default_local_pref);
+ json_object_int_add(json, "localAS", bgp->as);
json_object_object_add(json, "bgpStatusCodes",
json_scode);
json_object_object_add(json, "bgpOriginCodes",
else
vty_out(vty, "%u", bgp->vrf_id);
vty_out(vty, "\n");
+ vty_out(vty, "Default local pref %u, ",
+ bgp->default_local_pref);
+ vty_out(vty, "local AS %u\n", bgp->as);
vty_out(vty, BGP_SHOW_SCODE_HEADER);
vty_out(vty, BGP_SHOW_NCODE_HEADER);
vty_out(vty, BGP_SHOW_OCODE_HEADER);
"bgpLocalRouterId",
inet_ntoa(
bgp->router_id));
+ json_object_int_add(json,
+ "defaultLocPrf",
+ bgp->default_local_pref);
+ json_object_int_add(json,
+ "localAS", bgp->as);
json_object_object_add(
json, "bgpStatusCodes",
json_scode);
vty_out(vty, "%u",
bgp->vrf_id);
vty_out(vty, "\n");
+ vty_out(vty,
+ "Default local pref %u, ",
+ bgp->default_local_pref);
+ vty_out(vty, "local AS %u\n",
+ bgp->as);
vty_out(vty,
BGP_SHOW_SCODE_HEADER);
vty_out(vty,
output_count++;
}
} else if (type == bgp_show_adj_route_advertised) {
- for (adj = rn->adj_out; adj; adj = adj->next)
+ RB_FOREACH (adj, bgp_adj_out_rb, &rn->adj_out)
SUBGRP_FOREACH_PEER (adj->subgroup, paf) {
if (paf->peer != peer || !adj->attr)
continue;
"bgpLocalRouterId",
inet_ntoa(
bgp->router_id));
+ json_object_int_add(
+ json, "defaultLocPrf",
+ bgp->default_local_pref
+ );
+ json_object_int_add(
+ json, "localAS",
+ bgp->as);
json_object_object_add(
json,
"bgpStatusCodes",
"%u",
bgp->vrf_id);
vty_out(vty, "\n");
+ vty_out(vty,
+ "Default local pref %u, ",
+ bgp->default_local_pref
+ );
+ vty_out(vty,
+ "local AS %u\n",
+ bgp->as);
vty_out(vty,
BGP_SHOW_SCODE_HEADER);
vty_out(vty,
/* Get BGP distance node. */
rn = bgp_node_get(bgp_distance_table[afi][safi], (struct prefix *)&p);
- bdistance = bgp_distance_get_node(rn);
+ bdistance = bgp_node_get_bgp_distance_info(rn);
if (bdistance)
bgp_unlock_node(rn);
else {
bdistance = bgp_distance_new();
- bgp_distance_set_node_info(rn, bdistance);
+ bgp_node_set_bgp_distance_info(rn, bdistance);
}
/* Set distance value. */
return CMD_WARNING_CONFIG_FAILED;
}
- bdistance = bgp_distance_get_node(rn);
+ bdistance = bgp_node_get_bgp_distance_info(rn);
distance = atoi(distance_str);
if (bdistance->distance != distance) {
XFREE(MTYPE_AS_LIST, bdistance->access_list);
bgp_distance_free(bdistance);
- rn->info = NULL;
+ bgp_node_set_bgp_path_info(rn, NULL);
bgp_unlock_node(rn);
bgp_unlock_node(rn);
sockunion2hostprefix(&peer->su, &q);
rn = bgp_node_match(bgp_distance_table[afi][safi], &q);
if (rn) {
- bdistance = bgp_distance_get_node(rn);
+ bdistance = bgp_node_get_bgp_distance_info(rn);
bgp_unlock_node(rn);
if (bdistance->access_list) {
/* Backdoor check. */
rn = bgp_node_lookup(bgp->route[afi][safi], p);
if (rn) {
- bgp_static = bgp_static_get_node_info(rn);
+ bgp_static = bgp_node_get_bgp_static_info(rn);
bgp_unlock_node(rn);
if (bgp_static->backdoor) {
rn = bgp_route_next(rn)) {
if (prd && memcmp(rn->p.u.val, prd->val, 8) != 0)
continue;
- if ((table = rn->info) == NULL)
+ table = bgp_node_get_bgp_table_info(rn);
+ if (!table)
continue;
if ((rm = bgp_node_match(table, &match)) == NULL)
continue;
if (!prefix_check
|| rm->p.prefixlen == match.prefixlen) {
- pi = rm->info;
+ pi = bgp_node_get_bgp_path_info(rm);
while (pi) {
if (pi->extra && pi->extra->damp_info) {
pi_temp = pi->next;
!= NULL) {
if (!prefix_check
|| rn->p.prefixlen == match.prefixlen) {
- pi = rn->info;
+ pi = bgp_node_get_bgp_path_info(rn);
while (pi) {
if (pi->extra && pi->extra->damp_info) {
pi_temp = pi->next;
/* Network configuration. */
for (prn = bgp_table_top(bgp->route[afi][safi]); prn;
prn = bgp_route_next(prn)) {
- if ((table = prn->info) == NULL)
+ table = bgp_node_get_bgp_table_info(prn);
+ if (!table)
continue;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- bgp_static = bgp_static_get_node_info(rn);
+ bgp_static = bgp_node_get_bgp_static_info(rn);
if (bgp_static == NULL)
continue;
/* Network configuration. */
for (prn = bgp_table_top(bgp->route[afi][safi]); prn;
prn = bgp_route_next(prn)) {
- if ((table = prn->info) == NULL)
+ table = bgp_node_get_bgp_table_info(prn);
+ if (!table)
continue;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- bgp_static = bgp_static_get_node_info(rn);
+ bgp_static = bgp_node_get_bgp_static_info(rn);
if (bgp_static == NULL)
continue;
/* Network configuration. */
for (rn = bgp_table_top(bgp->route[afi][safi]); rn;
rn = bgp_route_next(rn)) {
- bgp_static = bgp_static_get_node_info(rn);
+ bgp_static = bgp_node_get_bgp_static_info(rn);
if (bgp_static == NULL)
continue;
/* Aggregate-address configuration. */
for (rn = bgp_table_top(bgp->aggregate[afi][safi]); rn;
rn = bgp_route_next(rn)) {
- bgp_aggregate = bgp_aggregate_get_node_info(rn);
+ bgp_aggregate = bgp_node_get_bgp_aggregate_info(rn);
if (bgp_aggregate == NULL)
continue;
for (rn = bgp_table_top(bgp_distance_table[afi][safi]); rn;
rn = bgp_route_next(rn)) {
- bdistance = bgp_distance_get_node(rn);
+ bdistance = bgp_node_get_bgp_distance_info(rn);
if (bdistance != NULL) {
char buf[PREFIX_STRLEN];