summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/command.c b/lib/command.c
index 5335969fbc..0e16f30a8a 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1053,9 +1053,16 @@ static int cmd_execute_command_real(vector vline, enum cmd_filter_type filter,
if (matched_element->daemon)
ret = CMD_SUCCESS_DAEMON;
else {
- /* Clear enqueued configuration changes. */
- vty->num_cfg_changes = 0;
- memset(&vty->cfg_changes, 0, sizeof(vty->cfg_changes));
+ if (vty->config) {
+ /* Clear array of enqueued configuration changes. */
+ vty->num_cfg_changes = 0;
+ memset(&vty->cfg_changes, 0, sizeof(vty->cfg_changes));
+
+ /* Regenerate candidate configuration. */
+ if (frr_get_cli_mode() == FRR_CLI_CLASSIC)
+ nb_config_replace(vty->candidate_config,
+ running_config, true);
+ }
ret = matched_element->func(matched_element, vty, argc, argv);
}
@@ -1962,7 +1969,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;
}