"router-id for the OSPF process\n"
"OSPF router-id in IP address format\n")
{
+ int idx_ipv4 = 2;
struct ospf *ospf = vty->index;
struct listnode *node;
struct ospf_area *area;
if (!ospf)
return CMD_SUCCESS;
- ret = inet_aton (argv[2]->arg, &router_id);
+ ret = inet_aton (argv[idx_ipv4]->arg, &router_id);
if (!ret)
{
vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE);
"Suppress routing updates on an interface\n"
"Interface's name\n")
{
+ int idx_ipv4 = 2;
struct interface *ifp;
struct in_addr addr = { .s_addr = INADDR_ANY };
int ret;
return CMD_SUCCESS;
}
- ifp = if_get_by_name (argv[2]->arg);
+ ifp = if_get_by_name (argv[idx_ipv4]->arg);
params = IF_DEF_PARAMS (ifp);
"Allow routing updates on an interface\n"
"Interface's name\n")
{
+ int idx_ipv4 = 3;
struct interface *ifp;
struct in_addr addr = { .s_addr = INADDR_ANY };
struct ospf_if_params *params;
return CMD_SUCCESS;
}
- ifp = if_get_by_name (argv[3]->arg);
+ ifp = if_get_by_name (argv[idx_ipv4]->arg);
params = IF_DEF_PARAMS (ifp);
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n")
{
+ int idx_ipv4_prefixlen = 1;
+ int idx_ipv4_number = 3;
struct ospf *ospf= vty->index;
struct prefix_ipv4 p;
struct in_addr area_id;
}
/* Get network prefix and Area ID. */
- VTY_GET_IPV4_PREFIX ("network prefix", p, argv[1]->arg);
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[3]->arg);
+ VTY_GET_IPV4_PREFIX ("network prefix", p, argv[idx_ipv4_prefixlen]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
ret = ospf_network_set (ospf, &p, area_id);
if (ret == 0)
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n")
{
+ int idx_ipv4_prefixlen = 2;
+ int idx_ipv4_number = 4;
struct ospf *ospf = (struct ospf *) vty->index;
struct prefix_ipv4 p;
struct in_addr area_id;
}
/* Get network prefix and Area ID. */
- VTY_GET_IPV4_PREFIX ("network prefix", p, argv[2]->arg);
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[4]->arg);
+ VTY_GET_IPV4_PREFIX ("network prefix", p, argv[idx_ipv4_prefixlen]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
ret = ospf_network_unset (ospf, &p, area_id);
if (ret == 0)
"Summarize routes matching address/mask (border routers only)\n"
"Area range prefix\n")
{
+ int idx_ipv4_number = 1;
+ int idx_ipv4_prefixlen = 3;
struct ospf *ospf = vty->index;
struct prefix_ipv4 p;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE);
if (argc > 2)
"Area range prefix\n"
"DoNotAdvertise this range\n")
{
+ int idx_ipv4_number = 1;
+ int idx_ipv4_prefixlen = 3;
struct ospf *ospf = vty->index;
struct prefix_ipv4 p;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
ospf_area_range_set (ospf, area_id, &p, 0);
"Summarize routes matching address/mask (border routers only)\n"
"Area range prefix\n")
{
+ int idx_ipv4_number = 2;
+ int idx_ipv4_prefixlen = 4;
struct ospf *ospf = vty->index;
struct prefix_ipv4 p;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[4]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
ospf_area_range_unset (ospf, area_id, &p);
"Announce area range as another prefix\n"
"Network prefix to be announced instead of range\n")
{
+ int idx_ipv4_number = 1;
+ int idx_ipv4_prefixlen = 3;
+ int idx_ipv4_prefixlen_2 = 5;
struct ospf *ospf = vty->index;
struct prefix_ipv4 p, s;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- 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);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
+ VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[idx_ipv4_prefixlen_2]->arg);
ospf_area_range_substitute_set (ospf, area_id, &p, &s);
"Announce area range as another prefix\n"
"Network prefix to be announced instead of range\n")
{
+ int idx_ipv4_number = 2;
+ int idx_ipv4_prefixlen = 4;
+ int idx_ipv4_prefixlen_2 = 6;
struct ospf *ospf = vty->index;
struct prefix_ipv4 p, s;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- 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);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
+ VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[idx_ipv4_prefixlen_2]->arg);
ospf_area_range_substitute_unset (ospf, area_id, &p);
"area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D",
VLINK_HELPSTR_IPADDR)
{
+ int idx_ipv4_number = 1;
+ int idx_ipv4 = 3;
struct ospf *ospf = vty->index;
struct ospf_vl_config_data vl_config;
char auth_key[OSPF_AUTH_SIMPLE_SIZE+1];
ospf_vl_config_data_init(&vl_config, vty);
/* Read off first 2 parameters and check them */
- ret = ospf_str2area_id (argv[1]->arg, &vl_config.area_id, &vl_config.format);
+ ret = ospf_str2area_id (argv[idx_ipv4_number]->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[3]->arg, &vl_config.vl_peer);
+ ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer);
if (! ret)
{
vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
NO_STR
VLINK_HELPSTR_IPADDR)
{
+ int idx_ipv4_number = 2;
+ int idx_ipv4 = 4;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct ospf_vl_config_data vl_config;
ospf_vl_config_data_init(&vl_config, vty);
- ret = ospf_str2area_id (argv[2]->arg, &vl_config.area_id, &format);
+ ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format);
if (ret < 0)
{
vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
return CMD_WARNING;
}
- ret = inet_aton (argv[4]->arg, &vl_config.vl_peer);
+ ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer);
if (! ret)
{
vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
"Enable shortcutting through the area\n"
"Disable shortcutting through the area\n")
{
+ int idx_ipv4_number = 1;
+ int idx_enable_disable = 3;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
- if (strncmp (argv[3]->arg, "de", 2) == 0)
+ if (strncmp (argv[idx_enable_disable]->arg, "de", 2) == 0)
mode = OSPF_SHORTCUT_DEFAULT;
- else if (strncmp (argv[3]->arg, "di", 2) == 0)
+ else if (strncmp (argv[idx_enable_disable]->arg, "di", 2) == 0)
mode = OSPF_SHORTCUT_DISABLE;
- else if (strncmp (argv[3]->arg, "e", 1) == 0)
+ else if (strncmp (argv[idx_enable_disable]->arg, "e", 1) == 0)
mode = OSPF_SHORTCUT_ENABLE;
else
return CMD_WARNING;
"Deconfigure enabled shortcutting through the area\n"
"Deconfigure disabled shortcutting through the area\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (!area)
"OSPF area ID as a decimal value\n"
"Configure OSPF area as stub\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct in_addr area_id;
int ret, format;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg);
ret = ospf_area_stub_set (ospf, area_id);
if (ret == 0)
"Configure OSPF area as stub\n"
"Do not inject inter-area routes into stub\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct in_addr area_id;
int ret, format;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg);
ret = ospf_area_stub_set (ospf, area_id);
if (ret == 0)
"OSPF area ID as a decimal value\n"
"Configure OSPF area as stub\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct in_addr area_id;
int format;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg);
ospf_area_stub_unset (ospf, area_id);
ospf_area_no_summary_unset (ospf, area_id);
"Configure OSPF area as stub\n"
"Do not inject inter-area routes into area\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct in_addr area_id;
int format;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg);
ospf_area_no_summary_unset (ospf, area_id);
return CMD_SUCCESS;
"OSPF area ID as a decimal value\n"
"Configure OSPF area as nssa\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct in_addr area_id;
int format;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[idx_ipv4_number]->arg);
ospf_area_nssa_unset (ospf, area_id);
ospf_area_no_summary_unset (ospf, area_id);
"Set the summary-default cost of a NSSA or stub area\n"
"Stub's advertised default summary cost\n")
{
+ int idx_ipv4_number = 1;
+ int idx_number = 3;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- 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);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[idx_number]->arg, 0, 16777215);
area = ospf_area_get (ospf, area_id, format);
"Set the summary-default cost of a NSSA or stub area\n"
"Stub's advertised default summary cost\n")
{
+ int idx_ipv4_number = 2;
+ int idx_number = 4;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- 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);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[idx_number]->arg, 0, OSPF_LS_INFINITY);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
"Set the filter for networks announced to other areas\n"
"Name of the access-list\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
ospf_area_export_list_set (ospf, area, argv[1]);
"Unset the filter for networks announced to other areas\n"
"Name of the access-list\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
"Set the filter for networks from other areas announced to the specified one\n"
"Name of the access-list\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
ospf_area_import_list_set (ospf, area, argv[1]);
"Unset the filter for networks announced to other areas\n"
"Name of the access-list\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
"Filter networks sent to this area\n"
"Filter networks sent from this area\n")
{
+ int idx_ipv4_number = 1;
+ int idx_word = 4;
+ int idx_in_out = 5;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
- plist = prefix_list_lookup (AFI_IP, argv[4]->arg);
- if (strncmp (argv[5]->arg, "in", 2) == 0)
+ plist = prefix_list_lookup (AFI_IP, argv[idx_word]->arg);
+ if (strncmp (argv[idx_in_out]->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[4]->arg);
+ PREFIX_NAME_IN (area) = strdup (argv[idx_word]->arg);
ospf_schedule_abr_task (ospf);
}
else
if (PREFIX_NAME_OUT (area))
free (PREFIX_NAME_OUT (area));
- PREFIX_NAME_OUT (area) = strdup (argv[4]->arg);
+ PREFIX_NAME_OUT (area) = strdup (argv[idx_word]->arg);
ospf_schedule_abr_task (ospf);
}
"Filter networks sent to this area\n"
"Filter networks sent from this area\n")
{
+ int idx_ipv4_number = 2;
+ int idx_word = 5;
+ int idx_in_out = 6;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL)
return CMD_SUCCESS;
- if (strncmp (argv[6]->arg, "in", 2) == 0)
+ if (strncmp (argv[idx_in_out]->arg, "in", 2) == 0)
{
if (PREFIX_NAME_IN (area))
- if (strcmp (PREFIX_NAME_IN (area), argv[5]->arg) != 0)
+ if (strcmp (PREFIX_NAME_IN (area), argv[idx_word]->arg) != 0)
return CMD_SUCCESS;
PREFIX_LIST_IN (area) = NULL;
else
{
if (PREFIX_NAME_OUT (area))
- if (strcmp (PREFIX_NAME_OUT (area), argv[5]->arg) != 0)
+ if (strcmp (PREFIX_NAME_OUT (area), argv[idx_word]->arg) != 0)
return CMD_SUCCESS;
PREFIX_LIST_OUT (area) = NULL;
"Enable authentication\n"
"Use message-digest authentication\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
"OSPF area ID as a decimal value\n"
"Enable authentication\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
area->auth_type = OSPF_AUTH_SIMPLE;
"OSPF area ID as a decimal value\n"
"Enable authentication\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
"Shortcut ABR\n"
"Standard behavior (RFC2328)\n")
{
+ int idx_vendor = 2;
struct ospf *ospf = vty->index;
u_char abr_type = OSPF_ABR_UNKNOWN;
if (!ospf)
return CMD_SUCCESS;
- if (strncmp (argv[2]->arg, "c", 1) == 0)
+ if (strncmp (argv[idx_vendor]->arg, "c", 1) == 0)
abr_type = OSPF_ABR_CISCO;
- else if (strncmp (argv[2]->arg, "i", 1) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "i", 1) == 0)
abr_type = OSPF_ABR_IBM;
- else if (strncmp (argv[2]->arg, "sh", 2) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "sh", 2) == 0)
abr_type = OSPF_ABR_SHORTCUT;
- else if (strncmp (argv[2]->arg, "st", 2) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "st", 2) == 0)
abr_type = OSPF_ABR_STAND;
else
return CMD_WARNING;
"Alternative ABR, IBM implementation\n"
"Shortcut ABR\n")
{
+ int idx_vendor = 3;
struct ospf *ospf = vty->index;
u_char abr_type = OSPF_ABR_UNKNOWN;
if (!ospf)
return CMD_SUCCESS;
- if (strncmp (argv[3]->arg, "c", 1) == 0)
+ if (strncmp (argv[idx_vendor]->arg, "c", 1) == 0)
abr_type = OSPF_ABR_CISCO;
- else if (strncmp (argv[3]->arg, "i", 1) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "i", 1) == 0)
abr_type = OSPF_ABR_IBM;
- else if (strncmp (argv[3]->arg, "sh", 2) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "sh", 2) == 0)
abr_type = OSPF_ABR_SHORTCUT;
- else if (strncmp (argv[3]->arg, "st", 2) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "st", 2) == 0)
abr_type = OSPF_ABR_STAND;
else
return CMD_WARNING;
"All LSA types\n"
"Delay (msec) between sending LSAs\n")
{
+ int idx_number = 4;
struct ospf *ospf = vty->index;
unsigned int interval;
return CMD_WARNING;
}
- VTY_GET_INTEGER ("LSA interval", interval, argv[4]->arg);
+ VTY_GET_INTEGER ("LSA interval", interval, argv[idx_number]->arg);
ospf->min_ls_interval = interval;
"OSPF minimum arrival interval delay\n"
"Delay (msec) between accepted LSAs\n")
{
+ int idx_number = 3;
struct ospf *ospf = vty->index;
unsigned int arrival;
return CMD_WARNING;
}
- VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[3]->arg, 0, 1000);
+ VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[idx_number]->arg, 0, 1000);
ospf->min_ls_arrival = arrival;
"Initial hold time (msec) between consecutive SPF calculations\n"
"Maximum hold time (msec)\n")
{
+ int idx_number = 3;
+ int idx_number_2 = 4;
+ int idx_number_3 = 5;
unsigned int delay, hold, max;
if (argc != 3)
return CMD_WARNING;
}
- 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);
+ VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[idx_number]->arg, 0, 600000);
+ VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[idx_number_2]->arg, 0, 600000);
+ VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[idx_number_3]->arg, 0, 600000);
return ospf_timers_spf_set (vty, delay, hold, max);
}
"Minimum delay in receiving new version of a LSA\n"
"Delay in milliseconds\n")
{
+ int idx_number = 3;
unsigned int minarrival;
struct ospf *ospf = vty->index;
return CMD_WARNING;
}
- VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[3]->arg);
+ VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[idx_number]->arg);
ospf->min_ls_arrival = minarrival;
NEIGHBOR_STR
"Neighbor IP address\n")
{
+ int idx_ipv4 = 1;
struct ospf *ospf = vty->index;
struct in_addr nbr_addr;
unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[1]->arg);
+ VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
if (argc > 1)
VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255);
"Dead Neighbor Polling interval\n"
"Seconds\n")
{
+ int idx_ipv4 = 1;
+ int idx_number = 3;
struct ospf *ospf = vty->index;
struct in_addr nbr_addr;
unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[1]->arg);
+ VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
if (argc > 1)
- VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[3]->arg, 1, 65535);
+ VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[idx_number]->arg, 1, 65535);
if (argc > 2)
VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255);
NEIGHBOR_STR
"Neighbor IP address\n")
{
+ int idx_ipv4 = 2;
struct ospf *ospf = vty->index;
struct in_addr nbr_addr;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[2]->arg);
+ VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
(void)ospf_nbr_nbma_unset (ospf, nbr_addr);
"Set refresh timer\n"
"Timer value in seconds\n")
{
+ int idx_number = 2;
struct ospf *ospf = vty->index;
unsigned int interval;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[2]->arg, 10, 1800);
+ VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[idx_number]->arg, 10, 1800);
interval = (interval / OSPF_LSA_REFRESHER_GRANULARITY) * OSPF_LSA_REFRESHER_GRANULARITY;
ospf_timers_refresh_set (ospf, interval);
"Unset refresh timer\n"
"Timer value in seconds\n")
{
+ int idx_number = 3;
struct ospf *ospf = vty->index;
unsigned int interval;
if (argc == 1)
{
- VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[3]->arg, 10, 1800);
+ VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[idx_number]->arg, 10, 1800);
if (ospf->lsa_refresh_interval != interval ||
interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
"Use reference bandwidth method to assign OSPF cost\n"
"The reference bandwidth in terms of Mbits per second\n")
{
+ int idx_number = 2;
struct ospf *ospf = vty->index;
u_int32_t refbw;
struct listnode *node;
if (!ospf)
return CMD_SUCCESS;
- refbw = strtol (argv[2]->arg, NULL, 10);
+ refbw = strtol (argv[idx_number]->arg, NULL, 10);
if (refbw < 1 || refbw > 4294967)
{
vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE);
"Write multiplier\n"
"Maximum number of interface serviced per write\n")
{
+ int idx_number = 2;
struct ospf *ospf = vty->index;
u_int32_t write_oi_count;
if (!ospf)
return CMD_SUCCESS;
- write_oi_count = strtol (argv[2]->arg, NULL, 10);
+ write_oi_count = strtol (argv[idx_number]->arg, NULL, 10);
if (write_oi_count < 1 || write_oi_count > 100)
{
vty_out (vty, "write-multiplier value is invalid%s", VTY_NEWLINE);
"Instance ID\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"Interface name\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"Neighbor list\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"include down status neighbor\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"Interface name\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"Neighbor ID\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"detail of all neighbors\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"include down status neighbor\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"detail of all neighbors\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"Instance ID\n"
"Database summary\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"Advertising Router link states\n"
"Advertising Router (as an IP address)\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"Use message-digest authentication\n"
"Address of interface")
{
+ int idx_encryption = 3;
+ int idx_ipv4 = 4;
struct interface *ifp;
struct in_addr addr;
int ret;
if (argc == 2)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
}
/* Handle null authentication */
- if ( argv[3]->arg[0] == 'n' )
+ if ( argv[idx_encryption]->arg[0] == 'n' )
{
SET_IF_PARAM (params, auth_type);
params->auth_type = OSPF_AUTH_NULL;
}
/* Handle message-digest authentication */
- if ( argv[3]->arg[0] == 'm' )
+ if ( argv[idx_encryption]->arg[0] == 'm' )
{
SET_IF_PARAM (params, auth_type);
params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
"Enable authentication on this interface\n"
"Address of interface")
{
+ int idx_ipv4 = 3;
struct interface *ifp;
struct in_addr addr;
int ret;
if (argc == 1)
{
- ret = inet_aton(argv[3]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Use message-digest authentication\n"
"Address of interface")
{
+ int idx_encryption = 4;
+ int idx_ipv4 = 5;
struct interface *ifp;
struct in_addr addr;
int ret;
if (argc == 2)
{
- ret = inet_aton(argv[5]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
}
else
{
- if ( argv[4]->arg[0] == 'n' )
+ if ( argv[idx_encryption]->arg[0] == 'n' )
{
auth_type = OSPF_AUTH_NULL;
}
- else if ( argv[4]->arg[0] == 'm' )
+ else if ( argv[idx_encryption]->arg[0] == 'm' )
{
auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
}
"Enable authentication on this interface\n"
"Address of interface")
{
+ int idx_ipv4 = 4;
struct interface *ifp;
struct in_addr addr;
int ret;
if (argc == 1)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"The OSPF password (key)\n"
"Address of interface")
{
+ int idx_ipv4 = 4;
struct interface *ifp;
struct in_addr addr;
int ret;
}
memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
- strncpy ((char *) params->auth_simple, argv[4]->arg, OSPF_AUTH_SIMPLE_SIZE);
+ strncpy ((char *) params->auth_simple, argv[idx_ipv4]->arg, OSPF_AUTH_SIMPLE_SIZE);
SET_IF_PARAM (params, auth_simple);
return CMD_SUCCESS;
"The OSPF password (key)"
"Address of interface")
{
+ int idx_number = 3;
+ int idx_ipv4 = 6;
struct interface *ifp;
struct crypt_key *ck;
u_char key_id;
ospf_if_update_params (ifp, addr);
}
- key_id = strtol (argv[3]->arg, NULL, 10);
+ key_id = strtol (argv[idx_number]->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);
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[6]->arg, OSPF_AUTH_MD5_SIZE);
+ strncpy ((char *) ck->auth_key, argv[idx_ipv4]->arg, OSPF_AUTH_MD5_SIZE);
ospf_crypt_key_add (params->auth_crypt, ck);
SET_IF_PARAM (params, auth_crypt);
"The OSPF password (key)"
"Address of interface")
{
+ int idx_number = 4;
struct interface *ifp;
struct crypt_key *ck;
int key_id;
return CMD_SUCCESS;
}
- key_id = strtol (argv[4]->arg, NULL, 10);
+ key_id = strtol (argv[idx_number]->arg, NULL, 10);
ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
if (ck == NULL)
{
"Key ID\n"
"Address of interface")
{
+ int idx_number = 4;
+ int idx_ipv4 = 5;
struct interface *ifp;
struct crypt_key *ck;
int key_id;
if (argc == 2)
{
- ret = inet_aton(argv[5]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
return CMD_SUCCESS;
}
- key_id = strtol (argv[4]->arg, NULL, 10);
+ key_id = strtol (argv[idx_number]->arg, NULL, 10);
ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
if (ck == NULL)
{
"Cost\n"
"Address of interface")
{
+ int idx_number = 3;
+ int idx_ipv4 = 4;
struct interface *ifp = vty->index;
u_int32_t cost;
struct in_addr addr;
params = IF_DEF_PARAMS (ifp);
- cost = strtol (argv[3]->arg, NULL, 10);
+ cost = strtol (argv[idx_number]->arg, NULL, 10);
/* cost range is <1-65535>. */
if (cost < 1 || cost > 65535)
if (argc == 2)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Interface cost\n"
"Address of interface")
{
+ int idx_ipv4 = 4;
struct interface *ifp = vty->index;
struct in_addr addr;
int ret;
if (argc == 1)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Interface cost\n"
"Cost")
{
+ int idx_number = 4;
struct interface *ifp = vty->index;
struct in_addr addr;
u_int32_t cost;
* 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[4]->arg, NULL, 10);
+ cost = strtol (argv[idx_number]->arg, NULL, 10);
if (cost < 1 || cost > 65535)
{
vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
"Seconds\n"
"Address of interface\n")
{
+ int idx_number = 3;
+ int idx_ipv4 = 4;
if (argc == 2)
- return ospf_vty_dead_interval_set (vty, argv[3]->arg, argv[4]->arg, NULL);
+ return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, argv[idx_ipv4]->arg, NULL);
else
- return ospf_vty_dead_interval_set (vty, argv[3]->arg, NULL, NULL);
+ return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, NULL, NULL);
}
"Number of Hellos to send each second\n"
"Address of interface\n")
{
+ int idx_number = 5;
+ int idx_ipv4 = 6;
if (argc == 2)
- return ospf_vty_dead_interval_set (vty, NULL, argv[6]->arg, argv[5]->arg);
+ return ospf_vty_dead_interval_set (vty, NULL, argv[idx_ipv4]->arg, argv[idx_number]->arg);
else
- return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[5]->arg);
+ return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[idx_number]->arg);
}
"Seconds\n"
"Address of interface")
{
+ int idx_ipv4 = 5;
struct interface *ifp = vty->index;
struct in_addr addr;
int ret;
if (argc == 2)
{
- ret = inet_aton(argv[5]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Seconds\n"
"Address of interface")
{
+ int idx_number = 3;
+ int idx_ipv4 = 4;
struct interface *ifp = vty->index;
u_int32_t seconds;
struct in_addr addr;
params = IF_DEF_PARAMS (ifp);
- seconds = strtol (argv[3]->arg, NULL, 10);
+ seconds = strtol (argv[idx_number]->arg, NULL, 10);
/* HelloInterval range is <1-65535>. */
if (seconds < 1 || seconds > 65535)
if (argc == 2)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Seconds\n"
"Address of interface")
{
+ int idx_ipv4 = 5;
struct interface *ifp = vty->index;
struct in_addr addr;
int ret;
if (argc == 2)
{
- ret = inet_aton(argv[5]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Specify OSPF point-to-multipoint network\n"
"Specify OSPF point-to-point network\n")
{
+ int idx_network = 3;
struct interface *ifp = vty->index;
int old_type = IF_DEF_PARAMS (ifp)->type;
struct route_node *rn;
return CMD_WARNING;
}
- if (strncmp (argv[3]->arg, "b", 1) == 0)
+ if (strncmp (argv[idx_network]->arg, "b", 1) == 0)
IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
- else if (strncmp (argv[3]->arg, "n", 1) == 0)
+ else if (strncmp (argv[idx_network]->arg, "n", 1) == 0)
IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA;
- else if (strncmp (argv[3]->arg, "point-to-m", 10) == 0)
+ else if (strncmp (argv[idx_network]->arg, "point-to-m", 10) == 0)
IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT;
- else if (strncmp (argv[3]->arg, "point-to-p", 10) == 0)
+ else if (strncmp (argv[idx_network]->arg, "point-to-p", 10) == 0)
IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT;
if (IF_DEF_PARAMS (ifp)->type == old_type)
"Priority\n"
"Address of interface")
{
+ int idx_number = 3;
+ int idx_ipv4 = 4;
struct interface *ifp = vty->index;
long priority;
struct route_node *rn;
params = IF_DEF_PARAMS (ifp);
- priority = strtol (argv[3]->arg, NULL, 10);
+ priority = strtol (argv[idx_number]->arg, NULL, 10);
/* Router Priority range is <0-255>. */
if (priority < 0 || priority > 255)
if (argc == 2)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Priority\n"
"Address of interface")
{
+ int idx_ipv4 = 5;
struct interface *ifp = vty->index;
struct route_node *rn;
struct in_addr addr;
if (argc == 2)
{
- ret = inet_aton(argv[5]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Seconds\n"
"Address of interface")
{
+ int idx_number = 3;
+ int idx_ipv4 = 4;
struct interface *ifp = vty->index;
u_int32_t seconds;
struct in_addr addr;
struct ospf_if_params *params;
params = IF_DEF_PARAMS (ifp);
- seconds = strtol (argv[3]->arg, NULL, 10);
+ seconds = strtol (argv[idx_number]->arg, NULL, 10);
/* Retransmit Interval range is <3-65535>. */
if (seconds < 3 || seconds > 65535)
if (argc == 2)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Seconds\n"
"Address of interface")
{
+ int idx_number = 3;
+ int idx_ipv4 = 4;
struct interface *ifp = vty->index;
u_int32_t seconds;
struct in_addr addr;
struct ospf_if_params *params;
params = IF_DEF_PARAMS (ifp);
- seconds = strtol (argv[3]->arg, NULL, 10);
+ seconds = strtol (argv[idx_number]->arg, NULL, 10);
/* Transmit Delay range is <1-65535>. */
if (seconds < 1 || seconds > 65535)
if (argc == 2)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n")
{
+ int idx_ipv4_number = 3;
struct interface *ifp = vty->index;
int format, ret;
struct in_addr area_id;
u_short instance = 0;
if (argc == 2)
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_ipv4_number]->arg);
ospf = ospf_lookup_instance (instance);
if (ospf == NULL)
"Instance ID\n"
"Disable OSPF on this interface\n")
{
+ int idx_number = 3;
struct interface *ifp = vty->index;
struct ospf *ospf;
struct ospf_if_params *params;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL)
return CMD_SUCCESS;
"Route map reference\n"
"Pointer to route-map entries\n")
{
+ int idx_protocol = 1;
+ int idx_redist_param = 2;
struct ospf *ospf = vty->index;
int source;
int type = -1;
return CMD_SUCCESS;
/* Get distribute source. */
- source = proto_redistnum(AFI_IP, argv[1]->arg);
+ source = proto_redistnum(AFI_IP, argv[idx_protocol]->arg);
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
return CMD_WARNING;
/* Get metric value. */
- if (argv[2]->arg != NULL)
- if (!str2metric (argv[2]->arg, &metric))
+ if (argv[idx_redist_param]->arg != NULL)
+ if (!str2metric (argv[idx_redist_param]->arg, &metric))
return CMD_WARNING;
/* Get metric type. */
"Route map reference\n"
"Pointer to route-map entries\n")
{
+ int idx_protocol = 2;
struct ospf *ospf = vty->index;
int source;
struct ospf_redist *red;
if (!ospf)
return CMD_SUCCESS;
- source = proto_redistnum(AFI_IP, argv[2]->arg);
+ source = proto_redistnum(AFI_IP, argv[idx_protocol]->arg);
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
return CMD_WARNING;
"Route map reference\n"
"Pointer to route-map entries\n")
{
+ int idx_ospf_table = 1;
+ int idx_number = 2;
+ int idx_redist_param = 3;
struct ospf *ospf = vty->index;
int source;
int type = -1;
if (!ospf)
return CMD_SUCCESS;
- if (strncmp(argv[1]->arg, "o", 1) == 0)
+ if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
source = ZEBRA_ROUTE_OSPF;
else
source = ZEBRA_ROUTE_TABLE;
- VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg);
+ VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
if (!ospf)
return CMD_SUCCESS;
}
/* Get metric value. */
- if (argv[3]->arg != NULL)
- if (!str2metric (argv[3]->arg, &metric))
+ if (argv[idx_redist_param]->arg != NULL)
+ if (!str2metric (argv[idx_redist_param]->arg, &metric))
return CMD_WARNING;
/* Get metric type. */
"Route map reference\n"
"Pointer to route-map entries\n")
{
+ int idx_ospf_table = 2;
+ int idx_number = 3;
struct ospf *ospf = vty->index;
u_int instance;
struct ospf_redist *red;
if (!ospf)
return CMD_SUCCESS;
- if (strncmp(argv[2]->arg, "o", 1) == 0)
+ if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
source = ZEBRA_ROUTE_OSPF;
else
source = ZEBRA_ROUTE_TABLE;
- VTY_GET_INTEGER ("Instance ID", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance)
{
OUT_STR
QUAGGA_REDIST_HELP_STR_OSPFD)
{
+ int idx_word = 1;
struct ospf *ospf = vty->index;
int source;
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
return CMD_WARNING;
- return ospf_distribute_list_out_set (ospf, source, argv[1]->arg);
+ return ospf_distribute_list_out_set (ospf, source, argv[idx_word]->arg);
}
DEFUN (no_ospf_distribute_list_out,
OUT_STR
QUAGGA_REDIST_HELP_STR_OSPFD)
{
+ int idx_word = 2;
struct ospf *ospf = vty->index;
int source;
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
return CMD_WARNING;
- return ospf_distribute_list_out_unset (ospf, source, argv[2]->arg);
+ return ospf_distribute_list_out_unset (ospf, source, argv[idx_word]->arg);
}
/* Default information originate. */
"Route map reference\n"
"Pointer to route-map entries\n")
{
+ int idx_redist_param = 2;
struct ospf *ospf = vty->index;
int default_originate = DEFAULT_ORIGINATE_ZEBRA;
int type = -1;
return CMD_WARNING; /* this should not happen */
/* Check whether "always" was specified */
- if (argv[2]->arg != NULL)
+ if (argv[idx_redist_param]->arg != NULL)
default_originate = DEFAULT_ORIGINATE_ALWAYS;
red = ospf_redist_add(ospf, DEFAULT_ROUTE, 0);
"Set metric of redistributed routes\n"
"Default metric\n")
{
+ int idx_number = 1;
struct ospf *ospf = vty->index;
int metric = -1;
if (!ospf)
return CMD_SUCCESS;
- if (!str2metric (argv[1]->arg, &metric))
+ if (!str2metric (argv[idx_number]->arg, &metric))
return CMD_WARNING;
ospf->default_metric = metric;
"Define an administrative distance\n"
"OSPF Administrative distance\n")
{
+ int idx_number = 1;
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- ospf->distance_all = atoi (argv[1]->arg);
+ ospf->distance_all = atoi (argv[idx_number]->arg);
return CMD_SUCCESS;
}
"External routes\n"
"Distance for external routes\n")
{
+ int idx_area_distance = 3;
struct ospf *ospf = vty->index;
if (!ospf)
if (!ospf)
return CMD_SUCCESS;
- if (argv[3]->arg != NULL)
+ if (argv[idx_area_distance]->arg != NULL)
ospf->distance_intra = 0;
if (argv[1] != NULL)
if (argv[2] != NULL)
ospf->distance_external = 0;
- if (argv[3]->arg || argv[1] || argv[2])
+ if (argv[idx_area_distance]->arg || argv[1] || argv[2])
return CMD_SUCCESS;
/* If no arguments are given, clear all distance information */
"External routes\n"
"Distance for external routes\n")
{
+ int idx_area_distance = 2;
struct ospf *ospf = vty->index;
if (!ospf)
if (argc < 3) /* should not happen */
return CMD_WARNING;
- if (!argv[2]->arg && !argv[1] && !argv[2])
+ if (!argv[idx_area_distance]->arg && !argv[1] && !argv[2])
{
vty_out(vty, "%% Command incomplete. (Arguments required)%s",
VTY_NEWLINE);
return CMD_WARNING;
}
- if (argv[2]->arg != NULL)
- ospf->distance_intra = atoi(argv[2]->arg);
+ if (argv[idx_area_distance]->arg != NULL)
+ ospf->distance_intra = atoi(argv[idx_area_distance]->arg);
if (argv[1] != NULL)
ospf->distance_inter = atoi(argv[1]);
"Distance value\n"
"IP source prefix\n")
{
+ int idx_number = 1;
+ int idx_ipv4_prefixlen = 2;
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- ospf_distance_set (vty, ospf, argv[1]->arg, argv[2]->arg, NULL);
+ ospf_distance_set (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL);
return CMD_SUCCESS;
}
"Distance value\n"
"IP source prefix\n")
{
+ int idx_number = 2;
+ int idx_ipv4_prefixlen = 3;
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- ospf_distance_unset (vty, ospf, argv[2]->arg, argv[3]->arg, NULL);
+ ospf_distance_unset (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL);
return CMD_SUCCESS;
}
"IP source prefix\n"
"Access list name\n")
{
+ int idx_number = 1;
+ int idx_ipv4_prefixlen = 2;
+ int idx_word = 3;
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- ospf_distance_set (vty, ospf, argv[1]->arg, argv[2]->arg, argv[3]->arg);
+ ospf_distance_set (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg);
return CMD_SUCCESS;
}
"IP source prefix\n"
"Access list name\n")
{
+ int idx_number = 2;
+ int idx_ipv4_prefixlen = 3;
+ int idx_word = 4;
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- ospf_distance_unset (vty, ospf, argv[2]->arg, argv[3]->arg, argv[4]->arg);
+ ospf_distance_unset (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg);
return CMD_SUCCESS;
}
"Disable mtu mismatch detection\n"
"Address of interface")
{
+ int idx_ipv4 = 3;
struct interface *ifp = vty->index;
struct in_addr addr;
int ret;
if (argc == 1)
{
- ret = inet_aton(argv[3]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Disable mtu mismatch detection\n"
"Address of interface")
{
+ int idx_ipv4 = 4;
struct interface *ifp = vty->index;
struct in_addr addr;
int ret;
if (argc == 1)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Automatically advertise stub Router-LSA on startup of OSPF\n"
"Time (seconds) to advertise self as stub-router\n")
{
+ int idx_number = 3;
unsigned int seconds;
struct ospf *ospf = vty->index;
return CMD_WARNING;
}
- VTY_GET_INTEGER ("stub-router startup period", seconds, argv[3]->arg);
+ VTY_GET_INTEGER ("stub-router startup period", seconds, argv[idx_number]->arg);
ospf->stub_router_startup_time = seconds;
"Advertise stub-router prior to full shutdown of OSPF\n"
"Time (seconds) to wait till full shutdown\n")
{
+ int idx_number = 3;
unsigned int seconds;
struct ospf *ospf = vty->index;
return CMD_WARNING;
}
- VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[3]->arg);
+ VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[idx_number]->arg);
ospf->stub_router_shutdown_time = seconds;
"Instance ID\n"
"Show all the ABR's and ASBR's\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"Instance ID\n"
"OSPF routing table\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"Interface information\n"
"Interface name\n")
{
+ int idx_ifname = 4;
struct interface *ifp;
struct listnode *node;
}
else /* Interface name is specified. */
{
- if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL)
+ if ((ifp = if_lookup_by_name (argv[idx_ifname]->arg)) == NULL)
vty_out (vty, "No such interface name%s", VTY_NEWLINE);
else
ospf_interface_clear(ifp);