summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/command.c b/lib/command.c
index 29f41a712c..e5e0623163 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1962,7 +1962,15 @@ DEFUN (config_hostname,
struct cmd_token *word = argv[1];
if (!isalnum((int)word->arg[0])) {
- vty_out(vty, "Please specify string starting with alphabet\n");
+ vty_out(vty,
+ "Please specify string starting with alphabet or number\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ /* With reference to RFC 1123 Section 2.1 */
+ if (strlen(word->arg) > HOSTNAME_LEN) {
+ vty_out(vty, "Hostname length should be less than %d chars\n",
+ HOSTNAME_LEN);
return CMD_WARNING_CONFIG_FAILED;
}
@@ -2803,9 +2811,10 @@ void cmd_init(int terminal)
/* Each node's basic commands. */
install_element(VIEW_NODE, &show_version_cmd);
install_element(ENABLE_NODE, &show_startup_config_cmd);
- install_element(ENABLE_NODE, &debug_memstats_cmd);
if (terminal) {
+ install_element(ENABLE_NODE, &debug_memstats_cmd);
+
install_element(VIEW_NODE, &config_list_cmd);
install_element(VIEW_NODE, &config_exit_cmd);
install_element(VIEW_NODE, &config_quit_cmd);
@@ -2839,9 +2848,10 @@ void cmd_init(int terminal)
install_element(CONFIG_NODE, &domainname_cmd);
install_element(CONFIG_NODE, &no_domainname_cmd);
install_element(CONFIG_NODE, &frr_version_defaults_cmd);
- install_element(CONFIG_NODE, &debug_memstats_cmd);
if (terminal > 0) {
+ install_element(CONFIG_NODE, &debug_memstats_cmd);
+
install_element(CONFIG_NODE, &password_cmd);
install_element(CONFIG_NODE, &no_password_cmd);
install_element(CONFIG_NODE, &enable_password_cmd);