From 8a6b65f7fde9c3bc5fce6a18f8e1d04db9fcf937 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 10 Oct 2023 16:44:11 -0400 Subject: [PATCH] Revert "bgpd: display link-state prefixes detail" This reverts commit 7e0d9ff8ba984966689562553afe2734b04c8539. --- bgpd/bgp_linkstate.c | 21 -- bgpd/bgp_linkstate.h | 10 - bgpd/bgp_linkstate_tlv.c | 495 --------------------------------------- bgpd/bgp_linkstate_tlv.h | 210 ----------------- bgpd/bgp_route.c | 13 - bgpd/bgpd.c | 2 - bgpd/subdir.am | 2 - 7 files changed, 753 deletions(-) delete mode 100644 bgpd/bgp_linkstate.c delete mode 100644 bgpd/bgp_linkstate.h diff --git a/bgpd/bgp_linkstate.c b/bgpd/bgp_linkstate.c deleted file mode 100644 index f76c68ca5d..0000000000 --- a/bgpd/bgp_linkstate.c +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* BGP Link-State - * Copyright 2023 6WIND S.A. - */ - -#include - -#include "prefix.h" -#include "lib_errors.h" - -#include "bgpd/bgpd.h" -#include "bgpd/bgp_route.h" -#include "bgpd/bgp_debug.h" -#include "bgpd/bgp_errors.h" -#include "bgpd/bgp_linkstate.h" -#include "bgpd/bgp_linkstate_tlv.h" - -void bgp_linkstate_init(void) -{ - prefix_set_linkstate_display_hook(bgp_linkstate_nlri_prefix_display); -} diff --git a/bgpd/bgp_linkstate.h b/bgpd/bgp_linkstate.h deleted file mode 100644 index c8d4d23f16..0000000000 --- a/bgpd/bgp_linkstate.h +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* BGP Link-State header - * Copyright 2023 6WIND S.A. - */ - -#ifndef _FRR_BGP_LINKSTATE_H -#define _FRR_BGP_LINKSTATE_H - -void bgp_linkstate_init(void); -#endif /* _FRR_BGP_LINKSTATE_H */ diff --git a/bgpd/bgp_linkstate_tlv.c b/bgpd/bgp_linkstate_tlv.c index d3fbb7871a..eca6c066a5 100644 --- a/bgpd/bgp_linkstate_tlv.c +++ b/bgpd/bgp_linkstate_tlv.c @@ -5,8 +5,6 @@ #include -#include "iso.h" - #include "bgpd/bgpd.h" #include "bgpd/bgp_route.h" #include "bgpd/bgp_debug.h" @@ -14,70 +12,6 @@ #include "bgpd/bgp_linkstate_tlv.h" -static bool bgp_linkstate_nlri_value_display(char *buf, size_t size, - uint8_t *pnt, uint16_t nlri_type, - uint16_t type, uint16_t length, - bool first, json_object *json); - -struct bgp_linkstate_tlv_info { - const char *descr; - uint8_t min_size; - uint16_t max_size; - uint8_t multiple; -}; - -#define UNDEF_MIN_SZ 0xFF -#define MAX_SZ 0xFFFF -#define UNDEF_MULTPL 1 - -/* clang-format off */ -struct bgp_linkstate_tlv_info bgp_linkstate_tlv_infos[BGP_LS_TLV_MAX] = { - /* NLRI TLV */ - [BGP_LS_TLV_LOCAL_NODE_DESCRIPTORS] = {"Local Node Descriptors", 1, MAX_SZ, UNDEF_MULTPL}, - [BGP_LS_TLV_REMOTE_NODE_DESCRIPTORS] = {"Remote Node Descriptors", 1, MAX_SZ, UNDEF_MULTPL}, - [BGP_LS_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS] = {"Link Local/Remote Identifiers", 2, 2, UNDEF_MULTPL}, - [BGP_LS_TLV_IPV4_INTERFACE_ADDRESS] = {"IPv4 interface address", 4, 4, UNDEF_MULTPL}, - [BGP_LS_TLV_IPV4_NEIGHBOR_ADDRESS] = {"IPv4 neighbor address", 4, 4, UNDEF_MULTPL}, - [BGP_LS_TLV_IPV6_INTERFACE_ADDRESS] = {"IPv6 interface address", 16, 16, UNDEF_MULTPL}, - [BGP_LS_TLV_IPV6_NEIGHBOR_ADDRESS] = {"IPv6 neighbor address", 16, 16, UNDEF_MULTPL}, - [BGP_LS_TLV_OSPF_ROUTE_TYPE] = {"OSPF Route Type", 1, 1, UNDEF_MULTPL}, - [BGP_LS_TLV_IP_REACHABILITY_INFORMATION] = {"IP Reachability Information", 2, 17, UNDEF_MULTPL}, - [BGP_LS_TLV_AUTONOMOUS_SYSTEM] = {"Autonomous System", 4, 4, UNDEF_MULTPL}, - [BGP_LS_TLV_BGP_LS_IDENTIFIER] = {"BGP-LS Identifier", 4, 4, UNDEF_MULTPL}, - [BGP_LS_TLV_OSPF_AREA_ID] = {"OSPF Area-ID", 4, 4, UNDEF_MULTPL}, - [BGP_LS_TLV_IGP_ROUTER_ID] = {"IGP Router-ID", 4, 8, UNDEF_MULTPL}, - /* NRLI & BGP-LS Attributes */ - [BGP_LS_TLV_MULTI_TOPOLOGY_ID] = {"Multi-Topology ID", 2, MAX_SZ, 2}, -}; -/* clang-format on */ - -/* Return the TLV length is valid for the TLV type */ -static bool bgp_ls_tlv_check_size(enum bgp_linkstate_tlv type, size_t length) -{ - if (type > BGP_LS_TLV_MAX || - bgp_linkstate_tlv_infos[type].descr == NULL) - /* TLV type is not defined. Cannot check size */ - return false; - - if (bgp_linkstate_tlv_infos[type].min_size > length) - return false; - if (bgp_linkstate_tlv_infos[type].max_size < length) - return false; - if (length % bgp_linkstate_tlv_infos[type].multiple != 0) - return false; - - return true; -} - -static uint8_t pnt_decode8(uint8_t **pnt) -{ - uint8_t data; - - data = **pnt; - *pnt += 1; - return data; -} - static uint16_t pnt_decode16(uint8_t **pnt) { uint16_t data; @@ -87,45 +21,6 @@ static uint16_t pnt_decode16(uint8_t **pnt) return data; } -static uint32_t pnt_decode32(uint8_t **pnt) -{ - uint32_t data; - - *pnt = (uint8_t *)ptr_get_be32(*pnt, &data); - - return data; -} - -static uint64_t pnt_decode64(uint8_t **pnt) -{ - uint64_t data; - - *pnt = (uint8_t *)ptr_get_be64(*pnt, &data); - - return data; -} - -static const char *bgp_ls_print_nlri_proto(enum bgp_ls_nlri_proto proto) -{ - switch (proto) { - case BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1: - return "ISIS-L1"; - case BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2: - return "ISIS-L2"; - case BGP_LS_NLRI_PROTO_ID_OSPF: - return "OSPFv2"; - case BGP_LS_NLRI_PROTO_ID_DIRECT: - return "Direct"; - case BGP_LS_NLRI_PROTO_ID_STATIC: - return "Static"; - case BGP_LS_NLRI_PROTO_ID_OSPFv3: - return "OSPFv3"; - case BGP_LS_NLRI_PROTO_ID_UNKNOWN: - return "Unknown"; - } - return "Unknown"; -} - int bgp_nlri_parse_linkstate(struct peer *peer, struct attr *attr, struct bgp_nlri *packet, int withdraw) { @@ -190,393 +85,3 @@ void bgp_nlri_encode_linkstate(struct stream *s, const struct prefix *p) stream_put(s, (const void *)p->u.prefix_linkstate.ptr, p->prefixlen); } - -static size_t bgp_linkstate_nlri_hexa_display(char *buf, size_t size, - uint8_t *pnt, uint16_t type, - uint16_t length, bool first, - json_object *json) -{ - json_object *json_array = NULL; - uint8_t *lim = pnt + length; - char json_buf[19]; - int i; - - if (json) { - snprintf(json_buf, sizeof(json_buf), "%u", type); - json_array = json_object_new_array(); - json_object_object_add(json, json_buf, json_array); - for (i = 0; pnt < lim; pnt++, i++) { - if (i % 8 == 0) { - if (i != 0) - json_object_array_add( - json_array, - json_object_new_string( - json_buf)); - snprintf(json_buf, sizeof(buf), "0x"); - } - snprintf(json_buf + strlen(json_buf), - sizeof(json_buf) - strlen(json_buf), "%02x", - *pnt); - } - if (strlen(json_buf) > 2) /* do not only contain 0x */ - json_object_array_add(json_array, - json_object_new_string(json_buf)); - - return size; - } - - snprintf(buf, size, "%s%u:", first ? "" : " ", type); - size -= strlen(buf); - buf += strlen(buf); - - snprintf(buf, size, "0x"); - size -= strlen(buf); - buf += strlen(buf); - - for (i = 0; pnt < lim; pnt++, i++) { - snprintf(buf, size, "%02x", *pnt); - size -= strlen(buf); - buf += strlen(buf); - } - - return size; -} - -static void bgp_linkstate_nlri_mtid_display(char *buf, size_t size, - uint8_t *pnt, uint16_t type, - uint16_t length, bool first, - json_object *json) -{ - json_object *json_array = NULL; - - if (json) { - json_array = json_object_new_array(); - json_object_object_add(json, "mtID", json_array); - for (int i = 0; i < (length / 2); i++) { - json_object_array_add( - json_array, - json_object_new_int(pnt_decode16(&pnt))); - } - return; - } - - for (int i = 0; i < (length / 2); i++) { - if (i == 0) - snprintf(buf, size, "%sMT:%hu", first ? "" : " ", - pnt_decode16(&pnt)); - else - snprintf(buf, size, ",%hu", pnt_decode16(&pnt)); - size -= strlen(buf); - buf += strlen(buf); - } -} - -static bool bgp_linkstate_nlri_node_descriptor_display( - char *buf, size_t size, uint8_t *pnt, uint16_t nlri_type, uint16_t type, - uint16_t length, bool first, json_object *json) -{ - json_object *json_node = NULL; - bool sub_first = true; - uint8_t *lim = pnt + length; - uint16_t sub_type, sub_length; - - if (json) { - json_node = json_object_new_object(); - if (type == BGP_LS_TLV_LOCAL_NODE_DESCRIPTORS) - json_object_object_add(json, "localNode", json_node); - else - json_object_object_add(json, "remoteNode", json_node); - } else { - if (type == BGP_LS_TLV_LOCAL_NODE_DESCRIPTORS) - snprintf(buf, size, "%sLocal {", first ? "" : " "); - else - snprintf(buf, size, "%sRemote {", first ? "" : " "); - size -= strlen(buf); - buf += strlen(buf); - } - - for (; pnt < lim; pnt += sub_length) { - sub_type = pnt_decode16(&pnt); - sub_length = pnt_decode16(&pnt); - - if (pnt + sub_length > lim) - /* bad length */ - return false; - - bgp_linkstate_nlri_value_display(buf, size, pnt, nlri_type, - sub_type, sub_length, - sub_first, json_node); - - if (!json) { - size -= strlen(buf); - buf += strlen(buf); - sub_first = false; - } - } - - if (!json) - snprintf(buf, size, "}"); - - return true; -} - -static bool bgp_linkstate_nlri_value_display(char *buf, size_t size, - uint8_t *pnt, uint16_t nlri_type, - uint16_t type, uint16_t length, - bool first, json_object *json) -{ - struct in_addr ipv4 = {0}; - struct in6_addr ipv6 = {0}; - uint8_t mask_length; - - if (!bgp_ls_tlv_check_size(type, length) && !json) { - bgp_linkstate_nlri_hexa_display(buf, size, pnt, type, length, - first, json); - return true; - } - - switch (type) { - case BGP_LS_TLV_LOCAL_NODE_DESCRIPTORS: - case BGP_LS_TLV_REMOTE_NODE_DESCRIPTORS: - return bgp_linkstate_nlri_node_descriptor_display( - buf, size, pnt, nlri_type, type, length, first, json); - case BGP_LS_TLV_AUTONOMOUS_SYSTEM: - if (json) - json_object_int_add(json, "as", pnt_decode32(&pnt)); - else - snprintf(buf, size, "%sAS:%u", first ? "" : " ", - pnt_decode32(&pnt)); - break; - case BGP_LS_TLV_BGP_LS_IDENTIFIER: - if (json) - json_object_int_add(json, "identifier", - pnt_decode32(&pnt)); - else - snprintf(buf, size, "%sID:%u", first ? "" : " ", - pnt_decode32(&pnt)); - break; - case BGP_LS_TLV_OSPF_AREA_ID: - if (json) - json_object_int_add(json, "area", pnt_decode32(&pnt)); - else - snprintf(buf, size, "%sArea:%u", first ? "" : " ", - pnt_decode32(&pnt)); - break; - case BGP_LS_TLV_IGP_ROUTER_ID: - switch (length) { - case BGP_LS_TLV_IGP_ROUTER_ID_ISIS_NON_PSEUDOWIRE_SIZE: - if (json) - json_object_string_addf(json, "routerID", - "%pSY", pnt); - else - snprintfrr(buf, size, "%sRtr:%pSY", - first ? "" : " ", pnt); - break; - case BGP_LS_TLV_IGP_ROUTER_ID_ISIS_PSEUDOWIRE_SIZE: - if (json) - json_object_string_addf(json, "routerID", - "%pPN", pnt); - else - snprintfrr(buf, size, "%sRtr:%pPN", - first ? "" : " ", pnt); - break; - case BGP_LS_TLV_IGP_ROUTER_ID_OSPF_NON_PSEUDOWIRE_SIZE: - if (json) - json_object_string_addf(json, "routerID", - "%pI4", - (in_addr_t *)pnt); - else - snprintfrr(buf, size, "%sRtr:%pI4", - first ? "" : " ", (in_addr_t *)pnt); - break; - case BGP_LS_TLV_IGP_ROUTER_ID_OSPF_PSEUDOWIRE_SIZE: - if (json) - json_object_string_addf(json, "routerID", - "%pI4:%pI4", - (in_addr_t *)pnt, - ((in_addr_t *)pnt + 1)); - else - snprintfrr(buf, size, "%sRtr:%pI4:%pI4", - first ? "" : " ", (in_addr_t *)pnt, - ((in_addr_t *)pnt + 1)); - break; - default: - bgp_linkstate_nlri_hexa_display(buf, size, pnt, type, - length, first, json); - } - break; - case BGP_LS_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS: - if (json) - json_object_int_add(json, "localRemoteID", - pnt_decode16(&pnt)); - else - snprintf(buf, size, "%sLocal/remote:%hu", - first ? "" : " ", pnt_decode16(&pnt)); - break; - case BGP_LS_TLV_IPV4_INTERFACE_ADDRESS: - if (json) - json_object_string_addf(json, "interfaceIPv4", "%pI4", - (in_addr_t *)pnt); - else - snprintfrr(buf, size, "%sIPv4:%pI4", first ? "" : " ", - (in_addr_t *)pnt); - break; - case BGP_LS_TLV_IPV4_NEIGHBOR_ADDRESS: - if (json) - json_object_string_addf(json, "neighborIPv4", "%pI4", - (in_addr_t *)pnt); - else - snprintfrr(buf, size, "%sNeigh-IPv4:%pI4", - first ? "" : " ", (in_addr_t *)pnt); - break; - case BGP_LS_TLV_IPV6_INTERFACE_ADDRESS: - if (json) - json_object_string_addf(json, "interfaceIPv6", "%pI6", - (struct in6_addr *)pnt); - else - snprintfrr(buf, size, "%sIPv6:%pI6", first ? "" : " ", - (struct in6_addr *)pnt); - break; - case BGP_LS_TLV_IPV6_NEIGHBOR_ADDRESS: - if (json) - json_object_string_addf(json, "neighborIPv6", "%pI6", - (struct in6_addr *)pnt); - else - snprintfrr(buf, size, "%sNeigh-IPv6:%pI6", - first ? "" : " ", (struct in6_addr *)pnt); - break; - case BGP_LS_TLV_MULTI_TOPOLOGY_ID: - bgp_linkstate_nlri_mtid_display(buf, size, pnt, type, length, - first, json); - break; - case BGP_LS_TLV_OSPF_ROUTE_TYPE: - if (json) - json_object_int_add(json, "ospfRouteType", - pnt_decode8(&pnt)); - else - snprintf(buf, size, "%sOSPF-Route-Type:%u", - first ? "" : " ", pnt_decode8(&pnt)); - break; - case BGP_LS_TLV_IP_REACHABILITY_INFORMATION: - mask_length = pnt_decode8(&pnt); - if (nlri_type == BGP_LINKSTATE_PREFIX4) { - memcpy(&ipv4.s_addr, pnt, length - sizeof(mask_length)); - if (json) - json_object_string_addf(json, "ipReachability", - "%pI4/%u", &ipv4, - mask_length); - else - snprintfrr(buf, size, "%sIPv4:%pI4/%u", - first ? "" : " ", &ipv4, - mask_length); - } else if (nlri_type == BGP_LINKSTATE_PREFIX6) { - memcpy(&ipv6, pnt, length - sizeof(mask_length)); - if (json) - json_object_string_addf(json, "ipReachability", - "%pI6/%u", &ipv6, - mask_length); - else - snprintfrr(buf, size, "%sIPv6:%pI6/%u", - first ? "" : " ", &ipv6, - mask_length); - } else - bgp_linkstate_nlri_hexa_display(buf, size, pnt, type, - length, first, json); - - break; - default: - bgp_linkstate_nlri_hexa_display(buf, size, pnt, type, length, - first, json); - } - - return true; -} - -char *bgp_linkstate_nlri_prefix_display(char *buf, size_t size, - uint16_t nlri_type, uintptr_t ptr, - uint16_t len) -{ - uint8_t *pnt = (uint8_t *)ptr; - uint8_t *lim = pnt + len; - uint16_t type, length; - char *cbuf = buf, *cbuf2; - uint8_t proto; - bool ret; - bool first = true; - - proto = pnt_decode8(&pnt); - - snprintfrr(buf, size, "%s %s ID:0x%" PRIx64 " {", - bgp_linkstate_nlri_type_2str(nlri_type), - bgp_ls_print_nlri_proto(proto), pnt_decode64(&pnt)); - size -= strlen(buf); - buf += strlen(buf); - - cbuf2 = buf; - - for (; pnt < lim; pnt += length) { - type = pnt_decode16(&pnt); - length = pnt_decode16(&pnt); - - if (pnt + length > lim) { - /* bad length */ - snprintf(cbuf2, size, "Bad format}"); - return cbuf; - } - - ret = bgp_linkstate_nlri_value_display( - buf, size, pnt, nlri_type, type, length, first, NULL); - - if (!ret) { - /* bad length */ - snprintf(cbuf2, size, "Bad format}"); - return cbuf; - } - - size -= strlen(buf); - buf += strlen(buf); - first = false; - } - - snprintf(buf, size, "}"); - - return cbuf; -} - -void bgp_linkstate_nlri_prefix_json(json_object *json, uint16_t nlri_type, - uintptr_t ptr, uint16_t len) -{ - json_object *json_nlri = json_object_new_object(); - uint8_t *pnt = (uint8_t *)ptr; - uint8_t *lim = pnt + len; - uint16_t type, length; - uint8_t proto; - bool ret; - - proto = pnt_decode8(&pnt); - - json_object_object_add(json, "linkStateNLRI", json_nlri); - json_object_string_add(json_nlri, "nlriType", - bgp_linkstate_nlri_type_2str(nlri_type)); - json_object_string_add(json_nlri, "protocol", - bgp_ls_print_nlri_proto(proto)); - json_object_string_addf(json_nlri, "identifier", "0x%" PRIx64, - pnt_decode64(&pnt)); - - for (; pnt < lim; pnt += length) { - type = pnt_decode16(&pnt); - length = pnt_decode16(&pnt); - - if (pnt + length > lim) - /* bad length */ - return; - - ret = bgp_linkstate_nlri_value_display(NULL, 0, pnt, nlri_type, - type, length, false, - json_nlri); - - if (!ret) - /* bad length */ - return; - } -} diff --git a/bgpd/bgp_linkstate_tlv.h b/bgpd/bgp_linkstate_tlv.h index dc7a43b6e1..6e34f1fda6 100644 --- a/bgpd/bgp_linkstate_tlv.h +++ b/bgpd/bgp_linkstate_tlv.h @@ -6,218 +6,8 @@ #ifndef BGP_LINKSTATE_TLV_H #define BGP_LINKSTATE_TLV_H -/* RFC7752 Link-State NLRI Protocol-ID values - * +-------------+----------------------------------+ - * | Protocol-ID | NLRI information source protocol | - * +-------------+----------------------------------+ - * | 1 | IS-IS Level 1 | - * | 2 | IS-IS Level 2 | - * | 3 | OSPFv2 | - * | 4 | Direct | - * | 5 | Static configuration | - * | 6 | OSPFv3 | - * +-------------+----------------------------------+ - */ - -enum bgp_ls_nlri_proto { - BGP_LS_NLRI_PROTO_ID_UNKNOWN = 0, - BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 = 1, - BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2 = 2, - BGP_LS_NLRI_PROTO_ID_OSPF = 3, - BGP_LS_NLRI_PROTO_ID_DIRECT = 4, - BGP_LS_NLRI_PROTO_ID_STATIC = 5, - BGP_LS_NLRI_PROTO_ID_OSPFv3 = 6, -}; - -/* - * List of BGP Link-State TLVs extracted from - * https://www.iana.org/assignments/bgp-ls-parameters/bgp-ls-parameters.xhtml#node-descriptor-link-descriptor-prefix-descriptor-attribute-tlv - * - * Retrieved on 2023-01-03 - * - * The following bash command was used to convert the list: - * sed -e 's| (.\+)||g' tmp \ - * | awk -F'\t' '($1 ~ /^[0-9]+$/) {gsub(/(\/|-| |\.)/,"_",$2); printf - * "\tBGP_LS_TLV_"toupper($2)" = "$1", \/\* "$4" \*\/\n"}' \ - * | grep -v UNASSIGNED \ - * | sed -e 's/\[//g;s/\]//g' - * - */ - -enum bgp_linkstate_tlv { - BGP_LS_TLV_LOCAL_NODE_DESCRIPTORS = 256, /* RFC7752, Section 3.2.1.2 */ - BGP_LS_TLV_REMOTE_NODE_DESCRIPTORS = 257, /* RFC7752, Section 3.2.1.3 */ - BGP_LS_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS = - 258, /* RFC5307, Section 1.1 */ - BGP_LS_TLV_IPV4_INTERFACE_ADDRESS = 259, /* RFC5305, Section 3.2 */ - BGP_LS_TLV_IPV4_NEIGHBOR_ADDRESS = 260, /* RFC5305, Section 3.3 */ - BGP_LS_TLV_IPV6_INTERFACE_ADDRESS = 261, /* RFC6119, Section 4.2 */ - BGP_LS_TLV_IPV6_NEIGHBOR_ADDRESS = 262, /* RFC6119, Section 4.3 */ - BGP_LS_TLV_MULTI_TOPOLOGY_ID = 263, /* RFC7752, Section 3.2.1.5 */ - BGP_LS_TLV_OSPF_ROUTE_TYPE = 264, /* RFC7752, Section 3.2.3 */ - BGP_LS_TLV_IP_REACHABILITY_INFORMATION = - 265, /* RFC7752, Section 3.2.3 */ - BGP_LS_TLV_NODE_MSD = 266, /* RFC8814 */ - BGP_LS_TLV_LINK_MSD = 267, /* RFC8814 */ - BGP_LS_TLV_AUTONOMOUS_SYSTEM = 512, /* RFC7752, Section 3.2.1.4 */ - BGP_LS_TLV_BGP_LS_IDENTIFIER = 513, /* RFC7752, Section 3.2.1.4 */ - BGP_LS_TLV_OSPF_AREA_ID = 514, /* RFC7752, Section 3.2.1.4 */ - BGP_LS_TLV_IGP_ROUTER_ID = 515, /* RFC7752, Section 3.2.1.4 */ - BGP_LS_TLV_BGP_ROUTER_ID = 516, /* RFC9086 */ - BGP_LS_TLV_BGP_CONFEDERATION_MEMBER = 517, /* RFC9086 */ - BGP_LS_TLV_SRV6_SID_INFORMATION_TLV = - 518, /* draft-ietf-idr-bgpls-srv6-ext-08 */ - BGP_LS_TLV_TUNNEL_ID_TLV = - 550, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_LSP_ID_TLV = 551, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_IPV4_6_TUNNEL_HEAD_END_ADDRESS_TLV = - 552, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_IPV4_6_TUNNEL_TAIL_END_ADDRESS_TLV = - 553, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_POLICY_CP_DESCRIPTOR_TLV = - 554, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_MPLS_LOCAL_CROSS_CONNECT_TLV = - 555, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_MPLS_CROSS_CONNECT_INTERFACE_TLV = - 556, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_MPLS_CROSS_CONNECT_FEC_TLV = - 557, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_NODE_FLAG_BITS = 1024, /* RFC7752, Section 3.3.1.1 */ - BGP_LS_TLV_OPAQUE_NODE_ATTRIBUTE = 1025, /* RFC7752, Section 3.3.1.5 */ - BGP_LS_TLV_NODE_NAME = 1026, /* RFC7752, Section 3.3.1.3 */ - BGP_LS_TLV_IS_IS_AREA_IDENTIFIER = 1027, /* RFC7752, Section 3.3.1.2 */ - BGP_LS_TLV_IPV4_ROUTER_ID_OF_LOCAL_NODE = - 1028, /* RFC5305, Section 4.3 */ - BGP_LS_TLV_IPV6_ROUTER_ID_OF_LOCAL_NODE = - 1029, /* RFC6119, Section 4.1 */ - BGP_LS_TLV_IPV4_ROUTER_ID_OF_REMOTE_NODE = - 1030, /* RFC5305, Section 4.3 */ - BGP_LS_TLV_IPV6_ROUTER_ID_OF_REMOTE_NODE = - 1031, /* RFC6119, Section 4.1 */ - BGP_LS_TLV_S_BFD_DISCRIMINATORS = 1032, /* RFC9247 */ - BGP_LS_TLV_UNASSIGNED = 1033, /* */ - BGP_LS_TLV_SR_CAPABILITIES = 1034, /* RFC9085, Section 2.1.2 */ - BGP_LS_TLV_SR_ALGORITHM = 1035, /* RFC9085, Section 2.1.3 */ - BGP_LS_TLV_SR_LOCAL_BLOCK = 1036, /* RFC9085, Section 2.1.4 */ - BGP_LS_TLV_SRMS_PREFERENCE = 1037, /* RFC9085, Section 2.1.5 */ - BGP_LS_TLV_SRV6_CAPABILITIES_TLV = - 1038, /* draft-ietf-idr-bgpls-srv6-ext-08 */ - BGP_LS_TLV_FLEXIBLE_ALGORITHM_DEFINITION = 1039, /* RFC9351 */ - BGP_LS_TLV_FLEXIBLE_ALGORITHM_EXCLUDE_ANY_AFFINITY = 1040, /* RFC9351 */ - BGP_LS_TLV_FLEXIBLE_ALGORITHM_INCLUDE_ANY_AFFINITY = 1041, /* RFC9351 */ - BGP_LS_TLV_FLEXIBLE_ALGORITHM_INCLUDE_ALL_AFFINITY = 1042, /* RFC9351 */ - BGP_LS_TLV_FLEXIBLE_ALGORITHM_DEFINITION_FLAGS = 1043, /* RFC9351 */ - BGP_LS_TLV_FLEXIBLE_ALGORITHM_PREFIX_METRIC = 1044, /* RFC9351 */ - BGP_LS_TLV_FLEXIBLE_ALGORITHM_EXCLUDE_SRLG = 1045, /* RFC9351 */ - BGP_LS_TLV_FLEXIBLE_ALGORITHM_UNSUPPORTED = 1046, /* RFC9351 */ - BGP_LS_TLV_ADMINISTRATIVE_GROUP = 1088, /* RFC5305, Section 3.1 */ - BGP_LS_TLV_MAXIMUM_LINK_BANDWIDTH = 1089, /* RFC5305, Section 3.4 */ - BGP_LS_TLV_MAX_RESERVABLE_LINK_BANDWIDTH = - 1090, /* RFC5305, Section 3.5 */ - BGP_LS_TLV_UNRESERVED_BANDWIDTH = 1091, /* RFC5305, Section 3.6 */ - BGP_LS_TLV_TE_DEFAULT_METRIC = 1092, /* RFC7752, Section 3.3.2.3 */ - BGP_LS_TLV_LINK_PROTECTION_TYPE = 1093, /* RFC5307, Section 1.2 */ - BGP_LS_TLV_MPLS_PROTOCOL_MASK = 1094, /* RFC7752, Section 3.3.2.2 */ - BGP_LS_TLV_IGP_METRIC = 1095, /* RFC7752, Section 3.3.2.4 */ - BGP_LS_TLV_SHARED_RISK_LINK_GROUP = 1096, /* RFC7752, Section 3.3.2.5 */ - BGP_LS_TLV_OPAQUE_LINK_ATTRIBUTE = 1097, /* RFC7752, Section 3.3.2.6 */ - BGP_LS_TLV_LINK_NAME = 1098, /* RFC7752, Section 3.3.2.7 */ - BGP_LS_TLV_ADJACENCY_SID = 1099, /* RFC9085, Section 2.2.1 */ - BGP_LS_TLV_LAN_ADJACENCY_SID = 1100, /* RFC9085, Section 2.2.2 */ - BGP_LS_TLV_PEERNODE_SID = 1101, /* RFC9086 */ - BGP_LS_TLV_PEERADJ_SID = 1102, /* RFC9086 */ - BGP_LS_TLV_PEERSET_SID = 1103, /* RFC9086 */ - BGP_LS_TLV_RTM_CAPABILITY = 1105, /* RFC8169 */ - BGP_LS_TLV_SRV6_END_X_SID_TLV = - 1106, /* draft-ietf-idr-bgpls-srv6-ext-08 */ - BGP_LS_TLV_IS_IS_SRV6_LAN_END_X_SID_TLV = - 1107, /* draft-ietf-idr-bgpls-srv6-ext-08 */ - BGP_LS_TLV_OSPFV3_SRV6_LAN_END_X_SID_TLV = - 1108, /* draft-ietf-idr-bgpls-srv6-ext-08 */ - BGP_LS_TLV_UNIDIRECTIONAL_LINK_DELAY = 1114, /* RFC8571 */ - BGP_LS_TLV_MIN_MAX_UNIDIRECTIONAL_LINK_DELAY = 1115, /* RFC8571 */ - BGP_LS_TLV_UNIDIRECTIONAL_DELAY_VARIATION = 1116, /* RFC8571 */ - BGP_LS_TLV_UNIDIRECTIONAL_LINK_LOSS = 1117, /* RFC8571 */ - BGP_LS_TLV_UNIDIRECTIONAL_RESIDUAL_BANDWIDTH = 1118, /* RFC8571 */ - BGP_LS_TLV_UNIDIRECTIONAL_AVAILABLE_BANDWIDTH = 1119, /* RFC8571 */ - BGP_LS_TLV_UNIDIRECTIONAL_UTILIZED_BANDWIDTH = 1120, /* RFC8571 */ - BGP_LS_TLV_GRACEFUL_LINK_SHUTDOWN_TLV = 1121, /* RFC8379 */ - BGP_LS_TLV_APPLICATION_SPECIFIC_LINK_ATTRIBUTES = 1122, /* RFC9294 */ - BGP_LS_TLV_IGP_FLAGS = 1152, /* RFC7752, Section 3.3.3.1 */ - BGP_LS_TLV_IGP_ROUTE_TAG = 1153, /* RFC5130 */ - BGP_LS_TLV_IGP_EXTENDED_ROUTE_TAG = 1154, /* RFC5130 */ - BGP_LS_TLV_PREFIX_METRIC = 1155, /* RFC5305 */ - BGP_LS_TLV_OSPF_FORWARDING_ADDRESS = 1156, /* RFC2328 */ - BGP_LS_TLV_OPAQUE_PREFIX_ATTRIBUTE = - 1157, /* RFC7752, Section 3.3.3.6 */ - BGP_LS_TLV_PREFIX_SID = 1158, /* RFC9085, Section 2.3.1 */ - BGP_LS_TLV_RANGE = 1159, /* RFC9085, Section 2.3.5 */ - BGP_LS_TLV_IS_IS_FLOOD_REFLECTION = - 1160, /* draft-ietf-idr-bgp-ls-isis-flood-reflection-02 */ - BGP_LS_TLV_SID_LABEL = 1161, /* RFC9085, Section 2.1.1 */ - BGP_LS_TLV_SRV6_LOCATOR_TLV = - 1162, /* draft-ietf-idr-bgpls-srv6-ext-08 */ - BGP_LS_TLV_PREFIX_ATTRIBUTES_FLAGS = 1170, /* RFC9085, Section 2.3.2 */ - BGP_LS_TLV_SOURCE_ROUTER_IDENTIFIER = 1171, /* RFC9085, Section 2.3.3 */ - BGP_LS_TLV_L2_BUNDLE_MEMBER_ATTRIBUTES = - 1172, /* RFC9085, Section 2.2.3 */ - BGP_LS_TLV_EXTENDED_ADMINISTRATIVE_GROUP = 1173, /* RFC9104 */ - BGP_LS_TLV_SOURCE_OSPF_ROUTER_ID = 1174, /* RFC9085, Section 2.3.4 */ - BGP_LS_TLV_MPLS_TE_POLICY_STATE_TLV = - 1200, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_BSID_TLV = - 1201, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_CP_STATE_TLV = - 1202, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_CP_NAME_TLV = - 1203, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_CP_CONSTRAINTS_TLV = - 1204, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_SEGMENT_LIST_TLV = - 1205, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_SEGMENT_SUB_TLV = - 1206, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_SEGMENT_LIST_METRIC_SUB_TLV = - 1207, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_AFFINITY_CONSTRAINT_SUB_TLV = - 1208, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_SRLG_CONSTRAINT_SUB_TLV = - 1209, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_BANDWIDTH_CONSTRAINT_SUB_TLV = - 1210, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_DISJOINT_GROUP_CONSTRAINT_SUB_TLV = - 1211, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SRV6_BSID_TLV = - 1212, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SR_POLICY_NAME_TLV = - 1213, /* draft-ietf-idr-te-lsp-distribution-17 */ - BGP_LS_TLV_SRV6_ENDPOINT_FUNCTION_TLV = - 1250, /* draft-ietf-idr-bgpls-srv6-ext-08 */ - BGP_LS_TLV_SRV6_BGP_PEER_NODE_SID_TLV = - 1251, /* draft-ietf-idr-bgpls-srv6-ext-08 */ - BGP_LS_TLV_SRV6_SID_STRUCTURE_TLV = - 1252, /* draft-ietf-idr-bgpls-srv6-ext-08 */ - BGP_LS_TLV_MAX = 1253, /* max TLV value for table size*/ -}; - -/* RFC7752 #3.2.1.4 IGP router-ID */ -enum bgp_ls_nlri_node_descr_ig_router_id_size { - BGP_LS_TLV_IGP_ROUTER_ID_ISIS_NON_PSEUDOWIRE_SIZE = 6, - BGP_LS_TLV_IGP_ROUTER_ID_ISIS_PSEUDOWIRE_SIZE = 7, - BGP_LS_TLV_IGP_ROUTER_ID_OSPF_NON_PSEUDOWIRE_SIZE = 4, - BGP_LS_TLV_IGP_ROUTER_ID_OSPF_PSEUDOWIRE_SIZE = 8, -}; - extern int bgp_nlri_parse_linkstate(struct peer *peer, struct attr *attr, struct bgp_nlri *packet, int withdraw); - extern void bgp_nlri_encode_linkstate(struct stream *s, const struct prefix *p); -extern char *bgp_linkstate_nlri_prefix_display(char *buf, size_t size, - uint16_t nlri_type, - uintptr_t prefix, uint16_t len); -extern void bgp_linkstate_nlri_prefix_json(json_object *json, - uint16_t nlri_type, uintptr_t prefix, - uint16_t len); - #endif /* BGP_LINKSTATE_TLV_H */ diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c44f8123b4..965e39888f 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -73,7 +73,6 @@ #include "bgpd/bgp_flowspec.h" #include "bgpd/bgp_flowspec_util.h" #include "bgpd/bgp_pbr.h" -#include "bgpd/bgp_linkstate_tlv.h" #include "bgpd/bgp_route_clippy.c" @@ -8799,14 +8798,6 @@ static void route_vty_out_route(struct bgp_dest *dest, const struct prefix *p, json ? NLRI_STRING_FORMAT_JSON_SIMPLE : NLRI_STRING_FORMAT_MIN, json); - } else if (p->family == AF_LINKSTATE) { - if (json) { - json_object_int_add(json, "version", dest->version); - bgp_linkstate_nlri_prefix_json( - json, p->u.prefix_linkstate.nlri_type, - p->u.prefix_linkstate.ptr, p->prefixlen); - } else - len = vty_out(vty, "%pFX", p); } else { if (!json) len = vty_out(vty, "%pFX", p); @@ -11045,10 +11036,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, " Time until Long-lived stale route deleted: %lu\n", llgr_remaining); } - if (safi == SAFI_LINKSTATE && json_paths) - bgp_linkstate_nlri_prefix_json( - json_path, bn->rn->p.u.prefix_linkstate.nlri_type, - bn->rn->p.u.prefix_linkstate.ptr, bn->rn->p.prefixlen); /* Output some debug about internal state of the dest flags */ if (json_paths) { diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 07340a2b72..2435e299b7 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -71,7 +71,6 @@ #include "bgpd/bgp_io.h" #include "bgpd/bgp_ecommunity.h" #include "bgpd/bgp_flowspec.h" -#include "bgpd/bgp_linkstate.h" #include "bgpd/bgp_labelpool.h" #include "bgpd/bgp_pbr.h" #include "bgpd/bgp_addpath.h" @@ -8396,7 +8395,6 @@ void bgp_init(unsigned short instance) #endif bgp_ethernetvpn_init(); bgp_flowspec_vty_init(); - bgp_linkstate_init(); /* Access list initialize. */ access_list_init(); diff --git a/bgpd/subdir.am b/bgpd/subdir.am index ca987ccb53..9326edc0fd 100644 --- a/bgpd/subdir.am +++ b/bgpd/subdir.am @@ -51,7 +51,6 @@ bgpd_libbgp_a_SOURCES = \ bgpd/bgp_label.c \ bgpd/bgp_labelpool.c \ bgpd/bgp_lcommunity.c \ - bgpd/bgp_linkstate.c \ bgpd/bgp_linkstate_tlv.c \ bgpd/bgp_mac.c \ bgpd/bgp_memory.c \ @@ -135,7 +134,6 @@ noinst_HEADERS += \ bgpd/bgp_label.h \ bgpd/bgp_labelpool.h \ bgpd/bgp_lcommunity.h \ - bgpd/bgp_linkstate.h \ bgpd/bgp_linkstate_tlv.h \ bgpd/bgp_mac.h \ bgpd/bgp_memory.h \ -- 2.39.5