summaryrefslogtreecommitdiffstats
path: root/ripngd
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-11-17 19:33:09 +0100
committerRenato Westphal <renato@opensourcerouting.org>2016-11-25 14:46:06 +0100
commitd7f966abed5f822e6f90442de5ccbf848be01b64 (patch)
tree667ae29fe754bff080b778c655944a083200afdf /ripngd
parentripngd: implement optional heuristic suggested by RFC 2080 (diff)
downloadfrr-d7f966abed5f822e6f90442de5ccbf848be01b64.tar.xz
frr-d7f966abed5f822e6f90442de5ccbf848be01b64.zip
ripngd: implement the "clear ipv6 ripng" vty command
This command deletes all received routes from the RIPng routing table. It should be used with caution as it can create black holes in the network (until it reconverges). Very useful to make automated testing (e.g. ANVL) more predictable. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripngd')
-rw-r--r--ripngd/ripngd.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 96206e2b0..82c487748 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -2170,6 +2170,54 @@ DEFUN (show_ipv6_ripng_status,
return CMD_SUCCESS;
}
+DEFUN (clear_ipv6_rip,
+ clear_ipv6_rip_cmd,
+ "clear ipv6 ripng",
+ CLEAR_STR
+ IPV6_STR
+ "Clear IPv6 RIP database")
+{
+ struct route_node *rp;
+ struct ripng_info *rinfo;
+ struct list *list;
+ struct listnode *listnode;
+
+ /* Clear received RIPng routes */
+ for (rp = route_top (ripng->table); rp; rp = route_next (rp))
+ {
+ list = rp->info;
+ if (list == NULL)
+ continue;
+
+ for (ALL_LIST_ELEMENTS_RO (list, listnode, rinfo))
+ {
+ if (! ripng_route_rte (rinfo))
+ continue;
+
+ if (CHECK_FLAG (rinfo->flags, RIPNG_RTF_FIB))
+ ripng_zebra_ipv6_delete (rp);
+ break;
+ }
+
+ if (rinfo)
+ {
+ RIPNG_TIMER_OFF (rinfo->t_timeout);
+ RIPNG_TIMER_OFF (rinfo->t_garbage_collect);
+ listnode_delete (list, rinfo);
+ ripng_info_free (rinfo);
+ }
+
+ if (list_isempty (list))
+ {
+ list_free (list);
+ rp->info = NULL;
+ route_unlock_node (rp);
+ }
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN (router_ripng,
router_ripng_cmd,
"router ripng",
@@ -3047,6 +3095,8 @@ ripng_init ()
install_element (VIEW_NODE, &show_ipv6_ripng_cmd);
install_element (VIEW_NODE, &show_ipv6_ripng_status_cmd);
+ install_element (ENABLE_NODE, &clear_ipv6_rip_cmd);
+
install_element (CONFIG_NODE, &router_ripng_cmd);
install_element (CONFIG_NODE, &no_router_ripng_cmd);