From: Nitin Soni Date: Tue, 12 Mar 2019 05:57:51 +0000 (-0700) Subject: bgpd: handle all afi safi while bgp clear soft X-Git-Tag: 7.1_pulled~118^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=99b3ebd3b921ecc6a1fb6d8ca112241640cffe13;p=mirror%2Ffrr.git bgpd: handle all afi safi while bgp clear soft Currently, as part of bgp clear soft inboud and outbound we don't handle l2vpn evpn. Now clearing soft for all supported afi safi. One of the examples where this was a problem - On applying graceful-shutdown, bgp clear soft inboud and outbound don't handle AFI L2VPN and SAFI EVPN. Gshut gets applied to EVPN Type 5 routes by asking peer to refresh the routes (provided we have config - "advertise ipv4/ipv6 unicast" as part of l2vpn evpn) but is not applied to type 2 and type 3 EVP routes. This fix takes care of l2vpn evpn type2 and type3 routes being readvertised with gshut community. This fix also fixes similar issues related to following where bgp clear soft is requred for l2vpn evpn - -config bgp cluster-id -config bgp client-to-client reflection -config bgp default local-preference -config bgp route-reflector allow-outbound-policy -config bgp disable-ebgp-connected-route-check Ticket: CM-22813 Signed-off-by: Nitin Soni Reviewed-by: CCR-8361 Testing-Done: -With gshut configured on all BGP VRFs (operator has to know about the auto-created BGP VRFs - we do show them in show commands - and turn on graceful-shutdown in all of them. -We announce all EVPN routes (type-2, type-3 and type-5) with GSHUT and we mark IPv4/IPv6 routes in a VRF that are based on received EVPN type-2 or type-5 routes with local pref 0. -On the receiver side, when EVPN routes are received with GSHUT, the correct handling takes place (to treat them with local preference 0, and hence not select them) -When the gshut configuration is removed on all BGP VRFs, we re-announce all of our EVPN routes without GSHUT and receiver does the appropriate thing. Also, we no longer mark EVPN-based IPv4/IPv6 routes with local pref 0. -evpn-smoke -bgp-smoke --- diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index b059ef2205..1d5cae55c2 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -771,19 +771,23 @@ static int bgp_clear_vty(struct vty *vty, const char *name, afi_t afi, /* clear soft inbound */ static void bgp_clear_star_soft_in(struct vty *vty, const char *name) { - bgp_clear_vty(vty, name, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); - bgp_clear_vty(vty, name, AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); + afi_t afi; + safi_t safi; + + FOREACH_AFI_SAFI (afi, safi) + bgp_clear_vty(vty, name, afi, safi, clear_all, + BGP_CLEAR_SOFT_IN, NULL); } /* clear soft outbound */ static void bgp_clear_star_soft_out(struct vty *vty, const char *name) { - bgp_clear_vty(vty, name, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); - bgp_clear_vty(vty, name, AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); + afi_t afi; + safi_t safi; + + FOREACH_AFI_SAFI (afi, safi) + bgp_clear_vty(vty, name, afi, safi, clear_all, + BGP_CLEAR_SOFT_OUT, NULL); }