mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 20:04:11 +00:00
bgpd: argv update for all but bgp_vty.c
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
parent
69642336f0
commit
4dcadbefd0
@ -28,6 +28,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
#include "str.h"
|
||||
#include "log.h"
|
||||
#include "stream.h"
|
||||
#include "command.h"
|
||||
#include "jhash.h"
|
||||
#include "queue.h"
|
||||
#include "filter.h"
|
||||
|
@ -32,6 +32,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
#include "queue.h"
|
||||
#include "table.h"
|
||||
#include "filter.h"
|
||||
#include "command.h"
|
||||
|
||||
#include "bgpd/bgpd.h"
|
||||
#include "bgpd/bgp_attr.h"
|
||||
|
@ -20,6 +20,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
|
||||
#include <zebra.h>
|
||||
|
||||
#include "command.h"
|
||||
#include "hash.h"
|
||||
#include "memory.h"
|
||||
|
||||
|
@ -630,7 +630,7 @@ DEFUN (debug_bgp_neighbor_events_peer,
|
||||
"BGP IPv6 neighbor to debug\n"
|
||||
"BGP neighbor on interface to debug\n")
|
||||
{
|
||||
const char *host = argv[0];
|
||||
const char *host = argv[3]->arg;
|
||||
|
||||
if (!bgp_debug_neighbor_events_peers)
|
||||
bgp_debug_neighbor_events_peers = list_new ();
|
||||
@ -685,7 +685,7 @@ DEFUN (no_debug_bgp_neighbor_events_peer,
|
||||
"BGP neighbor on interface to debug\n")
|
||||
{
|
||||
int found_peer = 0;
|
||||
const char *host = argv[0];
|
||||
const char *host = argv[4]->arg;
|
||||
|
||||
if (bgp_debug_neighbor_events_peers && !list_isempty(bgp_debug_neighbor_events_peers))
|
||||
{
|
||||
@ -774,7 +774,7 @@ DEFUN (debug_bgp_keepalive_peer,
|
||||
"BGP IPv6 neighbor to debug\n"
|
||||
"BGP neighbor on interface to debug\n")
|
||||
{
|
||||
const char *host = argv[0];
|
||||
const char *host = argv[3]->arg;
|
||||
|
||||
if (!bgp_debug_keepalive_peers)
|
||||
bgp_debug_keepalive_peers = list_new ();
|
||||
@ -829,7 +829,7 @@ DEFUN (no_debug_bgp_keepalive_peer,
|
||||
"BGP neighbor on interface to debug\n")
|
||||
{
|
||||
int found_peer = 0;
|
||||
const char *host = argv[0];
|
||||
const char *host = argv[4]->arg;
|
||||
|
||||
if (bgp_debug_keepalive_peers && !list_isempty(bgp_debug_keepalive_peers))
|
||||
{
|
||||
@ -867,7 +867,7 @@ DEFUN (debug_bgp_bestpath_prefix,
|
||||
int ret;
|
||||
|
||||
argv_p = prefix_new();
|
||||
ret = str2prefix (argv[0], argv_p);
|
||||
ret = str2prefix (argv[3]->arg, argv_p);
|
||||
if (!ret)
|
||||
{
|
||||
prefix_free(argv_p);
|
||||
@ -881,7 +881,7 @@ DEFUN (debug_bgp_bestpath_prefix,
|
||||
|
||||
if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL, argv_p))
|
||||
{
|
||||
vty_out (vty, "BGP bestptah debugging is already enabled for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP bestptah debugging is already enabled for %s%s", argv[3]->arg, VTY_NEWLINE);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -894,7 +894,7 @@ DEFUN (debug_bgp_bestpath_prefix,
|
||||
else
|
||||
{
|
||||
TERM_DEBUG_ON (bestpath, BESTPATH);
|
||||
vty_out (vty, "BGP bestpath debugging is on for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP bestpath debugging is on for %s%s", argv[3]->arg, VTY_NEWLINE);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
@ -916,7 +916,7 @@ DEFUN (no_debug_bgp_bestpath_prefix,
|
||||
int ret;
|
||||
|
||||
argv_p = prefix_new();
|
||||
ret = str2prefix (argv[0], argv_p);
|
||||
ret = str2prefix (argv[4]->arg, argv_p);
|
||||
if (!ret)
|
||||
{
|
||||
prefix_free(argv_p);
|
||||
@ -943,9 +943,9 @@ DEFUN (no_debug_bgp_bestpath_prefix,
|
||||
}
|
||||
|
||||
if (found_prefix)
|
||||
vty_out (vty, "BGP bestpath debugging is off for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP bestpath debugging is off for %s%s", argv[4]->arg, VTY_NEWLINE);
|
||||
else
|
||||
vty_out (vty, "BGP bestpath debugging was not enabled for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP bestpath debugging was not enabled for %s%s", argv[4]->arg, VTY_NEWLINE);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -1006,21 +1006,21 @@ DEFUN (debug_bgp_update_direct,
|
||||
"Outbound updates\n")
|
||||
{
|
||||
|
||||
if (strncmp ("i", argv[0], 1) == 0)
|
||||
if (strncmp ("i", argv[3]->arg, 1) == 0)
|
||||
bgp_debug_list_free(bgp_debug_update_in_peers);
|
||||
else
|
||||
bgp_debug_list_free(bgp_debug_update_out_peers);
|
||||
|
||||
if (vty->node == CONFIG_NODE)
|
||||
{
|
||||
if (strncmp ("i", argv[0], 1) == 0)
|
||||
if (strncmp ("i", argv[3]->arg, 1) == 0)
|
||||
DEBUG_ON (update, UPDATE_IN);
|
||||
else
|
||||
DEBUG_ON (update, UPDATE_OUT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strncmp ("i", argv[0], 1) == 0)
|
||||
if (strncmp ("i", argv[3]->arg, 1) == 0)
|
||||
{
|
||||
TERM_DEBUG_ON (update, UPDATE_IN);
|
||||
vty_out (vty, "BGP updates debugging is on (inbound)%s", VTY_NEWLINE);
|
||||
@ -1046,7 +1046,7 @@ DEFUN (debug_bgp_update_direct_peer,
|
||||
"BGP IPv6 neighbor to debug\n"
|
||||
"BGP neighbor on interface to debug\n")
|
||||
{
|
||||
const char *host = argv[1];
|
||||
const char *host = argv[4]->arg;
|
||||
int inbound;
|
||||
|
||||
if (!bgp_debug_update_in_peers)
|
||||
@ -1055,7 +1055,7 @@ DEFUN (debug_bgp_update_direct_peer,
|
||||
if (!bgp_debug_update_out_peers)
|
||||
bgp_debug_update_out_peers = list_new ();
|
||||
|
||||
if (strncmp ("i", argv[0], 1) == 0)
|
||||
if (strncmp ("i", argv[3]->arg, 1) == 0)
|
||||
inbound = 1;
|
||||
else
|
||||
inbound = 0;
|
||||
@ -1117,12 +1117,12 @@ DEFUN (debug_bgp_update_direct_peer,
|
||||
if (inbound)
|
||||
{
|
||||
TERM_DEBUG_ON (update, UPDATE_IN);
|
||||
vty_out (vty, "BGP updates debugging is on (inbound) for %s%s", argv[1], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP updates debugging is on (inbound) for %s%s", argv[4]->arg, VTY_NEWLINE);
|
||||
}
|
||||
else
|
||||
{
|
||||
TERM_DEBUG_ON (update, UPDATE_OUT);
|
||||
vty_out (vty, "BGP updates debugging is on (outbound) for %s%s", argv[1], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP updates debugging is on (outbound) for %s%s", argv[4]->arg, VTY_NEWLINE);
|
||||
}
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
@ -1138,7 +1138,7 @@ DEFUN (no_debug_bgp_update_direct,
|
||||
"Inbound updates\n"
|
||||
"Outbound updates\n")
|
||||
{
|
||||
if (strncmp ("i", argv[0], 1) == 0)
|
||||
if (strncmp ("i", argv[4]->arg, 1) == 0)
|
||||
{
|
||||
bgp_debug_list_free(bgp_debug_update_in_peers);
|
||||
|
||||
@ -1185,9 +1185,9 @@ DEFUN (no_debug_bgp_update_direct_peer,
|
||||
{
|
||||
int inbound;
|
||||
int found_peer = 0;
|
||||
const char *host = argv[1];
|
||||
const char *host = argv[5]->arg;
|
||||
|
||||
if (strncmp ("i", argv[0], 1) == 0)
|
||||
if (strncmp ("i", argv[4]->arg, 1) == 0)
|
||||
inbound = 1;
|
||||
else
|
||||
inbound = 0;
|
||||
@ -1275,7 +1275,7 @@ DEFUN (debug_bgp_update_prefix,
|
||||
int ret;
|
||||
|
||||
argv_p = prefix_new();
|
||||
ret = str2prefix (argv[0], argv_p);
|
||||
ret = str2prefix (argv[4]->arg, argv_p);
|
||||
if (!ret)
|
||||
{
|
||||
prefix_free(argv_p);
|
||||
@ -1289,7 +1289,7 @@ DEFUN (debug_bgp_update_prefix,
|
||||
|
||||
if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, argv_p))
|
||||
{
|
||||
vty_out (vty, "BGP updates debugging is already enabled for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP updates debugging is already enabled for %s%s", argv[4]->arg, VTY_NEWLINE);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1302,7 +1302,7 @@ DEFUN (debug_bgp_update_prefix,
|
||||
else
|
||||
{
|
||||
TERM_DEBUG_ON (update, UPDATE_PREFIX);
|
||||
vty_out (vty, "BGP updates debugging is on for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP updates debugging is on for %s%s", argv[4]->arg, VTY_NEWLINE);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
@ -1325,7 +1325,7 @@ DEFUN (no_debug_bgp_update_prefix,
|
||||
int ret;
|
||||
|
||||
argv_p = prefix_new();
|
||||
ret = str2prefix (argv[0], argv_p);
|
||||
ret = str2prefix (argv[5]->arg, argv_p);
|
||||
if (!ret)
|
||||
{
|
||||
prefix_free(argv_p);
|
||||
@ -1352,9 +1352,9 @@ DEFUN (no_debug_bgp_update_prefix,
|
||||
}
|
||||
|
||||
if (found_prefix)
|
||||
vty_out (vty, "BGP updates debugging is off for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP updates debugging is off for %s%s", argv[5]->arg, VTY_NEWLINE);
|
||||
else
|
||||
vty_out (vty, "BGP updates debugging was not enabled for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP updates debugging was not enabled for %s%s", argv[5]->arg, VTY_NEWLINE);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -1422,7 +1422,7 @@ DEFUN (debug_bgp_zebra_prefix,
|
||||
int ret;
|
||||
|
||||
argv_p = prefix_new();
|
||||
ret = str2prefix (argv[0], argv_p);
|
||||
ret = str2prefix (argv[4]->arg, argv_p);
|
||||
if (!ret)
|
||||
{
|
||||
prefix_free(argv_p);
|
||||
@ -1435,7 +1435,7 @@ DEFUN (debug_bgp_zebra_prefix,
|
||||
|
||||
if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes, NULL, argv_p))
|
||||
{
|
||||
vty_out (vty, "BGP zebra debugging is already enabled for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP zebra debugging is already enabled for %s%s", argv[4]->arg, VTY_NEWLINE);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1446,7 +1446,7 @@ DEFUN (debug_bgp_zebra_prefix,
|
||||
else
|
||||
{
|
||||
TERM_DEBUG_ON (zebra, ZEBRA);
|
||||
vty_out (vty, "BGP zebra debugging is on for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP zebra debugging is on for %s%s", argv[4]->arg, VTY_NEWLINE);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
@ -1489,7 +1489,7 @@ DEFUN (no_debug_bgp_zebra_prefix,
|
||||
int ret;
|
||||
|
||||
argv_p = prefix_new();
|
||||
ret = str2prefix (argv[0], argv_p);
|
||||
ret = str2prefix (argv[5]->arg, argv_p);
|
||||
if (!ret)
|
||||
{
|
||||
prefix_free(argv_p);
|
||||
@ -1514,9 +1514,9 @@ DEFUN (no_debug_bgp_zebra_prefix,
|
||||
}
|
||||
|
||||
if (found_prefix)
|
||||
vty_out (vty, "BGP zebra debugging is off for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP zebra debugging is off for %s%s", argv[5]->arg, VTY_NEWLINE);
|
||||
else
|
||||
vty_out (vty, "BGP zebra debugging was not enabled for %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "BGP zebra debugging was not enabled for %s%s", argv[5]->arg, VTY_NEWLINE);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -742,7 +742,7 @@ DEFUN (dump_bgp_all,
|
||||
const struct bgp_dump_type_map *map = NULL;
|
||||
|
||||
for (map = bgp_dump_type_map; map->str; map++)
|
||||
if (strcmp(argv[0], map->str) == 0)
|
||||
if (strcmp(argv[2]->arg, map->str) == 0)
|
||||
bgp_dump_type = map->type;
|
||||
|
||||
switch (bgp_dump_type)
|
||||
@ -763,10 +763,10 @@ DEFUN (dump_bgp_all,
|
||||
|
||||
/* When an interval is given */
|
||||
if (argc == 3)
|
||||
interval = argv[2];
|
||||
interval = argv[4]->arg;
|
||||
|
||||
return bgp_dump_set (vty, bgp_dump_struct, bgp_dump_type,
|
||||
argv[1], interval);
|
||||
argv[3]->arg, interval);
|
||||
}
|
||||
|
||||
DEFUN (no_dump_bgp_all,
|
||||
@ -786,7 +786,7 @@ DEFUN (no_dump_bgp_all,
|
||||
struct bgp_dump *bgp_dump_struct = NULL;
|
||||
|
||||
for (map = bgp_dump_type_map; map->str; map++)
|
||||
if (strcmp(argv[0], map->str) == 0)
|
||||
if (strcmp(argv[3]->arg, map->str) == 0)
|
||||
bgp_dump_type = map->type;
|
||||
|
||||
switch (bgp_dump_type)
|
||||
|
@ -426,7 +426,8 @@ as_list_dup_check (struct as_list *aslist, struct as_filter *new)
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFUN (ip_as_path, ip_as_path_cmd,
|
||||
DEFUN (ip_as_path,
|
||||
ip_as_path_cmd,
|
||||
"ip as-path access-list WORD (deny|permit) .LINE",
|
||||
IP_STR
|
||||
"BGP autonomous system path filter\n"
|
||||
@ -443,9 +444,9 @@ DEFUN (ip_as_path, ip_as_path_cmd,
|
||||
char *regstr;
|
||||
|
||||
/* Check the filter type. */
|
||||
if (strncmp (argv[1], "p", 1) == 0)
|
||||
if (strncmp (argv[4]->arg, "p", 1) == 0)
|
||||
type = AS_FILTER_PERMIT;
|
||||
else if (strncmp (argv[1], "d", 1) == 0)
|
||||
else if (strncmp (argv[4]->arg, "d", 1) == 0)
|
||||
type = AS_FILTER_DENY;
|
||||
else
|
||||
{
|
||||
@ -460,7 +461,7 @@ DEFUN (ip_as_path, ip_as_path_cmd,
|
||||
if (!regex)
|
||||
{
|
||||
XFREE (MTYPE_TMP, regstr);
|
||||
vty_out (vty, "can't compile regexp %s%s", argv[0],
|
||||
vty_out (vty, "can't compile regexp %s%s", argv[3]->arg,
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
@ -470,7 +471,7 @@ DEFUN (ip_as_path, ip_as_path_cmd,
|
||||
XFREE (MTYPE_TMP, regstr);
|
||||
|
||||
/* Install new filter to the access_list. */
|
||||
aslist = as_list_get (argv[0]);
|
||||
aslist = as_list_get (argv[3]->arg);
|
||||
|
||||
/* Duplicate insertion check. */;
|
||||
if (as_list_dup_check (aslist, asfilter))
|
||||
@ -500,18 +501,18 @@ DEFUN (no_ip_as_path,
|
||||
regex_t *regex;
|
||||
|
||||
/* Lookup AS list from AS path list. */
|
||||
aslist = as_list_lookup (argv[0]);
|
||||
aslist = as_list_lookup (argv[4]->arg);
|
||||
if (aslist == NULL)
|
||||
{
|
||||
vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[0],
|
||||
vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[4]->arg,
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
/* Check the filter type. */
|
||||
if (strncmp (argv[1], "p", 1) == 0)
|
||||
if (strncmp (argv[5]->arg, "p", 1) == 0)
|
||||
type = AS_FILTER_PERMIT;
|
||||
else if (strncmp (argv[1], "d", 1) == 0)
|
||||
else if (strncmp (argv[5]->arg, "d", 1) == 0)
|
||||
type = AS_FILTER_DENY;
|
||||
else
|
||||
{
|
||||
@ -526,7 +527,7 @@ DEFUN (no_ip_as_path,
|
||||
if (!regex)
|
||||
{
|
||||
XFREE (MTYPE_TMP, regstr);
|
||||
vty_out (vty, "can't compile regexp %s%s", argv[0],
|
||||
vty_out (vty, "can't compile regexp %s%s", argv[4]->arg,
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
@ -559,10 +560,10 @@ DEFUN (no_ip_as_path_all,
|
||||
{
|
||||
struct as_list *aslist;
|
||||
|
||||
aslist = as_list_lookup (argv[0]);
|
||||
aslist = as_list_lookup (argv[4]->arg);
|
||||
if (aslist == NULL)
|
||||
{
|
||||
vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[0],
|
||||
vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[4]->arg,
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
@ -571,7 +572,7 @@ DEFUN (no_ip_as_path_all,
|
||||
|
||||
/* Run hook function. */
|
||||
if (as_list_master.delete_hook)
|
||||
(*as_list_master.delete_hook) (argv[0]);
|
||||
(*as_list_master.delete_hook) (argv[4]->arg);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -629,7 +630,7 @@ DEFUN (show_ip_as_path_access_list,
|
||||
{
|
||||
struct as_list *aslist;
|
||||
|
||||
aslist = as_list_lookup (argv[0]);
|
||||
aslist = as_list_lookup (argv[3]->arg);
|
||||
if (aslist)
|
||||
as_list_show (vty, aslist);
|
||||
|
||||
|
@ -33,6 +33,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
#include "workqueue.h"
|
||||
#include "queue.h"
|
||||
#include "filter.h"
|
||||
#include "command.h"
|
||||
|
||||
#include "lib/json.h"
|
||||
#include "bgpd/bgpd.h"
|
||||
|
@ -360,7 +360,7 @@ DEFUN (vpnv4_network,
|
||||
"BGP tag\n"
|
||||
"tag value\n")
|
||||
{
|
||||
return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2], NULL);
|
||||
return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[1]->arg, argv[3]->arg, argv[5]->arg, NULL);
|
||||
}
|
||||
|
||||
DEFUN (vpnv4_network_route_map,
|
||||
@ -375,7 +375,7 @@ DEFUN (vpnv4_network_route_map,
|
||||
"route map\n"
|
||||
"route map name\n")
|
||||
{
|
||||
return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2], argv[3]);
|
||||
return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[1]->arg, argv[3]->arg, argv[5]->arg, argv[7]->arg);
|
||||
}
|
||||
|
||||
/* For testing purpose, static route of MPLS-VPN. */
|
||||
@ -390,7 +390,7 @@ DEFUN (no_vpnv4_network,
|
||||
"BGP tag\n"
|
||||
"tag value\n")
|
||||
{
|
||||
return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2]);
|
||||
return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[2]->arg, argv[4]->arg, argv[6]->arg);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -794,7 +794,7 @@ DEFUN (show_bgp_ipv4_vpn_rd,
|
||||
int ret;
|
||||
struct prefix_rd prd;
|
||||
|
||||
ret = str2prefix_rd (argv[0], &prd);
|
||||
ret = str2prefix_rd (argv[5]->arg, &prd);
|
||||
if (! ret)
|
||||
{
|
||||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
||||
@ -817,7 +817,7 @@ DEFUN (show_bgp_ipv6_vpn_rd,
|
||||
int ret;
|
||||
struct prefix_rd prd;
|
||||
|
||||
ret = str2prefix_rd (argv[0], &prd);
|
||||
ret = str2prefix_rd (argv[5]->arg, &prd);
|
||||
if (!ret)
|
||||
{
|
||||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
||||
@ -852,7 +852,7 @@ DEFUN (show_ip_bgp_vpnv4_rd,
|
||||
int ret;
|
||||
struct prefix_rd prd;
|
||||
|
||||
ret = str2prefix_rd (argv[0], &prd);
|
||||
ret = str2prefix_rd (argv[5]->arg, &prd);
|
||||
if (! ret)
|
||||
{
|
||||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
||||
@ -888,7 +888,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags,
|
||||
int ret;
|
||||
struct prefix_rd prd;
|
||||
|
||||
ret = str2prefix_rd (argv[0], &prd);
|
||||
ret = str2prefix_rd (argv[5]->arg, &prd);
|
||||
if (! ret)
|
||||
{
|
||||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
||||
@ -915,7 +915,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
|
||||
int ret;
|
||||
u_char uj = use_json(argc, argv);
|
||||
|
||||
ret = str2sockunion (argv[0], &su);
|
||||
ret = str2sockunion (argv[6]->arg, &su);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (uj)
|
||||
@ -927,7 +927,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
|
||||
json_object_free(json_no);
|
||||
}
|
||||
else
|
||||
vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "Malformed address: %s%s", argv[6]->arg, VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
@ -970,7 +970,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
|
||||
struct prefix_rd prd;
|
||||
u_char uj = use_json(argc, argv);
|
||||
|
||||
ret = str2prefix_rd (argv[0], &prd);
|
||||
ret = str2prefix_rd (argv[5]->arg, &prd);
|
||||
if (! ret)
|
||||
{
|
||||
if (uj)
|
||||
@ -986,7 +986,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
ret = str2sockunion (argv[1], &su);
|
||||
ret = str2sockunion (argv[7]->arg, &su);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (uj)
|
||||
@ -998,7 +998,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
|
||||
json_object_free(json_no);
|
||||
}
|
||||
else
|
||||
vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "Malformed address: %s%s", argv[5]->arg, VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
@ -1039,7 +1039,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
|
||||
union sockunion su;
|
||||
u_char uj = use_json(argc, argv);
|
||||
|
||||
ret = str2sockunion (argv[0], &su);
|
||||
ret = str2sockunion (argv[6]->arg, &su);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (uj)
|
||||
@ -1051,7 +1051,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
|
||||
json_object_free(json_no);
|
||||
}
|
||||
else
|
||||
vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "Malformed address: %s%s", argv[6]->arg, VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
peer = peer_lookup (NULL, &su);
|
||||
@ -1093,7 +1093,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
|
||||
union sockunion su;
|
||||
u_char uj = use_json(argc, argv);
|
||||
|
||||
ret = str2sockunion (argv[1], &su);
|
||||
ret = str2sockunion (argv[7]->arg, &su);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (uj)
|
||||
@ -1105,7 +1105,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
|
||||
json_object_free(json_no);
|
||||
}
|
||||
else
|
||||
vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
|
||||
vty_out (vty, "Malformed address: %s%s", argv[5]->arg, VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
peer = peer_lookup (NULL, &su);
|
||||
@ -1124,7 +1124,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
ret = str2prefix_rd (argv[0], &prd);
|
||||
ret = str2prefix_rd (argv[5]->arg, &prd);
|
||||
if (! ret)
|
||||
{
|
||||
if (uj)
|
||||
|
@ -520,7 +520,7 @@ DEFUN (show_ip_bgp_instance_nexthop,
|
||||
BGP_INSTANCE_HELP_STR
|
||||
"BGP nexthop table\n")
|
||||
{
|
||||
return show_ip_bgp_nexthop_table (vty, argv[1], 0);
|
||||
return show_ip_bgp_nexthop_table (vty, argv[4]->arg, 0);
|
||||
}
|
||||
|
||||
DEFUN (show_ip_bgp_instance_all_nexthop,
|
||||
@ -545,7 +545,7 @@ DEFUN (show_ip_bgp_instance_nexthop_detail,
|
||||
BGP_INSTANCE_HELP_STR
|
||||
"BGP nexthop table\n")
|
||||
{
|
||||
return show_ip_bgp_nexthop_table (vty, argv[1], 1);
|
||||
return show_ip_bgp_nexthop_table (vty, argv[4]->arg, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
610
bgpd/bgp_route.c
610
bgpd/bgp_route.c
File diff suppressed because it is too large
Load Diff
@ -3000,7 +3000,7 @@ DEFUN (match_peer,
|
||||
"IP address of peer\n"
|
||||
"IPv6 address of peer\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "peer", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "peer", argv[2]->arg,
|
||||
RMAP_EVENT_MATCH_ADDED);
|
||||
}
|
||||
|
||||
@ -3022,11 +3022,7 @@ DEFUN (no_match_peer,
|
||||
MATCH_STR
|
||||
"Match peer address\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_match_delete (vty, vty->index, "peer", NULL,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
|
||||
return bgp_route_match_delete (vty, vty->index, "peer", argv[0],
|
||||
return bgp_route_match_delete (vty, vty->index, "peer", argv[3]->arg,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
}
|
||||
|
||||
@ -3057,7 +3053,7 @@ DEFUN (match_ip_address,
|
||||
"IP access-list number (expanded range)\n"
|
||||
"IP Access-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "ip address", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "ip address", argv[3]->arg,
|
||||
RMAP_EVENT_FILTER_ADDED);
|
||||
}
|
||||
|
||||
@ -3069,11 +3065,7 @@ DEFUN (no_match_ip_address,
|
||||
IP_STR
|
||||
"Match address of route\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_match_delete (vty, vty->index, "ip address", NULL,
|
||||
RMAP_EVENT_FILTER_DELETED);
|
||||
|
||||
return bgp_route_match_delete (vty, vty->index, "ip address", argv[0],
|
||||
return bgp_route_match_delete (vty, vty->index, "ip address", argv[4]->arg,
|
||||
RMAP_EVENT_FILTER_DELETED);
|
||||
}
|
||||
|
||||
@ -3098,7 +3090,7 @@ DEFUN (match_ip_next_hop,
|
||||
"IP access-list number (expanded range)\n"
|
||||
"IP Access-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "ip next-hop", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg,
|
||||
RMAP_EVENT_FILTER_ADDED);
|
||||
}
|
||||
|
||||
@ -3110,11 +3102,7 @@ DEFUN (no_match_ip_next_hop,
|
||||
IP_STR
|
||||
"Match next-hop address of route\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_match_delete (vty, vty->index, "ip next-hop", NULL,
|
||||
RMAP_EVENT_FILTER_DELETED);
|
||||
|
||||
return bgp_route_match_delete (vty, vty->index, "ip next-hop", argv[0],
|
||||
return bgp_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg,
|
||||
RMAP_EVENT_FILTER_DELETED);
|
||||
}
|
||||
|
||||
@ -3138,7 +3126,7 @@ DEFUN (match_probability,
|
||||
"Match portion of routes defined by percentage value\n"
|
||||
"Percentage of routes\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "probability", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "probability", argv[2]->arg,
|
||||
RMAP_EVENT_MATCH_ADDED);
|
||||
}
|
||||
|
||||
@ -3149,7 +3137,7 @@ DEFUN (no_match_probability,
|
||||
MATCH_STR
|
||||
"Match portion of routes defined by percentage value\n")
|
||||
{
|
||||
return bgp_route_match_delete (vty, vty->index, "probability", argc ? argv[0] : NULL,
|
||||
return bgp_route_match_delete (vty, vty->index, "probability", argv[2]->arg,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
}
|
||||
|
||||
@ -3173,7 +3161,7 @@ DEFUN (match_ip_route_source,
|
||||
"IP access-list number (expanded range)\n"
|
||||
"IP standard access-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "ip route-source", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "ip route-source", argv[3]->arg,
|
||||
RMAP_EVENT_FILTER_ADDED);
|
||||
}
|
||||
|
||||
@ -3185,12 +3173,8 @@ DEFUN (no_match_ip_route_source,
|
||||
IP_STR
|
||||
"Match advertising source address of route\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_match_delete (vty, vty->index, "ip route-source", NULL,
|
||||
RMAP_EVENT_FILTER_DELETED);
|
||||
|
||||
return bgp_route_match_delete (vty, vty->index, "ip route-source",
|
||||
argv[0], RMAP_EVENT_FILTER_DELETED);
|
||||
argv[4]->arg, RMAP_EVENT_FILTER_DELETED);
|
||||
}
|
||||
|
||||
ALIAS (no_match_ip_route_source,
|
||||
@ -3214,7 +3198,7 @@ DEFUN (match_ip_address_prefix_list,
|
||||
"IP prefix-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "ip address prefix-list",
|
||||
argv[0], RMAP_EVENT_PLIST_ADDED);
|
||||
argv[4]->arg, RMAP_EVENT_PLIST_ADDED);
|
||||
}
|
||||
|
||||
DEFUN (no_match_ip_address_prefix_list,
|
||||
@ -3227,8 +3211,7 @@ DEFUN (no_match_ip_address_prefix_list,
|
||||
"Match entries of prefix-lists\n")
|
||||
{
|
||||
return bgp_route_match_delete (vty, vty->index, "ip address prefix-list",
|
||||
argc == 0 ? NULL : argv[0],
|
||||
RMAP_EVENT_PLIST_DELETED);
|
||||
argv[5]->arg, RMAP_EVENT_PLIST_DELETED);
|
||||
}
|
||||
|
||||
ALIAS (no_match_ip_address_prefix_list,
|
||||
@ -3251,7 +3234,7 @@ DEFUN (match_ip_next_hop_prefix_list,
|
||||
"IP prefix-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "ip next-hop prefix-list",
|
||||
argv[0], RMAP_EVENT_PLIST_ADDED);
|
||||
argv[4]->arg, RMAP_EVENT_PLIST_ADDED);
|
||||
}
|
||||
|
||||
DEFUN (no_match_ip_next_hop_prefix_list,
|
||||
@ -3264,8 +3247,7 @@ DEFUN (no_match_ip_next_hop_prefix_list,
|
||||
"Match entries of prefix-lists\n")
|
||||
{
|
||||
return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list",
|
||||
argc == 0 ? NULL : argv[0],
|
||||
RMAP_EVENT_PLIST_DELETED);
|
||||
argv[5]->arg, RMAP_EVENT_PLIST_DELETED);
|
||||
}
|
||||
|
||||
ALIAS (no_match_ip_next_hop_prefix_list,
|
||||
@ -3288,7 +3270,7 @@ DEFUN (match_ip_route_source_prefix_list,
|
||||
"IP prefix-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "ip route-source prefix-list",
|
||||
argv[0], RMAP_EVENT_PLIST_ADDED);
|
||||
argv[4]->arg, RMAP_EVENT_PLIST_ADDED);
|
||||
}
|
||||
|
||||
DEFUN (no_match_ip_route_source_prefix_list,
|
||||
@ -3301,8 +3283,7 @@ DEFUN (no_match_ip_route_source_prefix_list,
|
||||
"Match entries of prefix-lists\n")
|
||||
{
|
||||
return bgp_route_match_delete (vty, vty->index, "ip route-source prefix-list",
|
||||
argc == 0 ? NULL : argv[0],
|
||||
RMAP_EVENT_PLIST_DELETED);
|
||||
argv[5]->arg, RMAP_EVENT_PLIST_DELETED);
|
||||
}
|
||||
|
||||
ALIAS (no_match_ip_route_source_prefix_list,
|
||||
@ -3322,7 +3303,7 @@ DEFUN (match_metric,
|
||||
"Match metric of route\n"
|
||||
"Metric value\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "metric", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "metric", argv[2]->arg,
|
||||
RMAP_EVENT_MATCH_ADDED);
|
||||
}
|
||||
|
||||
@ -3334,7 +3315,7 @@ DEFUN (no_match_metric,
|
||||
"Match metric of route\n")
|
||||
{
|
||||
return bgp_route_match_delete (vty, vty->index, "metric",
|
||||
argc == 0 ? NULL : argv[0],
|
||||
argv[3]->arg,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
}
|
||||
|
||||
@ -3353,7 +3334,7 @@ DEFUN (match_local_pref,
|
||||
"Match local-preference of route\n"
|
||||
"Metric value\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "local-preference", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "local-preference", argv[2]->arg,
|
||||
RMAP_EVENT_MATCH_ADDED);
|
||||
}
|
||||
|
||||
@ -3365,10 +3346,7 @@ DEFUN (no_match_local_pref,
|
||||
"Match local preference of route\n")
|
||||
{
|
||||
return bgp_route_match_delete (vty, vty->index, "local-preference",
|
||||
argc == 0 ? NULL : argv[0],
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
|
||||
return bgp_route_match_delete (vty, vty->index, "local-preference", argv[0],
|
||||
argv[3]->arg,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
}
|
||||
|
||||
@ -3389,7 +3367,7 @@ DEFUN (match_community,
|
||||
"Community-list number (expanded)\n"
|
||||
"Community-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "community", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "community", argv[2]->arg,
|
||||
RMAP_EVENT_CLIST_ADDED);
|
||||
}
|
||||
|
||||
@ -3407,9 +3385,9 @@ DEFUN (match_community_exact,
|
||||
char *argstr;
|
||||
|
||||
argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
|
||||
strlen (argv[0]) + strlen ("exact-match") + 2);
|
||||
strlen (argv[2]->arg) + strlen ("exact-match") + 2);
|
||||
|
||||
sprintf (argstr, "%s exact-match", argv[0]);
|
||||
sprintf (argstr, "%s exact-match", argv[2]->arg);
|
||||
|
||||
ret = bgp_route_match_add (vty, vty->index, "community", argstr,
|
||||
RMAP_EVENT_CLIST_ADDED);
|
||||
@ -3460,7 +3438,7 @@ DEFUN (match_ecommunity,
|
||||
"Extended community-list number (expanded)\n"
|
||||
"Extended community-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "extcommunity", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "extcommunity", argv[2]->arg,
|
||||
RMAP_EVENT_ECLIST_ADDED);
|
||||
}
|
||||
|
||||
@ -3492,7 +3470,7 @@ DEFUN (match_aspath,
|
||||
"Match BGP AS path list\n"
|
||||
"AS path access-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "as-path", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "as-path", argv[2]->arg,
|
||||
RMAP_EVENT_ASLIST_ADDED);
|
||||
}
|
||||
|
||||
@ -3524,13 +3502,13 @@ DEFUN (match_origin,
|
||||
"local IGP\n"
|
||||
"unknown heritage\n")
|
||||
{
|
||||
if (strncmp (argv[0], "igp", 2) == 0)
|
||||
if (strncmp (argv[2]->arg, "igp", 2) == 0)
|
||||
return bgp_route_match_add (vty, vty->index, "origin", "igp",
|
||||
RMAP_EVENT_MATCH_ADDED);
|
||||
if (strncmp (argv[0], "egp", 1) == 0)
|
||||
if (strncmp (argv[2]->arg, "egp", 1) == 0)
|
||||
return bgp_route_match_add (vty, vty->index, "origin", "egp",
|
||||
RMAP_EVENT_MATCH_ADDED);
|
||||
if (strncmp (argv[0], "incomplete", 2) == 0)
|
||||
if (strncmp (argv[2]->arg, "incomplete", 2) == 0)
|
||||
return bgp_route_match_add (vty, vty->index, "origin", "incomplete",
|
||||
RMAP_EVENT_MATCH_ADDED);
|
||||
|
||||
@ -3565,7 +3543,7 @@ DEFUN (match_interface,
|
||||
"Match first hop interface of route\n"
|
||||
"Interface name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "interface", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "interface", argv[2]->arg,
|
||||
RMAP_EVENT_MATCH_ADDED);
|
||||
}
|
||||
|
||||
@ -3576,11 +3554,7 @@ DEFUN (no_match_interface,
|
||||
MATCH_STR
|
||||
"Match first hop interface of route\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_match_delete (vty, vty->index, "interface", NULL,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
|
||||
return bgp_route_match_delete (vty, vty->index, "interface", argv[0],
|
||||
return bgp_route_match_delete (vty, vty->index, "interface", argv[3]->arg,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
}
|
||||
|
||||
@ -3599,7 +3573,7 @@ DEFUN (match_tag,
|
||||
"Match tag of route\n"
|
||||
"Tag value\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "tag", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "tag", argv[2]->arg,
|
||||
RMAP_EVENT_MATCH_ADDED);
|
||||
}
|
||||
|
||||
@ -3610,11 +3584,7 @@ DEFUN (no_match_tag,
|
||||
MATCH_STR
|
||||
"Match tag of route\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_match_delete (vty, vty->index, "tag", NULL,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
|
||||
return bgp_route_match_delete (vty, vty->index, "tag", argv[0],
|
||||
return bgp_route_match_delete (vty, vty->index, "tag", argv[3]->arg,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
}
|
||||
|
||||
@ -3638,7 +3608,7 @@ DEFUN (set_ip_nexthop,
|
||||
union sockunion su;
|
||||
int ret;
|
||||
|
||||
ret = str2sockunion (argv[0], &su);
|
||||
ret = str2sockunion (argv[3]->arg, &su);
|
||||
if (ret < 0)
|
||||
{
|
||||
vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE);
|
||||
@ -3652,7 +3622,7 @@ DEFUN (set_ip_nexthop,
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
return bgp_route_set_add (vty, vty->index, "ip next-hop", argv[0]);
|
||||
return bgp_route_set_add (vty, vty->index, "ip next-hop", argv[3]->arg);
|
||||
}
|
||||
|
||||
DEFUN (set_ip_nexthop_peer,
|
||||
@ -3684,10 +3654,7 @@ DEFUN (no_set_ip_nexthop,
|
||||
SET_STR
|
||||
"Next hop address\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL);
|
||||
|
||||
return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[0]);
|
||||
return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[4]->arg);
|
||||
}
|
||||
|
||||
ALIAS (no_set_ip_nexthop,
|
||||
@ -3715,7 +3682,7 @@ DEFUN (set_metric,
|
||||
"Metric value for destination routing protocol\n"
|
||||
"Metric value\n")
|
||||
{
|
||||
return bgp_route_set_add (vty, vty->index, "metric", argv[0]);
|
||||
return bgp_route_set_add (vty, vty->index, "metric", argv[2]->arg);
|
||||
}
|
||||
|
||||
ALIAS (set_metric,
|
||||
@ -3741,10 +3708,7 @@ DEFUN (no_set_metric,
|
||||
SET_STR
|
||||
"Metric value for destination routing protocol\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "metric", NULL);
|
||||
|
||||
return bgp_route_set_delete (vty, vty->index, "metric", argv[0]);
|
||||
return bgp_route_set_delete (vty, vty->index, "metric", argv[3]->arg);
|
||||
}
|
||||
|
||||
ALIAS (no_set_metric,
|
||||
@ -3762,7 +3726,7 @@ DEFUN (set_local_pref,
|
||||
"BGP local preference path attribute\n"
|
||||
"Preference value\n")
|
||||
{
|
||||
return bgp_route_set_add (vty, vty->index, "local-preference", argv[0]);
|
||||
return bgp_route_set_add (vty, vty->index, "local-preference", argv[2]->arg);
|
||||
}
|
||||
|
||||
DEFUN (no_set_local_pref,
|
||||
@ -3772,10 +3736,7 @@ DEFUN (no_set_local_pref,
|
||||
SET_STR
|
||||
"BGP local preference path attribute\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "local-preference", NULL);
|
||||
|
||||
return bgp_route_set_delete (vty, vty->index, "local-preference", argv[0]);
|
||||
return bgp_route_set_delete (vty, vty->index, "local-preference", argv[3]->arg);
|
||||
}
|
||||
|
||||
ALIAS (no_set_local_pref,
|
||||
@ -3793,7 +3754,7 @@ DEFUN (set_weight,
|
||||
"BGP weight for routing table\n"
|
||||
"Weight value\n")
|
||||
{
|
||||
return bgp_route_set_add (vty, vty->index, "weight", argv[0]);
|
||||
return bgp_route_set_add (vty, vty->index, "weight", argv[2]->arg);
|
||||
}
|
||||
|
||||
DEFUN (no_set_weight,
|
||||
@ -3803,10 +3764,7 @@ DEFUN (no_set_weight,
|
||||
SET_STR
|
||||
"BGP weight for routing table\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "weight", NULL);
|
||||
|
||||
return bgp_route_set_delete (vty, vty->index, "weight", argv[0]);
|
||||
return bgp_route_set_delete (vty, vty->index, "weight", argv[3]->arg);
|
||||
}
|
||||
|
||||
ALIAS (no_set_weight,
|
||||
@ -3855,9 +3813,6 @@ DEFUN (no_set_aspath_prepend,
|
||||
int ret;
|
||||
char *str;
|
||||
|
||||
if (argc == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "as-path prepend", NULL);
|
||||
|
||||
str = argv_concat (argv, argc, 0);
|
||||
ret = bgp_route_set_delete (vty, vty->index, "as-path prepend", str);
|
||||
XFREE (MTYPE_TMP, str);
|
||||
@ -3901,9 +3856,6 @@ DEFUN (no_set_aspath_exclude,
|
||||
int ret;
|
||||
char *str;
|
||||
|
||||
if (argc == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "as-path exclude", NULL);
|
||||
|
||||
str = argv_concat (argv, argc, 0);
|
||||
ret = bgp_route_set_delete (vty, vty->index, "as-path exclude", str);
|
||||
XFREE (MTYPE_TMP, str);
|
||||
@ -3939,7 +3891,7 @@ DEFUN (set_community,
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
if (strncmp (argv[i], "additive", strlen (argv[i])) == 0)
|
||||
if (strncmp (argv[i]->arg, "additive", strlen (argv[i]->arg)) == 0)
|
||||
{
|
||||
additive = 1;
|
||||
continue;
|
||||
@ -3950,29 +3902,29 @@ DEFUN (set_community,
|
||||
else
|
||||
first = 1;
|
||||
|
||||
if (strncmp (argv[i], "internet", strlen (argv[i])) == 0)
|
||||
if (strncmp (argv[i]->arg, "internet", strlen (argv[i]->arg)) == 0)
|
||||
{
|
||||
buffer_putstr (b, "internet");
|
||||
continue;
|
||||
}
|
||||
if (strncmp (argv[i], "local-AS", strlen (argv[i])) == 0)
|
||||
if (strncmp (argv[i]->arg, "local-AS", strlen (argv[i]->arg)) == 0)
|
||||
{
|
||||
buffer_putstr (b, "local-AS");
|
||||
continue;
|
||||
}
|
||||
if (strncmp (argv[i], "no-a", strlen ("no-a")) == 0
|
||||
&& strncmp (argv[i], "no-advertise", strlen (argv[i])) == 0)
|
||||
if (strncmp (argv[i]->arg, "no-a", strlen ("no-a")) == 0
|
||||
&& strncmp (argv[i]->arg, "no-advertise", strlen (argv[i]->arg)) == 0)
|
||||
{
|
||||
buffer_putstr (b, "no-advertise");
|
||||
continue;
|
||||
}
|
||||
if (strncmp (argv[i], "no-e", strlen ("no-e"))== 0
|
||||
&& strncmp (argv[i], "no-export", strlen (argv[i])) == 0)
|
||||
if (strncmp (argv[i]->arg, "no-e", strlen ("no-e"))== 0
|
||||
&& strncmp (argv[i]->arg, "no-export", strlen (argv[i]->arg)) == 0)
|
||||
{
|
||||
buffer_putstr (b, "no-export");
|
||||
continue;
|
||||
}
|
||||
buffer_putstr (b, argv[i]);
|
||||
buffer_putstr (b, argv[i]->arg);
|
||||
}
|
||||
buffer_putc (b, '\0');
|
||||
|
||||
@ -4060,9 +4012,9 @@ DEFUN (set_community_delete,
|
||||
{
|
||||
char *str;
|
||||
|
||||
str = XCALLOC (MTYPE_TMP, strlen (argv[0]) + strlen (" delete") + 1);
|
||||
strcpy (str, argv[0]);
|
||||
strcpy (str + strlen (argv[0]), " delete");
|
||||
str = XCALLOC (MTYPE_TMP, strlen (argv[2]->arg) + strlen (" delete") + 1);
|
||||
strcpy (str, argv[2]->arg);
|
||||
strcpy (str + strlen (argv[2]->arg), " delete");
|
||||
|
||||
bgp_route_set_add (vty, vty->index, "comm-list", str);
|
||||
|
||||
@ -4175,11 +4127,11 @@ DEFUN (set_origin,
|
||||
"local IGP\n"
|
||||
"unknown heritage\n")
|
||||
{
|
||||
if (strncmp (argv[0], "igp", 2) == 0)
|
||||
if (strncmp (argv[2]->arg, "igp", 2) == 0)
|
||||
return bgp_route_set_add (vty, vty->index, "origin", "igp");
|
||||
if (strncmp (argv[0], "egp", 1) == 0)
|
||||
if (strncmp (argv[2]->arg, "egp", 1) == 0)
|
||||
return bgp_route_set_add (vty, vty->index, "origin", "egp");
|
||||
if (strncmp (argv[0], "incomplete", 2) == 0)
|
||||
if (strncmp (argv[2]->arg, "incomplete", 2) == 0)
|
||||
return bgp_route_set_add (vty, vty->index, "origin", "incomplete");
|
||||
|
||||
return CMD_WARNING;
|
||||
@ -4237,7 +4189,7 @@ DEFUN (set_aggregator_as,
|
||||
struct in_addr address;
|
||||
char *argstr;
|
||||
|
||||
ret = inet_aton (argv[1], &address);
|
||||
ret = inet_aton (argv[4]->arg, &address);
|
||||
if (ret == 0)
|
||||
{
|
||||
vty_out (vty, "Aggregator IP address is invalid%s", VTY_NEWLINE);
|
||||
@ -4245,9 +4197,9 @@ DEFUN (set_aggregator_as,
|
||||
}
|
||||
|
||||
argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
|
||||
strlen (argv[0]) + strlen (argv[1]) + 2);
|
||||
strlen (argv[3]->arg) + strlen (argv[4]->arg) + 2);
|
||||
|
||||
sprintf (argstr, "%s %s", argv[0], argv[1]);
|
||||
sprintf (argstr, "%s %s", argv[3]->arg, argv[4]->arg);
|
||||
|
||||
ret = bgp_route_set_add (vty, vty->index, "aggregator as", argstr);
|
||||
|
||||
@ -4271,7 +4223,7 @@ DEFUN (no_set_aggregator_as,
|
||||
if (argv == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "aggregator as", NULL);
|
||||
|
||||
ret = inet_aton (argv[1], &address);
|
||||
ret = inet_aton (argv[5]->arg, &address);
|
||||
if (ret == 0)
|
||||
{
|
||||
vty_out (vty, "Aggregator IP address is invalid%s", VTY_NEWLINE);
|
||||
@ -4279,9 +4231,9 @@ DEFUN (no_set_aggregator_as,
|
||||
}
|
||||
|
||||
argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
|
||||
strlen (argv[0]) + strlen (argv[1]) + 2);
|
||||
strlen (argv[4]->arg) + strlen (argv[5]->arg) + 2);
|
||||
|
||||
sprintf (argstr, "%s %s", argv[0], argv[1]);
|
||||
sprintf (argstr, "%s %s", argv[4]->arg, argv[5]->arg);
|
||||
|
||||
ret = bgp_route_set_delete (vty, vty->index, "aggregator as", argstr);
|
||||
|
||||
@ -4307,7 +4259,7 @@ DEFUN (set_tag,
|
||||
"Tag value for routing protocol\n"
|
||||
"Tag value\n")
|
||||
{
|
||||
return bgp_route_set_add (vty, vty->index, "tag", argv[0]);
|
||||
return bgp_route_set_add (vty, vty->index, "tag", argv[2]->arg);
|
||||
}
|
||||
|
||||
DEFUN (no_set_tag,
|
||||
@ -4317,10 +4269,7 @@ DEFUN (no_set_tag,
|
||||
SET_STR
|
||||
"Tag value for routing protocol\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
bgp_route_set_delete(vty, vty->index, "tag", NULL);
|
||||
|
||||
return bgp_route_set_delete (vty, vty->index, "tag", argv[0]);
|
||||
return bgp_route_set_delete (vty, vty->index, "tag", argv[3]->arg);
|
||||
}
|
||||
|
||||
ALIAS (no_set_tag,
|
||||
@ -4341,7 +4290,7 @@ DEFUN (match_ipv6_address,
|
||||
"Match IPv6 address of route\n"
|
||||
"IPv6 access-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "ipv6 address", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "ipv6 address", argv[3]->arg,
|
||||
RMAP_EVENT_FILTER_ADDED);
|
||||
}
|
||||
|
||||
@ -4354,7 +4303,7 @@ DEFUN (no_match_ipv6_address,
|
||||
"Match IPv6 address of route\n"
|
||||
"IPv6 access-list name\n")
|
||||
{
|
||||
return bgp_route_match_delete (vty, vty->index, "ipv6 address", argv[0],
|
||||
return bgp_route_match_delete (vty, vty->index, "ipv6 address", argv[4]->arg,
|
||||
RMAP_EVENT_FILTER_DELETED);
|
||||
}
|
||||
|
||||
@ -4366,7 +4315,7 @@ DEFUN (match_ipv6_next_hop,
|
||||
"Match IPv6 next-hop address of route\n"
|
||||
"IPv6 address of next hop\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "ipv6 next-hop", argv[0],
|
||||
return bgp_route_match_add (vty, vty->index, "ipv6 next-hop", argv[3]->arg,
|
||||
RMAP_EVENT_MATCH_ADDED);
|
||||
}
|
||||
|
||||
@ -4379,7 +4328,7 @@ DEFUN (no_match_ipv6_next_hop,
|
||||
"Match IPv6 next-hop address of route\n"
|
||||
"IPv6 address of next hop\n")
|
||||
{
|
||||
return bgp_route_match_delete (vty, vty->index, "ipv6 next-hop", argv[0],
|
||||
return bgp_route_match_delete (vty, vty->index, "ipv6 next-hop", argv[4]->arg,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
}
|
||||
|
||||
@ -4393,7 +4342,7 @@ DEFUN (match_ipv6_address_prefix_list,
|
||||
"IP prefix-list name\n")
|
||||
{
|
||||
return bgp_route_match_add (vty, vty->index, "ipv6 address prefix-list",
|
||||
argv[0], RMAP_EVENT_PLIST_ADDED);
|
||||
argv[4]->arg, RMAP_EVENT_PLIST_ADDED);
|
||||
}
|
||||
|
||||
DEFUN (no_match_ipv6_address_prefix_list,
|
||||
@ -4407,7 +4356,7 @@ DEFUN (no_match_ipv6_address_prefix_list,
|
||||
"IP prefix-list name\n")
|
||||
{
|
||||
return bgp_route_match_delete (vty, vty->index, "ipv6 address prefix-list",
|
||||
argv[0], RMAP_EVENT_PLIST_DELETED);
|
||||
argv[5]->arg, RMAP_EVENT_PLIST_DELETED);
|
||||
}
|
||||
|
||||
DEFUN (set_ipv6_nexthop_peer,
|
||||
@ -4468,7 +4417,7 @@ DEFUN (set_ipv6_nexthop_global,
|
||||
struct in6_addr addr;
|
||||
int ret;
|
||||
|
||||
ret = inet_pton (AF_INET6, argv[0], &addr);
|
||||
ret = inet_pton (AF_INET6, argv[4]->arg, &addr);
|
||||
if (!ret)
|
||||
{
|
||||
vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE);
|
||||
@ -4483,7 +4432,7 @@ DEFUN (set_ipv6_nexthop_global,
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[0]);
|
||||
return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[4]->arg);
|
||||
}
|
||||
|
||||
DEFUN (no_set_ipv6_nexthop_global,
|
||||
@ -4495,10 +4444,7 @@ DEFUN (no_set_ipv6_nexthop_global,
|
||||
"IPv6 next-hop address\n"
|
||||
"IPv6 global address\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", NULL);
|
||||
|
||||
return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", argv[0]);
|
||||
return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", argv[5]->arg);
|
||||
}
|
||||
|
||||
ALIAS (no_set_ipv6_nexthop_global,
|
||||
@ -4523,7 +4469,7 @@ DEFUN (set_ipv6_nexthop_local,
|
||||
struct in6_addr addr;
|
||||
int ret;
|
||||
|
||||
ret = inet_pton (AF_INET6, argv[0], &addr);
|
||||
ret = inet_pton (AF_INET6, argv[4]->arg, &addr);
|
||||
if (!ret)
|
||||
{
|
||||
vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE);
|
||||
@ -4535,7 +4481,7 @@ DEFUN (set_ipv6_nexthop_local,
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[0]);
|
||||
return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[4]->arg);
|
||||
}
|
||||
|
||||
DEFUN (no_set_ipv6_nexthop_local,
|
||||
@ -4547,10 +4493,7 @@ DEFUN (no_set_ipv6_nexthop_local,
|
||||
"IPv6 next-hop address\n"
|
||||
"IPv6 local address\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", NULL);
|
||||
|
||||
return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[0]);
|
||||
return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[5]->arg);
|
||||
}
|
||||
|
||||
ALIAS (no_set_ipv6_nexthop_local,
|
||||
@ -4572,7 +4515,7 @@ DEFUN (set_vpnv4_nexthop,
|
||||
"VPNv4 next-hop address\n"
|
||||
"IP address of next hop\n")
|
||||
{
|
||||
return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[0]);
|
||||
return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[3]->arg);
|
||||
}
|
||||
|
||||
DEFUN (no_set_vpnv4_nexthop,
|
||||
@ -4583,10 +4526,7 @@ DEFUN (no_set_vpnv4_nexthop,
|
||||
"VPNv4 information\n"
|
||||
"VPNv4 next-hop address\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", NULL);
|
||||
|
||||
return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[0]);
|
||||
return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[4]->arg);
|
||||
}
|
||||
|
||||
ALIAS (no_set_vpnv4_nexthop,
|
||||
@ -4605,7 +4545,7 @@ DEFUN (set_originator_id,
|
||||
"BGP originator ID attribute\n"
|
||||
"IP address of originator\n")
|
||||
{
|
||||
return bgp_route_set_add (vty, vty->index, "originator-id", argv[0]);
|
||||
return bgp_route_set_add (vty, vty->index, "originator-id", argv[2]->arg);
|
||||
}
|
||||
|
||||
DEFUN (no_set_originator_id,
|
||||
@ -4615,10 +4555,7 @@ DEFUN (no_set_originator_id,
|
||||
SET_STR
|
||||
"BGP originator ID attribute\n")
|
||||
{
|
||||
if (argc == 0)
|
||||
return bgp_route_set_delete (vty, vty->index, "originator-id", NULL);
|
||||
|
||||
return bgp_route_set_delete (vty, vty->index, "originator-id", argv[0]);
|
||||
return bgp_route_set_delete (vty, vty->index, "originator-id", argv[3]->arg);
|
||||
}
|
||||
|
||||
ALIAS (no_set_originator_id,
|
||||
|
@ -26,6 +26,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
#include "vty.h"
|
||||
#include "queue.h"
|
||||
#include "filter.h"
|
||||
#include "command.h"
|
||||
|
||||
#include "bgpd/bgpd.h"
|
||||
#include "bgpd/bgp_table.h"
|
||||
|
@ -20,7 +20,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
|
||||
#include <zebra.h>
|
||||
|
||||
#include "lib/json.h"
|
||||
#include "prefix.h"
|
||||
#include "thread.h"
|
||||
#include "buffer.h"
|
||||
@ -43,6 +42,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
#include "hash.h"
|
||||
#include "jhash.h"
|
||||
#include "table.h"
|
||||
#include "lib/json.h"
|
||||
|
||||
#include "bgpd/bgpd.h"
|
||||
#include "bgpd/bgp_table.h"
|
||||
|
@ -372,25 +372,25 @@ struct cmd_element
|
||||
/* IPv4 only machine should not accept IPv6 address for peer's IP
|
||||
address. So we replace VTY command string like below. */
|
||||
#ifdef HAVE_IPV6
|
||||
#define NEIGHBOR_CMD "neighbor <A.B.C.D|X:X::X:X> "
|
||||
#define NO_NEIGHBOR_CMD "no neighbor <A.B.C.D|X:X::X:X> "
|
||||
#define NEIGHBOR_CMD "neighbor (A.B.C.D|X:X::X:X) "
|
||||
#define NO_NEIGHBOR_CMD "no neighbor (A.B.C.D|X:X::X:X) "
|
||||
#define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n"
|
||||
#define NEIGHBOR_CMD2 "neighbor <A.B.C.D|X:X::X:X|WORD> "
|
||||
#define NO_NEIGHBOR_CMD2 "no neighbor <A.B.C.D|X:X::X:X|WORD> "
|
||||
#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|X:X::X:X|WORD) "
|
||||
#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|X:X::X:X|WORD) "
|
||||
#define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n"
|
||||
#define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n"
|
||||
#else
|
||||
#define NEIGHBOR_CMD "neighbor A.B.C.D "
|
||||
#define NO_NEIGHBOR_CMD "no neighbor A.B.C.D "
|
||||
#define NEIGHBOR_ADDR_STR "Neighbor address\n"
|
||||
#define NEIGHBOR_CMD2 "neighbor <A.B.C.D|WORD> "
|
||||
#define NO_NEIGHBOR_CMD2 "no neighbor <A.B.C.D|WORD> "
|
||||
#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|WORD) "
|
||||
#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|WORD) "
|
||||
#define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n"
|
||||
#endif /* HAVE_IPV6 */
|
||||
|
||||
/* Dynamic neighbor (listen range) configuration */
|
||||
#ifdef HAVE_IPV6
|
||||
#define LISTEN_RANGE_CMD "bgp listen range <A.B.C.D/M|X:X::X:X/M> "
|
||||
#define LISTEN_RANGE_CMD "bgp listen range (A.B.C.D/M|X:X::X:X/M) "
|
||||
#define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n"
|
||||
#else
|
||||
#define LISTEN_RANGE_CMD "bgp listen range A.B.C.D/M "
|
||||
|
@ -30,7 +30,7 @@
|
||||
* what.
|
||||
*/
|
||||
int
|
||||
use_json (const int argc, const struct cmd_token *argv[])
|
||||
use_json (const int argc, struct cmd_token *argv[])
|
||||
{
|
||||
if (argc == 0)
|
||||
return 0;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <json/json.h>
|
||||
#endif
|
||||
|
||||
extern int use_json(const int argc, const struct cmd_token *argv[]);
|
||||
extern int use_json(const int argc, struct cmd_token *argv[]);
|
||||
extern void json_object_string_add(struct json_object* obj, const char *key,
|
||||
const char *s);
|
||||
extern void json_object_int_add(struct json_object* obj, const char *key,
|
||||
|
@ -6,29 +6,30 @@ import os
|
||||
from pprint import pformat
|
||||
|
||||
|
||||
def token_is_variable(token):
|
||||
def token_is_variable(line_number, token):
|
||||
|
||||
if token.isdigit():
|
||||
return True
|
||||
|
||||
if token.startswith('('):
|
||||
assert token.endswith(')'), "token %s should end with )" % token
|
||||
assert token.endswith(')'), "%d: token %s should end with )" % (line_number, token)
|
||||
return True
|
||||
|
||||
if token.startswith('['):
|
||||
assert token.endswith(']'), "token %s should end with ]" % token
|
||||
assert token.endswith(']'), "%d: token %s should end with ]" % (line_number, token)
|
||||
return True
|
||||
|
||||
if token.startswith('{'):
|
||||
# I don't really care about checking for this I just put
|
||||
# these asserts in here to bug sharpd
|
||||
assert token.endswith('}'), "token %s should end with }" % token
|
||||
assert token.endswith('}'), "%d: token %s should end with }" % (line_number, token)
|
||||
return True
|
||||
|
||||
assert '|' not in token, "Weird token %s has a | but does not start with [ or (" % token
|
||||
assert '|' not in token, "%d: Weird token %s has a | but does not start with [ or (" % (line_number, token)
|
||||
|
||||
if token in ('WORD',
|
||||
'.LINE', # where is this defined?
|
||||
'PATH',
|
||||
'A.B.C.D',
|
||||
'A.B.C.D/M',
|
||||
'X:X::X:X',
|
||||
@ -43,22 +44,22 @@ def token_is_variable(token):
|
||||
return False
|
||||
|
||||
|
||||
def get_argv_translator(line):
|
||||
def get_argv_translator(line_number, line):
|
||||
table = {}
|
||||
line = line.strip()
|
||||
assert line.startswith('"'), "line does not start with \"\n%s" % line
|
||||
assert line.endswith('",'), "line does not end with \",\n%s" % line
|
||||
assert line.startswith('"'), "%d: line does not start with \"\n%s" % (line_number, line)
|
||||
assert line.endswith('",'), "%d: line does not end with \",\n%s" % (line_number, line)
|
||||
|
||||
line = line[1:-2]
|
||||
|
||||
funky_chars = ('+', '"')
|
||||
for char in funky_chars:
|
||||
if char in line:
|
||||
raise Exception("Add support for tokens in\n%s\n\nsee BGP_INSTANCE_CMD down below" % line)
|
||||
raise Exception("%d: Add support for tokens in\n%s\n\nsee BGP_INSTANCE_CMD down below" % (line_number, line))
|
||||
|
||||
old_style_index = 0
|
||||
for (token_index, token) in enumerate(line.split()):
|
||||
if token_is_variable(token):
|
||||
if token_is_variable(line_number, token):
|
||||
# print "%s is a token" % token
|
||||
table[old_style_index] = token_index
|
||||
old_style_index += 1
|
||||
@ -84,6 +85,7 @@ def update_argvs(filename):
|
||||
|
||||
if state is None:
|
||||
if line.startswith('DEFUN ('):
|
||||
assert line.count(',') == 1, "Too many commas in\n%s" % line
|
||||
state = 'DEFUN_HEADER'
|
||||
defun_line_number = line_number
|
||||
|
||||
@ -99,12 +101,45 @@ def update_argvs(filename):
|
||||
|
||||
elif line_number == defun_line_number + 2:
|
||||
|
||||
# bgpd/bgp_vty.h
|
||||
# in the middle
|
||||
line = line.replace('" CMD_AS_RANGE "', '<1-4294967295>')
|
||||
line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE "', '<1-5000>')
|
||||
line = line.replace('" BGP_INSTANCE_CMD "', '(view|vrf) WORD')
|
||||
line = line.replace('" BGP_INSTANCE_ALL_CMD "', '(view|vrf) all')
|
||||
argv_translator = get_argv_translator(line)
|
||||
line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM) "', '<1-255>')
|
||||
line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD "', '(kernel|connected|static|rip|ospf|isis|pim|table)')
|
||||
line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD "', '(kernel|connected|static|ripng|ospf6|isis|table)')
|
||||
|
||||
# endswith
|
||||
line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",')
|
||||
line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE,', ' <1-5000>",')
|
||||
line = line.replace('" BGP_INSTANCE_CMD,', ' (view|vrf) WORD",')
|
||||
line = line.replace('" BGP_INSTANCE_ALL_CMD,', ' (view|vrf) all",')
|
||||
line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM),', '<1-255>",')
|
||||
line = line.replace('" CMD_RANGE_STR(1, MAXTTL),', '<1-255>",')
|
||||
|
||||
line = line.replace('" BGP_UPDATE_SOURCE_REQ_STR,', ' (A.B.C.D|X:X::X:X|WORD)",')
|
||||
line = line.replace('" BGP_UPDATE_SOURCE_OPT_STR,', ' {A.B.C.D|X:X::X:X|WORD}",')
|
||||
line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD,', ' (kernel|connected|static|rip|ospf|isis|pim|table)",')
|
||||
line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD,', ' (kernel|connected|static|ripng|ospf6|isis|table)",')
|
||||
|
||||
# startswith
|
||||
line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ')
|
||||
line = line.replace('NO_NEIGHBOR_CMD2 "', '"no neighbor (A.B.C.D|X:X::X:X|WORD) ')
|
||||
line = line.replace('NEIGHBOR_CMD2 "', '"neighbor (A.B.C.D|X:X::X:X|WORD) ')
|
||||
line = line.replace('NO_NEIGHBOR_CMD "', '"no neighbor (A.B.C.D|X:X::X:X) ')
|
||||
line = line.replace('NEIGHBOR_CMD "', '"neighbor (A.B.C.D|X:X::X:X) ')
|
||||
|
||||
# solo
|
||||
line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor (A.B.C.D|X:X::X:X|WORD)",')
|
||||
line = line.replace('NEIGHBOR_CMD2,', '"neighbor (A.B.C.D|X:X::X:X|WORD)",')
|
||||
line = line.replace('NO_NEIGHBOR_CMD,', '"no neighbor (A.B.C.D|X:X::X:X)",')
|
||||
line = line.replace('NEIGHBOR_CMD,', '"neighbor (A.B.C.D|X:X::X:X)",')
|
||||
|
||||
if line.rstrip().endswith('" ,'):
|
||||
line = line.replace('" ,', '",')
|
||||
|
||||
argv_translator = get_argv_translator(line_number, line)
|
||||
print_translator = True
|
||||
|
||||
elif state == 'DEFUN_BODY':
|
||||
|
Loading…
Reference in New Issue
Block a user