From e2b20dfb3306d48868343587f79133b90b8bd842 Mon Sep 17 00:00:00 2001 From: vivek Date: Tue, 9 Jun 2020 22:15:33 -0700 Subject: [PATCH 1/9] zebra: Reset MAC's remote sequence number appropriately When a MAC gets deleted but associated neighbors remain, the MAC is kept in the zebra MAC database as an internal ("auto") entry. When this happens, reset the MAC's remote sequence number. This ensures that when the host with the MAC later comes up behind a remote VTEP, the local switch accepts the MAC and installs it into the bridge FDB and we don't end up in a situation where remote MACs are not installed into the bridge FDB. This fix is a corollary of CM-22753 and is this time done for local MACs upon delete. Note: Commit is marked Cumulus-only because I need to evalute more comprehensive changes before upstreaming it. Ticket: CM-29581 Reviewed By: As above Testing Done: 1. Multiple rounds of manual testing 2. Two rounds of evpn-smoke, 1 round of precommit Signed-off-by: Vivek Venkatraman Acked-by: Chirag Shah Acked-by: Anuradha Karuppiah --- zebra/zebra_evpn_mac.c | 2 ++ zebra/zebra_vxlan.c | 1 + 2 files changed, 3 insertions(+) diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index 0d53591336..f9009dabb7 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -1152,6 +1152,7 @@ int zebra_evpn_mac_del(struct zebra_evpn *zevpn, struct zebra_mac *mac) listcount(mac->neigh_list)); SET_FLAG(mac->flags, ZEBRA_MAC_AUTO); + mac->rem_seq = 0; return 0; } @@ -2411,6 +2412,7 @@ int zebra_evpn_del_local_mac(struct zebra_evpn *zevpn, struct zebra_mac *mac, UNSET_FLAG(mac->flags, ZEBRA_MAC_ALL_LOCAL_FLAGS); UNSET_FLAG(mac->flags, ZEBRA_MAC_STICKY); SET_FLAG(mac->flags, ZEBRA_MAC_AUTO); + mac->rem_seq = 0; } return 0; diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index ad112a4ab1..bc4f343898 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -4403,6 +4403,7 @@ static int zebra_vxlan_check_del_local_mac(struct interface *ifp, UNSET_FLAG(mac->flags, ZEBRA_MAC_ALL_LOCAL_FLAGS); UNSET_FLAG(mac->flags, ZEBRA_MAC_STICKY); SET_FLAG(mac->flags, ZEBRA_MAC_AUTO); + mac->rem_seq = 0; } return 0; From f8c464688d8ca2aa5250ae6828baee1daf06ea93 Mon Sep 17 00:00:00 2001 From: vivek Date: Wed, 9 Jun 2021 13:56:22 -0700 Subject: [PATCH 2/9] bgpd: Check L3VNI status before announcing default Check that the L3VNI is "up" before taking action to announce or withdraw the EVPN type-5 default based on configuration. Otherwise, there can be timing conditions where a EVPN type-5 default route gets announced without a VNI and with invalid route targets. Signed-off-by: Vivek Venkatraman Ticket: #2684144 Reviewed By: Chirag Shah Testing Done: 1. Rerun failed test multiple times successfully 2. Some manual testing 3. precommit and partial evpn-smoke --- bgpd/bgp_evpn_vty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 958a9c6492..338f5cefee 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -3469,7 +3469,9 @@ static void evpn_process_default_originate_cmd(struct bgp *bgp_vrf, BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6); } - bgp_evpn_install_uninstall_default_route(bgp_vrf, afi, safi, add); + if (is_l3vni_live(bgp_vrf)) + bgp_evpn_install_uninstall_default_route(bgp_vrf, + afi, safi, add); } /* From b3facc23df0ff09819f49a12cd0e48a2ddd5e354 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 10 Jun 2021 10:54:11 -0400 Subject: [PATCH 3/9] zebra: Reduce memory usage of streams for encoding packets For those packets that we are not sending 16k of data, but something far less than 256 bytes. Reduce those stream sizes we allocate to something much more reasonable. Signed-off-by: Donald Sharp --- zebra/zapi_msg.c | 34 ++++++++++++++++------------------ zebra/zebra_mpls.c | 2 +- zebra/zebra_mroute.c | 2 +- zebra/zebra_vxlan.c | 6 +++--- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 10acee9be4..d269cdd015 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -282,7 +282,7 @@ int zsend_interface_address(int cmd, struct zserv *client, { int blen; struct prefix *p; - struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + struct stream *s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, cmd, ifp->vrf->vrf_id); stream_putl(s, ifp->ifindex); @@ -323,7 +323,7 @@ static int zsend_interface_nbr_address(int cmd, struct zserv *client, struct nbr_connected *ifc) { int blen; - struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + struct stream *s = stream_new(ZEBRA_SMALL_PACKET_SIZE); struct prefix *p; zclient_create_header(s, cmd, ifp->vrf->vrf_id); @@ -651,7 +651,7 @@ static int zsend_nexthop_lookup_mrib(struct zserv *client, struct ipaddr *addr, struct nexthop *nexthop; /* Get output stream. */ - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); stream_reset(s); /* Fill in result. */ @@ -706,7 +706,7 @@ int zsend_nhg_notify(uint16_t type, uint16_t instance, uint32_t session_id, zlog_debug("%s: type %d, id %d, note %s", __func__, type, id, zapi_nhg_notify_owner2str(note)); - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); stream_reset(s); zclient_create_header(s, ZEBRA_NHG_NOTIFY_OWNER, VRF_DEFAULT); @@ -835,7 +835,7 @@ void zsend_rule_notify_owner(const struct zebra_dplane_ctx *ctx, if (!client) return; - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, ZEBRA_RULE_NOTIFY_OWNER, dplane_ctx_rule_get_vrfid(ctx)); @@ -889,7 +889,7 @@ void zsend_iptable_notify_owner(const struct zebra_dplane_ctx *ctx, if (!client) return; - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, cmd, VRF_DEFAULT); stream_putw(s, note); @@ -923,7 +923,7 @@ void zsend_ipset_notify_owner(const struct zebra_dplane_ctx *ctx, if (!client) return; - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, cmd, VRF_DEFAULT); stream_putw(s, note); @@ -959,7 +959,7 @@ void zsend_ipset_entry_notify_owner(const struct zebra_dplane_ctx *ctx, if (!client) return; - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, cmd, VRF_DEFAULT); stream_putw(s, note); @@ -1049,13 +1049,12 @@ int zsend_router_id_update(struct zserv *client, afi_t afi, struct prefix *p, vrf_id_t vrf_id) { int blen; - struct stream *s; /* Check this client need interface information. */ if (!vrf_bitmap_check(&client->ridinfo[afi], vrf_id)) return 0; - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + struct stream *s = stream_new(ZEBRA_SMALL_PACKET_SIZE); /* Message type. */ zclient_create_header(s, ZEBRA_ROUTER_ID_UPDATE, vrf_id); @@ -1077,7 +1076,7 @@ int zsend_router_id_update(struct zserv *client, afi_t afi, struct prefix *p, */ int zsend_pw_update(struct zserv *client, struct zebra_pw *pw) { - struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + struct stream *s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, ZEBRA_PW_STATUS_UPDATE, pw->vrf_id); stream_write(s, pw->ifname, IFNAMSIZ); @@ -1094,7 +1093,7 @@ int zsend_pw_update(struct zserv *client, struct zebra_pw *pw) int zsend_assign_label_chunk_response(struct zserv *client, vrf_id_t vrf_id, struct label_manager_chunk *lmc) { - struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + struct stream *s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, ZEBRA_GET_LABEL_CHUNK, vrf_id); /* proto */ @@ -1120,7 +1119,7 @@ int zsend_assign_label_chunk_response(struct zserv *client, vrf_id_t vrf_id, int zsend_label_manager_connect_response(struct zserv *client, vrf_id_t vrf_id, unsigned short result) { - struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + struct stream *s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, ZEBRA_LABEL_MANAGER_CONNECT, vrf_id); @@ -1144,7 +1143,7 @@ static int zsend_assign_table_chunk_response(struct zserv *client, vrf_id_t vrf_id, struct table_manager_chunk *tmc) { - struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + struct stream *s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, ZEBRA_GET_TABLE_CHUNK, vrf_id); @@ -1164,7 +1163,7 @@ static int zsend_table_manager_connect_response(struct zserv *client, vrf_id_t vrf_id, uint16_t result) { - struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + struct stream *s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, ZEBRA_TABLE_MANAGER_CONNECT, vrf_id); @@ -2406,7 +2405,7 @@ stream_failure: static void zsend_capabilities(struct zserv *client, struct zebra_vrf *zvrf) { - struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + struct stream *s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, ZEBRA_CAPABILITIES, zvrf->vrf->vrf_id); stream_putl(s, vrf_get_backend()); @@ -3990,8 +3989,7 @@ static inline void zebra_gre_source_set(ZAPI_HANDLER_ARGS) static void zsend_error_msg(struct zserv *client, enum zebra_error_types error, struct zmsghdr *bad_hdr) { - - struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + struct stream *s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, ZEBRA_ERROR, bad_hdr->vrf_id); diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 0d3fd2a726..3325532ca9 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -466,7 +466,7 @@ static int fec_send(struct zebra_fec *fec, struct zserv *client) rn = fec->rn; /* Get output stream. */ - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, ZEBRA_FEC_UPDATE, VRF_DEFAULT); diff --git a/zebra/zebra_mroute.c b/zebra/zebra_mroute.c index 881b681c2f..86e25469ba 100644 --- a/zebra/zebra_mroute.c +++ b/zebra/zebra_mroute.c @@ -61,7 +61,7 @@ void zebra_ipmr_route_stats(ZAPI_HANDLER_ARGS) suc = kernel_get_ipmr_sg_stats(zvrf, &mroute); stream_failure: - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); stream_reset(s); diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index bc4f343898..c60eeab946 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -2203,7 +2203,7 @@ static int zl3vni_send_add_to_client(struct zebra_l3vni *zl3vni) is_anycast_mac = false; } - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); /* The message is used for both vni add and/or update like * vrr mac is added for l3vni SVI. @@ -2246,7 +2246,7 @@ static int zl3vni_send_del_to_client(struct zebra_l3vni *zl3vni) if (!client) return 0; - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, ZEBRA_L3VNI_DEL, zl3vni_vrf_id(zl3vni)); stream_putl(s, zl3vni->vni); @@ -5861,7 +5861,7 @@ static int zebra_vxlan_sg_send(struct zebra_vrf *zvrf, if (!CHECK_FLAG(zvrf->flags, ZEBRA_PIM_SEND_VXLAN_SG)) return 0; - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); zclient_create_header(s, cmd, VRF_DEFAULT); stream_putl(s, IPV4_MAX_BYTELEN); From e57ad2fbcd33c00525895759118c12350a97c1bc Mon Sep 17 00:00:00 2001 From: Anuradha Karuppiah Date: Fri, 18 Jun 2021 08:38:54 -0700 Subject: [PATCH 4/9] pimd: skip init of mlag roles based on the zebra capabilities message Looks like the cap setting was added for testing mlag via zebra test cli to config the mlag role. However it is interfering with the valid state updates rxed from the MLAG daemon based on timing (in some cases the MLAG state changes are rxed before the capabilities). Reference logs - >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> root@TORC11:mgmt:/home/cumulus# grep -ri "my_role\|MlagRole" /var/log/frr/bgpd.log 2021/06/18 13:26:40.380130 PIM: pim_mlag_process_mlagd_state_change: msg dump: my_role: SECONDARY, peer_state: DOWN 2021/06/18 13:26:40.380766 PIM: pim_mlag_process_mlagd_state_change: msg dump: my_role: SECONDARY, peer_state: DOWN 2021/06/18 13:26:41.382258 PIM: pim_mlag_process_mlagd_state_change: msg dump: my_role: SECONDARY, peer_state: RUNNING 2021/06/18 13:26:41.382379 PIM: pim_mlag_process_mlagd_state_change: msg dump: my_role: PRIMARY, peer_state: RUNNING 2021/06/18 13:26:52.386071 ZEBRA: Sending capabilities to client pim: MPLS enabled numMultipath 128 GR disabled MaintMode off MlagRole 0 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Ticket: #2691629 Signed-off-by: Anuradha Karuppiah --- pimd/pim_zebra.c | 1 - 1 file changed, 1 deletion(-) diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index ce4d85a2c8..f0ec3c6b6e 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -426,7 +426,6 @@ static void pim_zebra_connected(struct zclient *zclient) static void pim_zebra_capabilities(struct zclient_capabilities *cap) { - router->mlag_role = cap->role; router->multipath = cap->ecmp; } From a72d1a112485465c9eaba05a7e487a8ad9f0f22d Mon Sep 17 00:00:00 2001 From: Wesley Coakley Date: Wed, 28 Jul 2021 21:37:44 -0400 Subject: [PATCH 5/9] pbrd: fix vrf_unchanged which may depend on other seqs Ticket: 2740911 Signed-off-by: Wesley Coakley --- pbrd/pbr_map.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pbrd/pbr_map.c b/pbrd/pbr_map.c index 8f7a46377c..ea0e2e4eaf 100644 --- a/pbrd/pbr_map.c +++ b/pbrd/pbr_map.c @@ -732,6 +732,14 @@ void pbr_map_schedule_policy_from_nhg(const char *nh_group, bool installed) pbr_map_check(pbrms, false); } + + /* + * vrf_unchanged pbrms have no nhg but their + * installation is contingent on other sequences which + * may... + */ + if (pbrms->vrf_unchanged) + pbr_map_check(pbrms, false); } } } From 5fba3c4d74af2bc4156468e3d96b0f3ad971c993 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 11 Aug 2021 14:11:02 -0400 Subject: [PATCH 6/9] watchfrr: increase restart timer 20s -> 90s This commit: "tools: run `vtysh -b` once for all-startup" changed things so that `vtysh -b` is run after all daemons have started up instead of doing it for each daemon as they are started up. This results in one long `vtysh -b`, which for large configs and many daemons (in the case I saw, 4 daemons and 30,000 line config) can exceed the 20 second timer watchfrr uses to kill "hung" background tasks. Shouldn't be any harm to increasing this to 90 seconds to give us some leeway while still making sure we kill anything truly misbehaving. Signed-off-by: Quentin Young --- watchfrr/watchfrr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index acc612c0a8..611a7872d0 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -44,7 +44,7 @@ #define DEFAULT_PERIOD 5 #define DEFAULT_TIMEOUT 90 -#define DEFAULT_RESTART_TIMEOUT 20 +#define DEFAULT_RESTART_TIMEOUT 90 #define DEFAULT_LOGLEVEL LOG_INFO #define DEFAULT_MIN_RESTART 60 #define DEFAULT_MAX_RESTART 600 From da7393b8fd67a6e0927af037dd263cc9d4e4b903 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 18 Oct 2021 13:49:35 -0400 Subject: [PATCH 7/9] zebra: Fix another ships in the night issue with WFI Effectively When bgp would send a route update down to zebra and immediately after that a asic update from the kernel was read. Zebra would choose the asic update and drop the bgp update leaving us in a state where bgp was not used as the true source. Modify the code so that in rib_multipath_nhe we notice that we have an unprocessed route update from bgp. And if so just drop this kernel update about an older version of the route since it is no longer needed. Ticket: 2722533 Signed-off-by: Donald Sharp --- zebra/zebra_rib.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 574083ae02..11d279d8c9 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2838,6 +2838,8 @@ static void process_subq_early_route_add(struct zebra_early_route *ere) if (!ere->startup && (re->flags & ZEBRA_FLAG_SELFROUTE) && zrouter.asic_offloaded) { + struct route_entry *entry; + if (!same) { if (IS_ZEBRA_DEBUG_RIB) zlog_debug( @@ -2854,6 +2856,25 @@ static void process_subq_early_route_add(struct zebra_early_route *ere) early_route_memory_free(ere); return; } + + RNODE_FOREACH_RE (rn, entry) { + if (CHECK_FLAG(entry->status, ROUTE_ENTRY_REMOVED)) + continue; + + if (entry->type != ere->re->type) + continue; + + /* + * If we have an entry that is changed but un + * processed and not a self route, then + * we should just drop this new self route + */ + if (CHECK_FLAG(entry->status, ROUTE_ENTRY_CHANGED) && + !(entry->flags & ZEBRA_FLAG_SELFROUTE)) { + early_route_memory_free(ere); + return; + } + } } /* Set default distance by route type. */ From 7ec7446ea82dea070673337931f30564e8ac03f7 Mon Sep 17 00:00:00 2001 From: Trey Aspelund Date: Fri, 5 Nov 2021 11:47:57 -0400 Subject: [PATCH 8/9] bgpd: only import specific route-types into EVIs Prior to this we were only filtering EVPN routes from the import logic if they were not route-type 1/2/3/5, which allowed things like RT-5s to be imported into an L2VNI/MAC-VRF. This adds additional logic to ensure routes are only imported into EVIs where they make sense. No more nonsensical route importing! Ticket: 2848204 Signed-off-by: Trey Aspelund --- bgpd/bgp_evpn.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index f173bd01f2..5617f0d009 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -4212,9 +4212,7 @@ static int bgp_evpn_install_uninstall_table(struct bgp *bgp, afi_t afi, assert(attr); - /* Only type-1, type-2, type-3, type-4 and type-5 - * are supported currently - */ + /* Only EVPN route-types 1-5 are supported currently */ if (!(evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE || evp->prefix.route_type == BGP_EVPN_IMET_ROUTE || evp->prefix.route_type == BGP_EVPN_ES_ROUTE @@ -4271,26 +4269,28 @@ static int bgp_evpn_install_uninstall_table(struct bgp *bgp, afi_t afi, bgp_evpn_attr_get_esi(pi->attr)); /* - * macip routes (type-2) are imported into VNI and VRF tables. - * IMET route is imported into VNI table. - * prefix routes are imported into VRF table. + * AD/IMET routes (type-1/3) are imported into VNI table. + * MACIP routes (type-2) are imported into VNI and VRF tables. + * Prefix routes (type 5) are imported into VRF table. */ if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE || evp->prefix.route_type == BGP_EVPN_IMET_ROUTE || evp->prefix.route_type == BGP_EVPN_AD_ROUTE || evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE) { + if (evp->prefix.route_type != BGP_EVPN_IP_PREFIX_ROUTE) { + irt = in_vni_rt ? lookup_import_rt(bgp, eval) : NULL; + if (irt) + install_uninstall_route_in_vnis(bgp, afi, safi, evp, pi, + irt->vnis, import); + } - irt = in_vni_rt ? lookup_import_rt(bgp, eval) : NULL; - if (irt) - install_uninstall_route_in_vnis( - bgp, afi, safi, evp, pi, irt->vnis, - import); - - vrf_irt = in_vrf_rt ? lookup_vrf_import_rt(eval) : NULL; - if (vrf_irt) - install_uninstall_route_in_vrfs( - bgp, afi, safi, evp, pi, vrf_irt->vrfs, - import); + if (evp->prefix.route_type != BGP_EVPN_AD_ROUTE && + evp->prefix.route_type != BGP_EVPN_IMET_ROUTE) { + vrf_irt = in_vrf_rt ? lookup_vrf_import_rt(eval) : NULL; + if (vrf_irt) + install_uninstall_route_in_vrfs(bgp, afi, safi, evp, pi, + vrf_irt->vrfs, import); + } /* Also check for non-exact match. * In this, we mask out the AS and From 3f3c923d7a2175f909e5c20e5f91548cf5c124bb Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Wed, 26 Jan 2022 15:48:44 -0800 Subject: [PATCH 9/9] bgpd: copy asn of src vrf to evpn type5 route When a unicast route from source vrf is imported into evpn as type5 route, prepend the asn of the source vrf into type5 asn path list. The condition of evpn type5 prefix path info is present but source vrf route has been cleared via clear command. In this case existing path info needs to rewrite the source vrf asn. prepends asn of the source vrf, but the further condition for existing path attribute for the same route needs to prepend source vrf asn. Ticket: #2943080 Testing: Before fix: r4# clear ip bgp vrf overlay prefix 0.0.0.0/0 Route Distinguisher: 128.117.243.209:4 *> [5]:[0]:[0]:[0.0.0.0] 203.0.113.1 0 0 194 ? <--- 64512 is missing ET:8 RT:64532:104001 Rmac:06:ec:bf:59:e8:93 After fix: r4# clear ip bgp vrf overlay prefix 0.0.0.0/0 Route's source vrf bgp output containing ASN 64512: r4# show bgp vrf overlay BGP table version is 2, local router ID is 128.117.243.209, vrf id 10 Default local pref 100, local AS 64512 ... Notice after clear command source vrf asn 64512 is retained. Route Distinguisher: 128.117.243.209:4 *> [5]:[0]:[0]:[0.0.0.0] 203.0.113.1 0 0 64512 194 ? ET:8 RT:64532:104001 Rmac:06:ec:bf:59:e8:93 Signed-off-by: Chirag Shah --- bgpd/bgp_evpn.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 5617f0d009..204c95022c 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -1669,9 +1669,18 @@ static int update_evpn_type5_route_entry(struct bgp *bgp_evpn, /* attribute changed */ *route_changed = 1; + /* if the asn values are different, copy the asn of + * source vrf to the target (evpn) vrf entry. + */ + if (bgp_vrf->as != bgp_evpn->as) { + new_aspath = aspath_dup(static_attr.aspath); + new_aspath = aspath_add_seq(new_aspath, bgp_vrf->as); + static_attr.aspath = new_aspath; + } /* The attribute has changed. */ /* Add (or update) attribute to hash. */ - attr_new = bgp_attr_intern(attr); + attr_new = bgp_attr_intern(&static_attr); + bgp_attr_flush(&static_attr); bgp_path_info_set_flag(dest, tmp_pi, BGP_PATH_ATTR_CHANGED);