Skip to content

Commit

Permalink
bgpd: copy asn of src vrf to evpn type5 route
Browse files Browse the repository at this point in the history
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 <chirag@nvidia.com>
  • Loading branch information
chiragshah6 authored and donaldsharp committed Dec 7, 2024
1 parent 03c93d3 commit ccfc65d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bgpd/bgp_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1669,9 +1669,19 @@ 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);

Expand Down

0 comments on commit ccfc65d

Please sign in to comment.