]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Fix spurious error messages in EVPN type-5 route injection/withdraw
authorvivek <vivek@cumulusnetworks.com>
Fri, 5 Jan 2018 20:41:25 +0000 (12:41 -0800)
committermitesh <mitesh@cumulusnetworks.com>
Wed, 24 Jan 2018 00:27:26 +0000 (16:27 -0800)
Ensure that spurious error messages are not generated in a non-EVPN configuration
when routes in a VRF get deleted or added. Also, check on EVPN advertisement
being enabled before walking VRF routing table.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-19206
Reviewed By: CCR-7073
Testing Done:
1. Recreate errors and validate fix
2. Type-5 route related testing - new routes, neighbor flap etc.

bgpd/bgp_evpn.c

index 35703a759120c22667d05d3776b13c3f0d517513..438b29b4ef4fb519e5776d01ceda6e5ae44aefc6 100644 (file)
@@ -1082,7 +1082,7 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf,
 
        bgp_def = bgp_get_default();
        if (!bgp_def)
-               return -1;
+               return 0;
 
        /* Build path attribute for this route - use the source attr, if
         * present, else treat as locally originated.
@@ -1362,7 +1362,7 @@ static int delete_evpn_type5_route(struct bgp *bgp_vrf,
 
        bgp_def = bgp_get_default();
        if (!bgp_def)
-               return -1;
+               return 0;
 
        /* locate the global route entry for this type-5 prefix */
        rn = bgp_afi_node_lookup(bgp_def->rib[afi][safi], afi, safi,
@@ -3204,6 +3204,10 @@ void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf, struct prefix *p,
        struct prefix_evpn evp;
        char buf[PREFIX_STRLEN];
 
+       /* NOTE: Check needed as this is called per-route also. */
+       if (!advertise_type5_routes(bgp_vrf, afi))
+               return;
+
        build_type5_prefix_from_ip_prefix(&evp, p);
        ret = delete_evpn_type5_route(bgp_vrf, &evp);
        if (ret) {
@@ -3222,6 +3226,7 @@ void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf,
        struct bgp_table *table = NULL;
        struct bgp_node *rn = NULL;
 
+       /* Bail out early if we don't have to advertise type-5 routes. */
        if (!advertise_type5_routes(bgp_vrf, afi))
                return;
 
@@ -3245,6 +3250,7 @@ void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p,
        struct prefix_evpn evp;
        char buf[PREFIX_STRLEN];
 
+       /* NOTE: Check needed as this is called per-route also. */
        if (!advertise_type5_routes(bgp_vrf, afi))
                return;
 
@@ -3272,6 +3278,10 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf,
        struct bgp_node *rn = NULL;
        struct bgp_info *ri;
 
+       /* Bail out early if we don't have to advertise type-5 routes. */
+       if (!advertise_type5_routes(bgp_vrf, afi))
+               return;
+
        table = bgp_vrf->rib[afi][safi];
        for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
                /* Need to identify the "selected" route entry to use its