diff options
-rw-r--r-- | lib/command.c | 62 | ||||
-rw-r--r-- | lib/filter.c | 268 | ||||
-rw-r--r-- | lib/if.c | 9 | ||||
-rw-r--r-- | lib/if_rmap.c | 22 | ||||
-rw-r--r-- | lib/keychain.c | 181 | ||||
-rw-r--r-- | lib/ns.c | 12 | ||||
-rw-r--r-- | lib/plist.c | 434 | ||||
-rw-r--r-- | lib/routemap.c | 30 | ||||
-rw-r--r-- | lib/smux.c | 6 | ||||
-rw-r--r-- | lib/thread.c | 14 | ||||
-rw-r--r-- | lib/vty.c | 19 | ||||
-rwxr-xr-x | tools/argv_translator.py | 21 |
12 files changed, 806 insertions, 272 deletions
diff --git a/lib/command.c b/lib/command.c index d3b3f3a2b..f18338589 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1148,6 +1148,7 @@ DEFUN (config_write, "Write configuration currently in memory\n" "Write configuration to terminal\n") { + int idx_type = 1; unsigned int i; int fd; struct cmd_node *node; @@ -1159,8 +1160,8 @@ DEFUN (config_write, struct stat conf_stat; // if command was 'write terminal' or 'show running-config' - if (argc == 2 && (!strcmp(argv[1]->arg, "terminal") || - !strcmp(argv[1]->arg, "running-config"))) + if (argc == 2 && (!strcmp(argv[idx_type]->arg, "terminal") || + !strcmp(argv[idx_type]->arg, "running-config"))) { if (vty->type == VTY_SHELL_SERV) { @@ -1364,6 +1365,8 @@ DEFUN (config_password, "Specifies a HIDDEN password will follow\n" "The password string\n") { + int idx_8 = 1; + int idx_word = 2; if (argc == 3) // '8' was specified { if (host.password) @@ -1371,11 +1374,11 @@ DEFUN (config_password, host.password = NULL; if (host.password_encrypt) XFREE (MTYPE_HOST, host.password_encrypt); - host.password_encrypt = XSTRDUP (MTYPE_HOST, argv[2]->arg); + host.password_encrypt = XSTRDUP (MTYPE_HOST, argv[idx_word]->arg); return CMD_SUCCESS; } - if (!isalnum (argv[1]->arg[0])) + if (!isalnum (argv[idx_8]->arg[0])) { vty_out (vty, "Please specify string starting with alphanumeric%s", VTY_NEWLINE); @@ -1390,10 +1393,10 @@ DEFUN (config_password, { if (host.password_encrypt) XFREE (MTYPE_HOST, host.password_encrypt); - host.password_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[1]->arg)); + host.password_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[idx_8]->arg)); } else - host.password = XSTRDUP (MTYPE_HOST, argv[1]->arg); + host.password = XSTRDUP (MTYPE_HOST, argv[idx_8]->arg); return CMD_SUCCESS; } @@ -1408,10 +1411,12 @@ DEFUN (config_enable_password, "dummy string \n" "The HIDDEN 'enable' password string\n") { + int idx_8 = 2; + int idx_word = 3; /* Crypt type is specified. */ if (argc == 4) { - if (argv[2]->arg[0] == '8') + if (argv[idx_8]->arg[0] == '8') { if (host.enable) XFREE (MTYPE_HOST, host.enable); @@ -1419,7 +1424,7 @@ DEFUN (config_enable_password, if (host.enable_encrypt) XFREE (MTYPE_HOST, host.enable_encrypt); - host.enable_encrypt = XSTRDUP (MTYPE_HOST, argv[3]->arg); + host.enable_encrypt = XSTRDUP (MTYPE_HOST, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -1430,7 +1435,7 @@ DEFUN (config_enable_password, } } - if (!isalnum (argv[2]->arg[0])) + if (!isalnum (argv[idx_8]->arg[0])) { vty_out (vty, "Please specify string starting with alphanumeric%s", VTY_NEWLINE); @@ -1446,10 +1451,10 @@ DEFUN (config_enable_password, { if (host.enable_encrypt) XFREE (MTYPE_HOST, host.enable_encrypt); - host.enable_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[2]->arg)); + host.enable_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[idx_8]->arg)); } else - host.enable = XSTRDUP (MTYPE_HOST, argv[2]->arg); + host.enable = XSTRDUP (MTYPE_HOST, argv[idx_8]->arg); return CMD_SUCCESS; } @@ -1530,10 +1535,11 @@ DEFUN (config_terminal_length, "Set number of lines on a screen\n" "Number of lines on screen (0 for no pausing)\n") { + int idx_number = 2; int lines; char *endptr = NULL; - lines = strtol (argv[2]->arg, &endptr, 10); + lines = strtol (argv[idx_number]->arg, &endptr, 10); if (lines < 0 || lines > 512 || *endptr != '\0') { vty_out (vty, "length is malformed%s", VTY_NEWLINE); @@ -1562,10 +1568,11 @@ DEFUN (service_terminal_length, "System wide terminal length configuration\n" "Number of lines of VTY (0 means no line control)\n") { + int idx_number = 2; int lines; char *endptr = NULL; - lines = strtol (argv[2]->arg, &endptr, 10); + lines = strtol (argv[idx_number]->arg, &endptr, 10); if (lines < 0 || lines > 512 || *endptr != '\0') { vty_out (vty, "length is malformed%s", VTY_NEWLINE); @@ -1610,10 +1617,11 @@ DEFUN (config_logmsg, LOG_LEVEL_DESC "The message to send\n") { + int idx_log_level = 1; int level; char *message; - if ((level = level_match(argv[1]->arg)) == ZLOG_DISABLED) + if ((level = level_match(argv[idx_log_level]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog(NULL, level, "%s", ((message = argv_concat(argv, argc, 1)) ? message : "")); @@ -1682,6 +1690,7 @@ DEFUN (config_log_stdout, "Set stdout logging level\n" LOG_LEVEL_DESC) { + int idx_log_level = 2; if (argc == 2) { zlog_set_level (NULL, ZLOG_DEST_STDOUT, zlog_default->default_lvl); @@ -1689,7 +1698,7 @@ DEFUN (config_log_stdout, } int level; - if ((level = level_match(argv[2]->arg)) == ZLOG_DISABLED) + if ((level = level_match(argv[idx_log_level]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog_set_level (NULL, ZLOG_DEST_STDOUT, level); return CMD_SUCCESS; @@ -1714,6 +1723,7 @@ DEFUN (config_log_monitor, "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) { + int idx_log_level = 2; if (argc == 2) { zlog_set_level (NULL, ZLOG_DEST_MONITOR, zlog_default->default_lvl); @@ -1721,7 +1731,7 @@ DEFUN (config_log_monitor, } int level; - if ((level = level_match(argv[2]->arg)) == ZLOG_DISABLED) + if ((level = level_match(argv[idx_log_level]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog_set_level (NULL, ZLOG_DEST_MONITOR, level); return CMD_SUCCESS; @@ -1801,15 +1811,17 @@ DEFUN (config_log_file, "Logging filename\n" LOG_LEVEL_DESC) { + int idx_filename = 2; + int idx_log_levels = 3; if (argc == 4) { int level; - if ((level = level_match(argv[3]->arg)) == ZLOG_DISABLED) + if ((level = level_match(argv[idx_log_levels]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; - return set_log_file(vty, argv[2]->arg, level); + return set_log_file(vty, argv[idx_filename]->arg, level); } else - return set_log_file(vty, argv[2]->arg, zlog_default->default_lvl); + return set_log_file(vty, argv[idx_filename]->arg, zlog_default->default_lvl); } DEFUN (no_config_log_file, @@ -1839,10 +1851,11 @@ DEFUN (config_log_syslog, "Set syslog logging level\n" LOG_LEVEL_DESC) { + int idx_log_levels = 2; if (argc == 3) { int level; - if ((level = level_match (argv[2]->arg)) == ZLOG_DISABLED) + if ((level = level_match (argv[idx_log_levels]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog_set_level (NULL, ZLOG_DEST_SYSLOG, level); return CMD_SUCCESS; @@ -1889,7 +1902,8 @@ DEFUN (config_log_facility, "Facility parameter for syslog messages\n" LOG_FACILITY_DESC) { - int facility = facility_match(argv[2]->arg); + int idx_target = 2; + int facility = facility_match(argv[idx_target]->arg); zlog_default->facility = facility; return CMD_SUCCESS; @@ -1968,8 +1982,9 @@ DEFUN (config_log_timestamp_precision, "Set the timestamp precision\n" "Number of subsecond digits\n") { + int idx_number = 3; VTY_GET_INTEGER_RANGE("Timestamp Precision", - zlog_default->timestamp_precision, argv[3]->arg, 0, 6); + zlog_default->timestamp_precision, argv[idx_number]->arg, 0, 6); return CMD_SUCCESS; } @@ -2017,7 +2032,8 @@ DEFUN (banner_motd_file, "Banner from a file\n" "Filename\n") { - const char *filename = argv[3]->arg; + int idx_file = 3; + const char *filename = argv[idx_file]->arg; int cmd = cmd_banner_motd_file (filename); if (cmd == CMD_ERR_NO_FILE) diff --git a/lib/filter.c b/lib/filter.c index 52d6d956d..40bf0a339 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -713,7 +713,11 @@ DEFUN (access_list_standard, "Address to match\n" "Wildcard bits\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, NULL, 0, 1); } @@ -727,7 +731,10 @@ DEFUN (access_list_standard_nomask, "Specify packets to forward\n" "Address to match\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, "0.0.0.0", + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 3; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", NULL, NULL, 0, 1); } @@ -742,7 +749,10 @@ DEFUN (access_list_standard_host, "A single host address\n" "Address to match\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, "0.0.0.0", + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 4; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", NULL, NULL, 0, 1); } @@ -756,7 +766,9 @@ DEFUN (access_list_standard_any, "Specify packets to forward\n" "Any source host\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", + int idx_acl = 1; + int idx_permit_deny = 2; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 1); } @@ -772,7 +784,11 @@ DEFUN (no_access_list_standard, "Address to match\n" "Wildcard bits\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, NULL, 0, 0); } @@ -787,7 +803,10 @@ DEFUN (no_access_list_standard_nomask, "Specify packets to forward\n" "Address to match\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, "0.0.0.0", + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 4; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", NULL, NULL, 0, 0); } @@ -803,7 +822,10 @@ DEFUN (no_access_list_standard_host, "A single host address\n" "Address to match\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, "0.0.0.0", + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 5; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", NULL, NULL, 0, 0); } @@ -818,7 +840,9 @@ DEFUN (no_access_list_standard_any, "Specify packets to forward\n" "Any source host\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", + int idx_acl = 2; + int idx_permit_deny = 3; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 0); } @@ -837,8 +861,14 @@ DEFUN (access_list_extended, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, - argv[5]->arg, argv[6]->arg, argv[7]->arg, 1 ,1); + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; + int idx_ipv4_3 = 6; + int idx_ipv4_4 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, argv[idx_ipv4_3]->arg, argv[idx_ipv4_4]->arg, 1 ,1); } DEFUN (access_list_extended_mask_any, @@ -854,8 +884,12 @@ DEFUN (access_list_extended_mask_any, "Source wildcard bits\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, - argv[5]->arg, "0.0.0.0", + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, "0.0.0.0", "255.255.255.255", 1, 1); } @@ -872,9 +906,13 @@ DEFUN (access_list_extended_any_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", - "255.255.255.255", argv[5]->arg, - argv[6]->arg, 1, 1); + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", + "255.255.255.255", argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, 1, 1); } DEFUN (access_list_extended_any_any, @@ -889,7 +927,9 @@ DEFUN (access_list_extended_any_any, "Any source host\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", + int idx_acl = 1; + int idx_permit_deny = 2; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", "255.255.255.255", "0.0.0.0", "255.255.255.255", 1, 1); } @@ -908,8 +948,13 @@ DEFUN (access_list_extended_mask_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, - argv[5]->arg, argv[7]->arg, + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; + int idx_ipv4_3 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, argv[idx_ipv4_3]->arg, "0.0.0.0", 1, 1); } @@ -927,9 +972,14 @@ DEFUN (access_list_extended_host_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[5]->arg, - "0.0.0.0", argv[6]->arg, - argv[7]->arg, 1, 1); + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + int idx_ipv4_3 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + "0.0.0.0", argv[idx_ipv4_2]->arg, + argv[idx_ipv4_3]->arg, 1, 1); } DEFUN (access_list_extended_host_host, @@ -946,8 +996,12 @@ DEFUN (access_list_extended_host_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[5]->arg, - "0.0.0.0", argv[7]->arg, + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 5; + int idx_ipv4_2 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + "0.0.0.0", argv[idx_ipv4_2]->arg, "0.0.0.0", 1, 1); } @@ -964,8 +1018,11 @@ DEFUN (access_list_extended_any_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", - "255.255.255.255", argv[6]->arg, + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 6; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", + "255.255.255.255", argv[idx_ipv4]->arg, "0.0.0.0", 1, 1); } @@ -982,7 +1039,10 @@ DEFUN (access_list_extended_host_any, "Source address\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[5]->arg, + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 5; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 1); } @@ -1002,8 +1062,14 @@ DEFUN (no_access_list_extended, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, - argv[6]->arg, argv[7]->arg, argv[8]->arg, 1, 0); + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + int idx_ipv4_3 = 7; + int idx_ipv4_4 = 8; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, argv[idx_ipv4_3]->arg, argv[idx_ipv4_4]->arg, 1, 0); } DEFUN (no_access_list_extended_mask_any, @@ -1020,8 +1086,12 @@ DEFUN (no_access_list_extended_mask_any, "Source wildcard bits\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, - argv[6]->arg, "0.0.0.0", + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1039,9 +1109,13 @@ DEFUN (no_access_list_extended_any_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", - "255.255.255.255", argv[6]->arg, - argv[7]->arg, 1, 0); + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 6; + int idx_ipv4_2 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", + "255.255.255.255", argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, 1, 0); } DEFUN (no_access_list_extended_any_any, @@ -1057,7 +1131,9 @@ DEFUN (no_access_list_extended_any_any, "Any source host\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", + int idx_acl = 2; + int idx_permit_deny = 3; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", "255.255.255.255", "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1077,8 +1153,13 @@ DEFUN (no_access_list_extended_mask_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, - argv[6]->arg, argv[8]->arg, + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + int idx_ipv4_3 = 8; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, argv[idx_ipv4_3]->arg, "0.0.0.0", 1, 0); } @@ -1097,9 +1178,14 @@ DEFUN (no_access_list_extended_host_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[6]->arg, - "0.0.0.0", argv[7]->arg, - argv[8]->arg, 1, 0); + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 6; + int idx_ipv4_2 = 7; + int idx_ipv4_3 = 8; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + "0.0.0.0", argv[idx_ipv4_2]->arg, + argv[idx_ipv4_3]->arg, 1, 0); } DEFUN (no_access_list_extended_host_host, @@ -1117,8 +1203,12 @@ DEFUN (no_access_list_extended_host_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[6]->arg, - "0.0.0.0", argv[8]->arg, + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 6; + int idx_ipv4_2 = 8; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + "0.0.0.0", argv[idx_ipv4_2]->arg, "0.0.0.0", 1, 0); } @@ -1136,8 +1226,11 @@ DEFUN (no_access_list_extended_any_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", - "255.255.255.255", argv[7]->arg, + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", + "255.255.255.255", argv[idx_ipv4]->arg, "0.0.0.0", 1, 0); } @@ -1155,7 +1248,10 @@ DEFUN (no_access_list_extended_host_any, "Source address\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[6]->arg, + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 6; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1251,7 +1347,10 @@ DEFUN (access_list, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[1]->arg, argv[2]->arg, AFI_IP, argv[3]->arg, 0, 1); + int idx_word = 1; + int idx_permit_deny = 2; + int idx_ipv4_prefixlen = 3; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, argv[idx_ipv4_prefixlen]->arg, 0, 1); } DEFUN (access_list_exact, @@ -1264,7 +1363,10 @@ DEFUN (access_list_exact, "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[1]->arg, argv[2]->arg, AFI_IP, argv[3]->arg, 1, 1); + int idx_word = 1; + int idx_permit_deny = 2; + int idx_ipv4_prefixlen = 3; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, argv[idx_ipv4_prefixlen]->arg, 1, 1); } DEFUN (access_list_any, @@ -1276,7 +1378,9 @@ DEFUN (access_list_any, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[1]->arg, argv[2]->arg, AFI_IP, "0.0.0.0/0", 0, 1); + int idx_word = 1; + int idx_permit_deny = 2; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, "0.0.0.0/0", 0, 1); } DEFUN (no_access_list, @@ -1289,7 +1393,10 @@ DEFUN (no_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP, argv[4]->arg, 0, 0); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, argv[idx_ipv4_prefixlen]->arg, 0, 0); } DEFUN (no_access_list_exact, @@ -1303,7 +1410,10 @@ DEFUN (no_access_list_exact, "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP, argv[4]->arg, 1, 0); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, argv[idx_ipv4_prefixlen]->arg, 1, 0); } DEFUN (no_access_list_any, @@ -1316,7 +1426,9 @@ DEFUN (no_access_list_any, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP, "0.0.0.0/0", 0, 0); + int idx_word = 2; + int idx_permit_deny = 3; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, "0.0.0.0/0", 0, 0); } DEFUN (no_access_list_all, @@ -1330,14 +1442,15 @@ DEFUN (no_access_list_all, "IP extended access list (expanded range)\n" "IP zebra access-list name\n") { + int idx_acl = 2; struct access_list *access; struct access_master *master; /* Looking up access_list. */ - access = access_list_lookup (AFI_IP, argv[2]->arg); + access = access_list_lookup (AFI_IP, argv[idx_acl]->arg); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[2]->arg, + vty_out (vty, "%% access-list %s doesn't exist%s", argv[idx_acl]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1367,9 +1480,10 @@ DEFUN (access_list_remark, "Access list entry comment\n" "Comment up to 100 characters\n") { + int idx_acl = 1; struct access_list *access; - access = access_list_get (AFI_IP, argv[1]->arg); + access = access_list_get (AFI_IP, argv[idx_acl]->arg); if (access->remark) { @@ -1393,7 +1507,8 @@ DEFUN (no_access_list_remark, "IP zebra access-list\n" "Access list entry comment\n") { - return vty_access_list_remark_unset (vty, AFI_IP, argv[2]->arg); + int idx_acl = 2; + return vty_access_list_remark_unset (vty, AFI_IP, argv[idx_acl]->arg); } /* ALIAS_FIXME */ @@ -1425,7 +1540,10 @@ DEFUN (ipv6_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP6, argv[4]->arg, 0, 1); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, argv[idx_ipv6_prefixlen]->arg, 0, 1); } DEFUN (ipv6_access_list_exact, @@ -1439,7 +1557,10 @@ DEFUN (ipv6_access_list_exact, "Prefix to match. e.g. 3ffe:506::/32\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP6, argv[4]->arg, 1, 1); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, argv[idx_ipv6_prefixlen]->arg, 1, 1); } DEFUN (ipv6_access_list_any, @@ -1452,7 +1573,9 @@ DEFUN (ipv6_access_list_any, "Specify packets to forward\n" "Any prefixi to match\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP6, "::/0", 0, 1); + int idx_word = 2; + int idx_permit_deny = 3; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, "::/0", 0, 1); } DEFUN (no_ipv6_access_list, @@ -1466,7 +1589,10 @@ DEFUN (no_ipv6_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { - return filter_set_zebra (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, argv[5]->arg, 0, 0); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, argv[idx_ipv6_prefixlen]->arg, 0, 0); } DEFUN (no_ipv6_access_list_exact, @@ -1481,7 +1607,10 @@ DEFUN (no_ipv6_access_list_exact, "Prefix to match. e.g. 3ffe:506::/32\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, argv[5]->arg, 1, 0); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, argv[idx_ipv6_prefixlen]->arg, 1, 0); } DEFUN (no_ipv6_access_list_any, @@ -1495,7 +1624,9 @@ DEFUN (no_ipv6_access_list_any, "Specify packets to forward\n" "Any prefixi to match\n") { - return filter_set_zebra (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, "::/0", 0, 0); + int idx_word = 3; + int idx_permit_deny = 4; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, "::/0", 0, 0); } @@ -1507,14 +1638,15 @@ DEFUN (no_ipv6_access_list_all, "Add an access list entry\n" "IPv6 zebra access-list\n") { + int idx_word = 3; struct access_list *access; struct access_master *master; /* Looking up access_list. */ - access = access_list_lookup (AFI_IP6, argv[3]->arg); + access = access_list_lookup (AFI_IP6, argv[idx_word]->arg); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[3]->arg, + vty_out (vty, "%% access-list %s doesn't exist%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1541,9 +1673,10 @@ DEFUN (ipv6_access_list_remark, "Access list entry comment\n" "Comment up to 100 characters\n") { + int idx_word = 2; struct access_list *access; - access = access_list_get (AFI_IP6, argv[2]->arg); + access = access_list_get (AFI_IP6, argv[idx_word]->arg); if (access->remark) { @@ -1564,7 +1697,8 @@ DEFUN (no_ipv6_access_list_remark, "IPv6 zebra access-list\n" "Access list entry comment\n") { - return vty_access_list_remark_unset (vty, AFI_IP6, argv[3]->arg); + int idx_word = 3; + return vty_access_list_remark_unset (vty, AFI_IP6, argv[idx_word]->arg); } /* ALIAS_FIXME */ @@ -1715,7 +1849,8 @@ DEFUN (show_ip_access_list_name, "IP extended access list (expanded range)\n" "IP zebra access-list\n") { - return filter_show (vty, argv[3]->arg, AFI_IP); + int idx_acl = 3; + return filter_show (vty, argv[idx_acl]->arg, AFI_IP); } #ifdef HAVE_IPV6 @@ -1737,7 +1872,8 @@ DEFUN (show_ipv6_access_list_name, "List IPv6 access lists\n" "IPv6 zebra access-list\n") { - return filter_show (vty, argv[3]->arg, AFI_IP6); + int idx_word = 3; + return filter_show (vty, argv[idx_word]->arg, AFI_IP6); } #endif /* HAVE_IPV6 */ @@ -755,7 +755,8 @@ DEFUN (interface, "Interface's name\n" VRF_CMD_HELP_STR) { - const char *ifname = argv[1]->arg; + int idx_ifname = 1; + const char *ifname = argv[idx_ifname]->arg; const char *vrfname = (argc > 2) ? argv[3]->arg : NULL; struct interface *ifp; @@ -836,7 +837,8 @@ DEFUN (vrf, "Select a VRF to configure\n" "VRF's name\n") { - const char *vrfname = argv[1]->arg; + int idx_name = 1; + const char *vrfname = argv[idx_name]->arg; struct vrf *vrfp; size_t sl; @@ -897,6 +899,7 @@ DEFUN (show_address, "address\n" VRF_CMD_HELP_STR) { + int idx_vrf_cmd_str = 2; struct listnode *node; struct listnode *node2; struct interface *ifp; @@ -905,7 +908,7 @@ DEFUN (show_address, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 2) - VRF_GET_ID (vrf_id, argv[2]->arg); + VRF_GET_ID (vrf_id, argv[idx_vrf_cmd_str]->arg); for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) { diff --git a/lib/if_rmap.c b/lib/if_rmap.c index abed32c9e..070d55d4b 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -228,11 +228,14 @@ DEFUN (if_rmap, "Route map set for output filtering\n" "Route map interface name\n") { + int idx_rmap_name = 1; + int idx_in_out = 2; + int idx_ifname = 3; enum if_rmap_type type; - if (strncmp (argv[2]->arg, "i", 1) == 0) + if (strncmp (argv[idx_in_out]->arg, "i", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[2]->arg, "o", 1) == 0) + else if (strncmp (argv[idx_in_out]->arg, "o", 1) == 0) type = IF_RMAP_OUT; else { @@ -240,10 +243,10 @@ DEFUN (if_rmap, return CMD_WARNING; } - if_rmap_set (argv[3]->arg, type, argv[1]->arg); + if_rmap_set (argv[idx_ifname]->arg, type, argv[idx_rmap_name]->arg); return CMD_SUCCESS; -} +} /* @@ -267,12 +270,15 @@ DEFUN (no_if_rmap, "Route map for output filtering\n" "Route map interface name\n") { + int idx_routemap_name = 2; + int idx_in_out = 3; + int idx_ifname = 4; int ret; enum if_rmap_type type; - if (strncmp (argv[3]->arg, "i", 1) == 0) + if (strncmp (argv[idx_in_out]->arg, "i", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[3]->arg, "o", 1) == 0) + else if (strncmp (argv[idx_in_out]->arg, "o", 1) == 0) type = IF_RMAP_OUT; else { @@ -280,14 +286,14 @@ DEFUN (no_if_rmap, return CMD_WARNING; } - ret = if_rmap_unset (argv[4]->arg, type, argv[2]->arg); + ret = if_rmap_unset (argv[idx_ifname]->arg, type, argv[idx_routemap_name]->arg); if (! ret) { vty_out (vty, "route-map doesn't exist%s", VTY_NEWLINE); return CMD_WARNING; } return CMD_SUCCESS; -} +} /* Configuration write function. */ diff --git a/lib/keychain.c b/lib/keychain.c index 0796d81f1..c2d6e4571 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -237,9 +237,10 @@ DEFUN (key_chain, "Key-chain management\n" "Key-chain name\n") { + int idx_word = 2; struct keychain *keychain; - keychain = keychain_get (argv[2]->arg); + keychain = keychain_get (argv[idx_word]->arg); vty->index = keychain; vty->node = KEYCHAIN_NODE; @@ -254,13 +255,14 @@ DEFUN (no_key_chain, "Key-chain management\n" "Key-chain name\n") { + int idx_word = 3; struct keychain *keychain; - keychain = keychain_lookup (argv[3]->arg); + keychain = keychain_lookup (argv[idx_word]->arg); if (! keychain) { - vty_out (vty, "Can't find keychain %s%s", argv[3]->arg, VTY_NEWLINE); + vty_out (vty, "Can't find keychain %s%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -275,13 +277,14 @@ DEFUN (key, "Configure a key\n" "Key identifier number\n") { + int idx_number = 1; struct keychain *keychain; struct key *key; u_int32_t index; keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[1]->arg); + VTY_GET_INTEGER ("key identifier", index, argv[idx_number]->arg); key = key_get (keychain, index); vty->index_sub = key; vty->node = KEYCHAIN_KEY_NODE; @@ -296,13 +299,14 @@ DEFUN (no_key, "Delete a key\n" "Key identifier number\n") { + int idx_number = 2; struct keychain *keychain; struct key *key; u_int32_t index; keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[2]->arg); + VTY_GET_INTEGER ("key identifier", index, argv[idx_number]->arg); key = key_lookup (keychain, index); if (! key) { @@ -323,13 +327,14 @@ DEFUN (key_string, "Set key string\n" "The key\n") { + int idx_line = 1; struct key *key; key = vty->index_sub; if (key->string) XFREE(MTYPE_KEY, key->string); - key->string = XSTRDUP(MTYPE_KEY, argv[1]->arg); + key->string = XSTRDUP(MTYPE_KEY, argv[idx_line]->arg); return CMD_SUCCESS; } @@ -552,12 +557,20 @@ DEFUN (accept_lifetime_day_month_day_month, "Month of the year to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_day_month_month_day, @@ -573,12 +586,20 @@ DEFUN (accept_lifetime_day_month_month_day, "Day of th month to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_month_day_day_month, @@ -594,12 +615,20 @@ DEFUN (accept_lifetime_month_day_day_month, "Month of the year to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, argv[2]->arg, - argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_month_day_month_day, @@ -615,12 +644,20 @@ DEFUN (accept_lifetime_month_day_month_day, "Day of th month to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, argv[2]->arg, - argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_infinite_day_month, @@ -633,12 +670,16 @@ DEFUN (accept_lifetime_infinite_day_month, "Year to start\n" "Never expires") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; struct key *key; key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg); + return key_lifetime_infinite_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg); } DEFUN (accept_lifetime_infinite_month_day, @@ -651,12 +692,16 @@ DEFUN (accept_lifetime_infinite_month_day, "Year to start\n" "Never expires") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; struct key *key; key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, - argv[2]->arg, argv[4]->arg); + return key_lifetime_infinite_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg); } DEFUN (accept_lifetime_duration_day_month, @@ -670,12 +715,17 @@ DEFUN (accept_lifetime_duration_day_month, "Duration of the key\n" "Duration seconds\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; struct key *key; key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, argv[6]->arg); + return key_lifetime_duration_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (accept_lifetime_duration_month_day, @@ -689,12 +739,17 @@ DEFUN (accept_lifetime_duration_month_day, "Duration of the key\n" "Duration seconds\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; struct key *key; key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, - argv[2]->arg, argv[4]->arg, argv[6]->arg); + return key_lifetime_duration_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (send_lifetime_day_month_day_month, @@ -710,12 +765,20 @@ DEFUN (send_lifetime_day_month_day_month, "Month of the year to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, - argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_day_month_month_day, @@ -731,12 +794,20 @@ DEFUN (send_lifetime_day_month_month_day, "Day of th month to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, - argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_month_day_day_month, @@ -752,12 +823,20 @@ DEFUN (send_lifetime_month_day_day_month, "Month of the year to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, argv[4]->arg, - argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_month_day_month_day, @@ -773,12 +852,20 @@ DEFUN (send_lifetime_month_day_month_day, "Day of th month to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, argv[4]->arg, - argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_infinite_day_month, @@ -791,12 +878,16 @@ DEFUN (send_lifetime_infinite_day_month, "Year to start\n" "Never expires") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; struct key *key; key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg); + return key_lifetime_infinite_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg); } DEFUN (send_lifetime_infinite_month_day, @@ -809,12 +900,16 @@ DEFUN (send_lifetime_infinite_month_day, "Year to start\n" "Never expires") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; struct key *key; key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, - argv[4]->arg); + return key_lifetime_infinite_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg); } DEFUN (send_lifetime_duration_day_month, @@ -828,12 +923,17 @@ DEFUN (send_lifetime_duration_day_month, "Duration of the key\n" "Duration seconds\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; struct key *key; key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg, argv[6]->arg); + return key_lifetime_duration_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (send_lifetime_duration_month_day, @@ -847,12 +947,17 @@ DEFUN (send_lifetime_duration_month_day, "Duration of the key\n" "Duration seconds\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; struct key *key; key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, - argv[4]->arg, argv[6]->arg); + return key_lifetime_duration_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_number_3]->arg); } static struct cmd_node keychain_node = @@ -557,14 +557,16 @@ DEFUN (ns_netns, "The Name Space\n" "The file name in " NS_RUN_DIR ", or a full pathname\n") { + int idx_number = 1; + int idx_name = 3; ns_id_t ns_id = NS_DEFAULT; struct ns *ns = NULL; - char *pathname = ns_netns_pathname (vty, argv[3]->arg); + char *pathname = ns_netns_pathname (vty, argv[idx_name]->arg); if (!pathname) return CMD_WARNING; - VTY_GET_INTEGER ("NS ID", ns_id, argv[1]->arg); + VTY_GET_INTEGER ("NS ID", ns_id, argv[idx_number]->arg); ns = ns_get (ns_id); if (ns->name && strcmp (ns->name, pathname) != 0) @@ -596,14 +598,16 @@ DEFUN (no_ns_netns, "The Name Space\n" "The file name in " NS_RUN_DIR ", or a full pathname\n") { + int idx_number = 2; + int idx_name = 4; ns_id_t ns_id = NS_DEFAULT; struct ns *ns = NULL; - char *pathname = ns_netns_pathname (vty, argv[4]->arg); + char *pathname = ns_netns_pathname (vty, argv[idx_name]->arg); if (!pathname) return CMD_WARNING; - VTY_GET_INTEGER ("NS ID", ns_id, argv[2]->arg); + VTY_GET_INTEGER ("NS ID", ns_id, argv[idx_number]->arg); ns = ns_lookup (ns_id); if (!ns) diff --git a/lib/plist.c b/lib/plist.c index 164bc1d7e..538660597 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1415,8 +1415,11 @@ DEFUN (ip_prefix_list, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, - argv[3]->arg, argv[4]->arg, NULL, NULL); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_any = 4; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, + argv[idx_permit_deny]->arg, argv[idx_ipv4_any]->arg, NULL, NULL); } DEFUN (ip_prefix_list_ge, @@ -1431,8 +1434,12 @@ DEFUN (ip_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[6]->arg, NULL); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + int idx_number = 6; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, NULL); } DEFUN (ip_prefix_list_ge_le, @@ -1449,8 +1456,13 @@ DEFUN (ip_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[6]->arg, argv[8]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + int idx_number = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); } DEFUN (ip_prefix_list_le, @@ -1465,8 +1477,12 @@ DEFUN (ip_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, NULL, argv[6]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + int idx_number = 6; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number]->arg); } DEFUN (ip_prefix_list_le_ge, @@ -1483,8 +1499,13 @@ DEFUN (ip_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[8]->arg, argv[6]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + int idx_number = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); } DEFUN (ip_prefix_list_seq, @@ -1500,8 +1521,12 @@ DEFUN (ip_prefix_list_seq, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, NULL, NULL); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv4_any = 6; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_any]->arg, NULL, NULL); } DEFUN (ip_prefix_list_seq_ge, @@ -1518,8 +1543,13 @@ DEFUN (ip_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[8]->arg, NULL); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv4_prefixlen = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (ip_prefix_list_seq_ge_le, @@ -1538,8 +1568,14 @@ DEFUN (ip_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[8]->arg, argv[10]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv4_prefixlen = 6; + int idx_number_2 = 8; + int idx_number_3 = 10; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (ip_prefix_list_seq_le, @@ -1556,8 +1592,13 @@ DEFUN (ip_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, NULL, argv[8]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv4_prefixlen = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number_2]->arg); } DEFUN (ip_prefix_list_seq_le_ge, @@ -1576,8 +1617,14 @@ DEFUN (ip_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[10]->arg, argv[8]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv4_prefixlen = 6; + int idx_number_2 = 8; + int idx_number_3 = 10; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); } DEFUN (no_ip_prefix_list, @@ -1588,7 +1635,8 @@ DEFUN (no_ip_prefix_list, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, NULL, + int idx_word = 3; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -1604,8 +1652,11 @@ DEFUN (no_ip_prefix_list_prefix, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, NULL, NULL); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv4_any = 5; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_any]->arg, NULL, NULL); } DEFUN (no_ip_prefix_list_ge, @@ -1621,8 +1672,12 @@ DEFUN (no_ip_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[7]->arg, NULL); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv4_prefixlen = 5; + int idx_number = 7; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, NULL); } DEFUN (no_ip_prefix_list_ge_le, @@ -1640,8 +1695,13 @@ DEFUN (no_ip_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[7]->arg, argv[9]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv4_prefixlen = 5; + int idx_number = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); } DEFUN (no_ip_prefix_list_le, @@ -1657,8 +1717,12 @@ DEFUN (no_ip_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, NULL, argv[7]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv4_prefixlen = 5; + int idx_number = 7; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number]->arg); } DEFUN (no_ip_prefix_list_le_ge, @@ -1676,8 +1740,13 @@ DEFUN (no_ip_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[9]->arg, argv[7]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv4_prefixlen = 5; + int idx_number = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); } DEFUN (no_ip_prefix_list_seq, @@ -1694,8 +1763,12 @@ DEFUN (no_ip_prefix_list_seq, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, NULL, NULL); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv4_any = 7; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_any]->arg, NULL, NULL); } DEFUN (no_ip_prefix_list_seq_ge, @@ -1713,8 +1786,13 @@ DEFUN (no_ip_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[9]->arg, NULL); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv4_prefixlen = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (no_ip_prefix_list_seq_ge_le, @@ -1734,8 +1812,14 @@ DEFUN (no_ip_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[9]->arg, argv[11]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv4_prefixlen = 7; + int idx_number_2 = 9; + int idx_number_3 = 11; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (no_ip_prefix_list_seq_le, @@ -1753,8 +1837,13 @@ DEFUN (no_ip_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, NULL, argv[9]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv4_prefixlen = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number_2]->arg); } DEFUN (no_ip_prefix_list_seq_le_ge, @@ -1774,8 +1863,14 @@ DEFUN (no_ip_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[11]->arg, argv[9]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv4_prefixlen = 7; + int idx_number_2 = 9; + int idx_number_3 = 11; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); } DEFUN (ip_prefix_list_sequence_number, @@ -1810,9 +1905,10 @@ DEFUN (ip_prefix_list_description, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { + int idx_word = 2; struct prefix_list *plist; - plist = prefix_list_get (AFI_IP, 0, argv[2]->arg); + plist = prefix_list_get (AFI_IP, 0, argv[idx_word]->arg); if (plist->desc) { @@ -1822,7 +1918,7 @@ DEFUN (ip_prefix_list_description, plist->desc = argv_concat(argv, argc, 1); return CMD_SUCCESS; -} +} /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN @@ -1844,7 +1940,8 @@ DEFUN (no_ip_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n") { - return vty_prefix_list_desc_unset (vty, AFI_IP, argv[3]->arg); + int idx_word = 3; + return vty_prefix_list_desc_unset (vty, AFI_IP, argv[idx_word]->arg); } @@ -1866,7 +1963,8 @@ DEFUN (show_ip_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[3]->arg, NULL, normal_display); + int idx_word = 3; + return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, normal_display); } DEFUN (show_ip_prefix_list_name_seq, @@ -1879,7 +1977,9 @@ DEFUN (show_ip_prefix_list_name_seq, "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[3]->arg, argv[5]->arg, sequential_display); + int idx_word = 3; + int idx_number = 5; + return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, sequential_display); } DEFUN (show_ip_prefix_list_prefix, @@ -1891,7 +1991,9 @@ DEFUN (show_ip_prefix_list_prefix, "Name of a prefix list\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[3]->arg, argv[4]->arg, normal_display); + int idx_word = 3; + int idx_ipv4_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, normal_display); } DEFUN (show_ip_prefix_list_prefix_longer, @@ -1904,7 +2006,9 @@ DEFUN (show_ip_prefix_list_prefix_longer, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[3]->arg, argv[4]->arg, longer_display); + int idx_word = 3; + int idx_ipv4_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, longer_display); } DEFUN (show_ip_prefix_list_prefix_first_match, @@ -1917,7 +2021,9 @@ DEFUN (show_ip_prefix_list_prefix_first_match, "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[3]->arg, argv[4]->arg, first_match_display); + int idx_word = 3; + int idx_ipv4_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, first_match_display); } DEFUN (show_ip_prefix_list_summary, @@ -1940,7 +2046,8 @@ DEFUN (show_ip_prefix_list_summary_name, "Summary of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[4]->arg, NULL, summary_display); + int idx_word = 4; + return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, summary_display); } @@ -1964,7 +2071,8 @@ DEFUN (show_ip_prefix_list_detail_name, "Detail of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[4]->arg, NULL, detail_display); + int idx_word = 4; + return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, detail_display); } DEFUN (clear_ip_prefix_list, @@ -1985,7 +2093,8 @@ DEFUN (clear_ip_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_clear_prefix_list (vty, AFI_IP, argv[3]->arg, NULL); + int idx_word = 3; + return vty_clear_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL); } DEFUN (clear_ip_prefix_list_name_prefix, @@ -1997,7 +2106,9 @@ DEFUN (clear_ip_prefix_list_name_prefix, "Name of a prefix list\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") { - return vty_clear_prefix_list (vty, AFI_IP, argv[3]->arg, argv[4]->arg); + int idx_word = 3; + int idx_ipv4_prefixlen = 4; + return vty_clear_prefix_list (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg); } #ifdef HAVE_IPV6 @@ -2012,8 +2123,11 @@ DEFUN (ipv6_prefix_list, "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, - argv[3]->arg, argv[4]->arg, NULL, NULL); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_any = 4; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, + argv[idx_permit_deny]->arg, argv[idx_ipv6_any]->arg, NULL, NULL); } DEFUN (ipv6_prefix_list_ge, @@ -2028,8 +2142,12 @@ DEFUN (ipv6_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[6]->arg, NULL); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + int idx_number = 6; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, NULL); } DEFUN (ipv6_prefix_list_ge_le, @@ -2047,8 +2165,13 @@ DEFUN (ipv6_prefix_list_ge_le, "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[6]->arg, argv[8]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + int idx_number = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); } DEFUN (ipv6_prefix_list_le, @@ -2063,8 +2186,12 @@ DEFUN (ipv6_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, NULL, argv[6]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + int idx_number = 6; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number]->arg); } DEFUN (ipv6_prefix_list_le_ge, @@ -2081,8 +2208,13 @@ DEFUN (ipv6_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[8]->arg, argv[6]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + int idx_number = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); } DEFUN (ipv6_prefix_list_seq, @@ -2098,8 +2230,12 @@ DEFUN (ipv6_prefix_list_seq, "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, NULL, NULL); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv6_any = 6; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_any]->arg, NULL, NULL); } DEFUN (ipv6_prefix_list_seq_ge, @@ -2116,8 +2252,13 @@ DEFUN (ipv6_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[8]->arg, NULL); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv6_prefixlen = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (ipv6_prefix_list_seq_ge_le, @@ -2136,8 +2277,14 @@ DEFUN (ipv6_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[8]->arg, argv[10]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv6_prefixlen = 6; + int idx_number_2 = 8; + int idx_number_3 = 10; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (ipv6_prefix_list_seq_le, @@ -2154,8 +2301,13 @@ DEFUN (ipv6_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, NULL, argv[8]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv6_prefixlen = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number_2]->arg); } DEFUN (ipv6_prefix_list_seq_le_ge, @@ -2174,8 +2326,14 @@ DEFUN (ipv6_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[10]->arg, argv[8]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv6_prefixlen = 6; + int idx_number_2 = 8; + int idx_number_3 = 10; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); } DEFUN (no_ipv6_prefix_list, @@ -2186,7 +2344,8 @@ DEFUN (no_ipv6_prefix_list, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, NULL, + int idx_word = 3; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -2202,8 +2361,11 @@ DEFUN (no_ipv6_prefix_list_prefix, "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, NULL, NULL); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_any = 5; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_any]->arg, NULL, NULL); } DEFUN (no_ipv6_prefix_list_ge, @@ -2219,8 +2381,12 @@ DEFUN (no_ipv6_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[7]->arg, NULL); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + int idx_number = 7; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, NULL); } DEFUN (no_ipv6_prefix_list_ge_le, @@ -2238,8 +2404,13 @@ DEFUN (no_ipv6_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[7]->arg, argv[9]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + int idx_number = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); } DEFUN (no_ipv6_prefix_list_le, @@ -2255,8 +2426,12 @@ DEFUN (no_ipv6_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, NULL, argv[7]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + int idx_number = 7; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number]->arg); } DEFUN (no_ipv6_prefix_list_le_ge, @@ -2274,8 +2449,13 @@ DEFUN (no_ipv6_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[9]->arg, argv[7]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + int idx_number = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); } DEFUN (no_ipv6_prefix_list_seq, @@ -2292,8 +2472,12 @@ DEFUN (no_ipv6_prefix_list_seq, "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, NULL, NULL); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv6_any = 7; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_any]->arg, NULL, NULL); } DEFUN (no_ipv6_prefix_list_seq_ge, @@ -2311,8 +2495,13 @@ DEFUN (no_ipv6_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[9]->arg, NULL); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv6_prefixlen = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (no_ipv6_prefix_list_seq_ge_le, @@ -2332,8 +2521,14 @@ DEFUN (no_ipv6_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[9]->arg, argv[11]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv6_prefixlen = 7; + int idx_number_2 = 9; + int idx_number_3 = 11; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (no_ipv6_prefix_list_seq_le, @@ -2351,8 +2546,13 @@ DEFUN (no_ipv6_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, NULL, argv[9]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv6_prefixlen = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number_2]->arg); } DEFUN (no_ipv6_prefix_list_seq_le_ge, @@ -2372,8 +2572,14 @@ DEFUN (no_ipv6_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[11]->arg, argv[9]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv6_prefixlen = 7; + int idx_number_2 = 9; + int idx_number_3 = 11; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); } DEFUN (ipv6_prefix_list_sequence_number, @@ -2408,9 +2614,10 @@ DEFUN (ipv6_prefix_list_description, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { + int idx_word = 2; struct prefix_list *plist; - plist = prefix_list_get (AFI_IP6, 0, argv[2]->arg); + plist = prefix_list_get (AFI_IP6, 0, argv[idx_word]->arg); if (plist->desc) { @@ -2420,7 +2627,7 @@ DEFUN (ipv6_prefix_list_description, plist->desc = argv_concat(argv, argc, 1); return CMD_SUCCESS; -} +} /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN @@ -2442,7 +2649,8 @@ DEFUN (no_ipv6_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n") { - return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[3]->arg); + int idx_word = 3; + return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[idx_word]->arg); } @@ -2464,7 +2672,8 @@ DEFUN (show_ipv6_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[3]->arg, NULL, normal_display); + int idx_word = 3; + return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, normal_display); } DEFUN (show_ipv6_prefix_list_name_seq, @@ -2477,7 +2686,9 @@ DEFUN (show_ipv6_prefix_list_name_seq, "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, sequential_display); + int idx_word = 3; + int idx_number = 5; + return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, sequential_display); } DEFUN (show_ipv6_prefix_list_prefix, @@ -2489,7 +2700,9 @@ DEFUN (show_ipv6_prefix_list_prefix, "Name of a prefix list\n" "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[3]->arg, argv[4]->arg, normal_display); + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, normal_display); } DEFUN (show_ipv6_prefix_list_prefix_longer, @@ -2502,7 +2715,9 @@ DEFUN (show_ipv6_prefix_list_prefix_longer, "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[3]->arg, argv[4]->arg, longer_display); + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, longer_display); } DEFUN (show_ipv6_prefix_list_prefix_first_match, @@ -2515,7 +2730,9 @@ DEFUN (show_ipv6_prefix_list_prefix_first_match, "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[3]->arg, argv[4]->arg, first_match_display); + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, first_match_display); } DEFUN (show_ipv6_prefix_list_summary, @@ -2538,7 +2755,8 @@ DEFUN (show_ipv6_prefix_list_summary_name, "Summary of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[4]->arg, NULL, summary_display); + int idx_word = 4; + return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, summary_display); } DEFUN (show_ipv6_prefix_list_detail, @@ -2561,7 +2779,8 @@ DEFUN (show_ipv6_prefix_list_detail_name, "Detail of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[4]->arg, NULL, detail_display); + int idx_word = 4; + return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, detail_display); } DEFUN (clear_ipv6_prefix_list, @@ -2582,7 +2801,8 @@ DEFUN (clear_ipv6_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_clear_prefix_list (vty, AFI_IP6, argv[3]->arg, NULL); + int idx_word = 3; + return vty_clear_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL); } DEFUN (clear_ipv6_prefix_list_name_prefix, @@ -2594,7 +2814,9 @@ DEFUN (clear_ipv6_prefix_list_name_prefix, "Name of a prefix list\n" "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") { - return vty_clear_prefix_list (vty, AFI_IP6, argv[3]->arg, argv[4]->arg); + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + return vty_clear_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg); } #endif /* HAVE_IPV6 */ diff --git a/lib/routemap.c b/lib/routemap.c index 88cdf97e5..7ad75b415 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1406,12 +1406,15 @@ DEFUN (route_map, "Route map permits set operations\n" "Sequence to insert to/delete from existing route-map entry\n") { + int idx_word = 1; + int idx_permit_deny = 2; + int idx_number = 3; struct route_map *map; struct route_map_index *index; char *endptr = NULL; - int permit = argv[2]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY; - unsigned long pref = strtoul (argv[3]->arg, &endptr, 10); - const char *mapname = argv[1]->arg; + int permit = argv[idx_permit_deny]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY; + unsigned long pref = strtoul (argv[idx_number]->arg, &endptr, 10); + const char *mapname = argv[idx_word]->arg; /* Get route map. */ map = route_map_get (mapname); @@ -1429,7 +1432,8 @@ DEFUN (no_route_map_all, "Create route-map or enter route-map command mode\n" "Route map tag\n") { - const char *mapname = argv[2]->arg; + int idx_word = 2; + const char *mapname = argv[idx_word]->arg; struct route_map *map; map = route_map_lookup_by_name (mapname); @@ -1454,12 +1458,15 @@ DEFUN (no_route_map, "Route map permits set operations\n" "Sequence to insert to/delete from existing route-map entry\n") { + int idx_word = 2; + int idx_permit_deny = 3; + int idx_number = 4; struct route_map *map; struct route_map_index *index; char *endptr = NULL; - int permit = argv[3]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY; - const char *prefstr = argv[4]->arg; - const char *mapname = argv[2]->arg; + int permit = argv[idx_permit_deny]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY; + const char *prefstr = argv[idx_number]->arg; + const char *mapname = argv[idx_word]->arg; unsigned long pref = strtoul (prefstr, &endptr, 10); /* Existence check. */ @@ -1537,11 +1544,12 @@ DEFUN (rmap_onmatch_goto, "Goto Clause number\n" "Number\n") { + int idx_number = 2; char *num = NULL; if (!strcmp (argv[0]->text, "continue")) num = argv[1]->arg; else - num = argv[2]->arg; + num = argv[idx_number]->arg; struct route_map_index *index = vty->index; int d = 0; @@ -1623,7 +1631,8 @@ DEFUN (rmap_show_name, "route-map information\n" "route-map name\n") { - const char *name = (argc == 3) ? argv[2]->arg : NULL; + int idx_word = 2; + const char *name = (argc == 3) ? argv[idx_word]->arg : NULL; return vty_show_route_map (vty, name); } @@ -1633,8 +1642,9 @@ DEFUN (rmap_call, "Jump to another Route-Map after match+set\n" "Target route-map name\n") { + int idx_word = 1; struct route_map_index *index; - const char *rmap = argv[1]->arg; + const char *rmap = argv[idx_word]->arg; index = vty->index; if (index) diff --git a/lib/smux.c b/lib/smux.c index 572722724..82bf64f1c 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -1370,7 +1370,8 @@ DEFUN (smux_peer, "SNMP MUX peer settings\n" "Object ID used in SMUX peering\n") { - if (smux_peer_oid (vty, argv[2]->arg, NULL) == 0) + int idx_oid = 2; + if (smux_peer_oid (vty, argv[idx_oid]->arg, NULL) == 0) { smux_start(); return CMD_SUCCESS; @@ -1387,7 +1388,8 @@ DEFUN (smux_peer_password, "SMUX peering object ID\n" "SMUX peering password\n") { - if (smux_peer_oid (vty, argv[2]->arg, argv[3]->rg) == 0) + int idx_oid = 2; + if (smux_peer_oid (vty, argv[idx_oid]->arg, argv[3]->rg) == 0) { smux_start(); return CMD_SUCCESS; diff --git a/lib/thread.c b/lib/thread.c index ba9a0ea2a..76acd0778 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -299,15 +299,16 @@ DEFUN (show_thread_cpu, "Thread CPU usage\n" "Display filter (rwtexb)\n") { + int idx_filter = 3; int i = 0; thread_type filter = (thread_type) -1U; if (argc > 3) { filter = 0; - while (argv[3]->arg[i] != '\0') + while (argv[idx_filter]->arg[i] != '\0') { - switch ( argv[3]->arg[i] ) + switch ( argv[idx_filter]->arg[i] ) { case 'r': case 'R': @@ -342,7 +343,7 @@ DEFUN (show_thread_cpu, { vty_out(vty, "Invalid filter \"%s\" specified," " must contain at least one of 'RWTEXB'%s", - argv[3]->arg, VTY_NEWLINE); + argv[idx_filter]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -381,15 +382,16 @@ DEFUN (clear_thread_cpu, "Thread CPU usage\n" "Display filter (rwtexb)\n") { + int idx_filter = 3; int i = 0; thread_type filter = (thread_type) -1U; if (argc > 3) { filter = 0; - while (argv[3]->arg[i] != '\0') + while (argv[idx_filter]->arg[i] != '\0') { - switch ( argv[3]->arg[i] ) + switch ( argv[idx_filter]->arg[i] ) { case 'r': case 'R': @@ -424,7 +426,7 @@ DEFUN (clear_thread_cpu, { vty_out(vty, "Invalid filter \"%s\" specified," " must contain at least one of 'RWTEXB'%s", - argv[3]->arg, VTY_NEWLINE); + argv[idx_filter]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -2748,7 +2748,8 @@ DEFUN (exec_timeout_min, "Set timeout value\n" "Timeout value in minutes\n") { - return exec_timeout (vty, argv[1]->arg, NULL); + int idx_number = 1; + return exec_timeout (vty, argv[idx_number]->arg, NULL); } DEFUN (exec_timeout_sec, @@ -2758,7 +2759,9 @@ DEFUN (exec_timeout_sec, "Timeout in minutes\n" "Timeout in seconds\n") { - return exec_timeout (vty, argv[1]->arg, argv[2]->arg); + int idx_number = 1; + int idx_number_2 = 2; + return exec_timeout (vty, argv[idx_number]->arg, argv[idx_number_2]->arg); } DEFUN (no_exec_timeout, @@ -2777,10 +2780,11 @@ DEFUN (vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { + int idx_word = 1; if (vty_accesslist_name) XFREE(MTYPE_VTY, vty_accesslist_name); - vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[1]->arg); + vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -2793,7 +2797,8 @@ DEFUN (no_vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { - const char *accesslist = (argc == 3) ? argv[2]->arg : NULL; + int idx_word = 2; + const char *accesslist = (argc == 3) ? argv[idx_word]->arg : NULL; if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, accesslist))) { vty_out (vty, "Access-class is not currently applied to vty%s", @@ -2817,10 +2822,11 @@ DEFUN (vty_ipv6_access_class, "Filter connections based on an IP access list\n" "IPv6 access list\n") { + int idx_word = 2; if (vty_ipv6_accesslist_name) XFREE(MTYPE_VTY, vty_ipv6_accesslist_name); - vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[2]->arg); + vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -2834,7 +2840,8 @@ DEFUN (no_vty_ipv6_access_class, "Filter connections based on an IP access list\n" "IPv6 access list\n") { - const char *accesslist = (argc == 4) ? argv[3]->arg : NULL; + int idx_word = 3; + const char *accesslist = (argc == 4) ? argv[idx_word]->arg : NULL; if (! vty_ipv6_accesslist_name || (argc && strcmp(vty_ipv6_accesslist_name, accesslist))) diff --git a/tools/argv_translator.py b/tools/argv_translator.py index b637cf69f..7998baaee 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -394,6 +394,25 @@ def get_token_index_variable_name(line_number, token): elif token == 'nocache|wrongvif|wholepkt': return 'idx_type' + elif token == 'file|memory|terminal': + return 'idx_type' + + elif token == 'prefix': + return 'idx_prefix' + + elif token == 'A.B.C.D/M|any': + return 'idx_ipv4_any' + + elif token == 'X:X::X:X/M|any': + return 'idx_ipv6_any' + + elif token == '(1-99)|(1300-1999)' or token == '(100-199)|(2000-2699)' or token == '(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD': + return 'idx_acl' + + elif token == 'kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7': + return 'idx_target' + + elif token in ('kernel|connected|static|rip|ospf|isis|pim|table', 'kernel|connected|static|ripng|ospf6|isis|table', 'kernel|connected|static|rip|isis|bgp|pim|table', @@ -406,6 +425,8 @@ def get_token_index_variable_name(line_number, token): 'kernel|connected|static|ospf|isis|bgp|pim|table', 'kernel|connected|static|ripng|isis|bgp|table', # '', + 'zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd|pimd', + 'zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd', 'bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static', 'kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table'): return 'idx_protocol' |