From: Vipin Kumar <[email protected]>

Signed-off-by: Vipin Kumar <[email protected]>
---
 ospfd/ospf_main.c |  1 +
 ospfd/ospf_vty.c  | 45 +++++++++++++++++++++++++++++++++++++++++++++
 ospfd/ospf_vty.h  |  1 +
 3 files changed, 47 insertions(+)

diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c
index 1e4184f..dae0b8a 100644
--- a/ospfd/ospf_main.c
+++ b/ospfd/ospf_main.c
@@ -303,6 +303,7 @@ main (int argc, char **argv)
   /* OSPF vty inits. */
   ospf_vty_init ();
   ospf_vty_show_init ();
+  ospf_vty_clear_init ();
 
   ospf_route_map_init ();
 #ifdef HAVE_SNMP
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 45a19c0..179b734 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -7769,6 +7769,51 @@ static struct cmd_node ospf_node =
   1
 };
 
+static void
+ospf_interface_clear (struct interface *ifp)
+{
+  if (!if_is_operative (ifp)) return;
+
+  if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
+    zlog (NULL, LOG_DEBUG, "ISM[%s]: clear by reset", ifp->name);
+
+  ospf_if_reset(ifp);
+}
+
+DEFUN (clear_ip_ospf_interface,
+       clear_ip_ospf_interface_cmd,
+       "clear ip ospf interface [IFNAME]",
+       CLEAR_STR
+       IP_STR
+       "OSPF information\n"
+       "Interface information\n"
+       "Interface name\n")
+{
+  struct interface *ifp;
+  struct listnode *node;
+
+  if (argc == 0) /* Clear all the ospfv2 interfaces. */
+    {
+      for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+        ospf_interface_clear(ifp);
+    }
+  else /* Interface name is specified. */
+    {
+      if ((ifp = if_lookup_by_name (argv[0])) == NULL)
+        vty_out (vty, "No such interface name%s", VTY_NEWLINE);
+      else
+        ospf_interface_clear(ifp);
+    }
+
+  return CMD_SUCCESS;
+}
+
+void
+ospf_vty_clear_init (void)
+{
+  install_element (ENABLE_NODE, &clear_ip_ospf_interface_cmd);
+}
+
 
 /* Install OSPF related vty commands. */
 void
diff --git a/ospfd/ospf_vty.h b/ospfd/ospf_vty.h
index da0ed1c..28bb419 100644
--- a/ospfd/ospf_vty.h
+++ b/ospfd/ospf_vty.h
@@ -53,5 +53,6 @@
 /* Prototypes. */
 extern void ospf_vty_init (void);
 extern void ospf_vty_show_init (void);
+extern void ospf_vty_clear_init (void);
 
 #endif /* _QUAGGA_OSPF_VTY_H */
-- 
1.9.1


_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to