summaryrefslogtreecommitdiffstats
path: root/zebra/rtadv.c
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2016-09-23 21:26:31 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-09-23 21:26:31 +0200
commit7c022376c83e8eb72ee02ff22916e925ef68430c (patch)
treee7593b90fa2a3bbf6a1d3b8d9c4043c2167a0950 /zebra/rtadv.c
parentzebra: fix vrf argv index numbers (diff)
downloadfrr-7c022376c83e8eb72ee02ff22916e925ef68430c.tar.xz
frr-7c022376c83e8eb72ee02ff22916e925ef68430c.zip
zebra: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Diffstat (limited to 'zebra/rtadv.c')
-rw-r--r--zebra/rtadv.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index c13d85a4d..ec4736463 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -923,6 +923,7 @@ DEFUN (ipv6_nd_ra_interval_msec,
"Router Advertisement interval\n"
"Router Advertisement interval in milliseconds\n")
{
+ int idx_number = 4;
unsigned interval;
struct interface *ifp = (struct interface *) vty->index;
struct zebra_if *zif = ifp->info;
@@ -930,7 +931,7 @@ DEFUN (ipv6_nd_ra_interval_msec,
struct zebra_ns *zns;
zns = zvrf->zns;
- VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[4]->arg, 70, 1800000);
+ VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[idx_number]->arg, 70, 1800000);
if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime * 1000))
{
vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE);
@@ -958,6 +959,7 @@ DEFUN (ipv6_nd_ra_interval,
"Router Advertisement interval\n"
"Router Advertisement interval in seconds\n")
{
+ int idx_number = 3;
unsigned interval;
struct interface *ifp = (struct interface *) vty->index;
struct zebra_if *zif = ifp->info;
@@ -965,7 +967,7 @@ DEFUN (ipv6_nd_ra_interval,
struct zebra_ns *zns;
zns = zvrf->zns;
- VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[3]->arg, 1, 1800);
+ VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[idx_number]->arg, 1, 1800);
if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime))
{
vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE);
@@ -1039,6 +1041,7 @@ DEFUN (ipv6_nd_ra_lifetime,
"Router lifetime\n"
"Router lifetime in seconds (0 stands for a non-default gw)\n")
{
+ int idx_number = 3;
int lifetime;
struct interface *ifp;
struct zebra_if *zif;
@@ -1046,7 +1049,7 @@ DEFUN (ipv6_nd_ra_lifetime,
ifp = (struct interface *) vty->index;
zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[3]->arg, 0, 9000);
+ VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[idx_number]->arg, 0, 9000);
/* The value to be placed in the Router Lifetime field
* of Router Advertisements sent from the interface,
@@ -1101,9 +1104,10 @@ DEFUN (ipv6_nd_reachable_time,
"Reachable time\n"
"Reachable time in milliseconds\n")
{
+ int idx_number = 3;
struct interface *ifp = (struct interface *) vty->index;
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[3]->arg, 1, RTADV_MAX_REACHABLE_TIME);
+ VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[idx_number]->arg, 1, RTADV_MAX_REACHABLE_TIME);
return CMD_SUCCESS;
}
@@ -1145,9 +1149,10 @@ DEFUN (ipv6_nd_homeagent_preference,
"Home Agent preference\n"
"preference value (default is 0, least preferred)\n")
{
+ int idx_number = 3;
struct interface *ifp = (struct interface *) vty->index;
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[3]->arg, 0, 65535);
+ VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[idx_number]->arg, 0, 65535);
return CMD_SUCCESS;
}
@@ -1189,9 +1194,10 @@ DEFUN (ipv6_nd_homeagent_lifetime,
"Home Agent lifetime\n"
"Home Agent lifetime in seconds (0 to track ra-lifetime)\n")
{
+ int idx_number = 3;
struct interface *ifp = (struct interface *) vty->index;
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[3]->arg, 0, RTADV_MAX_HALIFETIME);
+ VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[idx_number]->arg, 0, RTADV_MAX_HALIFETIME);
return CMD_SUCCESS;
}
@@ -1508,7 +1514,7 @@ DEFUN (no_ipv6_nd_other_config_flag,
*/
DEFUN (ipv6_nd_prefix,
ipv6_nd_prefix_cmd,
- "ipv6 nd prefix X:X::X:X/M <(0-4294967295)|infinite> <(0-4294967295)|infinite> <off-link|> <no-autoconfig|> <router-address|>",
+ "ipv6 nd prefix X:X::X:X/M <(0-4294967295)|infinite> <(0-4294967295)|infinite> <off-link> <no-autoconfig> <router-address>",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
@@ -1521,6 +1527,9 @@ DEFUN (ipv6_nd_prefix,
"Do not use prefix for autoconfiguration\n"
"Set Router Address flag\n")
{
+ int idx_ipv6_prefixlen = 3;
+ int idx_number_infinite = 4;
+ int idx_number_infinite_2 = 5;
int i;
int ret;
int cursor = 1;
@@ -1531,7 +1540,7 @@ DEFUN (ipv6_nd_prefix,
ifp = (struct interface *) vty->index;
zebra_if = ifp->info;
- ret = str2prefix_ipv6 (argv[3]->arg, &rp.prefix);
+ ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, &rp.prefix);
if (!ret)
{
vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
@@ -1546,19 +1555,19 @@ DEFUN (ipv6_nd_prefix,
if (argc > 1)
{
- if ((isdigit((unsigned char)argv[4]->arg[0]))
- || strncmp (argv[4]->arg, "i", 1) == 0)
+ if ((isdigit((unsigned char)argv[idx_number_infinite]->arg[0]))
+ || strncmp (argv[idx_number_infinite]->arg, "i", 1) == 0)
{
- if ( strncmp (argv[4]->arg, "i", 1) == 0)
+ if ( strncmp (argv[idx_number_infinite]->arg, "i", 1) == 0)
rp.AdvValidLifetime = UINT32_MAX;
else
- rp.AdvValidLifetime = (u_int32_t) strtoll (argv[4]->arg,
+ rp.AdvValidLifetime = (u_int32_t) strtoll (argv[idx_number_infinite]->arg,
(char **)NULL, 10);
- if ( strncmp (argv[5]->arg, "i", 1) == 0)
+ if ( strncmp (argv[idx_number_infinite_2]->arg, "i", 1) == 0)
rp.AdvPreferredLifetime = UINT32_MAX;
else
- rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[5]->arg,
+ rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[idx_number_infinite_2]->arg,
(char **)NULL, 10);
if (rp.AdvPreferredLifetime > rp.AdvValidLifetime)
@@ -1790,6 +1799,7 @@ DEFUN (ipv6_nd_router_preference,
"Low default router preference\n"
"Medium default router preference (default)\n")
{
+ int idx_high_medium_low = 3;
struct interface *ifp;
struct zebra_if *zif;
int i = 0;
@@ -1799,7 +1809,7 @@ DEFUN (ipv6_nd_router_preference,
while (0 != rtadv_pref_strs[i])
{
- if (strncmp (argv[3]->arg, rtadv_pref_strs[i], 1) == 0)
+ if (strncmp (argv[idx_high_medium_low]->arg, rtadv_pref_strs[i], 1) == 0)
{
zif->rtadv.DefaultPreference = i;
return CMD_SUCCESS;
@@ -1850,9 +1860,10 @@ DEFUN (ipv6_nd_mtu,
"Advertised MTU\n"
"MTU in bytes\n")
{
+ int idx_number = 3;
struct interface *ifp = (struct interface *) vty->index;
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[3]->arg, 1, 65535);
+ VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[idx_number]->arg, 1, 65535);
return CMD_SUCCESS;
}