isisd: API: circuit password
This cleans up circuit password configuration a little bit.
(Restructured several times by both Christian Franke and David
Lamparter.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c
index 06d59a8..c6f2465 100644
--- a/isisd/isis_vty.c
+++ b/isisd/isis_vty.c
@@ -293,6 +293,59 @@
return CMD_SUCCESS;
}
+DEFUN (isis_passwd,
+ isis_passwd_cmd,
+ "isis password (md5|clear) WORD",
+ "IS-IS commands\n"
+ "Configure the authentication password for a circuit\n"
+ "HMAC-MD5 authentication\n"
+ "Cleartext password\n"
+ "Circuit password\n")
+{
+ struct isis_circuit *circuit = isis_circuit_lookup (vty);
+ int rv;
+ if (!circuit)
+ return CMD_ERR_NO_MATCH;
+
+ if (argv[0][0] == 'm')
+ rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[1]);
+ else
+ rv = isis_circuit_passwd_cleartext_set(circuit, argv[1]);
+ if (rv)
+ {
+ vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
+ return CMD_ERR_AMBIGUOUS;
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_isis_passwd,
+ no_isis_passwd_cmd,
+ "no isis password",
+ NO_STR
+ "IS-IS commands\n"
+ "Configure the authentication password for a circuit\n")
+{
+ struct isis_circuit *circuit = isis_circuit_lookup (vty);
+ if (!circuit)
+ return CMD_ERR_NO_MATCH;
+
+ isis_circuit_passwd_unset(circuit);
+
+ return CMD_SUCCESS;
+}
+
+ALIAS (no_isis_passwd,
+ no_isis_passwd_arg_cmd,
+ "no isis password (md5|clear) WORD",
+ NO_STR
+ "IS-IS commands\n"
+ "Configure the authentication password for a circuit\n"
+ "HMAC-MD5 authentication\n"
+ "Cleartext password\n"
+ "Circuit password\n")
+
DEFUN (isis_priority,
isis_priority_cmd,
"isis priority <0-127>",
@@ -822,6 +875,10 @@
install_element (INTERFACE_NODE, &isis_network_cmd);
install_element (INTERFACE_NODE, &no_isis_network_cmd);
+ install_element (INTERFACE_NODE, &isis_passwd_cmd);
+ install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
+ install_element (INTERFACE_NODE, &no_isis_passwd_arg_cmd);
+
install_element (INTERFACE_NODE, &isis_priority_cmd);
install_element (INTERFACE_NODE, &no_isis_priority_cmd);
install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);