From f007bdcef1898ce65826fac7e9b7def5bcd1ca09 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Mon, 25 Feb 2019 10:07:05 -0800 Subject: [PATCH] bgpd: fix evpn type-5 implicit withdraw processing Withdraw flag is not sufficient to call bgp_update vs. bgp_withdraw() processing for a given BGP evpn update message. When a bgp update needs to be treated as an implicit withdraw (e.g., due to malformed attribute), the code wasn't handling things properly. Rearranging attribute pass field to type-5 route processing and aligning similar to done for other routes (type2/type-3). Ticket:CM-24003 Reviewed By:CCR-8330 Testing Done: Singed-off-by: Chirag Shah --- bgpd/bgp_evpn.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 1471bd9829..ce688c8d1a 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -3935,7 +3935,7 @@ static int process_type4_route(struct peer *peer, afi_t afi, safi_t safi, */ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi, struct attr *attr, uint8_t *pfx, int psize, - uint32_t addpath_id, int withdraw) + uint32_t addpath_id) { struct prefix_rd prd; struct prefix_evpn p; @@ -4021,7 +4021,7 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi, */ /* Process the route. */ - if (!withdraw) + if (attr) ret = bgp_update(peer, (struct prefix *)&p, addpath_id, attr, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, &label, 1, 0, &evpn); @@ -4873,8 +4873,9 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, break; case BGP_EVPN_IP_PREFIX_ROUTE: - if (process_type5_route(peer, afi, safi, attr, pnt, - psize, addpath_id, withdraw)) { + if (process_type5_route(peer, afi, safi, + withdraw ? NULL : attr, pnt, + psize, addpath_id)) { flog_err( EC_BGP_PKT_PROCESS, "%u:%s - Error in processing EVPN type-5 NLRI size %d", -- 2.39.5