diff options
author | Daniel Walton <dwalton@cumulusnetworks.com> | 2015-07-28 05:30:22 +0200 |
---|---|---|
committer | Daniel Walton <dwalton@cumulusnetworks.com> | 2015-07-28 05:30:22 +0200 |
commit | 5689fe5fefdb6f9f4f5dcb73cc863f44db76aa78 (patch) | |
tree | aa155c345c9f4f2e763827f9f19982103724d5b2 /vtysh | |
parent | Cause warnings to not build correctly in debian packaging (diff) | |
download | frr-5689fe5fefdb6f9f4f5dcb73cc863f44db76aa78.tar.xz frr-5689fe5fefdb6f9f4f5dcb73cc863f44db76aa78.zip |
Quagga processes should not die if they read an unrecognized line in
their config file
Ticket: CM-6738
Reviewed By: Donald and Dinesh
Testing Done:
<DETAILED DESCRIPTION (REPLACE)>
Diffstat (limited to 'vtysh')
-rw-r--r-- | vtysh/vtysh.c | 10 | ||||
-rw-r--r-- | vtysh/vtysh.h | 2 | ||||
-rw-r--r-- | vtysh/vtysh_config.c | 19 |
3 files changed, 7 insertions, 24 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index b1c9f453b..d134c027b 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -662,7 +662,7 @@ vtysh_mark_file (const char *filename) } /* Configration make from file. */ -int +void vtysh_config_from_file (struct vty *vty, FILE *fp) { int ret; @@ -707,14 +707,15 @@ vtysh_config_from_file (struct vty *vty, FILE *fp) else { save_node = vty->node; - vtysh_execute ("end"); - vtysh_execute ("configure terminal"); vty->node = CONFIG_NODE; ret = cmd_execute_command_strict (vline, vty, &cmd); + + // If the command did not work at CONFIG_NODE either then ignore + // the command and go back to our previous node. if ((ret != CMD_SUCCESS) && (ret != CMD_SUCCESS_DAEMON) && (ret != CMD_WARNING)) - vty->node = save_node; + vty->node = save_node; } } @@ -758,7 +759,6 @@ vtysh_config_from_file (struct vty *vty, FILE *fp) } } } - return CMD_SUCCESS; } /* We don't care about the point of the cursor when '?' is typed. */ diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h index b7ad299e1..36128eed0 100644 --- a/vtysh/vtysh.h +++ b/vtysh/vtysh.h @@ -50,7 +50,7 @@ char *vtysh_prompt (void); void vtysh_config_write (void); -int vtysh_config_from_file (struct vty *, FILE *); +void vtysh_config_from_file (struct vty *, FILE *); int vtysh_mark_file(const char *filename); diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index b60b83120..47886ea46 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -368,7 +368,6 @@ vtysh_config_dump (FILE *fp) static void vtysh_read_file (FILE *confp) { - int ret; struct vty *vty; vty = vty_new (); @@ -380,28 +379,12 @@ vtysh_read_file (FILE *confp) vtysh_execute_no_pager ("configure terminal"); /* Execute configuration file. */ - ret = vtysh_config_from_file (vty, confp); + vtysh_config_from_file (vty, confp); vtysh_execute_no_pager ("end"); vtysh_execute_no_pager ("disable"); vty_close (vty); - - if (ret != CMD_SUCCESS) - { - switch (ret) - { - case CMD_ERR_AMBIGUOUS: - fprintf (stderr, "Ambiguous command.\n"); - break; - case CMD_ERR_NO_MATCH: - fprintf (stderr, "There is no such command.\n"); - break; - } - fprintf (stderr, "Error occured during reading below line.\n%s\n", - vty->buf); - exit (1); - } } /* Read up configuration file from config_default_dir. */ |