summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-12-02 20:02:06 +0100
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-12-02 20:02:06 +0100
commit0b11464604990198553c451e8c0bf830a44adcf1 (patch)
treebea0c1aca92b0e1f2277fc887b926c1719cf0f56 /bgpd
parentbgpd: Add missing argv handler for ipv4 prefix in `show...vpnv4` cmd (diff)
parentlib: Macroize CLI matcher tracing (diff)
downloadfrr-0b11464604990198553c451e8c0bf830a44adcf1.tar.xz
frr-0b11464604990198553c451e8c0bf830a44adcf1.zip
Merge remote-tracking branch 'osr_private_quagga/queue/osr/vtysh-generic' into vtysh-grammar
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/Makefile.am2
-rw-r--r--bgpd/bgp_aspath.c1
-rw-r--r--bgpd/bgp_debug.c1
-rw-r--r--bgpd/bgp_regex.h6
-rw-r--r--bgpd/bgp_route.c3
-rw-r--r--bgpd/bgp_routemap.c6
-rw-r--r--bgpd/bgp_updgrp.c1
-rw-r--r--bgpd/bgp_updgrp_packet.c1
-rw-r--r--bgpd/bgp_vty.c2
-rw-r--r--bgpd/bgpd.c7
-rw-r--r--bgpd/rfapi/bgp_rfapi_cfg.c284
-rw-r--r--bgpd/rfapi/rfapi.c114
-rw-r--r--bgpd/rfapi/rfapi_import.c3
-rw-r--r--bgpd/rfapi/rfapi_vty.c252
-rw-r--r--bgpd/rfapi/vnc_debug.c35
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c17
-rw-r--r--bgpd/rfp-example/librfp/rfp_example.c2
17 files changed, 349 insertions, 388 deletions
diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am
index 1730f5cdb..69c0504af 100644
--- a/bgpd/Makefile.am
+++ b/bgpd/Makefile.am
@@ -45,6 +45,8 @@ BGP_VNC_RFAPI_HD=rfapi/bgp_rfapi_cfg.h \
rfapi/vnc_export_table.h \
rfapi/vnc_import_bgp.h \
rfapi/vnc_zebra.h \
+ rfapi/vnc_export_bgp_p.h \
+ rfapi/vnc_import_bgp_p.h \
bgp_vnc_types.h $(BGP_VNC_RFP_HD)
else
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index fdec5c6b5..2e78c9a3b 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -25,7 +25,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "memory.h"
#include "vector.h"
#include "vty.h"
-#include "str.h"
#include "log.h"
#include "stream.h"
#include "command.h"
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index f6b050043..0c74ba545 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -25,7 +25,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "linklist.h"
#include "stream.h"
#include "command.h"
-#include "str.h"
#include "log.h"
#include "sockunion.h"
#include "memory.h"
diff --git a/bgpd/bgp_regex.h b/bgpd/bgp_regex.h
index 9fc832229..e5d28d1b7 100644
--- a/bgpd/bgp_regex.h
+++ b/bgpd/bgp_regex.h
@@ -26,11 +26,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifdef HAVE_LIBPCREPOSIX
# include <pcreposix.h>
#else
-# ifdef HAVE_GNU_REGEX
-# include <regex.h>
-# else
-# include "regex-gnu.h"
-# endif /* HAVE_GNU_REGEX */
+# include <regex.h>
#endif /* HAVE_LIBPCREPOSIX */
extern void bgp_regex_free (regex_t *regex);
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 9353d36f7..9a3b681e7 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -26,7 +26,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "command.h"
#include "stream.h"
#include "filter.h"
-#include "str.h"
#include "log.h"
#include "routemap.h"
#include "buffer.h"
@@ -7900,7 +7899,7 @@ DEFUN (show_ip_bgp_ipv4,
char *vrf = NULL;
afi_t afi = AFI_IP6;
safi_t safi = SAFI_UNICAST;
- int exact_match;
+ int exact_match = 0;
enum bgp_show_type sh_type = bgp_show_type_normal;
int idx = 0;
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 41c9155e4..aaf01ff77 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -32,11 +32,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifdef HAVE_LIBPCREPOSIX
# include <pcreposix.h>
#else
-# ifdef HAVE_GNU_REGEX
-# include <regex.h>
-# else
-# include "regex-gnu.h"
-# endif /* HAVE_GNU_REGEX */
+# include <regex.h>
#endif /* HAVE_LIBPCREPOSIX */
#include "buffer.h"
#include "sockunion.h"
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index 77b979e56..9e5ec4b26 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -37,7 +37,6 @@
#include "memory.h"
#include "filter.h"
#include "routemap.h"
-#include "str.h"
#include "log.h"
#include "plist.h"
#include "linklist.h"
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index 3cb3ddcde..e18ba235c 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -37,7 +37,6 @@
#include "memory.h"
#include "filter.h"
#include "routemap.h"
-#include "str.h"
#include "log.h"
#include "plist.h"
#include "linklist.h"
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 1f8cb0863..4edd09067 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -9105,6 +9105,8 @@ bgp_show_one_peer_group (struct vty *vty, struct peer_group *group)
af_str = "IPv4";
else if (afi == AFI_IP6)
af_str = "IPv6";
+ else
+ af_str = "???";
lr_count = listcount(group->listen_range[afi]);
if (lr_count)
{
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 1b79fb782..50d412633 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -13,7 +13,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-You should have received a copy of the GN5U General Public License
+You should have received a copy of the GNU General Public License
along with GNU Zebra; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
@@ -31,7 +31,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "memory.h"
#include "filter.h"
#include "routemap.h"
-#include "str.h"
#include "log.h"
#include "plist.h"
#include "linklist.h"
@@ -1019,8 +1018,6 @@ peer_free (struct peer *peer)
{
assert (peer->status == Deleted);
- bgp_unlock(peer->bgp);
-
/* this /ought/ to have been done already through bgp_stop earlier,
* but just to be sure..
*/
@@ -1086,6 +1083,8 @@ peer_free (struct peer *peer)
bfd_info_free(&(peer->bfd_info));
+ bgp_unlock(peer->bgp);
+
memset (peer, 0, sizeof (struct peer));
XFREE (MTYPE_BGP_PEER, peer);
diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c
index d064c50d8..fa62f7051 100644
--- a/bgpd/rfapi/bgp_rfapi_cfg.c
+++ b/bgpd/rfapi/bgp_rfapi_cfg.c
@@ -311,7 +311,7 @@ DEFUN (vnc_advertise_un_method,
}
- if (!strncmp (argv[0], "encap-safi", 7))
+ if (!strncmp (argv[2]->arg, "encap-safi", 7))
{
bgp->rfapi_cfg->flags |= BGP_VNC_CONFIG_ADV_UN_METHOD_ENCAP;
}
@@ -340,7 +340,7 @@ static int
set_ecom_list (
struct vty *vty,
int argc,
- const char **argv,
+ struct cmd_token **argv,
struct ecommunity **list)
{
struct ecommunity *ecom = NULL;
@@ -349,7 +349,7 @@ set_ecom_list (
for (; argc; --argc, ++argv)
{
- ecomadd = ecommunity_str2com (*argv, ECOMMUNITY_ROUTE_TARGET, 0);
+ ecomadd = ecommunity_str2com (argv[0]->arg, ECOMMUNITY_ROUTE_TARGET, 0);
if (!ecomadd)
{
vty_out (vty, "Malformed community-list value%s", VTY_NEWLINE);
@@ -391,7 +391,7 @@ DEFUN (vnc_defaults_rt_import,
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return set_ecom_list (vty, argc, argv,
+ return set_ecom_list (vty, argc - 2, argv + 2,
&bgp->rfapi_cfg->default_rt_import_list);
}
@@ -408,7 +408,7 @@ DEFUN (vnc_defaults_rt_export,
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return set_ecom_list (vty, argc, argv,
+ return set_ecom_list (vty, argc - 2, argv + 2,
&bgp->rfapi_cfg->default_rt_export_list);
}
@@ -427,11 +427,11 @@ DEFUN (vnc_defaults_rt_both,
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
return CMD_WARNING;
}
- rc =
- set_ecom_list (vty, argc, argv, &bgp->rfapi_cfg->default_rt_import_list);
+ rc = set_ecom_list (vty, argc - 2, argv + 2,
+ &bgp->rfapi_cfg->default_rt_import_list);
if (rc != CMD_SUCCESS)
return rc;
- return set_ecom_list (vty, argc, argv,
+ return set_ecom_list (vty, argc - 2, argv + 2,
&bgp->rfapi_cfg->default_rt_export_list);
}
@@ -451,17 +451,17 @@ DEFUN (vnc_defaults_rd,
return CMD_WARNING;
}
- if (!strncmp (argv[0], "auto:vn:", 8))
+ if (!strncmp (argv[1]->arg, "auto:vn:", 8))
{
/*
* use AF_UNIX to designate automatically-assigned RD
* auto:vn:nn where nn is a 2-octet quantity
*/
char *end = NULL;
- uint32_t value32 = strtoul (argv[0] + 8, &end, 10);
+ uint32_t value32 = strtoul (argv[1]->arg + 8, &end, 10);
uint16_t value = value32 & 0xffff;
- if (!*(argv[0] + 5) || *end)
+ if (!argv[1]->arg[8] || *end)
{
vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -485,7 +485,7 @@ DEFUN (vnc_defaults_rd,
else
{
- ret = str2prefix_rd (argv[0], &prd);
+ ret = str2prefix_rd (argv[1]->arg, &prd);
if (!ret)
{
vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
@@ -513,19 +513,19 @@ DEFUN (vnc_defaults_l2rd,
return CMD_WARNING;
}
- if (!strcmp (argv[0], "auto:vn"))
+ if (!strcmp (argv[1]->arg, "auto:vn"))
{
value = 0;
}
else
{
char *end = NULL;
- unsigned long value_l = strtoul (argv[0], &end, 10);
+ unsigned long value_l = strtoul (argv[1]->arg, &end, 10);
value = value_l & 0xff;
- if (!*(argv[0]) || *end)
+ if (!argv[1]->arg[0] || *end)
{
- vty_out (vty, "%% Malformed l2 nve ID \"%s\"%s", argv[0],
+ vty_out (vty, "%% Malformed l2 nve ID \"%s\"%s", argv[1]->arg,
VTY_NEWLINE);
return CMD_WARNING;
}
@@ -585,13 +585,13 @@ DEFUN (vnc_defaults_responselifetime,
if (!h)
return CMD_WARNING;
- if (!strcmp (argv[0], "infinite"))
+ if (!strcmp (argv[1]->arg, "infinite"))
{
rspint = RFAPI_INFINITE_LIFETIME;
}
else
{
- VTY_GET_INTEGER ("Response Lifetime", rspint, argv[0]);
+ VTY_GET_INTEGER ("Response Lifetime", rspint, argv[1]->arg);
if (rspint > INT32_MAX)
rspint = INT32_MAX; /* is really an int, not an unsigned int */
}
@@ -844,8 +844,8 @@ DEFUN (vnc_redistribute_rh_roo_localadmin,
return CMD_WARNING;
}
- localadmin = strtoul (argv[0], &endptr, 0);
- if (!*(argv[0]) || *endptr)
+ localadmin = strtoul (argv[4]->arg, &endptr, 0);
+ if (!argv[4]->arg[0] || *endptr)
{
vty_out (vty, "%% Malformed value%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -906,7 +906,7 @@ DEFUN (vnc_redistribute_mode,
}
- switch (*argv[0])
+ switch (argv[3]->arg[0])
{
case 'n':
newmode = VNC_REDIST_MODE_RFG;
@@ -965,7 +965,7 @@ DEFUN (vnc_redistribute_protocol,
return CMD_WARNING;
}
- if (rfapi_str2route_type (argv[0], argv[1], &afi, &type))
+ if (rfapi_str2route_type (argv[2]->arg, argv[3]->arg, &afi, &type))
{
vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -1018,7 +1018,7 @@ DEFUN (vnc_no_redistribute_protocol,
return CMD_WARNING;
}
- if (rfapi_str2route_type (argv[0], argv[1], &afi, &type))
+ if (rfapi_str2route_type (argv[3]->arg, argv[4]->arg, &afi, &type))
{
vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -1064,7 +1064,7 @@ DEFUN (vnc_redistribute_bgp_exterior,
return CMD_WARNING;
}
- if (rfapi_str2route_type (argv[0], "bgp-direct-to-nve-groups", &afi, &type))
+ if (rfapi_str2route_type (argv[2]->arg, "bgp-direct-to-nve-groups", &afi, &type))
{
vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -1072,9 +1072,9 @@ DEFUN (vnc_redistribute_bgp_exterior,
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[1]);
+ bgp->rfapi_cfg->redist_bgp_exterior_view_name = strdup (argv[5]->arg);
/* could be NULL if name is not defined yet */
- bgp->rfapi_cfg->redist_bgp_exterior_view = bgp_lookup_by_name (argv[1]);
+ bgp->rfapi_cfg->redist_bgp_exterior_view = bgp_lookup_by_name (argv[5]->arg);
VNC_REDIST_ENABLE (bgp, afi, type);
@@ -1108,10 +1108,10 @@ DEFUN (vnc_redistribute_nvegroup,
* OK if nve group doesn't exist yet; we'll set the pointer
* when the group is defined later
*/
- bgp->rfapi_cfg->rfg_redist = rfapi_group_lookup_byname (bgp, argv[0]);
+ bgp->rfapi_cfg->rfg_redist = rfapi_group_lookup_byname (bgp, argv[3]->arg);
if (bgp->rfapi_cfg->rfg_redist_name)
free (bgp->rfapi_cfg->rfg_redist_name);
- bgp->rfapi_cfg->rfg_redist_name = strdup (argv[0]);
+ bgp->rfapi_cfg->rfg_redist_name = strdup (argv[3]->arg);
vnc_redistribute_postchange (bgp);
@@ -1176,14 +1176,14 @@ DEFUN (vnc_redistribute_lifetime,
vnc_redistribute_prechange (bgp);
- if (!strcmp (argv[0], "infinite"))
+ if (!strcmp (argv[3]->arg, "infinite"))
{
bgp->rfapi_cfg->redist_lifetime = RFAPI_INFINITE_LIFETIME;
}
else
{
VTY_GET_INTEGER ("Response Lifetime", bgp->rfapi_cfg->redist_lifetime,
- argv[0]);
+ argv[3]->arg);
}
vnc_redistribute_postchange (bgp);
@@ -1221,7 +1221,7 @@ DEFUN (vnc_redist_bgpdirect_no_prefixlist,
return CMD_WARNING;
}
- if (!strcmp (argv[0], "bgp-direct"))
+ if (!strcmp (argv[3]->arg, "bgp-direct"))
{
route_type = ZEBRA_ROUTE_BGP_DIRECT;
}
@@ -1230,7 +1230,7 @@ DEFUN (vnc_redist_bgpdirect_no_prefixlist,
route_type = ZEBRA_ROUTE_BGP_DIRECT_EXT;
}
- if (!strcmp (argv[1], "ipv4"))
+ if (!strcmp (argv[4]->arg, "ipv4"))
{
afi = AFI_IP;
}
@@ -1280,7 +1280,7 @@ DEFUN (vnc_redist_bgpdirect_prefixlist,
return CMD_WARNING;
}
- if (!strcmp (argv[0], "bgp-direct"))
+ if (!strcmp (argv[2]->arg, "bgp-direct"))
{
route_type = ZEBRA_ROUTE_BGP_DIRECT;
}
@@ -1289,7 +1289,7 @@ DEFUN (vnc_redist_bgpdirect_prefixlist,
route_type = ZEBRA_ROUTE_BGP_DIRECT_EXT;
}
- if (!strcmp (argv[1], "ipv4"))
+ if (!strcmp (argv[3]->arg, "ipv4"))
{
afi = AFI_IP;
}
@@ -1302,8 +1302,8 @@ DEFUN (vnc_redist_bgpdirect_prefixlist,
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[2]);
- hc->plist_redist[route_type][afi] = prefix_list_lookup (afi, argv[2]);
+ hc->plist_redist_name[route_type][afi] = strdup (argv[5]->arg);
+ hc->plist_redist[route_type][afi] = prefix_list_lookup (afi, argv[5]->arg);
vnc_redistribute_postchange (bgp);
@@ -1336,7 +1336,7 @@ DEFUN (vnc_redist_bgpdirect_no_routemap,
return CMD_WARNING;
}
- if (!strcmp (argv[0], "bgp-direct"))
+ if (!strcmp (argv[3]->arg, "bgp-direct"))
{
route_type = ZEBRA_ROUTE_BGP_DIRECT;
}
@@ -1382,7 +1382,7 @@ DEFUN (vnc_redist_bgpdirect_routemap,
return CMD_WARNING;
}
- if (!strcmp (argv[0], "bgp-direct"))
+ if (!strcmp (argv[2]->arg, "bgp-direct"))
{
route_type = ZEBRA_ROUTE_BGP_DIRECT;
}
@@ -1395,8 +1395,8 @@ DEFUN (vnc_redist_bgpdirect_routemap,
if (hc->routemap_redist_name[route_type])
free (hc->routemap_redist_name[route_type]);
- hc->routemap_redist_name[route_type] = strdup (argv[1]);
- hc->routemap_redist[route_type] = route_map_lookup_by_name (argv[1]);
+ hc->routemap_redist_name[route_type] = strdup (argv[4]->arg);
+ hc->routemap_redist[route_type] = route_map_lookup_by_name (argv[4]->arg);
vnc_redistribute_postchange (bgp);
@@ -1441,7 +1441,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_no_prefixlist,
return CMD_WARNING;
}
- if (!strcmp (argv[0], "ipv4"))
+ if (!strcmp (argv[3]->arg, "ipv4"))
{
afi = AFI_IP;
}
@@ -1496,7 +1496,7 @@ DEFUN (vnc_nve_group_redist_bgpdirect_prefixlist,
return CMD_WARNING;
}
- if (!strcmp (argv[0], "ipv4"))
+ if (!strcmp (argv[2]->arg, "ipv4"))
{
afi = AFI_IP;
}
@@ -1509,9 +1509,9 @@ DEFUN (vnc_nve_group_redist_bgpdirect_prefixlist,
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] = strdup (argv[1]);
+ rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi] = strdup (argv[4]->arg);
rfg->plist_redist[ZEBRA_ROUTE_BGP_DIRECT][afi] =
- prefix_list_lookup (afi, argv[1]);
+ prefix_list_lookup (afi, argv[4]->arg);
vnc_redistribute_postchange (bgp);
@@ -1596,9 +1596,9 @@ DEFUN (vnc_nve_group_redist_bgpdirect_routemap,
if (rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT])
free (rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT]);
- rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT] = strdup (argv[0]);
+ rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT] = strdup (argv[3]->arg);
rfg->routemap_redist[ZEBRA_ROUTE_BGP_DIRECT] =
- route_map_lookup_by_name (argv[0]);
+ route_map_lookup_by_name (argv[3]->arg);
vnc_redistribute_postchange (bgp);
@@ -1639,10 +1639,10 @@ DEFUN (vnc_export_mode,
return CMD_WARNING;
}
- if (*argv[0] == 'b')
+ if (argv[2]->arg[0] == 'b')
{
oldmode = bgp->rfapi_cfg->flags & BGP_VNC_CONFIG_EXPORT_BGP_MODE_BITS;
- switch (*argv[1])
+ switch (argv[4]->arg[0])
{
case 'g':
newmode = BGP_VNC_CONFIG_EXPORT_BGP_MODE_GRP;
@@ -1687,7 +1687,7 @@ DEFUN (vnc_export_mode,
oldmode = bgp->rfapi_cfg->flags & BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_BITS;
bgp->rfapi_cfg->flags &= ~BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_BITS;
- switch (*argv[1])
+ switch (argv[4]->arg[0])
{
case 'g':
if (oldmode == BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_RH)
@@ -1767,9 +1767,9 @@ DEFUN (vnc_export_nvegroup,
return CMD_WARNING;
}
- rfg_new = rfapi_group_lookup_byname (bgp, argv[1]);
+ rfg_new = rfapi_group_lookup_byname (bgp, argv[5]->arg);
- if (*argv[0] == 'b')
+ if (argv[2]->arg[0] == 'b')
{
struct listnode *node;
@@ -1784,7 +1784,7 @@ DEFUN (vnc_export_nvegroup,
node, rfgn))
{
- if (!strcmp (rfgn->name, argv[1]))
+ if (!strcmp (rfgn->name, argv[5]->arg))
{
/* already in the list: we're done */
return CMD_SUCCESS;
@@ -1792,7 +1792,7 @@ DEFUN (vnc_export_nvegroup,
}
rfgn = rfgn_new ();
- rfgn->name = strdup (argv[1]);
+ rfgn->name = strdup (argv[5]->arg);
rfgn->rfg = rfg_new; /* OK if not set yet */
listnode_add (bgp->rfapi_cfg->rfg_export_direct_bgp_l, rfgn);
@@ -1822,7 +1822,7 @@ DEFUN (vnc_export_nvegroup,
node, rfgn))
{
- if (!strcmp (rfgn->name, argv[1]))
+ if (!strcmp (rfgn->name, argv[5]->arg))
{
/* already in the list: we're done */
return CMD_SUCCESS;
@@ -1830,7 +1830,7 @@ DEFUN (vnc_export_nvegroup,
}
rfgn = rfgn_new ();
- rfgn->name = strdup (argv[1]);
+ rfgn->name = strdup (argv[5]->arg);
rfgn->rfg = rfg_new; /* OK if not set yet */
listnode_add (bgp->rfapi_cfg->rfg_export_zebra_l, rfgn);
@@ -1875,13 +1875,13 @@ DEFUN (vnc_no_export_nvegroup,
return CMD_WARNING;
}
- if (*argv[0] == 'b')
+ if (argv[2]->arg[0] == 'b')
{
for (ALL_LIST_ELEMENTS (bgp->rfapi_cfg->rfg_export_direct_bgp_l,
node, nnode, rfgn))
{
- if (rfgn->name && !strcmp (rfgn->name, argv[1]))
+ if (rfgn->name && !strcmp (rfgn->name, argv[6]->arg))
{
zlog_debug ("%s: matched \"%s\"", __func__, rfgn->name);
if (rfgn->rfg)
@@ -1901,7 +1901,7 @@ DEFUN (vnc_no_export_nvegroup,
{
zlog_debug ("does rfg \"%s\" match?", rfgn->name);
- if (rfgn->name && !strcmp (rfgn->name, argv[1]))
+ if (rfgn->name && !strcmp (rfgn->name, argv[6]->arg))
{
if (rfgn->rfg)
vnc_zebra_del_group (bgp, rfgn->rfg);
@@ -1950,7 +1950,7 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
return CMD_WARNING;
}
- if (!strcmp (argv[1], "ipv4"))
+ if (!strcmp (argv[3]->arg, "ipv4"))
{
afi = AFI_IP;
}
@@ -1959,10 +1959,11 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
afi = AFI_IP6;
}
- if (*argv[0] == 'b')
+ if (argv[2]->arg[0] == 'b')
{
- if (((argc >= 3) && !strcmp (argv[2], rfg->plist_export_bgp_name[afi]))
- || (argc < 3))
+ if (((argc > 5)
+ && !strcmp (argv[5]->arg, rfg->plist_export_bgp_name[afi]))
+ || (argc <= 5))
{
if (rfg->plist_export_bgp_name[afi])
@@ -1975,9 +1976,9 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
}
else
{
- if (((argc >= 3)
- && !strcmp (argv[2], rfg->plist_export_zebra_name[afi]))
- || (argc < 3))
+ if (((argc > 5)
+ && !strcmp (argv[5]->arg, rfg->plist_export_zebra_name[afi]))
+ || (argc <= 5))
{
if (rfg->plist_export_zebra_name[afi])
free (rfg->plist_export_zebra_name[afi]);
@@ -2024,7 +2025,7 @@ DEFUN (vnc_nve_group_export_prefixlist,
return CMD_WARNING;
}
- if (!strcmp (argv[1], "ipv4"))
+ if (!strcmp (argv[2]->arg, "ipv4"))
{
afi = AFI_IP;
}
@@ -2033,12 +2034,12 @@ DEFUN (vnc_nve_group_export_prefixlist,
afi = AFI_IP6;
}
- if (*argv[0] == 'b')
+ if (argv[1]->arg[0] == 'b')
{
if (rfg->plist_export_bgp_name[afi])
free (rfg->plist_export_bgp_name[afi]);
- rfg->plist_export_bgp_name[afi] = strdup (argv[2]);
- rfg->plist_export_bgp[afi] = prefix_list_lookup (afi, argv[2]);
+ rfg->plist_export_bgp_name[afi] = strdup (argv[4]->arg);
+ rfg->plist_export_bgp[afi] = prefix_list_lookup (afi, argv[4]->arg);
vnc_direct_bgp_reexport_group_afi (bgp, rfg, afi);
@@ -2047,8 +2048,8 @@ DEFUN (vnc_nve_group_export_prefixlist,
{
if (rfg->plist_export_zebra_name[afi])
free (rfg->plist_export_zebra_name[afi]);
- rfg->plist_export_zebra_name[afi] = strdup (argv[2]);
- rfg->plist_export_zebra[afi] = prefix_list_lookup (afi, argv[2]);
+ rfg->plist_export_zebra_name[afi] = strdup (argv[4]->arg);
+ rfg->plist_export_zebra[afi] = prefix_list_lookup (afi, argv[4]->arg);
vnc_zebra_reexport_group_afi (bgp, rfg, afi);
}
@@ -2087,10 +2088,11 @@ DEFUN (vnc_nve_group_export_no_routemap,
return CMD_WARNING;
}
- if (*argv[0] == 'b')
+ if (argv[2]->arg[0] == 'b')
{
- if (((argc >= 2) && !strcmp (argv[1], rfg->routemap_export_bgp_name)) ||
- (argc < 2))
+ if (((argc > 4)
+ && !strcmp (argv[4]->arg, rfg->routemap_export_bgp_name))
+ || (argc <= 4))
{
if (rfg->routemap_export_bgp_name)
@@ -2104,8 +2106,9 @@ DEFUN (vnc_nve_group_export_no_routemap,
}
else
{
- if (((argc >= 2) && !strcmp (argv[1], rfg->routemap_export_zebra_name))
- || (argc < 2))
+ if (((argc > 4)
+ && !strcmp (argv[4]->arg, rfg->routemap_export_zebra_name))
+ || (argc <= 4))
{
if (rfg->routemap_export_zebra_name)
free (rfg->routemap_export_zebra_name);
@@ -2150,12 +2153,12 @@ DEFUN (vnc_nve_group_export_routemap,
return CMD_WARNING;
}
- if (*argv[0] == 'b')
+ if (argv[1]->arg[0] == 'b')
{
if (rfg->routemap_export_bgp_name)
free (rfg->routemap_export_bgp_name);
- rfg->routemap_export_bgp_name = strdup (argv[1]);
- rfg->routemap_export_bgp = route_map_lookup_by_name (argv[1]);
+ rfg->routemap_export_bgp_name = strdup (argv[3]->arg);
+ rfg->routemap_export_bgp = route_map_lookup_by_name (argv[3]->arg);
vnc_direct_bgp_reexport_group_afi (bgp, rfg, AFI_IP);
vnc_direct_bgp_reexport_group_afi (bgp, rfg, AFI_IP6);
}
@@ -2163,8 +2166,8 @@ DEFUN (vnc_nve_group_export_routemap,
{
if (rfg->routemap_export_zebra_name)
free (rfg->routemap_export_zebra_name);
- rfg->routemap_export_zebra_name = strdup (argv[1]);
- rfg->routemap_export_zebra = route_map_lookup_by_name (argv[1]);
+ rfg->routemap_export_zebra_name = strdup (argv[3]->arg);
+ rfg->routemap_export_zebra = route_map_lookup_by_name (argv[3]->arg);
vnc_zebra_reexport_group_afi (bgp, rfg, AFI_IP);
vnc_zebra_reexport_group_afi (bgp, rfg, AFI_IP6);
}
@@ -2199,7 +2202,7 @@ DEFUN (vnc_nve_export_no_prefixlist,
return CMD_WARNING;
}
- if (!strcmp (argv[1], "ipv4"))
+ if (!strcmp (argv[4]->arg, "ipv4"))
{
afi = AFI_IP;
}
@@ -2208,10 +2211,11 @@ DEFUN (vnc_nve_export_no_prefixlist,
afi = AFI_IP6;
}
- if (*argv[0] == 'b')
+ if (argv[3]->arg[0] == 'b')
{
- if (((argc >= 3) && !strcmp (argv[2], hc->plist_export_bgp_name[afi]))
- || (argc < 3))
+ if (((argc > 6)
+ && !strcmp (argv[6]->arg, hc->plist_export_bgp_name[afi]))
+ || (argc <= 6))
{
if (hc->plist_export_bgp_name[afi])
@@ -2223,8 +2227,9 @@ DEFUN (vnc_nve_export_no_prefixlist,
}
else
{
- if (((argc >= 3) && !strcmp (argv[2], hc->plist_export_zebra_name[afi]))
- || (argc < 3))
+ if (((argc > 6)
+ && !strcmp (argv[6]->arg, hc->plist_export_zebra_name[afi]))
+ || (argc <= 6))
{
if (hc->plist_export_zebra_name[afi])
@@ -2265,7 +2270,7 @@ DEFUN (vnc_nve_export_prefixlist,
return CMD_WARNING;
}
- if (!strcmp (argv[1], "ipv4"))
+ if (!strcmp (argv[3]->arg, "ipv4"))
{
afi = AFI_IP;
}
@@ -2274,20 +2279,20 @@ DEFUN (vnc_nve_export_prefixlist,
afi = AFI_IP6;
}
- if (*argv[0] == 'b')
+ 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[2]);
- hc->plist_export_bgp[afi] = prefix_list_lookup (afi, argv[2]);
+ hc->plist_export_bgp_name[afi] = strdup (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[2]);
- hc->plist_export_zebra[afi] = prefix_list_lookup (afi, argv[2]);
+ hc->plist_export_zebra_name[afi] = strdup (argv[5]->arg);
+ hc->plist_export_zebra[afi] = prefix_list_lookup (afi, argv[5]->arg);
/* TBD vnc_zebra_rh_reexport(bgp, afi); */
}
return CMD_SUCCESS;
@@ -2318,10 +2323,11 @@ DEFUN (vnc_nve_export_no_routemap,
return CMD_WARNING;
}
- if (*argv[0] == 'b')
+ if (argv[3]->arg[0] == 'b')
{
- if (((argc >= 2) && !strcmp (argv[1], hc->routemap_export_bgp_name)) ||
- (argc < 2))
+ if (((argc > 5)
+ && !strcmp (argv[5]->arg, hc->routemap_export_bgp_name))
+ || (argc <= 5))
{
if (hc->routemap_export_bgp_name)
@@ -2334,8 +2340,9 @@ DEFUN (vnc_nve_export_no_routemap,
}
else
{
- if (((argc >= 2) && !strcmp (argv[1], hc->routemap_export_zebra_name))
- || (argc < 2))
+ if (((argc > 5)
+ && !strcmp (argv[5]->arg, hc->routemap_export_zebra_name))
+ || (argc <= 5))
{
if (hc->routemap_export_zebra_name)
@@ -2374,12 +2381,12 @@ DEFUN (vnc_nve_export_routemap,
return CMD_WARNING;
}
- if (*argv[0] == 'b')
+ if (argv[2]->arg[0] == 'b')
{
if (hc->routemap_export_bgp_name)
free (hc->routemap_export_bgp_name);
- hc->routemap_export_bgp_name = strdup (argv[1]);
- hc->routemap_export_bgp = route_map_lookup_by_name (argv[1]);
+ hc->routemap_export_bgp_name = strdup (argv[4]->arg);
+ hc->routemap_export_bgp = route_map_lookup_by_name (argv[4]->arg);
vnc_direct_bgp_reexport (bgp, AFI_IP);
vnc_direct_bgp_reexport (bgp, AFI_IP6);
}
@@ -2387,8 +2394,8 @@ DEFUN (vnc_nve_export_routemap,
{
if (hc->routemap_export_zebra_name)
free (hc->routemap_export_zebra_name);
- hc->routemap_export_zebra_name = strdup (argv[1]);
- hc->routemap_export_zebra = route_map_lookup_by_name (argv[1]);
+ hc->routemap_export_zebra_name = strdup (argv[4]->arg);
+ hc->routemap_export_zebra = route_map_lookup_by_name (argv[4]->arg);
/* TBD vnc_zebra_rh_reexport(bgp, AFI_IP); */
/* TBD vnc_zebra_rh_reexport(bgp, AFI_IP6); */
}
@@ -2615,7 +2622,7 @@ DEFUN (vnc_nve_group,
}
/* Search for name */
- rfg = rfapi_group_lookup_byname (bgp, argv[0]);
+ rfg = rfapi_group_lookup_byname (bgp, argv[2]->arg);
if (!rfg)
{
@@ -2626,7 +2633,7 @@ DEFUN (vnc_nve_group,
vty_out (vty, "Can't allocate memory for NVE group%s", VTY_NEWLINE);
return CMD_WARNING;
}
- rfg->name = strdup (argv[0]);
+ rfg->name = strdup (argv[2]->arg);
/* add to tail of list */
listnode_add (bgp->rfapi_cfg->nve_groups_sequential, rfg);
@@ -2910,7 +2917,7 @@ DEFUN (vnc_no_nve_group,
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_rfapi_delete_named_nve_group (vty, bgp, argv[0]);
+ return bgp_rfapi_delete_named_nve_group (vty, bgp, argv[3]->arg);
}
DEFUN (vnc_nve_group_prefix,
@@ -2945,9 +2952,9 @@ DEFUN (vnc_nve_group_prefix,
return CMD_WARNING;
}
- if (!str2prefix (argv[1], &p))
+ if (!str2prefix (argv[2]->arg, &p))
{
- vty_out (vty, "Malformed prefix \"%s\"%s", argv[1], VTY_NEWLINE);
+ vty_out (vty, "Malformed prefix \"%s\"%s", argv[2]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -2958,7 +2965,7 @@ DEFUN (vnc_nve_group_prefix,
return CMD_WARNING;
}
- if (*(argv[0]) == 'u')
+ if (argv[1]->arg[0] == 'u')
{
rt = &(bgp->rfapi_cfg->nve_groups_un[afi]);
is_un_prefix = 1;
@@ -2982,7 +2989,7 @@ DEFUN (vnc_nve_group_prefix,
*/
vty_out (vty, "nve group \"%s\" already has \"%s\" prefix %s%s",
((struct rfapi_nve_group_cfg *) (rn->info))->name,
- argv[0], argv[1], VTY_NEWLINE);
+ argv[1]->arg, argv[2]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
else
@@ -3070,7 +3077,7 @@ DEFUN (vnc_nve_group_rt_import,
return CMD_WARNING;
}
- rc = set_ecom_list (vty, argc, argv, &rfg->rt_import_list);
+ rc = set_ecom_list (vty, argc - 2, argv + 2, &rfg->rt_import_list);
if (rc != CMD_SUCCESS)
return rc;
@@ -3147,7 +3154,7 @@ DEFUN (vnc_nve_group_rt_export,
vnc_redistribute_prechange (bgp);
}
- rc = set_ecom_list (vty, argc, argv, &rfg->rt_export_list);
+ rc = set_ecom_list (vty, argc - 2, argv + 2, &rfg->rt_export_list);
if (bgp->rfapi_cfg->rfg_redist == rfg)
{
@@ -3186,7 +3193,7 @@ DEFUN (vnc_nve_group_rt_both,
return CMD_WARNING;
}
- rc = set_ecom_list (vty, argc, argv, &rfg->rt_import_list);
+ rc = set_ecom_list (vty, argc - 2, argv + 2, &rfg->rt_import_list);
if (rc != CMD_SUCCESS)
return rc;
@@ -3238,7 +3245,7 @@ DEFUN (vnc_nve_group_rt_both,
vnc_redistribute_prechange (bgp);
}
- rc = set_ecom_list (vty, argc, argv, &rfg->rt_export_list);
+ rc = set_ecom_list (vty, argc - 2, argv + 2, &rfg->rt_export_list);
if (bgp->rfapi_cfg->rfg_redist == rfg)
{
@@ -3273,19 +3280,19 @@ DEFUN (vnc_nve_group_l2rd,
return CMD_WARNING;
}
- if (!strcmp (argv[0], "auto:vn"))
+ if (!strcmp (argv[1]->arg, "auto:vn"))
{
rfg->l2rd = 0;
}
else
{
char *end = NULL;
- unsigned long value_l = strtoul (argv[0], &end, 10);
+ unsigned long value_l = strtoul (argv[1]->arg, &end, 10);
uint8_t value = value_l & 0xff;
- if (!*(argv[0]) || *end)
+ if (!argv[1]->arg[0] || *end)
{
- vty_out (vty, "%% Malformed l2 nve ID \"%s\"%s", argv[0],
+ vty_out (vty, "%% Malformed l2 nve ID \"%s\"%s", argv[1]->arg,
VTY_NEWLINE);
return CMD_WARNING;
}
@@ -3358,17 +3365,17 @@ DEFUN (vnc_nve_group_rd,
return CMD_WARNING;
}
- if (!strncmp (argv[0], "auto:vn:", 8))
+ if (!strncmp (argv[1]->arg, "auto:vn:", 8))
{
/*
* use AF_UNIX to designate automatically-assigned RD
* auto:vn:nn where nn is a 2-octet quantity
*/
char *end = NULL;
- uint32_t value32 = strtoul (argv[0] + 8, &end, 10);
+ uint32_t value32 = strtoul (argv[1]->arg + 8, &end, 10);
uint16_t value = value32 & 0xffff;
- if (!*(argv[0] + 5) || *end)
+ if (!argv[1]->arg[8] || *end)
{
vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -3392,7 +3399,7 @@ DEFUN (vnc_nve_group_rd,
else
{
- ret = str2prefix_rd (argv[0], &prd);
+ ret = str2prefix_rd (argv[1]->arg, &prd);
if (!ret)
{
vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
@@ -3440,13 +3447,13 @@ DEFUN (vnc_nve_group_responselifetime,
return CMD_WARNING;
}
- if (!strcmp (argv[0], "infinite"))
+ if (!strcmp (argv[1]->arg, "infinite"))
{
rspint = RFAPI_INFINITE_LIFETIME;
}
else
{
- VTY_GET_INTEGER ("Response Lifetime", rspint, argv[0]);
+ VTY_GET_INTEGER ("Response Lifetime", rspint, argv[1]->arg);
}
rfg->response_lifetime = rspint;
@@ -3509,7 +3516,7 @@ DEFUN (vnc_l2_group,
}
/* Search for name */
- rfg = rfapi_l2_group_lookup_byname (bgp, argv[0]);
+ rfg = rfapi_l2_group_lookup_byname (bgp, argv[2]->arg);
if (!rfg)
{
@@ -3520,7 +3527,7 @@ DEFUN (vnc_l2_group,
vty_out (vty, "Can't allocate memory for L2 group%s", VTY_NEWLINE);
return CMD_WARNING;
}
- rfg->name = strdup (argv[0]);
+ rfg->name = strdup (argv[2]->arg);
/* add to tail of list */
listnode_add (bgp->rfapi_cfg->l2_groups, rfg);
}
@@ -3599,7 +3606,7 @@ DEFUN (vnc_no_l2_group,
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_rfapi_delete_named_l2_group (vty, bgp, argv[0]);
+ return bgp_rfapi_delete_named_l2_group (vty, bgp, argv[3]->arg);
}
@@ -3626,7 +3633,7 @@ DEFUN (vnc_l2_group_lni,
return CMD_WARNING;
}
- VTY_GET_INTEGER ("logical-network-id", rfg->logical_net_id, argv[0]);
+ VTY_GET_INTEGER ("logical-network-id", rfg->logical_net_id, argv[1]->arg);
return CMD_SUCCESS;
}
@@ -3661,10 +3668,13 @@ DEFUN (vnc_l2_group_labels,
ll = list_new ();
rfg->labels = ll;
}
+
+ argc -= 1;
+ argv += 1;
for (; argc; --argc, ++argv)
{
uint32_t label;
- VTY_GET_INTEGER_RANGE ("Label value", label, argv[0], 0, 1048575);
+ VTY_GET_INTEGER_RANGE ("Label value", label, argv[0]->arg, 0, 1048575);
if (!listnode_lookup (ll, (void *) (uintptr_t) label))
listnode_add (ll, (void *) (uintptr_t) label);
}
@@ -3705,10 +3715,12 @@ DEFUN (vnc_l2_group_no_labels,
return CMD_WARNING;
}
+ argc -= 2;
+ argv += 2;
for (; argc; --argc, ++argv)
{
uint32_t label;
- VTY_GET_INTEGER_RANGE ("Label value", label, argv[0], 0, 1048575);
+ VTY_GET_INTEGER_RANGE ("Label value", label, argv[0]->arg, 0, 1048575);
listnode_delete (ll, (void *) (uintptr_t) label);
}
@@ -3730,7 +3742,7 @@ DEFUN (vnc_l2_group_rt,
int do_import = 0;
int do_export = 0;
- switch (argv[0][0])
+ switch (argv[1]->arg[0])
{
case 'b':
do_export = 1; /* fall through */
@@ -3741,12 +3753,10 @@ DEFUN (vnc_l2_group_rt,
do_export = 1;
break;
default:
- vty_out (vty, "Unknown option, %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "Unknown option, %s%s", argv[1]->arg, VTY_NEWLINE);
return CMD_ERR_NO_MATCH;
}
- argc--;
- argv++;
- if (argc < 1)
+ if (argc < 3)
return CMD_ERR_INCOMPLETE;
if (!bgp)
@@ -3764,9 +3774,9 @@ DEFUN (vnc_l2_group_rt,
}
if (do_import)
- rc = set_ecom_list (vty, argc, argv, &rfg->rt_import_list);
+ rc = set_ecom_list (vty, argc - 2, argv + 2, &rfg->rt_import_list);
if (rc == CMD_SUCCESS && do_export)
- rc = set_ecom_list (vty, argc, argv, &rfg->rt_export_list);
+ rc = set_ecom_list (vty, argc - 2, argv + 2, &rfg->rt_export_list);
return rc;
}
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 985bcaf94..40e59f18e 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -3041,18 +3041,18 @@ DEFUN (
{
struct prefix pfx;
- if (!str2prefix (argv[1], &pfx))
+ if (!str2prefix (argv[5]->arg, &pfx))
{
- vty_out (vty, "Malformed address \"%s\"%s", argv[1], VTY_NEWLINE);
+ vty_out (vty, "Malformed address \"%s\"%s", argv[5]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
if (pfx.family != AF_INET && pfx.family != AF_INET6)
{
- vty_out (vty, "Invalid address \"%s\"%s", argv[1], VTY_NEWLINE);
+ vty_out (vty, "Invalid address \"%s\"%s", argv[5]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
- if (*(argv[0]) == 'c')
+ if (argv[4]->arg[0] == 'u')
{
rfapiPrintMatchingDescriptors (vty, NULL, &pfx);
}
@@ -3112,13 +3112,13 @@ DEFUN (debug_rfapi_open,
/*
* Get VN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[0], &vn)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[4]->arg, &vn)))
return rc;
/*
* Get UN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[1], &un)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[6]->arg, &un)))
return rc;
rc = rfapi_open (rfapi_get_rfp_start_val_by_bgp (bgp_get_default ()),
@@ -3153,21 +3153,21 @@ DEFUN (debug_rfapi_close_vn_un,
/*
* Get VN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[0], &vn)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[4]->arg, &vn)))
return rc;
/*
* Get UN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[1], &un)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[6]->arg, &un)))
return rc;
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
- argv[0], argv[1], VTY_NEWLINE);
+ argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -3191,11 +3191,11 @@ DEFUN (debug_rfapi_close_rfd,
int rc;
char *endptr = NULL;
- handle = (rfapi_handle) (uintptr_t) (strtoull (argv[0], &endptr, 16));
+ handle = (rfapi_handle) (uintptr_t) (strtoull (argv[4]->arg, &endptr, 16));
if (*endptr != '\0' || (uintptr_t) handle == UINTPTR_MAX)
{
- vty_out (vty, "Invalid value: %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "Invalid value: %s%s", argv[4]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -3234,46 +3234,46 @@ DEFUN (debug_rfapi_register_vn_un,
/*
* Get VN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[0], &vn)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[4]->arg, &vn)))
return rc;
/*
* Get UN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[1], &un)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[6]->arg, &un)))
return rc;
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
- argv[0], argv[1], VTY_NEWLINE);
+ argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
/*
* Get prefix to advertise
*/
- if (!str2prefix (argv[2], &pfx))
+ if (!str2prefix (argv[8]->arg, &pfx))
{
- vty_out (vty, "Malformed prefix \"%s\"%s", argv[2], VTY_NEWLINE);
+ vty_out (vty, "Malformed prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
if (pfx.family != AF_INET && pfx.family != AF_INET6)
{
- vty_out (vty, "Bad family for prefix \"%s\"%s", argv[2], VTY_NEWLINE);
+ vty_out (vty, "Bad family for prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
rfapiQprefix2Rprefix (&pfx, &hpfx);
- if (!strcmp (argv[3], "infinite"))
+ if (!strcmp (argv[10]->arg, "infinite"))
{
lifetime = RFAPI_INFINITE_LIFETIME;
}
else
{
- VTY_GET_INTEGER ("Lifetime", lifetime, argv[3]);
+ VTY_GET_INTEGER ("Lifetime", lifetime, argv[10]->arg);
}
@@ -3323,55 +3323,55 @@ DEFUN (debug_rfapi_register_vn_un_l2o,
/*
* Get VN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[0], &vn)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[4]->arg, &vn)))
return rc;
/*
* Get UN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[1], &un)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[6]->arg, &un)))
return rc;
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
- argv[0], argv[1], VTY_NEWLINE);
+ argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
/*
* Get prefix to advertise
*/
- if (!str2prefix (argv[2], &pfx))
+ if (!str2prefix (argv[8]->arg, &pfx))
{
- vty_out (vty, "Malformed prefix \"%s\"%s", argv[2], VTY_NEWLINE);
+ vty_out (vty, "Malformed prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
if (pfx.family != AF_INET && pfx.family != AF_INET6)
{
- vty_out (vty, "Bad family for prefix \"%s\"%s", argv[2], VTY_NEWLINE);
+ vty_out (vty, "Bad family for prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
rfapiQprefix2Rprefix (&pfx, &hpfx);
- if (!strcmp (argv[3], "infinite"))
+ if (!strcmp (argv[10]->arg, "infinite"))
{
lifetime = RFAPI_INFINITE_LIFETIME;
}
else
{
- VTY_GET_INTEGER ("Lifetime", lifetime, argv[3]);
+ VTY_GET_INTEGER ("Lifetime", lifetime, argv[10]->arg);
}
/* L2 option parsing START */
memset (optary, 0, sizeof (optary));
VTY_GET_INTEGER ("Logical Network ID",
- optary[opt_next].v.l2addr.logical_net_id, argv[5]);
- if ((rc = rfapiStr2EthAddr (argv[4], &optary[opt_next].v.l2addr.macaddr)))
+ optary[opt_next].v.l2addr.logical_net_id, argv[14]->arg);
+ if ((rc = rfapiStr2EthAddr (argv[12]->arg, &optary[opt_next].v.l2addr.macaddr)))
{
- vty_out (vty, "Bad mac address \"%s\"%s", argv[4], VTY_NEWLINE);
+ vty_out (vty, "Bad mac address \"%s\"%s", argv[12]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
optary[opt_next].type = RFAPI_VN_OPTION_TYPE_L2ADDR;
@@ -3420,35 +3420,35 @@ DEFUN (debug_rfapi_unregister_vn_un,
/*
* Get VN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[0], &vn)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[4]->arg, &vn)))
return rc;
/*
* Get UN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[1], &un)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[6]->arg, &un)))
return rc;
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
- argv[0], argv[1], VTY_NEWLINE);
+ argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
/*
* Get prefix to advertise
*/
- if (!str2prefix (argv[2], &pfx))
+ if (!str2prefix (argv[8]->arg, &pfx))
{
- vty_out (vty, "Malformed prefix \"%s\"%s", argv[2], VTY_NEWLINE);
+ vty_out (vty, "Malformed prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
if (pfx.family != AF_INET && pfx.family != AF_INET6)
{
- vty_out (vty, "Bad family for prefix \"%s\"%s", argv[2], VTY_NEWLINE);
+ vty_out (vty, "Bad family for prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
rfapiQprefix2Rprefix (&pfx, &hpfx);
@@ -3480,28 +3480,28 @@ DEFUN (debug_rfapi_query_vn_un,
/*
* Get VN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[0], &vn)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[4]->arg, &vn)))
return rc;
/*
* Get UN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[1], &un)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[6]->arg, &un)))
return rc;
/*
* Get target addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[2], &target)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[8]->arg, &target)))
return rc;
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
- argv[0], argv[1], VTY_NEWLINE);
+ argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -3554,28 +3554,32 @@ DEFUN (debug_rfapi_query_vn_un_l2o,
/*
* Get VN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[0], &vn)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[4]->arg, &vn)))
return rc;
/*
* Get UN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[1], &un)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[6]->arg, &un)))
return rc;
+#if 0 /* there is no IP target arg here ?????? */
/*
* Get target addr
*/
if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[2], &target)))
return rc;
-
+#else
+ vty_out (vty, "%% This command is broken.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+#endif
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
- argv[0], argv[1], VTY_NEWLINE);
+ argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -3583,13 +3587,13 @@ DEFUN (debug_rfapi_query_vn_un_l2o,
* Set up L2 parameters
*/
memset (&l2o_buf, 0, sizeof (l2o_buf));
- if (rfapiStr2EthAddr (argv[3], &l2o_buf.macaddr))
+ if (rfapiStr2EthAddr (argv[10]->arg, &l2o_buf.macaddr))
{
- vty_out (vty, "Bad mac address \"%s\"%s", argv[3], VTY_NEWLINE);
+ vty_out (vty, "Bad mac address \"%s\"%s", argv[10]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
- VTY_GET_INTEGER ("Logical Network ID", l2o_buf.logical_net_id, argv[2]);
+ VTY_GET_INTEGER ("Logical Network ID", l2o_buf.logical_net_id, argv[8]->arg);
/* construct option chain */
@@ -3651,28 +3655,28 @@ DEFUN (debug_rfapi_query_done_vn_un,
/*
* Get VN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[0], &vn)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[5]->arg, &vn)))
return rc;
/*
* Get UN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[1], &un)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[7]->arg, &un)))
return rc;
/*
* Get target addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[2], &target)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[9]->arg, &target)))
return rc;
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
- argv[0], argv[1], VTY_NEWLINE);
+ argv[5]->arg, argv[7]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -3794,21 +3798,21 @@ DEFUN (debug_rfapi_show_import_vn_un,
/*
* Get VN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[0], &vn)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[5]->arg, &vn)))
return rc;
/*
* Get UN addr
*/
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[1], &un)))
+ if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[7]->arg, &un)))
return rc;
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
- argv[0], argv[1], VTY_NEWLINE);
+ argv[5]->arg, argv[7]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -3847,7 +3851,7 @@ DEFUN (debug_rfapi_response_omit_self,
return CMD_WARNING;
}
- if (!strcmp (argv[0], "on"))
+ if (!strcmp (argv[3]->arg, "on"))
SET_FLAG (bgp->rfapi_cfg->flags, BGP_VNC_CONFIG_FILTER_SELF_FROM_RSP);
else
UNSET_FLAG (bgp->rfapi_cfg->flags, BGP_VNC_CONFIG_FILTER_SELF_FROM_RSP);
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 8783024f1..77da4f9ee 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -4414,7 +4414,8 @@ rfapiProcessPeerDown (struct peer *peer)
*/
bgp = bgp_get_default (); /* assume 1 instance for now */
- assert (bgp);
+ if (!bgp)
+ return;
h = bgp->rfapi;
assert (h);
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index 1b6d1312a..2ee1adbcc 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -2185,16 +2185,23 @@ rfapiAddDeleteLocalRfpPrefix (
static int
register_add (
struct vty *vty,
- const char *arg_prefix,
- const char *arg_vn,
- const char *arg_un,
- const char *arg_cost, /* optional */
- const char *arg_lifetime, /* optional */
- const char *arg_macaddr, /* optional */
- const char *arg_vni, /* mac present=>mandatory Virtual Network ID */
+ struct cmd_token *carg_prefix,
+ struct cmd_token *carg_vn,
+ struct cmd_token *carg_un,
+ struct cmd_token *carg_cost, /* optional */
+ struct cmd_token *carg_lifetime, /* optional */
+ struct cmd_token *carg_macaddr, /* optional */
+ struct cmd_token *carg_vni, /* mac present=>mandatory Virtual Network ID */
int argc,
- const char **argv)
+ struct cmd_token **argv)
{
+ const char *arg_prefix = carg_prefix->arg;
+ const char *arg_vn = carg_vn->arg;
+ const char *arg_un = carg_un->arg;
+ const char *arg_cost = carg_cost ? carg_cost->arg : NULL;
+ const char *arg_lifetime = carg_lifetime ? carg_lifetime->arg : NULL;
+ const char *arg_macaddr = carg_macaddr ? carg_macaddr->arg : NULL;
+ const char *arg_vni = carg_vni ? carg_vni->arg : NULL;
struct rfapi_ip_addr vn_address;
struct rfapi_ip_addr un_address;
struct prefix pfx;
@@ -2235,7 +2242,7 @@ register_add (
for (; argc; --argc, ++argv)
{
- if (!strcmp (*argv, "local-next-hop"))
+ if (!strcmp (argv[0]->arg, "local-next-hop"))
{
if (arg_lnh)
{
@@ -2250,9 +2257,9 @@ register_add (
return CMD_WARNING;
}
++argv, --argc;
- arg_lnh = *argv;
+ arg_lnh = argv[0]->arg;
}
- if (!strcmp (*argv, "local-cost"))
+ if (!strcmp (argv[0]->arg, "local-cost"))
{
if (arg_lnh_cost)
{
@@ -2267,7 +2274,7 @@ register_add (
return CMD_WARNING;
}
++argv, --argc;
- arg_lnh_cost = *argv;
+ arg_lnh_cost = argv[0]->arg;
}
}
@@ -2562,9 +2569,9 @@ DEFUN (add_vnc_prefix_cost_life_lnh,
"[local-next-hop (A.B.C.D|X:X::X:X)] [local-cost <0-255>]\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[0], argv[1], argv[2], argv[3], argv[4],
+ return register_add (vty, argv[3], argv[5], argv[7], argv[9], argv[11],
/* mac vni */
- NULL, NULL, argc, argv);
+ NULL, NULL, argc - 12, argv + 12);
}
DEFUN (add_vnc_prefix_life_cost_lnh,
@@ -2588,9 +2595,9 @@ DEFUN (add_vnc_prefix_life_cost_lnh,
"[local-next-hop (A.B.C.D|X:X::X:X)] [local-cost <0-255>]\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[0], argv[1], argv[2], argv[4], argv[3],
+ return register_add (vty, argv[3], argv[5], argv[7], argv[11], argv[9],
/* mac vni */
- NULL, NULL, argc, argv);
+ NULL, NULL, argc - 12, argv + 12);
}
DEFUN (add_vnc_prefix_cost_lnh,
@@ -2612,9 +2619,9 @@ DEFUN (add_vnc_prefix_cost_lnh,
"[local-next-hop (A.B.C.D|X:X::X:X)] [local-cost <0-255>]\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[0], argv[1], argv[2], argv[3], NULL,
+ return register_add (vty, argv[3], argv[5], argv[7], argv[9], NULL,
/* mac vni */
- NULL, NULL, argc, argv);
+ NULL, NULL, argc - 10, argv + 10);
}
DEFUN (add_vnc_prefix_life_lnh,
@@ -2636,9 +2643,9 @@ DEFUN (add_vnc_prefix_life_lnh,
"[local-next-hop (A.B.C.D|X:X::X:X)] [local-cost <0-255>]\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[0], argv[1], argv[2], NULL, argv[3],
+ return register_add (vty, argv[3], argv[5], argv[7], NULL, argv[9],
/* mac vni */
- NULL, NULL, argc, argv);
+ NULL, NULL, argc - 10, argv + 10);
}
DEFUN (add_vnc_prefix_lnh,
@@ -2658,9 +2665,9 @@ DEFUN (add_vnc_prefix_lnh,
"[local-next-hop (A.B.C.D|X:X::X:X)] [local-cost <0-255>]\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[0], argv[1], argv[2], NULL, NULL,
+ return register_add (vty, argv[3], argv[5], argv[7], NULL, NULL,
/* mac vni */
- NULL, NULL, argc, argv);
+ NULL, NULL, argc - 8, argv + 8);
}
/************************************************************************
@@ -2687,7 +2694,7 @@ DEFUN (add_vnc_prefix_cost_life,
"[local-next-hop (A.B.C.D|X:X::X:X)] [local-cost <0-255>]\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[0], argv[1], argv[2], argv[3], argv[4],
+ return register_add (vty, argv[3], argv[5], argv[7], argv[9], argv[11],
/* mac vni */
NULL, NULL, 0, NULL);
}
@@ -2713,7 +2720,7 @@ DEFUN (add_vnc_prefix_life_cost,
"[local-next-hop (A.B.C.D|X:X::X:X)] [local-cost <0-255>]\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[0], argv[1], argv[2], argv[4], argv[3],
+ return register_add (vty, argv[3], argv[5], argv[7], argv[11], argv[9],
/* mac vni */
NULL, NULL, 0, NULL);
}
@@ -2737,7 +2744,7 @@ DEFUN (add_vnc_prefix_cost,
"[local-next-hop (A.B.C.D|X:X::X:X)] [local-cost <0-255>]\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[0], argv[1], argv[2], argv[3], NULL,
+ return register_add (vty, argv[3], argv[5], argv[7], argv[9], NULL,
/* mac vni */
NULL, NULL, 0, NULL);
}
@@ -2761,7 +2768,7 @@ DEFUN (add_vnc_prefix_life,
"[local-next-hop (A.B.C.D|X:X::X:X)] [local-cost <0-255>]\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[0], argv[1], argv[2], NULL, argv[3],
+ return register_add (vty, argv[3], argv[5], argv[7], NULL, argv[9],
/* mac vni */
NULL, NULL, 0, NULL);
}
@@ -2783,7 +2790,7 @@ DEFUN (add_vnc_prefix,
"[local-next-hop (A.B.C.D|X:X::X:X)] [local-cost <0-255>]\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[0], argv[1], argv[2], NULL, NULL,
+ return register_add (vty, argv[3], argv[5], argv[7], NULL, NULL,
/* mac vni */
NULL, NULL, 0, NULL);
}
@@ -2815,9 +2822,9 @@ DEFUN (add_vnc_mac_vni_prefix_cost_life,
"Lifetime value in seconds\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[4], argv[2], argv[3], argv[5], argv[6],
+ return register_add (vty, argv[11], argv[7], argv[9], argv[13], argv[15],
/* mac vni */
- argv[0], argv[1], 0, NULL);
+ argv[3], argv[5], 0, NULL);
}
@@ -2843,9 +2850,9 @@ DEFUN (add_vnc_mac_vni_prefix_life,
"Lifetime value in seconds\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[4], argv[2], argv[3], NULL, argv[5],
+ return register_add (vty, argv[11], argv[7], argv[9], NULL, argv[13],
/* mac vni */
- argv[0], argv[1], 0, NULL);
+ argv[3], argv[5], 0, NULL);
}
DEFUN (add_vnc_mac_vni_prefix_cost,
@@ -2869,9 +2876,9 @@ DEFUN (add_vnc_mac_vni_prefix_cost,
"Administrative cost [default: 255]\n" "Administrative cost\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[4], argv[2], argv[3], argv[5], NULL,
+ return register_add (vty, argv[11], argv[7], argv[9], argv[13], NULL,
/* mac vni */
- argv[0], argv[1], 0, NULL);
+ argv[3], argv[5], 0, NULL);
}
DEFUN (add_vnc_mac_vni_prefix,
@@ -2893,9 +2900,9 @@ DEFUN (add_vnc_mac_vni_prefix,
"IPv4 prefix\n" "IPv6 prefix\n")
{
/* pfx vn un cost life */
- return register_add (vty, argv[4], argv[2], argv[3], NULL, NULL,
+ return register_add (vty, argv[11], argv[7], argv[9], NULL, NULL,
/* mac vni */
- argv[0], argv[1], 0, NULL);
+ argv[3], argv[5], 0, NULL);
}
DEFUN (add_vnc_mac_vni_cost_life,
@@ -2919,9 +2926,9 @@ DEFUN (add_vnc_mac_vni_cost_life,
"Lifetime value in seconds\n")
{
/* pfx vn un cost life */
- return register_add (vty, NULL, argv[2], argv[3], argv[4], argv[5],
+ return register_add (vty, NULL, argv[7], argv[9], argv[11], argv[13],
/* mac vni */
- argv[0], argv[1], 0, NULL);
+ argv[3], argv[5], 0, NULL);
}
@@ -2943,9 +2950,9 @@ DEFUN (add_vnc_mac_vni_cost,
"Administrative cost [default: 255]\n" "Administrative cost\n")
{
/* pfx vn un cost life */
- return register_add (vty, NULL, argv[2], argv[3], argv[4], NULL,
+ return register_add (vty, NULL, argv[7], argv[9], argv[11], NULL,
/* mac vni */
- argv[0], argv[1], 0, NULL);
+ argv[3], argv[5], 0, NULL);
}
@@ -2968,9 +2975,9 @@ DEFUN (add_vnc_mac_vni_life,
"Lifetime value in seconds\n")
{
/* pfx vn un cost life */
- return register_add (vty, NULL, argv[2], argv[3], NULL, argv[4],
+ return register_add (vty, NULL, argv[7], argv[9], NULL, argv[11],
/* mac vni */
- argv[0], argv[1], 0, NULL);
+ argv[3], argv[5], 0, NULL);
}
@@ -2990,9 +2997,9 @@ DEFUN (add_vnc_mac_vni,
"UN IPv4 interface address\n" "UN IPv6 interface address\n")
{
/* pfx vn un cost life */
- return register_add (vty, NULL, argv[2], argv[3], NULL, NULL,
+ return register_add (vty, NULL, argv[7], argv[9], NULL, NULL,
/* mac vni */
- argv[0], argv[1], 0, NULL);
+ argv[3], argv[5], 0, NULL);
}
/************************************************************************
@@ -3107,13 +3114,18 @@ nve_addr_cmp (void *k1, void *k2)
static int
parse_deleter_args (
struct vty *vty,
- const char *arg_prefix,
- const char *arg_vn,
- const char *arg_un,
- const char *arg_l2addr,
- const char *arg_vni,
+ struct cmd_token *carg_prefix,
+ struct cmd_token *carg_vn,
+ struct cmd_token *carg_un,
+ struct cmd_token *carg_l2addr,
+ struct cmd_token *carg_vni,
struct rfapi_local_reg_delete_arg *rcdarg)
{
+ const char *arg_prefix = carg_prefix ? carg_prefix->arg : NULL;
+ const char *arg_vn = carg_vn ? carg_vn->arg : NULL;
+ const char *arg_un = carg_un ? carg_un->arg : NULL;
+ const char *arg_l2addr = carg_l2addr ? carg_l2addr->arg : NULL;
+ const char *arg_vni = carg_vni ? carg_vni->arg : NULL;
int rc = CMD_WARNING;
memset (rcdarg, 0, sizeof (struct rfapi_local_reg_delete_arg));
@@ -3734,7 +3746,7 @@ DEFUN (clear_vnc_nve_vn_un,
int rc;
if ((rc =
- parse_deleter_args (vty, NULL, argv[0], argv[1], NULL, NULL, &cda)))
+ parse_deleter_args (vty, NULL, argv[4], argv[6], NULL, NULL, &cda)))
return rc;
cda.vty = vty;
@@ -3764,7 +3776,7 @@ DEFUN (clear_vnc_nve_un_vn,
int rc;
if ((rc =
- parse_deleter_args (vty, NULL, argv[1], argv[0], NULL, NULL, &cda)))
+ parse_deleter_args (vty, NULL, argv[6], argv[4], NULL, NULL, &cda)))
return rc;
cda.vty = vty;
@@ -3790,7 +3802,7 @@ DEFUN (clear_vnc_nve_vn,
struct rfapi_local_reg_delete_arg cda;
int rc;
- if ((rc = parse_deleter_args (vty, NULL, argv[0], NULL, NULL, NULL, &cda)))
+ if ((rc = parse_deleter_args (vty, NULL, argv[4], NULL, NULL, NULL, &cda)))
return rc;
cda.vty = vty;
@@ -3815,7 +3827,7 @@ DEFUN (clear_vnc_nve_un,
struct rfapi_local_reg_delete_arg cda;
int rc;
- if ((rc = parse_deleter_args (vty, NULL, NULL, argv[0], NULL, NULL, &cda)))
+ if ((rc = parse_deleter_args (vty, NULL, NULL, argv[6], NULL, NULL, &cda)))
return rc;
cda.vty = vty;
@@ -3858,7 +3870,7 @@ DEFUN (clear_vnc_prefix_vn_un,
int rc;
if ((rc =
- parse_deleter_args (vty, argv[0], argv[1], argv[2], NULL, NULL, &cda)))
+ parse_deleter_args (vty, argv[3], argv[5], argv[7], NULL, NULL, &cda)))
return rc;
cda.vty = vty;
clear_vnc_prefix (&cda);
@@ -3888,7 +3900,7 @@ DEFUN (clear_vnc_prefix_un_vn,
int rc;
if ((rc =
- parse_deleter_args (vty, argv[0], argv[2], argv[1], NULL, NULL, &cda)))
+ parse_deleter_args (vty, argv[3], argv[7], argv[5], NULL, NULL, &cda)))
return rc;
cda.vty = vty;
clear_vnc_prefix (&cda);
@@ -3914,7 +3926,7 @@ DEFUN (clear_vnc_prefix_un,
int rc;
if ((rc =
- parse_deleter_args (vty, argv[0], NULL, argv[1], NULL, NULL, &cda)))
+ parse_deleter_args (vty, argv[3], NULL, argv[5], NULL, NULL, &cda)))
return rc;
cda.vty = vty;
clear_vnc_prefix (&cda);
@@ -3940,7 +3952,7 @@ DEFUN (clear_vnc_prefix_vn,
int rc;
if ((rc =
- parse_deleter_args (vty, argv[0], argv[1], NULL, NULL, NULL, &cda)))
+ parse_deleter_args (vty, argv[3], argv[5], NULL, NULL, NULL, &cda)))
return rc;
cda.vty = vty;
clear_vnc_prefix (&cda);
@@ -3962,7 +3974,7 @@ DEFUN (clear_vnc_prefix_all,
struct rfapi_local_reg_delete_arg cda;
int rc;
- if ((rc = parse_deleter_args (vty, argv[0], NULL, NULL, NULL, NULL, &cda)))
+ if ((rc = parse_deleter_args (vty, argv[3], NULL, NULL, NULL, NULL, &cda)))
return rc;
cda.vty = vty;
clear_vnc_prefix (&cda);
@@ -4004,7 +4016,7 @@ DEFUN (clear_vnc_mac_vn_un,
/* pfx vn un L2 VNI */
if ((rc =
- parse_deleter_args (vty, NULL, argv[2], argv[3], argv[0], argv[1],
+ parse_deleter_args (vty, NULL, argv[7], argv[9], argv[3], argv[5],
&cda)))
return rc;
cda.vty = vty;
@@ -4038,7 +4050,7 @@ DEFUN (clear_vnc_mac_un_vn,
/* pfx vn un L2 VNI */
if ((rc =
- parse_deleter_args (vty, NULL, argv[3], argv[2], argv[0], argv[1],
+ parse_deleter_args (vty, NULL, argv[9], argv[7], argv[3], argv[5],
&cda)))
return rc;
cda.vty = vty;
@@ -4068,7 +4080,7 @@ DEFUN (clear_vnc_mac_un,
/* pfx vn un L2 VNI */
if ((rc =
- parse_deleter_args (vty, NULL, NULL, argv[2], argv[0], argv[1], &cda)))
+ parse_deleter_args (vty, NULL, NULL, argv[7], argv[3], argv[5], &cda)))
return rc;
cda.vty = vty;
clear_vnc_prefix (&cda);
@@ -4097,7 +4109,7 @@ DEFUN (clear_vnc_mac_vn,
/* pfx vn un L2 VNI */
if ((rc =
- parse_deleter_args (vty, NULL, argv[2], NULL, argv[0], argv[1], &cda)))
+ parse_deleter_args (vty, NULL, argv[7], NULL, argv[3], argv[5], &cda)))
return rc;
cda.vty = vty;
clear_vnc_prefix (&cda);
@@ -4123,7 +4135,7 @@ DEFUN (clear_vnc_mac_all,
/* pfx vn un L2 VNI */
if ((rc =
- parse_deleter_args (vty, NULL, NULL, NULL, argv[0], argv[1], &cda)))
+ parse_deleter_args (vty, NULL, NULL, NULL, argv[3], argv[5], &cda)))
return rc;
cda.vty = vty;
clear_vnc_prefix (&cda);
@@ -4165,7 +4177,7 @@ DEFUN (clear_vnc_mac_vn_un_prefix,
/* pfx vn un L2 VNI */
if ((rc =
- parse_deleter_args (vty, argv[4], argv[2], argv[3], argv[0], argv[1],
+ parse_deleter_args (vty, argv[11], argv[7], argv[9], argv[3], argv[5],
&cda)))
return rc;
cda.vty = vty;
@@ -4199,7 +4211,7 @@ DEFUN (clear_vnc_mac_un_vn_prefix,
/* pfx vn un L2 VNI */
if ((rc =
- parse_deleter_args (vty, argv[4], argv[3], argv[2], argv[0], argv[1],
+ parse_deleter_args (vty, argv[11], argv[9], argv[7], argv[3], argv[5],
&cda)))
return rc;
cda.vty = vty;
@@ -4229,7 +4241,7 @@ DEFUN (clear_vnc_mac_un_prefix,
/* pfx vn un L2 VNI */
if ((rc =
- parse_deleter_args (vty, argv[3], NULL, argv[2], argv[0], argv[1],
+ parse_deleter_args (vty, argv[9], NULL, argv[7], argv[3], argv[5],
&cda)))
return rc;
cda.vty = vty;
@@ -4259,7 +4271,7 @@ DEFUN (clear_vnc_mac_vn_prefix,
/* pfx vn un L2 VNI */
if ((rc =
- parse_deleter_args (vty, argv[3], argv[2], NULL, argv[0], argv[1],
+ parse_deleter_args (vty, argv[9], argv[7], NULL, argv[3], argv[5],
&cda)))
return rc;
cda.vty = vty;
@@ -4289,7 +4301,7 @@ DEFUN (clear_vnc_mac_all_prefix,
/* pfx vn un L2 VNI */
if ((rc =
- parse_deleter_args (vty, argv[2], NULL, NULL, argv[0], argv[1], &cda)))
+ parse_deleter_args (vty, argv[7], NULL, NULL, argv[3], argv[5], &cda)))
return rc;
cda.vty = vty;
clear_vnc_prefix (&cda);
@@ -4568,18 +4580,18 @@ DEFUN (vnc_show_nves_ptct,
if (!check_and_display_is_vnc_running (vty))
return CMD_SUCCESS;
- if (!str2prefix (argv[1], &pfx))
+ if (!str2prefix (argv[4]->arg, &pfx))
{
- vty_out (vty, "Malformed address \"%s\"%s", argv[1], VTY_NEWLINE);
+ vty_out (vty, "Malformed address \"%s\"%s", argv[4]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
if (pfx.family != AF_INET && pfx.family != AF_INET6)
{
- vty_out (vty, "Invalid address \"%s\"%s", argv[1], VTY_NEWLINE);
+ vty_out (vty, "Invalid address \"%s\"%s", argv[4]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
- if (*(argv[0]) == 'u')
+ if (argv[3]->arg[0] == 'u')
{
rfapi_show_nves (vty, NULL, &pfx);
}
@@ -4636,7 +4648,7 @@ rfapi_show_registrations (
DEFUN (vnc_show_registrations_pfx,
vnc_show_registrations_pfx_cmd,
- "show vnc registrations <[A.B.C.D/M]|[X:X::X:X/M]|[YY:YY:YY:YY:YY:YY]>",
+ "show vnc registrations [<A.B.C.D/M|X:X::X:X/M|YY:YY:YY:YY:YY:YY>]",
SHOW_STR
VNC_SHOW_STR
"List active prefix registrations\n"
@@ -4646,11 +4658,11 @@ DEFUN (vnc_show_registrations_pfx,
struct prefix p;
struct prefix *p_addr = NULL;
- if (argc == 1)
+ if (argc > 3)
{
- if (!str2prefix (argv[0], &p))
+ if (!str2prefix (argv[3]->arg, &p))
{
- vty_out (vty, "Invalid prefix: %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "Invalid prefix: %s%s", argv[3]->arg, VTY_NEWLINE);
return CMD_SUCCESS;
}
else
@@ -4663,15 +4675,9 @@ DEFUN (vnc_show_registrations_pfx,
return CMD_SUCCESS;
}
-ALIAS (vnc_show_registrations_pfx,
- vnc_show_registrations_cmd,
- "show vnc registrations",
- SHOW_STR
- VNC_SHOW_STR
- "List active prefix registrations\n")
- DEFUN (vnc_show_registrations_some_pfx,
+DEFUN (vnc_show_registrations_some_pfx,
vnc_show_registrations_some_pfx_cmd,
- "show vnc registrations (all|holddown|imported|local|remote) ([A.B.C.D/M]|[X:X::X:X/M]|[YY:YY:YY:YY:YY:YY])",
+ "show vnc registrations <all|holddown|imported|local|remote> [<A.B.C.D/M|X:X::X:X/M|YY:YY:YY:YY:YY:YY>]",
SHOW_STR
VNC_SHOW_STR
"List active prefix registrations\n"
@@ -4680,7 +4686,7 @@ ALIAS (vnc_show_registrations_pfx,
"show only imported prefixes\n"
"show only local registrations\n"
"show only remote registrations\n"
- "Limit output to a particular prefix or address\n"
+ "Limit output to a particular prefix or address\n[A"
"Limit output to a particular prefix or address\n")
{
struct prefix p;
@@ -4691,11 +4697,11 @@ ALIAS (vnc_show_registrations_pfx,
int show_holddown = 0;
int show_imported = 0;
- if (argc == 2)
+ if (argc > 4)
{
- if (!str2prefix (argv[1], &p))
+ if (!str2prefix (argv[4]->arg, &p))
{
- vty_out (vty, "Invalid prefix: %s%s", argv[1], VTY_NEWLINE);
+ vty_out (vty, "Invalid prefix: %s%s", argv[4]->arg, VTY_NEWLINE);
return CMD_SUCCESS;
}
else
@@ -4703,7 +4709,7 @@ ALIAS (vnc_show_registrations_pfx,
p_addr = &p;
}
}
- switch (*argv[0])
+ switch (argv[3]->arg[0])
{
case 'a':
show_local = 1;
@@ -4735,21 +4741,9 @@ ALIAS (vnc_show_registrations_pfx,
return CMD_SUCCESS;
}
-ALIAS (vnc_show_registrations_some_pfx,
- vnc_show_registrations_some_cmd,
- "show vnc registrations (all|holddown|imported|local|remote)",
- SHOW_STR
- VNC_SHOW_STR
- "List active prefix registrations\n"
- "show all registrations\n"
- "show only registrations in holddown\n"
- "show only imported prefixes\n"
- "show only local registrations\n"
- "show only remote registrations\n")
-
DEFUN (vnc_show_responses_pfx,
vnc_show_responses_pfx_cmd,
- "show vnc responses <[A.B.C.D/M]|[X:X::X:X/M]|[YY:YY:YY:YY:YY:YY]>",
+ "show vnc responses [<A.B.C.D/M|X:X::X:X/M|YY:YY:YY:YY:YY:YY>]",
SHOW_STR
VNC_SHOW_STR
"List recent query responses\n"
@@ -4759,11 +4753,11 @@ DEFUN (vnc_show_responses_pfx,
struct prefix p;
struct prefix *p_addr = NULL;
- if (argc == 1)
+ if (argc > 3)
{
- if (!str2prefix (argv[0], &p))
+ if (!str2prefix (argv[3]->arg, &p))
{
- vty_out (vty, "Invalid prefix: %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "Invalid prefix: %s%s", argv[3]->arg, VTY_NEWLINE);
return CMD_SUCCESS;
}
else
@@ -4781,16 +4775,9 @@ DEFUN (vnc_show_responses_pfx,
return CMD_SUCCESS;
}
-ALIAS (vnc_show_responses_pfx,
- vnc_show_responses_cmd,
- "show vnc responses",
- SHOW_STR
- VNC_SHOW_STR
- "List recent query responses\n")
-
DEFUN (vnc_show_responses_some_pfx,
vnc_show_responses_some_pfx_cmd,
- "show vnc responses <active|removed> <[A.B.C.D/M]|[X:X::X:X/M]|[YY:YY:YY:YY:YY:YY]>",
+ "show vnc responses <active|removed> [<A.B.C.D/M|X:X::X:X/M|YY:YY:YY:YY:YY:YY>]",
SHOW_STR
VNC_SHOW_STR
"List recent query responses\n"
@@ -4808,11 +4795,11 @@ DEFUN (vnc_show_responses_some_pfx,
if (!check_and_display_is_vnc_running (vty))
return CMD_SUCCESS;
- if (argc == 2)
+ if (argc > 4)
{
- if (!str2prefix (argv[1], &p))
+ if (!str2prefix (argv[4]->arg, &p))
{
- vty_out (vty, "Invalid prefix: %s%s", argv[1], VTY_NEWLINE);
+ vty_out (vty, "Invalid prefix: %s%s", argv[4]->arg, VTY_NEWLINE);
return CMD_SUCCESS;
}
else
@@ -4821,7 +4808,7 @@ DEFUN (vnc_show_responses_some_pfx,
}
}
- switch (*argv[0])
+ switch (argv[3]->arg[0])
{
case 'a':
show_active = 1;
@@ -4844,18 +4831,9 @@ DEFUN (vnc_show_responses_some_pfx,
return CMD_SUCCESS;
}
-ALIAS (vnc_show_responses_some_pfx,
- vnc_show_responses_some_cmd,
- "show vnc responses (active|removed)",
- SHOW_STR
- VNC_SHOW_STR
- "List recent query responses\n"
- "show only active query responses\n"
- "show only removed query responses\n")
-
DEFUN (show_vnc_queries_pfx,
show_vnc_queries_pfx_cmd,
- "show vnc queries <[A.B.C.D/M]|[X:X::X:X/M]|[YY:YY:YY:YY:YY:YY]>",
+ "show vnc queries [<A.B.C.D/M|X:X::X:X/M|YY:YY:YY:YY:YY:YY>]",
SHOW_STR
VNC_SHOW_STR
"List active queries\n"
@@ -4865,11 +4843,11 @@ DEFUN (show_vnc_queries_pfx,
struct prefix pfx;
struct prefix *p = NULL;
- if (argc == 1)
+ if (argc > 3)
{
- if (!str2prefix (argv[0], &pfx))
+ if (!str2prefix (argv[3]->arg, &pfx))
{
- vty_out (vty, "Invalid prefix: %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "Invalid prefix: %s%s", argv[3]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
p = &pfx;
@@ -4880,13 +4858,6 @@ DEFUN (show_vnc_queries_pfx,
return rfapiShowVncQueries (vty, p);
}
-ALIAS (show_vnc_queries_pfx,
- show_vnc_queries_cmd,
- "show vnc queries",
- SHOW_STR
- VNC_SHOW_STR
- "List active queries\n")
-
DEFUN (vnc_clear_counters,
vnc_clear_counters_cmd,
"clear vnc counters",
@@ -4986,18 +4957,9 @@ void rfapi_vty_init ()
install_element (VIEW_NODE, &vnc_show_nves_cmd);
install_element (VIEW_NODE, &vnc_show_nves_ptct_cmd);
- install_element (VIEW_NODE, &vnc_show_registrations_cmd);
install_element (VIEW_NODE, &vnc_show_registrations_pfx_cmd);
-
- install_element (VIEW_NODE, &vnc_show_registrations_some_cmd);
install_element (VIEW_NODE, &vnc_show_registrations_some_pfx_cmd);
-
- install_element (VIEW_NODE, &vnc_show_responses_cmd);
install_element (VIEW_NODE, &vnc_show_responses_pfx_cmd);
-
- install_element (VIEW_NODE, &vnc_show_responses_some_cmd);
install_element (VIEW_NODE, &vnc_show_responses_some_pfx_cmd);
-
- install_element (VIEW_NODE, &show_vnc_queries_cmd);
install_element (VIEW_NODE, &show_vnc_queries_pfx_cmd);
}
diff --git a/bgpd/rfapi/vnc_debug.c b/bgpd/rfapi/vnc_debug.c
index 5db6f558b..f66be85c2 100644
--- a/bgpd/rfapi/vnc_debug.c
+++ b/bgpd/rfapi/vnc_debug.c
@@ -25,7 +25,6 @@
#include "lib/linklist.h"
#include "lib/stream.h"
#include "lib/command.h"
-#include "lib/str.h"
#include "lib/log.h"
#include "bgpd/rfapi/vnc_debug.h"
@@ -69,7 +68,7 @@ DEFUN (debug_bgp_vnc,
for (i = 0; i < (sizeof(vncdebug) / sizeof(struct vnc_debug)); ++i)
{
- if (!strcmp(argv[0], vncdebug[i].name))
+ if (!strcmp(argv[3]->arg, vncdebug[i].name))
{
if (vty->node == CONFIG_NODE)
{
@@ -85,13 +84,13 @@ DEFUN (debug_bgp_vnc,
return CMD_SUCCESS;
}
}
- vty_out (vty, "Unknown debug flag: %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "Unknown debug flag: %s%s", argv[3]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
DEFUN (no_debug_bgp_vnc,
no_debug_bgp_vnc_cmd,
- "no debug bgp vnc <rfapi-query|import-bi-attach|import-del-remote>",
+ "<no debug|undebug> bgp vnc <rfapi-query|import-bi-attach|import-del-remote>",
NO_STR
DEBUG_STR
BGP_STR
@@ -102,9 +101,11 @@ DEFUN (no_debug_bgp_vnc,
{
size_t i;
+ if (!strcmp(argv[0]->arg, "no"))
+ argc--, argv++;
for (i = 0; i < (sizeof(vncdebug) / sizeof(struct vnc_debug)); ++i)
{
- if (!strcmp(argv[0], vncdebug[i].name))
+ if (!strcmp(argv[3]->arg, vncdebug[i].name))
{
if (vty->node == CONFIG_NODE)
{
@@ -120,20 +121,10 @@ DEFUN (no_debug_bgp_vnc,
return CMD_SUCCESS;
}
}
- vty_out (vty, "Unknown debug flag: %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "Unknown debug flag: %s%s", argv[3]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
-ALIAS (no_debug_bgp_vnc,
- undebug_bgp_vnc_cmd,
- "undebug bgp vnc (rfapi-query|import-bi-attach|import-del-remote)",
- UNDEBUG_STR
- BGP_STR
- VNC_STR
- "rfapi query handling\n"
- "import BI atachment\n"
- "import delete remote routes\n")
-
/***********************************************************************
* no debug bgp vnc all
@@ -141,7 +132,7 @@ ALIAS (no_debug_bgp_vnc,
DEFUN (no_debug_bgp_vnc_all,
no_debug_bgp_vnc_all_cmd,
- "no debug all bgp vnc",
+ "<no debug|undebug> all bgp vnc",
NO_STR
DEBUG_STR
"Disable all VNC debugging\n"
@@ -154,14 +145,6 @@ DEFUN (no_debug_bgp_vnc_all,
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_vnc_all,
- undebug_bgp_vnc_all_cmd,
- "undebug all bgp vnc",
- UNDEBUG_STR
- "Disable all VNC debugging\n"
- BGP_STR
- VNC_STR)
-
/***********************************************************************
* show/save
***********************************************************************/
@@ -223,8 +206,6 @@ vnc_debug_init (void)
install_element (ENABLE_NODE, &debug_bgp_vnc_cmd);
install_element (CONFIG_NODE, &debug_bgp_vnc_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_vnc_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_vnc_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_vnc_all_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_vnc_all_cmd);
}
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 4215ce2bf..dc2640ab9 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -208,12 +208,17 @@ prefix_bag_free (void *pb)
static void
print_rhn_list (const char *tag1, const char *tag2)
{
- struct bgp *bgp = bgp_get_default ();
- struct skiplist *sl = bgp->rfapi->resolve_nve_nexthop;
+ struct bgp *bgp;
+ struct skiplist *sl;
struct skiplistnode *p;
struct prefix_bag *pb;
int count = 0;
+ bgp = bgp_get_default ();
+ if (!bgp)
+ return;
+
+ sl = bgp->frapi->resolve_nve_nexthop;
if (!sl)
{
zlog_debug ("%s: %s: RHN List is empty", (tag1 ? tag1 : ""),
@@ -251,6 +256,8 @@ vnc_rhnck (char *tag)
struct skiplistnode *p;
bgp = bgp_get_default ();
+ if (!bgp)
+ return;
sl = bgp->rfapi->resolve_nve_nexthop;
if (!sl)
@@ -1798,6 +1805,9 @@ vnc_import_bgp_exterior_add_route_it (
struct bgp *bgp_default = bgp_get_default ();
afi_t afi = family2afi (prefix->family);
+ if (!bgp_default)
+ return;
+
h = bgp_default->rfapi;
hc = bgp_default->rfapi_cfg;
@@ -1992,6 +2002,9 @@ vnc_import_bgp_exterior_del_route (
afi_t afi = family2afi (prefix->family);
struct bgp *bgp_default = bgp_get_default ();
+ if (!bgp_default)
+ return;
+
memset (&pfx_orig_nexthop, 0, sizeof (struct prefix)); /* keep valgrind happy */
h = bgp_default->rfapi;
diff --git a/bgpd/rfp-example/librfp/rfp_example.c b/bgpd/rfp-example/librfp/rfp_example.c
index e8b546ddf..614e2464a 100644
--- a/bgpd/rfp-example/librfp/rfp_example.c
+++ b/bgpd/rfp-example/librfp/rfp_example.c
@@ -48,7 +48,7 @@ DEFUN (rfp_example_config_value,
rfi = rfapi_get_rfp_start_val (vty->index); /* index=bgp for BGP_NODE */
assert (rfi != NULL);
- VTY_GET_INTEGER ("Example value", value, argv[0]);
+ VTY_GET_INTEGER ("Example value", value, argv[2]->arg);
if (rfi)
rfi->config_var = value;
return CMD_SUCCESS;