]> git.puffer.fish Git - mirror/frr.git/commitdiff
vtysh: fix markfile output for ldpd 866/head
authorRenato Westphal <renato@opensourcerouting.org>
Wed, 26 Jul 2017 22:37:49 +0000 (19:37 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Wed, 26 Jul 2017 22:44:49 +0000 (19:44 -0300)
Put the "end" marker in the right places. This should fix the
frr-reload.py script because it depends on the output of vtysh -m.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
vtysh/vtysh.c

index 395982189cf40d1ce7fd37d00451e1b953a73c3c..adf47ed57c2feab89fa866c9d352305cd576c93a 100644 (file)
@@ -498,6 +498,29 @@ int vtysh_mark_file(const char *filename)
                strcpy(vty_buf_copy, vty->buf);
                vty_buf_trimmed = trim(vty_buf_copy);
 
+               switch (vty->node) {
+               case LDP_IPV4_IFACE_NODE:
+                       if (strncmp(vty_buf_copy, "   ", 3)) {
+                               fprintf(stdout, "  end\n");
+                               vty->node = LDP_IPV4_NODE;
+                       }
+                       break;
+               case LDP_IPV6_IFACE_NODE:
+                       if (strncmp(vty_buf_copy, "   ", 3)) {
+                               fprintf(stdout, "  end\n");
+                               vty->node = LDP_IPV6_NODE;
+                       }
+                       break;
+               case LDP_PSEUDOWIRE_NODE:
+                       if (strncmp(vty_buf_copy, "  ", 2)) {
+                               fprintf(stdout, " end\n");
+                               vty->node = LDP_L2VPN_NODE;
+                       }
+                       break;
+               default:
+                       break;
+               }
+
                if (vty_buf_trimmed[0] == '!' || vty_buf_trimmed[0] == '#') {
                        fprintf(stdout, "%s", vty->buf);
                        continue;