From: Louis Scalbert Date: Tue, 2 May 2023 14:30:20 +0000 (+0200) Subject: bgpd: add LP_TYPE_BGP_L3VPN_BIND label type X-Git-Tag: base_9.1~351^2~12 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=73e9ce89b909419728825723b60435d92a0e2723;p=mirror%2Ffrr.git bgpd: add LP_TYPE_BGP_L3VPN_BIND label type Redistributing mpls vpn prefixes with a new label requires picking up unused MPLS local labels. Today, there is an MPLS label pool which is owned by the zebra daemon. BGP gets a chunk of labels that are shared with the multiple usage of the BGP daemon. A label type attribute is used whenever BGP needs a new label value. The 'LP_TYPE_BGP_L3VPN_BIND' label type will be used to allocate the MPLS labels that will be bound to the original next-hop, and label value of an L3VPN update. Signed-off-by: Louis Scalbert Signed-off-by: Philippe Guibert --- diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c index faddfc995f..91763b85a0 100644 --- a/bgpd/bgp_labelpool.c +++ b/bgpd/bgp_labelpool.c @@ -843,6 +843,16 @@ DEFUN(show_bgp_labelpool_ledger, show_bgp_labelpool_ledger_cmd, vty_out(vty, "%-18s %u\n", "nexthop", lcb->label); break; + case LP_TYPE_BGP_L3VPN_BIND: + if (uj) { + json_object_string_add(json_elem, "prefix", + "l3vpn-bind"); + json_object_int_add(json_elem, "label", + lcb->label); + } else + vty_out(vty, "%-18s %u\n", "l3vpn-bind", + lcb->label); + break; } } if (uj) @@ -941,6 +951,15 @@ DEFUN(show_bgp_labelpool_inuse, show_bgp_labelpool_inuse_cmd, vty_out(vty, "%-18s %u\n", "nexthop", label); break; + case LP_TYPE_BGP_L3VPN_BIND: + if (uj) { + json_object_string_add(json_elem, "prefix", + "l3vpn-bind"); + json_object_int_add(json_elem, "label", label); + } else + vty_out(vty, "%-18s %u\n", "l3vpn-bind", + label); + break; } } if (uj) @@ -1020,6 +1039,13 @@ DEFUN(show_bgp_labelpool_requests, show_bgp_labelpool_requests_cmd, else vty_out(vty, "Nexthop\n"); break; + case LP_TYPE_BGP_L3VPN_BIND: + if (uj) + json_object_string_add(json_elem, "prefix", + "l3vpn-bind"); + else + vty_out(vty, "L3VPN-BIND\n"); + break; } } if (uj) diff --git a/bgpd/bgp_labelpool.h b/bgpd/bgp_labelpool.h index b33527186e..9a110e6297 100644 --- a/bgpd/bgp_labelpool.h +++ b/bgpd/bgp_labelpool.h @@ -18,6 +18,7 @@ #define LP_TYPE_VRF 0x00000001 #define LP_TYPE_BGP_LU 0x00000002 #define LP_TYPE_NEXTHOP 0x00000003 +#define LP_TYPE_BGP_L3VPN_BIND 0x00000004 PREDECL_LIST(lp_fifo);