diff options
author | paul <paul> | 2003-05-24 06:40:04 +0000 |
---|---|---|
committer | paul <paul> | 2003-05-24 06:40:04 +0000 |
commit | bfc135325e9b0768c78b51c9495eb0fbabc59db6 (patch) | |
tree | c754c2132248a7436ca8012d383a73f89fcc66ef | |
parent | fd2dfce21bb21cc2f3d6de723812875ec7abc1f5 (diff) |
From: Hasso Tepper <hasso@estpak.ee>
ensure only interfaces that are inactive or do not exist can be deleted
-rw-r--r-- | lib/if.c | 8 | ||||
-rw-r--r-- | zebra/interface.c | 32 |
2 files changed, 7 insertions, 33 deletions
@@ -453,9 +453,13 @@ DEFUN_NOSH (no_interface, ifp = if_lookup_by_name (argv[0]); if (ifp == NULL) - return CMD_SUCCESS; + { + vty_out (vty, "%% Inteface %s does not exist%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } - if (if_is_up(ifp)) { + if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) + { vty_out (vty, "%% Only inactive interfaces can be deleted%s", VTY_NEWLINE); return CMD_WARNING; diff --git a/zebra/interface.c b/zebra/interface.c index c9f71320..f2374316 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -674,36 +674,6 @@ DEFUN_NOSH (zebra_interface, return ret; } -DEFUN_NOSH (no_zebra_interface, - no_zebra_interface_cmd, - "no interface IFNAME", - "Delete a pseudo interface's configuration\n" - "Interface's name\n") -{ - struct interface *ifp; - - ifp = if_lookup_by_name(argv[0]); - - if (ifp == NULL) - { - vty_out (vty, "Inteface %s does not exist%s", - argv[0], - VTY_NEWLINE); - return CMD_WARNING; - } - - if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) - { - vty_out(vty, "%% Only inactive interfaces can be deleted%s", VTY_NEWLINE); - return CMD_WARNING; - } - - /* Delete interface */ - if_delete(ifp); - - return CMD_SUCCESS; -} - struct cmd_node interface_node = { INTERFACE_NODE, @@ -1431,7 +1401,7 @@ zebra_if_init () install_element (VIEW_NODE, &show_interface_cmd); install_element (ENABLE_NODE, &show_interface_cmd); install_element (CONFIG_NODE, &zebra_interface_cmd); - install_element (CONFIG_NODE, &no_zebra_interface_cmd); + install_element (CONFIG_NODE, &no_interface_cmd); install_default (INTERFACE_NODE); install_element (INTERFACE_NODE, &interface_desc_cmd); install_element (INTERFACE_NODE, &no_interface_desc_cmd); |