]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: allow 'do' commands in ENABLE_NODE
authorQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 14 Jun 2017 19:47:14 +0000 (19:47 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 19 Sep 2017 15:22:35 +0000 (11:22 -0400)
'do' is syntax sugar that allows the user to execute a command under
ENABLE_NODE when in another CLI node. If the user is already in
ENABLE_NODE, use of 'do' was previously disallowed. This patch allows it
because it makes it easier for us to hack around certain instances of
the node synchronization problem with vtysh.

Also included is a fix for one of these problems.

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

index 444305d5d5c00b0ca0d9d472dbf0d37b2d0b11f3..cd4008d7cc4893c4ab5fc6d2750c8c87da10996f 100644 (file)
@@ -758,8 +758,7 @@ static struct graph *cmd_node_graph(vector v, enum node_type ntype)
 static int cmd_try_do_shortcut(enum node_type node, char *first_word)
 {
        if (first_word != NULL && node != AUTH_NODE && node != VIEW_NODE
-           && node != AUTH_ENABLE_NODE && node != ENABLE_NODE
-           && 0 == strcmp("do", first_word))
+           && node != AUTH_ENABLE_NODE && 0 == strcmp("do", first_word))
                return 1;
        return 0;
 }
index bfa9af62a50a9ee00d4043ac1fd8cb958d07c68c..fa31459c2a84509091aedaa653c61cc4d5fcd619 100644 (file)
@@ -2053,7 +2053,7 @@ static void backup_config_file(const char *fbackup)
 int vtysh_write_config_integrated(void)
 {
        u_int i;
-       char line[] = "write terminal\n";
+       char line[] = "do write terminal\n";
        FILE *fp;
        int fd;
        struct passwd *pwentry;
@@ -2173,7 +2173,7 @@ DEFUN (vtysh_write_memory,
                                break;
                if (i < array_size(vtysh_client) && vtysh_client[i].fd != -1)
                        ret = vtysh_client_execute(&vtysh_client[i],
-                                                  "write integrated", stdout);
+                                                  "do write integrated", stdout);
 
                if (ret != CMD_SUCCESS) {
                        printf("\nWarning: attempting direct configuration write without "