]> git.puffer.fish Git - matthieu/frr.git/commitdiff
From: Hasso Tepper <hasso@estpak.ee>
authorpaul <paul>
Fri, 23 May 2003 09:25:20 +0000 (09:25 +0000)
committerpaul <paul>
Fri, 23 May 2003 09:25:20 +0000 (09:25 +0000)
Add the 'no interface' command to all the daemons and vtysh. now it's
possible to delete interface from routeing daemons as well only if it
doesn't exist in os.

http://hasso.linux.ee/zebra/ht-no_interface_fix.patch

lib/if.c
lib/if.h
ospf6d/ospf6d.c
ospfd/ospf_vty.c
ripngd/ripng_interface.c
vtysh/vtysh.c
zebra/interface.c

index e1a18393bd8601bead8b728fa45cbeccf21d8a03..2ca8c94bb0d3e59e54de95d7d8218bd46f2e309b 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -440,6 +440,32 @@ DEFUN (interface,
   return CMD_SUCCESS;
 }
 
+DEFUN_NOSH (no_interface,
+           no_interface_cmd,
+           "no interface IFNAME",
+           NO_STR
+           "Delete a pseudo interface's configuration\n"
+           "Interface's name\n")
+{
+  // deleting interface
+  struct interface *ifp;
+
+  ifp = if_lookup_by_name (argv[0]);
+
+  if (ifp == NULL)
+    return CMD_SUCCESS;
+
+  if (if_is_up(ifp)) {
+    vty_out (vty, "%% Only inactive interfaces can be deleted%s",
+            VTY_NEWLINE);
+    return CMD_WARNING;
+  }
+
+  if_delete(ifp);
+
+  return CMD_SUCCESS;
+}
+
 /* For debug purpose. */
 DEFUN (show_address,
        show_address_cmd,
index 554126fdedaca5f5fe8eb84dd2fb8457fa601ac7..9ffe74cfbf5045a8715e19af81b44f367cdfde45 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -220,6 +220,7 @@ extern list iflist;
 extern struct cmd_element interface_desc_cmd;
 extern struct cmd_element no_interface_desc_cmd;
 extern struct cmd_element interface_cmd;
+extern struct cmd_element no_interface_cmd;
 extern struct cmd_element interface_pseudo_cmd;
 extern struct cmd_element no_interface_pseudo_cmd;
 
index 8b50b5ab74e9c4b7ec26843a521fcce19c26fd65..04609ba8aaf5896d8764cffe29f175eb5c3ccf9d 100644 (file)
@@ -729,6 +729,7 @@ ospf6_init ()
   install_element (ENABLE_NODE, &reload_cmd);
   install_element (CONFIG_NODE, &router_ospf6_cmd);
   install_element (CONFIG_NODE, &interface_cmd);
+  install_element (CONFIG_NODE, &no_interface_cmd);
 #ifdef OSPF6_STATISTICS
   install_element (VIEW_NODE, &show_ipv6_ospf6_statistics_cmd);
   install_element (ENABLE_NODE, &show_ipv6_ospf6_statistics_cmd);
index 482ef6fcd2604c7c2c98585257849357a732bcb3..ed4b4fd1850feb5e994b0193be6dc421a9be73d6 100644 (file)
@@ -7377,6 +7377,7 @@ ospf_vty_if_init ()
   install_node (&interface_node, config_write_interface);
 
   install_element (CONFIG_NODE, &interface_cmd);
+  install_element (CONFIG_NODE, &no_interface_cmd);
   install_default (INTERFACE_NODE);
 
   /* "description" commands. */
index c177381a62d335063e576e437f16fa57e5b54c8f..369c3d6fb77875cedc5b65a4626097315879c506 100644 (file)
@@ -822,6 +822,7 @@ ripng_if_init ()
   install_node (&interface_node, interface_config_write);
 
   install_element (CONFIG_NODE, &interface_cmd);
+  install_element (CONFIG_NODE, &no_interface_cmd);
   install_element (INTERFACE_NODE, &config_end_cmd);
   install_element (INTERFACE_NODE, &config_exit_cmd);
   install_element (INTERFACE_NODE, &config_help_cmd);
index be1f03e4d5dc14de4cfc86c3808a600dd7a94fc8..f6ab603558869306c4d173bb038312f6f7fcf73a 100644 (file)
@@ -1165,6 +1165,13 @@ DEFUNSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD|VTYSH_OSPF6D,
   return CMD_SUCCESS;
 }
 
+DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D,
+       vtysh_no_interface_cmd,
+       "no interface IFNAME",
+       NO_STR
+       "Delete a pseudo interface's configuration\n"
+       "Interface's name\n")
+
 DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD,
        interface_desc_cmd,
        "description .LINE",
@@ -1838,6 +1845,7 @@ vtysh_init_vty ()
   install_element (KEYCHAIN_NODE, &key_chain_cmd);
   install_element (KEYCHAIN_KEY_NODE, &key_chain_cmd);
   install_element (CONFIG_NODE, &vtysh_interface_cmd);
+  install_element (CONFIG_NODE, &vtysh_no_interface_cmd);
   install_element (ENABLE_NODE, &vtysh_show_running_config_cmd);
   install_element (ENABLE_NODE, &vtysh_copy_runningconfig_startupconfig_cmd);
   install_element (ENABLE_NODE, &vtysh_write_file_cmd);
index ed3ece2580d75df7040327b1d20c9658131c51c2..c9f713208b9fa08b5c2a84f525c7ac4008adcbb9 100644 (file)
@@ -674,7 +674,7 @@ DEFUN_NOSH (zebra_interface,
   return ret;
 }
 
-DEFUN (no_zebra_interface,
+DEFUN_NOSH (no_zebra_interface,
        no_zebra_interface_cmd,
        "no interface IFNAME",
        "Delete a pseudo interface's configuration\n"
@@ -694,7 +694,7 @@ DEFUN (no_zebra_interface,
 
   if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
     {
-      vty_out(vty, "Only inactive interfaces can be deleted%s", VTY_NEWLINE);
+      vty_out(vty, "%% Only inactive interfaces can be deleted%s", VTY_NEWLINE);
       return CMD_WARNING;
     }