summaryrefslogtreecommitdiff
path: root/ripngd/ripng_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ripngd/ripng_interface.c')
-rw-r--r--ripngd/ripng_interface.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index a8742ec9a4..1ac9e40f67 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -953,20 +953,21 @@ DEFUN (ripng_network,
"RIPng enable on specified interface or network.\n"
"Interface or address")
{
+ int idx_if_or_addr = 1;
int ret;
struct prefix p;
- ret = str2prefix (argv[0], &p);
+ ret = str2prefix (argv[idx_if_or_addr]->arg, &p);
/* Given string is IPv6 network or interface name. */
if (ret)
ret = ripng_enable_network_add (&p);
else
- ret = ripng_enable_if_add (argv[0]);
+ ret = ripng_enable_if_add (argv[idx_if_or_addr]->arg);
if (ret < 0)
{
- vty_out (vty, "There is same network configuration %s%s", argv[0],
+ vty_out (vty, "There is same network configuration %s%s", argv[idx_if_or_addr]->arg,
VTY_NEWLINE);
return CMD_WARNING;
}
@@ -982,20 +983,21 @@ DEFUN (no_ripng_network,
"RIPng enable on specified interface or network.\n"
"Interface or address")
{
+ int idx_if_or_addr = 2;
int ret;
struct prefix p;
- ret = str2prefix (argv[0], &p);
+ ret = str2prefix (argv[idx_if_or_addr]->arg, &p);
/* Given string is interface name. */
if (ret)
ret = ripng_enable_network_delete (&p);
else
- ret = ripng_enable_if_delete (argv[0]);
+ ret = ripng_enable_if_delete (argv[idx_if_or_addr]->arg);
if (ret < 0)
{
- vty_out (vty, "can't find network %s%s", argv[0],
+ vty_out (vty, "can't find network %s%s", argv[idx_if_or_addr]->arg,
VTY_NEWLINE);
return CMD_WARNING;
}
@@ -1010,10 +1012,9 @@ DEFUN (ipv6_ripng_split_horizon,
"Routing Information Protocol\n"
"Perform split horizon\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT(interface, ifp);
struct ripng_interface *ri;
- ifp = vty->index;
ri = ifp->info;
ri->split_horizon = RIPNG_SPLIT_HORIZON;
@@ -1028,10 +1029,9 @@ DEFUN (ipv6_ripng_split_horizon_poisoned_reverse,
"Perform split horizon\n"
"With poisoned-reverse\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT(interface, ifp);
struct ripng_interface *ri;
- ifp = vty->index;
ri = ifp->info;
ri->split_horizon = RIPNG_SPLIT_HORIZON_POISONED_REVERSE;
@@ -1040,38 +1040,30 @@ DEFUN (ipv6_ripng_split_horizon_poisoned_reverse,
DEFUN (no_ipv6_ripng_split_horizon,
no_ipv6_ripng_split_horizon_cmd,
- "no ipv6 ripng split-horizon",
+ "no ipv6 ripng split-horizon [poisoned-reverse]",
NO_STR
IPV6_STR
"Routing Information Protocol\n"
- "Perform split horizon\n")
+ "Perform split horizon\n"
+ "With poisoned-reverse\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT(interface, ifp);
struct ripng_interface *ri;
- ifp = vty->index;
ri = ifp->info;
ri->split_horizon = RIPNG_NO_SPLIT_HORIZON;
return CMD_SUCCESS;
}
-ALIAS (no_ipv6_ripng_split_horizon,
- no_ipv6_ripng_split_horizon_poisoned_reverse_cmd,
- "no ipv6 ripng split-horizon poisoned-reverse",
- NO_STR
- IPV6_STR
- "Routing Information Protocol\n"
- "Perform split horizon\n"
- "With poisoned-reverse\n")
-
DEFUN (ripng_passive_interface,
ripng_passive_interface_cmd,
"passive-interface IFNAME",
"Suppress routing updates on an interface\n"
"Interface name\n")
{
- return ripng_passive_interface_set (vty, argv[0]);
+ int idx_ifname = 1;
+ return ripng_passive_interface_set (vty, argv[idx_ifname]->arg);
}
DEFUN (no_ripng_passive_interface,
@@ -1081,7 +1073,8 @@ DEFUN (no_ripng_passive_interface,
"Suppress routing updates on an interface\n"
"Interface name\n")
{
- return ripng_passive_interface_unset (vty, argv[0]);
+ int idx_ifname = 2;
+ return ripng_passive_interface_unset (vty, argv[idx_ifname]->arg);
}
static struct ripng_interface *
@@ -1194,13 +1187,7 @@ ripng_if_init ()
/* Install interface node. */
install_node (&interface_node, interface_config_write);
-
- /* Install commands. */
- install_element (CONFIG_NODE, &interface_cmd);
- install_element (CONFIG_NODE, &no_interface_cmd);
- install_default (INTERFACE_NODE);
- install_element (INTERFACE_NODE, &interface_desc_cmd);
- install_element (INTERFACE_NODE, &no_interface_desc_cmd);
+ if_cmd_init ();
install_element (RIPNG_NODE, &ripng_network_cmd);
install_element (RIPNG_NODE, &no_ripng_network_cmd);
@@ -1210,5 +1197,4 @@ ripng_if_init ()
install_element (INTERFACE_NODE, &ipv6_ripng_split_horizon_cmd);
install_element (INTERFACE_NODE, &ipv6_ripng_split_horizon_poisoned_reverse_cmd);
install_element (INTERFACE_NODE, &no_ipv6_ripng_split_horizon_cmd);
- install_element (INTERFACE_NODE, &no_ipv6_ripng_split_horizon_poisoned_reverse_cmd);
}