diff options
-rw-r--r-- | bgpd/bgp_aspath.c | 1 | ||||
-rw-r--r-- | bgpd/bgp_attr.c | 1 | ||||
-rw-r--r-- | bgpd/bgp_community.c | 1 | ||||
-rw-r--r-- | bgpd/bgp_debug.c | 64 | ||||
-rw-r--r-- | bgpd/bgp_dump.c | 8 | ||||
-rw-r--r-- | bgpd/bgp_filter.c | 29 | ||||
-rw-r--r-- | bgpd/bgp_fsm.c | 1 | ||||
-rw-r--r-- | bgpd/bgp_mplsvpn.c | 34 | ||||
-rw-r--r-- | bgpd/bgp_nexthop.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 610 | ||||
-rw-r--r-- | bgpd/bgp_routemap.c | 221 | ||||
-rw-r--r-- | bgpd/bgp_table.c | 1 | ||||
-rw-r--r-- | bgpd/bgpd.c | 2 | ||||
-rw-r--r-- | lib/command.h | 14 | ||||
-rw-r--r-- | lib/json.c | 2 | ||||
-rw-r--r-- | lib/json.h | 2 | ||||
-rwxr-xr-x | tools/argv_translator.py | 59 |
17 files changed, 516 insertions, 538 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index eca444101..c33366f40 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -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" diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 3cb52ef91..936428e17 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -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" diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index 450cbddcf..17a3d2fda 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -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" diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index dc0f53984..bf865afdc 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -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; } diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index e219d5248..52989385d 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -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) diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 33877e725..1235e50d2 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -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); diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index f775bd048..c4c3b0f62 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -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" diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 5c1df6715..4721a2e8e 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -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) diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 19f5428d8..caecd80e6 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -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 diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 67ea246c1..2472511fe 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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 "linklist.h" #include "memory.h" @@ -37,6 +36,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "workqueue.h" #include "queue.h" #include "memory.h" +#include "lib/json.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" @@ -4265,7 +4265,7 @@ DEFUN (bgp_table_map, "Name of the route map\n") { return bgp_table_map_set (vty, vty->index, - bgp_node_afi (vty), bgp_node_safi (vty), argv[0]); + bgp_node_afi (vty), bgp_node_safi (vty), argv[1]->arg); } DEFUN (no_bgp_table_map, no_bgp_table_map_cmd, @@ -4274,7 +4274,7 @@ DEFUN (no_bgp_table_map, "Name of the route map\n") { return bgp_table_map_unset (vty, vty->index, - bgp_node_afi (vty), bgp_node_safi (vty), argv[0]); + bgp_node_afi (vty), bgp_node_safi (vty), argv[2]->arg); } DEFUN (bgp_network, @@ -4283,7 +4283,7 @@ DEFUN (bgp_network, "Specify a network to announce via BGP\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_static_set (vty, vty->index, argv[0], + return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP, bgp_node_safi (vty), NULL, 0); } @@ -4295,8 +4295,8 @@ DEFUN (bgp_network_route_map, "Route-map to modify the attributes\n" "Name of the route map\n") { - return bgp_static_set (vty, vty->index, argv[0], - AFI_IP, bgp_node_safi (vty), argv[1], 0); + return bgp_static_set (vty, vty->index, argv[1]->arg, + AFI_IP, bgp_node_safi (vty), argv[3]->arg, 0); } DEFUN (bgp_network_backdoor, @@ -4306,7 +4306,7 @@ DEFUN (bgp_network_backdoor, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Specify a BGP backdoor route\n") { - return bgp_static_set (vty, vty->index, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP, SAFI_UNICAST, NULL, 1); } @@ -4321,7 +4321,7 @@ DEFUN (bgp_network_mask, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[3]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4345,7 +4345,7 @@ DEFUN (bgp_network_mask_route_map, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[3]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4353,7 +4353,7 @@ DEFUN (bgp_network_mask_route_map, } return bgp_static_set (vty, vty->index, prefix_str, - AFI_IP, bgp_node_safi (vty), argv[2], 0); + AFI_IP, bgp_node_safi (vty), argv[5]->arg, 0); } DEFUN (bgp_network_mask_backdoor, @@ -4368,7 +4368,7 @@ DEFUN (bgp_network_mask_backdoor, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[3]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4388,7 +4388,7 @@ DEFUN (bgp_network_mask_natural, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], NULL, prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4410,7 +4410,7 @@ DEFUN (bgp_network_mask_natural_route_map, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], NULL, prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4418,7 +4418,7 @@ DEFUN (bgp_network_mask_natural_route_map, } return bgp_static_set (vty, vty->index, prefix_str, - AFI_IP, bgp_node_safi (vty), argv[1], 0); + AFI_IP, bgp_node_safi (vty), argv[3]->arg, 0); } DEFUN (bgp_network_mask_natural_backdoor, @@ -4431,7 +4431,7 @@ DEFUN (bgp_network_mask_natural_backdoor, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], NULL, prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4449,7 +4449,7 @@ DEFUN (no_bgp_network, "Specify a network to announce via BGP\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_static_unset (vty, vty->index, argv[0], AFI_IP, + return bgp_static_unset (vty, vty->index, argv[2]->arg, AFI_IP, bgp_node_safi (vty)); } @@ -4482,7 +4482,7 @@ DEFUN (no_bgp_network_mask, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[2]->arg, argv[4]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4524,7 +4524,7 @@ DEFUN (no_bgp_network_mask_natural, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], NULL, prefix_str); + ret = netmask_str2prefix_str (argv[2]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4559,7 +4559,7 @@ DEFUN (ipv6_bgp_network, "Specify a network to announce via BGP\n" "IPv6 prefix <network>/<length>\n") { - return bgp_static_set (vty, vty->index, argv[0], AFI_IP6, bgp_node_safi(vty), + return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP6, bgp_node_safi(vty), NULL, 0); } @@ -4571,8 +4571,8 @@ DEFUN (ipv6_bgp_network_route_map, "Route-map to modify the attributes\n" "Name of the route map\n") { - return bgp_static_set (vty, vty->index, argv[0], AFI_IP6, - bgp_node_safi (vty), argv[1], 0); + return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP6, + bgp_node_safi (vty), argv[3]->arg, 0); } DEFUN (no_ipv6_bgp_network, @@ -4582,7 +4582,7 @@ DEFUN (no_ipv6_bgp_network, "Specify a network to announce via BGP\n" "IPv6 prefix <network>/<length>\n") { - return bgp_static_unset (vty, vty->index, argv[0], AFI_IP6, bgp_node_safi(vty)); + return bgp_static_unset (vty, vty->index, argv[2]->arg, AFI_IP6, bgp_node_safi(vty)); } ALIAS (no_ipv6_bgp_network, @@ -5219,7 +5219,7 @@ DEFUN (aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP, bgp_node_safi (vty), 0, 0); + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), 0, 0); } DEFUN (aggregate_address_mask, @@ -5232,7 +5232,7 @@ DEFUN (aggregate_address_mask, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); if (! ret) { @@ -5251,7 +5251,7 @@ DEFUN (aggregate_address_summary_only, "Aggregate prefix\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP, bgp_node_safi (vty), + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), AGGREGATE_SUMMARY_ONLY, 0); } @@ -5266,7 +5266,7 @@ DEFUN (aggregate_address_mask_summary_only, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); if (! ret) { @@ -5285,7 +5285,7 @@ DEFUN (aggregate_address_as_set, "Aggregate prefix\n" "Generate AS set path information\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP, bgp_node_safi (vty), + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), 0, AGGREGATE_AS_SET); } @@ -5300,7 +5300,7 @@ DEFUN (aggregate_address_mask_as_set, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); if (! ret) { @@ -5321,7 +5321,7 @@ DEFUN (aggregate_address_as_set_summary, "Generate AS set path information\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP, bgp_node_safi (vty), + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), AGGREGATE_SUMMARY_ONLY, AGGREGATE_AS_SET); } @@ -5345,7 +5345,7 @@ DEFUN (aggregate_address_mask_as_set_summary, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); if (! ret) { @@ -5373,7 +5373,7 @@ DEFUN (no_aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_unset (vty, argv[0], AFI_IP, bgp_node_safi (vty)); + return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP, bgp_node_safi (vty)); } ALIAS (no_aggregate_address, @@ -5421,7 +5421,7 @@ DEFUN (no_aggregate_address_mask, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[2]->arg, argv[3]->arg, prefix_str); if (! ret) { @@ -5477,7 +5477,7 @@ DEFUN (ipv6_aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP6, SAFI_UNICAST, 0, 0); + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP6, SAFI_UNICAST, 0, 0); } DEFUN (ipv6_aggregate_address_summary_only, @@ -5487,7 +5487,7 @@ DEFUN (ipv6_aggregate_address_summary_only, "Aggregate prefix\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP6, SAFI_UNICAST, AGGREGATE_SUMMARY_ONLY, 0); } @@ -5498,7 +5498,7 @@ DEFUN (no_ipv6_aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_unset (vty, argv[0], AFI_IP6, SAFI_UNICAST); + return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP6, SAFI_UNICAST); } DEFUN (no_ipv6_aggregate_address_summary_only, @@ -5509,7 +5509,7 @@ DEFUN (no_ipv6_aggregate_address_summary_only, "Aggregate prefix\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_unset (vty, argv[0], AFI_IP6, SAFI_UNICAST); + return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP6, SAFI_UNICAST); } ALIAS (ipv6_aggregate_address, @@ -7947,7 +7947,7 @@ DEFUN (show_ip_bgp_ipv4, { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_normal, NULL, uj); @@ -7973,7 +7973,7 @@ DEFUN (show_ip_bgp_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_route_pathtype, @@ -7989,10 +7989,10 @@ DEFUN (show_ip_bgp_route_pathtype, { u_char uj = use_json(argc, argv); - if (strncmp (argv[1], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[4]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } DEFUN (show_bgp_ipv4_safi_route_pathtype, @@ -8010,16 +8010,16 @@ DEFUN (show_bgp_ipv4_safi_route_pathtype, { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[3]->arg, "m", 1) == 0) + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } DEFUN (show_bgp_ipv4_prefix, @@ -8031,7 +8031,7 @@ DEFUN (show_bgp_ipv4_prefix, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_route, @@ -8043,7 +8043,7 @@ DEFUN (show_bgp_ipv6_route, "Network in the BGP routing table to display\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_prefix, @@ -8055,7 +8055,7 @@ DEFUN (show_bgp_ipv6_prefix, "IPv6 prefix <network>/<length>\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc,argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc,argv)); } DEFUN (show_ip_bgp_ipv4_route, @@ -8072,10 +8072,10 @@ DEFUN (show_ip_bgp_ipv4_route, { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); } ALIAS (show_ip_bgp_ipv4_route, @@ -8100,7 +8100,7 @@ DEFUN (show_ip_bgp_vpnv4_all_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_ipv4_vpn_route, @@ -8113,7 +8113,7 @@ DEFUN (show_bgp_ipv4_vpn_route, "Network in the BGP routing table to display\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_vpn_route, @@ -8126,7 +8126,7 @@ DEFUN (show_bgp_ipv6_vpn_route, "Network in the BGP routing table to display\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv4_vpn_rd_route, @@ -8144,13 +8144,13 @@ DEFUN (show_bgp_ipv4_vpn_rd_route, 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); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_vpn_rd_route, @@ -8168,13 +8168,13 @@ DEFUN (show_bgp_ipv6_vpn_rd_route, 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); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP6, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_ip_bgp_vpnv4_rd_route, @@ -8193,13 +8193,13 @@ DEFUN (show_ip_bgp_vpnv4_rd_route, 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) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, uj); } DEFUN (show_ip_bgp_prefix, @@ -8211,7 +8211,7 @@ DEFUN (show_ip_bgp_prefix, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_prefix_pathtype, @@ -8226,10 +8226,10 @@ DEFUN (show_ip_bgp_prefix_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[1], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[4]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } DEFUN (show_ip_bgp_ipv4_prefix, @@ -8246,10 +8246,10 @@ DEFUN (show_ip_bgp_ipv4_prefix, { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); } ALIAS (show_ip_bgp_ipv4_prefix, @@ -8279,16 +8279,16 @@ DEFUN (show_ip_bgp_ipv4_prefix_pathtype, { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[4]->arg, "m", 1) == 0) + if (strncmp (argv[6]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[6]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } ALIAS (show_ip_bgp_ipv4_prefix_pathtype, @@ -8315,7 +8315,7 @@ DEFUN (show_ip_bgp_vpnv4_all_prefix, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_vpnv4_rd_prefix, @@ -8333,13 +8333,13 @@ DEFUN (show_ip_bgp_vpnv4_rd_prefix, 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); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_view, @@ -8354,10 +8354,10 @@ DEFUN (show_ip_bgp_view, struct bgp *bgp; /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[1]); + bgp = bgp_lookup_by_name (argv[4]->arg); if (bgp == NULL) { - vty_out (vty, "Can't find BGP instance %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[4]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -8389,7 +8389,7 @@ DEFUN (show_ip_bgp_instance_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_instance_route_pathtype, @@ -8406,10 +8406,10 @@ DEFUN (show_ip_bgp_instance_route_pathtype, { u_char uj = use_json(argc, argv); - if (strncmp (argv[3], "b", 1) == 0) - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[6]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } DEFUN (show_ip_bgp_instance_prefix, @@ -8422,7 +8422,7 @@ DEFUN (show_ip_bgp_instance_prefix, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_instance_prefix_pathtype, @@ -8438,10 +8438,10 @@ DEFUN (show_ip_bgp_instance_prefix_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[3], "b", 1) == 0) - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[6]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } #ifdef HAVE_IPV6 @@ -8475,7 +8475,7 @@ DEFUN (show_bgp_ipv6_safi, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[3]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, bgp_show_type_normal, NULL, uj); @@ -8512,7 +8512,7 @@ DEFUN (show_bgp_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_ipv6_safi_route, @@ -8527,10 +8527,10 @@ DEFUN (show_bgp_ipv6_safi_route, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); + if (strncmp (argv[3]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); } DEFUN (show_bgp_route_pathtype, @@ -8544,10 +8544,10 @@ DEFUN (show_bgp_route_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[1], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[3]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } ALIAS (show_bgp_route_pathtype, @@ -8575,16 +8575,16 @@ DEFUN (show_bgp_ipv6_safi_route_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[3]->arg, "m", 1) == 0) + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } /* old command */ @@ -8598,7 +8598,7 @@ DEFUN (show_ipv6_bgp_route, "JavaScript Object Notation\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_prefix, @@ -8609,7 +8609,7 @@ DEFUN (show_bgp_prefix, "IPv6 prefix <network>/<length>\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_ipv6_safi_prefix, @@ -8624,10 +8624,10 @@ DEFUN (show_bgp_ipv6_safi_prefix, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); + if (strncmp (argv[3]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); } DEFUN (show_bgp_prefix_pathtype, @@ -8641,10 +8641,10 @@ DEFUN (show_bgp_prefix_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[1], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[3]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } ALIAS (show_bgp_prefix_pathtype, @@ -8672,16 +8672,16 @@ DEFUN (show_bgp_ipv6_safi_prefix_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[3]->arg, "m", 1) == 0) + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } /* old command */ @@ -8695,7 +8695,7 @@ DEFUN (show_ipv6_bgp_prefix, "JavaScript Object Notation\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_view, @@ -8709,10 +8709,10 @@ DEFUN (show_bgp_view, struct bgp *bgp; /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[1]); + bgp = bgp_lookup_by_name (argv[3]->arg); if (bgp == NULL) { - vty_out (vty, "Can't find BGP instance %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -8751,7 +8751,7 @@ DEFUN (show_bgp_instance_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } ALIAS (show_bgp_instance_route, @@ -8776,10 +8776,10 @@ DEFUN (show_bgp_instance_route_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[3], "b", 1) == 0) - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } ALIAS (show_bgp_instance_route_pathtype, @@ -8803,7 +8803,7 @@ DEFUN (show_bgp_instance_prefix, "IPv6 prefix <network>/<length>\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } ALIAS (show_bgp_instance_prefix, @@ -8828,10 +8828,10 @@ DEFUN (show_bgp_instance_prefix_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[3], "b", 1) == 0) - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } ALIAS (show_bgp_instance_prefix_pathtype, @@ -8855,7 +8855,7 @@ DEFUN (show_bgp_instance_prefix_list, "Display routes conforming to the prefix-list\n" "IPv6 prefix-list name\n") { - return bgp_show_prefix_list (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_list (vty, argv[3]->arg, argv[5]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -8878,7 +8878,7 @@ DEFUN (show_bgp_instance_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, + return bgp_show_filter_list (vty, argv[3]->arg, argv[5]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -8901,7 +8901,7 @@ DEFUN (show_bgp_instance_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, + return bgp_show_route_map (vty, argv[3]->arg, argv[5]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_route_map); } @@ -8925,7 +8925,7 @@ DEFUN (show_bgp_instance_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, argv[1], argv[2], 0, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, argv[3]->arg, argv[5]->arg, 0, AFI_IP6, SAFI_UNICAST); } ALIAS (show_bgp_instance_community_list, @@ -8948,7 +8948,7 @@ DEFUN (show_bgp_instance_prefix_longer, "IPv6 prefix <network>/<length>\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -8987,7 +8987,7 @@ DEFUN (show_ipv6_mbgp_route, "JavaScript Object Notation\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } /* old command */ @@ -9001,13 +9001,13 @@ DEFUN (show_ipv6_mbgp_prefix, "JavaScript Object Notation\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } #endif static int -bgp_show_regexp (struct vty *vty, int argc, const char **argv, afi_t afi, +bgp_show_regexp (struct vty *vty, int argc, struct cmd_token **argv, afi_t afi, safi_t safi, enum bgp_show_type type) { int i; @@ -9025,12 +9025,12 @@ bgp_show_regexp (struct vty *vty, int argc, const char **argv, afi_t afi, buffer_putc (b, ' '); else { - if ((strcmp (argv[i], "unicast") == 0) || (strcmp (argv[i], "multicast") == 0)) + if ((strcmp (argv[i]->arg, "unicast") == 0) || (strcmp (argv[i]->arg, "multicast") == 0)) continue; first = 1; } - buffer_putstr (b, argv[i]); + buffer_putstr (b, argv[i]->arg); } buffer_putc (b, '\0'); @@ -9041,7 +9041,7 @@ bgp_show_regexp (struct vty *vty, int argc, const char **argv, afi_t afi, XFREE(MTYPE_TMP, regstr); if (! regex) { - vty_out (vty, "Can't compile regexp %s%s", argv[0], + vty_out (vty, "Can't compile regexp %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -9101,7 +9101,7 @@ DEFUN (show_ip_bgp_ipv4_regexp, "Display routes matching the AS path regular expression\n" "A regular-expression to match the BGP AS paths\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show_regexp (vty, argc, argv, AFI_IP, SAFI_MULTICAST, bgp_show_type_regexp); @@ -9196,7 +9196,7 @@ DEFUN (show_ip_bgp_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - return bgp_show_prefix_list (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9210,7 +9210,7 @@ DEFUN (show_ip_bgp_instance_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - return bgp_show_prefix_list (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_list (vty, argv[4]->arg, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9224,7 +9224,7 @@ DEFUN (show_ip_bgp_flap_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - return bgp_show_prefix_list (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_prefix_list); } @@ -9251,11 +9251,11 @@ DEFUN (show_ip_bgp_ipv4_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_prefix_list (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_prefix_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_prefix_list); - return bgp_show_prefix_list (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9268,7 +9268,7 @@ DEFUN (show_bgp_prefix_list, "Display routes conforming to the prefix-list\n" "IPv6 prefix-list name\n") { - return bgp_show_prefix_list (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9292,7 +9292,7 @@ DEFUN (show_ipv6_bgp_prefix_list, "IPv6 prefix-list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_list (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9307,7 +9307,7 @@ DEFUN (show_ipv6_mbgp_prefix_list, "IPv6 prefix-list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_list (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, + return bgp_show_prefix_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, bgp_show_type_prefix_list); } #endif /* HAVE_IPV6 */ @@ -9345,7 +9345,7 @@ DEFUN (show_ip_bgp_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9359,7 +9359,7 @@ DEFUN (show_ip_bgp_instance_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, + return bgp_show_filter_list (vty, argv[4]->arg, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9373,7 +9373,7 @@ DEFUN (show_ip_bgp_flap_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_filter_list); } @@ -9400,11 +9400,11 @@ DEFUN (show_ip_bgp_ipv4_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_filter_list (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_filter_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_filter_list); - return bgp_show_filter_list (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9417,7 +9417,7 @@ DEFUN (show_bgp_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9441,7 +9441,7 @@ DEFUN (show_ipv6_bgp_filter_list, "Regular expression access list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_filter_list (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9456,7 +9456,7 @@ DEFUN (show_ipv6_mbgp_filter_list, "Regular expression access list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_filter_list (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, + return bgp_show_filter_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, bgp_show_type_filter_list); } #endif /* HAVE_IPV6 */ @@ -9486,7 +9486,7 @@ DEFUN (show_ip_bgp_ipv4_dampening_parameters, "Display detailed information about dampening\n" "Display detail of configured dampening parameters\n") { - if (strncmp(argv[0], "m", 1) == 0) + if (strncmp(argv[4]->arg, "m", 1) == 0) return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_MULTICAST); return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_UNICAST); @@ -9505,7 +9505,7 @@ DEFUN (show_ip_bgp_ipv4_dampening_flap_stats, "Display detailed information about dampening\n" "Display flap statistics of routes\n") { - if (strncmp(argv[0], "m", 1) == 0) + if (strncmp(argv[4]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_flap_statistics, NULL, 0); @@ -9525,7 +9525,7 @@ DEFUN (show_ip_bgp_ipv4_dampening_dampd_paths, "Display detailed information about dampening\n" "Display paths suppressed due to dampening\n") { - if (strncmp(argv[0], "m", 1) == 0) + if (strncmp(argv[4]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_dampend_paths, NULL, 0); @@ -9567,7 +9567,7 @@ DEFUN (show_ip_bgp_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_route_map (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9581,7 +9581,7 @@ DEFUN (show_ip_bgp_instance_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, + return bgp_show_route_map (vty, argv[4]->arg, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9595,7 +9595,7 @@ DEFUN (show_ip_bgp_flap_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_route_map (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_route_map); } @@ -9622,11 +9622,11 @@ DEFUN (show_ip_bgp_ipv4_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route_map (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_route_map (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_route_map); - return bgp_show_route_map (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, + return bgp_show_route_map (vty, NULL, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9638,7 +9638,7 @@ DEFUN (show_bgp_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_route_map (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9697,7 +9697,7 @@ DEFUN (show_ip_bgp_ipv4_cidr_only, "Address Family modifier\n" "Display only routes with non-natural netmasks\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_cidr_only, NULL, 0); @@ -9728,7 +9728,7 @@ DEFUN (show_ip_bgp_ipv4_community_all, "Address Family modifier\n" "Display routes matching the communities\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_community_all, NULL, 0); @@ -9787,7 +9787,7 @@ DEFUN (show_ipv6_mbgp_community_all, static int bgp_show_community (struct vty *vty, const char *view_name, int argc, - const char **argv, int exact, afi_t afi, safi_t safi) + struct cmd_token **argv, int exact, afi_t afi, safi_t safi) { struct community *com; struct buffer *b; @@ -9823,12 +9823,12 @@ bgp_show_community (struct vty *vty, const char *view_name, int argc, buffer_putc (b, ' '); else { - if ((strcmp (argv[i], "unicast") == 0) || (strcmp (argv[i], "multicast") == 0)) + if ((strcmp (argv[i]->arg, "unicast") == 0) || (strcmp (argv[i]->arg, "multicast") == 0)) continue; first = 1; } - buffer_putstr (b, argv[i]); + buffer_putstr (b, argv[i]->arg); } buffer_putc (b, '\0'); @@ -9938,7 +9938,7 @@ DEFUN (show_ip_bgp_ipv4_community, "Do not advertise to any peer (well-known community)\n" "Do not export to next AS (well-known community)\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_MULTICAST); return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_UNICAST); @@ -10030,15 +10030,15 @@ DEFUN (show_bgp_instance_afi_safi_community_all, struct bgp *bgp; /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[1]); + bgp = bgp_lookup_by_name (argv[3]->arg); if (bgp == NULL) { - vty_out (vty, "Can't find BGP instance %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } - afi = (strncmp (argv[2], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[3], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + afi = (strncmp (argv[4]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; + safi = (strncmp (argv[5]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL, 0); } @@ -10061,9 +10061,9 @@ DEFUN (show_bgp_instance_afi_safi_community, int afi; int safi; - afi = (strncmp (argv[2], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[3], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - return bgp_show_community (vty, argv[1], argc-4, &argv[4], 0, afi, safi); + afi = (strncmp (argv[4]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; + safi = (strncmp (argv[5]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + return bgp_show_community (vty, argv[3]->arg, argc, argv, 0, afi, safi); } ALIAS (show_bgp_instance_afi_safi_community, @@ -10233,7 +10233,7 @@ DEFUN (show_ip_bgp_ipv4_community_exact, "Do not export to next AS (well-known community)\n" "Exact match of the communities") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_MULTICAST); return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_UNICAST); @@ -10972,7 +10972,7 @@ DEFUN (show_ip_bgp_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, NULL, argv[0], 0, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 0, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_instance_community_list, @@ -10986,7 +10986,7 @@ DEFUN (show_ip_bgp_instance_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, argv[1], argv[2], 0, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, argv[4]->arg, argv[6]->arg, 0, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_ipv4_community_list, @@ -11002,10 +11002,10 @@ DEFUN (show_ip_bgp_ipv4_community_list, "community-list number\n" "community-list name\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_community_list (vty, NULL, argv[1], 0, AFI_IP, SAFI_MULTICAST); + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_community_list (vty, NULL, argv[6]->arg, 0, AFI_IP, SAFI_MULTICAST); - return bgp_show_community_list (vty, NULL, argv[1], 0, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[6]->arg, 0, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_community_list_exact, @@ -11019,7 +11019,7 @@ DEFUN (show_ip_bgp_community_list_exact, "community-list name\n" "Exact match of the communities\n") { - return bgp_show_community_list (vty, NULL, argv[0], 1, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 1, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_ipv4_community_list_exact, @@ -11036,10 +11036,10 @@ DEFUN (show_ip_bgp_ipv4_community_list_exact, "community-list name\n" "Exact match of the communities\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_community_list (vty, NULL, argv[1], 1, AFI_IP, SAFI_MULTICAST); + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_community_list (vty, NULL, argv[6]->arg, 1, AFI_IP, SAFI_MULTICAST); - return bgp_show_community_list (vty, NULL, argv[1], 1, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[6]->arg, 1, AFI_IP, SAFI_UNICAST); } #ifdef HAVE_IPV6 @@ -11052,7 +11052,7 @@ DEFUN (show_bgp_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, NULL, argv[0], 0, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[3]->arg, 0, AFI_IP6, SAFI_UNICAST); } ALIAS (show_bgp_community_list, @@ -11076,7 +11076,7 @@ DEFUN (show_ipv6_bgp_community_list, "community-list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[0], 0, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 0, AFI_IP6, SAFI_UNICAST); } /* old command */ @@ -11090,7 +11090,7 @@ DEFUN (show_ipv6_mbgp_community_list, "community-list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[0], 0, AFI_IP6, SAFI_MULTICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 0, AFI_IP6, SAFI_MULTICAST); } DEFUN (show_bgp_community_list_exact, @@ -11103,7 +11103,7 @@ DEFUN (show_bgp_community_list_exact, "community-list name\n" "Exact match of the communities\n") { - return bgp_show_community_list (vty, NULL, argv[0], 1, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[3]->arg, 1, AFI_IP6, SAFI_UNICAST); } ALIAS (show_bgp_community_list_exact, @@ -11129,7 +11129,7 @@ DEFUN (show_ipv6_bgp_community_list_exact, "Exact match of the communities\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[0], 1, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 1, AFI_IP6, SAFI_UNICAST); } /* old command */ @@ -11144,7 +11144,7 @@ DEFUN (show_ipv6_mbgp_community_list_exact, "Exact match of the communities\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[0], 1, AFI_IP6, SAFI_MULTICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 1, AFI_IP6, SAFI_MULTICAST); } #endif /* HAVE_IPV6 */ @@ -11186,7 +11186,7 @@ DEFUN (show_ip_bgp_prefix_longer, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11200,7 +11200,7 @@ DEFUN (show_ip_bgp_instance_prefix_longer, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11214,7 +11214,7 @@ DEFUN (show_ip_bgp_flap_prefix_longer, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_prefix_longer); } @@ -11241,11 +11241,11 @@ DEFUN (show_ip_bgp_ipv4_prefix_longer, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_prefix_longer (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_prefix_longer (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_prefix_longer); - return bgp_show_prefix_longer (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11258,7 +11258,7 @@ DEFUN (show_ip_bgp_flap_address, "Display flap statistics of routes\n" "Network in the BGP routing table to display\n") { - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_address); } @@ -11281,7 +11281,7 @@ DEFUN (show_ip_bgp_flap_prefix, "Display flap statistics of routes\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_prefix); } @@ -11304,7 +11304,7 @@ DEFUN (show_bgp_prefix_longer, "IPv6 prefix <network>/<length>\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11328,7 +11328,7 @@ DEFUN (show_ipv6_bgp_prefix_longer, "Display route and more specific routes\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11343,7 +11343,7 @@ DEFUN (show_ipv6_mbgp_prefix_longer, "Display route and more specific routes\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, + return bgp_show_prefix_longer (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, bgp_show_type_prefix_longer); } #endif /* HAVE_IPV6 */ @@ -11758,7 +11758,7 @@ DEFUN (show_bgp_statistics, "Address Family modifier\n" "BGP RIB advertisement statistics\n") { - return bgp_table_stats_vty (vty, NULL, argv[0], argv[1]); + return bgp_table_stats_vty (vty, NULL, argv[2]->arg, argv[3]->arg); } DEFUN (show_bgp_statistics_view, @@ -11775,7 +11775,7 @@ DEFUN (show_bgp_statistics_view, "Address Family modifier\n" "BGP RIB advertisement statistics\n") { - return bgp_table_stats_vty (vty, NULL, argv[1], argv[2]); + return bgp_table_stats_vty (vty, NULL, argv[3]->arg, argv[4]->arg); } enum bgp_pcounts @@ -11985,7 +11985,7 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -12009,7 +12009,7 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); if (! peer) return CMD_WARNING; @@ -12032,7 +12032,7 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -12056,7 +12056,7 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[6]->arg, uj); if (! peer) return CMD_WARNING; @@ -12082,11 +12082,11 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); if (! peer) return CMD_WARNING; - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_peer_counts (vty, peer, AFI_IP, SAFI_MULTICAST, uj); return bgp_peer_counts (vty, peer, AFI_IP, SAFI_UNICAST, uj); @@ -12111,7 +12111,7 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); if (! peer) return CMD_WARNING; @@ -12374,10 +12374,10 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, struct peer *peer; u_char uj = use_json(argc, argv); - if (argc == 4 || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + if (argc == 4 || (argc == 3 && argv[6]->arg && strcmp(argv[6]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -12403,14 +12403,14 @@ DEFUN (show_ip_bgp_neighbor_advertised_route, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; - if ((argc == 2 && argv[1] && strcmp(argv[1], "json") != 0) + if ((argc == 2 && argv[6]->arg && strcmp(argv[6]->arg, "json") != 0) || (argc == 3)) - rmap_name = argv[1]; + rmap_name = argv[6]->arg; return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj); } @@ -12461,14 +12461,14 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); if (! peer) return CMD_WARNING; - if ((argc == 4) || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - rmap_name = argv[2]; + if ((argc == 4) || (argc == 3 && argv[8]->arg && strcmp(argv[8]->arg, "json") != 0)) + rmap_name = argv[8]->arg; - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 0, rmap_name, uj); else return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj); @@ -12508,10 +12508,10 @@ DEFUN (show_bgp_instance_neighbor_advertised_route, struct peer *peer; u_char uj = use_json(argc, argv); - if (argc == 4 || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + if (argc == 4 || (argc == 3 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (! peer) return CMD_WARNING; @@ -12550,13 +12550,13 @@ DEFUN (show_bgp_neighbor_advertised_route, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (!peer) return CMD_WARNING; - if (argc == 3 || (argc == 2 && argv[1] && strcmp(argv[1], "json") != 0)) - rmap_name = argv[1]; + if (argc == 3 || (argc == 2 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) + rmap_name = argv[5]->arg; return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, rmap_name, uj); } @@ -12606,7 +12606,7 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -12631,7 +12631,7 @@ DEFUN (show_bgp_instance_neighbor_received_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); if (! peer) return CMD_WARNING; @@ -12655,7 +12655,7 @@ DEFUN (show_ip_bgp_instance_neighbor_received_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); if (! peer) return CMD_WARNING; @@ -12694,13 +12694,13 @@ DEFUN (show_ip_bgp_neighbor_received_routes, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; - if (argc == 3 || (argc == 2 && argv[1] && strcmp(argv[1], "json") != 0)) - rmap_name = argv[1]; + if (argc == 3 || (argc == 2 && argv[6]->arg && strcmp(argv[6]->arg, "json") != 0)) + rmap_name = argv[6]->arg; return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj); } @@ -12752,14 +12752,14 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); if (! peer) return CMD_WARNING; - if (argc == 4 || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - rmap_name = argv[2]; + if (argc == 4 || (argc == 3 && argv[8]->arg && strcmp(argv[8]->arg, "json") != 0)) + rmap_name = argv[8]->arg; - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 1, rmap_name, uj); else return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj); @@ -12805,14 +12805,14 @@ DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[4], uj); + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[7]->arg, uj); if (! peer) return CMD_WARNING; - afi = (strncmp (argv[2], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[3], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - in = (strncmp (argv[5], "r", 1) == 0) ? 1 : 0; + afi = (strncmp (argv[4]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; + safi = (strncmp (argv[5]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + in = (strncmp (argv[8]->arg, "r", 1) == 0) ? 1 : 0; return peer_adj_routes (vty, peer, afi, safi, in, NULL, uj); } @@ -12837,10 +12837,10 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, int count, ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[4]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (NULL, argv[0]); + peer = peer_lookup_by_conf_if (NULL, argv[4]->arg); if (! peer) { if (uj) @@ -12850,13 +12850,13 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[0]); + json_object_string_add(json_sub, "warningCause", argv[4]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[4]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -12927,10 +12927,10 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, int count, ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[1], &su); + ret = str2sockunion (argv[6]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (NULL, argv[1]); + peer = peer_lookup_by_conf_if (NULL, argv[6]->arg); if (! peer) { if (uj) @@ -12940,13 +12940,13 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[1]); + json_object_string_add(json_sub, "warningCause", argv[6]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[6]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -12969,7 +12969,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, } } - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) { sprintf (name, "%s.%d.%d", peer->host, AFI_IP, SAFI_MULTICAST); count = prefix_bgp_show_prefix_list (NULL, AFI_IP, name, uj); @@ -13037,13 +13037,13 @@ DEFUN (show_bgp_neighbor_received_routes, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (! peer) return CMD_WARNING; - if (argc == 3 || (argc == 2 && argv[1] && strcmp(argv[1], "json") != 0)) - rmap_name = argv[1]; + if (argc == 3 || (argc == 2 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) + rmap_name = argv[5]->arg; return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1, rmap_name, uj); } @@ -13080,10 +13080,10 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, int count, ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[3]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (NULL, argv[0]); + peer = peer_lookup_by_conf_if (NULL, argv[3]->arg); if (! peer) { if (uj) @@ -13093,13 +13093,13 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[0]); + json_object_string_add(json_sub, "warningCause", argv[3]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -13192,7 +13192,7 @@ DEFUN (ipv6_mbgp_neighbor_received_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -13222,7 +13222,7 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, u_char uj = use_json(argc, argv); /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[1]); + bgp = bgp_lookup_by_name (argv[3]->arg); if (bgp == NULL) { if (uj) @@ -13234,14 +13234,14 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, json_object_free(json_no); } else - vty_out (vty, "Can't find BGP instance %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } - ret = str2sockunion (argv[2], &su); + ret = str2sockunion (argv[5]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (bgp, argv[2]); + peer = peer_lookup_by_conf_if (bgp, argv[5]->arg); if (! peer) { if (uj) @@ -13251,13 +13251,13 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[2]); + json_object_string_add(json_sub, "warningCause", argv[5]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[2], VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[5]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -13346,7 +13346,7 @@ DEFUN (show_ip_bgp_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -13371,7 +13371,7 @@ DEFUN (show_ip_bgp_instance_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); if (! peer) return CMD_WARNING; @@ -13395,7 +13395,7 @@ DEFUN (show_ip_bgp_neighbor_flap, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -13419,7 +13419,7 @@ DEFUN (show_ip_bgp_neighbor_damp, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -13446,11 +13446,11 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); if (! peer) return CMD_WARNING; - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_MULTICAST, bgp_show_type_neighbor, uj); @@ -13475,7 +13475,7 @@ DEFUN (show_bgp_instance_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); if (! peer) return CMD_WARNING; @@ -13513,11 +13513,11 @@ DEFUN (show_bgp_instance_neighbor_damp, struct peer *peer; u_char uj = use_json(argc, argv); - if ((argc == 4 && argv[3] && strcmp(argv[3], "json") == 0) - || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + if ((argc == 4 && argv[7]->arg && strcmp(argv[7]->arg, "json") == 0) + || (argc == 3 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (! peer) return CMD_WARNING; @@ -13556,11 +13556,11 @@ DEFUN (show_bgp_instance_neighbor_flap, struct peer *peer; u_char uj = use_json(argc, argv); - if ((argc == 4 && argv[3] && strcmp(argv[3], "json") == 0) - || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + if ((argc == 4 && argv[7]->arg && strcmp(argv[7]->arg, "json") == 0) + || (argc == 3 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (! peer) return CMD_WARNING; @@ -13598,7 +13598,7 @@ DEFUN (show_bgp_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (! peer) return CMD_WARNING; @@ -13651,7 +13651,7 @@ DEFUN (ipv6_mbgp_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -13913,9 +13913,9 @@ DEFUN (bgp_distance, bgp = vty->index; - bgp->distance_ebgp = atoi (argv[0]); - bgp->distance_ibgp = atoi (argv[1]); - bgp->distance_local = atoi (argv[2]); + bgp->distance_ebgp = atoi (argv[2]->arg); + bgp->distance_ibgp = atoi (argv[3]->arg); + bgp->distance_local = atoi (argv[4]->arg); return CMD_SUCCESS; } @@ -13953,7 +13953,7 @@ DEFUN (bgp_distance_source, "Administrative distance\n" "IP source prefix\n") { - bgp_distance_set (vty, argv[0], argv[1], NULL); + bgp_distance_set (vty, argv[1]->arg, argv[2]->arg, NULL); return CMD_SUCCESS; } @@ -13965,7 +13965,7 @@ DEFUN (no_bgp_distance_source, "Administrative distance\n" "IP source prefix\n") { - bgp_distance_unset (vty, argv[0], argv[1], NULL); + bgp_distance_unset (vty, argv[2]->arg, argv[3]->arg, NULL); return CMD_SUCCESS; } @@ -13977,7 +13977,7 @@ DEFUN (bgp_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - bgp_distance_set (vty, argv[0], argv[1], argv[2]); + bgp_distance_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg); return CMD_SUCCESS; } @@ -13990,7 +13990,7 @@ DEFUN (no_bgp_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - bgp_distance_unset (vty, argv[0], argv[1], argv[2]); + bgp_distance_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg); return CMD_SUCCESS; } @@ -14012,14 +14012,14 @@ DEFUN (bgp_damp_set, if (argc == 4) { - half = atoi (argv[0]) * 60; - reuse = atoi (argv[1]); - suppress = atoi (argv[2]); - max = atoi (argv[3]) * 60; + half = atoi (argv[2]->arg) * 60; + reuse = atoi (argv[3]->arg); + suppress = atoi (argv[4]->arg); + max = atoi (argv[5]->arg) * 60; } else if (argc == 1) { - half = atoi (argv[0]) * 60; + half = atoi (argv[2]->arg) * 60; max = 4 * half; } @@ -14246,7 +14246,7 @@ DEFUN (clear_ip_bgp_dampening_prefix, "Clear route flap dampening information\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return bgp_clear_damp_route (vty, NULL, argv[0], AFI_IP, + return bgp_clear_damp_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL, 1); } @@ -14259,7 +14259,7 @@ DEFUN (clear_ip_bgp_dampening_address, "Clear route flap dampening information\n" "Network to clear damping information\n") { - return bgp_clear_damp_route (vty, NULL, argv[0], AFI_IP, + return bgp_clear_damp_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0); } @@ -14276,7 +14276,7 @@ DEFUN (clear_ip_bgp_dampening_address_mask, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[4]->arg, argv[5]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index fea9ae6b1..286975f4a 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -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, diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 114c6ef01..884523919 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -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" diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index f4a16d6ba..9a7b297fb 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -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" diff --git a/lib/command.h b/lib/command.h index eef4b558a..7b0fbfb78 100644 --- a/lib/command.h +++ b/lib/command.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 " diff --git a/lib/json.c b/lib/json.c index d06bacece..1d22180e1 100644 --- a/lib/json.c +++ b/lib/json.c @@ -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; diff --git a/lib/json.h b/lib/json.h index 25fceb105..3fcfe340e 100644 --- a/lib/json.h +++ b/lib/json.h @@ -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, diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 791ae54b0..bf892f872 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -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': |