From c77272a1c6b59f25ef58caab2a2c1db01c0d76df Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 8 Oct 2016 16:37:48 -0400 Subject: [PATCH] bgpd: Fix changes caused by index_sub change. The qobj changes changed how index_sub was handled. This commit leaves some issues still. Signed-off-by: Donald Sharp --- bgpd/rfapi/bgp_rfapi_cfg.c | 111 ++++++++----------------------------- bgpd/rfapi/bgp_rfapi_cfg.h | 6 ++ 2 files changed, 30 insertions(+), 87 deletions(-) diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index 2a8ba3dbdd..9e4eafa6cf 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -18,8 +18,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - - #include "lib/zebra.h" #include "lib/command.h" @@ -81,6 +79,8 @@ DEFINE_MTYPE(RFAPI, RFAPI_L2ADDR_OPT, "RFAPI L2 Address Option") DEFINE_MTYPE(RFAPI, RFAPI_AP, "RFAPI Advertised Prefix") DEFINE_MTYPE(RFAPI, RFAPI_MONITOR_ETH, "RFAPI Monitor Ethernet") +DEFINE_QOBJ_TYPE(rfapi_nve_group_cfg) +DEFINE_QOBJ_TYPE(rfapi_l2_group_cfg) /*********************************************************************** * RFAPI Support ***********************************************************************/ @@ -1407,7 +1407,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_no_prefixlist, "IPv6 routes\n" "Prefix-list for filtering redistributed routes\n") { struct bgp *bgp = vty->index; - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg) afi_t afi; if (!bgp) @@ -1422,9 +1422,6 @@ DEFUN (vnc_nve_group_redist_bgpdirect_no_prefixlist, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -1465,7 +1462,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_prefixlist, "prefix list name\n") { struct bgp *bgp = vty->index; - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); afi_t afi; if (!bgp) @@ -1480,9 +1477,6 @@ DEFUN (vnc_nve_group_redist_bgpdirect_prefixlist, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -1523,7 +1517,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_no_routemap, "Route-map for filtering redistributed routes\n") { struct bgp *bgp = vty->index; - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); if (!bgp) { @@ -1537,9 +1531,6 @@ DEFUN (vnc_nve_group_redist_bgpdirect_no_routemap, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -1568,7 +1559,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_routemap, "Route-map for filtering exported routes\n" "route map name\n") { struct bgp *bgp = vty->index; - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); if (!bgp) { @@ -1582,9 +1573,6 @@ DEFUN (vnc_nve_group_redist_bgpdirect_routemap, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -1928,7 +1916,7 @@ DEFUN (vnc_nve_group_export_no_prefixlist, "Prefix-list for filtering exported routes\n" "prefix list name\n") { struct bgp *bgp = vty->index; - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); afi_t afi; if (!bgp) @@ -1943,9 +1931,6 @@ DEFUN (vnc_nve_group_export_no_prefixlist, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -2005,7 +1990,7 @@ DEFUN (vnc_nve_group_export_prefixlist, "Prefix-list for filtering exported routes\n" "prefix list name\n") { struct bgp *bgp = vty->index; - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); afi_t afi; if (!bgp) @@ -2020,9 +2005,6 @@ DEFUN (vnc_nve_group_export_prefixlist, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -2072,7 +2054,7 @@ DEFUN (vnc_nve_group_export_no_routemap, "Route-map for filtering exported routes\n" "route map name\n") { struct bgp *bgp = vty->index; - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); if (!bgp) { @@ -2086,9 +2068,6 @@ DEFUN (vnc_nve_group_export_no_routemap, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -2138,7 +2117,7 @@ DEFUN (vnc_nve_group_export_routemap, "Route-map for filtering exported routes\n" "route map name\n") { struct bgp *bgp = vty->index; - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); if (!bgp) { @@ -2152,9 +2131,6 @@ DEFUN (vnc_nve_group_export_routemap, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -2721,9 +2697,8 @@ DEFUN (vnc_nve_group, * XXX subsequent calls will need to make sure this item is still * in the linked list and has the same name */ - vty->index_sub = rfg; + VTY_PUSH_CONTEXT_SUB (BGP_VNC_NVE_GROUP_NODE, rfg); - vty->node = BGP_VNC_NVE_GROUP_NODE; return CMD_SUCCESS; } @@ -2935,7 +2910,7 @@ DEFUN (vnc_nve_group_prefix, "IPv4 prefix\n" "IPv6 prefix\n") { - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); struct prefix p; int afi; struct route_table *rt; @@ -2950,9 +2925,6 @@ DEFUN (vnc_nve_group_prefix, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -3064,7 +3036,7 @@ DEFUN (vnc_nve_group_rt_import, "Import filter\n" "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n") { - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); struct bgp *bgp = vty->index; int rc; struct listnode *node; @@ -3078,9 +3050,6 @@ DEFUN (vnc_nve_group_rt_import, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -3143,7 +3112,7 @@ DEFUN (vnc_nve_group_rt_export, "Export filter\n" "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n") { - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); struct bgp *bgp = vty->index; int rc; @@ -3153,9 +3122,6 @@ DEFUN (vnc_nve_group_rt_export, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -3186,7 +3152,7 @@ DEFUN (vnc_nve_group_rt_both, "Export+import filters\n" "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n") { - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); struct bgp *bgp = vty->index; int rc; int is_export_bgp = 0; @@ -3200,9 +3166,6 @@ DEFUN (vnc_nve_group_rt_both, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -3281,7 +3244,7 @@ DEFUN (vnc_nve_group_l2rd, "Fixed value 1-255\n" "use the low-order octet of the NVE's VN address\n") { - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); struct bgp *bgp = vty->index; if (!bgp) @@ -3290,9 +3253,6 @@ DEFUN (vnc_nve_group_l2rd, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -3338,7 +3298,7 @@ DEFUN (vnc_nve_group_no_l2rd, NO_STR "Specify default Local Nve ID value to use in RD for L2 routes\n") { - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); struct bgp *bgp = vty->index; if (!bgp) @@ -3347,9 +3307,6 @@ DEFUN (vnc_nve_group_no_l2rd, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -3372,7 +3329,7 @@ DEFUN (vnc_nve_group_rd, { int ret; struct prefix_rd prd; - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); struct bgp *bgp = vty->index; if (!bgp) @@ -3381,9 +3338,6 @@ DEFUN (vnc_nve_group_rd, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -3455,7 +3409,7 @@ DEFUN (vnc_nve_group_responselifetime, "Response lifetime in seconds\n" "Infinite response lifetime\n") { unsigned int rspint; - struct rfapi_nve_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); struct bgp *bgp = vty->index; struct rfapi_descriptor *rfd; struct listnode *hdnode; @@ -3466,9 +3420,6 @@ DEFUN (vnc_nve_group_responselifetime, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg)) { @@ -3566,9 +3517,7 @@ DEFUN (vnc_l2_group, * XXX subsequent calls will need to make sure this item is still * in the linked list and has the same name */ - vty->index_sub = rfg; - - vty->node = BGP_VNC_L2_GROUP_NODE; + VTY_PUSH_CONTEXT_SUB (BGP_VNC_L2_GROUP_NODE, rfg); return CMD_SUCCESS; } @@ -3648,7 +3597,7 @@ DEFUN (vnc_l2_group_lni, "Specify Logical Network ID associated with group\n" "value\n") { - struct rfapi_l2_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg); struct bgp *bgp = vty->index; if (!bgp) @@ -3657,9 +3606,6 @@ DEFUN (vnc_l2_group_lni, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->l2_groups, rfg)) { @@ -3679,7 +3625,7 @@ DEFUN (vnc_l2_group_labels, "Specify label values associated with group\n" "Space separated list of label values <0-1048575>\n") { - struct rfapi_l2_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg); struct bgp *bgp = vty->index; struct list *ll; @@ -3689,9 +3635,6 @@ DEFUN (vnc_l2_group_labels, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->l2_groups, rfg)) { @@ -3725,7 +3668,7 @@ DEFUN (vnc_l2_group_no_labels, "Specify label values associated with L2 group\n" "Space separated list of label values <0-1048575>\n") { - struct rfapi_l2_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg); struct bgp *bgp = vty->index; struct list *ll; @@ -3735,9 +3678,6 @@ DEFUN (vnc_l2_group_no_labels, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->l2_groups, rfg)) { @@ -3772,7 +3712,7 @@ DEFUN (vnc_l2_group_rt, "Import filters\n" "A route target\n") { - struct rfapi_l2_group_cfg *rfg; + VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg); struct bgp *bgp = vty->index; int rc = CMD_SUCCESS; int do_import = 0; @@ -3803,9 +3743,6 @@ DEFUN (vnc_l2_group_rt, return CMD_WARNING; } - /* get saved pointer */ - rfg = vty->index_sub; - /* make sure it's still in list */ if (!listnode_lookup (bgp->rfapi_cfg->l2_groups, rfg)) { diff --git a/bgpd/rfapi/bgp_rfapi_cfg.h b/bgpd/rfapi/bgp_rfapi_cfg.h index 12cedd56f2..50ab3e27aa 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.h +++ b/bgpd/rfapi/bgp_rfapi_cfg.h @@ -36,7 +36,10 @@ struct rfapi_l2_group_cfg struct ecommunity *rt_import_list; struct ecommunity *rt_export_list; void *rfp_cfg; /* rfp owned group config */ + + QOBJ_FIELDS }; +DECLARE_QOBJ_TYPE(rfapi_l2_group_cfg) struct rfapi_nve_group_cfg { @@ -95,7 +98,10 @@ struct rfapi_nve_group_cfg char *routemap_redist_name[ZEBRA_ROUTE_MAX]; struct route_map *routemap_redist[ZEBRA_ROUTE_MAX]; + + QOBJ_FIELDS }; +DECLARE_QOBJ_TYPE(rfapi_nve_group_cfg) struct rfapi_rfg_name { -- 2.39.5