babeld: vty commands (hello-interval, update-interval, resend-delay).

This commit is contained in:
Juliusz Chroboczek 2012-02-11 14:02:10 +01:00 committed by Paul Jakma
parent b58871ee4d
commit c428edba5f
2 changed files with 61 additions and 23 deletions

View File

@ -293,7 +293,7 @@ babel_enable_if_delete (const char *ifname)
DEFUN (babel_network, DEFUN (babel_network,
babel_network_cmd, babel_network_cmd,
"network IF_OR_ADDR", "network IF_OR_ADDR",
"Babel enable on specified interface or network.\n" "Enable Babel protocol on specified interface or network.\n"
"Interface or address") "Interface or address")
{ {
int ret; int ret;
@ -321,7 +321,7 @@ DEFUN (no_babel_network,
no_babel_network_cmd, no_babel_network_cmd,
"no network IF_OR_ADDR", "no network IF_OR_ADDR",
NO_STR NO_STR
"Babel enable on specified interface or network.\n" "Disable Babel protocol on specified interface or network.\n"
"Interface or address") "Interface or address")
{ {
int ret; int ret;
@ -348,8 +348,8 @@ DEFUN (no_babel_network,
DEFUN (babel_set_wired, DEFUN (babel_set_wired,
babel_set_wired_cmd, babel_set_wired_cmd,
"babel wired", "babel wired",
"Set this interface as wired (default: wireless).\n" "Babel interface commands\n"
"No attributes") "Enable wired optimisations")
{ {
struct interface *ifp; struct interface *ifp;
babel_interface_nfo *babel_ifp; babel_interface_nfo *babel_ifp;
@ -366,9 +366,8 @@ DEFUN (babel_set_wired,
DEFUN (babel_set_wireless, DEFUN (babel_set_wireless,
babel_set_wireless_cmd, babel_set_wireless_cmd,
"babel wireless", "babel wireless",
NO_STR "Babel interface commands\n"
"Set this interface as wireless (is default).\n" "Disable wired optimiations (assume wireless)")
"No attributes")
{ {
struct interface *ifp; struct interface *ifp;
babel_interface_nfo *babel_ifp; babel_interface_nfo *babel_ifp;
@ -385,9 +384,8 @@ DEFUN (babel_set_wireless,
DEFUN (babel_split_horizon, DEFUN (babel_split_horizon,
babel_split_horizon_cmd, babel_split_horizon_cmd,
"babel split-horizon", "babel split-horizon",
IPV6_STR "Babel interface commands\n"
"Perform split horizon\n" "Enable split horizon processing")
"No attributes\n")
{ {
struct interface *ifp; struct interface *ifp;
babel_interface_nfo *babel_ifp; babel_interface_nfo *babel_ifp;
@ -405,9 +403,8 @@ DEFUN (no_babel_split_horizon,
no_babel_split_horizon_cmd, no_babel_split_horizon_cmd,
"no babel split-horizon", "no babel split-horizon",
NO_STR NO_STR
IPV6_STR "Babel interface commands\n"
"Disable split horizon\n" "Disable split horizon processing")
"No attributes\n")
{ {
struct interface *ifp; struct interface *ifp;
babel_interface_nfo *babel_ifp; babel_interface_nfo *babel_ifp;
@ -423,15 +420,16 @@ DEFUN (no_babel_split_horizon,
/* [Interface Command]. */ /* [Interface Command]. */
DEFUN (babel_set_hello_interval, DEFUN (babel_set_hello_interval,
babel_set_hello_interval_cmd, babel_set_hello_interval_cmd,
"hello interval <5-1000000>", "babel hello-interval <20-655340>",
"Set interface's hello interval (default: 4000).\n" "Babel interface commands\n"
"Value in miliseconds\n") "Time between scheduled hellos\n"
"Milliseconds\n")
{ {
struct interface *ifp; struct interface *ifp;
babel_interface_nfo *babel_ifp; babel_interface_nfo *babel_ifp;
int interval; int interval;
VTY_GET_INTEGER_RANGE("hello interval", interval, argv[0], 20, 10 * 0xFFFE); VTY_GET_INTEGER_RANGE("milliseconds", interval, argv[0], 20, 10 * 0xFFFE);
ifp = vty->index; ifp = vty->index;
babel_ifp = babel_get_if_nfo(ifp); babel_ifp = babel_get_if_nfo(ifp);
@ -441,12 +439,34 @@ DEFUN (babel_set_hello_interval,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/* [Interface Command]. */
DEFUN (babel_set_update_interval,
babel_set_update_interval_cmd,
"babel update-interval <20-655340>",
"Babel interface commands\n"
"Time between scheduled updates\n"
"Milliseconds\n")
{
struct interface *ifp;
babel_interface_nfo *babel_ifp;
int interval;
VTY_GET_INTEGER_RANGE("milliseconds", interval, argv[0], 20, 10 * 0xFFFE);
ifp = vty->index;
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
babel_ifp->update_interval = interval;
return CMD_SUCCESS;
}
/* [Interface Command]. */ /* [Interface Command]. */
DEFUN (babel_passive_interface, DEFUN (babel_passive_interface,
babel_passive_interface_cmd, babel_passive_interface_cmd,
"passive-interface", "babel passive-interface",
"The daemon will only announce redistributed routes\n" "Babel interface commands\n"
"No attributes\n") "Only announce redistributed routes on this interface\n")
{ {
if (allow_duplicates) { if (allow_duplicates) {
return CMD_WARNING; return CMD_WARNING;
@ -458,10 +478,10 @@ DEFUN (babel_passive_interface,
/* [Interface Command]. */ /* [Interface Command]. */
DEFUN (no_babel_passive_interface, DEFUN (no_babel_passive_interface,
no_babel_passive_interface_cmd, no_babel_passive_interface_cmd,
"no passive-interface", "no babel passive-interface",
NO_STR NO_STR
"The daemon will announce all (filtred) routes\n" "Babel interface commands\n"
"No attributes\n") "Announce all routes on this interface\n")
{ {
parasitic = 0; parasitic = 0;
return CMD_SUCCESS; return CMD_SUCCESS;
@ -899,6 +919,7 @@ babel_if_init ()
install_element(INTERFACE_NODE, &babel_set_wired_cmd); install_element(INTERFACE_NODE, &babel_set_wired_cmd);
install_element(INTERFACE_NODE, &babel_set_wireless_cmd); install_element(INTERFACE_NODE, &babel_set_wireless_cmd);
install_element(INTERFACE_NODE, &babel_set_hello_interval_cmd); install_element(INTERFACE_NODE, &babel_set_hello_interval_cmd);
install_element(INTERFACE_NODE, &babel_set_update_interval_cmd);
install_element(INTERFACE_NODE, &babel_passive_interface_cmd); install_element(INTERFACE_NODE, &babel_passive_interface_cmd);
install_element(INTERFACE_NODE, &no_babel_passive_interface_cmd); install_element(INTERFACE_NODE, &no_babel_passive_interface_cmd);

View File

@ -629,6 +629,22 @@ DEFUN (no_router_babel,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/* [Babel Command] */
DEFUN (babel_set_resend_delay,
babel_set_resend_delay_cmd,
"babel resend-delay <20-655340>",
"Babel commands\n"
"Time before resending a message\n"
"Milliseconds\n")
{
int interval;
VTY_GET_INTEGER_RANGE("milliseconds", interval, argv[0], 20, 10 * 0xFFFE);
resend_delay = interval;
return CMD_SUCCESS;
}
void void
babeld_quagga_init(void) babeld_quagga_init(void)
{ {
@ -639,6 +655,7 @@ babeld_quagga_init(void)
install_element(CONFIG_NODE, &no_router_babel_cmd); install_element(CONFIG_NODE, &no_router_babel_cmd);
install_default(BABEL_NODE); install_default(BABEL_NODE);
install_element(BABEL_NODE, &babel_set_resend_delay_cmd);
babel_if_init(); babel_if_init();