From bf2bfafd7e547081c1f792c766848b2b3b761090 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 19:15:24 +0000 Subject: [PATCH] ospfd: argv update for all but ospf_vty.c Signed-off-by: Daniel Walton --- lib/vty.c | 12 +- ospfd/ospf_bfd.c | 2 +- ospfd/ospf_dump.c | 186 ++++++++++----------- ospfd/ospf_nsm.c | 1 + ospfd/ospf_ri.c | 16 +- ospfd/ospf_routemap.c | 67 +++----- ospfd/ospf_te.c | 6 +- ospfd/ospf_vty.c | 347 +++++++++++++++++++-------------------- tools/argv_translator.py | 82 ++++++++- 9 files changed, 383 insertions(+), 336 deletions(-) diff --git a/lib/vty.c b/lib/vty.c index ff559d1705..900183fe55 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2746,7 +2746,7 @@ DEFUN (exec_timeout_min, "Set timeout value\n" "Timeout value in minutes\n") { - return exec_timeout (vty, argv[0], NULL); + return exec_timeout (vty, argv[1]->arg, NULL); } DEFUN (exec_timeout_sec, @@ -2756,7 +2756,7 @@ DEFUN (exec_timeout_sec, "Timeout in minutes\n" "Timeout in seconds\n") { - return exec_timeout (vty, argv[0], argv[1]); + return exec_timeout (vty, argv[1]->arg, argv[2]->arg); } DEFUN (no_exec_timeout, @@ -2778,7 +2778,7 @@ DEFUN (vty_access_class, if (vty_accesslist_name) XFREE(MTYPE_VTY, vty_accesslist_name); - vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]); + vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[1]->arg); return CMD_SUCCESS; } @@ -2791,7 +2791,7 @@ DEFUN (no_vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { - if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[0]))) + if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[2]->arg))) { vty_out (vty, "Access-class is not currently applied to vty%s", VTY_NEWLINE); @@ -2817,7 +2817,7 @@ DEFUN (vty_ipv6_access_class, if (vty_ipv6_accesslist_name) XFREE(MTYPE_VTY, vty_ipv6_accesslist_name); - vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]); + vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[2]->arg); return CMD_SUCCESS; } @@ -2832,7 +2832,7 @@ DEFUN (no_vty_ipv6_access_class, "IPv6 access list\n") { if (! vty_ipv6_accesslist_name || - (argc && strcmp(vty_ipv6_accesslist_name, argv[0]))) + (argc && strcmp(vty_ipv6_accesslist_name, argv[3]->arg))) { vty_out (vty, "IPv6 access-class is not currently applied to vty%s", VTY_NEWLINE); diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c index c87bcb0afb..dd44ab2ac1 100644 --- a/ospfd/ospf_bfd.c +++ b/ospfd/ospf_bfd.c @@ -395,7 +395,7 @@ DEFUN (ip_ospf_bfd_param, assert (ifp); - if ((ret = bfd_validate_param (vty, argv[0], argv[1], argv[2], &dm_val, + if ((ret = bfd_validate_param (vty, argv[3]->arg, argv[4]->arg, argv[5]->arg, &dm_val, &rx_val, &tx_val)) != CMD_SUCCESS) return ret; diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index a53c726853..583a4d85d9 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -760,7 +760,7 @@ ospf_packet_dump (struct stream *s) */ static int debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, - const char **argv) + struct cmd_token **argv) { int type = 0; int flag = 0; @@ -769,17 +769,17 @@ debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, assert (argc > arg_base + 0); /* Check packet type. */ - if (strncmp (argv[arg_base + 0], "h", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "h", 1) == 0) type = OSPF_DEBUG_HELLO; - else if (strncmp (argv[arg_base + 0], "d", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "d", 1) == 0) type = OSPF_DEBUG_DB_DESC; - else if (strncmp (argv[arg_base + 0], "ls-r", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-r", 4) == 0) type = OSPF_DEBUG_LS_REQ; - else if (strncmp (argv[arg_base + 0], "ls-u", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-u", 4) == 0) type = OSPF_DEBUG_LS_UPD; - else if (strncmp (argv[arg_base + 0], "ls-a", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-a", 4) == 0) type = OSPF_DEBUG_LS_ACK; - else if (strncmp (argv[arg_base + 0], "a", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "a", 1) == 0) type = OSPF_DEBUG_ALL; /* Default, both send and recv. */ @@ -789,17 +789,17 @@ debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, /* send or recv. */ if (argc >= arg_base + 2) { - if (strncmp (argv[arg_base + 1], "s", 1) == 0) + if (strncmp (argv[arg_base + 1]->arg, "s", 1) == 0) flag = OSPF_DEBUG_SEND; - else if (strncmp (argv[arg_base + 1], "r", 1) == 0) + else if (strncmp (argv[arg_base + 1]->arg, "r", 1) == 0) flag = OSPF_DEBUG_RECV; - else if (strncmp (argv[arg_base + 1], "d", 1) == 0) + else if (strncmp (argv[arg_base + 1]->arg, "d", 1) == 0) flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL; } /* detail. */ if (argc == arg_base + 3) - if (strncmp (argv[arg_base + 2], "d", 1) == 0) + if (strncmp (argv[arg_base + 2]->arg, "d", 1) == 0) flag |= OSPF_DEBUG_DETAIL; for (i = 0; i < 5; i++) @@ -878,7 +878,7 @@ DEFUN (debug_ospf_instance_packet, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -921,7 +921,7 @@ ALIAS (debug_ospf_instance_packet, static int no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, - const char **argv) + struct cmd_token **argv) { int type = 0; int flag = 0; @@ -930,17 +930,17 @@ no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, assert (argc > arg_base + 0); /* Check packet type. */ - if (strncmp (argv[arg_base + 0], "h", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "h", 1) == 0) type = OSPF_DEBUG_HELLO; - else if (strncmp (argv[arg_base + 0], "d", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "d", 1) == 0) type = OSPF_DEBUG_DB_DESC; - else if (strncmp (argv[arg_base + 0], "ls-r", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-r", 4) == 0) type = OSPF_DEBUG_LS_REQ; - else if (strncmp (argv[arg_base + 0], "ls-u", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-u", 4) == 0) type = OSPF_DEBUG_LS_UPD; - else if (strncmp (argv[arg_base + 0], "ls-a", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-a", 4) == 0) type = OSPF_DEBUG_LS_ACK; - else if (strncmp (argv[arg_base + 0], "a", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "a", 1) == 0) type = OSPF_DEBUG_ALL; /* Default, both send and recv. */ @@ -950,17 +950,17 @@ no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, /* send or recv. */ if (argc == arg_base + 2) { - if (strncmp (argv[arg_base + 1], "s", 1) == 0) + if (strncmp (argv[arg_base + 1]->arg, "s", 1) == 0) flag = OSPF_DEBUG_SEND | OSPF_DEBUG_DETAIL; - else if (strncmp (argv[arg_base + 1], "r", 1) == 0) + else if (strncmp (argv[arg_base + 1]->arg, "r", 1) == 0) flag = OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL; - else if (strncmp (argv[arg_base + 1], "d", 1) == 0) + else if (strncmp (argv[arg_base + 1]->arg, "d", 1) == 0) flag = OSPF_DEBUG_DETAIL | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL; } /* detail. */ if (argc == arg_base + 3) - if (strncmp (argv[arg_base + 2], "d", 1) == 0) + if (strncmp (argv[arg_base + 2]->arg, "d", 1) == 0) flag = OSPF_DEBUG_DETAIL; for (i = 0; i < 5; i++) @@ -1050,7 +1050,7 @@ DEFUN (no_debug_ospf_instance_packet, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1095,7 +1095,7 @@ ALIAS (no_debug_ospf_instance_packet, static int -debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, const char **argv) +debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1103,11 +1103,11 @@ debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, const char **arg DEBUG_ON (ism, ISM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) DEBUG_ON (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) DEBUG_ON (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) DEBUG_ON (ism, ISM_TIMERS); } @@ -1119,11 +1119,11 @@ debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, const char **arg TERM_DEBUG_ON (ism, ISM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) TERM_DEBUG_ON (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) TERM_DEBUG_ON (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) TERM_DEBUG_ON (ism, ISM_TIMERS); } @@ -1160,7 +1160,7 @@ DEFUN (debug_ospf_instance_ism, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1180,7 +1180,7 @@ ALIAS (debug_ospf_instance_ism, static int no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc, - const char **argv) + struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1188,11 +1188,11 @@ no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc, DEBUG_OFF (ism, ISM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) DEBUG_OFF (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) DEBUG_OFF (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) DEBUG_OFF (ism, ISM_TIMERS); } return CMD_SUCCESS; @@ -1203,11 +1203,11 @@ no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc, TERM_DEBUG_OFF (ism, ISM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) TERM_DEBUG_OFF (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) TERM_DEBUG_OFF (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) TERM_DEBUG_OFF (ism, ISM_TIMERS); } @@ -1247,7 +1247,7 @@ DEFUN (no_debug_ospf_instance_ism, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1267,7 +1267,7 @@ ALIAS (no_debug_ospf_instance_ism, "ISM Timer Information\n") static int -debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char **argv) +debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1275,11 +1275,11 @@ debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char **arg DEBUG_ON (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) DEBUG_ON (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) DEBUG_ON (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) DEBUG_ON (nsm, NSM_TIMERS); } @@ -1291,11 +1291,11 @@ debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char **arg TERM_DEBUG_ON (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) TERM_DEBUG_ON (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) TERM_DEBUG_ON (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) TERM_DEBUG_ON (nsm, NSM_TIMERS); } @@ -1332,7 +1332,7 @@ DEFUN (debug_ospf_instance_nsm, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1351,7 +1351,7 @@ ALIAS (debug_ospf_instance_nsm, "NSM Timer Information\n") static int -no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char **argv) +no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1359,11 +1359,11 @@ no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char ** DEBUG_OFF (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) DEBUG_OFF (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) DEBUG_OFF (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) DEBUG_OFF (nsm, NSM_TIMERS); } @@ -1375,11 +1375,11 @@ no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char ** TERM_DEBUG_OFF (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) TERM_DEBUG_OFF (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) TERM_DEBUG_OFF (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) TERM_DEBUG_OFF (nsm, NSM_TIMERS); } @@ -1419,7 +1419,7 @@ DEFUN (no_debug_ospf_instance_nsm, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1440,7 +1440,7 @@ ALIAS (no_debug_ospf_instance_nsm, static int -debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char **argv) +debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1448,13 +1448,13 @@ debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char **arg DEBUG_ON (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "g", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) DEBUG_ON (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0], "f", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) DEBUG_ON (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0], "i", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) DEBUG_ON (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) DEBUG_ON (lsa, LSA_REFRESH); } @@ -1466,13 +1466,13 @@ debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char **arg TERM_DEBUG_ON (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "g", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) TERM_DEBUG_ON (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0], "f", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) TERM_DEBUG_ON (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0], "i", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) TERM_DEBUG_ON (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) TERM_DEBUG_ON (lsa, LSA_REFRESH); } @@ -1510,7 +1510,7 @@ DEFUN (debug_ospf_instance_lsa, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1530,7 +1530,7 @@ ALIAS (debug_ospf_instance_lsa, "LSA Refresh\n") static int -no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char **argv) +no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1538,13 +1538,13 @@ no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char ** DEBUG_OFF (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "g", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) DEBUG_OFF (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0], "f", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) DEBUG_OFF (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0], "i", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) DEBUG_OFF (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) DEBUG_OFF (lsa, LSA_REFRESH); } @@ -1556,13 +1556,13 @@ no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char ** TERM_DEBUG_OFF (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "g", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) TERM_DEBUG_OFF (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0], "f", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) TERM_DEBUG_OFF (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0], "i", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) TERM_DEBUG_OFF (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) TERM_DEBUG_OFF (lsa, LSA_REFRESH); } @@ -1603,7 +1603,7 @@ DEFUN (no_debug_ospf_instance_lsa, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1625,7 +1625,7 @@ ALIAS (no_debug_ospf_instance_lsa, static int -debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, const char **argv) +debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1633,9 +1633,9 @@ debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, const char **a DEBUG_ON (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "i", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) DEBUG_ON (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE); } @@ -1647,9 +1647,9 @@ debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, const char **a TERM_DEBUG_ON (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "i", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) TERM_DEBUG_ON (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) TERM_DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE); } @@ -1685,7 +1685,7 @@ DEFUN (debug_ospf_instance_zebra, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1704,7 +1704,7 @@ ALIAS (debug_ospf_instance_zebra, static int no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, - const char **argv) + struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1712,9 +1712,9 @@ no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, DEBUG_OFF (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "i", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) DEBUG_OFF (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE); } @@ -1726,9 +1726,9 @@ no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, TERM_DEBUG_OFF (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "i", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) TERM_DEBUG_OFF (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) TERM_DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE); } @@ -1767,7 +1767,7 @@ DEFUN (no_debug_ospf_instance_zebra, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1823,7 +1823,7 @@ DEFUN (debug_ospf_instance_event, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1844,7 +1844,7 @@ DEFUN (no_debug_ospf_instance_event, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1891,7 +1891,7 @@ DEFUN (debug_ospf_instance_nssa, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1912,7 +1912,7 @@ DEFUN (no_debug_ospf_instance_nssa, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -2133,7 +2133,7 @@ DEFUN (show_debugging_ospf_instance, struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL ) return CMD_SUCCESS; diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index c6b55b0746..17cc1f66c2 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -33,6 +33,7 @@ #include "stream.h" #include "table.h" #include "log.h" +#include "command.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_interface.h" diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 8fefd2bdb8..0ea25ceb94 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1190,7 +1190,7 @@ DEFUN (router_info, /* Check and get Area value if present */ if (argc == 1) { - if (!inet_aton (argv[0], &OspfRI.area_id)) + if (!inet_aton (argv[2]->arg, &OspfRI.area_id)) { vty_out (vty, "Please specify Router Info Area by A.B.C.D%s", VTY_NEWLINE); @@ -1276,7 +1276,7 @@ DEFUN (pce_address, struct in_addr value; struct ospf_pce_info *pi = &OspfRI.pce_info; - if (!inet_aton (argv[0], &value)) + if (!inet_aton (argv[2]->arg, &value)) { vty_out (vty, "Please specify PCE Address by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -1323,7 +1323,7 @@ DEFUN (pce_path_scope, uint32_t scope; struct ospf_pce_info *pi = &OspfRI.pce_info; - if (sscanf (argv[0], "0x%x", &scope) != 1) + if (sscanf (argv[2]->arg, "0x%x", &scope) != 1) { vty_out (vty, "pce_path_scope: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1373,7 +1373,7 @@ DEFUN (pce_domain, struct listnode *node; struct ri_pce_subtlv_domain *domain; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[3]->arg, "%d", &as) != 1) { vty_out (vty, "pce_domain: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1410,7 +1410,7 @@ DEFUN (no_pce_domain, uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[4]->arg, "%d", &as) != 1) { vty_out (vty, "no_pce_domain: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1441,7 +1441,7 @@ DEFUN (pce_neigbhor, struct listnode *node; struct ri_pce_subtlv_neighbor *neighbor; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[3]->arg, "%d", &as) != 1) { vty_out (vty, "pce_neighbor: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1478,7 +1478,7 @@ DEFUN (no_pce_neighbor, uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[4]->arg, "%d", &as) != 1) { vty_out (vty, "no_pce_neighbor: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1506,7 +1506,7 @@ DEFUN (pce_cap_flag, uint32_t cap; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[0], "0x%x", &cap) != 1) + if (sscanf (argv[2]->arg, "0x%x", &cap) != 1) { vty_out (vty, "pce_cap_flag: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index b2f1c67126..1836660844 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -700,7 +700,7 @@ DEFUN (match_ip_nexthop, "IP access-list number (expanded range)\n" "IP access-list name\n") { - return ospf_route_match_add (vty, vty->index, "ip next-hop", argv[0]); + return ospf_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg); } DEFUN (no_match_ip_nexthop, @@ -711,10 +711,7 @@ DEFUN (no_match_ip_nexthop, IP_STR "Match next-hop address of route\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "ip next-hop", NULL); - - return ospf_route_match_delete (vty, vty->index, "ip next-hop", argv[0]); + return ospf_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg); } ALIAS (no_match_ip_nexthop, @@ -738,7 +735,7 @@ DEFUN (match_ip_next_hop_prefix_list, "IP prefix-list name\n") { return ospf_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[0]); + argv[4]->arg); } DEFUN (no_match_ip_next_hop_prefix_list, @@ -750,11 +747,8 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match next-hop address of route\n" "Match entries of prefix-lists\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list", - NULL); return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list", - argv[0]); + argv[5]->arg); } ALIAS (no_match_ip_next_hop_prefix_list, @@ -777,7 +771,7 @@ DEFUN (match_ip_address, "IP access-list number (expanded range)\n" "IP access-list name\n") { - return ospf_route_match_add (vty, vty->index, "ip address", argv[0]); + return ospf_route_match_add (vty, vty->index, "ip address", argv[3]->arg); } DEFUN (no_match_ip_address, @@ -788,10 +782,7 @@ DEFUN (no_match_ip_address, IP_STR "Match address of route\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "ip address", NULL); - - return ospf_route_match_delete (vty, vty->index, "ip address", argv[0]); + return ospf_route_match_delete (vty, vty->index, "ip address", argv[4]->arg); } ALIAS (no_match_ip_address, @@ -815,7 +806,7 @@ DEFUN (match_ip_address_prefix_list, "IP prefix-list name\n") { return ospf_route_match_add (vty, vty->index, "ip address prefix-list", - argv[0]); + argv[4]->arg); } DEFUN (no_match_ip_address_prefix_list, @@ -827,11 +818,8 @@ DEFUN (no_match_ip_address_prefix_list, "Match address of route\n" "Match entries of prefix-lists\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", - NULL); return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", - argv[0]); + argv[5]->arg); } ALIAS (no_match_ip_address_prefix_list, @@ -851,7 +839,7 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return ospf_route_match_add (vty, vty->index, "interface", argv[0]); + return ospf_route_match_add (vty, vty->index, "interface", argv[2]->arg); } DEFUN (no_match_interface, @@ -861,10 +849,7 @@ DEFUN (no_match_interface, MATCH_STR "Match first hop interface of route\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "interface", NULL); - - return ospf_route_match_delete (vty, vty->index, "interface", argv[0]); + return ospf_route_match_delete (vty, vty->index, "interface", argv[3]->arg); } ALIAS (no_match_interface, @@ -882,7 +867,7 @@ DEFUN (match_tag, "Match tag of route\n" "Tag value\n") { - return ospf_route_match_add (vty, vty->index, "tag", argv[0]); + return ospf_route_match_add (vty, vty->index, "tag", argv[2]->arg); } DEFUN (no_match_tag, @@ -892,10 +877,7 @@ DEFUN (no_match_tag, MATCH_STR "Match tag of route\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "tag", NULL); - - return ospf_route_match_delete (vty, vty->index, "tag", argv[0]); + return ospf_route_match_delete (vty, vty->index, "tag", argv[3]->arg); } ALIAS (no_match_tag, @@ -913,7 +895,7 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return ospf_route_set_add (vty, vty->index, "metric", argv[0]); + return ospf_route_set_add (vty, vty->index, "metric", argv[2]->arg); } DEFUN (no_set_metric, @@ -923,10 +905,7 @@ DEFUN (no_set_metric, SET_STR "Metric value for destination routing protocol\n") { - if (argc == 0) - return ospf_route_set_delete (vty, vty->index, "metric", NULL); - - return ospf_route_set_delete (vty, vty->index, "metric", argv[0]); + return ospf_route_set_delete (vty, vty->index, "metric", argv[3]->arg); } ALIAS (no_set_metric, @@ -945,12 +924,12 @@ DEFUN (set_metric_type, "OSPF[6] external type 1 metric\n" "OSPF[6] external type 2 metric\n") { - if (strcmp (argv[0], "1") == 0) + if (strcmp (argv[2]->arg, "1") == 0) return ospf_route_set_add (vty, vty->index, "metric-type", "type-1"); - if (strcmp (argv[0], "2") == 0) + if (strcmp (argv[2]->arg, "2") == 0) return ospf_route_set_add (vty, vty->index, "metric-type", "type-2"); - return ospf_route_set_add (vty, vty->index, "metric-type", argv[0]); + return ospf_route_set_add (vty, vty->index, "metric-type", argv[2]->arg); } DEFUN (no_set_metric_type, @@ -960,10 +939,7 @@ DEFUN (no_set_metric_type, SET_STR "Type of metric for destination routing protocol\n") { - if (argc == 0) - return ospf_route_set_delete (vty, vty->index, "metric-type", NULL); - - return ospf_route_set_delete (vty, vty->index, "metric-type", argv[0]); + return ospf_route_set_delete (vty, vty->index, "metric-type", argv[3]->arg); } ALIAS (no_set_metric_type, @@ -982,7 +958,7 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return ospf_route_set_add (vty, vty->index, "tag", argv[0]); + return ospf_route_set_add (vty, vty->index, "tag", argv[2]->arg); } DEFUN (no_set_tag, @@ -992,10 +968,7 @@ DEFUN (no_set_tag, SET_STR "Tag value for routing protocol\n") { - if (argc == 0) - ospf_route_set_delete(vty, vty->index, "tag", NULL); - - return ospf_route_set_delete (vty, vty->index, "tag", argv[0]); + return ospf_route_set_delete (vty, vty->index, "tag", argv[3]->arg); } ALIAS (no_set_tag, diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 12d589cd99..4b02475267 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -2346,7 +2346,7 @@ DEFUN (ospf_mpls_te_router_addr, if (!ospf) return CMD_SUCCESS; - if (! inet_aton (argv[0], &value)) + if (! inet_aton (argv[2]->arg, &value)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -2480,7 +2480,7 @@ DEFUN (ospf_mpls_te_inter_as_area, "OSPF area ID in IP format\n" "OSPF area ID as decimal value\n") { - return set_inter_as_mode (vty, "area", argv[0]); + return set_inter_as_mode (vty, "area", argv[3]->arg); } DEFUN (no_ospf_mpls_te_inter_as, @@ -2636,7 +2636,7 @@ DEFUN (show_ip_ospf_mpls_te_link, /* Interface name is specified. */ else { - if ((ifp = if_lookup_by_name (argv[0])) == NULL) + if ((ifp = if_lookup_by_name (argv[5]->arg)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else show_mpls_te_link_sub (vty, ifp); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 1b26c67866..30c63ea353 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -21,7 +21,6 @@ */ #include -#include #include #include "memory.h" @@ -33,6 +32,7 @@ #include "plist.h" #include "log.h" #include "zclient.h" +#include #include "ospfd/ospfd.h" #include "ospfd/ospf_asbr.h" @@ -199,7 +199,7 @@ DEFUN (no_router_ospf, u_short instance = 0; if (argc) - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL) return CMD_SUCCESS; @@ -233,7 +233,7 @@ DEFUN (ospf_router_id, if (!ospf) return CMD_SUCCESS; - ret = inet_aton (argv[0], &router_id); + ret = inet_aton (argv[2]->arg, &router_id); if (!ret) { vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE); @@ -383,7 +383,7 @@ DEFUN (ospf_passive_interface, return CMD_SUCCESS; } - ifp = if_get_by_name (argv[0]); + ifp = if_get_by_name (argv[2]->arg); params = IF_DEF_PARAMS (ifp); @@ -465,7 +465,7 @@ DEFUN (no_ospf_passive_interface, return CMD_SUCCESS; } - ifp = if_get_by_name (argv[0]); + ifp = if_get_by_name (argv[3]->arg); params = IF_DEF_PARAMS (ifp); @@ -551,8 +551,8 @@ DEFUN (ospf_network_area, } /* Get network prefix and Area ID. */ - VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); + VTY_GET_IPV4_PREFIX ("network prefix", p, argv[1]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[3]->arg); ret = ospf_network_set (ospf, &p, area_id); if (ret == 0) @@ -590,8 +590,8 @@ DEFUN (no_ospf_network_area, } /* Get network prefix and Area ID. */ - VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); + VTY_GET_IPV4_PREFIX ("network prefix", p, argv[2]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[4]->arg); ret = ospf_network_unset (ospf, &p, area_id); if (ret == 0) @@ -623,8 +623,8 @@ DEFUN (ospf_area_range, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); - VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg); ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); if (argc > 2) @@ -687,8 +687,8 @@ DEFUN (ospf_area_range_not_advertise, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); - VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg); ospf_area_range_set (ospf, area_id, &p, 0); @@ -713,8 +713,8 @@ DEFUN (no_ospf_area_range, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); - VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[4]->arg); ospf_area_range_unset (ospf, area_id, &p); @@ -777,9 +777,9 @@ DEFUN (ospf_area_range_substitute, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); - VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); - VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg); + VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[5]->arg); ospf_area_range_substitute_set (ospf, area_id, &p, &s); @@ -806,9 +806,9 @@ DEFUN (no_ospf_area_range_substitute, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); - VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); - VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[4]->arg); + VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[6]->arg); ospf_area_range_substitute_unset (ospf, area_id, &p); @@ -1087,14 +1087,14 @@ DEFUN (ospf_area_vlink, ospf_vl_config_data_init(&vl_config, vty); /* Read off first 2 parameters and check them */ - ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format); + ret = ospf_str2area_id (argv[1]->arg, &vl_config.area_id, &vl_config.format); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); return CMD_WARNING; } - ret = inet_aton (argv[1], &vl_config.vl_peer); + ret = inet_aton (argv[3]->arg, &vl_config.vl_peer); if (! ret) { vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", @@ -1225,7 +1225,7 @@ DEFUN (no_ospf_area_vlink, ospf_vl_config_data_init(&vl_config, vty); - ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format); + ret = ospf_str2area_id (argv[2]->arg, &vl_config.area_id, &format); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1239,7 +1239,7 @@ DEFUN (no_ospf_area_vlink, return CMD_WARNING; } - ret = inet_aton (argv[1], &vl_config.vl_peer); + ret = inet_aton (argv[4]->arg, &vl_config.vl_peer); if (! ret) { vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", @@ -1566,15 +1566,15 @@ DEFUN (ospf_area_shortcut, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); - if (strncmp (argv[1], "de", 2) == 0) + if (strncmp (argv[3]->arg, "de", 2) == 0) mode = OSPF_SHORTCUT_DEFAULT; - else if (strncmp (argv[1], "di", 2) == 0) + else if (strncmp (argv[3]->arg, "di", 2) == 0) mode = OSPF_SHORTCUT_DISABLE; - else if (strncmp (argv[1], "e", 1) == 0) + else if (strncmp (argv[3]->arg, "e", 1) == 0) mode = OSPF_SHORTCUT_ENABLE; else return CMD_WARNING; @@ -1608,7 +1608,7 @@ DEFUN (no_ospf_area_shortcut, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[2]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (!area) @@ -1635,7 +1635,7 @@ DEFUN (ospf_area_stub, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[1]->arg); ret = ospf_area_stub_set (ospf, area_id); if (ret == 0) @@ -1666,7 +1666,7 @@ DEFUN (ospf_area_stub_no_summary, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[1]->arg); ret = ospf_area_stub_set (ospf, area_id); if (ret == 0) @@ -1697,7 +1697,7 @@ DEFUN (no_ospf_area_stub, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[2]->arg); ospf_area_stub_unset (ospf, area_id); ospf_area_no_summary_unset (ospf, area_id); @@ -1722,7 +1722,7 @@ DEFUN (no_ospf_area_stub_no_summary, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[2]->arg); ospf_area_no_summary_unset (ospf, area_id); return CMD_SUCCESS; @@ -1845,7 +1845,7 @@ DEFUN (no_ospf_area_nssa, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[2]->arg); ospf_area_nssa_unset (ospf, area_id); ospf_area_no_summary_unset (ospf, area_id); @@ -1887,8 +1887,8 @@ DEFUN (ospf_area_default_cost, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); - VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); + VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[1]->arg); + VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[3]->arg, 0, 16777215); area = ospf_area_get (ospf, area_id, format); @@ -1931,8 +1931,8 @@ DEFUN (no_ospf_area_default_cost, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); - VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[1], 0, OSPF_LS_INFINITY); + VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[2]->arg); + VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[4]->arg, 0, OSPF_LS_INFINITY); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -1978,7 +1978,7 @@ DEFUN (ospf_area_export_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); ospf_area_export_list_set (ospf, area, argv[1]); @@ -2004,7 +2004,7 @@ DEFUN (no_ospf_area_export_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -2033,7 +2033,7 @@ DEFUN (ospf_area_import_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); ospf_area_import_list_set (ospf, area, argv[1]); @@ -2059,7 +2059,7 @@ DEFUN (no_ospf_area_import_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -2091,17 +2091,17 @@ DEFUN (ospf_area_filter_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); - plist = prefix_list_lookup (AFI_IP, argv[1]); - if (strncmp (argv[2], "in", 2) == 0) + plist = prefix_list_lookup (AFI_IP, argv[4]->arg); + if (strncmp (argv[5]->arg, "in", 2) == 0) { PREFIX_LIST_IN (area) = plist; if (PREFIX_NAME_IN (area)) free (PREFIX_NAME_IN (area)); - PREFIX_NAME_IN (area) = strdup (argv[1]); + PREFIX_NAME_IN (area) = strdup (argv[4]->arg); ospf_schedule_abr_task (ospf); } else @@ -2110,7 +2110,7 @@ DEFUN (ospf_area_filter_list, if (PREFIX_NAME_OUT (area)) free (PREFIX_NAME_OUT (area)); - PREFIX_NAME_OUT (area) = strdup (argv[1]); + PREFIX_NAME_OUT (area) = strdup (argv[4]->arg); ospf_schedule_abr_task (ospf); } @@ -2138,15 +2138,15 @@ DEFUN (no_ospf_area_filter_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL) return CMD_SUCCESS; - if (strncmp (argv[2], "in", 2) == 0) + if (strncmp (argv[6]->arg, "in", 2) == 0) { if (PREFIX_NAME_IN (area)) - if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0) + if (strcmp (PREFIX_NAME_IN (area), argv[5]->arg) != 0) return CMD_SUCCESS; PREFIX_LIST_IN (area) = NULL; @@ -2160,7 +2160,7 @@ DEFUN (no_ospf_area_filter_list, else { if (PREFIX_NAME_OUT (area)) - if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0) + if (strcmp (PREFIX_NAME_OUT (area), argv[5]->arg) != 0) return CMD_SUCCESS; PREFIX_LIST_OUT (area) = NULL; @@ -2193,7 +2193,7 @@ DEFUN (ospf_area_authentication_message_digest, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; @@ -2217,7 +2217,7 @@ DEFUN (ospf_area_authentication, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); area->auth_type = OSPF_AUTH_SIMPLE; @@ -2242,7 +2242,7 @@ DEFUN (no_ospf_area_authentication, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -2272,13 +2272,13 @@ DEFUN (ospf_abr_type, if (!ospf) return CMD_SUCCESS; - if (strncmp (argv[0], "c", 1) == 0) + if (strncmp (argv[2]->arg, "c", 1) == 0) abr_type = OSPF_ABR_CISCO; - else if (strncmp (argv[0], "i", 1) == 0) + else if (strncmp (argv[2]->arg, "i", 1) == 0) abr_type = OSPF_ABR_IBM; - else if (strncmp (argv[0], "sh", 2) == 0) + else if (strncmp (argv[2]->arg, "sh", 2) == 0) abr_type = OSPF_ABR_SHORTCUT; - else if (strncmp (argv[0], "st", 2) == 0) + else if (strncmp (argv[2]->arg, "st", 2) == 0) abr_type = OSPF_ABR_STAND; else return CMD_WARNING; @@ -2309,13 +2309,13 @@ DEFUN (no_ospf_abr_type, if (!ospf) return CMD_SUCCESS; - if (strncmp (argv[0], "c", 1) == 0) + if (strncmp (argv[3]->arg, "c", 1) == 0) abr_type = OSPF_ABR_CISCO; - else if (strncmp (argv[0], "i", 1) == 0) + else if (strncmp (argv[3]->arg, "i", 1) == 0) abr_type = OSPF_ABR_IBM; - else if (strncmp (argv[0], "sh", 2) == 0) + else if (strncmp (argv[3]->arg, "sh", 2) == 0) abr_type = OSPF_ABR_SHORTCUT; - else if (strncmp (argv[0], "st", 2) == 0) + else if (strncmp (argv[3]->arg, "st", 2) == 0) abr_type = OSPF_ABR_STAND; else return CMD_WARNING; @@ -2484,7 +2484,7 @@ DEFUN (ospf_timers_min_ls_interval, return CMD_WARNING; } - VTY_GET_INTEGER ("LSA interval", interval, argv[0]); + VTY_GET_INTEGER ("LSA interval", interval, argv[4]->arg); ospf->min_ls_interval = interval; @@ -2536,7 +2536,7 @@ DEFUN (ospf_timers_min_ls_arrival, return CMD_WARNING; } - VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[0], 0, 1000); + VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[3]->arg, 0, 1000); ospf->min_ls_arrival = arrival; @@ -2588,9 +2588,9 @@ DEFUN (ospf_timers_throttle_spf, return CMD_WARNING; } - VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[0], 0, 600000); - VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[1], 0, 600000); - VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[2], 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[3]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[4]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[5]->arg, 0, 600000); return ospf_timers_spf_set (vty, delay, hold, max); } @@ -2640,7 +2640,7 @@ DEFUN (ospf_timers_lsa, return CMD_WARNING; } - VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[0]); + VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[3]->arg); ospf->min_ls_arrival = minarrival; @@ -2699,7 +2699,7 @@ DEFUN (ospf_neighbor, if (!ospf) return CMD_SUCCESS; - VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[1]->arg); if (argc > 1) VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); @@ -2750,10 +2750,10 @@ DEFUN (ospf_neighbor_poll_interval, if (!ospf) return CMD_SUCCESS; - VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[1]->arg); if (argc > 1) - VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535); + VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[3]->arg, 1, 65535); if (argc > 2) VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); @@ -2790,7 +2790,7 @@ DEFUN (no_ospf_neighbor, if (!ospf) return CMD_SUCCESS; - VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[2]->arg); (void)ospf_nbr_nbma_unset (ospf, nbr_addr); @@ -2837,7 +2837,8 @@ ALIAS (no_ospf_neighbor, "Dead Neighbor Polling interval\n" "Seconds\n") -DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, +DEFUN (ospf_refresh_timer, + ospf_refresh_timer_cmd, "refresh timer <10-1800>", "Adjust refresh parameters\n" "Set refresh timer\n" @@ -2849,7 +2850,7 @@ DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, if (!ospf) return CMD_SUCCESS; - VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); + VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[2]->arg, 10, 1800); interval = (interval / OSPF_LSA_REFRESHER_GRANULARITY) * OSPF_LSA_REFRESHER_GRANULARITY; ospf_timers_refresh_set (ospf, interval); @@ -2857,7 +2858,8 @@ DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, return CMD_SUCCESS; } -DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, +DEFUN (no_ospf_refresh_timer, + no_ospf_refresh_timer_val_cmd, "no refresh timer <10-1800>", "Adjust refresh parameters\n" "Unset refresh timer\n" @@ -2871,7 +2873,7 @@ DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, if (argc == 1) { - VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); + VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[3]->arg, 10, 1800); if (ospf->lsa_refresh_interval != interval || interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT) @@ -2904,7 +2906,7 @@ DEFUN (ospf_auto_cost_reference_bandwidth, if (!ospf) return CMD_SUCCESS; - refbw = strtol (argv[0], NULL, 10); + refbw = strtol (argv[2]->arg, NULL, 10); if (refbw < 1 || refbw > 4294967) { vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); @@ -2970,7 +2972,7 @@ DEFUN (ospf_write_multiplier, if (!ospf) return CMD_SUCCESS; - write_oi_count = strtol (argv[0], NULL, 10); + write_oi_count = strtol (argv[2]->arg, NULL, 10); if (write_oi_count < 1 || write_oi_count > 100) { vty_out (vty, "write-multiplier value is invalid%s", VTY_NEWLINE); @@ -3614,7 +3616,7 @@ DEFUN (show_ip_ospf_instance, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4026,7 +4028,7 @@ DEFUN (show_ip_ospf_instance_interface, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4182,7 +4184,7 @@ DEFUN (show_ip_ospf_instance_neighbor, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4294,7 +4296,7 @@ DEFUN (show_ip_ospf_instance_neighbor_all, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4388,7 +4390,7 @@ DEFUN (show_ip_ospf_instance_neighbor_int, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4754,7 +4756,7 @@ DEFUN (show_ip_ospf_instance_neighbor_id, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4845,7 +4847,7 @@ DEFUN (show_ip_ospf_instance_neighbor_detail, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4944,7 +4946,7 @@ DEFUN (show_ip_ospf_instance_neighbor_detail_all, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -5046,7 +5048,7 @@ DEFUN (show_ip_ospf_instance_neighbor_int_detail, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -5841,7 +5843,7 @@ DEFUN (show_ip_ospf_instance_database, struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -5997,7 +5999,7 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -6036,7 +6038,7 @@ DEFUN (ip_ospf_authentication_args, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6049,7 +6051,7 @@ DEFUN (ip_ospf_authentication_args, } /* Handle null authentication */ - if ( argv[0][0] == 'n' ) + if ( argv[3]->arg[0] == 'n' ) { SET_IF_PARAM (params, auth_type); params->auth_type = OSPF_AUTH_NULL; @@ -6057,7 +6059,7 @@ DEFUN (ip_ospf_authentication_args, } /* Handle message-digest authentication */ - if ( argv[0][0] == 'm' ) + if ( argv[3]->arg[0] == 'm' ) { SET_IF_PARAM (params, auth_type); params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; @@ -6095,7 +6097,7 @@ DEFUN (ip_ospf_authentication, if (argc == 1) { - ret = inet_aton(argv[0], &addr); + ret = inet_aton(argv[3]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6143,7 +6145,7 @@ DEFUN (no_ip_ospf_authentication_args, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[5]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6167,11 +6169,11 @@ DEFUN (no_ip_ospf_authentication_args, } else { - if ( argv[0][0] == 'n' ) + if ( argv[4]->arg[0] == 'n' ) { auth_type = OSPF_AUTH_NULL; } - else if ( argv[0][0] == 'm' ) + else if ( argv[4]->arg[0] == 'm' ) { auth_type = OSPF_AUTH_CRYPTOGRAPHIC; } @@ -6243,7 +6245,7 @@ DEFUN (no_ip_ospf_authentication, if (argc == 1) { - ret = inet_aton(argv[0], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6345,7 +6347,7 @@ DEFUN (ip_ospf_authentication_key, } memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); - strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); + strncpy ((char *) params->auth_simple, argv[4]->arg, OSPF_AUTH_SIMPLE_SIZE); SET_IF_PARAM (params, auth_simple); return CMD_SUCCESS; @@ -6485,7 +6487,7 @@ DEFUN (ip_ospf_message_digest_key, ospf_if_update_params (ifp, addr); } - key_id = strtol (argv[0], NULL, 10); + key_id = strtol (argv[3]->arg, NULL, 10); if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) { vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); @@ -6495,7 +6497,7 @@ DEFUN (ip_ospf_message_digest_key, ck = ospf_crypt_key_new (); ck->key_id = (u_char) key_id; memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); - strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); + strncpy ((char *) ck->auth_key, argv[6]->arg, OSPF_AUTH_MD5_SIZE); ospf_crypt_key_add (params->auth_crypt, ck); SET_IF_PARAM (params, auth_crypt); @@ -6559,7 +6561,7 @@ DEFUN (no_ip_ospf_message_digest_key_md5, return CMD_SUCCESS; } - key_id = strtol (argv[0], NULL, 10); + key_id = strtol (argv[4]->arg, NULL, 10); ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); if (ck == NULL) { @@ -6611,7 +6613,7 @@ DEFUN (no_ip_ospf_message_digest_key, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[5]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6624,7 +6626,7 @@ DEFUN (no_ip_ospf_message_digest_key, return CMD_SUCCESS; } - key_id = strtol (argv[0], NULL, 10); + key_id = strtol (argv[4]->arg, NULL, 10); ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); if (ck == NULL) { @@ -6677,7 +6679,7 @@ DEFUN (ip_ospf_cost, params = IF_DEF_PARAMS (ifp); - cost = strtol (argv[0], NULL, 10); + cost = strtol (argv[3]->arg, NULL, 10); /* cost range is <1-65535>. */ if (cost < 1 || cost > 65535) @@ -6688,7 +6690,7 @@ DEFUN (ip_ospf_cost, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6750,7 +6752,7 @@ DEFUN (no_ip_ospf_cost, if (argc == 1) { - ret = inet_aton(argv[0], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6822,7 +6824,7 @@ DEFUN (no_ip_ospf_cost2, * of N already configured for the interface. Thus the first argument * is always checked to be a number, but is ignored after that. */ - cost = strtol (argv[0], NULL, 10); + cost = strtol (argv[4]->arg, NULL, 10); if (cost < 1 || cost > 65535) { vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); @@ -6990,9 +6992,9 @@ DEFUN (ip_ospf_dead_interval, "Address of interface\n") { if (argc == 2) - return ospf_vty_dead_interval_set (vty, argv[0], argv[1], NULL); + return ospf_vty_dead_interval_set (vty, argv[3]->arg, argv[4]->arg, NULL); else - return ospf_vty_dead_interval_set (vty, argv[0], NULL, NULL); + return ospf_vty_dead_interval_set (vty, argv[3]->arg, NULL, NULL); } ALIAS (ip_ospf_dead_interval, @@ -7022,9 +7024,9 @@ DEFUN (ip_ospf_dead_interval_minimal, "Address of interface\n") { if (argc == 2) - return ospf_vty_dead_interval_set (vty, NULL, argv[1], argv[0]); + return ospf_vty_dead_interval_set (vty, NULL, argv[6]->arg, argv[5]->arg); else - return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[0]); + return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[5]->arg); } ALIAS (ip_ospf_dead_interval_minimal, @@ -7059,7 +7061,7 @@ DEFUN (no_ip_ospf_dead_interval, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[5]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7170,7 +7172,7 @@ DEFUN (ip_ospf_hello_interval, params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[0], NULL, 10); + seconds = strtol (argv[3]->arg, NULL, 10); /* HelloInterval range is <1-65535>. */ if (seconds < 1 || seconds > 65535) @@ -7181,7 +7183,7 @@ DEFUN (ip_ospf_hello_interval, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7234,7 +7236,7 @@ DEFUN (no_ip_ospf_hello_interval, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[5]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7305,13 +7307,13 @@ DEFUN (ip_ospf_network, return CMD_WARNING; } - if (strncmp (argv[0], "b", 1) == 0) + if (strncmp (argv[3]->arg, "b", 1) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; - else if (strncmp (argv[0], "n", 1) == 0) + else if (strncmp (argv[3]->arg, "n", 1) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; - else if (strncmp (argv[0], "point-to-m", 10) == 0) + else if (strncmp (argv[3]->arg, "point-to-m", 10) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; - else if (strncmp (argv[0], "point-to-p", 10) == 0) + else if (strncmp (argv[3]->arg, "point-to-p", 10) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; if (IF_DEF_PARAMS (ifp)->type == old_type) @@ -7432,7 +7434,7 @@ DEFUN (ip_ospf_priority, params = IF_DEF_PARAMS (ifp); - priority = strtol (argv[0], NULL, 10); + priority = strtol (argv[3]->arg, NULL, 10); /* Router Priority range is <0-255>. */ if (priority < 0 || priority > 255) @@ -7443,7 +7445,7 @@ DEFUN (ip_ospf_priority, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7512,7 +7514,7 @@ DEFUN (no_ip_ospf_priority, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[5]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7594,7 +7596,7 @@ DEFUN (ip_ospf_retransmit_interval, struct ospf_if_params *params; params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[0], NULL, 10); + seconds = strtol (argv[3]->arg, NULL, 10); /* Retransmit Interval range is <3-65535>. */ if (seconds < 3 || seconds > 65535) @@ -7606,7 +7608,7 @@ DEFUN (ip_ospf_retransmit_interval, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7752,7 +7754,7 @@ DEFUN (ip_ospf_transmit_delay, struct ospf_if_params *params; params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[0], NULL, 10); + seconds = strtol (argv[3]->arg, NULL, 10); /* Transmit Delay range is <1-65535>. */ if (seconds < 1 || seconds > 65535) @@ -7763,7 +7765,7 @@ DEFUN (ip_ospf_transmit_delay, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7911,7 +7913,7 @@ DEFUN (ip_ospf_area, u_short instance = 0; if (argc == 2) - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); ospf = ospf_lookup_instance (instance); if (ospf == NULL) @@ -8026,7 +8028,7 @@ DEFUN (no_ip_ospf_instance_area, struct ospf_if_params *params; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL) return CMD_SUCCESS; @@ -8056,8 +8058,7 @@ ALIAS (no_ip_ospf_instance_area, DEFUN (ospf_redistribute_source, ospf_redistribute_source_cmd, - "redistribute " QUAGGA_REDIST_STR_OSPFD - " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "redistribute " QUAGGA_REDIST_STR_OSPFD " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD "Metric for redistributed routes\n" @@ -8084,13 +8085,13 @@ DEFUN (ospf_redistribute_source, return CMD_SUCCESS; /* Get distribute source. */ - source = proto_redistnum(AFI_IP, argv[0]); + source = proto_redistnum(AFI_IP, argv[1]->arg); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; /* Get metric value. */ - if (argv[1] != NULL) - if (!str2metric (argv[1], &metric)) + if (argv[2]->arg != NULL) + if (!str2metric (argv[2]->arg, &metric)) return CMD_WARNING; /* Get metric type. */ @@ -8110,8 +8111,7 @@ DEFUN (ospf_redistribute_source, DEFUN (no_ospf_redistribute_source, no_ospf_redistribute_source_cmd, - "no redistribute " QUAGGA_REDIST_STR_OSPFD - " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "no redistribute " QUAGGA_REDIST_STR_OSPFD " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD @@ -8129,7 +8129,7 @@ DEFUN (no_ospf_redistribute_source, if (!ospf) return CMD_SUCCESS; - source = proto_redistnum(AFI_IP, argv[0]); + source = proto_redistnum(AFI_IP, argv[2]->arg); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; @@ -8143,8 +8143,7 @@ DEFUN (no_ospf_redistribute_source, DEFUN (ospf_redistribute_instance_source, ospf_redistribute_instance_source_cmd, - "redistribute (ospf|table) <1-65535>" - " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "redistribute (ospf|table) <1-65535> {metric <0-16777214>|metric-type (1|2)|route-map WORD}", REDIST_STR "Open Shortest Path First\n" "Non-main Kernel Routing Table\n" @@ -8167,12 +8166,12 @@ DEFUN (ospf_redistribute_instance_source, if (!ospf) return CMD_SUCCESS; - if (strncmp(argv[0], "o", 1) == 0) + if (strncmp(argv[1]->arg, "o", 1) == 0) source = ZEBRA_ROUTE_OSPF; else source = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[1]); + VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); if (!ospf) return CMD_SUCCESS; @@ -8192,8 +8191,8 @@ DEFUN (ospf_redistribute_instance_source, } /* Get metric value. */ - if (argv[2] != NULL) - if (!str2metric (argv[2], &metric)) + if (argv[3]->arg != NULL) + if (!str2metric (argv[3]->arg, &metric)) return CMD_WARNING; /* Get metric type. */ @@ -8212,8 +8211,7 @@ DEFUN (ospf_redistribute_instance_source, DEFUN (no_ospf_redistribute_instance_source, no_ospf_redistribute_instance_source_cmd, - "no redistribute (ospf|table) <1-65535>" - " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "no redistribute (ospf|table) <1-65535> {metric <0-16777214>|metric-type (1|2)|route-map WORD}", NO_STR REDIST_STR "Open Shortest Path First\n" @@ -8235,12 +8233,12 @@ DEFUN (no_ospf_redistribute_instance_source, if (!ospf) return CMD_SUCCESS; - if (strncmp(argv[0], "o", 1) == 0) + if (strncmp(argv[2]->arg, "o", 1) == 0) source = ZEBRA_ROUTE_OSPF; else source = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[1]); + VTY_GET_INTEGER ("Instance ID", instance, argv[3]->arg); if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance) { @@ -8279,11 +8277,11 @@ DEFUN (ospf_distribute_list_out, return CMD_SUCCESS; /* Get distribute source. */ - source = proto_redistnum(AFI_IP, argv[1]); + source = proto_redistnum(AFI_IP, argv[4]->arg); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; - return ospf_distribute_list_out_set (ospf, source, argv[0]); + return ospf_distribute_list_out_set (ospf, source, argv[1]->arg); } DEFUN (no_ospf_distribute_list_out, @@ -8301,18 +8299,17 @@ DEFUN (no_ospf_distribute_list_out, if (!ospf) return CMD_SUCCESS; - source = proto_redistnum(AFI_IP, argv[1]); + source = proto_redistnum(AFI_IP, argv[5]->arg); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; - return ospf_distribute_list_out_unset (ospf, source, argv[0]); + return ospf_distribute_list_out_unset (ospf, source, argv[2]->arg); } /* Default information originate. */ DEFUN (ospf_default_information_originate, ospf_default_information_originate_cmd, - "default-information originate " - "{always|metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "default-information originate {always|metric <0-16777214>|metric-type (1|2)|route-map WORD}", "Control distribution of default information\n" "Distribute a default route\n" "Always advertise default route\n" @@ -8337,7 +8334,7 @@ DEFUN (ospf_default_information_originate, return CMD_WARNING; /* this should not happen */ /* Check whether "always" was specified */ - if (argv[0] != NULL) + if (argv[2]->arg != NULL) default_originate = DEFAULT_ORIGINATE_ALWAYS; red = ospf_redist_add(ospf, DEFAULT_ROUTE, 0); @@ -8363,8 +8360,7 @@ DEFUN (ospf_default_information_originate, DEFUN (no_ospf_default_information_originate, no_ospf_default_information_originate_cmd, - "no default-information originate" - "{always|metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "no default-information originate {always|metric <0-16777214>|metric-type (1|2)|route-map WORD}", NO_STR "Control distribution of default information\n" "Distribute a default route\n" @@ -8417,7 +8413,7 @@ DEFUN (ospf_default_metric, if (!ospf) return CMD_SUCCESS; - if (!str2metric (argv[0], &metric)) + if (!str2metric (argv[1]->arg, &metric)) return CMD_WARNING; ospf->default_metric = metric; @@ -8459,7 +8455,7 @@ DEFUN (ospf_distance, if (!ospf) return CMD_SUCCESS; - ospf->distance_all = atoi (argv[0]); + ospf->distance_all = atoi (argv[1]->arg); return CMD_SUCCESS; } @@ -8505,7 +8501,7 @@ DEFUN (no_ospf_distance_ospf, if (!ospf) return CMD_SUCCESS; - if (argv[0] != NULL) + if (argv[3]->arg != NULL) ospf->distance_intra = 0; if (argv[1] != NULL) @@ -8514,7 +8510,7 @@ DEFUN (no_ospf_distance_ospf, if (argv[2] != NULL) ospf->distance_external = 0; - if (argv[0] || argv[1] || argv[2]) + if (argv[3]->arg || argv[1] || argv[2]) return CMD_SUCCESS; /* If no arguments are given, clear all distance information */ @@ -8527,8 +8523,7 @@ DEFUN (no_ospf_distance_ospf, DEFUN (ospf_distance_ospf, ospf_distance_ospf_cmd, - "distance ospf " - "{intra-area <1-255>|inter-area <1-255>|external <1-255>}", + "distance ospf {intra-area <1-255>|inter-area <1-255>|external <1-255>}", "Define an administrative distance\n" "OSPF Administrative distance\n" "Intra-area routes\n" @@ -8546,15 +8541,15 @@ DEFUN (ospf_distance_ospf, if (argc < 3) /* should not happen */ return CMD_WARNING; - if (!argv[0] && !argv[1] && !argv[2]) + if (!argv[2]->arg && !argv[1] && !argv[2]) { vty_out(vty, "%% Command incomplete. (Arguments required)%s", VTY_NEWLINE); return CMD_WARNING; } - if (argv[0] != NULL) - ospf->distance_intra = atoi(argv[0]); + if (argv[2]->arg != NULL) + ospf->distance_intra = atoi(argv[2]->arg); if (argv[1] != NULL) ospf->distance_inter = atoi(argv[1]); @@ -8577,7 +8572,7 @@ DEFUN (ospf_distance_source, if (!ospf) return CMD_SUCCESS; - ospf_distance_set (vty, ospf, argv[0], argv[1], NULL); + ospf_distance_set (vty, ospf, argv[1]->arg, argv[2]->arg, NULL); return CMD_SUCCESS; } @@ -8595,7 +8590,7 @@ DEFUN (no_ospf_distance_source, if (!ospf) return CMD_SUCCESS; - ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL); + ospf_distance_unset (vty, ospf, argv[2]->arg, argv[3]->arg, NULL); return CMD_SUCCESS; } @@ -8613,7 +8608,7 @@ DEFUN (ospf_distance_source_access_list, if (!ospf) return CMD_SUCCESS; - ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]); + ospf_distance_set (vty, ospf, argv[1]->arg, argv[2]->arg, argv[3]->arg); return CMD_SUCCESS; } @@ -8632,7 +8627,7 @@ DEFUN (no_ospf_distance_source_access_list, if (!ospf) return CMD_SUCCESS; - ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]); + ospf_distance_unset (vty, ospf, argv[2]->arg, argv[3]->arg, argv[4]->arg); return CMD_SUCCESS; } @@ -8654,7 +8649,7 @@ DEFUN (ip_ospf_mtu_ignore, if (argc == 1) { - ret = inet_aton(argv[0], &addr); + ret = inet_aton(argv[3]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -8704,7 +8699,7 @@ DEFUN (no_ip_ospf_mtu_ignore, if (argc == 1) { - ret = inet_aton(argv[0], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -8815,7 +8810,7 @@ DEFUN (ospf_max_metric_router_lsa_startup, return CMD_WARNING; } - VTY_GET_INTEGER ("stub-router startup period", seconds, argv[0]); + VTY_GET_INTEGER ("stub-router startup period", seconds, argv[3]->arg); ospf->stub_router_startup_time = seconds; @@ -8883,7 +8878,7 @@ DEFUN (ospf_max_metric_router_lsa_shutdown, return CMD_WARNING; } - VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[0]); + VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[3]->arg); ospf->stub_router_shutdown_time = seconds; @@ -9146,7 +9141,7 @@ DEFUN (show_ip_ospf_instance_border_routers, struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -9208,7 +9203,7 @@ DEFUN (show_ip_ospf_instance_route, struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -10272,7 +10267,7 @@ DEFUN (clear_ip_ospf_interface, } else /* Interface name is specified. */ { - if ((ifp = if_lookup_by_name (argv[0])) == NULL) + if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else ospf_interface_clear(ifp); diff --git a/tools/argv_translator.py b/tools/argv_translator.py index f99316d905..8547715d34 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -30,6 +30,7 @@ def token_is_variable(line_number, token): if token in ('WORD', '.LINE', # where is this defined? 'LINE', + 'BITPATTERN', 'PATH', 'A.B.C.D', 'A.B.C.D/M', @@ -45,6 +46,78 @@ def token_is_variable(line_number, token): return False + tokens = [] + + +def line_to_tokens(text): + """ + Most of the time whitespace can be used to split tokens + (set|clear) clagd-enable (no|yes) + + tokens + - (set|clear) + - + - clagd-enable + - (no|yes) + + But if we are dealing with multiword keywords, such as "soft in", that approach + does not work. We can only split on whitespaces if we are not inside a () or [] + bgp (|||*) [soft in|soft out] + + tokens: + - bgp + - (|||*) + - [soft in|soft out] + """ + tokens = [] + token_index = 0 + token_text = [] + parens = 0 + curlys = 0 + brackets = 0 + less_greater = 0 + + for char in text: + if char == ' ': + if parens == 0 and brackets == 0 and curlys == 0 and less_greater == 0: + tokens.append(''.join(token_text)) + token_index += 1 + token_text = [] + else: + token_text.append(char) + else: + if char == '(': + parens += 1 + + elif char == ')': + parens -= 1 + + elif char == '[': + brackets += 1 + + elif char == ']': + brackets -= 1 + + elif char == '{': + curlys += 1 + + elif char == '}': + curlys -= 1 + + elif char == '<': + less_greater += 1 + + elif char == '>': + less_greater -= 1 + + token_text.append(char) + + if token_text: + tokens.append(''.join(token_text)) + + return tokens + + def get_argv_translator(line_number, line): table = {} line = line.strip() @@ -59,7 +132,7 @@ def get_argv_translator(line_number, 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()): + for (token_index, token) in enumerate(line_to_tokens(line)): if token_is_variable(line_number, token): # print "%s is a token" % token table[old_style_index] = token_index @@ -110,6 +183,8 @@ def update_argvs(filename): 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)') + line = line.replace('" OSPF_LSA_TYPES_CMD_STR "', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as') + line = line.replace('" QUAGGA_REDIST_STR_OSPFD "', '(kernel|connected|static|rip|isis|bgp|pim|table)') # endswith line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",') @@ -118,13 +193,16 @@ def update_argvs(filename): 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('" BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE,', '<2-255> <50-60000> <50-60000>",') + line = line.replace('" OSPF_LSA_TYPES_CMD_STR,', ' asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as",') 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)",') + line = line.replace('" QUAGGA_REDIST_STR_OSPFD,', ' (kernel|connected|static|rip|isis|bgp|pim|table)",') - # startswith + # 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) ') -- 2.39.5