From dcab1bb822161d55795aad59b14c5c5d79b71e1f Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Fri, 7 Dec 2012 16:45:52 +0000 Subject: bgpd: conditional default-originate using route-map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Incorporate a patch by Svetozar Mihailov which implements default-originate route-maps to behave as expected, i.e. allowing the default route to be advertised conditionally, depending on a criterion given by the route-map. I am aware that the performance attributes of the following implementation are far from optimal. However, this affects only code paths belonging to a feature that is broken without this patch, therefore, it seems reasonable to me to have this in the mainline for now. Cc: Svetozar Mihailov Reported-by: Sébastien Cramatte Signed-off-by: Christian Franke Signed-off-by: David Lamparter --- bgpd/bgp_nexthop.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bgpd/bgp_nexthop.c') diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 0e56d368..d4692366 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -506,6 +506,16 @@ bgp_scan (afi_t afi, safi_t safi) else if (afi == AFI_IP6) zlog_debug ("scanning IPv6 Unicast routing tables"); } + + /* Reevaluate default-originate route-maps and announce/withdraw + * default route if neccesary. */ + for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) + { + if (peer->status == Established + && CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE) + && peer->default_rmap[afi][safi].name) + bgp_default_originate (peer, afi, safi, 0); + } } /* BGP scan thread. This thread check nexthop reachability. */ -- cgit v1.2.1