]> git.puffer.fish Git - mirror/frr.git/commitdiff
vtysh: warn on cli targeting non-running daemon 1195/head
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 18 Sep 2017 16:35:10 +0000 (12:35 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 18 Sep 2017 16:35:10 +0000 (12:35 -0400)
Presently CLI entered for daemons which are not running is accepted
quietly, which can be confusing for users. This patch warns about it
when possible.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
vtysh/vtysh.c

index e8968ab896326cc728da116c150b3a463fe4546c..78e64c1509d65bf4c24f7ce8d0c1299eb0fb0c6a 100644 (file)
@@ -425,6 +425,12 @@ static int vtysh_execute_func(const char *line, int pager)
                cmd_stat = CMD_SUCCESS;
                for (i = 0; i < array_size(vtysh_client); i++) {
                        if (cmd->daemon & vtysh_client[i].flag) {
+                               if (vtysh_client[i].fd < 0
+                                   && (cmd->daemon == vtysh_client[i].flag)) {
+                                       fprintf(stderr, "%s is not running\n",
+                                               vtysh_client[i].name);
+                                       continue;
+                               }
                                cmd_stat = vtysh_client_execute(
                                        &vtysh_client[i], line, fp);
                                if (cmd_stat != CMD_SUCCESS)