diff -c --recursive z.old/lib/command.c zebra-0.88/lib/command.c *** z.old/lib/command.c Sun Jul 30 18:53:53 2000 --- zebra-0.88/lib/command.c Thu Sep 14 14:49:19 2000 *************** *** 1905,1912 **** int config_from_file (struct vty *vty, FILE *fp) { ! int ret; vector vline; while (fgets (vty->buf, VTY_BUFSIZ, fp)) { --- 1905,1916 ---- int config_from_file (struct vty *vty, FILE *fp) { ! int ret, nodes, i; vector vline; + enum node_type node[VERY_LAST_NODE]; + + nodes = 0; + node[nodes++] = vty->node; while (fgets (vty->buf, VTY_BUFSIZ, fp)) { *************** *** 1921,1944 **** /* Try again with setting node to CONFIG_NODE */ if (ret != CMD_SUCCESS && ret != CMD_WARNING) { ! if (vty->node == KEYCHAIN_KEY_NODE) ! { ! vty->node = KEYCHAIN_NODE; ! ! ret = cmd_execute_command_strict (cmdvec, vline, vty); ! ! if (ret != CMD_SUCCESS && ret != CMD_WARNING) ! { ! vty->node = CONFIG_NODE; ! ret = cmd_execute_command_strict (cmdvec, vline, vty); ! } ! } ! else ! { ! vty->node = CONFIG_NODE; ! ret = cmd_execute_command_strict (cmdvec, vline, vty); ! } } cmd_free_strvec (vline); --- 1925,1947 ---- /* Try again with setting node to CONFIG_NODE */ if (ret != CMD_SUCCESS && ret != CMD_WARNING) { ! for (i = 0; i < nodes; i++) { ! vty->node = node[i]; ! ret = cmd_execute_command_strict (cmdvec, vline, vty); ! if (ret == CMD_SUCCESS || ret == CMD_WARNING) ! break; ! } } + if (ret == CMD_SUCCESS || ret == CMD_WARNING) + { + /* remember any nodes that we have visited so we can try them on + errors later */ + for (i = 0; i < nodes; i++) + if (node[i] == vty->node) + break; + if (i >= nodes) + node[nodes++] = vty->node; + } cmd_free_strvec (vline); diff -c --recursive z.old/lib/command.h zebra-0.88/lib/command.h *** z.old/lib/command.h Wed Jul 12 12:10:16 2000 --- zebra-0.88/lib/command.h Thu Sep 14 14:21:36 2000 *************** *** 100,106 **** RMAP_NODE, /* Route map node. */ SMUX_NODE, /* SNMP configuration node. */ DUMP_NODE, /* Packet dump node. */ ! VTY_NODE /* Vty node. */ }; /* Node which has some commands and prompt string and configuration --- 100,108 ---- RMAP_NODE, /* Route map node. */ SMUX_NODE, /* SNMP configuration node. */ DUMP_NODE, /* Packet dump node. */ ! VTY_NODE, /* Vty node. */ ! ! VERY_LAST_NODE /* keep this last :-) */ }; /* Node which has some commands and prompt string and configuration