From: Hasso Tepper <hasso@estpak.ee>

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
diff --git a/lib/if.c b/lib/if.c
index e1a1839..2ca8c94 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -440,6 +440,32 @@
   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,
diff --git a/lib/if.h b/lib/if.h
index 554126f..9ffe74c 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -220,6 +220,7 @@
 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;
 
diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c
index 8b50b5a..04609ba 100644
--- a/ospf6d/ospf6d.c
+++ b/ospf6d/ospf6d.c
@@ -729,6 +729,7 @@
   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);
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 482ef6f..ed4b4fd 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -7377,6 +7377,7 @@
   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. */
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index c177381..369c3d6 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -822,6 +822,7 @@
   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);
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index be1f03e..f6ab603 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -1165,6 +1165,13 @@
   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 @@
   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);
diff --git a/zebra/interface.c b/zebra/interface.c
index ed3ece2..c9f7132 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -674,7 +674,7 @@
   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 @@
 
   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;
     }