bgpd: Add clear command to force a bestpath recalculation and re-advertisement of a prefix
Add these commands to bgp:
clear ip bgp prefix A.B.C.D/M
clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M
These two commands forces a bestpath calculation to happen again if
necessary to re-advertise the prefix.
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 17b87f4..48645cf 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1602,7 +1602,8 @@
new_select = old_and_new.new;
/* Nothing to do. */
- if (old_select && old_select == new_select)
+ if (old_select && old_select == new_select
+ && !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR))
{
if (! CHECK_FLAG (old_select->flags, BGP_INFO_ATTR_CHANGED))
{
@@ -1616,6 +1617,9 @@
}
}
+ /* If the user did "clear ip bgp prefix x.x.x.x" this flag will be set */
+ UNSET_FLAG(rn->flags, BGP_NODE_USER_CLEAR);
+
if (old_select)
bgp_info_unset_flag (rn, old_select, BGP_INFO_SELECTED);
if (new_select)