From 855dcbf15898ce6b40bdf31902970d65ac801f56 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Tue, 28 Feb 2023 14:11:30 +0100 Subject: [PATCH] bgpd: introduce LP_TYPE_NEXTHOP label type A new label type is introduced: LP_TYPE_NEXTHOP. This new label type will be used in next commits to allocate labels for a specific nexthop IP address. The commit changes add vty and json outputs to display the new label type and the label values associated. Signed-off-by: Philippe Guibert --- bgpd/bgp_labelpool.c | 26 ++++++++++++++++++++++++++ bgpd/bgp_labelpool.h | 1 + 2 files changed, 27 insertions(+) diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c index 9943f57fb3..9f1a07cd23 100644 --- a/bgpd/bgp_labelpool.c +++ b/bgpd/bgp_labelpool.c @@ -830,6 +830,16 @@ DEFUN(show_bgp_labelpool_ledger, show_bgp_labelpool_ledger_cmd, lcb->label); break; + case LP_TYPE_NEXTHOP: + if (uj) { + json_object_string_add(json_elem, "prefix", + "nexthop"); + json_object_int_add(json_elem, "label", + lcb->label); + } else + vty_out(vty, "%-18s %u\n", "nexthop", + lcb->label); + break; } } if (uj) @@ -919,6 +929,15 @@ DEFUN(show_bgp_labelpool_inuse, show_bgp_labelpool_inuse_cmd, vty_out(vty, "%-18s %u\n", "VRF", label); break; + case LP_TYPE_NEXTHOP: + if (uj) { + json_object_string_add(json_elem, "prefix", + "nexthop"); + json_object_int_add(json_elem, "label", label); + } else + vty_out(vty, "%-18s %u\n", "nexthop", + label); + break; } } if (uj) @@ -991,6 +1010,13 @@ DEFUN(show_bgp_labelpool_requests, show_bgp_labelpool_requests_cmd, else vty_out(vty, "VRF\n"); break; + case LP_TYPE_NEXTHOP: + if (uj) + json_object_string_add(json_elem, "prefix", + "nexthop"); + else + vty_out(vty, "Nexthop\n"); + break; } } if (uj) diff --git a/bgpd/bgp_labelpool.h b/bgpd/bgp_labelpool.h index 9526cba0ce..6491954983 100644 --- a/bgpd/bgp_labelpool.h +++ b/bgpd/bgp_labelpool.h @@ -17,6 +17,7 @@ */ #define LP_TYPE_VRF 0x00000001 #define LP_TYPE_BGP_LU 0x00000002 +#define LP_TYPE_NEXTHOP 0x00000003 PREDECL_LIST(lp_fifo); -- 2.39.5