]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib, vtysh: Rehook the motd command back into vtysh
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 18 Feb 2016 15:23:45 +0000 (10:23 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 18 Feb 2016 15:23:45 +0000 (10:23 -0500)
Code was already in place to read and display a motd, but
no cli was present to make it happen.  Add the cli
back to vtysh.conf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
lib/command.c
lib/command.h
vtysh/vtysh_user.c

index a1809f514c062ac215d74a88603b91f21ee1267a..037835e1df02ab0f5a28d210034a7385dd7c1524 100644 (file)
@@ -4004,6 +4004,16 @@ DEFUN (no_config_log_timestamp_precision,
   return CMD_SUCCESS;
 }
 
+int
+cmd_banner_motd_file (const char *file)
+{
+  if (host.motdfile)
+    XFREE (MTYPE_HOST, host.motdfile);
+  host.motdfile = XSTRDUP (MTYPE_HOST, file);
+
+  return CMD_SUCCESS;
+}
+
 DEFUN (banner_motd_file,
        banner_motd_file_cmd,
        "banner motd file [FILE]",
@@ -4012,11 +4022,7 @@ DEFUN (banner_motd_file,
        "Banner from a file\n"
        "Filename\n")
 {
-  if (host.motdfile)
-    XFREE (MTYPE_HOST, host.motdfile);
-  host.motdfile = XSTRDUP (MTYPE_HOST, argv[0]);
-
-  return CMD_SUCCESS;
+  return cmd_banner_motd_file (argv[0]);
 }
 
 DEFUN (banner_motd_default,
index f1d70d7186c685436d6d40a564b7cf2cdbb9d2d4..6e6ab047f74d702ee18662b99eb732610e36cc02 100644 (file)
@@ -563,6 +563,8 @@ extern void host_config_set (const char *);
 
 extern void print_version (const char *);
 
+extern int cmd_banner_motd_file (const char *);
+
 /* struct host global, ick */
 extern struct host host; 
 
index 214279fac40f523640aba15188306151cb763f36..f31c5d623f34f6742d2162ce8475fb60182f7a41 100644 (file)
@@ -173,6 +173,14 @@ user_get (const char *name)
   return user;
 }
 
+DEFUN (banner_motd_file,
+       banner_motd_file_cmd,
+       "banner motd file [FILE]",
+       "\n\n\n\n")
+{
+  return cmd_banner_motd_file (argv[0]);
+}
+
 DEFUN (username_nopassword,
        username_nopassword_cmd,
        "username WORD nopassword",
@@ -222,4 +230,5 @@ vtysh_user_init (void)
 {
   userlist = list_new ();
   install_element (CONFIG_NODE, &username_nopassword_cmd);
+  install_element (CONFIG_NODE, &banner_motd_file_cmd);
 }