summaryrefslogtreecommitdiff
path: root/ripd/rip_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ripd/rip_interface.c')
-rw-r--r--ripd/rip_interface.c136
1 files changed, 47 insertions, 89 deletions
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 425b01c247..357856e1e8 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -1168,7 +1168,7 @@ static int
rip_passive_nondefault_set (struct vty *vty, const char *ifname)
{
if (rip_passive_nondefault_lookup (ifname) >= 0)
- return CMD_WARNING;
+ return CMD_WARNING_CONFIG_FAILED;
vector_set (Vrip_passive_nondefault, strdup (ifname));
@@ -1185,7 +1185,7 @@ rip_passive_nondefault_unset (struct vty *vty, const char *ifname)
i = rip_passive_nondefault_lookup (ifname);
if (i < 0)
- return CMD_WARNING;
+ return CMD_WARNING_CONFIG_FAILED;
str = vector_slot (Vrip_passive_nondefault, i);
free (str);
@@ -1233,9 +1233,9 @@ DEFUN (rip_network,
if (ret < 0)
{
- vty_outln (vty, "There is a same network configuration %s",
+ vty_out (vty, "There is a same network configuration %s\n",
argv[idx_ipv4_word]->arg);
- return CMD_WARNING;
+ return CMD_WARNING_CONFIG_FAILED;
}
return CMD_SUCCESS;
@@ -1263,9 +1263,9 @@ DEFUN (no_rip_network,
if (ret < 0)
{
- vty_outln (vty, "Can't find network configuration %s",
+ vty_out (vty, "Can't find network configuration %s\n",
argv[idx_ipv4_word]->arg);
- return CMD_WARNING;
+ return CMD_WARNING_CONFIG_FAILED;
}
return CMD_SUCCESS;
@@ -1286,8 +1286,8 @@ DEFUN (rip_neighbor,
if (ret <= 0)
{
- vty_outln (vty, "Please specify address by A.B.C.D");
- return CMD_WARNING;
+ vty_out (vty, "Please specify address by A.B.C.D\n");
+ return CMD_WARNING_CONFIG_FAILED;
}
rip_neighbor_add (&p);
@@ -1311,8 +1311,8 @@ DEFUN (no_rip_neighbor,
if (ret <= 0)
{
- vty_outln (vty, "Please specify address by A.B.C.D");
- return CMD_WARNING;
+ vty_out (vty, "Please specify address by A.B.C.D\n");
+ return CMD_WARNING_CONFIG_FAILED;
}
rip_neighbor_delete (&p);
@@ -1327,8 +1327,7 @@ DEFUN (ip_rip_receive_version,
"Routing Information Protocol\n"
"Advertisement reception\n"
"Version control\n"
- "RIP version 1\n"
- "RIP version 2\n"
+ "RIP version\n"
"None\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
@@ -1352,36 +1351,18 @@ DEFUN (ip_rip_receive_version,
break;
}
- return CMD_WARNING;
+ return CMD_WARNING_CONFIG_FAILED;
}
DEFUN (ip_rip_receive_version_1,
ip_rip_receive_version_1_cmd,
- "ip rip receive version (1-1) (2-2)",
+ "ip rip receive version <1 2|2 1>",
IP_STR
"Routing Information Protocol\n"
"Advertisement reception\n"
"Version control\n"
"RIP version 1\n"
- "RIP version 2\n")
-{
- VTY_DECLVAR_CONTEXT(interface, ifp);
- struct rip_interface *ri;
-
- ri = ifp->info;
-
- /* Version 1 and 2. */
- ri->ri_receive = RI_RIP_VERSION_1_AND_2;
- return CMD_SUCCESS;
-}
-
-DEFUN (ip_rip_receive_version_2,
- ip_rip_receive_version_2_cmd,
- "ip rip receive version (2-2) (1-1)",
- IP_STR
- "Routing Information Protocol\n"
- "Advertisement reception\n"
- "Version control\n"
+ "RIP version 2\n"
"RIP version 2\n"
"RIP version 1\n")
{
@@ -1403,8 +1384,7 @@ DEFUN (no_ip_rip_receive_version,
"Routing Information Protocol\n"
"Advertisement reception\n"
"Version control\n"
- "Version 1\n"
- "Version 2\n")
+ "RIP version\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
struct rip_interface *ri;
@@ -1423,8 +1403,7 @@ DEFUN (ip_rip_send_version,
"Routing Information Protocol\n"
"Advertisement transmission\n"
"Version control\n"
- "RIP version 1\n"
- "RIP version 2\n")
+ "RIP version\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
int idx_type = 4;
@@ -1443,36 +1422,18 @@ DEFUN (ip_rip_send_version,
ri->ri_send = RI_RIP_VERSION_2;
return CMD_SUCCESS;
}
- return CMD_WARNING;
+ return CMD_WARNING_CONFIG_FAILED;
}
DEFUN (ip_rip_send_version_1,
ip_rip_send_version_1_cmd,
- "ip rip send version (1-1) (2-2)",
+ "ip rip send version <1 2|2 1>",
IP_STR
"Routing Information Protocol\n"
"Advertisement transmission\n"
"Version control\n"
"RIP version 1\n"
- "RIP version 2\n")
-{
- VTY_DECLVAR_CONTEXT(interface, ifp);
- struct rip_interface *ri;
-
- ri = ifp->info;
-
- /* Version 1 and 2. */
- ri->ri_send = RI_RIP_VERSION_1_AND_2;
- return CMD_SUCCESS;
-}
-
-DEFUN (ip_rip_send_version_2,
- ip_rip_send_version_2_cmd,
- "ip rip send version (2-2) (1-1)",
- IP_STR
- "Routing Information Protocol\n"
- "Advertisement transmission\n"
- "Version control\n"
+ "RIP version 2\n"
"RIP version 2\n"
"RIP version 1\n")
{
@@ -1494,8 +1455,7 @@ DEFUN (no_ip_rip_send_version,
"Routing Information Protocol\n"
"Advertisement transmission\n"
"Version control\n"
- "Version 1\n"
- "Version 2\n")
+ "RIP version\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
struct rip_interface *ri;
@@ -1574,8 +1534,8 @@ DEFUN (ip_rip_authentication_mode,
{
if (auth_type != RIP_AUTH_MD5)
{
- vty_outln (vty, "auth length argument only valid for md5");
- return CMD_WARNING;
+ vty_out (vty, "auth length argument only valid for md5\n");
+ return CMD_WARNING_CONFIG_FAILED;
}
if (strmatch ("rfc", authlen))
ri->md5_auth_len = RIP_AUTH_MD5_SIZE;
@@ -1631,15 +1591,15 @@ DEFUN (ip_rip_authentication_string,
if (strlen (argv[idx_line]->arg) > 16)
{
- vty_outln (vty,
- "%% RIPv2 authentication string must be shorter than 16");
- return CMD_WARNING;
+ vty_out (vty,
+ "%% RIPv2 authentication string must be shorter than 16\n");
+ return CMD_WARNING_CONFIG_FAILED;
}
if (ri->key_chain)
{
- vty_outln (vty, "%% key-chain configuration exists");
- return CMD_WARNING;
+ vty_out (vty, "%% key-chain configuration exists\n");
+ return CMD_WARNING_CONFIG_FAILED;
}
if (ri->auth_str)
@@ -1691,8 +1651,8 @@ DEFUN (ip_rip_authentication_key_chain,
if (ri->auth_str)
{
- vty_outln (vty,"%% authentication string configuration exists");
- return CMD_WARNING;
+ vty_out (vty,"%% authentication string configuration exists\n");
+ return CMD_WARNING_CONFIG_FAILED;
}
if (ri->key_chain)
@@ -1877,43 +1837,43 @@ rip_interface_config_write (struct vty *vty)
(!ri->key_chain) )
continue;
- vty_outln (vty, "interface %s",ifp->name);
+ vty_out (vty, "interface %s\n",ifp->name);
if (ifp->desc)
- vty_outln (vty, " description %s",ifp->desc);
+ vty_out (vty, " description %s\n",ifp->desc);
/* Split horizon. */
if (ri->split_horizon != ri->split_horizon_default)
{
switch (ri->split_horizon) {
case RIP_SPLIT_HORIZON:
- vty_outln (vty, " ip rip split-horizon");
+ vty_out (vty, " ip rip split-horizon\n");
break;
case RIP_SPLIT_HORIZON_POISONED_REVERSE:
- vty_outln (vty," ip rip split-horizon poisoned-reverse");
+ vty_out (vty," ip rip split-horizon poisoned-reverse\n");
break;
case RIP_NO_SPLIT_HORIZON:
default:
- vty_outln (vty, " no ip rip split-horizon");
+ vty_out (vty, " no ip rip split-horizon\n");
break;
}
}
/* RIP version setting. */
if (ri->ri_send != RI_RIP_UNSPEC)
- vty_outln (vty, " ip rip send version %s",
+ vty_out (vty, " ip rip send version %s\n",
lookup_msg(ri_version_msg, ri->ri_send, NULL));
if (ri->ri_receive != RI_RIP_UNSPEC)
- vty_outln (vty, " ip rip receive version %s ",
+ vty_out (vty, " ip rip receive version %s \n",
lookup_msg(ri_version_msg, ri->ri_receive, NULL));
if (ri->v2_broadcast)
- vty_outln (vty, " ip rip v2-broadcast");
+ vty_out (vty, " ip rip v2-broadcast\n");
/* RIP authentication. */
if (ri->auth_type == RIP_AUTH_SIMPLE_PASSWORD)
- vty_outln (vty, " ip rip authentication mode text");
+ vty_out (vty, " ip rip authentication mode text\n");
if (ri->auth_type == RIP_AUTH_MD5)
{
@@ -1922,18 +1882,18 @@ rip_interface_config_write (struct vty *vty)
vty_out (vty, " auth-length old-ripd");
else
vty_out (vty, " auth-length rfc");
- vty_out (vty, VTYNL);
+ vty_out (vty, "\n");
}
if (ri->auth_str)
- vty_outln (vty, " ip rip authentication string %s",
+ vty_out (vty, " ip rip authentication string %s\n",
ri->auth_str);
if (ri->key_chain)
- vty_outln (vty, " ip rip authentication key-chain %s",
+ vty_out (vty, " ip rip authentication key-chain %s\n",
ri->key_chain);
- vty_outln (vty, "!");
+ vty_out (vty, "!\n");
}
return 0;
}
@@ -1948,7 +1908,7 @@ config_write_rip_network (struct vty *vty, int config_mode)
/* Network type RIP enable interface statement. */
for (node = route_top (rip_enable_network); node; node = route_next (node))
if (node->info)
- vty_outln (vty, "%s%s/%d",
+ vty_out (vty, "%s%s/%d\n",
config_mode ? " network " : " ",
inet_ntoa (node->p.u.prefix4),
node->p.prefixlen);
@@ -1956,24 +1916,24 @@ config_write_rip_network (struct vty *vty, int config_mode)
/* Interface name RIP enable statement. */
for (i = 0; i < vector_active (rip_enable_interface); i++)
if ((ifname = vector_slot (rip_enable_interface, i)) != NULL)
- vty_outln (vty, "%s%s",
+ vty_out (vty, "%s%s\n",
config_mode ? " network " : " ",
ifname);
/* RIP neighbors listing. */
for (node = route_top (rip->neighbor); node; node = route_next (node))
if (node->info)
- vty_outln (vty, "%s%s",
+ vty_out (vty, "%s%s\n",
config_mode ? " neighbor " : " ",
inet_ntoa(node->p.u.prefix4));
/* RIP passive interface listing. */
if (config_mode) {
if (passive_default)
- vty_outln (vty, " passive-interface default");
+ vty_out (vty, " passive-interface default\n");
for (i = 0; i < vector_active (Vrip_passive_nondefault); i++)
if ((ifname = vector_slot (Vrip_passive_nondefault, i)) != NULL)
- vty_outln (vty, " %spassive-interface %s",
+ vty_out (vty, " %spassive-interface %s\n",
(passive_default ? "no " : ""), ifname);
}
@@ -2034,12 +1994,10 @@ rip_if_init (void)
install_element (INTERFACE_NODE, &ip_rip_send_version_cmd);
install_element (INTERFACE_NODE, &ip_rip_send_version_1_cmd);
- install_element (INTERFACE_NODE, &ip_rip_send_version_2_cmd);
install_element (INTERFACE_NODE, &no_ip_rip_send_version_cmd);
install_element (INTERFACE_NODE, &ip_rip_receive_version_cmd);
install_element (INTERFACE_NODE, &ip_rip_receive_version_1_cmd);
- install_element (INTERFACE_NODE, &ip_rip_receive_version_2_cmd);
install_element (INTERFACE_NODE, &no_ip_rip_receive_version_cmd);
install_element (INTERFACE_NODE, &ip_rip_v2_broadcast_cmd);