summaryrefslogtreecommitdiffstats
path: root/bgpd/rfapi
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bgpd/rfapi/bgp_rfapi_cfg.c176
-rw-r--r--bgpd/rfapi/rfapi.c83
-rw-r--r--bgpd/rfapi/rfapi_import.c266
-rw-r--r--bgpd/rfapi/rfapi_import.h2
-rw-r--r--bgpd/rfapi/rfapi_monitor.c2
-rw-r--r--bgpd/rfapi/rfapi_rib.c29
-rw-r--r--bgpd/rfapi/rfapi_vty.c84
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c32
-rw-r--r--bgpd/rfapi/vnc_zebra.c2
9 files changed, 307 insertions, 369 deletions
diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c
index 5b6961d..a452ebe 100644
--- a/bgpd/rfapi/bgp_rfapi_cfg.c
+++ b/bgpd/rfapi/bgp_rfapi_cfg.c
@@ -531,7 +531,7 @@ rfapi_group_new(struct bgp *bgp, rfapi_group_cfg_type_t type, const char *name)
rfg = XCALLOC(MTYPE_RFAPI_GROUP_CFG,
sizeof(struct rfapi_nve_group_cfg));
rfg->type = type;
- rfg->name = strdup(name);
+ rfg->name = XSTRDUP(MTYPE_RFAPI_GROUP_CFG, name);
/* add to tail of list */
listnode_add(bgp->rfapi_cfg->nve_groups_sequential, rfg);
rfg->label = MPLS_LABEL_NONE;
@@ -832,8 +832,8 @@ DEFUN (vnc_redistribute_protocol,
if (bgp->rfapi_cfg->redist_bgp_exterior_view_name) {
VNC_REDIST_DISABLE(bgp, afi,
type); /* disabled view implicitly */
- free(bgp->rfapi_cfg->redist_bgp_exterior_view_name);
- bgp->rfapi_cfg->redist_bgp_exterior_view_name = NULL;
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ bgp->rfapi_cfg->redist_bgp_exterior_view_name);
}
bgp->rfapi_cfg->redist_bgp_exterior_view = bgp;
}
@@ -873,10 +873,8 @@ DEFUN (vnc_no_redistribute_protocol,
VNC_REDIST_DISABLE(bgp, afi, type);
if (type == ZEBRA_ROUTE_BGP_DIRECT_EXT) {
- if (bgp->rfapi_cfg->redist_bgp_exterior_view_name) {
- free(bgp->rfapi_cfg->redist_bgp_exterior_view_name);
- bgp->rfapi_cfg->redist_bgp_exterior_view_name = NULL;
- }
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ bgp->rfapi_cfg->redist_bgp_exterior_view_name);
bgp->rfapi_cfg->redist_bgp_exterior_view = NULL;
}
@@ -905,9 +903,10 @@ DEFUN (vnc_redistribute_bgp_exterior,
return CMD_WARNING_CONFIG_FAILED;
}
- if (bgp->rfapi_cfg->redist_bgp_exterior_view_name)
- free(bgp->rfapi_cfg->redist_bgp_exterior_view_name);
- bgp->rfapi_cfg->redist_bgp_exterior_view_name = strdup(argv[5]->arg);
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ bgp->rfapi_cfg->redist_bgp_exterior_view_name);
+ bgp->rfapi_cfg->redist_bgp_exterior_view_name =
+ XSTRDUP(MTYPE_RFAPI_GROUP_CFG, argv[5]->arg);
/* could be NULL if name is not defined yet */
bgp->rfapi_cfg->redist_bgp_exterior_view =
bgp_lookup_by_name(argv[5]->arg);
@@ -935,9 +934,9 @@ DEFUN (vnc_redistribute_nvegroup,
*/
bgp->rfapi_cfg->rfg_redist = bgp_rfapi_cfg_match_byname(
bgp, argv[3]->arg, RFAPI_GROUP_CFG_NVE);
- if (bgp->rfapi_cfg->rfg_redist_name)
- free(bgp->rfapi_cfg->rfg_redist_name);
- bgp->rfapi_cfg->rfg_redist_name = strdup(argv[3]->arg);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, bgp->rfapi_cfg->rfg_redist_name);
+ bgp->rfapi_cfg->rfg_redist_name = XSTRDUP(MTYPE_RFAPI_GROUP_CFG,
+ argv[3]->arg);
vnc_redistribute_postchange(bgp);
@@ -959,9 +958,7 @@ DEFUN (vnc_redistribute_no_nvegroup,
vnc_redistribute_prechange(bgp);
bgp->rfapi_cfg->rfg_redist = NULL;
- if (bgp->rfapi_cfg->rfg_redist_name)
- free(bgp->rfapi_cfg->rfg_redist_name);
- bgp->rfapi_cfg->rfg_redist_name = NULL;
+ XFREE(MTYPE_RFAPI_GROUP_CFG, bgp->rfapi_cfg->rfg_redist_name);
vnc_redistribute_postchange(bgp);
@@ -1030,9 +1027,7 @@ DEFUN (vnc_redist_bgpdirect_no_prefixlist,
vnc_redistribute_prechange(bgp);
- if (hc->plist_redist_name[route_type][afi])
- free(hc->plist_redist_name[route_type][afi]);
- hc->plist_redist_name[route_type][afi] = NULL;
+ XFREE(MTYPE_RFAPI_GROUP_CFG, hc->plist_redist_name[route_type][afi]);
hc->plist_redist[route_type][afi] = NULL;
vnc_redistribute_postchange(bgp);
@@ -1074,9 +1069,9 @@ DEFUN (vnc_redist_bgpdirect_prefixlist,
vnc_redistribute_prechange(bgp);
- if (hc->plist_redist_name[route_type][afi])
- free(hc->plist_redist_name[route_type][afi]);
- hc->plist_redist_name[route_type][afi] = strdup(argv[5]->arg);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, hc->plist_redist_name[route_type][afi]);
+ hc->plist_redist_name[route_type][afi] = XSTRDUP(MTYPE_RFAPI_GROUP_CFG,
+ argv[5]->arg);
hc->plist_redist[route_type][afi] =
prefix_list_lookup(afi, argv[5]->arg);
@@ -1110,9 +1105,7 @@ DEFUN (vnc_redist_bgpdirect_no_routemap,
vnc_redistribute_prechange(bgp);
- if (hc->routemap_redist_name[route_type])
- free(hc->routemap_redist_name[route_type]);
- hc->routemap_redist_name[route_type] = NULL;
+ XFREE(MTYPE_RFAPI_GROUP_CFG, hc->routemap_redist_name[route_type]);
hc->routemap_redist[route_type] = NULL;
vnc_redistribute_postchange(bgp);
@@ -1144,15 +1137,16 @@ DEFUN (vnc_redist_bgpdirect_routemap,
vnc_redistribute_prechange(bgp);
- if (hc->routemap_redist_name[route_type])
- free(hc->routemap_redist_name[route_type]);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, hc->routemap_redist_name[route_type]);
/* If the old route map config overwrite with new
* route map config , old routemap counter have to be
* reduced.
*/
route_map_counter_decrement(hc->routemap_redist[route_type]);
- hc->routemap_redist_name[route_type] = strdup(argv[4]->arg);
+ hc->routemap_redist_name[route_type] = XSTRDUP(MTYPE_RFAPI_GROUP_CFG,
+ argv[4]->arg);
+
hc->routemap_redist[route_type] =
route_map_lookup_by_name(argv[4]->arg);
route_map_counter_increment(hc->routemap_redist[route_type]);
@@ -1197,9 +1191,8 @@ DEFUN (vnc_nve_group_redist_bgpdirect_no_prefixlist,
vnc_redistribute_prechange(bgp);
- if (rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi])
- free(rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi]);
- rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi] = NULL;
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi]);
rfg->plist_redist[ZEBRA_ROUTE_BGP_DIRECT][afi] = NULL;
vnc_redistribute_postchange(bgp);
@@ -1238,10 +1231,10 @@ DEFUN (vnc_nve_group_redist_bgpdirect_prefixlist,
vnc_redistribute_prechange(bgp);
- if (rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi])
- free(rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi]);
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi]);
rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi] =
- strdup(argv[4]->arg);
+ XSTRDUP(MTYPE_RFAPI_GROUP_CFG, argv[4]->arg);
rfg->plist_redist[ZEBRA_ROUTE_BGP_DIRECT][afi] =
prefix_list_lookup(afi, argv[4]->arg);
@@ -1272,11 +1265,10 @@ DEFUN (vnc_nve_group_redist_bgpdirect_no_routemap,
vnc_redistribute_prechange(bgp);
- if (rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT])
- free(rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT]);
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT]);
route_map_counter_decrement(
rfg->routemap_redist[ZEBRA_ROUTE_BGP_DIRECT]);
- rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT] = NULL;
rfg->routemap_redist[ZEBRA_ROUTE_BGP_DIRECT] = NULL;
vnc_redistribute_postchange(bgp);
@@ -1305,12 +1297,12 @@ DEFUN (vnc_nve_group_redist_bgpdirect_routemap,
vnc_redistribute_prechange(bgp);
- if (rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT])
- free(rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT]);
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT]);
route_map_counter_decrement(
rfg->routemap_redist[ZEBRA_ROUTE_BGP_DIRECT]);
rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT] =
- strdup(argv[3]->arg);
+ XSTRDUP(MTYPE_RFAPI_GROUP_CFG, argv[3]->arg);
rfg->routemap_redist[ZEBRA_ROUTE_BGP_DIRECT] =
route_map_lookup_by_name(argv[3]->arg);
route_map_counter_increment(
@@ -1451,7 +1443,7 @@ DEFUN (vnc_export_nvegroup,
}
rfgn = rfgn_new();
- rfgn->name = strdup(argv[5]->arg);
+ rfgn->name = XSTRDUP(MTYPE_RFAPI_GROUP_CFG, argv[5]->arg);
rfgn->rfg = rfg_new; /* OK if not set yet */
listnode_add(bgp->rfapi_cfg->rfg_export_direct_bgp_l, rfgn);
@@ -1487,7 +1479,7 @@ DEFUN (vnc_export_nvegroup,
}
rfgn = rfgn_new();
- rfgn->name = strdup(argv[5]->arg);
+ rfgn->name = XSTRDUP(MTYPE_RFAPI_GROUP_CFG, argv[5]->arg);
rfgn->rfg = rfg_new; /* OK if not set yet */
listnode_add(bgp->rfapi_cfg->rfg_export_zebra_l, rfgn);
@@ -1531,7 +1523,7 @@ DEFUN (vnc_no_export_nvegroup,
if (rfgn->rfg)
vnc_direct_bgp_del_group(bgp,
rfgn->rfg);
- free(rfgn->name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, rfgn->name);
list_delete_node(
bgp->rfapi_cfg->rfg_export_direct_bgp_l,
node);
@@ -1548,7 +1540,7 @@ DEFUN (vnc_no_export_nvegroup,
if (rfgn->name && !strcmp(rfgn->name, argv[6]->arg)) {
if (rfgn->rfg)
vnc_zebra_del_group(bgp, rfgn->rfg);
- free(rfgn->name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, rfgn->name);
list_delete_node(
bgp->rfapi_cfg->rfg_export_zebra_l,
node);
@@ -1612,9 +1604,8 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
|| (rfg->plist_export_zebra_name[afi]
&& strmatch(argv[idx]->arg,
rfg->plist_export_zebra_name[afi]))) {
- if (rfg->plist_export_zebra_name[afi])
- free(rfg->plist_export_zebra_name[afi]);
- rfg->plist_export_zebra_name[afi] = NULL;
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ rfg->plist_export_zebra_name[afi]);
rfg->plist_export_zebra[afi] = NULL;
vnc_zebra_reexport_group_afi(bgp, rfg, afi);
@@ -1667,18 +1658,18 @@ DEFUN (vnc_nve_group_export_prefixlist,
idx = argc - 1;
if (is_bgp) {
- if (rfg->plist_export_bgp_name[afi])
- free(rfg->plist_export_bgp_name[afi]);
- rfg->plist_export_bgp_name[afi] = strdup(argv[idx]->arg);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, rfg->plist_export_bgp_name[afi]);
+ rfg->plist_export_bgp_name[afi] = XSTRDUP(MTYPE_RFAPI_GROUP_CFG,
+ argv[idx]->arg);
rfg->plist_export_bgp[afi] =
prefix_list_lookup(afi, argv[idx]->arg);
vnc_direct_bgp_reexport_group_afi(bgp, rfg, afi);
} else {
- if (rfg->plist_export_zebra_name[afi])
- free(rfg->plist_export_zebra_name[afi]);
- rfg->plist_export_zebra_name[afi] = strdup(argv[idx]->arg);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, rfg->plist_export_zebra_name[afi]);
+ rfg->plist_export_zebra_name[afi] =
+ XSTRDUP(MTYPE_RFAPI_GROUP_CFG, argv[idx]->arg);
rfg->plist_export_zebra[afi] =
prefix_list_lookup(afi, argv[idx]->arg);
@@ -1720,7 +1711,8 @@ DEFUN (vnc_nve_group_export_no_routemap,
switch (argv[idx]->text[0]) {
case 'z':
is_bgp = 0;
- /* fall thru */
+ idx += 2;
+ break;
case 'b':
idx += 2;
break;
@@ -1734,10 +1726,9 @@ DEFUN (vnc_nve_group_export_no_routemap,
|| (rfg->routemap_export_bgp_name
&& strmatch(argv[idx]->arg,
rfg->routemap_export_bgp_name))) {
- if (rfg->routemap_export_bgp_name)
- free(rfg->routemap_export_bgp_name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ rfg->routemap_export_bgp_name);
route_map_counter_decrement(rfg->routemap_export_bgp);
- rfg->routemap_export_bgp_name = NULL;
rfg->routemap_export_bgp = NULL;
vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP);
@@ -1748,10 +1739,8 @@ DEFUN (vnc_nve_group_export_no_routemap,
|| (rfg->routemap_export_zebra_name
&& strmatch(argv[idx]->arg,
rfg->routemap_export_zebra_name))) {
- if (rfg->routemap_export_zebra_name)
- free(rfg->routemap_export_zebra_name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, rfg->routemap_export_zebra_name);
route_map_counter_decrement(rfg->routemap_export_zebra);
- rfg->routemap_export_zebra_name = NULL;
rfg->routemap_export_zebra = NULL;
vnc_zebra_reexport_group_afi(bgp, rfg, AFI_IP);
@@ -1795,20 +1784,20 @@ DEFUN (vnc_nve_group_export_routemap,
idx = argc - 1;
if (is_bgp) {
- if (rfg->routemap_export_bgp_name)
- free(rfg->routemap_export_bgp_name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, rfg->routemap_export_bgp_name);
route_map_counter_decrement(rfg->routemap_export_bgp);
- rfg->routemap_export_bgp_name = strdup(argv[idx]->arg);
+ rfg->routemap_export_bgp_name = XSTRDUP(MTYPE_RFAPI_GROUP_CFG,
+ argv[idx]->arg);
rfg->routemap_export_bgp =
route_map_lookup_by_name(argv[idx]->arg);
route_map_counter_increment(rfg->routemap_export_bgp);
vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP);
vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP6);
} else {
- if (rfg->routemap_export_zebra_name)
- free(rfg->routemap_export_zebra_name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, rfg->routemap_export_zebra_name);
route_map_counter_decrement(rfg->routemap_export_zebra);
- rfg->routemap_export_zebra_name = strdup(argv[idx]->arg);
+ rfg->routemap_export_zebra_name = XSTRDUP(MTYPE_RFAPI_GROUP_CFG,
+ argv[idx]->arg);
rfg->routemap_export_zebra =
route_map_lookup_by_name(argv[idx]->arg);
route_map_counter_increment(rfg->routemap_export_zebra);
@@ -1853,9 +1842,8 @@ DEFUN (vnc_nve_export_no_prefixlist,
if (((argc > 6) && hc->plist_export_bgp_name[afi]
&& strmatch(argv[6]->text, hc->plist_export_bgp_name[afi]))
|| (argc <= 6)) {
-
- free(hc->plist_export_bgp_name[afi]);
- hc->plist_export_bgp_name[afi] = NULL;
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ hc->plist_export_bgp_name[afi]);
hc->plist_export_bgp[afi] = NULL;
vnc_direct_bgp_reexport(bgp, afi);
}
@@ -1864,9 +1852,8 @@ DEFUN (vnc_nve_export_no_prefixlist,
&& strmatch(argv[6]->text,
hc->plist_export_zebra_name[afi]))
|| (argc <= 6)) {
-
- free(hc->plist_export_zebra_name[afi]);
- hc->plist_export_zebra_name[afi] = NULL;
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ hc->plist_export_zebra_name[afi]);
hc->plist_export_zebra[afi] = NULL;
/* TBD vnc_zebra_rh_reexport(bgp, afi); */
}
@@ -1899,16 +1886,16 @@ DEFUN (vnc_nve_export_prefixlist,
}
if (argv[2]->arg[0] == 'b') {
- if (hc->plist_export_bgp_name[afi])
- free(hc->plist_export_bgp_name[afi]);
- hc->plist_export_bgp_name[afi] = strdup(argv[5]->arg);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, hc->plist_export_bgp_name[afi]);
+ hc->plist_export_bgp_name[afi] = XSTRDUP(MTYPE_RFAPI_GROUP_CFG,
+ argv[5]->arg);
hc->plist_export_bgp[afi] =
prefix_list_lookup(afi, argv[5]->arg);
vnc_direct_bgp_reexport(bgp, afi);
} else {
- if (hc->plist_export_zebra_name[afi])
- free(hc->plist_export_zebra_name[afi]);
- hc->plist_export_zebra_name[afi] = strdup(argv[5]->arg);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, hc->plist_export_zebra_name[afi]);
+ hc->plist_export_zebra_name[afi] =
+ XSTRDUP(MTYPE_RFAPI_GROUP_CFG, argv[5]->arg);
hc->plist_export_zebra[afi] =
prefix_list_lookup(afi, argv[5]->arg);
/* TBD vnc_zebra_rh_reexport(bgp, afi); */
@@ -1936,10 +1923,9 @@ DEFUN (vnc_nve_export_no_routemap,
if (((argc > 5) && hc->routemap_export_bgp_name
&& strmatch(argv[5]->text, hc->routemap_export_bgp_name))
|| (argc <= 5)) {
-
- free(hc->routemap_export_bgp_name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG,
+ hc->routemap_export_bgp_name);
route_map_counter_decrement(hc->routemap_export_bgp);
- hc->routemap_export_bgp_name = NULL;
hc->routemap_export_bgp = NULL;
vnc_direct_bgp_reexport(bgp, AFI_IP);
vnc_direct_bgp_reexport(bgp, AFI_IP6);
@@ -1949,9 +1935,8 @@ DEFUN (vnc_nve_export_no_routemap,
&& strmatch(argv[5]->text, hc->routemap_export_zebra_name))
|| (argc <= 5)) {
- free(hc->routemap_export_zebra_name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, hc->routemap_export_zebra_name);
route_map_counter_decrement(hc->routemap_export_zebra);
- hc->routemap_export_zebra_name = NULL;
hc->routemap_export_zebra = NULL;
/* TBD vnc_zebra_rh_reexport(bgp, AFI_IP); */
/* TBD vnc_zebra_rh_reexport(bgp, AFI_IP6); */
@@ -1976,20 +1961,20 @@ DEFUN (vnc_nve_export_routemap,
hc = bgp->rfapi_cfg;
if (argv[2]->arg[0] == 'b') {
- if (hc->routemap_export_bgp_name)
- free(hc->routemap_export_bgp_name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, hc->routemap_export_bgp_name);
route_map_counter_decrement(hc->routemap_export_bgp);
- hc->routemap_export_bgp_name = strdup(argv[4]->arg);
+ hc->routemap_export_bgp_name = XSTRDUP(MTYPE_RFAPI_GROUP_CFG,
+ argv[4]->arg);
hc->routemap_export_bgp =
route_map_lookup_by_name(argv[4]->arg);
route_map_counter_increment(hc->routemap_export_bgp);
vnc_direct_bgp_reexport(bgp, AFI_IP);
vnc_direct_bgp_reexport(bgp, AFI_IP6);
} else {
- if (hc->routemap_export_zebra_name)
- free(hc->routemap_export_zebra_name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, hc->routemap_export_zebra_name);
route_map_counter_decrement(hc->routemap_export_zebra);
- hc->routemap_export_zebra_name = strdup(argv[4]->arg);
+ hc->routemap_export_zebra_name = XSTRDUP(MTYPE_RFAPI_GROUP_CFG,
+ argv[4]->arg);
hc->routemap_export_zebra =
route_map_lookup_by_name(argv[4]->arg);
route_map_counter_increment(hc->routemap_export_zebra);
@@ -2319,7 +2304,7 @@ static void bgp_rfapi_delete_nve_group(struct vty *vty, /* NULL = no output */
}
/* delete it */
- free(rfg->name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, rfg->name);
if (rfg->rfapi_import_table)
rfapiImportTableRefDelByIt(bgp, rfg->rfapi_import_table);
if (rfg->rt_import_list)
@@ -3410,7 +3395,7 @@ DEFUN_NOSH (vnc_l2_group,
vty_out(vty, "Can't allocate memory for L2 group\n");
return CMD_WARNING_CONFIG_FAILED;
}
- rfg->name = strdup(argv[2]->arg);
+ rfg->name = XSTRDUP(MTYPE_RFAPI_GROUP_CFG, argv[2]->arg);
/* add to tail of list */
listnode_add(bgp->rfapi_cfg->l2_groups, rfg);
}
@@ -3428,7 +3413,7 @@ static void bgp_rfapi_delete_l2_group(struct vty *vty, /* NULL = no output */
struct rfapi_l2_group_cfg *rfg)
{
/* delete it */
- free(rfg->name);
+ XFREE(MTYPE_RFAPI_GROUP_CFG, rfg->name);
if (rfg->rt_import_list)
ecommunity_free(&rfg->rt_import_list);
if (rfg->rt_export_list)
@@ -3590,7 +3575,9 @@ DEFUN (vnc_l2_group_rt,
switch (argv[1]->arg[0]) {
case 'b':
- do_export = 1; /* fall through */
+ do_export = 1;
+ do_import = 1;
+ break;
case 'i':
do_import = 1;
break;
@@ -3840,7 +3827,8 @@ struct rfapi_cfg *bgp_rfapi_cfg_new(struct rfapi_rfp_cfg *cfg)
static void bgp_rfapi_rfgn_list_delete(void *data)
{
struct rfapi_rfg_name *rfgn = data;
- free(rfgn->name);
+
+ XFREE(MTYPE_RFAPI_GROUP_CFG, rfgn->name);
rfgn_free(rfgn);
}
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index ff7137b..382af05 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -46,11 +46,6 @@
#include "bgpd/rfapi/rfapi_encap_tlv.h"
#include "bgpd/rfapi/vnc_debug.h"
-#ifdef HAVE_GLIBC_BACKTRACE
-/* for backtrace and friends */
-#include <execinfo.h>
-#endif /* HAVE_GLIBC_BACKTRACE */
-
#define DEBUG_CLEANUP 0
struct ethaddr rfapi_ethaddr0 = {{0}};
@@ -371,20 +366,19 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
for (bpi = (bn ? bgp_dest_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=%" PRIu64,
__func__, bpi, bpi->peer, bpi->type, bpi->sub_type,
- (bpi->extra ? bpi->extra->vnc.export.rfapi_handle
+ (bpi->extra ? bpi->extra->vnc->vnc.export.rfapi_handle
: NULL),
CHECK_FLAG(bpi->attr->flag,
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)
- ? bpi->attr->local_pref : 0));
-
- if (bpi->peer == peer && bpi->type == type
- && bpi->sub_type == sub_type && bpi->extra
- && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
+ ? bpi->attr->local_pref
+ : 0));
+ if (bpi->peer == peer && bpi->type == type &&
+ bpi->sub_type == sub_type && bpi->extra &&
+ bpi->extra->vnc->vnc.export.rfapi_handle == (void *)rfd) {
vnc_zlog_debug_verbose("%s: matched it", __func__);
break;
@@ -397,8 +391,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
* route. Leave the route itself in place.
* TBD add return code reporting of success/failure
*/
- if (!bpi || !bpi->extra
- || !bpi->extra->vnc.export.local_nexthops) {
+ if (!bpi || !bpi->extra ||
+ !bpi->extra->vnc->vnc.export.local_nexthops) {
/*
* no local nexthops
*/
@@ -414,16 +408,16 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
struct listnode *node;
struct rfapi_nexthop *pLnh = NULL;
- for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc.export.local_nexthops,
+ for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc->vnc.export
+ .local_nexthops,
node, pLnh)) {
-
if (prefix_same(&pLnh->addr, &lnh->addr)) {
break;
}
}
if (pLnh) {
- listnode_delete(bpi->extra->vnc.export.local_nexthops,
+ listnode_delete(bpi->extra->vnc->vnc.export.local_nexthops,
pLnh);
/* silly rabbit, listnode_delete doesn't invoke
@@ -464,8 +458,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
/*
* Delete local_nexthops list
*/
- if (bpi->extra && bpi->extra->vnc.export.local_nexthops)
- list_delete(&bpi->extra->vnc.export.local_nexthops);
+ if (bpi->extra && bpi->extra->vnc->vnc.export.local_nexthops)
+ list_delete(&bpi->extra->vnc->vnc.export.local_nexthops);
bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
bgp_path_info_delete(bn, bpi);
@@ -907,11 +901,10 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
*/
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
- && bpi->sub_type == sub_type && bpi->extra
- && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
-
+ * bpi->extra->vnc->vnc.export.rfapi_handle */
+ if (bpi->peer == rfd->peer && bpi->type == type &&
+ bpi->sub_type == sub_type && bpi->extra &&
+ bpi->extra->vnc->vnc.export.rfapi_handle == (void *)rfd) {
break;
}
}
@@ -923,11 +916,11 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
* what is advertised via BGP
*/
if (lnh) {
- if (!bpi->extra->vnc.export.local_nexthops) {
+ if (!bpi->extra->vnc->vnc.export.local_nexthops) {
/* TBD make arrangements to free when needed */
- bpi->extra->vnc.export.local_nexthops =
+ bpi->extra->vnc->vnc.export.local_nexthops =
list_new();
- bpi->extra->vnc.export.local_nexthops->del =
+ bpi->extra->vnc->vnc.export.local_nexthops->del =
rfapi_nexthop_free;
}
@@ -937,10 +930,9 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
struct listnode *node;
struct rfapi_nexthop *pLnh = NULL;
- for (ALL_LIST_ELEMENTS_RO(
- bpi->extra->vnc.export.local_nexthops,
- node, pLnh)) {
-
+ for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc->vnc.export
+ .local_nexthops,
+ node, pLnh)) {
if (prefix_same(&pLnh->addr, &lnh->addr)) {
break;
}
@@ -951,9 +943,9 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
*/
if (!pLnh) {
pLnh = rfapi_nexthop_new(lnh);
- listnode_add(
- bpi->extra->vnc.export.local_nexthops,
- pLnh);
+ listnode_add(bpi->extra->vnc->vnc.export
+ .local_nexthops,
+ pLnh);
}
}
@@ -1025,7 +1017,9 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
/* save backref to rfapi handle */
bgp_path_info_extra_get(new);
- new->extra->vnc.export.rfapi_handle = (void *)rfd;
+ new->extra->vnc = XCALLOC(MTYPE_BGP_ROUTE_EXTRA_VNC,
+ sizeof(struct bgp_path_info_extra_vnc));
+ new->extra->vnc->vnc.export.rfapi_handle = (void *)rfd;
encode_label(label_val, &new->extra->label[0]);
/* debug */
@@ -2091,24 +2085,7 @@ int rfapi_close(void *handle)
vnc_zlog_debug_verbose("%s: rfd=%p", __func__, rfd);
#ifdef RFAPI_WHO_IS_CALLING_ME
-#ifdef HAVE_GLIBC_BACKTRACE
-#define RFAPI_DEBUG_BACKTRACE_NENTRIES 5
- {
- void *buf[RFAPI_DEBUG_BACKTRACE_NENTRIES];
- char **syms;
- int i;
- size_t size;
-
- size = backtrace(buf, RFAPI_DEBUG_BACKTRACE_NENTRIES);
- syms = backtrace_symbols(buf, size);
- for (i = 0; i < size && i < RFAPI_DEBUG_BACKTRACE_NENTRIES;
- ++i) {
- vnc_zlog_debug_verbose("backtrace[%2d]: %s", i,
- syms[i]);
- }
- free(syms);
- }
-#endif
+ zlog_backtrace(LOG_INFO);
#endif
bgp = rfd->bgp;
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index a93e186..168b8e4 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -44,11 +44,6 @@
#include "bgpd/rfapi/rfapi_encap_tlv.h"
#include "bgpd/rfapi/vnc_debug.h"
-#ifdef HAVE_GLIBC_BACKTRACE
-/* for backtrace and friends */
-#include <execinfo.h>
-#endif /* HAVE_GLIBC_BACKTRACE */
-
#undef DEBUG_MONITOR_MOVE_SHORTER
#undef DEBUG_RETURNED_NHL
#undef DEBUG_ROUTE_COUNTERS
@@ -79,32 +74,6 @@ struct rfapi_withdraw {
/*
* DEBUG FUNCTION
- * It's evil and fiendish. It's compiler-dependent.
- * ? Might need LDFLAGS -rdynamic to produce all function names
- */
-void rfapiDebugBacktrace(void)
-{
-#ifdef HAVE_GLIBC_BACKTRACE
-#define RFAPI_DEBUG_BACKTRACE_NENTRIES 200
- void *buf[RFAPI_DEBUG_BACKTRACE_NENTRIES];
- char **syms;
- size_t i;
- size_t size;
-
- size = backtrace(buf, RFAPI_DEBUG_BACKTRACE_NENTRIES);
- syms = backtrace_symbols(buf, size);
-
- for (i = 0; i < size && i < RFAPI_DEBUG_BACKTRACE_NENTRIES; ++i) {
- vnc_zlog_debug_verbose("backtrace[%2zu]: %s", i, syms[i]);
- }
-
- free(syms);
-#else
-#endif
-}
-
-/*
- * DEBUG FUNCTION
* Count remote routes and compare with actively-maintained values.
* Abort if they disagree.
*/
@@ -428,18 +397,22 @@ int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p)
* advertisement
*/
if (bpi->extra) {
- switch (bpi->extra->vnc.import.un_family) {
+ switch (bpi->extra->vnc->vnc.import.un_family) {
case AF_INET:
if (p) {
- p->family = bpi->extra->vnc.import.un_family;
- p->u.prefix4 = bpi->extra->vnc.import.un.addr4;
+ p->family =
+ bpi->extra->vnc->vnc.import.un_family;
+ p->u.prefix4 =
+ bpi->extra->vnc->vnc.import.un.addr4;
p->prefixlen = IPV4_MAX_BITLEN;
}
return 0;
case AF_INET6:
if (p) {
- p->family = bpi->extra->vnc.import.un_family;
- p->u.prefix6 = bpi->extra->vnc.import.un.addr6;
+ p->family =
+ bpi->extra->vnc->vnc.import.un_family;
+ p->u.prefix6 =
+ bpi->extra->vnc->vnc.import.un.addr6;
p->prefixlen = IPV6_MAX_BITLEN;
}
return 0;
@@ -475,9 +448,11 @@ static struct bgp_path_info *rfapiBgpInfoCreate(struct attr *attr,
new->attr = bgp_attr_intern(attr);
bgp_path_info_extra_get(new);
+ new->extra->vnc = XCALLOC(MTYPE_BGP_ROUTE_EXTRA_VNC,
+ sizeof(struct bgp_path_info_extra_vnc));
if (prd) {
- new->extra->vnc.import.rd = *prd;
- new->extra->vnc.import.create_time = monotime(NULL);
+ new->extra->vnc->vnc.import.rd = *prd;
+ new->extra->vnc->vnc.import.create_time = monotime(NULL);
}
if (label)
encode_label(*label, &new->extra->label[0]);
@@ -842,13 +817,13 @@ static void rfapiBgpInfoChainFree(struct bgp_path_info *bpi)
* If there is a timer waiting to delete this bpi, cancel
* the timer and delete immediately
*/
- if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
- && bpi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) &&
+ bpi->extra->vnc->vnc.import.timer) {
struct rfapi_withdraw *wcb =
- EVENT_ARG(bpi->extra->vnc.import.timer);
+ EVENT_ARG(bpi->extra->vnc->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- EVENT_OFF(bpi->extra->vnc.import.timer);
+ EVENT_OFF(bpi->extra->vnc->vnc.import.timer);
}
next = bpi->next;
@@ -1136,15 +1111,15 @@ static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
*/
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) {
+ pfx_un1.family = bpi1->extra->vnc->vnc.import.un_family;
+ switch (bpi1->extra->vnc->vnc.import.un_family) {
case AF_INET:
pfx_un1.u.prefix4 =
- bpi1->extra->vnc.import.un.addr4;
+ bpi1->extra->vnc->vnc.import.un.addr4;
break;
case AF_INET6:
pfx_un1.u.prefix6 =
- bpi1->extra->vnc.import.un.addr6;
+ bpi1->extra->vnc->vnc.import.un.addr6;
break;
default:
pfx_un1.family = AF_UNSPEC;
@@ -1155,15 +1130,15 @@ static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
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) {
+ pfx_un2.family = bpi2->extra->vnc->vnc.import.un_family;
+ switch (bpi2->extra->vnc->vnc.import.un_family) {
case AF_INET:
pfx_un2.u.prefix4 =
- bpi2->extra->vnc.import.un.addr4;
+ bpi2->extra->vnc->vnc.import.un.addr4;
break;
case AF_INET6:
pfx_un2.u.prefix6 =
- bpi2->extra->vnc.import.un.addr6;
+ bpi2->extra->vnc->vnc.import.un.addr6;
break;
default:
pfx_un2.family = AF_UNSPEC;
@@ -1268,9 +1243,8 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
new->prefix = *rprefix;
- if (bpi->extra
- && decode_rd_type(bpi->extra->vnc.import.rd.val)
- == RD_TYPE_VNC_ETH) {
+ if (bpi->extra && decode_rd_type(bpi->extra->vnc->vnc.import.rd.val) ==
+ RD_TYPE_VNC_ETH) {
/* ethernet */
struct rfapi_vn_option *vo;
@@ -1289,7 +1263,8 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
&vo->v.l2addr.tag_id);
/* local_nve_id comes from lower byte of RD type */
- vo->v.l2addr.local_nve_id = bpi->extra->vnc.import.rd.val[1];
+ vo->v.l2addr.local_nve_id =
+ bpi->extra->vnc->vnc.import.rd.val[1];
/* label comes from MP_REACH_NLRI label */
vo->v.l2addr.label = decode_label(&bpi->extra->label[0]);
@@ -1300,8 +1275,9 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
* If there is an auxiliary prefix (i.e., host IP address),
* use it as the nexthop prefix instead of the query prefix
*/
- if (bpi->extra->vnc.import.aux_prefix.family) {
- rfapiQprefix2Rprefix(&bpi->extra->vnc.import.aux_prefix,
+ if (bpi->extra->vnc->vnc.import.aux_prefix.family) {
+ rfapiQprefix2Rprefix(&bpi->extra->vnc->vnc.import
+ .aux_prefix,
&new->prefix);
}
}
@@ -1402,15 +1378,16 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
/*
* use cached UN address from ENCAP route
*/
- new->un_address.addr_family = bpi->extra->vnc.import.un_family;
+ new->un_address.addr_family =
+ bpi->extra->vnc->vnc.import.un_family;
switch (new->un_address.addr_family) {
case AF_INET:
new->un_address.addr.v4 =
- bpi->extra->vnc.import.un.addr4;
+ bpi->extra->vnc->vnc.import.un.addr4;
break;
case AF_INET6:
new->un_address.addr.v6 =
- bpi->extra->vnc.import.un.addr6;
+ bpi->extra->vnc->vnc.import.un.addr6;
break;
default:
zlog_warn("%s: invalid UN addr family (%d) for bpi %p",
@@ -1537,7 +1514,7 @@ static int rfapiNhlAddNodeRoutes(
if (is_l2) {
/* L2 routes: semantic nexthop in aux_prefix; VN addr
* ain't it */
- pfx_vn = bpi->extra->vnc.import.aux_prefix;
+ pfx_vn = bpi->extra->vnc->vnc.import.aux_prefix;
} else {
rfapiNexthop2Prefix(bpi->attr, &pfx_vn);
}
@@ -1709,7 +1686,7 @@ struct rfapi_next_hop_entry *rfapiRouteNode2NextHopList(
#ifdef DEBUG_RETURNED_NHL
vnc_zlog_debug_verbose("%s: called with node pfx=%rRN", __func__, rn);
- rfapiDebugBacktrace();
+ zlog_backtrace(LOG_INFO);
#endif
rfapiQprefix2Rprefix(p, &rprefix);
@@ -2011,9 +1988,10 @@ static int rfapi_bi_peer_rd_cmp(const void *b1, const void *b2)
/*
* compare RDs
*/
- return vnc_prefix_cmp(
- (const struct prefix *)&bpi1->extra->vnc.import.rd,
- (const struct prefix *)&bpi2->extra->vnc.import.rd);
+ return vnc_prefix_cmp((const struct prefix *)&bpi1->extra->vnc->vnc
+ .import.rd,
+ (const struct prefix *)&bpi2->extra->vnc->vnc
+ .import.rd);
}
/*
@@ -2038,8 +2016,8 @@ static int rfapi_bi_peer_rd_aux_cmp(const void *b1, const void *b2)
/*
* compare RDs
*/
- rc = vnc_prefix_cmp((struct prefix *)&bpi1->extra->vnc.import.rd,
- (struct prefix *)&bpi2->extra->vnc.import.rd);
+ rc = vnc_prefix_cmp((struct prefix *)&bpi1->extra->vnc->vnc.import.rd,
+ (struct prefix *)&bpi2->extra->vnc->vnc.import.rd);
if (rc) {
return rc;
}
@@ -2056,19 +2034,18 @@ static int rfapi_bi_peer_rd_aux_cmp(const void *b1, const void *b2)
* because there is no guarantee of the order the test key and
* the real key will be passed)
*/
- 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))) {
-
+ if ((bpi1->extra->vnc->vnc.import.aux_prefix.family == AF_ETHERNET &&
+ (bpi1->extra->vnc->vnc.import.aux_prefix.prefixlen == 1)) ||
+ (bpi2->extra->vnc->vnc.import.aux_prefix.family == AF_ETHERNET &&
+ (bpi2->extra->vnc->vnc.import.aux_prefix.prefixlen == 1))) {
/*
* wildcard aux address specified
*/
return 0;
}
- return vnc_prefix_cmp(&bpi1->extra->vnc.import.aux_prefix,
- &bpi2->extra->vnc.import.aux_prefix);
+ return vnc_prefix_cmp(&bpi1->extra->vnc->vnc.import.aux_prefix,
+ &bpi2->extra->vnc->vnc.import.aux_prefix);
}
@@ -2086,7 +2063,7 @@ static void rfapiItBiIndexAdd(struct agg_node *rn, /* Import table VPN node */
assert(bpi->extra);
vnc_zlog_debug_verbose("%s: bpi %p, peer %p, rd %pRDP", __func__, bpi,
- bpi->peer, &bpi->extra->vnc.import.rd);
+ bpi->peer, &bpi->extra->vnc->vnc.import.rd);
sl = RFAPI_RDINDEX_W_ALLOC(rn);
if (!sl) {
@@ -2123,11 +2100,10 @@ static void rfapiItBiIndexDump(struct agg_node *rn)
char buf[RD_ADDRSTRLEN];
char buf_aux_pfx[PREFIX_STRLEN];
- prefix_rd2str(
- &k->extra->vnc.import.rd, buf, sizeof(buf),
- bgp_get_asnotation(k->peer ? k->peer->bgp : NULL));
- if (k->extra->vnc.import.aux_prefix.family) {
- prefix2str(&k->extra->vnc.import.aux_prefix,
+ prefix_rd2str(&k->extra->vnc->vnc.import.rd, buf, sizeof(buf),
+ bgp_get_asnotation(k->peer ? k->peer->bgp : NULL));
+ if (k->extra->vnc->vnc.import.aux_prefix.family) {
+ prefix2str(&k->extra->vnc->vnc.import.aux_prefix,
buf_aux_pfx, sizeof(buf_aux_pfx));
} else
strlcpy(buf_aux_pfx, "(none)", sizeof(buf_aux_pfx));
@@ -2146,6 +2122,7 @@ static struct bgp_path_info *rfapiItBiIndexSearch(
int rc;
struct bgp_path_info bpi_fake = {0};
struct bgp_path_info_extra bpi_extra = {0};
+ struct bgp_path_info_extra_vnc bpi_extra_vnc = { 0 };
struct bgp_path_info *bpi_result;
sl = RFAPI_RDINDEX(rn);
@@ -2178,27 +2155,25 @@ static struct bgp_path_info *rfapiItBiIndexSearch(
for (bpi_result = rn->info; bpi_result;
bpi_result = bpi_result->next) {
#ifdef DEBUG_BI_SEARCH
- vnc_zlog_debug_verbose(
- "%s: bpi has prd=%pRDP, peer=%p", __func__,
- &bpi_result->extra->vnc.import.rd,
- bpi_result->peer);
+ vnc_zlog_debug_verbose("%s: bpi has prd=%pRDP, peer=%p",
+ __func__,
+ &bpi_result->extra->vnc->vnc
+ .import.rd,
+ bpi_result->peer);
#endif
- if (peer == bpi_result->peer
- && !prefix_cmp((struct prefix *)&bpi_result->extra
- ->vnc.import.rd,
- (struct prefix *)prd)) {
-
+ if (peer == bpi_result->peer &&
+ !prefix_cmp((struct prefix *)&bpi_result->extra->vnc
+ ->vnc.import.rd,
+ (struct prefix *)prd)) {
#ifdef DEBUG_BI_SEARCH
vnc_zlog_debug_verbose(
"%s: peer and RD same, doing aux_prefix check",
__func__);
#endif
- if (!aux_prefix
- || !prefix_cmp(
- aux_prefix,
- &bpi_result->extra->vnc.import
- .aux_prefix)) {
-
+ if (!aux_prefix ||
+ !prefix_cmp(aux_prefix,
+ &bpi_result->extra->vnc->vnc
+ .import.aux_prefix)) {
#ifdef DEBUG_BI_SEARCH
vnc_zlog_debug_verbose("%s: match",
__func__);
@@ -2212,13 +2187,14 @@ static struct bgp_path_info *rfapiItBiIndexSearch(
bpi_fake.peer = peer;
bpi_fake.extra = &bpi_extra;
- bpi_fake.extra->vnc.import.rd = *prd;
+ bpi_fake.extra->vnc = &bpi_extra_vnc;
+ bpi_fake.extra->vnc->vnc.import.rd = *prd;
if (aux_prefix) {
- bpi_fake.extra->vnc.import.aux_prefix = *aux_prefix;
+ bpi_fake.extra->vnc->vnc.import.aux_prefix = *aux_prefix;
} else {
/* wildcard */
- bpi_fake.extra->vnc.import.aux_prefix.family = AF_ETHERNET;
- bpi_fake.extra->vnc.import.aux_prefix.prefixlen = 1;
+ bpi_fake.extra->vnc->vnc.import.aux_prefix.family = AF_ETHERNET;
+ bpi_fake.extra->vnc->vnc.import.aux_prefix.prefixlen = 1;
}
rc = skiplist_search(sl, (void *)&bpi_fake, (void *)&bpi_result);
@@ -2244,7 +2220,7 @@ static void rfapiItBiIndexDel(struct agg_node *rn, /* Import table VPN node */
int rc;
vnc_zlog_debug_verbose("%s: bpi %p, peer %p, rd %pRDP", __func__, bpi,
- bpi->peer, &bpi->extra->vnc.import.rd);
+ bpi->peer, &bpi->extra->vnc->vnc.import.rd);
sl = RFAPI_RDINDEX(rn);
assert(sl);
@@ -2292,11 +2268,10 @@ rfapiMonitorEncapAdd(struct rfapi_import_table *import_table,
RFAPI_MONITOR_ENCAP_W_ALLOC(rn) = m;
/* for easy lookup when deleting vpn route */
- vpn_bpi->extra->vnc.import.hme = m;
+ vpn_bpi->extra->vnc->vnc.import.hme = m;
- vnc_zlog_debug_verbose(
- "%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);
+ vnc_zlog_debug_verbose("%s: it=%p, vpn_bpi=%p, afi=%d, encap rn=%p, setting vpn_bpi->extra->vnc->vnc.import.hme=%p",
+ __func__, import_table, vpn_bpi, afi, rn, m);
RFAPI_CHECK_REFCOUNT(rn, SAFI_ENCAP, 0);
bgp_attr_intern(vpn_bpi->attr);
@@ -2310,7 +2285,7 @@ static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi)
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;
+ vpn_bpi->extra->vnc->vnc.import.hme;
if (hme) {
@@ -2334,7 +2309,7 @@ static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi)
agg_unlock_node(hme->rn); /* decr ref count */
XFREE(MTYPE_RFAPI_MONITOR_ENCAP, hme);
- vpn_bpi->extra->vnc.import.hme = NULL;
+ vpn_bpi->extra->vnc->vnc.import.hme = NULL;
}
}
}
@@ -2573,21 +2548,21 @@ static void rfapiCopyUnEncap2VPN(struct bgp_path_info *encap_bpi,
vnc_zlog_debug_verbose("%s: vpn_bpi->extra=%p", __func__,
vpn_bpi->extra);
- vpn_bpi->extra->vnc.import.un_family = AF_INET;
- vpn_bpi->extra->vnc.import.un.addr4 =
+ vpn_bpi->extra->vnc->vnc.import.un_family = AF_INET;
+ vpn_bpi->extra->vnc->vnc.import.un.addr4 =
encap_bpi->attr->mp_nexthop_global_in;
break;
case AF_INET6:
- vpn_bpi->extra->vnc.import.un_family = AF_INET6;
- vpn_bpi->extra->vnc.import.un.addr6 =
+ vpn_bpi->extra->vnc->vnc.import.un_family = AF_INET6;
+ vpn_bpi->extra->vnc->vnc.import.un.addr6 =
encap_bpi->attr->mp_nexthop_global;
break;
default:
zlog_warn("%s: invalid encap nexthop length: %d", __func__,
encap_bpi->attr->mp_nexthop_len);
- vpn_bpi->extra->vnc.import.un_family = AF_UNSPEC;
+ vpn_bpi->extra->vnc->vnc.import.un_family = AF_UNSPEC;
break;
}
}
@@ -2612,9 +2587,9 @@ rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table,
__func__);
return 1;
}
- vpn_bpi->extra->vnc.import.un_family = AF_UNSPEC;
- memset(&vpn_bpi->extra->vnc.import.un, 0,
- sizeof(vpn_bpi->extra->vnc.import.un));
+ vpn_bpi->extra->vnc->vnc.import.un_family = AF_UNSPEC;
+ memset(&vpn_bpi->extra->vnc->vnc.import.un, 0,
+ sizeof(vpn_bpi->extra->vnc->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);
@@ -2785,9 +2760,9 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
assert(bpi->extra);
if (lifetime > UINT32_MAX / 1001) {
/* sub-optimal case, but will probably never happen */
- bpi->extra->vnc.import.timer = NULL;
+ bpi->extra->vnc->vnc.import.timer = NULL;
event_add_timer(bm->master, timer_service_func, wcb, lifetime,
- &bpi->extra->vnc.import.timer);
+ &bpi->extra->vnc->vnc.import.timer);
} else {
static uint32_t jitter;
uint32_t lifetime_msec;
@@ -2801,10 +2776,10 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
lifetime_msec = (lifetime * 1000) + jitter;
- bpi->extra->vnc.import.timer = NULL;
+ bpi->extra->vnc->vnc.import.timer = NULL;
event_add_timer_msec(bm->master, timer_service_func, wcb,
lifetime_msec,
- &bpi->extra->vnc.import.timer);
+ &bpi->extra->vnc->vnc.import.timer);
}
/* re-sort route list (BGP_PATH_REMOVED routes are last) */
@@ -3017,17 +2992,16 @@ static void rfapiBgpInfoFilteredImportEncap(
* Compare RDs
*
* RD of import table bpi is in
- * bpi->extra->vnc.import.rd RD of info_orig is in prd
+ * bpi->extra->vnc->vnc.import.rd RD of info_orig is in prd
*/
if (!bpi->extra) {
vnc_zlog_debug_verbose("%s: no bpi->extra",
__func__);
continue;
}
- if (prefix_cmp(
- (struct prefix *)&bpi->extra->vnc.import.rd,
- (struct prefix *)prd)) {
-
+ if (prefix_cmp((struct prefix *)&bpi->extra->vnc->vnc
+ .import.rd,
+ (struct prefix *)prd)) {
vnc_zlog_debug_verbose("%s: prd does not match",
__func__);
continue;
@@ -3071,13 +3045,14 @@ static void rfapiBgpInfoFilteredImportEncap(
* a previous withdraw, we must cancel its
* timer.
*/
- if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
- && bpi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) &&
+ bpi->extra->vnc->vnc.import.timer) {
struct rfapi_withdraw *wcb = EVENT_ARG(
- bpi->extra->vnc.import.timer);
+ bpi->extra->vnc->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- EVENT_OFF(bpi->extra->vnc.import.timer);
+ EVENT_OFF(bpi->extra->vnc->vnc.import
+ .timer);
}
if (action == FIF_ACTION_UPDATE) {
@@ -3163,12 +3138,12 @@ static void rfapiBgpInfoFilteredImportEncap(
vnc_zlog_debug_verbose(
"%s: removing holddown bpi matching NVE of new route",
__func__);
- if (bpi->extra->vnc.import.timer) {
+ if (bpi->extra->vnc->vnc.import.timer) {
struct rfapi_withdraw *wcb =
- EVENT_ARG(bpi->extra->vnc.import.timer);
+ EVENT_ARG(bpi->extra->vnc->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- EVENT_OFF(bpi->extra->vnc.import.timer);
+ EVENT_OFF(bpi->extra->vnc->vnc.import.timer);
}
rfapiExpireEncapNow(import_table, rn, bpi);
}
@@ -3523,13 +3498,14 @@ void rfapiBgpInfoFilteredImportVPN(
* a previous withdraw, we must cancel its
* timer.
*/
- if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
- && bpi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) &&
+ bpi->extra->vnc->vnc.import.timer) {
struct rfapi_withdraw *wcb = EVENT_ARG(
- bpi->extra->vnc.import.timer);
+ bpi->extra->vnc->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- EVENT_OFF(bpi->extra->vnc.import.timer);
+ EVENT_OFF(bpi->extra->vnc->vnc.import
+ .timer);
import_table->holddown_count[afi] -= 1;
RFAPI_UPDATE_ITABLE_COUNT(
@@ -3602,7 +3578,7 @@ void rfapiBgpInfoFilteredImportVPN(
/* Not a big deal, just means VPN route got here first */
vnc_zlog_debug_verbose("%s: no encap route for vn addr %pFX",
__func__, &vn_prefix);
- info_new->extra->vnc.import.un_family = AF_UNSPEC;
+ info_new->extra->vnc->vnc.import.un_family = AF_UNSPEC;
}
if (rn) {
@@ -3624,7 +3600,7 @@ void rfapiBgpInfoFilteredImportVPN(
vnc_zlog_debug_verbose("%s: setting BPI's aux_prefix",
__func__);
- info_new->extra->vnc.import.aux_prefix = *aux_prefix;
+ info_new->extra->vnc->vnc.import.aux_prefix = *aux_prefix;
}
vnc_zlog_debug_verbose("%s: inserting bpi %p at prefix %pRN #%d",
@@ -3742,12 +3718,12 @@ void rfapiBgpInfoFilteredImportVPN(
vnc_zlog_debug_verbose(
"%s: removing holddown bpi matching NVE of new route",
__func__);
- if (bpi->extra->vnc.import.timer) {
+ if (bpi->extra->vnc->vnc.import.timer) {
struct rfapi_withdraw *wcb =
- EVENT_ARG(bpi->extra->vnc.import.timer);
+ EVENT_ARG(bpi->extra->vnc->vnc.import.timer);
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
- EVENT_OFF(bpi->extra->vnc.import.timer);
+ EVENT_OFF(bpi->extra->vnc->vnc.import.timer);
}
rfapiExpireVpnNow(import_table, rn, bpi, 0);
}
@@ -4479,12 +4455,10 @@ static void rfapiDeleteRemotePrefixesIt(
if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
if (!delete_holddown)
continue;
- if (bpi->extra->vnc.import.timer) {
- struct rfapi_withdraw *wcb =
- EVENT_ARG(
- bpi->extra->vnc
- .import
- .timer);
+ if (bpi->extra->vnc->vnc.import.timer) {
+ struct rfapi_withdraw *wcb = EVENT_ARG(
+ bpi->extra->vnc->vnc
+ .import.timer);
wcb->import_table
->holddown_count[afi] -=
@@ -4494,8 +4468,8 @@ static void rfapiDeleteRemotePrefixesIt(
afi, 1);
XFREE(MTYPE_RFAPI_WITHDRAW,
wcb);
- EVENT_OFF(bpi->extra->vnc.import
- .timer);
+ EVENT_OFF(bpi->extra->vnc->vnc
+ .import.timer);
}
} else {
if (!delete_active)
diff --git a/bgpd/rfapi/rfapi_import.h b/bgpd/rfapi/rfapi_import.h
index dd06afe..1a37e1c 100644
--- a/bgpd/rfapi/rfapi_import.h
+++ b/bgpd/rfapi/rfapi_import.h
@@ -57,8 +57,6 @@ struct rfapi_import_table {
extern uint8_t rfapiRfpCost(struct attr *attr);
-extern void rfapiDebugBacktrace(void);
-
extern void rfapiCheckRouteCount(void);
/*
diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c
index 3fe957b..146e0d1 100644
--- a/bgpd/rfapi/rfapi_monitor.c
+++ b/bgpd/rfapi/rfapi_monitor.c
@@ -354,7 +354,7 @@ struct agg_node *rfapiMonitorGetAttachNode(struct rfapi_descriptor *rfd,
* If there is a cached ENCAP UN address, it's a usable
* VPN route
*/
- if (bpi->extra && bpi->extra->vnc.import.un_family) {
+ if (bpi->extra && bpi->extra->vnc->vnc.import.un_family) {
break;
}
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index 5784f95..316904e 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -663,9 +663,8 @@ static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri,
/*
* VN options
*/
- if (bpi->extra
- && decode_rd_type(bpi->extra->vnc.import.rd.val)
- == RD_TYPE_VNC_ETH) {
+ if (bpi->extra && decode_rd_type(bpi->extra->vnc->vnc.import.rd.val) ==
+ RD_TYPE_VNC_ETH) {
/* ethernet route */
struct rfapi_vn_option *vo;
@@ -678,8 +677,8 @@ static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri,
/* copy from RD already stored in bpi, so we don't need it_node
*/
- memcpy(&vo->v.l2addr.macaddr, bpi->extra->vnc.import.rd.val + 2,
- ETH_ALEN);
+ memcpy(&vo->v.l2addr.macaddr,
+ bpi->extra->vnc->vnc.import.rd.val + 2, ETH_ALEN);
(void)rfapiEcommunityGetLNI(bgp_attr_get_ecommunity(bpi->attr),
&vo->v.l2addr.logical_net_id);
@@ -688,7 +687,8 @@ static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri,
&vo->v.l2addr.tag_id);
/* local_nve_id comes from RD */
- vo->v.l2addr.local_nve_id = bpi->extra->vnc.import.rd.val[1];
+ vo->v.l2addr.local_nve_id =
+ bpi->extra->vnc->vnc.import.rd.val[1];
/* label comes from MP_REACH_NLRI label */
vo->v.l2addr.label = decode_label(&bpi->extra->label[0]);
@@ -701,8 +701,8 @@ static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri,
/*
* If there is an auxiliary IP address (L2 can have it), copy it
*/
- if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
- ri->rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
+ if (bpi->extra && bpi->extra->vnc->vnc.import.aux_prefix.family) {
+ ri->rk.aux_prefix = bpi->extra->vnc->vnc.import.aux_prefix;
}
}
@@ -746,13 +746,13 @@ int rfapiRibPreloadBi(
memset((void *)&rk, 0, sizeof(rk));
rk.vn = *pfx_vn;
- rk.rd = bpi->extra->vnc.import.rd;
+ rk.rd = bpi->extra->vnc->vnc.import.rd;
/*
* If there is an auxiliary IP address (L2 can have it), copy it
*/
- if (bpi->extra->vnc.import.aux_prefix.family) {
- rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
+ if (bpi->extra->vnc->vnc.import.aux_prefix.family) {
+ rk.aux_prefix = bpi->extra->vnc->vnc.import.aux_prefix;
}
/*
@@ -1629,12 +1629,13 @@ void rfapiRibUpdatePendingNode(
ri = rfapi_info_new();
ri->rk.vn = pfx_nh;
- ri->rk.rd = bpi->extra->vnc.import.rd;
+ ri->rk.rd = bpi->extra->vnc->vnc.import.rd;
/*
* If there is an auxiliary IP address (L2 can have it), copy it
*/
- if (bpi->extra->vnc.import.aux_prefix.family) {
- ri->rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
+ if (bpi->extra->vnc->vnc.import.aux_prefix.family) {
+ ri->rk.aux_prefix =
+ bpi->extra->vnc->vnc.import.aux_prefix;
}
if (rfapiGetUnAddrOfVpnBi(bpi, &ri->un)) {
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index 252b6d6..5da99db 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -419,22 +419,21 @@ void rfapi_vty_out_vncinfo(struct vty *vty, const struct prefix *p,
else
vty_out(vty, " label=%u",
decode_label(&bpi->extra->label[0]));
+ }
- if (bpi->attr->srv6_l3vpn || bpi->attr->srv6_vpn) {
- struct in6_addr *sid_tmp =
- bpi->attr->srv6_l3vpn
- ? (&bpi->attr->srv6_l3vpn->sid)
- : (&bpi->attr->srv6_vpn->sid);
- vty_out(vty, " sid=%pI6", sid_tmp);
-
- if (bpi->attr->srv6_l3vpn &&
- bpi->attr->srv6_l3vpn->loc_block_len != 0) {
- vty_out(vty, " sid_structure=[%d,%d,%d,%d]",
- bpi->attr->srv6_l3vpn->loc_block_len,
- bpi->attr->srv6_l3vpn->loc_node_len,
- bpi->attr->srv6_l3vpn->func_len,
- bpi->attr->srv6_l3vpn->arg_len);
- }
+ if (bpi->attr->srv6_l3vpn || bpi->attr->srv6_vpn) {
+ struct in6_addr *sid_tmp =
+ bpi->attr->srv6_l3vpn ? (&bpi->attr->srv6_l3vpn->sid)
+ : (&bpi->attr->srv6_vpn->sid);
+ vty_out(vty, " sid=%pI6", sid_tmp);
+
+ if (bpi->attr->srv6_l3vpn &&
+ bpi->attr->srv6_l3vpn->loc_block_len != 0) {
+ vty_out(vty, " sid_structure=[%d,%d,%d,%d]",
+ bpi->attr->srv6_l3vpn->loc_block_len,
+ bpi->attr->srv6_l3vpn->loc_node_len,
+ bpi->attr->srv6_l3vpn->func_len,
+ bpi->attr->srv6_l3vpn->arg_len);
}
}
@@ -519,9 +518,10 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
if (!bpi)
return;
- if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra
- && bpi->extra->vnc.import.timer) {
- struct event *t = (struct event *)bpi->extra->vnc.import.timer;
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra &&
+ bpi->extra->vnc->vnc.import.timer) {
+ struct event *t =
+ (struct event *)bpi->extra->vnc->vnc.import.timer;
r = snprintf(p, REMAIN, " [%4lu] ",
event_timer_remain_second(t));
@@ -534,12 +534,12 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
if (bpi->extra) {
/* TBD This valid only for SAFI_MPLS_VPN, but not for encap */
- if (decode_rd_type(bpi->extra->vnc.import.rd.val)
- == RD_TYPE_VNC_ETH) {
+ if (decode_rd_type(bpi->extra->vnc->vnc.import.rd.val) ==
+ RD_TYPE_VNC_ETH) {
has_macaddr = 1;
- memcpy(macaddr.octet, bpi->extra->vnc.import.rd.val + 2,
- 6);
- l2hid = bpi->extra->vnc.import.rd.val[1];
+ memcpy(macaddr.octet,
+ bpi->extra->vnc->vnc.import.rd.val + 2, 6);
+ l2hid = bpi->extra->vnc->vnc.import.rd.val[1];
}
}
@@ -670,11 +670,11 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
l2o_buf.label, l2o_buf.logical_net_id, l2o_buf.local_nve_id,
HVTYNL);
}
- if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
+ if (bpi->extra && bpi->extra->vnc->vnc.import.aux_prefix.family) {
const char *sp;
- sp = rfapi_ntop(bpi->extra->vnc.import.aux_prefix.family,
- &bpi->extra->vnc.import.aux_prefix.u.prefix,
+ sp = rfapi_ntop(bpi->extra->vnc->vnc.import.aux_prefix.family,
+ &bpi->extra->vnc->vnc.import.aux_prefix.u.prefix,
buf, BUFSIZ);
buf[BUFSIZ - 1] = 0;
if (sp) {
@@ -1097,14 +1097,14 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
fp(out, "%-10s ", buf_lifetime);
}
- if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra
- && bpi->extra->vnc.import.timer) {
-
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra &&
+ bpi->extra->vnc->vnc.import.timer) {
uint32_t remaining;
time_t age;
char buf_age[BUFSIZ];
- struct event *t = (struct event *)bpi->extra->vnc.import.timer;
+ struct event *t =
+ (struct event *)bpi->extra->vnc->vnc.import.timer;
remaining = event_timer_remain_second(t);
#ifdef RFAPI_REGISTRATIONS_REPORT_AGE
@@ -1125,11 +1125,10 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
fp(out, "%-10s ", buf_age);
} else if (RFAPI_LOCAL_BI(bpi)) {
-
char buf_age[BUFSIZ];
- if (bpi->extra && bpi->extra->vnc.import.create_time) {
- rfapiFormatAge(bpi->extra->vnc.import.create_time,
+ if (bpi->extra && bpi->extra->vnc->vnc.import.create_time) {
+ rfapiFormatAge(bpi->extra->vnc->vnc.import.create_time,
buf_age, BUFSIZ);
} else {
buf_age[0] = '?';
@@ -1145,13 +1144,14 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
* print that on the next line
*/
- if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
+ if (bpi->extra && bpi->extra->vnc->vnc.import.aux_prefix.family) {
const char *sp;
- sp = rfapi_ntop(
- bpi->extra->vnc.import.aux_prefix.family,
- &bpi->extra->vnc.import.aux_prefix.u.prefix,
- buf_ntop, BUFSIZ);
+ sp = rfapi_ntop(bpi->extra->vnc->vnc.import.aux_prefix
+ .family,
+ &bpi->extra->vnc->vnc.import.aux_prefix
+ .u.prefix,
+ buf_ntop, BUFSIZ);
buf_ntop[BUFSIZ - 1] = 0;
if (sp && strcmp(buf_vn, sp) != 0) {
@@ -1545,10 +1545,9 @@ void rfapiPrintAdvertisedInfo(struct vty *vty, struct rfapi_descriptor *rfd,
vty_out(vty, " bd=%p%s", bd, HVTYNL);
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) {
-
+ if (bpi->peer == rfd->peer && bpi->type == type &&
+ bpi->sub_type == BGP_ROUTE_RFP && bpi->extra &&
+ bpi->extra->vnc->vnc.export.rfapi_handle == (void *)rfd) {
rfapiPrintBi(vty, bpi);
printed = 1;
}
@@ -4151,6 +4150,7 @@ static int rfapi_vty_show_nve_summary(struct vty *vty,
case SHOW_NVE_SUMMARY_RESPONSES:
rfapiRibShowResponsesSummary(vty);
+ break;
case SHOW_NVE_SUMMARY_UNKNOWN_NVES:
case SHOW_NVE_SUMMARY_MAX:
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 3fcc0e6..c067b7a 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -1696,8 +1696,8 @@ static void vnc_import_bgp_exterior_add_route_it(
have_usable_route = 1;
if (bpi_interior->extra) {
- prd = &bpi_interior->extra->vnc.import
- .rd;
+ prd = &bpi_interior->extra->vnc->vnc
+ .import.rd;
label = decode_label(
&bpi_interior->extra->label[0]);
} else
@@ -1865,8 +1865,8 @@ void vnc_import_bgp_exterior_del_route(
have_usable_route = 1;
if (bpi_interior->extra) {
- prd = &bpi_interior->extra->vnc.import
- .rd;
+ prd = &bpi_interior->extra->vnc->vnc
+ .import.rd;
label = decode_label(
&bpi_interior->extra->label[0]);
} else
@@ -2013,7 +2013,7 @@ void vnc_import_bgp_exterior_add_route_interior(
assert(pfx_exterior);
if (bpi_interior->extra) {
- prd = &bpi_interior->extra->vnc.import.rd;
+ prd = &bpi_interior->extra->vnc->vnc.import.rd;
label = decode_label(
&bpi_interior->extra->label[0]);
} else
@@ -2126,8 +2126,8 @@ void vnc_import_bgp_exterior_add_route_interior(
for (bpi = par->info; bpi; bpi = bpi->next) {
if (bpi->extra) {
- prd = &bpi->extra->vnc.import
- .rd;
+ prd = &bpi->extra->vnc->vnc
+ .import.rd;
label = decode_label(
&bpi->extra->label[0]);
} else
@@ -2148,8 +2148,8 @@ void vnc_import_bgp_exterior_add_route_interior(
* the new interior route at longer prefix.
*/
if (bpi_interior->extra) {
- prd = &bpi_interior->extra->vnc.import
- .rd;
+ prd = &bpi_interior->extra->vnc->vnc
+ .import.rd;
label = decode_label(
&bpi_interior->extra->label[0]);
} else
@@ -2267,7 +2267,7 @@ void vnc_import_bgp_exterior_add_route_interior(
* new interior route at the longer prefix.
*/
if (bpi_interior->extra) {
- prd = &bpi_interior->extra->vnc.import.rd;
+ prd = &bpi_interior->extra->vnc->vnc.import.rd;
label = decode_label(
&bpi_interior->extra->label[0]);
} else
@@ -2375,7 +2375,7 @@ void vnc_import_bgp_exterior_del_route_interior(
uint32_t label = 0;
if (bpi_interior->extra) {
- prd = &bpi_interior->extra->vnc.import.rd;
+ prd = &bpi_interior->extra->vnc->vnc.import.rd;
label = decode_label(&bpi_interior->extra->label[0]);
} else
prd = NULL;
@@ -2452,7 +2452,7 @@ void vnc_import_bgp_exterior_del_route_interior(
continue;
if (bpi->extra) {
- prd = &bpi->extra->vnc.import.rd;
+ prd = &bpi->extra->vnc->vnc.import.rd;
label = decode_label(
&bpi->extra->label[0]);
} else
@@ -2805,14 +2805,14 @@ void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi)
assert(bpi->extra);
- rfd = bpi->extra->vnc.export.rfapi_handle;
+ rfd = bpi->extra->vnc->vnc.export.rfapi_handle;
vnc_zlog_debug_verbose(
- "%s: deleting bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p [passing rfd=%p]",
+ "%s: deleting bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc->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
+ (bpi->extra ? bpi->extra->vnc->vnc
+ .export.rfapi_handle
: NULL),
rfd);
diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c
index c886bee..82c08ca 100644
--- a/bgpd/rfapi/vnc_zebra.c
+++ b/bgpd/rfapi/vnc_zebra.c
@@ -872,7 +872,7 @@ static zclient_handler *const vnc_handlers[] = {
void vnc_zebra_init(struct event_loop *master)
{
/* Set default values. */
- zclient_vnc = zclient_new(master, &zclient_options_default,
+ zclient_vnc = zclient_new(master, &zclient_options_auxiliary,
vnc_handlers, array_size(vnc_handlers));
zclient_init(zclient_vnc, ZEBRA_ROUTE_VNC, 0, &bgpd_privs);
}