summaryrefslogtreecommitdiff
path: root/bgpd/rfapi/rfapi.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-07-30 11:40:02 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-11-16 09:43:35 -0500
commit6f94b685d0480f7ea427ddfd1c603399dd047aa3 (patch)
tree0bd62ffb42a51cf9c27efbf5e686a703748e1b2a /bgpd/rfapi/rfapi.c
parentaaafc3216727276a6daf5f2fc5a050b5601e1eb3 (diff)
bgpd: Abstract bgp_info retrieving/setting from info pointer
The bgp_info data is stored as a void pointer in `struct bgp_node`. Abstract retrieval of this data and setting of this data into functions so that in the future we can move around what is stored in bgp_node. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd/rfapi/rfapi.c')
-rw-r--r--bgpd/rfapi/rfapi.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 6978dd145d..4fffe94a83 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -382,9 +382,10 @@ 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 ? bn->info : NULL));
+ afi, safi, bn, (bn ? bgp_node_get_bgp_path_info(bn) : NULL));
- for (bpi = (bn ? bn->info : NULL); bpi; bpi = bpi->next) {
+ for (bpi = (bn ? bgp_node_get_bgp_path_info(bn) : NULL); bpi;
+ bpi = bpi->next) {
vnc_zlog_debug_verbose(
"%s: trying bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p, local_pref=%u",
@@ -945,7 +946,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 = bn->info; bpi; bpi = bpi->next) {
+ for (bpi = bgp_node_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
@@ -1081,7 +1082,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
/* debug */
if (VNC_DEBUG(VERBOSE)) {
- vnc_zlog_debug_verbose("%s: printing BI", __func__);
+ vnc_zlog_debug_verbose("%s: printing BPI", __func__);
rfapiPrintBi(NULL, new);
}
@@ -3701,10 +3702,12 @@ static void rfapi_print_exported(struct bgp *bgp)
fprintf(stderr, "%s: vpn rdn=%p\n", __func__, rdn);
for (rn = bgp_table_top(rdn->info); rn;
rn = bgp_route_next(rn)) {
- if (!rn->info)
+ bpi = bgp_node_get_bgp_path_info(rn);
+
+ if (!bpi)
continue;
fprintf(stderr, "%s: rn=%p\n", __func__, rn);
- for (bpi = rn->info; bpi; bpi = bpi->next) {
+ for (; bpi; bpi = bpi->next) {
rfapiPrintBi((void *)2, bpi); /* 2 => stderr */
}
}
@@ -3716,10 +3719,11 @@ static void rfapi_print_exported(struct bgp *bgp)
fprintf(stderr, "%s: encap rdn=%p\n", __func__, rdn);
for (rn = bgp_table_top(rdn->info); rn;
rn = bgp_route_next(rn)) {
- if (!rn->info)
+ bpi = bgp_node_get_bgp_path_info(rn);
+ if (!bpi)
continue;
fprintf(stderr, "%s: rn=%p\n", __func__, rn);
- for (bpi = rn->info; bpi; bpi = bpi->next) {
+ for (; bpi; bpi = bpi->next) {
rfapiPrintBi((void *)2, bpi); /* 2 => stderr */
}
}