diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2023-05-11 13:56:16 +0200 | 
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2023-06-16 10:54:58 +0200 | 
| commit | 1069425868d108bd6e582f6b67a78a1d9ac4bd85 (patch) | |
| tree | aee07885b7faa1c1ed29666d4cc4fa5babfd2754 /bgpd/bgp_route.h | |
| parent | 28d5c6e531b685725ee4c6fec90813041bfb2bc3 (diff) | |
bgpd: allocate label bound to received mpls vpn routes
Current implementation does not offer a new label to bind
to a received VPN route entry to redistribute with that new
label.
This commit allocates a label for VPN entries that have
a valid label, and a reachable next-hop interface that is
configured as follows:
> interface eth0
>  mpls bgp l3vpn-multi-domain-switching
> exit
An mplsvpn next-hop label binding entry is created in an mpls
vpn nexthop label bind hash table of the current BGP instance.
That mpls vpn next-hop label entry is indexed by the (next-hop,
orig_label) values provided by the incoming updates, and shared
with other updates having the same (next-hop, orig_label) values.
A new 'LP_TYPE_BGP_L3VPN_BIND' label value is picked up from the
zebra mpls label pool, and assigned to the new_label attribute.
The 'bgp_path_info' appends a 'bgp_mplsvpn_nh_label_bind' structure
to the 'mplsvpn' union structure. Both structures in the union are not
used at the same, as the paths are either VRF updates to export, or MPLS
VPN updates. Using an union gives a 24 bytes memory gain compared to if
the structures had not been in an union (24 bytes compared to 48 bytes).
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_route.h')
| -rw-r--r-- | bgpd/bgp_route.h | 10 | 
1 files changed, 10 insertions, 0 deletions
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 96aa98c277..a67145a3ab 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -254,6 +254,14 @@ struct bgp_mplsvpn_label_nh {  	struct bgp_label_per_nexthop_cache *label_nexthop_cache;  }; +struct bgp_mplsvpn_nh_label_bind { +	/* For mplsvpn nexthop label bind linked list */ +	LIST_ENTRY(bgp_path_info) nh_label_bind_thread; + +	/* Back pointer to the bgp mplsvpn nexthop label bind structure */ +	struct bgp_mplsvpn_nh_label_bind_cache *nh_label_bind_cache; +}; +  struct bgp_path_info {  	/* For linked list. */  	struct bgp_path_info *next; @@ -307,6 +315,7 @@ struct bgp_path_info {  #define BGP_PATH_LINK_BW_CHG (1 << 15)  #define BGP_PATH_ACCEPT_OWN (1 << 16)  #define BGP_PATH_MPLSVPN_LABEL_NH (1 << 17) +#define BGP_PATH_MPLSVPN_NH_LABEL_BIND (1 << 18)  	/* BGP route type.  This can be static, RIP, OSPF, BGP etc.  */  	uint8_t type; @@ -331,6 +340,7 @@ struct bgp_path_info {  	union {  		struct bgp_mplsvpn_label_nh blnc; +		struct bgp_mplsvpn_nh_label_bind bmnc;  	} mplsvpn;  };  | 
