* Purpose: maintain per-nve ribs and generate change lists
*/
-#include <errno.h>
-
#include "lib/zebra.h"
#include "lib/prefix.h"
-#include "lib/table.h"
+#include "lib/agg_table.h"
#include "lib/vty.h"
#include "lib/memory.h"
#include "lib/log.h"
for (afi = AFI_IP; afi < AFI_MAX; ++afi) {
- struct route_node *rn;
+ struct agg_node *rn;
- for (rn = route_top(rfd->rib[afi]); rn;
- rn = route_next(rn)) {
+ for (rn = agg_route_top(rfd->rib[afi]); rn;
+ rn = agg_route_next(rn)) {
struct skiplist *sl = rn->info;
struct skiplist *dsl = rn->aggregate;
++t_pfx_deleted;
}
}
- for (rn = route_top(rfd->rib_pending[afi]); rn;
- rn = route_next(rn)) {
+ for (rn = agg_route_top(rfd->rib_pending[afi]); rn;
+ rn = agg_route_next(rn)) {
struct list *l = rn->info; /* sorted by cost */
struct skiplist *sl = rn->aggregate;
}
}
- if (checkstats && bgp && bgp->rfapi) {
+ if (checkstats && bgp->rfapi) {
if (t_pfx_active != bgp->rfapi->rib_prefix_count_total) {
vnc_zlog_debug_verbose(
"%s: actual total pfx count %u != running %u",
struct rfapi_descriptor *rfd;
struct skiplist *sl;
struct rfapi_info *ri;
- struct route_node *rn;
+ struct agg_node *rn;
int flags;
#define RFAPI_RIB_TCB_FLAG_DELETED 0x00000001
};
RFAPI_RIB_PREFIX_COUNT_DECR(tcb->rfd, bgp->rfapi);
}
skiplist_free(tcb->sl);
- route_unlock_node(tcb->rn);
+ agg_unlock_node(tcb->rn);
}
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
return 0;
}
-static void
-rfapiRibStartTimer(struct rfapi_descriptor *rfd, struct rfapi_info *ri,
- struct route_node *rn, /* route node attached to */
- int deleted)
+static void rfapiRibStartTimer(struct rfapi_descriptor *rfd,
+ struct rfapi_info *ri,
+ struct agg_node *rn, /* route node attached to */
+ int deleted)
{
struct thread *t = ri->timer;
struct rfapi_rib_tcb *tcb = NULL;
- char buf_prefix[BUFSIZ];
+ char buf_prefix[PREFIX_STRLEN];
if (t) {
tcb = t->arg;
UNSET_FLAG(tcb->flags, RFAPI_RIB_TCB_FLAG_DELETED);
}
- prefix2str(&rn->p, buf_prefix, BUFSIZ);
+ prefix2str(&rn->p, buf_prefix, sizeof(buf_prefix));
vnc_zlog_debug_verbose("%s: rfd %p pfx %s life %u", __func__, rfd,
buf_prefix, ri->lifetime);
ri->timer = NULL;
#endif
for (afi = AFI_IP; afi < AFI_MAX; ++afi) {
- struct route_node *pn;
- struct route_node *rn;
+ struct agg_node *pn;
+ struct agg_node *rn;
if (rfd->rib_pending[afi]) {
- for (pn = route_top(rfd->rib_pending[afi]); pn;
- pn = route_next(pn)) {
+ for (pn = agg_route_top(rfd->rib_pending[afi]); pn;
+ pn = agg_route_next(pn)) {
if (pn->aggregate) {
/*
* free references into the rfapi_info
(struct skiplist
*)(pn->aggregate));
pn->aggregate = NULL;
- route_unlock_node(
+ agg_unlock_node(
pn); /* skiplist deleted */
}
/*
*/
if (pn->info) {
if (pn->info != (void *)1) {
- list_delete_and_null(
- (struct list **)(&pn->info));
+ list_delete(
+ (struct list *
+ *)(&pn->info));
}
pn->info = NULL;
/* linklist or 1 deleted */
- route_unlock_node(pn);
+ agg_unlock_node(pn);
}
}
}
if (rfd->rib[afi]) {
- for (rn = route_top(rfd->rib[afi]); rn;
- rn = route_next(rn)) {
+ for (rn = agg_route_top(rfd->rib[afi]); rn;
+ rn = agg_route_next(rn)) {
if (rn->info) {
struct rfapi_info *ri;
skiplist_free(
(struct skiplist *)rn->info);
rn->info = NULL;
- route_unlock_node(rn);
+ agg_unlock_node(rn);
RFAPI_RIB_PREFIX_COUNT_DECR(rfd,
bgp->rfapi);
}
*)(rn->aggregate));
rn->aggregate = NULL;
- route_unlock_node(rn);
+ agg_unlock_node(rn);
}
}
}
}
- if (rfd->updated_responses_queue) {
- work_queue_free(rfd->updated_responses_queue);
- rfd->updated_responses_queue = NULL;
- }
+ if (rfd->updated_responses_queue)
+ work_queue_free_and_null(&rfd->updated_responses_queue);
}
/*
* Free radix trees
*/
for (afi = AFI_IP; afi < AFI_MAX; ++afi) {
- route_table_finish(rfd->rib_pending[afi]);
+ if (rfd->rib_pending[afi])
+ agg_table_finish(rfd->rib_pending[afi]);
rfd->rib_pending[afi] = NULL;
- route_table_finish(rfd->rib[afi]);
+ if (rfd->rib[afi])
+ agg_table_finish(rfd->rib[afi]);
rfd->rib[afi] = NULL;
- /* NB route_table_finish frees only prefix nodes, not chained
+ /* NB agg_table_finish frees only prefix nodes, not chained
* info */
- route_table_finish(rfd->rsp_times[afi]);
+ if (rfd->rsp_times[afi])
+ agg_table_finish(rfd->rsp_times[afi]);
rfd->rib[afi] = NULL;
}
}
/*
- * Copies struct bgp_info to struct rfapi_info, except for rk fields and un
+ * Copies struct bgp_path_info to struct rfapi_info, except for rk fields and un
*/
-static void rfapiRibBi2Ri(struct bgp_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);
- if (bi->attr) {
- (void)rfapiEcommunityGetLNI(
- bi->attr->ecommunity,
- &vo->v.l2addr.logical_net_id);
- (void)rfapiEcommunityGetEthernetTag(
- bi->attr->ecommunity, &vo->v.l2addr.tag_id);
- }
+ (void)rfapiEcommunityGetLNI(bpi->attr->ecommunity,
+ &vo->v.l2addr.logical_net_id);
+ (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);
+ 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 && 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;
}
}
* !0 do not include route in response
*/
int rfapiRibPreloadBi(
- struct route_node *rfd_rib_node, /* NULL = don't preload or filter */
+ 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_info *bi)
+ struct bgp_path_info *bpi)
{
struct rfapi_descriptor *rfd;
struct skiplist *slRibPt = NULL;
struct rfapi_info *ori = NULL;
struct rfapi_rib_key rk;
- struct route_node *trn;
+ struct agg_node *trn;
afi_t afi;
if (!rfd_rib_node)
afi = family2afi(rfd_rib_node->p.family);
- rfd = (struct rfapi_descriptor *)(rfd_rib_node->table->info);
+ rfd = agg_get_table_info(agg_get_table(rfd_rib_node));
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);
rfd_rib_node->info = slRibPt;
- route_lock_node(rfd_rib_node);
+ agg_lock_node(rfd_rib_node);
RFAPI_RIB_PREFIX_COUNT_INCR(rfd, rfd->bgp->rfapi);
}
skiplist_insert(slRibPt, &ori->rk, ori);
/*
* Update last sent time for prefix
*/
- trn = route_node_get(rfd->rsp_times[afi],
- &rfd_rib_node->p); /* locks trn */
+ trn = agg_node_get(rfd->rsp_times[afi],
+ &rfd_rib_node->p); /* locks trn */
trn->info = (void *)(uintptr_t)bgp_clock();
if (trn->lock > 1)
- route_unlock_node(trn);
+ agg_unlock_node(trn);
return 0;
}
*/
static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
afi_t afi,
- struct route_node *pn, /* pending node */
+ struct agg_node *pn, /* pending node */
struct rfapi_next_hop_entry **head,
struct rfapi_next_hop_entry **tail)
{
struct listnode *nnode = NULL;
struct rfapi_info *ri = NULL; /* happy valgrind */
struct rfapi_ip_prefix hp = {0}; /* pfx to put in NHE */
- struct route_node *rn = NULL;
+ struct agg_node *rn = NULL;
struct skiplist *slRibPt = NULL; /* rib list */
struct skiplist *slPendPt = NULL;
struct list *lPendCost = NULL;
struct list *delete_list = NULL;
int printedprefix = 0;
- char buf_prefix[BUFSIZ];
+ char buf_prefix[PREFIX_STRLEN];
int rib_node_started_nonempty = 0;
int sendingsomeroutes = 0;
#endif
assert(pn);
- prefix2str(&pn->p, buf_prefix, BUFSIZ);
+ prefix2str(&pn->p, buf_prefix, sizeof(buf_prefix));
vnc_zlog_debug_verbose("%s: afi=%d, %s pn->info=%p", __func__, afi,
buf_prefix, pn->info);
/*
* Find corresponding RIB node
*/
- rn = route_node_get(rfd->rib[afi], &pn->p); /* locks rn */
+ rn = agg_node_get(rfd->rib[afi], &pn->p); /* locks rn */
/*
* RIB skiplist has key=rfapi_addr={vn,un}, val = rfapi_info,
while (0
== skiplist_first(slRibPt, NULL, (void **)&ri)) {
- char buf[BUFSIZ];
- char buf2[BUFSIZ];
+ char buf[PREFIX_STRLEN];
+ char buf2[PREFIX_STRLEN];
listnode_add(delete_list, ri);
vnc_zlog_debug_verbose(
ri->timer = NULL;
}
- prefix2str(&ri->rk.vn, buf, BUFSIZ);
- prefix2str(&ri->un, buf2, BUFSIZ);
+ prefix2str(&ri->rk.vn, buf, sizeof(buf));
+ prefix2str(&ri->un, buf2, sizeof(buf2));
vnc_zlog_debug_verbose(
"%s: put dl pfx=%s vn=%s un=%s cost=%d life=%d vn_options=%p",
__func__, buf_prefix, buf, buf2,
skiplist_free(slRibPt);
rn->info = slRibPt = NULL;
- route_unlock_node(rn);
+ agg_unlock_node(rn);
lPendCost = pn->info = NULL;
- route_unlock_node(pn);
+ agg_unlock_node(pn);
goto callback;
}
if (slRibPt) {
skiplist_free(slRibPt);
rn->info = NULL;
- route_unlock_node(rn);
+ agg_unlock_node(rn);
}
assert(!slPendPt);
if (slPendPt) { /* TBD I think we can toss this block */
skiplist_free(slPendPt);
pn->aggregate = NULL;
- route_unlock_node(pn);
+ agg_unlock_node(pn);
}
pn->info = NULL;
- route_unlock_node(pn);
+ agg_unlock_node(pn);
- route_unlock_node(rn); /* route_node_get() */
+ agg_unlock_node(rn); /* agg_node_get() */
if (rib_node_started_nonempty) {
RFAPI_RIB_PREFIX_COUNT_DECR(rfd, bgp->rfapi);
if (skiplist_empty(slRibPt)) {
skiplist_free(slRibPt);
slRibPt = rn->info = NULL;
- route_unlock_node(rn);
+ agg_unlock_node(rn);
}
}
}
} else {
- char buf_rd[BUFSIZ];
+ char buf_rd[RD_ADDRSTRLEN];
/* not found: add new route to RIB */
ori = rfapi_info_new();
slRibPt = skiplist_new(
0, rfapi_rib_key_cmp, NULL);
rn->info = slRibPt;
- route_lock_node(rn);
+ agg_lock_node(rn);
}
skiplist_insert(slRibPt, &ori->rk, ori);
for (ALL_LIST_ELEMENTS(lPendCost, node, nnode, ri)) {
struct rfapi_next_hop_entry *new;
- struct route_node *trn;
+ struct agg_node *trn;
new = XCALLOC(MTYPE_RFAPI_NEXTHOP,
sizeof(struct rfapi_next_hop_entry));
/*
* update this NVE's timestamp for this prefix
*/
- trn = route_node_get(rfd->rsp_times[afi],
- &pn->p); /* locks trn */
+ trn = agg_node_get(rfd->rsp_times[afi],
+ &pn->p); /* locks trn */
trn->info = (void *)(uintptr_t)bgp_clock();
if (trn->lock > 1)
- route_unlock_node(trn);
+ agg_unlock_node(trn);
rfapiRfapiIpAddr2Str(&new->vn_address, buf, BUFSIZ);
rfapiRfapiIpAddr2Str(&new->un_address, buf2, BUFSIZ);
0, rfapi_rib_key_cmp,
(void (*)(void *))
rfapi_info_free);
- route_lock_node(rn);
+ agg_lock_node(rn);
}
RFAPI_RIB_CHECK_COUNTS(0, delete_list->count);
ri->last_sent_time = rfapi_time(NULL);
#if DEBUG_RIB_SL_RD
{
- char buf_rd[BUFSIZ];
- prefix_rd2str(&ri->rk.rd,
- buf_rd,
- sizeof(buf_rd));
+ char buf_rd[RD_ADDRSTRLEN];
+
vnc_zlog_debug_verbose(
"%s: move route to recently deleted list, rd=%s",
- __func__, buf_rd);
+ __func__,
+ prefix_rd2str(
+ &ri->rk.rd,
+ buf_rd,
+ sizeof(buf_rd)));
}
#endif
}
delete_list->del = (void (*)(void *))rfapi_info_free;
- list_delete_and_null(&delete_list);
+ list_delete(&delete_list);
}
RFAPI_RIB_CHECK_COUNTS(0, 0);
/*
- * Reset pending lists. The final route_unlock_node() will probably
+ * Reset pending lists. The final agg_unlock_node() will probably
* cause the pending node to be released.
*/
if (slPendPt) {
skiplist_free(slPendPt);
pn->aggregate = NULL;
- route_unlock_node(pn);
+ agg_unlock_node(pn);
}
if (lPendCost) {
- list_delete_and_null(&lPendCost);
+ list_delete(&lPendCost);
pn->info = NULL;
- route_unlock_node(pn);
+ agg_unlock_node(pn);
}
RFAPI_RIB_CHECK_COUNTS(0, 0);
if (sendingsomeroutes)
rfapiMonitorTimersRestart(rfd, &pn->p);
- route_unlock_node(rn); /* route_node_get() */
+ agg_unlock_node(rn); /* agg_node_get() */
RFAPI_RIB_CHECK_COUNTS(1, 0);
}
struct bgp *bgp = bgp_get_default();
struct rfapi_next_hop_entry *head = NULL;
struct rfapi_next_hop_entry *tail = NULL;
- struct route_node *rn;
+ struct agg_node *rn;
#if DEBUG_L2_EXTRA
vnc_zlog_debug_verbose("%s: rfd=%p, afi=%d", __func__, rfd, afi);
assert(bgp->rfapi);
- for (rn = route_top(rfd->rib_pending[afi]); rn; rn = route_next(rn)) {
+ for (rn = agg_route_top(rfd->rib_pending[afi]); rn;
+ rn = agg_route_next(rn)) {
process_pending_node(bgp, rfd, afi, rn, &head, &tail);
}
void rfapiRibUpdatePendingNode(
struct bgp *bgp, struct rfapi_descriptor *rfd,
struct rfapi_import_table *it, /* needed for L2 */
- struct route_node *it_node, uint32_t lifetime)
+ struct agg_node *it_node, uint32_t lifetime)
{
struct prefix *prefix;
- struct bgp_info *bi;
- struct route_node *pn;
+ struct bgp_path_info *bpi;
+ struct agg_node *pn;
afi_t afi;
uint32_t queued_flag;
int count = 0;
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
vnc_zlog_debug_verbose("%s: entry", __func__);
prefix = &it_node->p;
afi = family2afi(prefix->family);
- prefix2str(prefix, buf, BUFSIZ);
+ prefix2str(prefix, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: prefix=%s", __func__, buf);
- pn = route_node_get(rfd->rib_pending[afi], prefix);
+ pn = agg_node_get(rfd->rib_pending[afi], prefix);
assert(pn);
vnc_zlog_debug_verbose("%s: pn->info=%p, pn->aggregate=%p", __func__,
*/
skiplist_free((struct skiplist *)(pn->aggregate));
pn->aggregate = NULL;
- route_unlock_node(pn); /* skiplist deleted */
+ agg_unlock_node(pn); /* skiplist deleted */
}
*/
if (pn->info) {
if (pn->info != (void *)1) {
- list_delete_and_null((struct list **)(&pn->info));
+ list_delete((struct list **)(&pn->info));
}
pn->info = NULL;
- route_unlock_node(pn); /* linklist or 1 deleted */
+ agg_unlock_node(pn); /* linklist or 1 deleted */
}
/*
- * 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;
}
if (!pn->aggregate) {
pn->aggregate =
skiplist_new(0, rfapi_rib_key_cmp, NULL);
- route_lock_node(pn);
+ agg_lock_node(pn);
}
/*
continue;
}
- rfapiRibBi2Ri(bi, ri, lifetime);
+ rfapiRibBi2Ri(bpi, ri, lifetime);
if (!pn->info) {
pn->info = list_new();
((struct list *)(pn->info))->del =
(void (*)(void *))rfapi_info_free;
- route_lock_node(pn);
+ agg_lock_node(pn);
}
listnode_add((struct list *)(pn->info), ri);
assert(!pn->aggregate);
pn->info = (void *)1; /* magic value means this node has no
routes */
- route_lock_node(pn);
+ agg_lock_node(pn);
}
- route_unlock_node(pn); /* route_node_get */
+ agg_unlock_node(pn); /* agg_node_get */
queued_flag = RFAPI_QUEUED_FLAG(afi);
void rfapiRibUpdatePendingNodeSubtree(
struct bgp *bgp, struct rfapi_descriptor *rfd,
- struct rfapi_import_table *it, struct route_node *it_node,
- struct route_node *omit_subtree, /* may be NULL */
+ struct rfapi_import_table *it, struct agg_node *it_node,
+ struct agg_node *omit_subtree, /* may be NULL */
uint32_t lifetime)
{
/* FIXME: need to find a better way here to work without sticking our
* hands in node->link */
- if (it_node->l_left && (it_node->l_left != omit_subtree)) {
- if (it_node->l_left->info)
- rfapiRibUpdatePendingNode(bgp, rfd, it, it_node->l_left,
- lifetime);
- rfapiRibUpdatePendingNodeSubtree(bgp, rfd, it, it_node->l_left,
+ if (agg_node_left(it_node)
+ && (agg_node_left(it_node) != omit_subtree)) {
+ if (agg_node_left(it_node)->info)
+ rfapiRibUpdatePendingNode(
+ bgp, rfd, it, agg_node_left(it_node), lifetime);
+ rfapiRibUpdatePendingNodeSubtree(bgp, rfd, it,
+ agg_node_left(it_node),
omit_subtree, lifetime);
}
- if (it_node->l_right && (it_node->l_right != omit_subtree)) {
- if (it_node->l_right->info)
+ if (agg_node_right(it_node)
+ && (agg_node_right(it_node) != omit_subtree)) {
+ if (agg_node_right(it_node)->info)
rfapiRibUpdatePendingNode(bgp, rfd, it,
- it_node->l_right, lifetime);
- rfapiRibUpdatePendingNodeSubtree(bgp, rfd, it, it_node->l_right,
+ agg_node_right(it_node),
+ lifetime);
+ rfapiRibUpdatePendingNodeSubtree(bgp, rfd, it,
+ agg_node_right(it_node),
omit_subtree, lifetime);
}
}
*/
int rfapiRibFTDFilterRecentPrefix(
struct rfapi_descriptor *rfd,
- struct route_node *it_rn, /* import table node */
+ struct agg_node *it_rn, /* import table node */
struct prefix *pfx_target_original) /* query target */
{
struct bgp *bgp = rfd->bgp;
afi_t afi = family2afi(it_rn->p.family);
time_t prefix_time;
- struct route_node *trn;
+ struct agg_node *trn;
/*
* Not in FTD mode, so allow prefix
#if DEBUG_FTD_FILTER_RECENT
{
- char buf_pfx[BUFSIZ];
+ char buf_pfx[PREFIX_STRLEN];
- prefix2str(&it_rn->p, buf_pfx, BUFSIZ);
+ prefix2str(&it_rn->p, buf_pfx, sizeof(buf_pfx));
vnc_zlog_debug_verbose("%s: prefix %s", __func__, buf_pfx);
}
#endif
/*
* check this NVE's timestamp for this prefix
*/
- trn = route_node_get(rfd->rsp_times[afi], &it_rn->p); /* locks trn */
+ trn = agg_node_get(rfd->rsp_times[afi], &it_rn->p); /* locks trn */
prefix_time = (time_t)trn->info;
if (trn->lock > 1)
- route_unlock_node(trn);
+ agg_unlock_node(trn);
#if DEBUG_FTD_FILTER_RECENT
vnc_zlog_debug_verbose("%s: last sent time %lu, last allowed time %lu",
afi_t afi;
struct rfapi_info *ri;
int need_insert;
- struct route_node *rn;
+ struct agg_node *rn;
int rib_node_started_nonempty = 0;
- struct route_node *trn;
+ struct agg_node *trn;
int allowed = 0;
/* save in case we delete nhp */
/*
* Look up prefix in RIB
*/
- rn = route_node_get(rfd->rib[afi], &pfx); /* locks rn */
+ rn = agg_node_get(rfd->rib[afi], &pfx); /* locks rn */
if (rn->info) {
rib_node_started_nonempty = 1;
} else {
rn->info = skiplist_new(0, rfapi_rib_key_cmp, NULL);
- route_lock_node(rn);
+ agg_lock_node(rn);
}
/*
#if DEBUG_NHL
{
- char str_vn[BUFSIZ];
- char str_aux_prefix[BUFSIZ];
+ char str_vn[PREFIX_STRLEN];
+ char str_aux_prefix[PREFIX_STRLEN];
str_vn[0] = 0;
str_aux_prefix[0] = 0;
- prefix2str(&rk.vn, str_vn, BUFSIZ);
- prefix2str(&rk.aux_prefix, str_aux_prefix, BUFSIZ);
+ prefix2str(&rk.vn, str_vn, sizeof(str_vn));
+ prefix2str(&rk.aux_prefix, str_aux_prefix,
+ sizeof(str_aux_prefix));
if (!rk.aux_prefix.family) {
}
rfapiRibStartTimer(rfd, ri, rn, 0);
RFAPI_RIB_CHECK_COUNTS(0, 0);
- route_unlock_node(rn);
+ agg_unlock_node(rn);
/*
* update this NVE's timestamp for this prefix
*/
- trn = route_node_get(rfd->rsp_times[afi], &pfx); /* locks trn */
+ trn = agg_node_get(rfd->rsp_times[afi], &pfx); /* locks trn */
trn->info = (void *)(uintptr_t)bgp_clock();
if (trn->lock > 1)
- route_unlock_node(trn);
+ agg_unlock_node(trn);
{
- char str_pfx[BUFSIZ];
- char str_pfx_vn[BUFSIZ];
+ char str_pfx[PREFIX_STRLEN];
+ char str_pfx_vn[PREFIX_STRLEN];
- prefix2str(&pfx, str_pfx, BUFSIZ);
- prefix2str(&rk.vn, str_pfx_vn, BUFSIZ);
+ prefix2str(&pfx, str_pfx, sizeof(str_pfx));
+ prefix2str(&rk.vn, str_pfx_vn, sizeof(str_pfx_vn));
vnc_zlog_debug_verbose(
"%s: added pfx=%s nh[vn]=%s, cost=%u, lifetime=%u, allowed=%d",
__func__, str_pfx, str_pfx_vn, nhp->prefix.cost,
nhp->vn_options = NULL;
XFREE(MTYPE_RFAPI_NEXTHOP, nhp);
- nhp = NULL;
}
}
}
void rfapiRibPendingDeleteRoute(struct bgp *bgp, struct rfapi_import_table *it,
- afi_t afi, struct route_node *it_node)
+ afi_t afi, struct agg_node *it_node)
{
struct rfapi_descriptor *rfd;
struct listnode *node;
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- prefix2str(&it_node->p, buf, BUFSIZ);
+ prefix2str(&it_node->p, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: entry, it=%p, afi=%d, it_node=%p, pfx=%s",
__func__, it, afi, it_node, buf);
* identifies the rfd that owns it.
*/
struct rfapi_monitor_eth *m;
- struct route_node *rn;
+ struct agg_node *rn;
struct skiplist *sl;
void *cursor;
int rc;
* NVE, it's OK to send an update with the
* delete
*/
- if ((rn = route_node_lookup(m->rfd->rib[afi],
- &it_node->p))) {
+ if ((rn = agg_node_lookup(m->rfd->rib[afi],
+ &it_node->p))) {
rfapiRibUpdatePendingNode(
bgp, m->rfd, it, it_node,
m->rfd->response_lifetime);
- route_unlock_node(rn);
+ agg_unlock_node(rn);
}
}
}
* this
* NVE, it's OK to send an update with the delete
*/
- if ((rn = route_node_lookup(m->rfd->rib[afi],
- &it_node->p))) {
+ if ((rn = agg_node_lookup(m->rfd->rib[afi],
+ &it_node->p))) {
rfapiRibUpdatePendingNode(
bgp, m->rfd, it, it_node,
m->rfd->response_lifetime);
for (ALL_LIST_ELEMENTS_RO(&bgp->rfapi->descriptors, node,
rfd)) {
- struct route_node *rn;
+ struct agg_node *rn;
vnc_zlog_debug_verbose(
"%s: comparing rfd(%p)->import_table=%p to it=%p",
* prefix
* previously, we should send an updated response.
*/
- if ((rn = route_node_lookup(rfd->rib[afi],
- &it_node->p))) {
+ if ((rn = agg_node_lookup(rfd->rib[afi],
+ &it_node->p))) {
rfapiRibUpdatePendingNode(
bgp, rfd, it, it_node,
rfd->response_lifetime);
- route_unlock_node(rn);
+ agg_unlock_node(rn);
}
}
}
for (rc = skiplist_next(sl, NULL, (void **)&ri, &cursor); !rc;
rc = skiplist_next(sl, NULL, (void **)&ri, &cursor)) {
- char str_vn[BUFSIZ];
- char str_un[BUFSIZ];
+ char str_vn[PREFIX_STRLEN];
+ char str_un[PREFIX_STRLEN];
char str_lifetime[BUFSIZ];
char str_age[BUFSIZ];
char *p;
- char str_rd[BUFSIZ];
+ char str_rd[RD_ADDRSTRLEN];
++routes_displayed;
- prefix2str(&ri->rk.vn, str_vn, BUFSIZ);
+ prefix2str(&ri->rk.vn, str_vn, sizeof(str_vn));
p = index(str_vn, '/');
if (p)
*p = 0;
- prefix2str(&ri->un, str_un, BUFSIZ);
+ prefix2str(&ri->un, str_un, sizeof(str_un));
p = index(str_un, '/');
if (p)
*p = 0;
str_rd[0] = 0; /* start empty */
#if DEBUG_RIB_SL_RD
- str_rd[0] = ' ';
- prefix_rd2str(&ri->rk.rd, str_rd + 1, BUFSIZ - 1);
+ prefix_rd2str(&ri->rk.rd, str_rd, sizeof(str_rd));
#endif
- fp(out, " %c %-20s %-15s %-15s %-4u %-8s %-8s%s\n",
+ fp(out, " %c %-20s %-15s %-15s %-4u %-8s %-8s %s\n",
deleted ? 'r' : ' ', *printedprefix ? "" : str_pfx, str_vn,
str_un, ri->cost, str_lifetime, str_age, str_rd);
const char *vty_newline;
int nhs_displayed = 0;
- char str_pfx[BUFSIZ];
+ char str_pfx[PREFIX_STRLEN];
int printedprefix = 0;
if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0)
return;
- prefix2str(pfx, str_pfx, BUFSIZ);
+ prefix2str(pfx, str_pfx, sizeof(str_pfx));
nhs_displayed +=
print_rib_sl(fp, vty, out, sl, 0, str_pfx, &printedprefix);
for (afi = AFI_IP; afi < AFI_MAX; ++afi) {
- struct route_node *rn;
+ struct agg_node *rn;
if (!rfd->rib[afi])
continue;
- for (rn = route_top(rfd->rib[afi]); rn;
- rn = route_next(rn)) {
+ for (rn = agg_route_top(rfd->rib[afi]); rn;
+ rn = agg_route_next(rn)) {
struct skiplist *sl;
- char str_pfx[BUFSIZ];
+ char str_pfx[PREFIX_STRLEN];
int printedprefix = 0;
if (!show_removed)
str_un,
BUFSIZ));
}
- prefix2str(&rn->p, str_pfx, BUFSIZ);
+ prefix2str(&rn->p, str_pfx, sizeof(str_pfx));
// fp(out, " %s\n", buf); /* prefix */
routes_displayed++;