diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-12-06 19:51:33 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-12-06 19:51:33 +0000 |
| commit | 6fd800be4ac4da8ec034f2a858e0183b8ae9bb01 (patch) | |
| tree | e1a77a68567f6496415b6476a6bed52c77d64619 /ripd/rip_interface.c | |
| parent | 3d6e734154e6da17423e9054b5443774cacfdd51 (diff) | |
| parent | 9dec6b446c5487623ad04fdaa8160e3338f12799 (diff) | |
Merge remote-tracking branch 'osr/master' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Conflicts:
lib/command_match.c
Diffstat (limited to 'ripd/rip_interface.c')
| -rw-r--r-- | ripd/rip_interface.c | 128 |
1 files changed, 89 insertions, 39 deletions
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index f2ce7e760d..2ce28f0c96 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -55,6 +55,7 @@ const struct message ri_version_msg[] = {RI_RIP_VERSION_1, "1"}, {RI_RIP_VERSION_2, "2"}, {RI_RIP_VERSION_1_AND_2, "1 2"}, + {RI_RIP_VERSION_NONE, "none"}, }; extern struct zebra_privs_t ripd_privs; @@ -497,17 +498,17 @@ rip_interface_delete (int command, struct zclient *zclient, static void rip_interface_clean (struct rip_interface *ri) - { - ri->enable_network = 0; - ri->enable_interface = 0; - ri->running = 0; +{ + ri->enable_network = 0; + ri->enable_interface = 0; + ri->running = 0; - if (ri->t_wakeup) - { - thread_cancel (ri->t_wakeup); - ri->t_wakeup = NULL; - } + if (ri->t_wakeup) + { + thread_cancel (ri->t_wakeup); + ri->t_wakeup = NULL; } +} void rip_interfaces_clean (void) @@ -521,7 +522,7 @@ rip_interfaces_clean (void) static void rip_interface_reset (struct rip_interface *ri) - { +{ /* Default authentication type is simple password for Cisco compatibility. */ ri->auth_type = RIP_NO_AUTH; @@ -534,34 +535,36 @@ rip_interface_reset (struct rip_interface *ri) ri->split_horizon_default = RIP_SPLIT_HORIZON; ri->split_horizon = ri->split_horizon_default; - ri->ri_send = RI_RIP_UNSPEC; - ri->ri_receive = RI_RIP_UNSPEC; + ri->ri_send = RI_RIP_UNSPEC; + ri->ri_receive = RI_RIP_UNSPEC; - if (ri->auth_str) - { - free (ri->auth_str); - ri->auth_str = NULL; - } - if (ri->key_chain) - { - free (ri->key_chain); - ri->key_chain = NULL; - } + ri->v2_broadcast = 0; - ri->list[RIP_FILTER_IN] = NULL; - ri->list[RIP_FILTER_OUT] = NULL; + if (ri->auth_str) + { + free (ri->auth_str); + ri->auth_str = NULL; + } + if (ri->key_chain) + { + free (ri->key_chain); + ri->key_chain = NULL; + } - ri->prefix[RIP_FILTER_IN] = NULL; - ri->prefix[RIP_FILTER_OUT] = NULL; - - ri->recv_badpackets = 0; - ri->recv_badroutes = 0; - ri->sent_updates = 0; + ri->list[RIP_FILTER_IN] = NULL; + ri->list[RIP_FILTER_OUT] = NULL; - ri->passive = 0; + ri->prefix[RIP_FILTER_IN] = NULL; + ri->prefix[RIP_FILTER_OUT] = NULL; + + ri->recv_badpackets = 0; + ri->recv_badroutes = 0; + ri->sent_updates = 0; + + ri->passive = 0; rip_interface_clean (ri); - } +} void rip_interfaces_reset (void) @@ -1320,13 +1323,14 @@ DEFUN (no_rip_neighbor, DEFUN (ip_rip_receive_version, ip_rip_receive_version_cmd, - "ip rip receive version (1-2)", + "ip rip receive version <1|2|none>", IP_STR "Routing Information Protocol\n" "Advertisement reception\n" "Version control\n" "RIP version 1\n" - "RIP version 2\n") + "RIP version 2\n" + "None\n") { int idx_type = 4; struct interface *ifp; @@ -1335,17 +1339,21 @@ DEFUN (ip_rip_receive_version, ifp = (struct interface *)vty->index; ri = ifp->info; - /* Version 1. */ - if (atoi (argv[idx_type]->arg) == 1) + switch (argv[idx_type]->arg[0]) { + case '1': ri->ri_receive = RI_RIP_VERSION_1; return CMD_SUCCESS; - } - if (atoi (argv[idx_type]->arg) == 2) - { + case '2': ri->ri_receive = RI_RIP_VERSION_2; return CMD_SUCCESS; + case 'n': + ri->ri_receive = RI_RIP_VERSION_NONE; + return CMD_SUCCESS; + default: + break; } + return CMD_WARNING; } @@ -1508,6 +1516,41 @@ DEFUN (no_ip_rip_send_version, } +DEFUN (ip_rip_v2_broadcast, + ip_rip_v2_broadcast_cmd, + "ip rip v2-broadcast", + IP_STR + "Routing Information Protocol\n" + "Send ip broadcast v2 update\n") +{ + struct interface *ifp; + struct rip_interface *ri; + + ifp = (struct interface *)vty->index; + ri = ifp->info; + + ri->v2_broadcast = 1; + return CMD_SUCCESS; +} + +DEFUN (no_ip_rip_v2_broadcast, + no_ip_rip_v2_broadcast_cmd, + "no ip rip v2-broadcast", + NO_STR + IP_STR + "Routing Information Protocol\n" + "Send ip broadcast v2 update\n") +{ + struct interface *ifp; + struct rip_interface *ri; + + ifp = (struct interface *)vty->index; + ri = ifp->info; + + ri->v2_broadcast = 0; + return CMD_SUCCESS; +} + DEFUN (ip_rip_authentication_mode, ip_rip_authentication_mode_cmd, "ip rip authentication mode <md5|text> [auth-length <rfc|old-ripd>]", @@ -1850,6 +1893,7 @@ rip_interface_config_write (struct vty *vty) (ri->ri_send == RI_RIP_UNSPEC) && (ri->ri_receive == RI_RIP_UNSPEC) && (ri->auth_type != RIP_AUTH_MD5) && + (!ri->v2_broadcast) && (ri->md5_auth_len != RIP_AUTH_MD5_SIZE) && (!ri->auth_str) && (!ri->key_chain) ) @@ -1891,6 +1935,9 @@ rip_interface_config_write (struct vty *vty) lookup (ri_version_msg, ri->ri_receive), VTY_NEWLINE); + if (ri->v2_broadcast) + vty_out (vty, " ip rip v2-broadcast%s", VTY_NEWLINE); + /* RIP authentication. */ if (ri->auth_type == RIP_AUTH_SIMPLE_PASSWORD) vty_out (vty, " ip rip authentication mode text%s", VTY_NEWLINE); @@ -2025,6 +2072,9 @@ rip_if_init (void) 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); + install_element (INTERFACE_NODE, &no_ip_rip_v2_broadcast_cmd); + install_element (INTERFACE_NODE, &ip_rip_authentication_mode_cmd); install_element (INTERFACE_NODE, &no_ip_rip_authentication_mode_cmd); |
