diff options
| author | Russ White <russ@riw.us> | 2024-04-26 14:41:05 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-26 14:41:05 -0400 | 
| commit | f19817f71daeb3b566ac55e5605c683dfcd70369 (patch) | |
| tree | c530c5282562c3a65a3e8a4a4b9ff0e5f7474382 /bgpd/bgp_route.c | |
| parent | 6a7fadaecc5367dcf05694da5dcfc226d5cfec09 (diff) | |
| parent | 634d1375faa62c6593cc9292d32804666333a1f6 (diff) | |
Merge pull request #15723 from opensourcerouting/feature/extended_link_bw_refactored_v1
bgpd: Implement extended link-bandwidth
Diffstat (limited to 'bgpd/bgp_route.c')
| -rw-r--r-- | bgpd/bgp_route.c | 45 | 
1 files changed, 35 insertions, 10 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 3feb2717d1..6bf56a5285 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2771,17 +2771,26 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,  	 * the most sense. However, don't modify if the link-bandwidth has  	 * been explicitly set by user policy.  	 */ -	if (nh_reset && -	    bgp_path_info_mpath_chkwtd(bgp, pi) && +	if (nh_reset && bgp_path_info_mpath_chkwtd(bgp, pi) &&  	    (cum_bw = bgp_path_info_mpath_cumbw(pi)) != 0 && -	    !CHECK_FLAG(attr->rmap_change_flags, BATTR_RMAP_LINK_BW_SET)) -		bgp_attr_set_ecommunity( -			attr, -			ecommunity_replace_linkbw( -				bgp->as, bgp_attr_get_ecommunity(attr), cum_bw, -				CHECK_FLAG( -					peer->flags, -					PEER_FLAG_DISABLE_LINK_BW_ENCODING_IEEE))); +	    !CHECK_FLAG(attr->rmap_change_flags, BATTR_RMAP_LINK_BW_SET)) { +		if (CHECK_FLAG(peer->flags, PEER_FLAG_EXTENDED_LINK_BANDWIDTH)) +			bgp_attr_set_ipv6_ecommunity( +				attr, +				ecommunity_replace_linkbw(bgp->as, +							  bgp_attr_get_ipv6_ecommunity( +								  attr), +							  cum_bw, false, true)); +		else +			bgp_attr_set_ecommunity( +				attr, +				ecommunity_replace_linkbw( +					bgp->as, bgp_attr_get_ecommunity(attr), +					cum_bw, +					CHECK_FLAG(peer->flags, +						   PEER_FLAG_DISABLE_LINK_BW_ENCODING_IEEE), +					false)); +	}  	return true;  } @@ -10457,6 +10466,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,  	json_object *json_cluster_list = NULL;  	json_object *json_cluster_list_list = NULL;  	json_object *json_ext_community = NULL; +	json_object *json_ext_ipv6_community = NULL;  	json_object *json_last_update = NULL;  	json_object *json_pmsi = NULL;  	json_object *json_nexthop_global = NULL; @@ -11165,6 +11175,21 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,  		}  	} +	if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_IPV6_EXT_COMMUNITIES)) { +		if (json_paths) { +			json_ext_ipv6_community = json_object_new_object(); +			json_object_string_add(json_ext_ipv6_community, "string", +					       bgp_attr_get_ipv6_ecommunity(attr) +						       ->str); +			json_object_object_add(json_path, +					       "extendedIpv6Community", +					       json_ext_ipv6_community); +		} else { +			vty_out(vty, "      Extended IPv6 Community: %s\n", +				bgp_attr_get_ipv6_ecommunity(attr)->str); +		} +	} +  	/* Line 6 display Large community */  	if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES)) {  		if (json_paths) {  | 
