diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2023-05-11 15:26:50 +0200 | 
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2023-06-16 10:54:58 +0200 | 
| commit | 98c615f05a0965d916964e389fde24c4237e0296 (patch) | |
| tree | 7e0ee9018052dcf24a8b3cc7f8ab04e38396f968 /bgpd/bgp_updgrp_packet.c | |
| parent | 1069425868d108bd6e582f6b67a78a1d9ac4bd85 (diff) | |
bgpd: advertise mpls vpn routes with appropriate label
The advertised label value from mpls vpn routes is not modified
when the advertised next-hop is modified to next-hop-self.
Actually, the original label value received is redistributed as
is, whereas the new_label value bound in the nexthop label
bind entry should be used.
Only the VPN entries that contain MPLS information, and that
are redistributed between distinct peers, will have a label
value to advertise.
- no SRv6 attribute
- no local prefix
- no exported VPN prefixes from a VRF
If the advertisement to a given peer has the next-hop modified,
then the new label value will be picked up. The considered cases
are peers configured with 'next-hop-self' option, or ebgp peerings
without the 'next-hop-unchanged' option.
Note that the the NLRI format will follow the rfc3107 format, as
multiple label values for MPLS VPN NLRIs are not supported (the
rfc8277 is not supported).
Note also that the case where an outgoing route-map is applied to
the outgoing neighbor is not considered in this commit.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_updgrp_packet.c')
| -rw-r--r-- | bgpd/bgp_updgrp_packet.c | 23 | 
1 files changed, 23 insertions, 0 deletions
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index e04d5ae245..49b7f51286 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -789,6 +789,29 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)  						      safi);  				label_pnt = &label;  				num_labels = 1; +			} else if (safi == SAFI_MPLS_VPN && path && +				   CHECK_FLAG(path->flags, +					      BGP_PATH_MPLSVPN_NH_LABEL_BIND) && +				   path->mplsvpn.bmnc.nh_label_bind_cache && +				   path->peer && path->peer != peer && +				   path->sub_type != BGP_ROUTE_IMPORTED && +				   path->sub_type != BGP_ROUTE_STATIC && +				   bgp_mplsvpn_path_uses_valid_mpls_label( +					   path) && +				   bgp_path_info_nexthop_changed(path, peer, +								 afi)) { +				/* Redistributed mpls vpn route between distinct +				 * peers from 'pi->peer' to 'to', +				 * and an mpls label is used in this path, +				 * and there is a nh label bind entry, +				 * then get appropriate mpls local label. When +				 * called here, 'get_label()' returns a valid +				 * label. +				 */ +				label = bgp_mplsvpn_nh_label_bind_get_label( +					path); +				label_pnt = &label; +				num_labels = 1;  			} else if (path && path->extra) {  				label_pnt = &path->extra->label[0];  				num_labels = path->extra->num_labels;  | 
