summaryrefslogtreecommitdiffstats
path: root/bgpd/rfapi
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-03-27 00:11:58 +0100
committerDavid Lamparter <equinox@diac24.net>2020-06-23 17:32:52 +0200
commit9bcb3eef541180a17341d1d4510586efc35711db (patch)
tree686e6d7721a180a168cb3353e2c900b63069e6c3 /bgpd/rfapi
parentMerge pull request #6625 from ton31337/fix/network_check_import_for_static_bgp (diff)
downloadfrr-9bcb3eef541180a17341d1d4510586efc35711db.tar.xz
frr-9bcb3eef541180a17341d1d4510586efc35711db.zip
bgp: rename bgp_node to bgp_dest
This is the bulk part extracted from "bgpd: Convert from `struct bgp_node` to `struct bgp_dest`". It should not result in any functional change. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd/rfapi')
-rw-r--r--bgpd/rfapi/rfapi.c108
-rw-r--r--bgpd/rfapi/rfapi_import.c24
-rw-r--r--bgpd/rfapi/rfapi_vty.c8
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c102
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c107
-rw-r--r--bgpd/rfapi/vnc_zebra.c21
6 files changed, 191 insertions, 179 deletions
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index d6b6a78f6..c93549628 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -360,7 +360,7 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
struct rfapi_nexthop *lnh, int kill)
{
afi_t afi; /* of the VN address */
- struct bgp_node *bn;
+ struct bgp_dest *bn;
struct bgp_path_info *bpi;
char buf[PREFIX_STRLEN];
char buf2[RD_ADDRSTRLEN];
@@ -382,9 +382,9 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
vnc_zlog_debug_verbose(
"%s: peer=%p, prefix=%s, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p",
__func__, peer, buf, prefix_rd2str(prd, buf2, sizeof(buf2)),
- afi, safi, bn, (bn ? bgp_node_get_bgp_path_info(bn) : NULL));
+ afi, safi, bn, (bn ? bgp_dest_get_bgp_path_info(bn) : NULL));
- for (bpi = (bn ? bgp_node_get_bgp_path_info(bn) : NULL); bpi;
+ for (bpi = (bn ? bgp_dest_get_bgp_path_info(bn) : NULL); bpi;
bpi = bpi->next) {
vnc_zlog_debug_verbose(
@@ -465,16 +465,16 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
__func__, safi, buf);
if (safi == SAFI_MPLS_VPN) {
- struct bgp_node *prn = NULL;
+ struct bgp_dest *pdest = NULL;
struct bgp_table *table = NULL;
- prn = bgp_node_get(bgp->rib[afi][safi],
- (struct prefix *)prd);
- table = bgp_node_get_bgp_table_info(prn);
+ pdest = bgp_node_get(bgp->rib[afi][safi],
+ (struct prefix *)prd);
+ table = bgp_dest_get_bgp_table_info(pdest);
if (table)
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
bgp, prd, table, p, bpi);
- bgp_unlock_node(prn);
+ bgp_dest_unlock_node(pdest);
}
/*
@@ -492,7 +492,7 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
__func__, safi, buf);
}
done:
- bgp_unlock_node(bn);
+ bgp_dest_unlock_node(bn);
}
struct rfapi_nexthop *rfapi_nexthop_new(struct rfapi_nexthop *copyme)
@@ -573,7 +573,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
afi_t afi; /* of the VN address */
struct bgp_path_info *new;
struct bgp_path_info *bpi;
- struct bgp_node *bn;
+ struct bgp_dest *bn;
struct attr attr = {0};
struct attr *new_attr;
@@ -942,7 +942,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
* ecommunity: POINTS TO interned/refcounted dynamic 2-part AS attr
* aspath: POINTS TO interned/refcounted hashed block
*/
- for (bpi = bgp_node_get_bgp_path_info(bn); bpi; bpi = bpi->next) {
+ for (bpi = bgp_dest_get_bgp_path_info(bn); bpi; bpi = bpi->next) {
/* probably only need to check
* bpi->extra->vnc.export.rfapi_handle */
if (bpi->peer == rfd->peer && bpi->type == type
@@ -997,7 +997,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
if (attrhash_cmp(bpi->attr, new_attr)
&& !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
bgp_attr_unintern(&new_attr);
- bgp_unlock_node(bn);
+ bgp_dest_unlock_node(bn);
vnc_zlog_debug_any(
"%s: Found route (safi=%d) at prefix %s, no change",
@@ -1009,16 +1009,16 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
bgp_path_info_set_flag(bn, bpi, BGP_PATH_ATTR_CHANGED);
if (safi == SAFI_MPLS_VPN) {
- struct bgp_node *prn = NULL;
+ struct bgp_dest *pdest = NULL;
struct bgp_table *table = NULL;
- prn = bgp_node_get(bgp->rib[afi][safi],
- (struct prefix *)prd);
- table = bgp_node_get_bgp_table_info(prn);
+ pdest = bgp_node_get(bgp->rib[afi][safi],
+ (struct prefix *)prd);
+ table = bgp_dest_get_bgp_table_info(pdest);
if (table)
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
bgp, prd, table, p, bpi);
- bgp_unlock_node(prn);
+ bgp_dest_unlock_node(pdest);
}
/* Rewrite BGP route information. */
@@ -1032,22 +1032,22 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
if (safi == SAFI_MPLS_VPN) {
- struct bgp_node *prn = NULL;
+ struct bgp_dest *pdest = NULL;
struct bgp_table *table = NULL;
- prn = bgp_node_get(bgp->rib[afi][safi],
- (struct prefix *)prd);
- table = bgp_node_get_bgp_table_info(prn);
+ pdest = bgp_node_get(bgp->rib[afi][safi],
+ (struct prefix *)prd);
+ table = bgp_dest_get_bgp_table_info(pdest);
if (table)
vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
bgp, prd, table, p, bpi);
- bgp_unlock_node(prn);
+ bgp_dest_unlock_node(pdest);
}
/* Process change. */
bgp_aggregate_increment(bgp, p, bpi, afi, safi);
bgp_process(bgp, bn, afi, safi);
- bgp_unlock_node(bn);
+ bgp_dest_unlock_node(bn);
vnc_zlog_debug_any(
"%s: Found route (safi=%d) at prefix %s, changed attr",
@@ -1076,19 +1076,19 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
bgp_path_info_add(bn, new);
if (safi == SAFI_MPLS_VPN) {
- struct bgp_node *prn = NULL;
+ struct bgp_dest *pdest = NULL;
struct bgp_table *table = NULL;
- prn = bgp_node_get(bgp->rib[afi][safi], (struct prefix *)prd);
- table = bgp_node_get_bgp_table_info(prn);
+ pdest = bgp_node_get(bgp->rib[afi][safi], (struct prefix *)prd);
+ table = bgp_dest_get_bgp_table_info(pdest);
if (table)
vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
bgp, prd, table, p, new);
- bgp_unlock_node(prn);
+ bgp_dest_unlock_node(pdest);
encode_label(label_val, &bn->local_label);
}
- bgp_unlock_node(bn);
+ bgp_dest_unlock_node(bn);
bgp_process(bgp, bn, afi, safi);
vnc_zlog_debug_any(
@@ -3665,51 +3665,55 @@ void rfapi_init(void)
#ifdef DEBUG_RFAPI
static void rfapi_print_exported(struct bgp *bgp)
{
- struct bgp_node *rdn;
- struct bgp_node *rn;
+ struct bgp_dest *destn;
+ struct bgp_dest *dest;
struct bgp_path_info *bpi;
if (!bgp)
return;
- for (rdn = bgp_table_top(bgp->rib[AFI_IP][SAFI_MPLS_VPN]); rdn;
- rdn = bgp_route_next(rdn)) {
+ for (destn = bgp_table_top(bgp->rib[AFI_IP][SAFI_MPLS_VPN]); destn;
+ destn = bgp_route_next(destn)) {
struct bgp_table *table;
- table = bgp_node_get_bgp_table_info(rdn);
+ table = bgp_dest_get_bgp_table_info(destn);
if (!table)
continue;
- fprintf(stderr, "%s: vpn rdn=%p\n", __func__, rdn);
- for (rn = bgp_table_top(table); rn;
- rn = bgp_route_next(rn)) {
- bpi = bgp_node_get_bgp_path_info(rn);
+ fprintf(stderr, "%s: vpn destn=%p\n", __func__, destn);
+ for (dest = bgp_table_top(table); dest;
+ dest = bgp_route_next(dest)) {
+ bpi = bgp_dest_get_bgp_path_info(dest);
if (!bpi)
continue;
- fprintf(stderr, "%s: rn=%p\n", __func__, rn);
+ fprintf(stderr, "%s: dest=%p\n", __func__, dest);
for (; bpi; bpi = bpi->next) {
rfapiPrintBi((void *)2, bpi); /* 2 => stderr */
}
}
}
- for (rdn = bgp_table_top(bgp->rib[AFI_IP][SAFI_ENCAP]); rdn;
- rdn = bgp_route_next(rdn)) {
+ for (destn = bgp_table_top(bgp->rib[AFI_IP][SAFI_ENCAP]); destn;
+ destn = bgp_route_next(destn)) {
struct bgp_table *table;
- table = bgp_node_get_bgp_table_info(rdn);
+ table = bgp_dest_get_bgp_table_info(destn);
if (!table)
continue;
- fprintf(stderr, "%s: encap rdn=%p\n", __func__, rdn);
- for (rn = bgp_table_top(table)); rn;
- rn = bgp_route_next(rn)) {
- bpi = bgp_node_get_bgp_path_info(rn);
- if (!bpi)
- continue;
- fprintf(stderr, "%s: rn=%p\n", __func__, rn);
- for (; bpi; bpi = bpi->next) {
- rfapiPrintBi((void *)2, bpi); /* 2 => stderr */
- }
- }
+ fprintf(stderr, "%s: encap destn=%p\n", __func__, destn);
+ for (dest = bgp_table_top(table))
+ ;
+ dest;
+ dest = bgp_route_next(dest))
+ {
+ bpi = bgp_dest_get_bgp_path_info(dest);
+ if (!bpi)
+ continue;
+ fprintf(stderr, "%s: dest=%p\n", __func__, dest);
+ for (; bpi; bpi = bpi->next) {
+ rfapiPrintBi((void *)2,
+ bpi); /* 2 => stderr */
+ }
+ }
}
}
#endif /* defined(DEBUG_RFAPI) */
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 41e6a64a6..c3ad95ff2 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -4177,8 +4177,8 @@ static void rfapiBgpTableFilteredImport(struct bgp *bgp,
struct rfapi_import_table *it,
afi_t afi, safi_t safi)
{
- struct bgp_node *rn1;
- struct bgp_node *rn2;
+ struct bgp_dest *dest1;
+ struct bgp_dest *dest2;
/* Only these SAFIs have 2-level RIBS */
assert(safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP);
@@ -4188,17 +4188,18 @@ static void rfapiBgpTableFilteredImport(struct bgp *bgp,
* route tables attached to them, and import the routes
* if they have matching route targets
*/
- for (rn1 = bgp_table_top(bgp->rib[afi][safi]); rn1;
- rn1 = bgp_route_next(rn1)) {
+ for (dest1 = bgp_table_top(bgp->rib[afi][safi]); dest1;
+ dest1 = bgp_route_next(dest1)) {
- if (bgp_node_has_bgp_path_info_data(rn1)) {
+ if (bgp_dest_has_bgp_path_info_data(dest1)) {
- for (rn2 = bgp_table_top(bgp_node_get_bgp_table_info(rn1)); rn2;
- rn2 = bgp_route_next(rn2)) {
+ for (dest2 = bgp_table_top(
+ bgp_dest_get_bgp_table_info(dest1));
+ dest2; dest2 = bgp_route_next(dest2)) {
struct bgp_path_info *bpi;
- for (bpi = bgp_node_get_bgp_path_info(rn2);
+ for (bpi = bgp_dest_get_bgp_path_info(dest2);
bpi; bpi = bpi->next) {
uint32_t label = 0;
@@ -4213,11 +4214,12 @@ static void rfapiBgpTableFilteredImport(struct bgp *bgp,
safi))(
it, /* which import table */
FIF_ACTION_UPDATE, bpi->peer,
- NULL, bgp_node_get_prefix(rn2),
+ NULL,
+ bgp_dest_get_prefix(dest2),
NULL, afi,
(struct prefix_rd *)
- bgp_node_get_prefix(
- rn1),
+ bgp_dest_get_prefix(
+ dest1),
bpi->attr, bpi->type,
bpi->sub_type, &label);
}
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index 67f6a6a0f..d74404ea5 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -1535,7 +1535,7 @@ void rfapiPrintAdvertisedInfo(struct vty *vty, struct rfapi_descriptor *rfd,
safi_t safi, struct prefix *p)
{
afi_t afi; /* of the VN address */
- struct bgp_node *bn;
+ struct bgp_dest *bd;
struct bgp_path_info *bpi;
uint8_t type = ZEBRA_ROUTE_BGP;
struct bgp *bgp;
@@ -1562,11 +1562,11 @@ void rfapiPrintAdvertisedInfo(struct vty *vty, struct rfapi_descriptor *rfd,
} else {
prd = &rfd->rd;
}
- bn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
+ bd = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
- vty_out(vty, " bn=%p%s", bn, HVTYNL);
+ vty_out(vty, " bd=%p%s", bd, HVTYNL);
- for (bpi = bgp_node_get_bgp_path_info(bn); bpi; bpi = bpi->next) {
+ for (bpi = bgp_dest_get_bgp_path_info(bd); 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) {
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index bd3395b49..0480704b2 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -179,7 +179,7 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
struct peer *peer = bpi->peer;
const struct prefix *prefix = agg_node_get_prefix(rn);
afi_t afi = family2afi(prefix->family);
- struct bgp_node *urn;
+ struct bgp_dest *udest;
struct bgp_path_info *ubpi;
struct attr hattr;
struct attr *iattr;
@@ -254,9 +254,10 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
* Is this route already represented in the unicast RIB?
* (look up prefix; compare route type, sub_type, peer, nexthop)
*/
- urn = bgp_afi_node_get(bgp->rib[afi][SAFI_UNICAST], afi, SAFI_UNICAST,
- prefix, NULL);
- for (ubpi = bgp_node_get_bgp_path_info(urn); ubpi; ubpi = ubpi->next) {
+ udest = bgp_afi_node_get(bgp->rib[afi][SAFI_UNICAST], afi, SAFI_UNICAST,
+ prefix, NULL);
+ for (ubpi = bgp_dest_get_bgp_path_info(udest); ubpi;
+ ubpi = ubpi->next) {
struct prefix unicast_nexthop;
if (CHECK_FLAG(ubpi->flags, BGP_PATH_REMOVED))
@@ -456,7 +457,7 @@ static void vnc_direct_bgp_vpn_enable_ce(struct bgp *bgp, afi_t afi)
static void vnc_direct_bgp_vpn_disable_ce(struct bgp *bgp, afi_t afi)
{
- struct bgp_node *rn;
+ struct bgp_dest *dest;
vnc_zlog_debug_verbose("%s: entry, afi=%d", __func__, afi);
@@ -472,14 +473,14 @@ static void vnc_direct_bgp_vpn_disable_ce(struct bgp *bgp, afi_t afi)
* Go through the entire BGP unicast table and remove routes that
* originated from us
*/
- for (rn = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); rn;
- rn = bgp_route_next(rn)) {
+ for (dest = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); dest;
+ dest = bgp_route_next(dest)) {
struct bgp_path_info *ri;
struct bgp_path_info *next;
- for (ri = bgp_node_get_bgp_path_info(rn), next = NULL;
- ri; ri = next) {
+ for (ri = bgp_dest_get_bgp_path_info(dest), next = NULL; ri;
+ ri = next) {
next = ri->next;
@@ -487,7 +488,7 @@ static void vnc_direct_bgp_vpn_disable_ce(struct bgp *bgp, afi_t afi)
&& ri->sub_type == BGP_ROUTE_REDISTRIBUTE) {
bgp_withdraw(
- ri->peer, bgp_node_get_prefix(rn),
+ ri->peer, bgp_dest_get_prefix(dest),
0, /* addpath_id */
NULL, /* ignored */
AFI_IP, SAFI_UNICAST,
@@ -1805,7 +1806,7 @@ void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi,
void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
{
struct prefix_rd prd;
- struct bgp_node *prn;
+ struct bgp_dest *pdest;
struct rfapi_cfg *hc;
vnc_zlog_debug_verbose("%s: entry, afi=%d", __func__, afi);
@@ -1835,45 +1836,46 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
vnc_zlog_debug_verbose("%s: starting RD loop", __func__);
/* Loop over all the RDs */
- for (prn = bgp_table_top(bgp->rib[afi][SAFI_MPLS_VPN]); prn;
- prn = bgp_route_next(prn)) {
+ for (pdest = bgp_table_top(bgp->rib[afi][SAFI_MPLS_VPN]); pdest;
+ pdest = bgp_route_next(pdest)) {
struct bgp_table *table;
- struct bgp_node *rn;
+ struct bgp_dest *dest;
struct bgp_path_info *ri;
- const struct prefix *prn_p = bgp_node_get_prefix(prn);
+ const struct prefix *pdest_p = bgp_dest_get_prefix(pdest);
memset(&prd, 0, sizeof(prd));
prd.family = AF_UNSPEC;
prd.prefixlen = 64;
- memcpy(prd.val, prn_p->u.val, 8);
+ memcpy(prd.val, pdest_p->u.val, 8);
/* This is the per-RD table of prefixes */
- table = bgp_node_get_bgp_table_info(prn);
+ table = bgp_dest_get_bgp_table_info(pdest);
if (!table)
continue;
- for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- const struct prefix *rn_p;
+ for (dest = bgp_table_top(table); dest;
+ dest = bgp_route_next(dest)) {
+ const struct prefix *dest_p;
/*
* skip prefix list check if no routes here
*/
- if (!bgp_node_has_bgp_path_info_data(rn))
+ if (!bgp_dest_has_bgp_path_info_data(dest))
continue;
vnc_zlog_debug_verbose("%s: checking prefix %pRN",
- __func__, rn);
+ __func__, dest);
- rn_p = bgp_node_get_prefix(rn);
+ dest_p = bgp_dest_get_prefix(dest);
/*
* prefix list check
*/
if (hc->plist_export_bgp[afi]) {
if (prefix_list_apply(hc->plist_export_bgp[afi],
- rn_p)
+ dest_p)
== PREFIX_DENY) {
vnc_zlog_debug_verbose(
@@ -1883,8 +1885,8 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
}
}
- for (ri = bgp_node_get_bgp_path_info(rn);
- ri; ri = ri->next) {
+ for (ri = bgp_dest_get_bgp_path_info(dest); ri;
+ ri = ri->next) {
vnc_zlog_debug_verbose("%s: ri->sub_type: %d",
__func__, ri->sub_type);
@@ -1918,7 +1920,8 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
info.attr = &hattr;
ret = route_map_apply(
hc->routemap_export_bgp,
- rn_p, RMAP_BGP, &info);
+ dest_p, RMAP_BGP,
+ &info);
if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&hattr);
vnc_zlog_debug_verbose(
@@ -1937,7 +1940,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
* this route
*/
eti = vnc_eti_get(
- bgp, EXPORT_TYPE_BGP, rn_p,
+ bgp, EXPORT_TYPE_BGP, dest_p,
ri->peer,
ZEBRA_ROUTE_VNC_DIRECT_RH,
BGP_ROUTE_REDISTRIBUTE);
@@ -1958,19 +1961,19 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
"%s: calling bgp_update",
__func__);
- bgp_update(ri->peer, rn_p, /* prefix */
- 0, /* addpath_id */
- iattr, /* bgp_update copies
- it */
- AFI_IP, SAFI_UNICAST,
- ZEBRA_ROUTE_VNC_DIRECT_RH,
- BGP_ROUTE_REDISTRIBUTE, NULL,
- /* RD not used for unicast */
- NULL,
- /* tag not used for unicast,
- or EVPN */
- 0, 0,
- NULL); /* EVPN not used */
+ bgp_update(
+ ri->peer, dest_p, /* prefix */
+ 0, /* addpath_id */
+ iattr, /* bgp_update copies
+ it */
+ AFI_IP, SAFI_UNICAST,
+ ZEBRA_ROUTE_VNC_DIRECT_RH,
+ BGP_ROUTE_REDISTRIBUTE, NULL,
+ /* RD not used for unicast */
+ NULL,
+ /* tag not used for unicast,
+ or EVPN */
+ 0, 0, NULL); /* EVPN not used */
bgp_attr_unintern(&iattr);
}
@@ -1981,7 +1984,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
void vnc_direct_bgp_rh_vpn_disable(struct bgp *bgp, afi_t afi)
{
- struct bgp_node *rn;
+ struct bgp_dest *dest;
vnc_zlog_debug_verbose("%s: entry, afi=%d", __func__, afi);
@@ -1997,13 +2000,14 @@ void vnc_direct_bgp_rh_vpn_disable(struct bgp *bgp, afi_t afi)
* Go through the entire BGP unicast table and remove routes that
* originated from us
*/
- for (rn = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); rn;
- rn = bgp_route_next(rn)) {
- const struct prefix *rn_p = bgp_node_get_prefix(rn);
+ for (dest = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); dest;
+ dest = bgp_route_next(dest)) {
+ const struct prefix *dest_p = bgp_dest_get_prefix(dest);
struct bgp_path_info *ri;
struct bgp_path_info *next;
- for (ri = bgp_node_get_bgp_path_info(rn), next = NULL; ri; ri = next) {
+ for (ri = bgp_dest_get_bgp_path_info(dest), next = NULL; ri;
+ ri = next) {
next = ri->next;
@@ -2016,7 +2020,7 @@ void vnc_direct_bgp_rh_vpn_disable(struct bgp *bgp, afi_t afi)
* Delete routes immediately (no timer)
*/
eti = vnc_eti_checktimer(
- bgp, EXPORT_TYPE_BGP, rn_p, ri->peer,
+ bgp, EXPORT_TYPE_BGP, dest_p, ri->peer,
ZEBRA_ROUTE_VNC_DIRECT_RH,
BGP_ROUTE_REDISTRIBUTE);
if (eti) {
@@ -2025,9 +2029,9 @@ void vnc_direct_bgp_rh_vpn_disable(struct bgp *bgp, afi_t afi)
vnc_eti_delete(eti);
}
- bgp_withdraw(ri->peer, rn_p, /* prefix */
- 0, /* addpath_id */
- NULL, /* ignored */
+ bgp_withdraw(ri->peer, dest_p, /* prefix */
+ 0, /* addpath_id */
+ NULL, /* ignored */
AFI_IP, SAFI_UNICAST,
ZEBRA_ROUTE_VNC_DIRECT_RH,
BGP_ROUTE_REDISTRIBUTE,
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 0a8e1618f..85d64b5a7 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -523,7 +523,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
uint32_t *med, /* NULL = no med */
struct prefix *ubpi_nexthop) /* unicast nexthop */
{
- struct bgp_node *bn;
+ struct bgp_dest *bd;
struct bgp_path_info *bpi;
if (!table_rd)
@@ -538,8 +538,8 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
}
/* exact match */
- bn = bgp_node_lookup(table_rd, ubpi_nexthop);
- if (!bn) {
+ bd = bgp_node_lookup(table_rd, ubpi_nexthop);
+ if (!bd) {
vnc_zlog_debug_verbose(
"%s: no match in RD's table for ubpi_nexthop",
__func__);
@@ -547,14 +547,14 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
}
/* Iterate over bgp_info items at this node */
- for (bpi = bgp_node_get_bgp_path_info(bn); bpi; bpi = bpi->next) {
+ for (bpi = bgp_dest_get_bgp_path_info(bd); bpi; bpi = bpi->next) {
vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
bgp, afi, bpi, /* VPN bpi */
prd, prefix, local_pref, med, ecom);
}
- bgp_unlock_node(bn);
+ bgp_dest_unlock_node(bd);
}
static void vnc_import_bgp_add_route_mode_resolve_nve(
@@ -570,7 +570,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
uint32_t *med = NULL;
struct prefix_bag *pb;
- struct bgp_node *bnp; /* prd table node */
+ struct bgp_dest *bdp; /* prd table node */
/*debugging */
if (VNC_DEBUG(VERBOSE)) {
@@ -668,18 +668,18 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
* (exact match, /32). If an exact match is found, call add_vnc_route.
*/
- for (bnp = bgp_table_top(bgp->rib[afi][SAFI_MPLS_VPN]); bnp;
- bnp = bgp_route_next(bnp)) {
+ for (bdp = bgp_table_top(bgp->rib[afi][SAFI_MPLS_VPN]); bdp;
+ bdp = bgp_route_next(bdp)) {
struct bgp_table *table;
- table = bgp_node_get_bgp_table_info(bnp);
+ table = bgp_dest_get_bgp_table_info(bdp);
if (!table)
continue;
vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
- (struct prefix_rd *)bgp_node_get_prefix(bnp), table,
+ (struct prefix_rd *)bgp_dest_get_prefix(bdp), table,
afi, bgp, prefix, ecom, &local_pref, med,
&pfx_unicast_nexthop);
}
@@ -1282,7 +1282,7 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
const struct prefix *prefix, /* unicast prefix */
const struct prefix *ubpi_nexthop) /* unicast bpi's nexthop */
{
- struct bgp_node *bn;
+ struct bgp_dest *bd;
struct bgp_path_info *bpi;
if (!table_rd)
@@ -1297,8 +1297,8 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
/* exact match */
- bn = bgp_node_lookup(table_rd, ubpi_nexthop);
- if (!bn) {
+ bd = bgp_node_lookup(table_rd, ubpi_nexthop);
+ if (!bd) {
vnc_zlog_debug_verbose(
"%s: no match in RD's table for ubpi_nexthop",
__func__);
@@ -1306,7 +1306,7 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
}
/* Iterate over bgp_info items at this node */
- for (bpi = bgp_node_get_bgp_path_info(bn); bpi; bpi = bpi->next) {
+ for (bpi = bgp_dest_get_bgp_path_info(bd); bpi; bpi = bpi->next) {
vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
bgp, afi, bpi, /* VPN bpi */
@@ -1314,7 +1314,7 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
prefix); /* unicast route prefix */
}
- bgp_unlock_node(bn);
+ bgp_dest_unlock_node(bd);
}
static void
@@ -1331,7 +1331,7 @@ vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp, afi_t afi,
void *cursor;
struct skiplist *sl = bgp->rfapi->resolve_nve_nexthop;
int rc;
- struct bgp_node *bnp; /* prd table node */
+ struct bgp_dest *bdp; /* prd table node */
if (!sl) {
vnc_zlog_debug_verbose("%s: no RHN entries, skipping",
@@ -1372,18 +1372,18 @@ vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp, afi_t afi,
* (exact match, /32). If an exact match is found, call add_vnc_route.
*/
- for (bnp = bgp_table_top(bgp->rib[afi][SAFI_MPLS_VPN]); bnp;
- bnp = bgp_route_next(bnp)) {
+ for (bdp = bgp_table_top(bgp->rib[afi][SAFI_MPLS_VPN]); bdp;
+ bdp = bgp_route_next(bdp)) {
struct bgp_table *table;
- table = bgp_node_get_bgp_table_info(bnp);
+ table = bgp_dest_get_bgp_table_info(bdp);
if (!table)
continue;
vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
- (struct prefix_rd *)bgp_node_get_prefix(bnp), table,
+ (struct prefix_rd *)bgp_dest_get_prefix(bdp), table,
afi, bgp, prefix, &pfx_unicast_nexthop);
}
@@ -2737,7 +2737,7 @@ void vnc_import_bgp_redist_enable(struct bgp *bgp, afi_t afi)
/* iterate over bgp unicast v4 and v6 routes, call
* vnc_import_bgp_add_route */
- struct bgp_node *rn;
+ struct bgp_dest *dest;
vnc_zlog_debug_verbose("%s: entry, afi=%d", __func__, afi);
@@ -2749,18 +2749,18 @@ void vnc_import_bgp_redist_enable(struct bgp *bgp, afi_t afi)
}
bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT] = 1;
- for (rn = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); rn;
- rn = bgp_route_next(rn)) {
+ for (dest = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); dest;
+ dest = bgp_route_next(dest)) {
struct bgp_path_info *bpi;
- for (bpi = bgp_node_get_bgp_path_info(rn); bpi;
+ for (bpi = bgp_dest_get_bgp_path_info(dest); bpi;
bpi = bpi->next) {
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
- vnc_import_bgp_add_route(bgp, bgp_node_get_prefix(rn),
+ vnc_import_bgp_add_route(bgp, bgp_dest_get_prefix(dest),
bpi);
}
}
@@ -2772,7 +2772,7 @@ void vnc_import_bgp_redist_enable(struct bgp *bgp, afi_t afi)
void vnc_import_bgp_exterior_redist_enable(struct bgp *bgp, afi_t afi)
{
struct bgp *bgp_exterior;
- struct bgp_node *rn;
+ struct bgp_dest *dest;
bgp_exterior = bgp->rfapi_cfg->redist_bgp_exterior_view;
@@ -2791,19 +2791,19 @@ void vnc_import_bgp_exterior_redist_enable(struct bgp *bgp, afi_t afi)
return;
}
- for (rn = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]); rn;
- rn = bgp_route_next(rn)) {
+ for (dest = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]); dest;
+ dest = bgp_route_next(dest)) {
struct bgp_path_info *bpi;
- for (bpi = bgp_node_get_bgp_path_info(rn); bpi;
+ for (bpi = bgp_dest_get_bgp_path_info(dest); bpi;
bpi = bpi->next) {
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
vnc_import_bgp_exterior_add_route(
- bgp_exterior, bgp_node_get_prefix(rn), bpi);
+ bgp_exterior, bgp_dest_get_prefix(dest), bpi);
}
}
vnc_zlog_debug_verbose(
@@ -2818,7 +2818,7 @@ void vnc_import_bgp_exterior_redist_enable_it(
struct bgp *bgp, afi_t afi, struct rfapi_import_table *it_only)
{
struct bgp *bgp_exterior;
- struct bgp_node *rn;
+ struct bgp_dest *dest;
vnc_zlog_debug_verbose("%s: entry", __func__);
@@ -2837,19 +2837,19 @@ void vnc_import_bgp_exterior_redist_enable_it(
return;
}
- for (rn = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]); rn;
- rn = bgp_route_next(rn)) {
+ for (dest = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]); dest;
+ dest = bgp_route_next(dest)) {
struct bgp_path_info *bpi;
- for (bpi = bgp_node_get_bgp_path_info(rn); bpi;
+ for (bpi = bgp_dest_get_bgp_path_info(dest); bpi;
bpi = bpi->next) {
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
vnc_import_bgp_exterior_add_route_it(
- bgp_exterior, bgp_node_get_prefix(rn), bpi,
+ bgp_exterior, bgp_dest_get_prefix(dest), bpi,
it_only);
}
}
@@ -2862,8 +2862,8 @@ void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi)
* iterate over vpn routes, find routes of type ZEBRA_ROUTE_BGP_DIRECT,
* delete (call timer expire immediately)
*/
- struct bgp_node *rn1;
- struct bgp_node *rn2;
+ struct bgp_dest *dest1;
+ struct bgp_dest *dest2;
vnc_zlog_debug_verbose("%s: entry", __func__);
@@ -2878,21 +2878,22 @@ void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi)
* Two-level table for SAFI_MPLS_VPN
* Be careful when changing the things we iterate over
*/
- for (rn1 = bgp_table_top(bgp->rib[afi][SAFI_MPLS_VPN]); rn1;
- rn1 = bgp_route_next(rn1)) {
- const struct prefix *rn1_p;
+ for (dest1 = bgp_table_top(bgp->rib[afi][SAFI_MPLS_VPN]); dest1;
+ dest1 = bgp_route_next(dest1)) {
+ const struct prefix *dest1_p;
- if (!bgp_node_has_bgp_path_info_data(rn1))
+ if (!bgp_dest_has_bgp_path_info_data(dest1))
continue;
- rn1_p = bgp_node_get_prefix(rn1);
- for (rn2 = bgp_table_top(bgp_node_get_bgp_table_info(rn1)); rn2;
- rn2 = bgp_route_next(rn2)) {
- const struct prefix *rn2_p = bgp_node_get_prefix(rn2);
+ dest1_p = bgp_dest_get_prefix(dest1);
+ for (dest2 = bgp_table_top(bgp_dest_get_bgp_table_info(dest1));
+ dest2; dest2 = bgp_route_next(dest2)) {
+ const struct prefix *dest2_p =
+ bgp_dest_get_prefix(dest2);
struct bgp_path_info *bpi;
struct bgp_path_info *nextbpi;
- for (bpi = bgp_node_get_bgp_path_info(rn2); bpi;
+ for (bpi = bgp_dest_get_bgp_path_info(dest2); bpi;
bpi = nextbpi) {
nextbpi = bpi->next;
@@ -2917,8 +2918,8 @@ void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi)
rfd);
del_vnc_route(rfd, bpi->peer, bgp,
- SAFI_MPLS_VPN, rn2_p,
- (struct prefix_rd *)rn1_p,
+ SAFI_MPLS_VPN, dest2_p,
+ (struct prefix_rd *)dest1_p,
bpi->type, bpi->sub_type, NULL,
1); /* kill */
@@ -2966,20 +2967,20 @@ void vnc_import_bgp_exterior_redist_disable(struct bgp *bgp, afi_t afi)
{
- struct bgp_node *rn;
- for (rn = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]);
- rn; rn = bgp_route_next(rn)) {
+ struct bgp_dest *dest;
+ for (dest = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]);
+ dest; dest = bgp_route_next(dest)) {
struct bgp_path_info *bpi;
- for (bpi = bgp_node_get_bgp_path_info(rn); bpi;
+ for (bpi = bgp_dest_get_bgp_path_info(dest); bpi;
bpi = bpi->next) {
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
vnc_import_bgp_exterior_del_route(
- bgp_exterior, bgp_node_get_prefix(rn),
+ bgp_exterior, bgp_dest_get_prefix(dest),
bpi);
}
}
diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c
index 686dc394a..008c7b28b 100644
--- a/bgpd/rfapi/vnc_zebra.c
+++ b/bgpd/rfapi/vnc_zebra.c
@@ -286,8 +286,8 @@ static void vnc_redistribute_withdraw(struct bgp *bgp, afi_t afi, uint8_t type)
{
struct prefix_rd prd;
struct bgp_table *table;
- struct bgp_node *prn;
- struct bgp_node *rn;
+ struct bgp_dest *pdest;
+ struct bgp_dest *dest;
vnc_zlog_debug_verbose("%s: entry", __func__);
@@ -302,25 +302,26 @@ static void vnc_redistribute_withdraw(struct bgp *bgp, afi_t afi, uint8_t type)
/*
* Loop over all the RDs
*/
- for (prn = bgp_table_top(bgp->rib[afi][SAFI_MPLS_VPN]); prn;
- prn = bgp_route_next(prn)) {
- const struct prefix *prn_p = bgp_node_get_prefix(prn);
+ for (pdest = bgp_table_top(bgp->rib[afi][SAFI_MPLS_VPN]); pdest;
+ pdest = bgp_route_next(pdest)) {
+ const struct prefix *pdest_p = bgp_dest_get_prefix(pdest);
memset(&prd, 0, sizeof(prd));
prd.family = AF_UNSPEC;
prd.prefixlen = 64;
- memcpy(prd.val, prn_p->u.val, 8);
+ memcpy(prd.val, pdest_p->u.val, 8);
/* This is the per-RD table of prefixes */
- table = bgp_node_get_bgp_table_info(prn);
+ table = bgp_dest_get_bgp_table_info(pdest);
if (!table)
continue;
- for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
+ for (dest = bgp_table_top(table); dest;
+ dest = bgp_route_next(dest)) {
struct bgp_path_info *ri;
- for (ri = bgp_node_get_bgp_path_info(rn); ri;
+ for (ri = bgp_dest_get_bgp_path_info(dest); ri;
ri = ri->next) {
if (ri->type
== type) { /* has matching redist type */
@@ -331,7 +332,7 @@ static void vnc_redistribute_withdraw(struct bgp *bgp, afi_t afi, uint8_t type)
del_vnc_route(
&vncHD1VR, /* use dummy ptr as cookie */
vncHD1VR.peer, bgp, SAFI_MPLS_VPN,
- bgp_node_get_prefix(rn), &prd, type,
+ bgp_dest_get_prefix(dest), &prd, type,
BGP_ROUTE_REDISTRIBUTE, NULL, 0);
}
}