Merge pull request #14562 from FRRouting/mergify/bp/dev/9.1/pr-14560

Linkstate reversal (backport #14560)
This commit is contained in:
Donatas Abraitis 2023-10-11 13:29:30 +03:00 committed by GitHub
commit 964c166f4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 63 additions and 4691 deletions

View File

@ -40,12 +40,8 @@
#endif #endif
#include "bgp_evpn.h" #include "bgp_evpn.h"
#include "bgp_flowspec_private.h" #include "bgp_flowspec_private.h"
#include "bgp_linkstate_tlv.h"
#include "bgp_mac.h" #include "bgp_mac.h"
DEFINE_MTYPE_STATIC(BGPD, BGP_ATTR_LS, "BGP Attribute Link-State");
DEFINE_MTYPE_STATIC(BGPD, BGP_ATTR_LS_DATA, "BGP Attribute Link-State Data");
/* Attribute strings for logging. */ /* Attribute strings for logging. */
static const struct message attr_str[] = { static const struct message attr_str[] = {
{BGP_ATTR_ORIGIN, "ORIGIN"}, {BGP_ATTR_ORIGIN, "ORIGIN"},
@ -69,7 +65,6 @@ static const struct message attr_str[] = {
#ifdef ENABLE_BGP_VNC_ATTR #ifdef ENABLE_BGP_VNC_ATTR
{BGP_ATTR_VNC, "VNC"}, {BGP_ATTR_VNC, "VNC"},
#endif #endif
{BGP_ATTR_LINK_STATE, "LINK_STATE"},
{BGP_ATTR_LARGE_COMMUNITIES, "LARGE_COMMUNITY"}, {BGP_ATTR_LARGE_COMMUNITIES, "LARGE_COMMUNITY"},
{BGP_ATTR_PREFIX_SID, "PREFIX_SID"}, {BGP_ATTR_PREFIX_SID, "PREFIX_SID"},
{BGP_ATTR_IPV6_EXT_COMMUNITIES, "IPV6_EXT_COMMUNITIES"}, {BGP_ATTR_IPV6_EXT_COMMUNITIES, "IPV6_EXT_COMMUNITIES"},
@ -204,8 +199,6 @@ static struct hash *vnc_hash = NULL;
static struct hash *srv6_l3vpn_hash; static struct hash *srv6_l3vpn_hash;
static struct hash *srv6_vpn_hash; static struct hash *srv6_vpn_hash;
static struct hash *link_state_hash;
struct bgp_attr_encap_subtlv *encap_tlv_dup(struct bgp_attr_encap_subtlv *orig) struct bgp_attr_encap_subtlv *encap_tlv_dup(struct bgp_attr_encap_subtlv *orig)
{ {
struct bgp_attr_encap_subtlv *new; struct bgp_attr_encap_subtlv *new;
@ -723,99 +716,6 @@ static void srv6_finish(void)
hash_clean_and_free(&srv6_vpn_hash, (void (*)(void *))srv6_vpn_free); hash_clean_and_free(&srv6_vpn_hash, (void (*)(void *))srv6_vpn_free);
} }
static void *link_state_hash_alloc(void *p)
{
return p;
}
static void link_state_free(struct bgp_attr_ls *link_state)
{
XFREE(MTYPE_BGP_ATTR_LS_DATA, link_state->data);
XFREE(MTYPE_BGP_ATTR_LS, link_state);
}
static struct bgp_attr_ls *link_state_intern(struct bgp_attr_ls *link_state)
{
struct bgp_attr_ls *find;
find = hash_get(link_state_hash, link_state, link_state_hash_alloc);
if (find != link_state)
link_state_free(link_state);
find->refcnt++;
return find;
}
static void link_state_unintern(struct bgp_attr_ls **link_statep)
{
struct bgp_attr_ls *link_state = *link_statep;
if (!*link_statep)
return;
if (link_state->refcnt)
link_state->refcnt--;
if (link_state->refcnt == 0) {
hash_release(link_state_hash, link_state);
link_state_free(link_state);
*link_statep = NULL;
}
}
static uint32_t link_state_hash_key_make(const void *p)
{
const struct bgp_attr_ls *link_state = p;
uint32_t key = 0;
key = jhash_1word(link_state->length, key);
key = jhash(link_state->data, link_state->length, key);
return key;
}
static bool link_state_hash_cmp(const void *p1, const void *p2)
{
const struct bgp_attr_ls *link_state1 = p1;
const struct bgp_attr_ls *link_state2 = p2;
if (!link_state1 && link_state2)
return false;
if (link_state1 && !link_state2)
return false;
if (!link_state1 && !link_state2)
return true;
if (link_state1->length != link_state2->length)
return false;
return !memcmp(link_state1->data, link_state2->data,
link_state1->length);
}
static bool link_state_same(const struct bgp_attr_ls *h1,
const struct bgp_attr_ls *h2)
{
if (h1 == h2)
return true;
else if (h1 == NULL || h2 == NULL)
return false;
else
return link_state_hash_cmp((const void *)h1, (const void *)h2);
}
static void link_state_init(void)
{
link_state_hash =
hash_create(link_state_hash_key_make, link_state_hash_cmp,
"BGP Link-State Attributes TLVs");
}
static void link_state_finish(void)
{
hash_clean_and_free(&link_state_hash,
(void (*)(void *))link_state_free);
}
static unsigned int transit_hash_key_make(const void *p) static unsigned int transit_hash_key_make(const void *p)
{ {
const struct transit *transit = p; const struct transit *transit = p;
@ -905,8 +805,6 @@ unsigned int attrhash_key_make(const void *p)
MIX(attr->bh_type); MIX(attr->bh_type);
MIX(attr->otc); MIX(attr->otc);
MIX(bgp_attr_get_aigp_metric(attr)); MIX(bgp_attr_get_aigp_metric(attr));
if (attr->link_state)
MIX(link_state_hash_key_make(attr->link_state));
return key; return key;
} }
@ -972,8 +870,7 @@ bool attrhash_cmp(const void *p1, const void *p2)
attr1->srte_color == attr2->srte_color && attr1->srte_color == attr2->srte_color &&
attr1->nh_type == attr2->nh_type && attr1->nh_type == attr2->nh_type &&
attr1->bh_type == attr2->bh_type && attr1->bh_type == attr2->bh_type &&
attr1->otc == attr2->otc && attr1->otc == attr2->otc)
link_state_same(attr1->link_state, attr2->link_state))
return true; return true;
} }
@ -1133,12 +1030,6 @@ struct attr *bgp_attr_intern(struct attr *attr)
else else
attr->srv6_vpn->refcnt++; attr->srv6_vpn->refcnt++;
} }
if (attr->link_state) {
if (!attr->link_state->refcnt)
attr->link_state = link_state_intern(attr->link_state);
else
attr->link_state->refcnt++;
}
#ifdef ENABLE_BGP_VNC #ifdef ENABLE_BGP_VNC
struct bgp_attr_encap_subtlv *vnc_subtlvs = struct bgp_attr_encap_subtlv *vnc_subtlvs =
bgp_attr_get_vnc_subtlvs(attr); bgp_attr_get_vnc_subtlvs(attr);
@ -1357,8 +1248,6 @@ void bgp_attr_unintern_sub(struct attr *attr)
srv6_l3vpn_unintern(&attr->srv6_l3vpn); srv6_l3vpn_unintern(&attr->srv6_l3vpn);
srv6_vpn_unintern(&attr->srv6_vpn); srv6_vpn_unintern(&attr->srv6_vpn);
link_state_unintern(&attr->link_state);
} }
/* Free bgp attribute and aspath. */ /* Free bgp attribute and aspath. */
@ -1522,7 +1411,6 @@ bgp_attr_malformed(struct bgp_attr_parser_args *args, uint8_t subcode,
case BGP_ATTR_ENCAP: case BGP_ATTR_ENCAP:
case BGP_ATTR_OTC: case BGP_ATTR_OTC:
return BGP_ATTR_PARSE_WITHDRAW; return BGP_ATTR_PARSE_WITHDRAW;
case BGP_ATTR_LINK_STATE:
case BGP_ATTR_MP_REACH_NLRI: case BGP_ATTR_MP_REACH_NLRI:
case BGP_ATTR_MP_UNREACH_NLRI: case BGP_ATTR_MP_UNREACH_NLRI:
bgp_notify_send_with_data(peer->connection, bgp_notify_send_with_data(peer->connection,
@ -1609,7 +1497,6 @@ const uint8_t attr_flags_values[] = {
[BGP_ATTR_IPV6_EXT_COMMUNITIES] = [BGP_ATTR_IPV6_EXT_COMMUNITIES] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_AIGP] = BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_AIGP] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_LINK_STATE] = BGP_ATTR_FLAG_OPTIONAL,
}; };
static const size_t attr_flags_values_max = array_size(attr_flags_values) - 1; static const size_t attr_flags_values_max = array_size(attr_flags_values) - 1;
@ -3403,32 +3290,6 @@ aigp_ignore:
return bgp_attr_ignore(peer, args->type); return bgp_attr_ignore(peer, args->type);
} }
/* Link-State (rfc7752) */
static enum bgp_attr_parse_ret
bgp_attr_linkstate(struct bgp_attr_parser_args *args)
{
struct peer *const peer = args->peer;
struct attr *const attr = args->attr;
const bgp_size_t length = args->length;
struct stream *s = peer->curr;
struct bgp_attr_ls *bgp_attr_ls;
void *bgp_attr_ls_data;
if (STREAM_READABLE(s) == 0)
return BGP_ATTR_PARSE_PROCEED;
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LINK_STATE);
bgp_attr_ls = XCALLOC(MTYPE_BGP_ATTR_LS, sizeof(struct bgp_attr_ls));
bgp_attr_ls->length = length;
bgp_attr_ls_data = XCALLOC(MTYPE_BGP_ATTR_LS_DATA, length);
bgp_attr_ls->data = bgp_attr_ls_data;
stream_get(bgp_attr_ls_data, s, length);
attr->link_state = link_state_intern(bgp_attr_ls);
return BGP_ATTR_PARSE_PROCEED;
}
/* OTC attribute. */ /* OTC attribute. */
static enum bgp_attr_parse_ret bgp_attr_otc(struct bgp_attr_parser_args *args) static enum bgp_attr_parse_ret bgp_attr_otc(struct bgp_attr_parser_args *args)
{ {
@ -3886,9 +3747,6 @@ enum bgp_attr_parse_ret bgp_attr_parse(struct peer *peer, struct attr *attr,
case BGP_ATTR_AIGP: case BGP_ATTR_AIGP:
ret = bgp_attr_aigp(&attr_args); ret = bgp_attr_aigp(&attr_args);
break; break;
case BGP_ATTR_LINK_STATE:
ret = bgp_attr_linkstate(&attr_args);
break;
default: default:
ret = bgp_attr_unknown(&attr_args); ret = bgp_attr_unknown(&attr_args);
break; break;
@ -4145,8 +4003,6 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi,
switch (nh_afi) { switch (nh_afi) {
case AFI_IP: case AFI_IP:
switch (safi) { switch (safi) {
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_UNICAST: case SAFI_UNICAST:
case SAFI_MULTICAST: case SAFI_MULTICAST:
case SAFI_LABELED_UNICAST: case SAFI_LABELED_UNICAST:
@ -4180,8 +4036,6 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi,
break; break;
case AFI_IP6: case AFI_IP6:
switch (safi) { switch (safi) {
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_UNICAST: case SAFI_UNICAST:
case SAFI_MULTICAST: case SAFI_MULTICAST:
case SAFI_LABELED_UNICAST: case SAFI_LABELED_UNICAST:
@ -4232,9 +4086,8 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi,
break; break;
} }
break; break;
case AFI_LINKSTATE:
case AFI_L2VPN: case AFI_L2VPN:
if (nh_afi == AFI_L2VPN && safi != SAFI_FLOWSPEC) if (safi != SAFI_FLOWSPEC)
flog_err( flog_err(
EC_BGP_ATTR_NH_SEND_LEN, EC_BGP_ATTR_NH_SEND_LEN,
"Bad nexthop when sending to %s, AFI %u SAFI %u nhlen %d", "Bad nexthop when sending to %s, AFI %u SAFI %u nhlen %d",
@ -4285,12 +4138,6 @@ void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi,
stream_put_labeled_prefix(s, p, label, addpath_capable, stream_put_labeled_prefix(s, p, label, addpath_capable,
addpath_tx_id); addpath_tx_id);
break; break;
case SAFI_LINKSTATE:
bgp_nlri_encode_linkstate(s, p);
break;
case SAFI_LINKSTATE_VPN:
/* not yet supported */
break;
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
stream_putc(s, p->u.prefix_flowspec.prefixlen); stream_putc(s, p->u.prefix_flowspec.prefixlen);
stream_put(s, (const void *)p->u.prefix_flowspec.ptr, stream_put(s, (const void *)p->u.prefix_flowspec.ptr,
@ -4317,8 +4164,6 @@ size_t bgp_packet_mpattr_prefix_size(afi_t afi, safi_t safi,
case SAFI_MAX: case SAFI_MAX:
assert(!"Attempting to figure size for a SAFI_UNSPEC/SAFI_MAX this is a DEV ESCAPE"); assert(!"Attempting to figure size for a SAFI_UNSPEC/SAFI_MAX this is a DEV ESCAPE");
break; break;
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_UNICAST: case SAFI_UNICAST:
case SAFI_MULTICAST: case SAFI_MULTICAST:
break; break;
@ -4981,14 +4826,6 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
#endif #endif
} }
/* BGP Link-State */
if (attr->link_state) {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL);
stream_putc(s, BGP_ATTR_LINK_STATE);
stream_putc(s, attr->link_state->length);
stream_put(s, attr->link_state->data, attr->link_state->length);
}
/* PMSI Tunnel */ /* PMSI Tunnel */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)) {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS); stream_putc(s, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS);
@ -5093,7 +4930,6 @@ void bgp_attr_init(void)
transit_init(); transit_init();
encap_init(); encap_init();
srv6_init(); srv6_init();
link_state_init();
} }
void bgp_attr_finish(void) void bgp_attr_finish(void)
@ -5107,7 +4943,6 @@ void bgp_attr_finish(void)
transit_finish(); transit_finish();
encap_finish(); encap_finish();
srv6_finish(); srv6_finish();
link_state_finish();
} }
/* Make attribute packet. */ /* Make attribute packet. */

View File

@ -136,13 +136,6 @@ struct bgp_attr_srv6_l3vpn {
uint8_t transposition_offset; uint8_t transposition_offset;
}; };
struct bgp_attr_ls {
unsigned long refcnt;
uint8_t length;
void *data;
};
/* BGP core attribute structure. */ /* BGP core attribute structure. */
struct attr { struct attr {
/* AS Path structure */ /* AS Path structure */
@ -166,8 +159,6 @@ struct attr {
/* Path origin attribute */ /* Path origin attribute */
uint8_t origin; uint8_t origin;
struct bgp_attr_ls *link_state; /* BGP Link State attribute */
/* PMSI tunnel type (RFC 6514). */ /* PMSI tunnel type (RFC 6514). */
enum pta_type pmsi_tnl_type; enum pta_type pmsi_tnl_type;

View File

@ -177,9 +177,6 @@ int main(int argc, char **argv)
case AFI_IP6: case AFI_IP6:
printf("/AFI_IP6\n"); printf("/AFI_IP6\n");
break; break;
case AFI_LINKSTATE:
printf("/AFI_LINKSTATE\n");
break;
default: default:
printf("/UNKNOWN %d", subtype); printf("/UNKNOWN %d", subtype);
break; break;

View File

@ -51,7 +51,6 @@ unsigned long conf_bgp_debug_nht;
unsigned long conf_bgp_debug_update_groups; unsigned long conf_bgp_debug_update_groups;
unsigned long conf_bgp_debug_vpn; unsigned long conf_bgp_debug_vpn;
unsigned long conf_bgp_debug_flowspec; unsigned long conf_bgp_debug_flowspec;
unsigned long conf_bgp_debug_linkstate;
unsigned long conf_bgp_debug_labelpool; unsigned long conf_bgp_debug_labelpool;
unsigned long conf_bgp_debug_pbr; unsigned long conf_bgp_debug_pbr;
unsigned long conf_bgp_debug_graceful_restart; unsigned long conf_bgp_debug_graceful_restart;
@ -73,7 +72,6 @@ unsigned long term_bgp_debug_nht;
unsigned long term_bgp_debug_update_groups; unsigned long term_bgp_debug_update_groups;
unsigned long term_bgp_debug_vpn; unsigned long term_bgp_debug_vpn;
unsigned long term_bgp_debug_flowspec; unsigned long term_bgp_debug_flowspec;
unsigned long term_bgp_debug_linkstate;
unsigned long term_bgp_debug_labelpool; unsigned long term_bgp_debug_labelpool;
unsigned long term_bgp_debug_pbr; unsigned long term_bgp_debug_pbr;
unsigned long term_bgp_debug_graceful_restart; unsigned long term_bgp_debug_graceful_restart;

View File

@ -60,7 +60,6 @@ extern unsigned long conf_bgp_debug_nht;
extern unsigned long conf_bgp_debug_update_groups; extern unsigned long conf_bgp_debug_update_groups;
extern unsigned long conf_bgp_debug_vpn; extern unsigned long conf_bgp_debug_vpn;
extern unsigned long conf_bgp_debug_flowspec; extern unsigned long conf_bgp_debug_flowspec;
extern unsigned long conf_bgp_debug_linkstate;
extern unsigned long conf_bgp_debug_labelpool; extern unsigned long conf_bgp_debug_labelpool;
extern unsigned long conf_bgp_debug_pbr; extern unsigned long conf_bgp_debug_pbr;
extern unsigned long conf_bgp_debug_graceful_restart; extern unsigned long conf_bgp_debug_graceful_restart;
@ -80,7 +79,6 @@ extern unsigned long term_bgp_debug_nht;
extern unsigned long term_bgp_debug_update_groups; extern unsigned long term_bgp_debug_update_groups;
extern unsigned long term_bgp_debug_vpn; extern unsigned long term_bgp_debug_vpn;
extern unsigned long term_bgp_debug_flowspec; extern unsigned long term_bgp_debug_flowspec;
extern unsigned long term_bgp_debug_linkstate;
extern unsigned long term_bgp_debug_labelpool; extern unsigned long term_bgp_debug_labelpool;
extern unsigned long term_bgp_debug_pbr; extern unsigned long term_bgp_debug_pbr;
extern unsigned long term_bgp_debug_graceful_restart; extern unsigned long term_bgp_debug_graceful_restart;
@ -120,7 +118,6 @@ struct bgp_debug_filter {
#define BGP_DEBUG_VPN_LEAK_RMAP_EVENT 0x04 #define BGP_DEBUG_VPN_LEAK_RMAP_EVENT 0x04
#define BGP_DEBUG_VPN_LEAK_LABEL 0x08 #define BGP_DEBUG_VPN_LEAK_LABEL 0x08
#define BGP_DEBUG_FLOWSPEC 0x01 #define BGP_DEBUG_FLOWSPEC 0x01
#define BGP_DEBUG_LINKSTATE 0x01
#define BGP_DEBUG_LABELPOOL 0x01 #define BGP_DEBUG_LABELPOOL 0x01
#define BGP_DEBUG_PBR 0x01 #define BGP_DEBUG_PBR 0x01
#define BGP_DEBUG_PBR_ERROR 0x02 #define BGP_DEBUG_PBR_ERROR 0x02

View File

@ -449,12 +449,6 @@ static struct log_ref ferr_bgp_err[] = {
.description = "The BGP flowspec subsystem has detected that there was a failure for installation/removal/modification of Flowspec from the dataplane", .description = "The BGP flowspec subsystem has detected that there was a failure for installation/removal/modification of Flowspec from the dataplane",
.suggestion = "Gather log files from the router and open an issue, Restart FRR" .suggestion = "Gather log files from the router and open an issue, Restart FRR"
}, },
{
.code = EC_BGP_LINKSTATE_PACKET,
.title = "BGP Link-State packet processing error",
.description = "The BGP Link-State subsystem has detected a error in the send or receive of a packet",
.suggestion = "Gather log files from both sides of the peering relationship and open an issue"
},
{ {
.code = EC_BGP_DOPPELGANGER_CONFIG, .code = EC_BGP_DOPPELGANGER_CONFIG,
.title = "BGP has detected a configuration overwrite during peer collision resolution", .title = "BGP has detected a configuration overwrite during peer collision resolution",

View File

@ -59,7 +59,6 @@ enum bgp_log_refs {
EC_BGP_EVPN_INSTANCE_MISMATCH, EC_BGP_EVPN_INSTANCE_MISMATCH,
EC_BGP_FLOWSPEC_PACKET, EC_BGP_FLOWSPEC_PACKET,
EC_BGP_FLOWSPEC_INSTALLATION, EC_BGP_FLOWSPEC_INSTALLATION,
EC_BGP_LINKSTATE_PACKET,
EC_BGP_ASPATH_FEWER_HOPS, EC_BGP_ASPATH_FEWER_HOPS,
EC_BGP_DEFUNCT_SNPA_LEN, EC_BGP_DEFUNCT_SNPA_LEN,
EC_BGP_MISSING_ATTRIBUTE, EC_BGP_MISSING_ATTRIBUTE,

View File

@ -1,21 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* BGP Link-State
* Copyright 2023 6WIND S.A.
*/
#include <zebra.h>
#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);
}

View File

@ -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 */

File diff suppressed because it is too large Load Diff

View File

@ -1,226 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* BGP Link-State TLV Serializer/Deserializer header
* Copyright 2023 6WIND S.A.
*/
#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 = 1252, /* 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);
extern void bgp_linkstate_tlv_attribute_display(struct vty *vty,
struct bgp_attr_ls *attr_ls,
int indent, json_object *json);
#endif /* BGP_LINKSTATE_TLV_H */

View File

@ -1,53 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* BGP Link-State VTY
* Copyright 2023 6WIND S.A.
*/
#include <zebra.h>
#include "command.h"
#include "prefix.h"
#include "lib/json.h"
#include "lib/printfrr.h"
#include "stream.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_linkstate_vty.h"
#include "bgpd/bgp_linkstate.h"
#include "bgpd/bgp_zebra.h"
#include "bgpd/bgp_vty.h"
#include "bgpd/bgp_debug.h"
#include "bgpd/bgp_linkstate_vty_clippy.c"
DEFPY (debug_bgp_linkstate,
debug_bgp_linkstate_cmd,
"[no] debug bgp linkstate",
NO_STR
DEBUG_STR
BGP_STR
"BGP allow linkstate debugging entries\n")
{
if (vty->node == CONFIG_NODE) {
if (no)
DEBUG_OFF(linkstate, LINKSTATE);
else
DEBUG_ON(linkstate, LINKSTATE);
} else {
if (no)
TERM_DEBUG_OFF(linkstate, LINKSTATE);
else
TERM_DEBUG_ON(linkstate, LINKSTATE);
vty_out(vty, "BGP linkstate debugging is %s\n",
no ? "off" : "on");
}
return CMD_SUCCESS;
}
void bgp_linkstate_vty_init(void)
{
install_element(ENABLE_NODE, &debug_bgp_linkstate_cmd);
install_element(CONFIG_NODE, &debug_bgp_linkstate_cmd);
}

View File

@ -1,11 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* BGP Link-State VTY header
* Copyright 2023 6WIND S.A.
*/
#ifndef _FRR_BGP_LINKSTATE_VTY_H
#define _FRR_BGP_LINKSTATE_VTY_H
void bgp_linkstate_vty_init(void);
#endif /* _FRR_BGP_LINKSTATE_VTY_H */

View File

@ -147,12 +147,6 @@ void bgp_capability_vty_out(struct vty *vty, struct peer *peer, bool use_json,
"capabilityErrorMultiProtocolAfi", "capabilityErrorMultiProtocolAfi",
"L2VPN"); "L2VPN");
break; break;
case AFI_LINKSTATE:
json_object_string_add(
json_cap,
"capabilityErrorMultiProtocolAfi",
"Link State");
break;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_MAX: case AFI_MAX:
json_object_int_add( json_object_int_add(
@ -204,18 +198,6 @@ void bgp_capability_vty_out(struct vty *vty, struct peer *peer, bool use_json,
"capabilityErrorMultiProtocolSafi", "capabilityErrorMultiProtocolSafi",
"flowspec"); "flowspec");
break; break;
case SAFI_LINKSTATE:
json_object_string_add(
json_cap,
"capabilityErrorMultiProtocolSafi",
"Link State");
break;
case SAFI_LINKSTATE_VPN:
json_object_string_add(
json_cap,
"capabilityErrorMultiProtocolSafi",
"Link State VPN");
break;
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_MAX: case SAFI_MAX:
json_object_int_add( json_object_int_add(
@ -237,9 +219,6 @@ void bgp_capability_vty_out(struct vty *vty, struct peer *peer, bool use_json,
case AFI_L2VPN: case AFI_L2VPN:
vty_out(vty, "AFI L2VPN, "); vty_out(vty, "AFI L2VPN, ");
break; break;
case AFI_LINKSTATE:
vty_out(vty, "AFI Link State, ");
break;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_MAX: case AFI_MAX:
vty_out(vty, "AFI Unknown %d, ", vty_out(vty, "AFI Unknown %d, ",
@ -268,12 +247,6 @@ void bgp_capability_vty_out(struct vty *vty, struct peer *peer, bool use_json,
case SAFI_EVPN: case SAFI_EVPN:
vty_out(vty, "SAFI EVPN"); vty_out(vty, "SAFI EVPN");
break; break;
case SAFI_LINKSTATE:
vty_out(vty, "SAFI LINK STATE");
break;
case SAFI_LINKSTATE_VPN:
vty_out(vty, "SAFI LINK STATE VPN");
break;
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_MAX: case SAFI_MAX:
vty_out(vty, "SAFI Unknown %d ", vty_out(vty, "SAFI Unknown %d ",
@ -1441,8 +1414,7 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length,
&& !peer->afc_nego[AFI_IP6][SAFI_MPLS_VPN] && !peer->afc_nego[AFI_IP6][SAFI_MPLS_VPN]
&& !peer->afc_nego[AFI_IP6][SAFI_ENCAP] && !peer->afc_nego[AFI_IP6][SAFI_ENCAP]
&& !peer->afc_nego[AFI_IP6][SAFI_FLOWSPEC] && !peer->afc_nego[AFI_IP6][SAFI_FLOWSPEC]
&& !peer->afc_nego[AFI_L2VPN][SAFI_EVPN] && !peer->afc_nego[AFI_L2VPN][SAFI_EVPN]) {
&& !peer->afc_nego[AFI_LINKSTATE][SAFI_LINKSTATE]) {
flog_err(EC_BGP_PKT_OPEN, flog_err(EC_BGP_PKT_OPEN,
"%s [Error] Configured AFI/SAFIs do not overlap with received MP capabilities", "%s [Error] Configured AFI/SAFIs do not overlap with received MP capabilities",
peer->host); peer->host);

View File

@ -48,7 +48,6 @@
#include "bgpd/bgp_io.h" #include "bgpd/bgp_io.h"
#include "bgpd/bgp_keepalives.h" #include "bgpd/bgp_keepalives.h"
#include "bgpd/bgp_flowspec.h" #include "bgpd/bgp_flowspec.h"
#include "bgpd/bgp_linkstate_tlv.h"
#include "bgpd/bgp_trace.h" #include "bgpd/bgp_trace.h"
DEFINE_HOOK(bgp_packet_dump, DEFINE_HOOK(bgp_packet_dump,
@ -350,11 +349,7 @@ int bgp_nlri_parse(struct peer *peer, struct attr *attr,
return bgp_nlri_parse_evpn(peer, attr, packet, mp_withdraw); return bgp_nlri_parse_evpn(peer, attr, packet, mp_withdraw);
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
return bgp_nlri_parse_flowspec(peer, attr, packet, mp_withdraw); return bgp_nlri_parse_flowspec(peer, attr, packet, mp_withdraw);
case SAFI_LINKSTATE:
return bgp_nlri_parse_linkstate(peer, attr, packet,
mp_withdraw);
} }
return BGP_NLRI_PARSE_ERROR; return BGP_NLRI_PARSE_ERROR;
} }
@ -1901,8 +1896,6 @@ static int bgp_open_receive(struct peer_connection *connection,
peer->afc[AFI_L2VPN][SAFI_EVPN]; peer->afc[AFI_L2VPN][SAFI_EVPN];
peer->afc_nego[AFI_IP6][SAFI_FLOWSPEC] = peer->afc_nego[AFI_IP6][SAFI_FLOWSPEC] =
peer->afc[AFI_IP6][SAFI_FLOWSPEC]; peer->afc[AFI_IP6][SAFI_FLOWSPEC];
peer->afc_nego[AFI_LINKSTATE][SAFI_LINKSTATE] =
peer->afc[AFI_LINKSTATE][SAFI_LINKSTATE];
} }
/* Verify valid local address present based on negotiated /* Verify valid local address present based on negotiated

View File

@ -73,7 +73,6 @@
#include "bgpd/bgp_flowspec.h" #include "bgpd/bgp_flowspec.h"
#include "bgpd/bgp_flowspec_util.h" #include "bgpd/bgp_flowspec_util.h"
#include "bgpd/bgp_pbr.h" #include "bgpd/bgp_pbr.h"
#include "bgpd/bgp_linkstate_tlv.h"
#include "bgpd/bgp_route_clippy.c" #include "bgpd/bgp_route_clippy.c"
@ -1582,7 +1581,7 @@ static enum filter_type bgp_input_filter(struct peer *peer,
done: done:
if (frrtrace_enabled(frr_bgp, input_filter)) { if (frrtrace_enabled(frr_bgp, input_filter)) {
char pfxprint[PREFIX_STRLEN_EXTENDED]; char pfxprint[PREFIX2STR_BUFFER];
prefix2str(p, pfxprint, sizeof(pfxprint)); prefix2str(p, pfxprint, sizeof(pfxprint));
frrtrace(5, frr_bgp, input_filter, peer, pfxprint, afi, safi, frrtrace(5, frr_bgp, input_filter, peer, pfxprint, afi, safi,
@ -1639,7 +1638,7 @@ static enum filter_type bgp_output_filter(struct peer *peer,
} }
if (frrtrace_enabled(frr_bgp, output_filter)) { if (frrtrace_enabled(frr_bgp, output_filter)) {
char pfxprint[PREFIX_STRLEN_EXTENDED]; char pfxprint[PREFIX2STR_BUFFER];
prefix2str(p, pfxprint, sizeof(pfxprint)); prefix2str(p, pfxprint, sizeof(pfxprint));
frrtrace(5, frr_bgp, output_filter, peer, pfxprint, afi, safi, frrtrace(5, frr_bgp, output_filter, peer, pfxprint, afi, safi,
@ -2713,7 +2712,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,
int paths_eq, do_mpath; int paths_eq, do_mpath;
bool debug; bool debug;
struct list mp_list; struct list mp_list;
char pfx_buf[PREFIX_STRLEN_EXTENDED] = {}; char pfx_buf[PREFIX2STR_BUFFER] = {};
char path_buf[PATH_ADDPATH_STR_BUFFER]; char path_buf[PATH_ADDPATH_STR_BUFFER];
bgp_mp_list_init(&mp_list); bgp_mp_list_init(&mp_list);
@ -4168,7 +4167,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
int allowas_in = 0; int allowas_in = 0;
if (frrtrace_enabled(frr_bgp, process_update)) { if (frrtrace_enabled(frr_bgp, process_update)) {
char pfxprint[PREFIX_STRLEN_EXTENDED]; char pfxprint[PREFIX2STR_BUFFER];
prefix2str(p, pfxprint, sizeof(pfxprint)); prefix2str(p, pfxprint, sizeof(pfxprint));
frrtrace(6, frr_bgp, process_update, peer, pfxprint, addpath_id, frrtrace(6, frr_bgp, process_update, peer, pfxprint, addpath_id,
@ -4730,8 +4729,8 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
(safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST || (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST ||
(safi == SAFI_MPLS_VPN && (safi == SAFI_MPLS_VPN &&
pi->sub_type != BGP_ROUTE_IMPORTED))) || pi->sub_type != BGP_ROUTE_IMPORTED))) ||
(safi == SAFI_EVPN && bgp_evpn_is_prefix_nht_supported(p)) || (safi == SAFI_EVPN &&
afi == AFI_LINKSTATE) { bgp_evpn_is_prefix_nht_supported(p))) {
if (safi != SAFI_EVPN && peer->sort == BGP_PEER_EBGP if (safi != SAFI_EVPN && peer->sort == BGP_PEER_EBGP
&& peer->ttl == BGP_DEFAULT_TTL && peer->ttl == BGP_DEFAULT_TTL
&& !CHECK_FLAG(peer->flags, && !CHECK_FLAG(peer->flags,
@ -4878,9 +4877,9 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
/* Nexthop reachability check. */ /* Nexthop reachability check. */
if (((afi == AFI_IP || afi == AFI_IP6) && if (((afi == AFI_IP || afi == AFI_IP6) &&
(safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST || (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST ||
(safi == SAFI_MPLS_VPN && new->sub_type != BGP_ROUTE_IMPORTED))) || (safi == SAFI_MPLS_VPN &&
(safi == SAFI_EVPN && bgp_evpn_is_prefix_nht_supported(p)) || new->sub_type != BGP_ROUTE_IMPORTED))) ||
afi == AFI_LINKSTATE) { (safi == SAFI_EVPN && bgp_evpn_is_prefix_nht_supported(p))) {
if (safi != SAFI_EVPN && peer->sort == BGP_PEER_EBGP if (safi != SAFI_EVPN && peer->sort == BGP_PEER_EBGP
&& peer->ttl == BGP_DEFAULT_TTL && peer->ttl == BGP_DEFAULT_TTL
&& !CHECK_FLAG(peer->flags, && !CHECK_FLAG(peer->flags,
@ -8773,7 +8772,7 @@ static void route_vty_out_route(struct bgp_dest *dest, const struct prefix *p,
struct vty *vty, json_object *json, bool wide) struct vty *vty, json_object *json, bool wide)
{ {
int len = 0; int len = 0;
char buf[PREFIX_STRLEN_EXTENDED]; char buf[INET6_ADDRSTRLEN];
if (p->family == AF_INET) { if (p->family == AF_INET) {
if (!json) { if (!json) {
@ -8799,14 +8798,6 @@ static void route_vty_out_route(struct bgp_dest *dest, const struct prefix *p,
json ? json ?
NLRI_STRING_FORMAT_JSON_SIMPLE : NLRI_STRING_FORMAT_JSON_SIMPLE :
NLRI_STRING_FORMAT_MIN, json); 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 { } else {
if (!json) if (!json)
len = vty_out(vty, "%pFX", p); len = vty_out(vty, "%pFX", p);
@ -10112,7 +10103,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
json_object *json_peer = NULL; json_object *json_peer = NULL;
json_object *json_string = NULL; json_object *json_string = NULL;
json_object *json_adv_to = NULL; json_object *json_adv_to = NULL;
json_object *json_bgp_ls_attr = NULL;
int first = 0; int first = 0;
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct peer *peer; struct peer *peer;
@ -11047,28 +11037,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
llgr_remaining); llgr_remaining);
} }
if (safi == SAFI_LINKSTATE) {
/* BGP Link-State NLRI */
if (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);
/* BGP Link-State Attributes */
if (attr->link_state) {
if (json_paths) {
json_bgp_ls_attr = json_object_new_object();
json_object_object_add(json_path,
"linkStateAttributes",
json_bgp_ls_attr);
} else {
vty_out(vty, " BGP-LS attributes:\n");
}
bgp_linkstate_tlv_attribute_display(
vty, attr->link_state, 4, json_bgp_ls_attr);
}
}
/* Output some debug about internal state of the dest flags */ /* Output some debug about internal state of the dest flags */
if (json_paths) { if (json_paths) {
if (CHECK_FLAG(bn->flags, BGP_NODE_PROCESS_SCHEDULED)) if (CHECK_FLAG(bn->flags, BGP_NODE_PROCESS_SCHEDULED))
@ -11451,7 +11419,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t sa
vty_out(vty, ASN_FORMAT(bgp->asnotation), vty_out(vty, ASN_FORMAT(bgp->asnotation),
&bgp->as); &bgp->as);
vty_out(vty, "\n"); vty_out(vty, "\n");
if (!detail_routes && safi != SAFI_LINKSTATE) { if (!detail_routes) {
vty_out(vty, BGP_SHOW_SCODE_HEADER); vty_out(vty, BGP_SHOW_SCODE_HEADER);
vty_out(vty, BGP_SHOW_NCODE_HEADER); vty_out(vty, BGP_SHOW_NCODE_HEADER);
vty_out(vty, BGP_SHOW_OCODE_HEADER); vty_out(vty, BGP_SHOW_OCODE_HEADER);
@ -12084,8 +12052,6 @@ const struct prefix_rd *bgp_rd_from_dest(const struct bgp_dest *dest,
case SAFI_UNICAST: case SAFI_UNICAST:
case SAFI_MULTICAST: case SAFI_MULTICAST:
case SAFI_LABELED_UNICAST: case SAFI_LABELED_UNICAST:
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
case SAFI_MAX: case SAFI_MAX:
return NULL; return NULL;
@ -13002,62 +12968,6 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/* BGP route print out function */
DEFPY (show_ip_bgp_link_state, show_ip_bgp_link_state_cmd,
"show [ip] bgp [<view|vrf> VIEWVRFNAME] link-state link-state\
[all$all]\
[version (1-4294967295)\
|detail-routes$detail_routes\
] [json$uj [detail$detail_json] | wide$wide]",
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR
BGP_AF_STR
BGP_AF_MODIFIER_STR
"Display the entries for all address families\n"
"Display prefixes with matching version numbers\n"
"Version number and above\n"
"Display detailed version of all routes\n"
JSON_STR
"Display detailed version of JSON output\n"
"Increase table width for longer prefixes\n")
{
afi_t afi = AFI_LINKSTATE;
safi_t safi = SAFI_LINKSTATE;
enum bgp_show_type sh_type = bgp_show_type_normal;
void *output_arg = NULL;
struct bgp *bgp = NULL;
int idx = 0;
uint16_t show_flags = 0;
enum rpki_states rpki_target_state = RPKI_NOT_BEING_USED;
if (uj) {
argc--;
SET_FLAG(show_flags, BGP_SHOW_OPT_JSON);
}
if (detail_json)
SET_FLAG(show_flags, BGP_SHOW_OPT_JSON_DETAIL);
if (detail_routes)
SET_FLAG(show_flags, BGP_SHOW_OPT_ROUTES_DETAIL);
if (wide)
SET_FLAG(show_flags, BGP_SHOW_OPT_WIDE);
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
&bgp, uj);
if (!idx)
return CMD_WARNING;
/* Display prefixes with matching version numbers */
if (argv_find(argv, argc, "version", &idx)) {
sh_type = bgp_show_type_prefix_version;
output_arg = argv[idx + 1]->arg;
}
return bgp_show(vty, bgp, afi, safi, sh_type, output_arg, show_flags,
rpki_target_state);
}
DEFUN (show_ip_bgp_route, DEFUN (show_ip_bgp_route,
show_ip_bgp_route_cmd, show_ip_bgp_route_cmd,
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]]<A.B.C.D|A.B.C.D/M|X:X::X:X|X:X::X:X/M> [<bestpath|multipath>] [rpki <valid|invalid|notfound>] [json]", "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]]<A.B.C.D|A.B.C.D/M|X:X::X:X|X:X::X:X/M> [<bestpath|multipath>] [rpki <valid|invalid|notfound>] [json]",
@ -13138,13 +13048,13 @@ DEFUN (show_ip_bgp_route,
DEFUN (show_ip_bgp_regexp, DEFUN (show_ip_bgp_regexp,
show_ip_bgp_regexp_cmd, show_ip_bgp_regexp_cmd,
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_WITH_LS_CMD_STR" ["BGP_SAFI_WITH_LABEL_LS_CMD_STR"]] regexp REGEX [json]", "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] regexp REGEX [json]",
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
BGP_INSTANCE_HELP_STR BGP_INSTANCE_HELP_STR
BGP_AFI_WITH_LS_HELP_STR BGP_AFI_HELP_STR
BGP_SAFI_WITH_LABEL_LS_HELP_STR BGP_SAFI_WITH_LABEL_HELP_STR
"Display routes matching the AS path regular expression\n" "Display routes matching the AS path regular expression\n"
"A regular-expression (1234567890_^|[,{}() ]$*+.?-\\) to match the BGP AS paths\n" "A regular-expression (1234567890_^|[,{}() ]$*+.?-\\) to match the BGP AS paths\n"
JSON_STR) JSON_STR)
@ -13391,8 +13301,6 @@ static void bgp_table_stats_walker(struct event *t)
case AFI_L2VPN: case AFI_L2VPN:
space = EVPN_ROUTE_PREFIXLEN; space = EVPN_ROUTE_PREFIXLEN;
break; break;
case AFI_LINKSTATE:
/* TODO */
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_MAX: case AFI_MAX:
return; return;
@ -13649,8 +13557,6 @@ static int bgp_table_stats_single(struct vty *vty, struct bgp *bgp, afi_t afi,
case AFI_L2VPN: case AFI_L2VPN:
bitlen = EVPN_ROUTE_PREFIXLEN; bitlen = EVPN_ROUTE_PREFIXLEN;
break; break;
case AFI_LINKSTATE:
/* TODO */
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_MAX: case AFI_MAX:
break; break;
@ -14685,13 +14591,13 @@ DEFPY (show_ip_bgp_instance_neighbor_bestpath_route,
DEFPY(show_ip_bgp_instance_neighbor_advertised_route, DEFPY(show_ip_bgp_instance_neighbor_advertised_route,
show_ip_bgp_instance_neighbor_advertised_route_cmd, show_ip_bgp_instance_neighbor_advertised_route_cmd,
"show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_WITH_LS_CMD_STR " [" BGP_SAFI_WITH_LABEL_LS_CMD_STR "]] [all$all] neighbors <A.B.C.D|X:X::X:X|WORD> <advertised-routes|received-routes|filtered-routes> [route-map RMAP_NAME$route_map] [<A.B.C.D/M|X:X::X:X/M>$prefix | detail$detail] [json$uj | wide$wide]", "show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_CMD_STR " [" BGP_SAFI_WITH_LABEL_CMD_STR "]] [all$all] neighbors <A.B.C.D|X:X::X:X|WORD> <advertised-routes|received-routes|filtered-routes> [route-map RMAP_NAME$route_map] [<A.B.C.D/M|X:X::X:X/M>$prefix | detail$detail] [json$uj | wide$wide]",
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
BGP_INSTANCE_HELP_STR BGP_INSTANCE_HELP_STR
BGP_AFI_WITH_LS_HELP_STR BGP_AFI_HELP_STR
BGP_SAFI_WITH_LABEL_LS_HELP_STR BGP_SAFI_WITH_LABEL_HELP_STR
"Display the entries for all address families\n" "Display the entries for all address families\n"
"Detailed information on TCP and BGP neighbor connections\n" "Detailed information on TCP and BGP neighbor connections\n"
"Neighbor to display information about\n" "Neighbor to display information about\n"
@ -14745,12 +14651,6 @@ DEFPY(show_ip_bgp_instance_neighbor_advertised_route,
if (!idx) if (!idx)
return CMD_WARNING; return CMD_WARNING;
if (afi == AFI_LINKSTATE && prefix_str) {
vty_out(vty,
"The prefix option cannot be selected with AFI Link-State\n");
return CMD_WARNING;
}
/* neighbors <A.B.C.D|X:X::X:X|WORD> */ /* neighbors <A.B.C.D|X:X::X:X|WORD> */
argv_find(argv, argc, "neighbors", &idx); argv_find(argv, argc, "neighbors", &idx);
peerstr = argv[++idx]->arg; peerstr = argv[++idx]->arg;
@ -15973,7 +15873,6 @@ void bgp_route_init(void)
install_element(VIEW_NODE, &show_ip_bgp_l2vpn_evpn_statistics_cmd); install_element(VIEW_NODE, &show_ip_bgp_l2vpn_evpn_statistics_cmd);
install_element(VIEW_NODE, &show_ip_bgp_dampening_params_cmd); install_element(VIEW_NODE, &show_ip_bgp_dampening_params_cmd);
install_element(VIEW_NODE, &show_ip_bgp_cmd); install_element(VIEW_NODE, &show_ip_bgp_cmd);
install_element(VIEW_NODE, &show_ip_bgp_link_state_cmd);
install_element(VIEW_NODE, &show_ip_bgp_route_cmd); install_element(VIEW_NODE, &show_ip_bgp_route_cmd);
install_element(VIEW_NODE, &show_ip_bgp_regexp_cmd); install_element(VIEW_NODE, &show_ip_bgp_regexp_cmd);
install_element(VIEW_NODE, &show_ip_bgp_statistics_all_cmd); install_element(VIEW_NODE, &show_ip_bgp_statistics_all_cmd);

View File

@ -63,7 +63,7 @@ struct bgp_dest *bgp_dest_lock_node(struct bgp_dest *dest)
const char *bgp_dest_get_prefix_str(struct bgp_dest *dest) const char *bgp_dest_get_prefix_str(struct bgp_dest *dest)
{ {
const struct prefix *p = NULL; const struct prefix *p = NULL;
static char str[PREFIX_STRLEN_EXTENDED] = {0}; static char str[PREFIX_STRLEN] = {0};
p = bgp_dest_get_prefix(dest); p = bgp_dest_get_prefix(dest);
if (p) if (p)
@ -117,9 +117,6 @@ static void bgp_node_destroy(route_table_delegate_t *delegate,
node->info = NULL; node->info = NULL;
} }
if (family2afi(node->p.family) == AFI_LINKSTATE)
prefix_linkstate_ptr_free(&node->p);
XFREE(MTYPE_ROUTE_NODE, node); XFREE(MTYPE_ROUTE_NODE, node);
} }

View File

@ -168,8 +168,6 @@ static enum node_type bgp_node_type(afi_t afi, safi_t safi)
return BGP_VPNV4_NODE; return BGP_VPNV4_NODE;
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
return BGP_FLOWSPECV4_NODE; return BGP_FLOWSPECV4_NODE;
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_ENCAP: case SAFI_ENCAP:
case SAFI_EVPN: case SAFI_EVPN:
@ -190,8 +188,6 @@ static enum node_type bgp_node_type(afi_t afi, safi_t safi)
return BGP_VPNV6_NODE; return BGP_VPNV6_NODE;
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
return BGP_FLOWSPECV6_NODE; return BGP_FLOWSPECV6_NODE;
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_ENCAP: case SAFI_ENCAP:
case SAFI_EVPN: case SAFI_EVPN:
@ -202,23 +198,6 @@ static enum node_type bgp_node_type(afi_t afi, safi_t safi)
break; break;
case AFI_L2VPN: case AFI_L2VPN:
return BGP_EVPN_NODE; return BGP_EVPN_NODE;
case AFI_LINKSTATE:
switch (safi) {
case SAFI_LINKSTATE:
return BGP_LS_NODE;
case SAFI_LINKSTATE_VPN: /* Not yet supported */
case SAFI_UNICAST:
case SAFI_MULTICAST:
case SAFI_LABELED_UNICAST:
case SAFI_MPLS_VPN:
case SAFI_FLOWSPEC:
case SAFI_UNSPEC:
case SAFI_ENCAP:
case SAFI_EVPN:
case SAFI_MAX:
return BGP_IPV4_NODE;
}
break;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_MAX: case AFI_MAX:
// We should never be here but to clarify the switch statement.. // We should never be here but to clarify the switch statement..
@ -260,11 +239,6 @@ static const char *get_afi_safi_vty_str(afi_t afi, safi_t safi)
} else if (afi == AFI_L2VPN) { } else if (afi == AFI_L2VPN) {
if (safi == SAFI_EVPN) if (safi == SAFI_EVPN)
return "L2VPN EVPN"; return "L2VPN EVPN";
} else if (afi == AFI_LINKSTATE) {
if (safi == SAFI_LINKSTATE)
return "Link State";
if (safi == SAFI_LINKSTATE_VPN)
return "Link State VPN";
} }
return "Unknown"; return "Unknown";
@ -307,11 +281,6 @@ static const char *get_afi_safi_json_str(afi_t afi, safi_t safi)
} else if (afi == AFI_L2VPN) { } else if (afi == AFI_L2VPN) {
if (safi == SAFI_EVPN) if (safi == SAFI_EVPN)
return "l2VpnEvpn"; return "l2VpnEvpn";
} else if (afi == AFI_LINKSTATE) {
if (safi == SAFI_LINKSTATE)
return "linkState";
if (safi == SAFI_LINKSTATE_VPN)
return "linkStateVPN";
} }
return "Unknown"; return "Unknown";
@ -402,9 +371,6 @@ afi_t bgp_node_afi(struct vty *vty)
case BGP_EVPN_NODE: case BGP_EVPN_NODE:
afi = AFI_L2VPN; afi = AFI_L2VPN;
break; break;
case BGP_LS_NODE:
afi = AFI_LINKSTATE;
break;
default: default:
afi = AFI_IP; afi = AFI_IP;
break; break;
@ -437,9 +403,6 @@ safi_t bgp_node_safi(struct vty *vty)
case BGP_FLOWSPECV6_NODE: case BGP_FLOWSPECV6_NODE:
safi = SAFI_FLOWSPEC; safi = SAFI_FLOWSPEC;
break; break;
case BGP_LS_NODE:
safi = SAFI_LINKSTATE;
break;
default: default:
safi = SAFI_UNICAST; safi = SAFI_UNICAST;
break; break;
@ -465,8 +428,6 @@ afi_t bgp_vty_afi_from_str(const char *afi_str)
afi = AFI_IP6; afi = AFI_IP6;
else if (strmatch(afi_str, "l2vpn")) else if (strmatch(afi_str, "l2vpn"))
afi = AFI_L2VPN; afi = AFI_L2VPN;
else if (strmatch(afi_str, "link-state"))
afi = AFI_LINKSTATE;
return afi; return afi;
} }
@ -486,10 +447,6 @@ int argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index,
ret = 1; ret = 1;
if (afi) if (afi)
*afi = AFI_L2VPN; *afi = AFI_L2VPN;
} else if (argv_find(argv, argc, "link-state", index)) {
ret = 1;
if (afi)
*afi = AFI_LINKSTATE;
} }
return ret; return ret;
} }
@ -510,10 +467,6 @@ safi_t bgp_vty_safi_from_str(const char *safi_str)
safi = SAFI_LABELED_UNICAST; safi = SAFI_LABELED_UNICAST;
else if (strmatch(safi_str, "flowspec")) else if (strmatch(safi_str, "flowspec"))
safi = SAFI_FLOWSPEC; safi = SAFI_FLOWSPEC;
else if (strmatch(safi_str, "link-state"))
safi = SAFI_LINKSTATE;
else if (strmatch(safi_str, "link-state-vpn"))
safi = SAFI_LINKSTATE_VPN;
return safi; return safi;
} }
@ -545,10 +498,6 @@ int argv_find_and_parse_safi(struct cmd_token **argv, int argc, int *index,
ret = 1; ret = 1;
if (safi) if (safi)
*safi = SAFI_FLOWSPEC; *safi = SAFI_FLOWSPEC;
} else if (argv_find(argv, argc, "link-state", index)) {
ret = 1;
if (safi)
*safi = SAFI_LINKSTATE;
} }
return ret; return ret;
} }
@ -585,8 +534,6 @@ static const char *get_bgp_default_af_flag(afi_t afi, safi_t safi)
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
return "ipv4-flowspec"; return "ipv4-flowspec";
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_EVPN: case SAFI_EVPN:
case SAFI_MAX: case SAFI_MAX:
return "unknown-afi/safi"; return "unknown-afi/safi";
@ -606,8 +553,6 @@ static const char *get_bgp_default_af_flag(afi_t afi, safi_t safi)
return "ipv6-labeled-unicast"; return "ipv6-labeled-unicast";
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
return "ipv6-flowspec"; return "ipv6-flowspec";
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_EVPN: case SAFI_EVPN:
case SAFI_MAX: case SAFI_MAX:
@ -623,33 +568,12 @@ static const char *get_bgp_default_af_flag(afi_t afi, safi_t safi)
case SAFI_MPLS_VPN: case SAFI_MPLS_VPN:
case SAFI_ENCAP: case SAFI_ENCAP:
case SAFI_LABELED_UNICAST: case SAFI_LABELED_UNICAST:
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_MAX: case SAFI_MAX:
return "unknown-afi/safi"; return "unknown-afi/safi";
} }
break; break;
case AFI_LINKSTATE:
switch (safi) {
case SAFI_EVPN:
case SAFI_UNICAST:
case SAFI_MULTICAST:
case SAFI_MPLS_VPN:
case SAFI_ENCAP:
case SAFI_LABELED_UNICAST:
case SAFI_FLOWSPEC:
case SAFI_UNSPEC:
case SAFI_MAX:
case SAFI_LINKSTATE:
return "link-state";
case SAFI_LINKSTATE_VPN:
return "link-state-vpn";
default:
return "unknown-afi/safi";
}
break;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_MAX: case AFI_MAX:
return "unknown-afi/safi"; return "unknown-afi/safi";
@ -4212,7 +4136,6 @@ DEFPY(bgp_default_afi_safi, bgp_default_afi_safi_cmd,
"ipv6-vpn|" "ipv6-vpn|"
"ipv6-labeled-unicast|" "ipv6-labeled-unicast|"
"ipv6-flowspec|" "ipv6-flowspec|"
"link-state|"
"l2vpn-evpn>$afi_safi", "l2vpn-evpn>$afi_safi",
NO_STR NO_STR
BGP_STR BGP_STR
@ -4227,7 +4150,6 @@ DEFPY(bgp_default_afi_safi, bgp_default_afi_safi_cmd,
"Activate ipv6-vpn for a peer by default\n" "Activate ipv6-vpn for a peer by default\n"
"Activate ipv6-labeled-unicast for a peer by default\n" "Activate ipv6-labeled-unicast for a peer by default\n"
"Activate ipv6-flowspec for a peer by default\n" "Activate ipv6-flowspec for a peer by default\n"
"Activate link-state for a peer by default\n"
"Activate l2vpn-evpn for a peer by default\n") "Activate l2vpn-evpn for a peer by default\n")
{ {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
@ -4237,14 +4159,9 @@ DEFPY(bgp_default_afi_safi, bgp_default_afi_safi_cmd,
strlcpy(afi_safi_str, afi_safi, sizeof(afi_safi_str)); strlcpy(afi_safi_str, afi_safi, sizeof(afi_safi_str));
char *afi_str = strtok_r(afi_safi_str, "-", &afi_safi_str_tok); char *afi_str = strtok_r(afi_safi_str, "-", &afi_safi_str_tok);
char *safi_str = strtok_r(NULL, "-", &afi_safi_str_tok); char *safi_str = strtok_r(NULL, "-", &afi_safi_str_tok);
afi_t afi; afi_t afi = bgp_vty_afi_from_str(afi_str);
safi_t safi; safi_t safi;
if (strmatch(afi_safi, "link-state"))
afi = bgp_vty_afi_from_str("link-state");
else
afi = bgp_vty_afi_from_str(afi_str);
/* /*
* Impossible situation but making coverity happy * Impossible situation but making coverity happy
*/ */
@ -4252,8 +4169,6 @@ DEFPY(bgp_default_afi_safi, bgp_default_afi_safi_cmd,
if (strmatch(safi_str, "labeled")) if (strmatch(safi_str, "labeled"))
safi = bgp_vty_safi_from_str("labeled-unicast"); safi = bgp_vty_safi_from_str("labeled-unicast");
else if (strmatch(afi_safi, "link-state"))
safi = bgp_vty_safi_from_str("link-state");
else else
safi = bgp_vty_safi_from_str(safi_str); safi = bgp_vty_safi_from_str(safi_str);
@ -10363,15 +10278,6 @@ DEFUN_NOSH (address_family_evpn,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN_NOSH(address_family_linkstate, address_family_linkstate_cmd,
"address-family link-state link-state",
"Enter Address Family command mode\n" BGP_AF_STR BGP_AF_MODIFIER_STR)
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
vty->node = BGP_LS_NODE;
return CMD_SUCCESS;
}
DEFUN_NOSH (bgp_segment_routing_srv6, DEFUN_NOSH (bgp_segment_routing_srv6,
bgp_segment_routing_srv6_cmd, bgp_segment_routing_srv6_cmd,
"segment-routing srv6", "segment-routing srv6",
@ -10512,8 +10418,7 @@ DEFUN_NOSH (exit_address_family,
|| vty->node == BGP_IPV6L_NODE || vty->node == BGP_VPNV6_NODE || vty->node == BGP_IPV6L_NODE || vty->node == BGP_VPNV6_NODE
|| vty->node == BGP_EVPN_NODE || vty->node == BGP_EVPN_NODE
|| vty->node == BGP_FLOWSPECV4_NODE || vty->node == BGP_FLOWSPECV4_NODE
|| vty->node == BGP_FLOWSPECV6_NODE || vty->node == BGP_FLOWSPECV6_NODE)
|| vty->node == BGP_LS_NODE)
vty->node = BGP_NODE; vty->node = BGP_NODE;
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -12385,11 +12290,11 @@ int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
/* `show [ip] bgp summary' commands. */ /* `show [ip] bgp summary' commands. */
DEFPY(show_ip_bgp_summary, show_ip_bgp_summary_cmd, DEFPY(show_ip_bgp_summary, show_ip_bgp_summary_cmd,
"show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_WITH_LS_CMD_STR "show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_CMD_STR
" [" BGP_SAFI_WITH_LABEL_LS_CMD_STR " [" BGP_SAFI_WITH_LABEL_CMD_STR
"]] [all$all] summary [established|failed] [<neighbor <A.B.C.D|X:X::X:X|WORD>|remote-as <ASNUM|internal|external>>] [terse] [wide] [json$uj]", "]] [all$all] summary [established|failed] [<neighbor <A.B.C.D|X:X::X:X|WORD>|remote-as <ASNUM|internal|external>>] [terse] [wide] [json$uj]",
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_WITH_LS_HELP_STR SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
BGP_SAFI_WITH_LABEL_LS_HELP_STR BGP_SAFI_WITH_LABEL_HELP_STR
"Display the entries for all address families\n" "Display the entries for all address families\n"
"Summary of BGP neighbor status\n" "Summary of BGP neighbor status\n"
"Show only sessions in Established state\n" "Show only sessions in Established state\n"
@ -18458,11 +18363,6 @@ static void bgp_config_write_family(struct vty *vty, struct bgp *bgp, afi_t afi,
} else if (afi == AFI_L2VPN) { } else if (afi == AFI_L2VPN) {
if (safi == SAFI_EVPN) if (safi == SAFI_EVPN)
vty_frame(vty, "l2vpn evpn"); vty_frame(vty, "l2vpn evpn");
} else if (afi == AFI_LINKSTATE) {
if (safi == SAFI_LINKSTATE)
vty_frame(vty, "link-state link-state");
else if (safi == SAFI_LINKSTATE_VPN)
vty_frame(vty, "link-state link-state-vpn");
} }
vty_frame(vty, "\n"); vty_frame(vty, "\n");
@ -19006,11 +18906,6 @@ int bgp_config_write(struct vty *vty)
/* EVPN configuration. */ /* EVPN configuration. */
bgp_config_write_family(vty, bgp, AFI_L2VPN, SAFI_EVPN); bgp_config_write_family(vty, bgp, AFI_L2VPN, SAFI_EVPN);
bgp_config_write_family(vty, bgp, AFI_LINKSTATE,
SAFI_LINKSTATE);
bgp_config_write_family(vty, bgp, AFI_LINKSTATE,
SAFI_LINKSTATE_VPN);
hook_call(bgp_inst_config_write, bgp, vty); hook_call(bgp_inst_config_write, bgp, vty);
#ifdef ENABLE_BGP_VNC #ifdef ENABLE_BGP_VNC
@ -19135,13 +19030,6 @@ static struct cmd_node bgp_srv6_node = {
.prompt = "%s(config-router-srv6)# ", .prompt = "%s(config-router-srv6)# ",
}; };
static struct cmd_node bgp_ls_node = {
.name = "bgp link-state",
.node = BGP_LS_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af-ls)# ",
};
static void community_list_vty(void); static void community_list_vty(void);
static void bgp_ac_peergroup(vector comps, struct cmd_token *token) static void bgp_ac_peergroup(vector comps, struct cmd_token *token)
@ -19456,7 +19344,6 @@ void bgp_vty_init(void)
install_node(&bgp_flowspecv4_node); install_node(&bgp_flowspecv4_node);
install_node(&bgp_flowspecv6_node); install_node(&bgp_flowspecv6_node);
install_node(&bgp_srv6_node); install_node(&bgp_srv6_node);
install_node(&bgp_ls_node);
/* Install default VTY commands to new nodes. */ /* Install default VTY commands to new nodes. */
install_default(BGP_NODE); install_default(BGP_NODE);
@ -19473,7 +19360,6 @@ void bgp_vty_init(void)
install_default(BGP_EVPN_NODE); install_default(BGP_EVPN_NODE);
install_default(BGP_EVPN_VNI_NODE); install_default(BGP_EVPN_VNI_NODE);
install_default(BGP_SRV6_NODE); install_default(BGP_SRV6_NODE);
install_default(BGP_LS_NODE);
/* "global bgp inq-limit command */ /* "global bgp inq-limit command */
install_element(CONFIG_NODE, &bgp_inq_limit_cmd); install_element(CONFIG_NODE, &bgp_inq_limit_cmd);
@ -19605,13 +19491,6 @@ void bgp_vty_init(void)
install_element(BGP_IPV6L_NODE, &bgp_maxpaths_ibgp_cluster_cmd); install_element(BGP_IPV6L_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
install_element(BGP_IPV6L_NODE, &no_bgp_maxpaths_ibgp_cmd); install_element(BGP_IPV6L_NODE, &no_bgp_maxpaths_ibgp_cmd);
install_element(BGP_LS_NODE, &bgp_maxpaths_cmd);
install_element(BGP_LS_NODE, &no_bgp_maxpaths_cmd);
install_element(BGP_LS_NODE, &bgp_maxpaths_ibgp_cmd);
install_element(BGP_LS_NODE, &no_bgp_maxpaths_ibgp_cmd);
install_element(BGP_LS_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
/* "timers bgp" commands. */ /* "timers bgp" commands. */
install_element(BGP_NODE, &bgp_timers_cmd); install_element(BGP_NODE, &bgp_timers_cmd);
install_element(BGP_NODE, &no_bgp_timers_cmd); install_element(BGP_NODE, &no_bgp_timers_cmd);
@ -19834,7 +19713,6 @@ void bgp_vty_init(void)
install_element(BGP_FLOWSPECV4_NODE, &neighbor_activate_cmd); install_element(BGP_FLOWSPECV4_NODE, &neighbor_activate_cmd);
install_element(BGP_FLOWSPECV6_NODE, &neighbor_activate_cmd); install_element(BGP_FLOWSPECV6_NODE, &neighbor_activate_cmd);
install_element(BGP_EVPN_NODE, &neighbor_activate_cmd); install_element(BGP_EVPN_NODE, &neighbor_activate_cmd);
install_element(BGP_LS_NODE, &neighbor_activate_cmd);
/* "no neighbor activate" commands. */ /* "no neighbor activate" commands. */
install_element(BGP_NODE, &no_neighbor_activate_hidden_cmd); install_element(BGP_NODE, &no_neighbor_activate_hidden_cmd);
@ -19849,7 +19727,6 @@ void bgp_vty_init(void)
install_element(BGP_FLOWSPECV4_NODE, &no_neighbor_activate_cmd); install_element(BGP_FLOWSPECV4_NODE, &no_neighbor_activate_cmd);
install_element(BGP_FLOWSPECV6_NODE, &no_neighbor_activate_cmd); install_element(BGP_FLOWSPECV6_NODE, &no_neighbor_activate_cmd);
install_element(BGP_EVPN_NODE, &no_neighbor_activate_cmd); install_element(BGP_EVPN_NODE, &no_neighbor_activate_cmd);
install_element(BGP_LS_NODE, &no_neighbor_activate_cmd);
/* "neighbor peer-group" set commands. */ /* "neighbor peer-group" set commands. */
install_element(BGP_NODE, &neighbor_set_peer_group_cmd); install_element(BGP_NODE, &neighbor_set_peer_group_cmd);
@ -19864,8 +19741,6 @@ void bgp_vty_init(void)
&neighbor_set_peer_group_hidden_cmd); &neighbor_set_peer_group_hidden_cmd);
install_element(BGP_FLOWSPECV6_NODE, install_element(BGP_FLOWSPECV6_NODE,
&neighbor_set_peer_group_hidden_cmd); &neighbor_set_peer_group_hidden_cmd);
install_element(BGP_LS_NODE, &neighbor_set_peer_group_hidden_cmd);
/* "no neighbor peer-group unset" commands. */ /* "no neighbor peer-group unset" commands. */
install_element(BGP_NODE, &no_neighbor_set_peer_group_cmd); install_element(BGP_NODE, &no_neighbor_set_peer_group_cmd);
@ -19880,7 +19755,6 @@ void bgp_vty_init(void)
&no_neighbor_set_peer_group_hidden_cmd); &no_neighbor_set_peer_group_hidden_cmd);
install_element(BGP_FLOWSPECV6_NODE, install_element(BGP_FLOWSPECV6_NODE,
&no_neighbor_set_peer_group_hidden_cmd); &no_neighbor_set_peer_group_hidden_cmd);
install_element(BGP_LS_NODE, &no_neighbor_set_peer_group_hidden_cmd);
/* "neighbor softreconfiguration inbound" commands.*/ /* "neighbor softreconfiguration inbound" commands.*/
install_element(BGP_NODE, &neighbor_soft_reconfiguration_hidden_cmd); install_element(BGP_NODE, &neighbor_soft_reconfiguration_hidden_cmd);
@ -19911,8 +19785,6 @@ void bgp_vty_init(void)
&no_neighbor_soft_reconfiguration_cmd); &no_neighbor_soft_reconfiguration_cmd);
install_element(BGP_EVPN_NODE, &neighbor_soft_reconfiguration_cmd); install_element(BGP_EVPN_NODE, &neighbor_soft_reconfiguration_cmd);
install_element(BGP_EVPN_NODE, &no_neighbor_soft_reconfiguration_cmd); install_element(BGP_EVPN_NODE, &no_neighbor_soft_reconfiguration_cmd);
install_element(BGP_LS_NODE, &neighbor_soft_reconfiguration_cmd);
install_element(BGP_LS_NODE, &no_neighbor_soft_reconfiguration_cmd);
/* "neighbor attribute-unchanged" commands. */ /* "neighbor attribute-unchanged" commands. */
install_element(BGP_NODE, &neighbor_attr_unchanged_hidden_cmd); install_element(BGP_NODE, &neighbor_attr_unchanged_hidden_cmd);
@ -19933,10 +19805,9 @@ void bgp_vty_init(void)
install_element(BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); install_element(BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
install_element(BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd); install_element(BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
install_element(BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd); install_element(BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
install_element(BGP_EVPN_NODE, &neighbor_attr_unchanged_cmd); install_element(BGP_EVPN_NODE, &neighbor_attr_unchanged_cmd);
install_element(BGP_EVPN_NODE, &no_neighbor_attr_unchanged_cmd); install_element(BGP_EVPN_NODE, &no_neighbor_attr_unchanged_cmd);
install_element(BGP_LS_NODE, &neighbor_attr_unchanged_cmd);
install_element(BGP_LS_NODE, &no_neighbor_attr_unchanged_cmd);
install_element(BGP_FLOWSPECV4_NODE, &neighbor_attr_unchanged_cmd); install_element(BGP_FLOWSPECV4_NODE, &neighbor_attr_unchanged_cmd);
install_element(BGP_FLOWSPECV4_NODE, &no_neighbor_attr_unchanged_cmd); install_element(BGP_FLOWSPECV4_NODE, &no_neighbor_attr_unchanged_cmd);
@ -19969,8 +19840,6 @@ void bgp_vty_init(void)
install_element(BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd); install_element(BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
install_element(BGP_EVPN_NODE, &neighbor_nexthop_self_cmd); install_element(BGP_EVPN_NODE, &neighbor_nexthop_self_cmd);
install_element(BGP_EVPN_NODE, &no_neighbor_nexthop_self_cmd); install_element(BGP_EVPN_NODE, &no_neighbor_nexthop_self_cmd);
install_element(BGP_LS_NODE, &neighbor_nexthop_self_cmd);
install_element(BGP_LS_NODE, &no_neighbor_nexthop_self_cmd);
/* "neighbor next-hop-self force" commands. */ /* "neighbor next-hop-self force" commands. */
install_element(BGP_NODE, &neighbor_nexthop_self_force_hidden_cmd); install_element(BGP_NODE, &neighbor_nexthop_self_force_hidden_cmd);
@ -20019,8 +19888,6 @@ void bgp_vty_init(void)
&no_neighbor_nexthop_self_all_hidden_cmd); &no_neighbor_nexthop_self_all_hidden_cmd);
install_element(BGP_EVPN_NODE, &neighbor_nexthop_self_force_cmd); install_element(BGP_EVPN_NODE, &neighbor_nexthop_self_force_cmd);
install_element(BGP_EVPN_NODE, &no_neighbor_nexthop_self_force_cmd); install_element(BGP_EVPN_NODE, &no_neighbor_nexthop_self_force_cmd);
install_element(BGP_LS_NODE, &neighbor_nexthop_self_force_cmd);
install_element(BGP_LS_NODE, &no_neighbor_nexthop_self_force_cmd);
/* "neighbor as-override" commands. */ /* "neighbor as-override" commands. */
install_element(BGP_NODE, &neighbor_as_override_hidden_cmd); install_element(BGP_NODE, &neighbor_as_override_hidden_cmd);
@ -20153,18 +20020,6 @@ void bgp_vty_init(void)
&neighbor_remove_private_as_all_replace_as_cmd); &neighbor_remove_private_as_all_replace_as_cmd);
install_element(BGP_VPNV6_NODE, install_element(BGP_VPNV6_NODE,
&no_neighbor_remove_private_as_all_replace_as_cmd); &no_neighbor_remove_private_as_all_replace_as_cmd);
install_element(BGP_LS_NODE, &neighbor_remove_private_as_cmd);
install_element(BGP_LS_NODE, &no_neighbor_remove_private_as_cmd);
install_element(BGP_LS_NODE, &neighbor_remove_private_as_all_cmd);
install_element(BGP_LS_NODE, &no_neighbor_remove_private_as_all_cmd);
install_element(BGP_LS_NODE,
&neighbor_remove_private_as_replace_as_cmd);
install_element(BGP_LS_NODE,
&no_neighbor_remove_private_as_replace_as_cmd);
install_element(BGP_LS_NODE,
&neighbor_remove_private_as_all_replace_as_cmd);
install_element(BGP_LS_NODE,
&no_neighbor_remove_private_as_all_replace_as_cmd);
/* "neighbor send-community" commands.*/ /* "neighbor send-community" commands.*/
install_element(BGP_NODE, &neighbor_send_community_hidden_cmd); install_element(BGP_NODE, &neighbor_send_community_hidden_cmd);
@ -20203,10 +20058,6 @@ void bgp_vty_init(void)
install_element(BGP_VPNV6_NODE, &neighbor_send_community_type_cmd); install_element(BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
install_element(BGP_VPNV6_NODE, &no_neighbor_send_community_cmd); install_element(BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
install_element(BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd); install_element(BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
install_element(BGP_LS_NODE, &neighbor_send_community_cmd);
install_element(BGP_LS_NODE, &neighbor_send_community_type_cmd);
install_element(BGP_LS_NODE, &no_neighbor_send_community_cmd);
install_element(BGP_LS_NODE, &no_neighbor_send_community_type_cmd);
/* "neighbor route-reflector" commands.*/ /* "neighbor route-reflector" commands.*/
install_element(BGP_NODE, &neighbor_route_reflector_client_hidden_cmd); install_element(BGP_NODE, &neighbor_route_reflector_client_hidden_cmd);
@ -20244,8 +20095,6 @@ void bgp_vty_init(void)
&no_neighbor_route_reflector_client_cmd); &no_neighbor_route_reflector_client_cmd);
install_element(BGP_EVPN_NODE, &neighbor_route_reflector_client_cmd); install_element(BGP_EVPN_NODE, &neighbor_route_reflector_client_cmd);
install_element(BGP_EVPN_NODE, &no_neighbor_route_reflector_client_cmd); install_element(BGP_EVPN_NODE, &no_neighbor_route_reflector_client_cmd);
install_element(BGP_LS_NODE, &neighbor_route_reflector_client_cmd);
install_element(BGP_LS_NODE, &no_neighbor_route_reflector_client_cmd);
/* "neighbor route-server" commands.*/ /* "neighbor route-server" commands.*/
install_element(BGP_NODE, &neighbor_route_server_client_hidden_cmd); install_element(BGP_NODE, &neighbor_route_server_client_hidden_cmd);
@ -20274,8 +20123,6 @@ void bgp_vty_init(void)
install_element(BGP_FLOWSPECV6_NODE, &neighbor_route_server_client_cmd); install_element(BGP_FLOWSPECV6_NODE, &neighbor_route_server_client_cmd);
install_element(BGP_FLOWSPECV6_NODE, install_element(BGP_FLOWSPECV6_NODE,
&no_neighbor_route_server_client_cmd); &no_neighbor_route_server_client_cmd);
install_element(BGP_LS_NODE, &neighbor_route_server_client_cmd);
install_element(BGP_LS_NODE, &no_neighbor_route_server_client_cmd);
/* "neighbor disable-addpath-rx" commands. */ /* "neighbor disable-addpath-rx" commands. */
install_element(BGP_IPV4_NODE, &neighbor_disable_addpath_rx_cmd); install_element(BGP_IPV4_NODE, &neighbor_disable_addpath_rx_cmd);
@ -20437,8 +20284,6 @@ void bgp_vty_init(void)
install_element(BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); install_element(BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
install_element(BGP_IPV6L_NODE, &neighbor_capability_orf_prefix_cmd); install_element(BGP_IPV6L_NODE, &neighbor_capability_orf_prefix_cmd);
install_element(BGP_IPV6L_NODE, &no_neighbor_capability_orf_prefix_cmd); install_element(BGP_IPV6L_NODE, &no_neighbor_capability_orf_prefix_cmd);
install_element(BGP_LS_NODE, &neighbor_capability_orf_prefix_cmd);
install_element(BGP_LS_NODE, &no_neighbor_capability_orf_prefix_cmd);
/* "neighbor capability dynamic" commands.*/ /* "neighbor capability dynamic" commands.*/
install_element(BGP_NODE, &neighbor_capability_dynamic_cmd); install_element(BGP_NODE, &neighbor_capability_dynamic_cmd);
@ -20575,8 +20420,6 @@ void bgp_vty_init(void)
install_element(BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); install_element(BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
install_element(BGP_VPNV6_NODE, &neighbor_distribute_list_cmd); install_element(BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
install_element(BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd); install_element(BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
install_element(BGP_LS_NODE, &neighbor_distribute_list_cmd);
install_element(BGP_LS_NODE, &no_neighbor_distribute_list_cmd);
/* "neighbor prefix-list" commands. */ /* "neighbor prefix-list" commands. */
install_element(BGP_NODE, &neighbor_prefix_list_hidden_cmd); install_element(BGP_NODE, &neighbor_prefix_list_hidden_cmd);
@ -20601,7 +20444,6 @@ void bgp_vty_init(void)
install_element(BGP_FLOWSPECV4_NODE, &no_neighbor_prefix_list_cmd); install_element(BGP_FLOWSPECV4_NODE, &no_neighbor_prefix_list_cmd);
install_element(BGP_FLOWSPECV6_NODE, &neighbor_prefix_list_cmd); install_element(BGP_FLOWSPECV6_NODE, &neighbor_prefix_list_cmd);
install_element(BGP_FLOWSPECV6_NODE, &no_neighbor_prefix_list_cmd); install_element(BGP_FLOWSPECV6_NODE, &no_neighbor_prefix_list_cmd);
install_element(BGP_LS_NODE, &neighbor_prefix_list_cmd);
/* "neighbor filter-list" commands. */ /* "neighbor filter-list" commands. */
install_element(BGP_NODE, &neighbor_filter_list_hidden_cmd); install_element(BGP_NODE, &neighbor_filter_list_hidden_cmd);
@ -20626,8 +20468,6 @@ void bgp_vty_init(void)
install_element(BGP_FLOWSPECV4_NODE, &no_neighbor_filter_list_cmd); install_element(BGP_FLOWSPECV4_NODE, &no_neighbor_filter_list_cmd);
install_element(BGP_FLOWSPECV6_NODE, &neighbor_filter_list_cmd); install_element(BGP_FLOWSPECV6_NODE, &neighbor_filter_list_cmd);
install_element(BGP_FLOWSPECV6_NODE, &no_neighbor_filter_list_cmd); install_element(BGP_FLOWSPECV6_NODE, &no_neighbor_filter_list_cmd);
install_element(BGP_LS_NODE, &neighbor_filter_list_cmd);
install_element(BGP_LS_NODE, &no_neighbor_filter_list_cmd);
/* "neighbor route-map" commands. */ /* "neighbor route-map" commands. */
install_element(BGP_NODE, &neighbor_route_map_hidden_cmd); install_element(BGP_NODE, &neighbor_route_map_hidden_cmd);
@ -20654,7 +20494,6 @@ void bgp_vty_init(void)
install_element(BGP_FLOWSPECV6_NODE, &no_neighbor_route_map_cmd); install_element(BGP_FLOWSPECV6_NODE, &no_neighbor_route_map_cmd);
install_element(BGP_EVPN_NODE, &neighbor_route_map_cmd); install_element(BGP_EVPN_NODE, &neighbor_route_map_cmd);
install_element(BGP_EVPN_NODE, &no_neighbor_route_map_cmd); install_element(BGP_EVPN_NODE, &no_neighbor_route_map_cmd);
install_element(BGP_LS_NODE, &neighbor_route_map_cmd);
/* "neighbor unsuppress-map" commands. */ /* "neighbor unsuppress-map" commands. */
install_element(BGP_NODE, &neighbor_unsuppress_map_hidden_cmd); install_element(BGP_NODE, &neighbor_unsuppress_map_hidden_cmd);
@ -20675,8 +20514,6 @@ void bgp_vty_init(void)
install_element(BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); install_element(BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
install_element(BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd); install_element(BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
install_element(BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd); install_element(BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
install_element(BGP_LS_NODE, &neighbor_unsuppress_map_cmd);
install_element(BGP_LS_NODE, &no_neighbor_unsuppress_map_cmd);
/* "neighbor advertise-map" commands. */ /* "neighbor advertise-map" commands. */
install_element(BGP_NODE, &bgp_condadv_period_cmd); install_element(BGP_NODE, &bgp_condadv_period_cmd);
@ -20796,15 +20633,6 @@ void bgp_vty_init(void)
install_element(BGP_VPNV6_NODE, install_element(BGP_VPNV6_NODE,
&neighbor_maximum_prefix_threshold_restart_cmd); &neighbor_maximum_prefix_threshold_restart_cmd);
install_element(BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd); install_element(BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
install_element(BGP_LS_NODE, &neighbor_maximum_prefix_cmd);
install_element(BGP_LS_NODE, &neighbor_maximum_prefix_threshold_cmd);
install_element(BGP_LS_NODE, &neighbor_maximum_prefix_warning_cmd);
install_element(BGP_LS_NODE,
&neighbor_maximum_prefix_threshold_warning_cmd);
install_element(BGP_LS_NODE, &neighbor_maximum_prefix_restart_cmd);
install_element(BGP_LS_NODE,
&neighbor_maximum_prefix_threshold_restart_cmd);
install_element(BGP_LS_NODE, &no_neighbor_maximum_prefix_cmd);
/* "neighbor allowas-in" */ /* "neighbor allowas-in" */
install_element(BGP_NODE, &neighbor_allowas_in_hidden_cmd); install_element(BGP_NODE, &neighbor_allowas_in_hidden_cmd);
@ -20827,8 +20655,6 @@ void bgp_vty_init(void)
install_element(BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd); install_element(BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
install_element(BGP_EVPN_NODE, &neighbor_allowas_in_cmd); install_element(BGP_EVPN_NODE, &neighbor_allowas_in_cmd);
install_element(BGP_EVPN_NODE, &no_neighbor_allowas_in_cmd); install_element(BGP_EVPN_NODE, &no_neighbor_allowas_in_cmd);
install_element(BGP_LS_NODE, &neighbor_allowas_in_cmd);
install_element(BGP_LS_NODE, &no_neighbor_allowas_in_cmd);
/* neighbor accept-own */ /* neighbor accept-own */
install_element(BGP_VPNV4_NODE, &neighbor_accept_own_cmd); install_element(BGP_VPNV4_NODE, &neighbor_accept_own_cmd);
@ -20864,8 +20690,6 @@ void bgp_vty_init(void)
install_element(BGP_NODE, &address_family_evpn_cmd); install_element(BGP_NODE, &address_family_evpn_cmd);
install_element(BGP_NODE, &address_family_linkstate_cmd);
/* "exit-address-family" command. */ /* "exit-address-family" command. */
install_element(BGP_IPV4_NODE, &exit_address_family_cmd); install_element(BGP_IPV4_NODE, &exit_address_family_cmd);
install_element(BGP_IPV4M_NODE, &exit_address_family_cmd); install_element(BGP_IPV4M_NODE, &exit_address_family_cmd);
@ -20878,7 +20702,6 @@ void bgp_vty_init(void)
install_element(BGP_FLOWSPECV4_NODE, &exit_address_family_cmd); install_element(BGP_FLOWSPECV4_NODE, &exit_address_family_cmd);
install_element(BGP_FLOWSPECV6_NODE, &exit_address_family_cmd); install_element(BGP_FLOWSPECV6_NODE, &exit_address_family_cmd);
install_element(BGP_EVPN_NODE, &exit_address_family_cmd); install_element(BGP_EVPN_NODE, &exit_address_family_cmd);
install_element(BGP_LS_NODE, &exit_address_family_cmd);
/* BGP retain all route-target */ /* BGP retain all route-target */
install_element(BGP_VPNV4_NODE, &bgp_retain_route_target_cmd); install_element(BGP_VPNV4_NODE, &bgp_retain_route_target_cmd);

View File

@ -17,8 +17,6 @@ struct bgp;
#define BGP_AF_MODIFIER_STR "Address Family modifier\n" #define BGP_AF_MODIFIER_STR "Address Family modifier\n"
#define BGP_AFI_CMD_STR "<ipv4|ipv6>" #define BGP_AFI_CMD_STR "<ipv4|ipv6>"
#define BGP_AFI_HELP_STR BGP_AF_STR BGP_AF_STR #define BGP_AFI_HELP_STR BGP_AF_STR BGP_AF_STR
#define BGP_AFI_WITH_LS_CMD_STR "<ipv4|ipv6|link-state>"
#define BGP_AFI_WITH_LS_HELP_STR BGP_AF_STR BGP_AF_STR BGP_AF_STR
#define BGP_SAFI_CMD_STR "<unicast|multicast|vpn>" #define BGP_SAFI_CMD_STR "<unicast|multicast|vpn>"
#define BGP_SAFI_HELP_STR \ #define BGP_SAFI_HELP_STR \
BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR
@ -30,12 +28,6 @@ struct bgp;
BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR \ BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR \
BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR
#define BGP_SAFI_WITH_LABEL_LS_CMD_STR \
"<unicast|multicast|vpn|labeled-unicast|flowspec|link-state>"
#define BGP_SAFI_WITH_LABEL_LS_HELP_STR \
BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR \
BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR
#define BGP_SELF_ORIG_CMD_STR "self-originate" #define BGP_SELF_ORIG_CMD_STR "self-originate"
#define BGP_SELF_ORIG_HELP_STR "Display only self-originated routes\n" #define BGP_SELF_ORIG_HELP_STR "Display only self-originated routes\n"

View File

@ -1262,10 +1262,6 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
uint32_t bos = 0; uint32_t bos = 0;
uint32_t exp = 0; uint32_t exp = 0;
if (afi == AFI_LINKSTATE)
/* nothing to install */
return;
/* /*
* BGP is installing this route and bgp has been configured * BGP is installing this route and bgp has been configured
* to suppress announcements until the route has been installed * to suppress announcements until the route has been installed

View File

@ -71,8 +71,6 @@
#include "bgpd/bgp_io.h" #include "bgpd/bgp_io.h"
#include "bgpd/bgp_ecommunity.h" #include "bgpd/bgp_ecommunity.h"
#include "bgpd/bgp_flowspec.h" #include "bgpd/bgp_flowspec.h"
#include "bgpd/bgp_linkstate.h"
#include "bgpd/bgp_linkstate_vty.h"
#include "bgpd/bgp_labelpool.h" #include "bgpd/bgp_labelpool.h"
#include "bgpd/bgp_pbr.h" #include "bgpd/bgp_pbr.h"
#include "bgpd/bgp_addpath.h" #include "bgpd/bgp_addpath.h"
@ -2042,10 +2040,6 @@ void peer_as_change(struct peer *peer, as_t as, int as_specified,
PEER_FLAG_REFLECTOR_CLIENT); PEER_FLAG_REFLECTOR_CLIENT);
UNSET_FLAG(peer->af_flags[AFI_L2VPN][SAFI_EVPN], UNSET_FLAG(peer->af_flags[AFI_L2VPN][SAFI_EVPN],
PEER_FLAG_REFLECTOR_CLIENT); PEER_FLAG_REFLECTOR_CLIENT);
UNSET_FLAG(peer->af_flags[AFI_LINKSTATE][SAFI_LINKSTATE],
PEER_FLAG_REFLECTOR_CLIENT);
UNSET_FLAG(peer->af_flags[AFI_LINKSTATE][SAFI_LINKSTATE_VPN],
PEER_FLAG_REFLECTOR_CLIENT);
} }
} }
@ -4390,9 +4384,7 @@ bool peer_active(struct peer *peer)
|| peer->afc[AFI_IP6][SAFI_MPLS_VPN] || peer->afc[AFI_IP6][SAFI_MPLS_VPN]
|| peer->afc[AFI_IP6][SAFI_ENCAP] || peer->afc[AFI_IP6][SAFI_ENCAP]
|| peer->afc[AFI_IP6][SAFI_FLOWSPEC] || peer->afc[AFI_IP6][SAFI_FLOWSPEC]
|| peer->afc[AFI_L2VPN][SAFI_EVPN] || peer->afc[AFI_L2VPN][SAFI_EVPN])
|| peer->afc[AFI_LINKSTATE][SAFI_LINKSTATE]
|| peer->afc[AFI_LINKSTATE][SAFI_LINKSTATE_VPN])
return true; return true;
return false; return false;
} }
@ -4412,9 +4404,7 @@ bool peer_active_nego(struct peer *peer)
|| peer->afc_nego[AFI_IP6][SAFI_MPLS_VPN] || peer->afc_nego[AFI_IP6][SAFI_MPLS_VPN]
|| peer->afc_nego[AFI_IP6][SAFI_ENCAP] || peer->afc_nego[AFI_IP6][SAFI_ENCAP]
|| peer->afc_nego[AFI_IP6][SAFI_FLOWSPEC] || peer->afc_nego[AFI_IP6][SAFI_FLOWSPEC]
|| peer->afc_nego[AFI_L2VPN][SAFI_EVPN] || peer->afc_nego[AFI_L2VPN][SAFI_EVPN])
|| peer->afc_nego[AFI_LINKSTATE][SAFI_LINKSTATE]
|| peer->afc_nego[AFI_LINKSTATE][SAFI_LINKSTATE_VPN])
return true; return true;
return false; return false;
} }
@ -8397,8 +8387,6 @@ void bgp_init(unsigned short instance)
#endif #endif
bgp_ethernetvpn_init(); bgp_ethernetvpn_init();
bgp_flowspec_vty_init(); bgp_flowspec_vty_init();
bgp_linkstate_init();
bgp_linkstate_vty_init();
/* Access list initialize. */ /* Access list initialize. */
access_list_init(); access_list_init();

View File

@ -81,8 +81,6 @@ enum bgp_af_index {
BGP_AF_IPV6_LBL_UNICAST, BGP_AF_IPV6_LBL_UNICAST,
BGP_AF_IPV4_FLOWSPEC, BGP_AF_IPV4_FLOWSPEC,
BGP_AF_IPV6_FLOWSPEC, BGP_AF_IPV6_FLOWSPEC,
BGP_AF_LINKSTATE,
BGP_AF_LINKSTATE_VPN,
BGP_AF_MAX BGP_AF_MAX
}; };
@ -1926,7 +1924,6 @@ struct bgp_nlri {
#define BGP_ATTR_ENCAP 23 #define BGP_ATTR_ENCAP 23
#define BGP_ATTR_IPV6_EXT_COMMUNITIES 25 #define BGP_ATTR_IPV6_EXT_COMMUNITIES 25
#define BGP_ATTR_AIGP 26 #define BGP_ATTR_AIGP 26
#define BGP_ATTR_LINK_STATE 29
#define BGP_ATTR_LARGE_COMMUNITIES 32 #define BGP_ATTR_LARGE_COMMUNITIES 32
#define BGP_ATTR_OTC 35 #define BGP_ATTR_OTC 35
#define BGP_ATTR_PREFIX_SID 40 #define BGP_ATTR_PREFIX_SID 40
@ -2507,8 +2504,6 @@ static inline int afindex(afi_t afi, safi_t safi)
return BGP_AF_IPV4_ENCAP; return BGP_AF_IPV4_ENCAP;
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
return BGP_AF_IPV4_FLOWSPEC; return BGP_AF_IPV4_FLOWSPEC;
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_EVPN: case SAFI_EVPN:
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_MAX: case SAFI_MAX:
@ -2529,8 +2524,6 @@ static inline int afindex(afi_t afi, safi_t safi)
return BGP_AF_IPV6_ENCAP; return BGP_AF_IPV6_ENCAP;
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
return BGP_AF_IPV6_FLOWSPEC; return BGP_AF_IPV6_FLOWSPEC;
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_EVPN: case SAFI_EVPN:
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_MAX: case SAFI_MAX:
@ -2548,26 +2541,6 @@ static inline int afindex(afi_t afi, safi_t safi)
case SAFI_ENCAP: case SAFI_ENCAP:
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_MAX:
return BGP_AF_MAX;
}
break;
case AFI_LINKSTATE:
switch (safi) {
case SAFI_LINKSTATE:
return BGP_AF_LINKSTATE;
case SAFI_LINKSTATE_VPN:
return BGP_AF_LINKSTATE_VPN;
case SAFI_EVPN:
case SAFI_UNICAST:
case SAFI_MULTICAST:
case SAFI_LABELED_UNICAST:
case SAFI_MPLS_VPN:
case SAFI_ENCAP:
case SAFI_FLOWSPEC:
case SAFI_UNSPEC:
case SAFI_MAX: case SAFI_MAX:
return BGP_AF_MAX; return BGP_AF_MAX;
} }
@ -2597,9 +2570,7 @@ static inline int peer_afi_active_nego(const struct peer *peer, afi_t afi)
|| peer->afc_nego[afi][SAFI_MPLS_VPN] || peer->afc_nego[afi][SAFI_MPLS_VPN]
|| peer->afc_nego[afi][SAFI_ENCAP] || peer->afc_nego[afi][SAFI_ENCAP]
|| peer->afc_nego[afi][SAFI_FLOWSPEC] || peer->afc_nego[afi][SAFI_FLOWSPEC]
|| peer->afc_nego[afi][SAFI_EVPN] || peer->afc_nego[afi][SAFI_EVPN])
|| peer->afc_nego[afi][SAFI_LINKSTATE]
|| peer->afc_nego[afi][SAFI_LINKSTATE_VPN])
return 1; return 1;
return 0; return 0;
} }
@ -2619,9 +2590,7 @@ static inline int peer_group_af_configured(struct peer_group *group)
|| peer->afc[AFI_IP6][SAFI_MPLS_VPN] || peer->afc[AFI_IP6][SAFI_MPLS_VPN]
|| peer->afc[AFI_IP6][SAFI_ENCAP] || peer->afc[AFI_IP6][SAFI_ENCAP]
|| peer->afc[AFI_IP6][SAFI_FLOWSPEC] || peer->afc[AFI_IP6][SAFI_FLOWSPEC]
|| peer->afc[AFI_L2VPN][SAFI_EVPN] || peer->afc[AFI_L2VPN][SAFI_EVPN])
|| peer->afc[AFI_LINKSTATE][SAFI_LINKSTATE]
|| peer->afc[AFI_LINKSTATE][SAFI_LINKSTATE_VPN])
return 1; return 1;
return 0; return 0;
} }

View File

@ -248,8 +248,6 @@ void rfapiCheckRefcount(struct agg_node *rn, safi_t safi, int lockoffset)
case SAFI_EVPN: case SAFI_EVPN:
case SAFI_LABELED_UNICAST: case SAFI_LABELED_UNICAST:
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_MAX: case SAFI_MAX:
assert(!"Passed in safi should be impossible"); assert(!"Passed in safi should be impossible");
} }
@ -2974,7 +2972,6 @@ static void rfapiBgpInfoFilteredImportEncap(
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_L2VPN: case AFI_L2VPN:
case AFI_LINKSTATE:
case AFI_MAX: case AFI_MAX:
flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi); flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return; return;
@ -3423,7 +3420,6 @@ void rfapiBgpInfoFilteredImportVPN(
rt = import_table->imported_vpn[afi]; rt = import_table->imported_vpn[afi];
break; break;
case AFI_LINKSTATE:
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_MAX: case AFI_MAX:
flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi); flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
@ -3823,8 +3819,6 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
case SAFI_EVPN: case SAFI_EVPN:
case SAFI_LABELED_UNICAST: case SAFI_LABELED_UNICAST:
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_MAX: case SAFI_MAX:
/* not expected */ /* not expected */
flog_err(EC_LIB_DEVELOPMENT, "%s: bad safi %d", __func__, safi); flog_err(EC_LIB_DEVELOPMENT, "%s: bad safi %d", __func__, safi);
@ -4069,8 +4063,6 @@ static void rfapiProcessPeerDownRt(struct peer *peer,
case SAFI_EVPN: case SAFI_EVPN:
case SAFI_LABELED_UNICAST: case SAFI_LABELED_UNICAST:
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_MAX: case SAFI_MAX:
/* Suppress uninitialized variable warning */ /* Suppress uninitialized variable warning */
rt = NULL; rt = NULL;

View File

@ -237,8 +237,6 @@ void rfapiMonitorExtraFlush(safi_t safi, struct agg_node *rn)
case SAFI_EVPN: case SAFI_EVPN:
case SAFI_LABELED_UNICAST: case SAFI_LABELED_UNICAST:
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_MAX: case SAFI_MAX:
assert(0); assert(0);
} }
@ -307,8 +305,6 @@ void rfapiMonitorExtraPrune(safi_t safi, struct agg_node *rn)
case SAFI_EVPN: case SAFI_EVPN:
case SAFI_LABELED_UNICAST: case SAFI_LABELED_UNICAST:
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
case SAFI_LINKSTATE:
case SAFI_LINKSTATE_VPN:
case SAFI_MAX: case SAFI_MAX:
assert(0); assert(0);
} }

View File

@ -51,9 +51,6 @@ bgpd_libbgp_a_SOURCES = \
bgpd/bgp_label.c \ bgpd/bgp_label.c \
bgpd/bgp_labelpool.c \ bgpd/bgp_labelpool.c \
bgpd/bgp_lcommunity.c \ bgpd/bgp_lcommunity.c \
bgpd/bgp_linkstate.c \
bgpd/bgp_linkstate_tlv.c \
bgpd/bgp_linkstate_vty.c \
bgpd/bgp_mac.c \ bgpd/bgp_mac.c \
bgpd/bgp_memory.c \ bgpd/bgp_memory.c \
bgpd/bgp_mpath.c \ bgpd/bgp_mpath.c \
@ -136,9 +133,6 @@ noinst_HEADERS += \
bgpd/bgp_label.h \ bgpd/bgp_label.h \
bgpd/bgp_labelpool.h \ bgpd/bgp_labelpool.h \
bgpd/bgp_lcommunity.h \ bgpd/bgp_lcommunity.h \
bgpd/bgp_linkstate.h \
bgpd/bgp_linkstate_tlv.h \
bgpd/bgp_linkstate_vty.h \
bgpd/bgp_mac.h \ bgpd/bgp_mac.h \
bgpd/bgp_memory.h \ bgpd/bgp_memory.h \
bgpd/bgp_mpath.h \ bgpd/bgp_mpath.h \
@ -215,7 +209,6 @@ clippy_scan += \
bgpd/bgp_debug.c \ bgpd/bgp_debug.c \
bgpd/bgp_evpn_vty.c \ bgpd/bgp_evpn_vty.c \
bgpd/bgp_labelpool.c \ bgpd/bgp_labelpool.c \
bgpd/bgp_linkstate_vty.c \
bgpd/bgp_route.c \ bgpd/bgp_route.c \
bgpd/bgp_routemap.c \ bgpd/bgp_routemap.c \
bgpd/bgp_rpki.c \ bgpd/bgp_rpki.c \

View File

@ -1,146 +0,0 @@
.. _bgp-link-state:
BGP Link-State
==============
Overview
--------
BGP Link-State (BGP-LS) is an extension of the BGP protocol designed to
redistribute information from an IGP database to a remote controller (most
likely a Path Computation Element - PCE). BGP-LS does nothing more than
transport IGP information. Therefore, it cannot be used to replace a Link State
routing protocol like OSPF and IS-IS.
Historically, the only way to get a network controller to collect an IGP
database was to have it participate in the IGP itself as if it were a standard
router. Since the controllers were usually located far from the IGP area,
tunnels such as GRE were used to connect the controllers to the IGP area. This
method was so impractical that an alternative solution was imagined: using the
already deployed inter-domain BGP protocol to redistribute the various IGP
databases.
BGP Link-State as defined in `RFC7752
<https://www.rfc-editor.org/rfc/rfc7752.html>`_ uses the AFI 16388 and SAFI 71.
The BGP Link-State pseudo-prefixes distributed by the `NLRI (Network Layer
Reachability Information)` uniquely define the following
IGP information:
- Nodes
- Link
- IPv4 Prefix
- IPv6 Prefix
They are called descriptors. In addition, a new type of BGP Attributes called
"BGP-LS attributes" carries the other information related to a descriptor.
NLRI and attribute information for BGP-LS is organized using the TLV format
already used by IS-IS LSPs and OSPF opaque LSAs. The `list of TLV code points
<https://www.iana.org/assignments/bgp-ls-parameters/bgp-ls-parameters.xhtml#node-descriptor-link-descriptor-prefix-descriptor-attribute-tlv>`_
is maintained by IANA.
Current implementation
----------------------
The current version can participate in BGP Link-State AFI / SAFI with
third-party routers and forward the BGP Link-State descriptors and attributes to
other routers. However, it can not generate BGP Link-State data from OSPF and
IS-IS.
IANA maintains a `registry of BGP-LS NRLI descriptor types
<https://www.iana.org/assignments/bgp-ls-parameters/bgp-ls-parameters.xhtml#nlri-types>`_.
Only the following RFC7752 NRLI types are supported by the current version:
- Nodes
- Link
- IPv4 Prefix
- IPv6 Prefix
The BGP-LS attribute TLVs for these NLRI types are transmitted as is to other
routers which means that all the current and future version are already
supported.
Show commands
-------------
The following configuration enables the negotiation of the link-state AFI / SAFI
with the 192.0.2.2 eBGP peer.
.. code-block:: frr
router bgp 65003
neighbor 192.0.2.2 remote-as 65002
neighbor 192.0.2.2 update-source 192.0.2.3
!
address-family link-state link-state
neighbor 192.0.2.2 activate
neighbor 192.0.2.2 route-map PERMIT-ALL in
neighbor 192.0.2.2 route-map PERMIT-ALL out
exit-address-family
exit
!
route-map PERMIT-ALL permit 1
The BGP-LS table can be displayed.
.. code-block:: frr
frr# show bgp link-state link-state
BGP table version is 8, local router ID is 192.0.2.3, vrf id 0
Default local pref 100, local AS 65003
Network Next Hop Metric LocPrf Weight Path
*> Node OSPFv2 ID:0x20 Local{AS:65001 ID:0 Area:0 Rtr:10.10.10.10:1.1.1.1}/48
0 65002 65001 i
*> IPv4-Prefix OSPFv2 ID:0x20 Local{AS:65001 ID:0 Area:0 Rtr:10.10.10.10:1.1.1.1} Prefix{IPv4:89.10.11.0/24}/64
0 65002 65001 i
*> IPv6-Prefix ISIS-L2 ID:0x20 Local{AS:65001 ID:0 Rtr:0000.0000.1003.00} Prefix{IPv6:12:12::12:12/128 MT:2}/74
0 65002 65001 i
*> IPv6-Prefix OSPFv3 ID:0x20 Local{AS:65001 ID:0 Area:0 Rtr:10.10.10.10} Prefix{OSPF-Route-Type:1 IPv6:12:12::12:12/128 MT:2}/74
0 65002 65001 i
*> Node OSPFv2 ID:0x20 Local{AS:65001 ID:0 Area:0 Rtr:10.10.10.10}/48
0 65002 65001 i
*> Node ISIS-L1 ID:0x20 Local{AS:65001 ID:0 Rtr:0000.0000.1003.00}/48
0 65002 65001 i
*> Link ISIS-L1 ID:0x20 Local{AS:65001 ID:0 Rtr:0000.0000.1001} Remote{AS:65001 ID:0 Rtr:0000.0000.1000} Link{IPv4:10.1.0.1 Neigh-IPv4:10.1.0.2 IPv6:2001::1 Neigh-IPv6:2001::2 MT:0,2}/132
0 65002 65001 i
The "detail-routes" allows displaying the BGP-LS attributes as well.
.. code-block:: frr
frr# show bgp link-state link-state detail-routes
(...)
BGP routing table entry for Link ISIS-L1 ID:0x20 Local{AS:65001 ID:0 Rtr:0000.0000.1001} Remote{AS:65001 ID:0 Rtr:0000.0000.1000} Link{IPv4:10.1.0.1 Neigh-IPv4:10.1.0.2 IPv6:2001::1 Neigh-IPv6:2001::2 MT:0,2}/116, version 1
Paths: (1 available, best #1)
Advertised to non peer-group peers:
192.0.2.1 192.0.2.3
65001
:: from 192.0.2.1 (192.0.2.1)
Origin IGP, valid, external, best (First path received)
Last update: Mon Apr 17 15:45:42 2023
BGP-LS attributes:
IPv4 Router-ID of Local Node: 1.1.1.1
IPv4 Router-ID of Remote Node: 10.10.10.10
Maximum link bandwidth: 1410.07 Mbps
Max. reservable link bandwidth: 1410.07 Mbps
Unreserved bandwidth:
[0]: 1410.07 Mbps [1]: 1410.07 Mbps
[2]: 1410.07 Mbps [3]: 1410.07 Mbps
[4]: 1410.07 Mbps [5]: 1410.07 Mbps
[6]: 1410.07 Mbps [7]: 1410.07 Mbps
TE Default Metric: 100
IGP Metric: 10
Adjacency SID:
Flags: 0b00110000
Weight: 0
SID: 15000
Unidirectional Link Delay: 8500 microseconds
Min/Max Unidirectional Link Delay: 8000/9000 microseconds
Application-Specific Link Attributes:
SABM Flags : 0b00010000 00000000 00000000 00000000
UDABM Flags: 0b00000000 00000000 00000000 00000000
Administrative group: 0x00000001
TE Default Metric: 100
Min/Max Unidirectional Link Delay: 8000/9000 microseconds
Extended Administrative Group: 0x00000001

View File

@ -827,10 +827,6 @@ from eBGP peers, :ref:`bgp-route-selection`.
MED as an intra-AS metric to steer equal-length AS_PATH routes to, e.g., MED as an intra-AS metric to steer equal-length AS_PATH routes to, e.g.,
desired exit points. desired exit points.
.. [#med-transitivity-rant] For some set of objects to have an order, there *must* be some binary ordering relation that is defined for *every* combination of those objects, and that relation *must* be transitive. I.e.:, if the relation operator is <, and if a < b and b < c then that relation must carry over and it *must* be that a < c for the objects to have an order. The ordering relation may allow for equality, i.e. a < b and b < a may both be true and imply that a and b are equal in the order and not distinguished by it, in which case the set has a partial order. Otherwise, if there is an order, all the objects have a distinct place in the order and the set has a total order)
.. [bgp-route-osci-cond] McPherson, D. and Gill, V. and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation Condition", IETF RFC3345
.. [stable-flexible-ibgp] Flavel, A. and M. Roughan, "Stable and flexible iBGP", ACM SIGCOMM 2009
.. [ibgp-correctness] Griffin, T. and G. Wilfong, "On the correctness of IBGP configuration", ACM SIGCOMM 2002
.. _bgp-graceful-restart: .. _bgp-graceful-restart:
@ -1837,13 +1833,6 @@ Configuring Peers
and is not displayed. and is not displayed.
The `bgp default l2vpn-evpn` form of the command is displayed. The `bgp default l2vpn-evpn` form of the command is displayed.
.. clicmd:: bgp default link-state
This command allows the user to specify that the link-state link-state
address family is turned on by default or not. This command defaults to off
and is not displayed.
The `bgp default link-state` form of the command is displayed.
.. clicmd:: bgp default show-hostname .. clicmd:: bgp default show-hostname
This command shows the hostname of the peer in certain BGP commands This command shows the hostname of the peer in certain BGP commands
@ -5243,7 +5232,10 @@ Show command json output:
.. include:: flowspec.rst .. include:: flowspec.rst
.. include:: bgp-linkstate.rst .. [#med-transitivity-rant] For some set of objects to have an order, there *must* be some binary ordering relation that is defined for *every* combination of those objects, and that relation *must* be transitive. I.e.:, if the relation operator is <, and if a < b and b < c then that relation must carry over and it *must* be that a < c for the objects to have an order. The ordering relation may allow for equality, i.e. a < b and b < a may both be true and imply that a and b are equal in the order and not distinguished by it, in which case the set has a partial order. Otherwise, if there is an order, all the objects have a distinct place in the order and the set has a total order)
.. [bgp-route-osci-cond] McPherson, D. and Gill, V. and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation Condition", IETF RFC3345
.. [stable-flexible-ibgp] Flavel, A. and M. Roughan, "Stable and flexible iBGP", ACM SIGCOMM 2009
.. [ibgp-correctness] Griffin, T. and G. Wilfong, "On the correctness of IBGP configuration", ACM SIGCOMM 2002
.. _bgp-fast-convergence: .. _bgp-fast-convergence:

View File

@ -130,7 +130,6 @@ exclude_patterns = [
"rpki.rst", "rpki.rst",
"routeserver.rst", "routeserver.rst",
"ospf_fundamentals.rst", "ospf_fundamentals.rst",
"bgp-linkstate.rst",
"flowspec.rst", "flowspec.rst",
"snmptrap.rst", "snmptrap.rst",
"wecmp_linkbw.rst", "wecmp_linkbw.rst",

View File

@ -174,7 +174,6 @@ enum node_type {
BMP_NODE, /* BMP config under router bgp */ BMP_NODE, /* BMP config under router bgp */
ISIS_SRV6_NODE, /* ISIS SRv6 node */ ISIS_SRV6_NODE, /* ISIS SRv6 node */
ISIS_SRV6_NODE_MSD_NODE, /* ISIS SRv6 Node MSDs node */ ISIS_SRV6_NODE_MSD_NODE, /* ISIS SRv6 Node MSDs node */
BGP_LS_NODE, /* BGP-LS configuration node */
NODE_TYPE_MAX, /* maximum */ NODE_TYPE_MAX, /* maximum */
}; };
/* clang-format on */ /* clang-format on */

View File

@ -26,7 +26,6 @@ typedef enum {
IANA_AFI_IPV4 = 1, IANA_AFI_IPV4 = 1,
IANA_AFI_IPV6 = 2, IANA_AFI_IPV6 = 2,
IANA_AFI_L2VPN = 25, IANA_AFI_L2VPN = 25,
IANA_AFI_LINKSTATE = 16388, /* BGP-LS RFC 7752 */
} iana_afi_t; } iana_afi_t;
typedef enum { typedef enum {
@ -36,8 +35,6 @@ typedef enum {
IANA_SAFI_LABELED_UNICAST = 4, IANA_SAFI_LABELED_UNICAST = 4,
IANA_SAFI_ENCAP = 7, IANA_SAFI_ENCAP = 7,
IANA_SAFI_EVPN = 70, IANA_SAFI_EVPN = 70,
IANA_SAFI_LINKSTATE = 71, /* BGP-LS RFC 7752 */
IANA_SAFI_LINKSTATE_VPN = 72, /* BGP-LS RFC 7752 */
IANA_SAFI_MPLS_VPN = 128, IANA_SAFI_MPLS_VPN = 128,
IANA_SAFI_FLOWSPEC = 133 IANA_SAFI_FLOWSPEC = 133
} iana_safi_t; } iana_safi_t;
@ -51,8 +48,6 @@ static inline afi_t afi_iana2int(iana_afi_t afi)
return AFI_IP6; return AFI_IP6;
case IANA_AFI_L2VPN: case IANA_AFI_L2VPN:
return AFI_L2VPN; return AFI_L2VPN;
case IANA_AFI_LINKSTATE:
return AFI_LINKSTATE;
case IANA_AFI_RESERVED: case IANA_AFI_RESERVED:
return AFI_MAX; return AFI_MAX;
} }
@ -69,8 +64,6 @@ static inline iana_afi_t afi_int2iana(afi_t afi)
return IANA_AFI_IPV6; return IANA_AFI_IPV6;
case AFI_L2VPN: case AFI_L2VPN:
return IANA_AFI_L2VPN; return IANA_AFI_L2VPN;
case AFI_LINKSTATE:
return IANA_AFI_LINKSTATE;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_MAX: case AFI_MAX:
return IANA_AFI_RESERVED; return IANA_AFI_RESERVED;
@ -101,10 +94,6 @@ static inline safi_t safi_iana2int(iana_safi_t safi)
return SAFI_LABELED_UNICAST; return SAFI_LABELED_UNICAST;
case IANA_SAFI_FLOWSPEC: case IANA_SAFI_FLOWSPEC:
return SAFI_FLOWSPEC; return SAFI_FLOWSPEC;
case IANA_SAFI_LINKSTATE:
return SAFI_LINKSTATE;
case IANA_SAFI_LINKSTATE_VPN:
return SAFI_LINKSTATE_VPN;
case IANA_SAFI_RESERVED: case IANA_SAFI_RESERVED:
return SAFI_MAX; return SAFI_MAX;
} }
@ -129,10 +118,6 @@ static inline iana_safi_t safi_int2iana(safi_t safi)
return IANA_SAFI_LABELED_UNICAST; return IANA_SAFI_LABELED_UNICAST;
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
return IANA_SAFI_FLOWSPEC; return IANA_SAFI_FLOWSPEC;
case SAFI_LINKSTATE:
return IANA_SAFI_LINKSTATE;
case SAFI_LINKSTATE_VPN:
return IANA_SAFI_LINKSTATE_VPN;
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_MAX: case SAFI_MAX:
return IANA_SAFI_RESERVED; return IANA_SAFI_RESERVED;

View File

@ -20,7 +20,6 @@
DEFINE_MTYPE_STATIC(LIB, PREFIX, "Prefix"); DEFINE_MTYPE_STATIC(LIB, PREFIX, "Prefix");
DEFINE_MTYPE_STATIC(LIB, PREFIX_FLOWSPEC, "Prefix Flowspec"); DEFINE_MTYPE_STATIC(LIB, PREFIX_FLOWSPEC, "Prefix Flowspec");
DEFINE_MTYPE_STATIC(LIB, PREFIX_LINKSTATE, "Prefix Link-State");
/* Maskbit. */ /* Maskbit. */
static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
@ -33,18 +32,6 @@ static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
#define MASKBIT(offset) ((0xff << (PNBBY - (offset))) & 0xff) #define MASKBIT(offset) ((0xff << (PNBBY - (offset))) & 0xff)
char *(*prefix_linkstate_display_hook)(char *buf, size_t size,
uint16_t nlri_type, uintptr_t ptr,
uint16_t len) = NULL;
void prefix_set_linkstate_display_hook(char *(*func)(char *buf, size_t size,
uint16_t nlri_type,
uintptr_t ptr,
uint16_t len))
{
prefix_linkstate_display_hook = func;
}
int is_zero_mac(const struct ethaddr *mac) int is_zero_mac(const struct ethaddr *mac)
{ {
int i = 0; int i = 0;
@ -94,8 +81,6 @@ int str2family(const char *string)
return AF_ETHERNET; return AF_ETHERNET;
else if (!strcmp("evpn", string)) else if (!strcmp("evpn", string))
return AF_EVPN; return AF_EVPN;
else if (!strcmp("link-state", string))
return AF_LINKSTATE;
return -1; return -1;
} }
@ -110,8 +95,6 @@ const char *family2str(int family)
return "Ethernet"; return "Ethernet";
case AF_EVPN: case AF_EVPN:
return "Evpn"; return "Evpn";
case AF_LINKSTATE:
return "Link-State";
} }
return "?"; return "?";
} }
@ -126,8 +109,6 @@ int afi2family(afi_t afi)
else if (afi == AFI_L2VPN) else if (afi == AFI_L2VPN)
return AF_ETHERNET; return AF_ETHERNET;
/* NOTE: EVPN code should NOT use this interface. */ /* NOTE: EVPN code should NOT use this interface. */
else if (afi == AFI_LINKSTATE)
return AF_LINKSTATE;
return 0; return 0;
} }
@ -139,8 +120,6 @@ afi_t family2afi(int family)
return AFI_IP6; return AFI_IP6;
else if (family == AF_ETHERNET || family == AF_EVPN) else if (family == AF_ETHERNET || family == AF_EVPN)
return AFI_L2VPN; return AFI_L2VPN;
else if (family == AF_LINKSTATE)
return AFI_LINKSTATE;
return 0; return 0;
} }
@ -153,8 +132,6 @@ const char *afi2str_lower(afi_t afi)
return "ipv6"; return "ipv6";
case AFI_L2VPN: case AFI_L2VPN:
return "l2vpn"; return "l2vpn";
case AFI_LINKSTATE:
return "link-state";
case AFI_MAX: case AFI_MAX:
case AFI_UNSPEC: case AFI_UNSPEC:
return "bad-value"; return "bad-value";
@ -172,8 +149,6 @@ const char *afi2str(afi_t afi)
return "IPv6"; return "IPv6";
case AFI_L2VPN: case AFI_L2VPN:
return "l2vpn"; return "l2vpn";
case AFI_LINKSTATE:
return "link-state";
case AFI_MAX: case AFI_MAX:
case AFI_UNSPEC: case AFI_UNSPEC:
return "bad-value"; return "bad-value";
@ -199,10 +174,6 @@ const char *safi2str(safi_t safi)
return "labeled-unicast"; return "labeled-unicast";
case SAFI_FLOWSPEC: case SAFI_FLOWSPEC:
return "flowspec"; return "flowspec";
case SAFI_LINKSTATE:
return "link-state";
case SAFI_LINKSTATE_VPN:
return "link-state-vpn";
case SAFI_UNSPEC: case SAFI_UNSPEC:
case SAFI_MAX: case SAFI_MAX:
return "unknown"; return "unknown";
@ -240,21 +211,6 @@ int prefix_match(union prefixconstptr unet, union prefixconstptr upfx)
offset = n->u.prefix_flowspec.prefixlen; offset = n->u.prefix_flowspec.prefixlen;
while (offset--)
if (np[offset] != pp[offset])
return 0;
return 1;
} else if (n->family == AF_LINKSTATE) {
if (n->u.prefix_linkstate.nlri_type !=
p->u.prefix_linkstate.nlri_type)
return 0;
/* Set both prefix's head pointer. */
np = (const uint8_t *)&n->u.prefix_linkstate.ptr;
pp = (const uint8_t *)&p->u.prefix_linkstate.ptr;
offset = n->prefixlen; /* length is checked above */
while (offset--) while (offset--)
if (np[offset] != pp[offset]) if (np[offset] != pp[offset])
return 0; return 0;
@ -360,8 +316,6 @@ void prefix_copy(union prefixptr udest, union prefixconstptr usrc)
{ {
struct prefix *dest = udest.p; struct prefix *dest = udest.p;
const struct prefix *src = usrc.p; const struct prefix *src = usrc.p;
void *temp;
int len;
dest->family = src->family; dest->family = src->family;
dest->prefixlen = src->prefixlen; dest->prefixlen = src->prefixlen;
@ -380,6 +334,9 @@ void prefix_copy(union prefixptr udest, union prefixconstptr usrc)
dest->u.lp.id = src->u.lp.id; dest->u.lp.id = src->u.lp.id;
dest->u.lp.adv_router = src->u.lp.adv_router; dest->u.lp.adv_router = src->u.lp.adv_router;
} else if (src->family == AF_FLOWSPEC) { } else if (src->family == AF_FLOWSPEC) {
void *temp;
int len;
len = src->u.prefix_flowspec.prefixlen; len = src->u.prefix_flowspec.prefixlen;
dest->u.prefix_flowspec.prefixlen = dest->u.prefix_flowspec.prefixlen =
src->u.prefix_flowspec.prefixlen; src->u.prefix_flowspec.prefixlen;
@ -390,14 +347,6 @@ void prefix_copy(union prefixptr udest, union prefixconstptr usrc)
dest->u.prefix_flowspec.ptr = (uintptr_t)temp; dest->u.prefix_flowspec.ptr = (uintptr_t)temp;
memcpy((void *)dest->u.prefix_flowspec.ptr, memcpy((void *)dest->u.prefix_flowspec.ptr,
(void *)src->u.prefix_flowspec.ptr, len); (void *)src->u.prefix_flowspec.ptr, len);
} else if (src->family == AF_LINKSTATE) {
len = src->prefixlen;
dest->u.prefix_linkstate.nlri_type =
src->u.prefix_linkstate.nlri_type;
temp = XCALLOC(MTYPE_PREFIX_LINKSTATE, len);
dest->u.prefix_linkstate.ptr = (uintptr_t)temp;
memcpy((void *)dest->u.prefix_linkstate.ptr,
(void *)src->u.prefix_linkstate.ptr, len);
} else { } else {
flog_err(EC_LIB_DEVELOPMENT, flog_err(EC_LIB_DEVELOPMENT,
"prefix_copy(): Unknown address family %d", "prefix_copy(): Unknown address family %d",
@ -487,14 +436,6 @@ int prefix_same(union prefixconstptr up1, union prefixconstptr up2)
p2->u.prefix_flowspec.prefixlen)) p2->u.prefix_flowspec.prefixlen))
return 1; return 1;
} }
if (p1->family == AF_LINKSTATE) {
if (p1->u.prefix_linkstate.nlri_type !=
p2->u.prefix_linkstate.nlri_type)
return 0;
if (!memcmp(&p1->u.prefix_linkstate.ptr,
&p2->u.prefix_linkstate.ptr, p2->prefixlen))
return 1;
}
} }
return 0; return 0;
} }
@ -542,22 +483,6 @@ int prefix_cmp(union prefixconstptr up1, union prefixconstptr up2)
if (pp1[offset] != pp2[offset]) if (pp1[offset] != pp2[offset])
return numcmp(pp1[offset], pp2[offset]); return numcmp(pp1[offset], pp2[offset]);
return 0; return 0;
} else if (p1->family == AF_LINKSTATE) {
pp1 = (const uint8_t *)p1->u.prefix_linkstate.ptr;
pp2 = (const uint8_t *)p2->u.prefix_linkstate.ptr;
if (p1->u.prefix_linkstate.nlri_type !=
p2->u.prefix_linkstate.nlri_type)
return 1;
if (p1->prefixlen != p2->prefixlen)
return numcmp(p1->prefixlen, p2->prefixlen);
offset = p1->prefixlen;
while (offset--)
if (pp1[offset] != pp2[offset])
return numcmp(pp1[offset], pp2[offset]);
return 0;
} }
pp1 = p1->u.val; pp1 = p1->u.val;
pp2 = p2->u.val; pp2 = p2->u.val;
@ -1147,26 +1072,10 @@ static const char *prefixevpn2str(const struct prefix_evpn *p, char *str,
return str; return str;
} }
const char *bgp_linkstate_nlri_type_2str(uint16_t nlri_type)
{
switch (nlri_type) {
case BGP_LINKSTATE_NODE:
return "Node";
case BGP_LINKSTATE_LINK:
return "Link";
case BGP_LINKSTATE_PREFIX4:
return "IPv4-Prefix";
case BGP_LINKSTATE_PREFIX6:
return "IPv6-Prefix";
}
return "Unknown";
}
const char *prefix2str(union prefixconstptr pu, char *str, int size) const char *prefix2str(union prefixconstptr pu, char *str, int size)
{ {
const struct prefix *p = pu.p; const struct prefix *p = pu.p;
char buf[PREFIX_STRLEN_EXTENDED]; char buf[PREFIX2STR_BUFFER];
int byte, tmp, a, b; int byte, tmp, a, b;
bool z = false; bool z = false;
size_t l; size_t l;
@ -1207,22 +1116,6 @@ const char *prefix2str(union prefixconstptr pu, char *str, int size)
strlcpy(str, "FS prefix", size); strlcpy(str, "FS prefix", size);
break; break;
case AF_LINKSTATE:
if (prefix_linkstate_display_hook)
snprintf(str, size, "%s/%d",
prefix_linkstate_display_hook(
buf, sizeof(buf),
p->u.prefix_linkstate.nlri_type,
p->u.prefix_linkstate.ptr,
p->prefixlen),
p->prefixlen);
else
snprintf(str, size, "%s/%d",
bgp_linkstate_nlri_type_2str(
p->u.prefix_linkstate.nlri_type),
p->prefixlen);
break;
default: default:
strlcpy(str, "UNK prefix", size); strlcpy(str, "UNK prefix", size);
break; break;
@ -1234,7 +1127,7 @@ const char *prefix2str(union prefixconstptr pu, char *str, int size)
static ssize_t prefixhost2str(struct fbuf *fbuf, union prefixconstptr pu) static ssize_t prefixhost2str(struct fbuf *fbuf, union prefixconstptr pu)
{ {
const struct prefix *p = pu.p; const struct prefix *p = pu.p;
char buf[PREFIX_STRLEN_EXTENDED]; char buf[PREFIX2STR_BUFFER];
switch (p->family) { switch (p->family) {
case AF_INET: case AF_INET:
@ -1246,17 +1139,6 @@ static ssize_t prefixhost2str(struct fbuf *fbuf, union prefixconstptr pu)
prefix_mac2str(&p->u.prefix_eth, buf, sizeof(buf)); prefix_mac2str(&p->u.prefix_eth, buf, sizeof(buf));
return bputs(fbuf, buf); return bputs(fbuf, buf);
case AF_LINKSTATE:
if (prefix_linkstate_display_hook)
prefix_linkstate_display_hook(
buf, sizeof(buf),
p->u.prefix_linkstate.nlri_type,
p->u.prefix_linkstate.ptr, p->prefixlen);
else
snprintf(buf, sizeof(buf), "%s",
bgp_linkstate_nlri_type_2str(
p->u.prefix_linkstate.nlri_type));
return bputs(fbuf, buf);
default: default:
return bprintfrr(fbuf, "{prefix.af=%dPF}", p->family); return bprintfrr(fbuf, "{prefix.af=%dPF}", p->family);
} }
@ -1291,20 +1173,6 @@ const char *prefix_sg2str(const struct prefix_sg *sg, char *sg_str)
return sg_str; return sg_str;
} }
void prefix_linkstate_ptr_free(struct prefix *p)
{
void *temp;
if (!p || p->family != AF_LINKSTATE || !p->u.prefix_linkstate.ptr)
return;
temp = (void *)p->u.prefix_linkstate.ptr;
XFREE(MTYPE_PREFIX_LINKSTATE, temp);
p->u.prefix_linkstate.ptr = (uintptr_t)NULL;
}
struct prefix *prefix_new(void) struct prefix *prefix_new(void)
{ {
struct prefix *p; struct prefix *p;
@ -1454,16 +1322,17 @@ char *prefix_mac2str(const struct ethaddr *mac, char *buf, int size)
unsigned prefix_hash_key(const void *pp) unsigned prefix_hash_key(const void *pp)
{ {
struct prefix copy; struct prefix copy;
if (((struct prefix *)pp)->family == AF_FLOWSPEC) {
uint32_t len; uint32_t len;
void *temp; void *temp;
/* make sure *all* unused bits are zero, particularly including /* make sure *all* unused bits are zero,
* alignment / * particularly including alignment /
* padding and unused prefix bytes. */ * padding and unused prefix bytes.
*/
memset(&copy, 0, sizeof(copy)); memset(&copy, 0, sizeof(copy));
prefix_copy(&copy, (struct prefix *)pp); prefix_copy(&copy, (struct prefix *)pp);
if (((struct prefix *)pp)->family == AF_FLOWSPEC) {
len = jhash((void *)copy.u.prefix_flowspec.ptr, len = jhash((void *)copy.u.prefix_flowspec.ptr,
copy.u.prefix_flowspec.prefixlen, copy.u.prefix_flowspec.prefixlen,
0x55aa5a5a); 0x55aa5a5a);
@ -1471,13 +1340,12 @@ unsigned prefix_hash_key(const void *pp)
XFREE(MTYPE_PREFIX_FLOWSPEC, temp); XFREE(MTYPE_PREFIX_FLOWSPEC, temp);
copy.u.prefix_flowspec.ptr = (uintptr_t)NULL; copy.u.prefix_flowspec.ptr = (uintptr_t)NULL;
return len; return len;
} else if (((struct prefix *)pp)->family == AF_LINKSTATE) {
len = jhash((void *)copy.u.prefix_linkstate.ptr, copy.prefixlen,
0x55aa5a5a);
prefix_linkstate_ptr_free(&copy);
return len;
} }
/* make sure *all* unused bits are zero, particularly including
* alignment /
* padding and unused prefix bytes. */
memset(&copy, 0, sizeof(copy));
prefix_copy(&copy, (struct prefix *)pp);
return jhash(&copy, return jhash(&copy,
offsetof(struct prefix, u.prefix) + PSIZE(copy.prefixlen), offsetof(struct prefix, u.prefix) + PSIZE(copy.prefixlen),
0x55aa5a5a); 0x55aa5a5a);
@ -1752,7 +1620,7 @@ static ssize_t printfrr_pfx(struct fbuf *buf, struct printfrr_eargs *ea,
if (host_only) if (host_only)
return prefixhost2str(buf, (struct prefix *)ptr); return prefixhost2str(buf, (struct prefix *)ptr);
else { else {
char cbuf[PREFIX_STRLEN_EXTENDED]; char cbuf[PREFIX_STRLEN];
prefix2str(ptr, cbuf, sizeof(cbuf)); prefix2str(ptr, cbuf, sizeof(cbuf));
return bputs(buf, cbuf); return bputs(buf, cbuf);

View File

@ -125,15 +125,6 @@ struct evpn_addr {
#define prefix_addr u._prefix_addr #define prefix_addr u._prefix_addr
}; };
/* BGP Link-State NRLI types*/
enum bgp_linkstate_nlri_type {
/* RFC7752 Table 1 */
BGP_LINKSTATE_NODE = 1,
BGP_LINKSTATE_LINK = 2,
BGP_LINKSTATE_PREFIX4 = 3, /* IPv4 Topology Prefix */
BGP_LINKSTATE_PREFIX6 = 4, /* IPv6 Topology Prefix */
};
/* /*
* A struct prefix contains an address family, a prefix length, and an * A struct prefix contains an address family, a prefix length, and an
* address. This can represent either a 'network prefix' as defined * address. This can represent either a 'network prefix' as defined
@ -167,21 +158,12 @@ enum bgp_linkstate_nlri_type {
#define AF_FLOWSPEC (AF_MAX + 2) #define AF_FLOWSPEC (AF_MAX + 2)
#endif #endif
#if !defined(AF_LINKSTATE)
#define AF_LINKSTATE (AF_MAX + 3)
#endif
struct flowspec_prefix { struct flowspec_prefix {
uint8_t family; uint8_t family;
uint16_t prefixlen; /* length in bytes */ uint16_t prefixlen; /* length in bytes */
uintptr_t ptr; uintptr_t ptr;
}; };
struct linkstate_prefix {
uint16_t nlri_type;
uintptr_t ptr;
};
/* FRR generic prefix structure. */ /* FRR generic prefix structure. */
struct prefix { struct prefix {
uint8_t family; uint8_t family;
@ -200,7 +182,6 @@ struct prefix {
uintptr_t ptr; uintptr_t ptr;
struct evpn_addr prefix_evpn; /* AF_EVPN */ struct evpn_addr prefix_evpn; /* AF_EVPN */
struct flowspec_prefix prefix_flowspec; /* AF_FLOWSPEC */ struct flowspec_prefix prefix_flowspec; /* AF_FLOWSPEC */
struct linkstate_prefix prefix_linkstate; /* AF_LINKSTATE */
} u __attribute__((aligned(8))); } u __attribute__((aligned(8)));
}; };
@ -298,14 +279,6 @@ struct prefix_fs {
struct flowspec_prefix prefix __attribute__((aligned(8))); struct flowspec_prefix prefix __attribute__((aligned(8)));
}; };
/* Prefix for a BGP-LS entry */
struct prefix_bgpls {
uint8_t family;
uint16_t prefixlen;
struct linkstate_prefix prefix __attribute__((aligned(8)));
};
struct prefix_sg { struct prefix_sg {
uint8_t family; uint8_t family;
uint16_t prefixlen; uint16_t prefixlen;
@ -347,11 +320,6 @@ union prefixconstptr {
/* Maximum string length of the result of prefix2str */ /* Maximum string length of the result of prefix2str */
#define PREFIX_STRLEN 80 #define PREFIX_STRLEN 80
/* Maximum string length of the result of prefix2str for
* long string prefixes (eg. BGP Link-State)
*/
#define PREFIX_STRLEN_EXTENDED 512
/* /*
* Longest possible length of a (S,G) string is 34 bytes * Longest possible length of a (S,G) string is 34 bytes
* 123.123.123.123 = 15 * 2 * 123.123.123.123 = 15 * 2
@ -408,10 +376,6 @@ static inline void ipv4_addr_copy(struct in_addr *dst,
#define s6_addr32 __u6_addr.__u6_addr32 #define s6_addr32 __u6_addr.__u6_addr32
#endif /*s6_addr32*/ #endif /*s6_addr32*/
extern void prefix_set_linkstate_display_hook(
char *(*func)(char *buf, size_t size, uint16_t nlri_type, uintptr_t ptr,
uint16_t len));
/* Prototypes. */ /* Prototypes. */
extern int str2family(const char *string); extern int str2family(const char *string);
extern int afi2family(afi_t afi); extern int afi2family(afi_t afi);
@ -437,8 +401,6 @@ static inline afi_t prefix_afi(union prefixconstptr pu)
*/ */
extern unsigned int prefix_bit(const uint8_t *prefix, const uint16_t bit_index); extern unsigned int prefix_bit(const uint8_t *prefix, const uint16_t bit_index);
extern void prefix_linkstate_ptr_free(struct prefix *p);
extern struct prefix *prefix_new(void); extern struct prefix *prefix_new(void);
extern void prefix_free(struct prefix **p); extern void prefix_free(struct prefix **p);
/* /*
@ -456,7 +418,6 @@ extern void prefix_mcast_inet4_dump(const char *onfail, struct in_addr addr,
extern const char *prefix_sg2str(const struct prefix_sg *sg, char *str); extern const char *prefix_sg2str(const struct prefix_sg *sg, char *str);
extern const char *prefix2str(union prefixconstptr upfx, char *buffer, extern const char *prefix2str(union prefixconstptr upfx, char *buffer,
int size); int size);
extern const char *bgp_linkstate_nlri_type_2str(uint16_t nlri_type);
extern int evpn_type5_prefix_match(const struct prefix *evpn_pfx, extern int evpn_type5_prefix_match(const struct prefix *evpn_pfx,
const struct prefix *match_pfx); const struct prefix *match_pfx);
extern int prefix_match(union prefixconstptr unet, union prefixconstptr upfx); extern int prefix_match(union prefixconstptr unet, union prefixconstptr upfx);

View File

@ -142,7 +142,7 @@ static void route_common(const struct prefix *n, const struct prefix *p,
const uint8_t *pp; const uint8_t *pp;
uint8_t *newp; uint8_t *newp;
if (n->family == AF_FLOWSPEC || n->family == AF_LINKSTATE) if (n->family == AF_FLOWSPEC)
return prefix_copy(new, p); return prefix_copy(new, p);
np = (const uint8_t *)&n->u.prefix; np = (const uint8_t *)&n->u.prefix;
pp = (const uint8_t *)&p->u.prefix; pp = (const uint8_t *)&p->u.prefix;
@ -281,22 +281,15 @@ struct route_node *route_node_get(struct route_table *table,
const uint8_t *prefix = &p->u.prefix; const uint8_t *prefix = &p->u.prefix;
node = rn_hash_node_find(&table->hash, &search); node = rn_hash_node_find(&table->hash, &search);
if (node && node->info) { if (node && node->info)
if (family2afi(p->family) == AFI_LINKSTATE)
prefix_linkstate_ptr_free(p);
return route_lock_node(node); return route_lock_node(node);
}
match = NULL; match = NULL;
node = table->top; node = table->top;
while (node && node->p.prefixlen <= prefixlen while (node && node->p.prefixlen <= prefixlen
&& prefix_match(&node->p, p)) { && prefix_match(&node->p, p)) {
if (node->p.prefixlen == prefixlen) { if (node->p.prefixlen == prefixlen)
if (family2afi(p->family) == AFI_LINKSTATE)
prefix_linkstate_ptr_free(p);
return route_lock_node(node); return route_lock_node(node);
}
match = node; match = node;
node = node->link[prefix_bit(prefix, node->p.prefixlen)]; node = node->link[prefix_bit(prefix, node->p.prefixlen)];
@ -331,9 +324,6 @@ struct route_node *route_node_get(struct route_table *table,
table->count++; table->count++;
route_lock_node(new); route_lock_node(new);
if (family2afi(p->family) == AFI_LINKSTATE)
prefix_linkstate_ptr_free(p);
return new; return new;
} }

View File

@ -326,14 +326,13 @@ struct in_pktinfo {
#define INADDR_LOOPBACK 0x7f000001 /* Internet address 127.0.0.1. */ #define INADDR_LOOPBACK 0x7f000001 /* Internet address 127.0.0.1. */
#endif #endif
/* Address family numbers. */ /* Address family numbers from RFC1700. */
typedef enum { typedef enum {
AFI_UNSPEC = 0, AFI_UNSPEC = 0,
AFI_IP = 1, AFI_IP = 1,
AFI_IP6 = 2, AFI_IP6 = 2,
AFI_L2VPN = 3, AFI_L2VPN = 3,
AFI_LINKSTATE = 4, /* BGP-LS RFC 7752 */ AFI_MAX = 4
AFI_MAX = 5,
} afi_t; } afi_t;
#define IS_VALID_AFI(a) ((a) > AFI_UNSPEC && (a) < AFI_MAX) #define IS_VALID_AFI(a) ((a) > AFI_UNSPEC && (a) < AFI_MAX)
@ -348,9 +347,7 @@ typedef enum {
SAFI_EVPN = 5, SAFI_EVPN = 5,
SAFI_LABELED_UNICAST = 6, SAFI_LABELED_UNICAST = 6,
SAFI_FLOWSPEC = 7, SAFI_FLOWSPEC = 7,
SAFI_LINKSTATE = 8, /* BGP-LS RFC 7752 */ SAFI_MAX = 8
SAFI_LINKSTATE_VPN = 9, /* BGP-LS RFC 7752 */
SAFI_MAX = 10,
} safi_t; } safi_t;
#define FOREACH_AFI_SAFI(afi, safi) \ #define FOREACH_AFI_SAFI(afi, safi) \

View File

@ -312,11 +312,6 @@ void route_add(struct pbr_nexthop_group_cache *pnhgc, struct nexthop_group nhg,
"%s: Asked to install unsupported route type: L2VPN", "%s: Asked to install unsupported route type: L2VPN",
__func__); __func__);
break; break;
case AFI_LINKSTATE:
DEBUGD(&pbr_dbg_zebra,
"%s: Asked to install unsupported route type: Link-State",
__func__);
break;
case AFI_UNSPEC: case AFI_UNSPEC:
DEBUGD(&pbr_dbg_zebra, DEBUGD(&pbr_dbg_zebra,
"%s: Asked to install unspecified route type", __func__); "%s: Asked to install unspecified route type", __func__);
@ -362,11 +357,6 @@ void route_delete(struct pbr_nexthop_group_cache *pnhgc, afi_t afi)
"%s: Asked to delete unsupported route type: L2VPN", "%s: Asked to delete unsupported route type: L2VPN",
__func__); __func__);
break; break;
case AFI_LINKSTATE:
DEBUGD(&pbr_dbg_zebra,
"%s: Asked to delete unsupported route type: Link-State",
__func__);
break;
case AFI_UNSPEC: case AFI_UNSPEC:
DEBUGD(&pbr_dbg_zebra, DEBUGD(&pbr_dbg_zebra,
"%s: Asked to delete unspecified route type", __func__); "%s: Asked to delete unspecified route type", __func__);

View File

@ -131,7 +131,6 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
assert(!!str2prefix(args->source, &src)); assert(!!str2prefix(args->source, &src));
break; break;
case AFI_L2VPN: case AFI_L2VPN:
case AFI_LINKSTATE:
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_MAX: case AFI_MAX:
break; break;

View File

@ -660,8 +660,6 @@ static const char *str_from_afi(afi_t afi)
return "ipv6"; return "ipv6";
case AFI_L2VPN: case AFI_L2VPN:
return "l2vpn"; return "l2vpn";
case AFI_LINKSTATE:
return "link-state";
case AFI_MAX: case AFI_MAX:
case AFI_UNSPEC: case AFI_UNSPEC:
return "bad-value"; return "bad-value";

View File

@ -1,215 +0,0 @@
// Check content with
// cat bgp_injector.cfg | sed -e 's|//.*||g' | jq .
{
"my_as": 65001,
"hold_time": 30,
"bgp_identifier": "192.0.2.1",
"local_address": "192.0.2.1",
"peer_address": "192.0.2.2",
"mss": 4000,
"port": 179,
"path_attributes":
{
"as-path": "65001",
"next-hop": "192.0.2.1",
"origin": 0
},
"link_states":
[
{
"nlri":
{
"proto": "01", // IS-IS L1
"id": "0000000000000020",
"type": "0002", // Link-NLRI
"256": { // Local Link-Node Descriptor TLV
"512": "0000fde9", // AS 65001
"513": "00000000", // BGP-LS ID
"515": "000000001001" // router-id: 0000.0000.1001
},
"257": { // Remote Link-Node Descriptor TLV
"512": "0000fde9", // AS 65001
"513": "00000000", // BGP-LS ID
"515": "000000001000" // router-id: 0000.0000.1000
},
"259": "0a010001", // IPv4 interface address TLV
"260": "0a010002", // IPv4 Neighbor address TLV
"261": "20010000000000000000000000000001", // IPv6 interface address TLV
"262": "20010000000000000000000000000002", // IPv6 Neighbor address TLV
"263": "00000002" // MT-ID
},
"attr":
{
"1028": "01010101", //IPv4 Router-ID of Local Node TLV
"1030": "0a0a0a0a", //IPv4 Router-ID of Remote Node TLV
"1089": "4d2817c8", // Maximum link bandwidth TLV 1410.07 Mbps
"1090": "4d2817c8", // Maximum reservable link bandwidth TLV 1410.07 Mbps
"1091": "4d2817c84d2817c84d2817c84d2817c84d2817c84d2817c84d2817c84d2817c8", // Unreserved bandwidth TLV
"1092": "00000064", // TE Default Metric TLV
"1095": "00000a", // Metric TLV
// Adjacency SID TLV
// Flags: 0x30, Value Flag (V), Local Flag (L)
// Weight: 0
// .... 0000 0011 1010 1001 1000 = SID/Label: 15000
"1099": "30000000003a98",
//Unidirectional Link Delay TLV
// TE Metric Flags: 0x00
// Delay: 8500
"1114": "00002134",
//Min/Max Unidirectional Link Delay TLV
// TE Metric Flags: 0x00
// Min Delay: 8000
// Reserved: 0x00
// Max Delay: 9000
"1115": "00001f4000002328",
"1122": { //Application-Specific Link Attributes TLV
// Type: 1122
// Length: 48
// SABM Length: 4
// UDABM Length: 4
// Reserved: 0x0000
// Standard Application Identifier Bit Mask: 0x10000000, Flexible Algorithm (X)
// User-Defined Application Identifier Bit Mask: 00 00 00 00
"0": "040400001000000000000000", // 0 means encode data directly
"1088": "00000001", // Administrative group (color) TLV
"1092": "00000064", // TE Default Metric TLV
"1115": "00001f4000002328", // Min/Max Unidirectional Link Delay TLV
"1173": "00000001"// Extended Administrative Group TLV
}
}
},
{
"nlri":
{
"proto": "01", // IS-IS L1
"id": "0000000000000020",
"type": "0001", // Node-NLRI
"256": { // Local Link-Node Descriptor TLV
"512": "0000fde9", // AS 65001
"513": "00000000", // BGP-LS ID
"515": "00000000100300" // router-id: 0000.0000.1003.00
}
},
"attr":
{
"0": "0107000400000002010a00020108040200027233040300034910000404000403030303040a000cc000000fa004890003004e20040b0003008082040c000c00000003e804890003003a98"
}
},
{
"nlri":
{
"proto": "03", // OSPFv2
"id": "0000000000000020",
"type": "0001", // Node-NLRI
"256": { // Local Link-Node Descriptor TLV
"512": "0000fde9", // AS 65001
"513": "00000000", // BGP-LS ID
"514": "00000000", // Area 0
"515": "0a0a0a0a" // router-id: 10.10.10.10
}
},
"attr": // Attributes to test display
{
"1152": "80", // IGP flags
"1097": "000b00020123000500020123", //opaque Link TLV
"1105": "d123ed", // RTM capabilities
"1172": "dc12fceb04400004000f0001", // L2 bundle member attributes
"1117": "00FFFFFF", //Packet Loss 50.331642%
"1039": "820000800411000400000001041500040000000a0413000480000000", //flex-algo definition
"1044": "82800000000003e8", // flex-algo prefix metric
"1121": "", // graceful link shutdown
"1171": "00120012000000000000000000120012", // source router IPv6
"1871": "00120012000000000000000000" // Unknown TLV
}
},
{
"nlri":
{
"proto": "03", // OSPFv2
"id": "0000000000000020",
"type": "0001", // Node-NLRI
"256": { // Local Link-Node Descriptor TLV
"512": "0000fde9", // AS 65001
"513": "00000000", // BGP-LS ID
"514": "00000000", // Area 0
"515": "0a0a0a0a01010101" // router-id: 10.10.10.10:1.1.1.1
}
}
},
{
"nlri":
{
"proto": "03", // OSPFv2
"id": "0000000000000020",
"type": "0003", // IPv4-topo-prefix-NLRI
"256": { // Local Link-Node Descriptor TLV
"512": "0000fde9", // AS 65001
"513": "00000000", // BGP-LS ID
"514": "00000000", // Area 0
"515": "0a0a0a0a01010101" // router-id: 10.10.10.10:1.1.1.1
},
"265": "18590a0b" // IP Reachability Information TLV (89.10.11.0/24)
}
},
{
"nlri":
{
"proto": "02", // IS-IS L2
"id": "0000000000000020",
"type": "0004", // IPv6-topo-prefix-NLRI
"256": { // Local Link-Node Descriptor TLV
"512": "0000fde9", // AS 65001
"513": "00000000", // BGP-LS ID
"515": "00000000100300" // router-id: 0000.0000.1003.00
},
"263": "0002", // MT-ID
// IP Reachability Information TLV (12:12::12:12/128)
"265": "8000120012000000000000000000120012"
}
},
{
"nlri":
{
"proto": "06", // OSPFv3
"id": "0000000000000020",
"type": "0004", // IPv6-topo-prefix-NLRI
"256": { // Local Link-Node Descriptor TLV
"512": "0000fde9", // AS 65001
"513": "00000000", // BGP-LS ID
"514": "00000000", // Area 0
"515": "0a0a0a0a" // router-id: 10.10.10.10
},
"263": "0002", // MT-ID
"264": "01", // OSPF: route-type Intra-Area (0x1)
// IP Reachability Information TLV (12:12::12:12/128)
"265": "8000120012000000000000000000120012"
}
},
{
"nlri":
{
"proto": "06", // OSPFv3
"id": "ffffffffffffffff",
"type": "0002", // Link-NLRI
"256": { // Local Link-Node Descriptor TLV
"512": "ffffffff", // AS
"513": "ffffffff", // BGP-LS ID
"514": "ffffffff", // OSPF area ID
"515": "0a0a0a0b02020202" // router-id: 10.10.10.11:2.2.2.2
},
"257": { // Remote Link-Node Descriptor TLV
"512": "ffffffff", // AS
"513": "ffffffff", // BGP-LS ID
"514": "ffffffff", // OSPF area ID
"515": "0a0a0a0a01010101" // router-id: 10.10.10.10:1.1.1.1
},
"259": "0a010001", // IPv4 interface address TLV
"260": "0a010002", // IPv4 Neighbor address TLV
"261": "20010000000000000000000000000001", // IPv6 interface address TLV
"262": "20010000000000000000000000000002", // IPv6 Neighbor address TLV
"263": "00000002", // MT-ID
"424": "200100000000000001" // unknown TLV
}
}
]
}

View File

@ -1,596 +0,0 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
#
# Copyright 2018 Jorge Borreicho
# Copyright 2023 6WIND S.A.
"""
BGP prefix injection tool
"""
import socket
import sys
import time
from datetime import datetime
import struct
import threading
import json
import os
import re
import signal
import errno
AFI_IPV4 = 1
SAFI_UNICAST = 1
AFI_LINKSTATE = 16388
SAFI_LINKSTATE = 71
saved_pid = False
global pid_file
class Unbuffered(object):
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush()
def writelines(self, datas):
self.stream.writelines(datas)
self.stream.flush()
def __getattr__(self, attr):
return getattr(self.stream, attr)
def keepalive_thread(conn, interval):
# infinite loop so that function do not terminate and thread do not end.
while True:
time.sleep(interval)
keepalive_bgp(conn)
def receive_thread(conn):
# infinite loop so that function do not terminate and thread do not end.
while True:
# Receiving from client
r = conn.recv(1500)
while True:
start_ptr = (
r.find(
b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
)
+ 16
)
end_ptr = (
r[16:].find(
b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
)
+ 16
)
if (
start_ptr >= end_ptr
): # a single message was sent in the BGP packet OR it is the last message of the BGP packet
decode_bgp(r[start_ptr:])
break
else: # more messages left to decode
decode_bgp(r[start_ptr:end_ptr])
r = r[end_ptr:]
def decode_bgp(msg):
if len(msg) < 3:
return
msg_length, msg_type = struct.unpack("!HB", msg[0:3])
if msg_type == 4:
# print(timestamp + " - " + "Received KEEPALIVE") #uncomment to debug
pass
elif msg_type == 2:
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "Received UPDATE")
elif msg_type == 1:
version, remote_as, holdtime, i1, i2, i3, i4, opt_length = struct.unpack(
"!BHHBBBBB", msg[3:13]
)
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "Received OPEN")
print()
print(
"--> Version:"
+ str(version)
+ ", Remote AS: "
+ str(remote_as)
+ ", Hold Time:"
+ str(holdtime)
+ ", Remote ID: "
+ str(i1)
+ "."
+ str(i2)
+ "."
+ str(i3)
+ "."
+ str(i4)
)
print()
elif msg_type == 3:
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "Received NOTIFICATION")
def multiprotocol_capability(afi, safi):
hexstream = bytes.fromhex("02060104")
hexstream += struct.pack("!H", afi)
hexstream += struct.pack("!B", 0)
hexstream += struct.pack("!B", safi)
return hexstream
def open_bgp(conn, config):
# Build the BGP Message
bgp_version = b"\x04"
bgp_as = struct.pack("!H", config["my_as"])
bgp_hold_time = struct.pack("!H", config["hold_time"])
octet = config["bgp_identifier"].split(".")
bgp_identifier = struct.pack(
"!BBBB", int(octet[0]), int(octet[1]), int(octet[2]), int(octet[3])
)
bgp_opt = b""
bgp_opt += multiprotocol_capability(AFI_IPV4, SAFI_UNICAST)
bgp_opt += multiprotocol_capability(AFI_LINKSTATE, SAFI_LINKSTATE)
bgp_opt_lenght = struct.pack("!B", len(bgp_opt))
bgp_message = (
bgp_version + bgp_as + bgp_hold_time + bgp_identifier + bgp_opt_lenght + bgp_opt
)
# Build the BGP Header
total_length = len(bgp_message) + 16 + 2 + 1
bgp_marker = b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
bgp_length = struct.pack("!H", total_length)
bgp_type = b"\x01"
bgp_header = bgp_marker + bgp_length + bgp_type
bgp_packet = bgp_header + bgp_message
conn.send(bgp_packet)
return 0
def keepalive_bgp(conn):
# Build the BGP Header
total_length = 16 + 2 + 1
bgp_marker = b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
bgp_length = struct.pack("!H", total_length)
bgp_type = b"\x04"
bgp_header = bgp_marker + bgp_length + bgp_type
bgp_packet = bgp_header
conn.send(bgp_packet)
return 0
def encode_ipv4_prefix(address, netmask):
octet = address.split(".")
length = struct.pack("!B", int(netmask))
if int(netmask) <= 8:
prefix = struct.pack("!B", int(octet[0]))
elif int(netmask) <= 16:
prefix = struct.pack("!BB", int(octet[0]), int(octet[1]))
elif int(netmask) <= 24:
prefix = struct.pack("!BBB", int(octet[0]), int(octet[1]), int(octet[2]))
else:
prefix = struct.pack(
"!BBBB", int(octet[0]), int(octet[1]), int(octet[2]), int(octet[3])
)
return length + prefix
def encode_path_attribute_mp_reach_nrli(afi, safi, data, config):
hexstream = b""
hexstream += b"\x90" # flags optional, extended
hexstream += struct.pack("!B", 14) # type code MP_REACH_NLRI
hexstream2 = b""
hexstream2 += struct.pack("!H", afi)
hexstream2 += struct.pack("!B", safi)
hexstream2 += struct.pack("!B", 4) # nexthop length
hexstream2 += socket.inet_aton(config["local_address"]) # nexthop IPv4
hexstream2 += b"\x00" # SNPA
hexstream2 += data
hexstream += struct.pack("!H", len(hexstream2)) # length
hexstream += hexstream2
return hexstream
def encode_path_attribute_linkstate(data):
hexstream = b""
hexstream += b"\x80" # flags optional
hexstream += struct.pack("!B", 29) # type code BGP-LS
hexstream += struct.pack("!B", len(data)) # length
hexstream += data
return hexstream
def encode_path_attribute(type, value):
path_attributes = {
"origin": [b"\x40", 1],
"as-path": [b"\x40", 2],
"next-hop": [b"\x40", 3],
"med": [b"\x80", 4],
"local_pref": [b"\x40", 5],
"communities": [b"\xc0", 8],
}
attribute_flag = path_attributes[type][0]
attribute_type_code = struct.pack("!B", int(path_attributes[type][1]))
if type == "origin":
attribute_value = struct.pack("!B", value)
elif type == "as-path":
as_number_list = value.split(" ")
attribute_value = struct.pack("!BB", 2, len(as_number_list))
for as_number in as_number_list:
attribute_value += struct.pack("!H", int(as_number))
elif type == "next-hop":
octet = value.split(".")
attribute_value = struct.pack(
"!BBBB", int(octet[0]), int(octet[1]), int(octet[2]), int(octet[3])
)
elif type == "med":
attribute_value = struct.pack("!I", value)
elif type == "local_pref":
attribute_value = struct.pack("!I", value)
elif type == "communities":
communities_list = value.split(" ")
attribute_value = b""
for community in communities_list:
aux = community.split(":")
attribute_value += struct.pack("!HH", int(aux[0]), int(aux[1]))
attribute_length = struct.pack("!B", len(attribute_value))
return attribute_flag + attribute_type_code + attribute_length + attribute_value
def encode_tlvs(tlvs):
stream = b""
for key, tlv_data in tlvs.items():
if isinstance(key, str) and key.isdigit():
tlv_type = int(key)
else:
# key is not a TLV
continue
if isinstance(tlv_data, str):
if tlv_type != 0:
# TLV type 0 is fake TLV
stream += struct.pack("!H", tlv_type)
stream += struct.pack("!H", len(bytes.fromhex(tlv_data)))
stream += bytes.fromhex(tlv_data)
elif isinstance(tlv_data, dict):
# TLV contains sub-TLV
stream += struct.pack("!H", tlv_type)
stream_subtlv = encode_tlvs(tlv_data)
stream += struct.pack("!H", len(stream_subtlv))
stream += stream_subtlv
else:
# invalid input
assert 0
return stream
def encode_linkstate_nrli_tlv(nlri):
stream = b""
stream += bytes.fromhex(nlri["type"])
stream2 = b""
stream2 += bytes.fromhex(nlri["proto"])
stream2 += bytes.fromhex(nlri["id"])
stream2 += encode_tlvs(nlri)
stream += struct.pack("!H", len(stream2))
stream += stream2
return stream
def update_bgp(conn, link_state, config):
# Build the BGP Message
# Expired Routes
# 1 - Withdrawn Routes
bgp_withdrawn_routes = b""
max_length_reached = False
bgp_withdrawn_routes_length = struct.pack("!H", len(bgp_withdrawn_routes))
bgp_withdrawn_routes = bgp_withdrawn_routes_length + bgp_withdrawn_routes
# New Routes
# 2 - Path Attributes
path_attributes = config["path_attributes"]
bgp_mss = config["mss"]
bgp_total_path_attributes = b""
# encode link-state MP_REACH NLRI
data = encode_linkstate_nrli_tlv(link_state["nlri"])
bgp_total_path_attributes += encode_path_attribute_mp_reach_nrli(
AFI_LINKSTATE, SAFI_LINKSTATE, data, config
)
# encode classic attributes
for key in path_attributes.keys():
bgp_total_path_attributes += encode_path_attribute(key, path_attributes[key])
# encode link-state attributes
if "attr" in link_state:
data = encode_tlvs(link_state["attr"])
else:
data = b""
bgp_total_path_attributes += encode_path_attribute_linkstate(data)
bgp_total_path_attributes_length = struct.pack("!H", len(bgp_total_path_attributes))
bgp_total_path_attributes = (
bgp_total_path_attributes_length + bgp_total_path_attributes
)
# 3- Network Layer Reachability Information (NLRI)
bgp_new_routes = b""
bgp_message = bgp_withdrawn_routes + bgp_total_path_attributes + bgp_new_routes
# Build the BGP Header
total_length = len(bgp_message) + 16 + 2 + 1
bgp_marker = b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
bgp_length = struct.pack("!H", total_length)
bgp_type = b"\x02"
bgp_header = bgp_marker + bgp_length + bgp_type
bgp_packet = bgp_header + bgp_message
conn.send(bgp_packet)
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "Sent UPDATE")
return 0
def str2ip(ip_str):
s_octet = ip_str.split(".")
ip_addr = struct.pack(
"!BBBB", int(s_octet[0]), int(s_octet[1]), int(s_octet[2]), int(s_octet[3])
)
return ip_addr
def check_pid(pid):
if pid < 0: # user input error
return False
if pid == 0: # all processes
return False
try:
os.kill(pid, 0)
return True
except OSError as err:
if err.errno == errno.EPERM: # a process we were denied access to
return True
if err.errno == errno.ESRCH: # No such process
return False
# should never happen
return False
def savepid():
ownid = os.getpid()
flags = os.O_CREAT | os.O_EXCL | os.O_WRONLY
mode = ((os.R_OK | os.W_OK) << 6) | (os.R_OK << 3) | os.R_OK
try:
fd = os.open(pid_file, flags, mode)
except OSError:
try:
pid = open(pid_file, "r").readline().strip()
if check_pid(int(pid)):
sys.stderr.write(
"PIDfile already exists and program still running %s\n" % pid_file
)
return False
else:
# If pid is not running, reopen file without O_EXCL
fd = os.open(pid_file, flags ^ os.O_EXCL, mode)
except (OSError, IOError, ValueError):
sys.stderr.write(
"issue accessing PID file %s (most likely permission or ownership)\n"
% pid_file
)
return False
try:
f = os.fdopen(fd, "w")
line = "%d\n" % ownid
f.write(line)
f.close()
saved_pid = True
except IOError:
sys.stderr.write("Can not create PIDfile %s\n" % pid_file)
return False
print("Created PIDfile %s with value %d\n" % (pid_file, ownid))
return True
def removepid():
if not saved_pid:
return
try:
os.remove(pid_file)
except OSError as exc:
if exc.errno == errno.ENOENT:
pass
else:
sys.stderr.write("Can not remove PIDfile %s\n" % pid_file)
return
sys.stderr.write("Removed PIDfile %s\n" % pid_file)
def daemonize():
try:
pid = os.fork()
if pid > 0:
# Exit first parent
sys.exit(0)
except OSError as e:
print("Fork #1 failed: %d (%s)" % (e.errno, e.strerror))
sys.exit(1)
# Decouple from parent environment
os.chdir("/")
os.setsid()
os.umask(0)
# Do second fork
try:
pid = os.fork()
if pid > 0:
# Exit from second parent
sys.exit(0)
except OSError as e:
print("Fork #2 failed: %d (%s)" % (e.errno, e.strerror))
sys.exit(1)
# Redirect standard file descriptors
sys.stdout.flush()
sys.stderr.flush()
si = open(os.devnull, "r")
so = open(os.devnull, "a+")
se = open(os.devnull, "a+")
os.dup2(si.fileno(), sys.stdin.fileno())
os.dup2(so.fileno(), sys.stdout.fileno())
os.dup2(se.fileno(), sys.stderr.fileno())
def term(signal, frame):
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "^C received, shutting down.\n")
bgp_socket.close()
removepid()
exit()
if __name__ == "__main__":
if len(sys.argv) > 1:
# daemonize and log to file
daemonize()
pid_file = os.path.join(sys.argv[1], "bgp_injector.pid")
savepid()
# deal with daemon termination
signal.signal(signal.SIGTERM, term)
signal.signal(signal.SIGINT, term) # CTRL + C
log_dir = os.path.join(sys.argv[1], "bgp_injector.log")
f = open(log_dir, 'w')
sys.stdout = Unbuffered(f)
sys.stderr = Unbuffered(f)
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "Starting BGP injector ")
CONFIG_FILENAME = os.path.join(sys.path[0], "bgp_injector.cfg")
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "Reading config file " + CONFIG_FILENAME)
input_file = open(CONFIG_FILENAME, "r")
input = input_file.read()
# cleanup comments that are not supported by JSON
json_input = re.sub(r"//.*\n", "", input, flags=re.MULTILINE)
config = json.loads(json_input)
bgp_peer = config["peer_address"]
bgp_local = config["local_address"]
bgp_mss = config["mss"]
bgp_port = config["port"]
rib = dict()
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "Starting BGP... (peer: " + str(bgp_peer) + ")")
retry = 30
while retry:
retry -= 1
try:
bgp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
bgp_socket.bind((bgp_local, 0))
bgp_socket.connect((bgp_peer, bgp_port))
open_bgp(bgp_socket, config)
break
except TimeoutError:
if retry == 0:
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "Error: timeout connecting to the peer.")
exit()
time.sleep(1)
except OSError as e:
if retry == 0:
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "Error: cannot connect to the peer: " + str(e))
exit()
time.sleep(1)
receive_worker = threading.Thread(
target=receive_thread, args=(bgp_socket,)
) # wait from BGP msg from peer and process them
receive_worker.setDaemon(True)
receive_worker.start()
keepalive_worker = threading.Thread(
target=keepalive_thread,
args=(
bgp_socket,
(config["hold_time"]) / 3,
),
) # send keep alives every 10s by default
keepalive_worker.setDaemon(True)
keepalive_worker.start()
# send a first keepalive packet before sending the initial UPDATE packet
keepalive_bgp(bgp_socket)
timestamp = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print(timestamp + " - " + "BGP is up.")
time.sleep(3)
for link_state in config["link_states"]:
update_bgp(
bgp_socket,
link_state,
config,
)
while True:
time.sleep(60)

View File

@ -1 +0,0 @@
ip route 192.0.2.2/32 192.168.1.2

View File

@ -1,7 +0,0 @@
!
interface lo
ip address 192.0.2.1/32
!
interface r1-eth0
ip address 192.168.1.1/24
!

View File

@ -1,20 +0,0 @@
router bgp 65002
no bgp ebgp-requires-policy
neighbor 192.0.2.1 remote-as 65001
neighbor 192.0.2.1 timers connect 1
neighbor 192.0.2.1 ebgp-multihop 3
neighbor 192.0.2.1 update-source 192.0.2.2
neighbor 192.0.2.3 remote-as 65003
neighbor 192.0.2.3 timers 1 3
neighbor 192.0.2.3 timers connect 1
neighbor 192.0.2.3 ebgp-multihop 3
neighbor 192.0.2.3 update-source 192.0.2.2
address-family ipv4 unicast
no neighbor 192.0.2.1 activate
no neighbor 192.0.2.3 activate
exit-address-family
address-family link-state link-state
neighbor 192.0.2.1 activate
neighbor 192.0.2.3 activate
exit-address-family
!

View File

@ -1,189 +0,0 @@
{
"routes": {
"Link OSPFv3 ID:0xffffffffffffffff {Local {AS:4294967295 ID:4294967295 Area:4294967295 Rtr:10.10.10.11:2.2.2.2} Remote {AS:4294967295 ID:4294967295 Area:4294967295 Rtr:10.10.10.10:1.1.1.1} IPv4:10.1.0.1 Neigh-IPv4:10.1.0.2 IPv6:2001::1 Neigh-IPv6:2001::2 MT:0,2 424:0x200100000000000001}/XX": [
{
"valid": true,
"bestpath": true,
"pathFrom": "external",
"linkStateNLRI": {
"nlriType": "Link",
"protocol": "OSPFv3",
"identifier": "0xffffffffffffffff",
"localNode": {
"as": 4294967295,
"identifier": 4294967295,
"area": 4294967295,
"routerID": "10.10.10.11:2.2.2.2"
},
"remoteNode": {
"as": 4294967295,
"identifier": 4294967295,
"area": 4294967295,
"routerID": "10.10.10.10:1.1.1.1"
},
"interfaceIPv4": "10.1.0.1",
"neighborIPv4": "10.1.0.2",
"interfaceIPv6": "2001::1",
"neighborIPv6": "2001::2",
"mtID": [0, 2],
"424": ["0x2001000000000000", "0x01"]
},
"weight": 0,
"origin": "IGP"
}
],
"IPv6-Prefix OSPFv3 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10} MT:2 OSPF-Route-Type:1 IPv6:12:12::12:12/128}/XX": [
{
"valid": true,
"bestpath": true,
"pathFrom": "external",
"linkStateNLRI": {
"nlriType": "IPv6-Prefix",
"protocol": "OSPFv3",
"identifier": "0x20",
"localNode": {
"as": 65001,
"identifier": 0,
"area": 0,
"routerID": "10.10.10.10"
},
"ospfRouteType": 1,
"ipReachability": "12:12::12:12/128",
"mtID": [2]
},
"weight": 0,
"origin": "IGP"
}
],
"IPv6-Prefix ISIS-L2 ID:0x20 {Local {AS:65001 ID:0 Rtr:0000.0000.1003.00} MT:2 IPv6:12:12::12:12/128}/XX": [
{
"valid": true,
"bestpath": true,
"pathFrom": "external",
"linkStateNLRI": {
"nlriType": "IPv6-Prefix",
"protocol": "ISIS-L2",
"identifier": "0x20",
"localNode": {
"as": 65001,
"identifier": 0,
"routerID": "0000.0000.1003.00"
},
"ipReachability": "12:12::12:12/128",
"mtID": [2]
},
"weight": 0,
"origin": "IGP"
}
],
"IPv4-Prefix OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10:1.1.1.1} IPv4:89.10.11.0/24}/XX": [
{
"valid": true,
"bestpath": true,
"pathFrom": "external",
"linkStateNLRI": {
"nlriType": "IPv4-Prefix",
"protocol": "OSPFv2",
"identifier": "0x20",
"localNode": {
"as": 65001,
"identifier": 0,
"area": 0,
"routerID": "10.10.10.10:1.1.1.1"
},
"ipReachability": "89.10.11.0/24"
},
"weight": 0,
"origin": "IGP"
}
],
"Node OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10:1.1.1.1}}/XX": [
{
"valid": true,
"bestpath": true,
"pathFrom": "external",
"linkStateNLRI": {
"nlriType": "Node",
"protocol": "OSPFv2",
"identifier": "0x20",
"localNode": {
"as": 65001,
"identifier": 0,
"area": 0,
"routerID": "10.10.10.10:1.1.1.1"
}
},
"weight": 0,
"origin": "IGP"
}
],
"Node OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10}}/XX": [
{
"valid": true,
"bestpath": true,
"pathFrom": "external",
"linkStateNLRI": {
"nlriType": "Node",
"protocol": "OSPFv2",
"identifier": "0x20",
"localNode": {
"as": 65001,
"identifier": 0,
"area": 0,
"routerID": "10.10.10.10"
}
},
"weight": 0,
"origin": "IGP"
}
],
"Node ISIS-L1 ID:0x20 {Local {AS:65001 ID:0 Rtr:0000.0000.1003.00}}/XX": [
{
"valid": true,
"bestpath": true,
"pathFrom": "external",
"linkStateNLRI": {
"nlriType": "Node",
"protocol": "ISIS-L1",
"identifier": "0x20",
"localNode": {
"as": 65001,
"identifier": 0,
"routerID": "0000.0000.1003.00"
}
},
"weight": 0,
"origin": "IGP"
}
],
"Link ISIS-L1 ID:0x20 {Local {AS:65001 ID:0 Rtr:0000.0000.1001} Remote {AS:65001 ID:0 Rtr:0000.0000.1000} IPv4:10.1.0.1 Neigh-IPv4:10.1.0.2 IPv6:2001::1 Neigh-IPv6:2001::2 MT:0,2}/XX": [
{
"valid": true,
"bestpath": true,
"pathFrom": "external",
"linkStateNLRI": {
"nlriType": "Link",
"protocol": "ISIS-L1",
"identifier": "0x20",
"localNode": {
"as": 65001,
"identifier": 0,
"routerID": "0000.0000.1001"
},
"remoteNode": {
"as": 65001,
"identifier": 0,
"routerID": "0000.0000.1000"
},
"interfaceIPv4": "10.1.0.1",
"neighborIPv4": "10.1.0.2",
"interfaceIPv6": "2001::1",
"neighborIPv6": "2001::2",
"mtID": [0, 2]
},
"weight": 0,
"origin": "IGP"
}
]
}
}

View File

@ -1,325 +0,0 @@
{
"Node OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10}}/XX": {
"1152": {
"description": "IGP Flags",
"type": 1152,
"length": 1,
"data": "0b10000000"
},
"1097": {
"description": "Opaque Link Attribute",
"type": 1097,
"length": 12,
"data": {
"11": {
"type": 11,
"length": 2,
"data": "0x0123"
},
"5": {
"type": 5,
"length": 2,
"data": "0x0123"
}
}
},
"1105": {
"description": "RTM Capability",
"type": 1105,
"length": 3,
"data": {
"flags": "0b110",
"values": "0x11ed"
}
},
"1172": {
"description": "L2 Bundle Member Attributes",
"type": 1172,
"length": 12,
"data": {
"descriptor": "0xdc12fceb",
"1088": {
"description": "Administrative group",
"type": 1088,
"length": 4,
"data": "0x000f0001"
}
}
},
"1117": {
"description": "Unidirectional Link Loss",
"type": 1117,
"length": 4,
"data": {
"anomalous": false,
"lossPercent": 50.33164596557617
}
},
"1039": {
"description": "Flexible Algorithm Definition",
"type": 1039,
"length": 28,
"data": {
"flexAlgo": 130,
"metricType": 0,
"calcType": 0,
"priority": 128,
"1041": {
"description": "Flexible Algorithm Include Any Affinity",
"type": 1041,
"length": 4,
"data": "0x00000001"
},
"1045": {
"description": "Flexible Algorithm Exclude SRLG",
"type": 1045,
"length": 4,
"data": [
10
]
},
"1043": {
"description": "Flexible Algorithm Definition Flags",
"type": 1043,
"length": 4,
"data": "0b10000000 00000000 00000000 00000000"
}
}
},
"1044": {
"description": "Flexible Algorithm Prefix Metric",
"type": 1044,
"length": 8,
"data": {
"flexAlgo": 130,
"flags": "0b10000000",
"metric": 1000
}
},
"1121": {
"description": "Graceful-Link-Shutdown TLV",
"type": 1121,
"length": 0
},
"1171": {
"description": "Source Router Identifier",
"type": 1171,
"length": 16,
"data": "12:12::12:12"
},
"1871": {
"type": 1871,
"length": 13,
"data": "0x00120012000000000000000000"
}
},
"Node ISIS-L1 ID:0x20 {Local {AS:65001 ID:0 Rtr:0000.0000.1003.00}}/XX": {
"263": {
"description": "Multi-Topology ID",
"type": 263,
"length": 4,
"data": [
0,
2
]
},
"266": {
"description": "Node MSD",
"type": 266,
"length": 2,
"data": [
{
"type": 1,
"value": 8
}
]
},
"1026": {
"description": "Node Name",
"type": 1026,
"length": 2,
"data": "r3"
},
"1027": {
"description": "IS-IS Area Identifier",
"type": 1027,
"length": 3,
"data": "49.1000"
},
"1028": {
"description": "IPv4 Router-ID of Local Node",
"type": 1028,
"length": 4,
"data": "3.3.3.3"
},
"1034": {
"description": "SR Capabilities",
"type": 1034,
"length": 12,
"data": {
"flags": "0b11000000",
"range": 4000,
"1161": {
"description": "SID/Label",
"type": 1161,
"length": 3,
"data": {
"fromLabel": 20000
}
}
}
},
"1035": {
"description": "SR Algorithm",
"type": 1035,
"length": 3,
"data": [
0,
128,
130
]
},
"1036": {
"description": "SR Local Block",
"type": 1036,
"length": 12,
"data": {
"flags": "0b00000000",
"range": 1000,
"1161": {
"description": "SID/Label",
"type": 1161,
"length": 3,
"data": {
"fromLabel": 15000
}
}
}
}
},
"Link ISIS-L1 ID:0x20 {Local {AS:65001 ID:0 Rtr:0000.0000.1001} Remote {AS:65001 ID:0 Rtr:0000.0000.1000} IPv4:10.1.0.1 Neigh-IPv4:10.1.0.2 IPv6:2001::1 Neigh-IPv6:2001::2 MT:0,2}/XX": {
"1028": {
"description": "IPv4 Router-ID of Local Node",
"type": 1028,
"length": 4,
"data": "1.1.1.1"
},
"1030": {
"description": "IPv4 Router-ID of Remote Node",
"type": 1030,
"length": 4,
"data": "10.10.10.10"
},
"1089": {
"description": "Maximum link bandwidth",
"type": 1089,
"length": 4,
"data": 176258176,
"dataUnit": "bps"
},
"1090": {
"description": "Max. reservable link bandwidth",
"type": 1090,
"length": 4,
"data": 176258176,
"dataUnit": "bps"
},
"1091": {
"description": "Unreserved bandwidth",
"type": 1091,
"length": 32,
"dataUnit": "bps",
"data": {
"0": 176258176,
"1": 176258176,
"2": 176258176,
"3": 176258176,
"4": 176258176,
"5": 176258176,
"6": 176258176,
"7": 176258176
}
},
"1092": {
"description": "TE Default Metric",
"type": 1092,
"length": 4,
"data": 100
},
"1095": {
"description": "IGP Metric",
"type": 1095,
"length": 3,
"data": 10
},
"1099": {
"description": "Adjacency SID",
"type": 1099,
"length": 7,
"data": {
"flags": "0b00110000",
"weight": 0,
"sid": 15000
}
},
"1114": {
"description": "Unidirectional Link Delay",
"type": 1114,
"length": 4,
"data": {
"anomalous": false,
"delay": 8500
},
"dataUnit": "microseconds"
},
"1115": {
"description": "Min/Max Unidirectional Link Delay",
"type": 1115,
"length": 8,
"data": {
"anomalous": false,
"minDelay": 8000,
"maxDelay": 9000
},
"dataUnit": "microseconds"
},
"1122": {
"description": "Application-Specific Link Attributes",
"type": 1122,
"length": 48,
"data": {
"sabmFlags": "0b00010000 00000000 00000000 00000000",
"udabmFlags": "0b00000000 00000000 00000000 00000000",
"1088": {
"description": "Administrative group",
"type": 1088,
"length": 4,
"data": "0x00000001"
},
"1092": {
"description": "TE Default Metric",
"type": 1092,
"length": 4,
"data": 100
},
"1115": {
"description": "Min/Max Unidirectional Link Delay",
"type": 1115,
"length": 8,
"data": {
"anomalous": false,
"minDelay": 8000,
"maxDelay": 9000
},
"dataUnit": "microseconds"
},
"1173": {
"description": "Extended Administrative Group",
"type": 1173,
"length": 4,
"data": "0x00000001"
}
}
}
}
}

View File

@ -1,2 +0,0 @@
ip route 192.0.2.1/32 192.168.1.1
ip route 192.0.2.3/32 192.168.2.3

View File

@ -1,11 +0,0 @@
!
int lo
ip address 192.0.2.2/32
!
interface r2-eth0
ip address 192.168.1.2/24
!
interface r2-eth1
ip address 192.168.2.2/24
!

View File

@ -1,14 +0,0 @@
router bgp 65003
no bgp ebgp-requires-policy
neighbor 192.0.2.2 remote-as 65002
neighbor 192.0.2.2 timers 1 3
neighbor 192.0.2.2 timers connect 1
neighbor 192.0.2.2 ebgp-multihop 3
neighbor 192.0.2.2 update-source 192.0.2.3
address-family ipv4 unicast
no neighbor 192.0.2.2 activate
exit-address-family
address-family link-state link-state
neighbor 192.0.2.2 activate
exit-address-family
!

View File

@ -1 +0,0 @@
../r2/linkstate.json

View File

@ -1 +0,0 @@
../r2/linkstate_detail.json

View File

@ -1 +0,0 @@
ip route 192.0.2.2/32 192.168.2.2

View File

@ -1,7 +0,0 @@
!
int lo
ip address 192.0.2.3/32
!
interface r3-eth0
ip address 192.168.2.3/24
!

View File

@ -1,143 +0,0 @@
#!/usr/bin/env python
# SPDX-License-Identifier: ISC
# Copyright 2023 6WIND S.A.
import os
import sys
import json
import pytest
import functools
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
# pylint: disable=C0413
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import step
from lib.topolog import logger
pytestmark = [pytest.mark.bgpd]
def build_topo(tgen):
for routern in range(1, 4):
tgen.add_router("r{}".format(routern))
switch = tgen.add_switch("s1")
switch.add_link(tgen.gears["r1"])
switch.add_link(tgen.gears["r2"])
switch = tgen.add_switch("s2")
switch.add_link(tgen.gears["r2"])
switch.add_link(tgen.gears["r3"])
def setup_module(mod):
tgen = Topogen(build_topo, mod.__name__)
tgen.start_topology()
router_list = tgen.routers()
for i, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
router.load_config(
TopoRouter.RD_STATIC, os.path.join(CWD, "{}/staticd.conf".format(rname))
)
if rname == "r1":
# use bgp_injector.py to inject BGP prefixes
continue
router.load_config(
TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
)
tgen.start_router()
r1_path = os.path.join(CWD, "r1")
log_dir = os.path.join(tgen.logdir, "r1")
tgen.gears["r1"].cmd("chmod u+x {}/bgp_injector.py".format(r1_path))
tgen.gears["r1"].run("{}/bgp_injector.py {}".format(r1_path, log_dir))
def teardown_module(mod):
tgen = get_topogen()
log_dir = os.path.join(tgen.logdir, "r1")
pid_file = os.path.join(log_dir, "bgp_injector.pid")
logger.info("r1: sending SIGTERM to bgp_injector")
tgen.gears["r1"].cmd("kill $(cat {})".format(pid_file))
tgen.stop_topology()
def test_show_bgp_link_state():
tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
def _remove_prefixlen(tmp_json):
new_json = {
prefix.split("}/")[0] + "}/XX": data
for prefix, data in tmp_json["routes"].items()
}
return new_json
def _show_bgp_link_state_json(rname, tmp_expected):
tmp_output = json.loads(
tgen.gears[rname].vtysh_cmd("show bgp link-state link-state json")
)
# prefix length is the size of prefix in memory
# which differs on 32 and 64 bits.
# do not compare the prefix length
output = _remove_prefixlen(tmp_output)
expected = _remove_prefixlen(tmp_expected)
return topotest.json_cmp(output, expected)
step("Check BGP Link-State tables")
for rname in ["r2", "r3"]:
expected = open(os.path.join(CWD, "{}/linkstate.json".format(rname))).read()
expected_json = json.loads(expected)
test_func = functools.partial(_show_bgp_link_state_json, rname, expected_json)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Failed to see BGP prefixes on {}".format(rname)
def test_show_bgp_link_state_detail():
tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
def _show_bgp_link_state_json(rname, expected):
output = json.loads(
tgen.gears[rname].vtysh_cmd("show bgp link-state link-state detail-routes json")
)
json_output = {
prefix.split("/")[0] + "/XX": item["linkStateAttributes"]
for prefix, data in output["routes"].items()
for item in data
if "linkStateAttributes" in item
}
return topotest.json_cmp(json_output, expected)
step("Check BGP Link-State Attributes tables")
for rname in ["r2", "r3"]:
expected = open(
os.path.join(CWD, "{}/linkstate_detail.json".format(rname))
).read()
expected_json = json.loads(expected)
test_func = functools.partial(_show_bgp_link_state_json, rname, expected_json)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Failed to display BGP-LS Attributes on {}".format(rname)
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))

View File

@ -1447,13 +1447,6 @@ static struct cmd_node bgp_ipv6l_node = {
.no_xpath = true, .no_xpath = true,
}; };
static struct cmd_node bgp_ls_node = {
.name = "bgp link-state",
.node = BGP_LS_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af-ls)# ",
};
#ifdef ENABLE_BGP_VNC #ifdef ENABLE_BGP_VNC
static struct cmd_node bgp_vnc_defaults_node = { static struct cmd_node bgp_vnc_defaults_node = {
.name = "bgp vnc defaults", .name = "bgp vnc defaults",
@ -1765,14 +1758,6 @@ DEFUNSH(VTYSH_BGPD, address_family_flowspecv6, address_family_flowspecv6_cmd,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUNSH(VTYSH_BGPD, address_family_linkstate, address_family_linkstate_cmd,
"address-family link-state link-state",
"Enter Address Family command mode\n" BGP_AF_STR BGP_AF_MODIFIER_STR)
{
vty->node = BGP_LS_NODE;
return CMD_SUCCESS;
}
DEFUNSH(VTYSH_BGPD, address_family_ipv4_multicast, DEFUNSH(VTYSH_BGPD, address_family_ipv4_multicast,
address_family_ipv4_multicast_cmd, "address-family ipv4 multicast", address_family_ipv4_multicast_cmd, "address-family ipv4 multicast",
"Enter Address Family command mode\n" "Enter Address Family command mode\n"
@ -2446,8 +2431,7 @@ DEFUNSH(VTYSH_BGPD, exit_address_family, exit_address_family_cmd,
|| vty->node == BGP_IPV6L_NODE || vty->node == BGP_IPV6M_NODE || vty->node == BGP_IPV6L_NODE || vty->node == BGP_IPV6M_NODE
|| vty->node == BGP_EVPN_NODE || vty->node == BGP_EVPN_NODE
|| vty->node == BGP_FLOWSPECV4_NODE || vty->node == BGP_FLOWSPECV4_NODE
|| vty->node == BGP_FLOWSPECV6_NODE || vty->node == BGP_FLOWSPECV6_NODE)
|| vty->node == BGP_LS_NODE)
vty->node = BGP_NODE; vty->node = BGP_NODE;
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -4698,13 +4682,6 @@ void vtysh_init_vty(void)
install_element(BGP_EVPN_VNI_NODE, &vtysh_end_all_cmd); install_element(BGP_EVPN_VNI_NODE, &vtysh_end_all_cmd);
install_element(BGP_EVPN_VNI_NODE, &exit_vni_cmd); install_element(BGP_EVPN_VNI_NODE, &exit_vni_cmd);
install_node(&bgp_ls_node);
install_element(BGP_NODE, &address_family_linkstate_cmd);
install_element(BGP_LS_NODE, &vtysh_exit_bgpd_cmd);
install_element(BGP_LS_NODE, &vtysh_quit_bgpd_cmd);
install_element(BGP_LS_NODE, &vtysh_end_all_cmd);
install_element(BGP_LS_NODE, &exit_address_family_cmd);
install_node(&rpki_node); install_node(&rpki_node);
install_element(CONFIG_NODE, &rpki_cmd); install_element(CONFIG_NODE, &rpki_cmd);
install_element(RPKI_NODE, &rpki_exit_cmd); install_element(RPKI_NODE, &rpki_exit_cmd);

View File

@ -204,15 +204,5 @@ submodule frr-bgp-common-multiprotocol {
description description
"IPv6 flowspec configuration options."; "IPv6 flowspec configuration options.";
} }
container linkstate-linkstate {
when "derived-from-or-self(../afi-safi-name, 'frr-rt:linkstate-linkstate')" {
description
"Include this container for Link-State specific
configuration.";
}
description
"Link-State configuration options.";
}
} }
} }

View File

@ -819,17 +819,6 @@ module frr-bgp {
uses structure-neighbor-group-filter-config; uses structure-neighbor-group-filter-config;
} }
augment "/frr-rt:routing/frr-rt:control-plane-protocols/frr-rt:control-plane-protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/linkstate-linkstate" {
uses structure-neighbor-route-reflector;
uses structure-neighbor-route-server;
uses structure-neighbor-group-soft-reconfiguration;
uses structure-neighbor-group-filter-config;
}
augment "/frr-rt:routing/frr-rt:control-plane-protocols/frr-rt:control-plane-protocol/bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast" { augment "/frr-rt:routing/frr-rt:control-plane-protocols/frr-rt:control-plane-protocol/bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast" {
uses structure-neighbor-group-add-paths; uses structure-neighbor-group-add-paths;
@ -1101,16 +1090,6 @@ module frr-bgp {
uses structure-neighbor-group-filter-config; uses structure-neighbor-group-filter-config;
} }
augment "/frr-rt:routing/frr-rt:control-plane-protocols/frr-rt:control-plane-protocol/bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/linkstate-linkstate" {
uses structure-neighbor-route-reflector;
uses structure-neighbor-route-server;
uses structure-neighbor-group-soft-reconfiguration;
uses structure-neighbor-group-filter-config;
}
augment "/frr-rt:routing/frr-rt:control-plane-protocols/frr-rt:control-plane-protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast" { augment "/frr-rt:routing/frr-rt:control-plane-protocols/frr-rt:control-plane-protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast" {
uses structure-neighbor-group-add-paths; uses structure-neighbor-group-add-paths;
@ -1387,14 +1366,4 @@ module frr-bgp {
uses structure-neighbor-group-filter-config; uses structure-neighbor-group-filter-config;
} }
augment "/frr-rt:routing/frr-rt:control-plane-protocols/frr-rt:control-plane-protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/linkstate-linkstate" {
uses structure-neighbor-route-reflector;
uses structure-neighbor-route-server;
uses structure-neighbor-group-soft-reconfiguration;
uses structure-neighbor-group-filter-config;
}
} }

View File

@ -172,13 +172,6 @@ module frr-routing {
} }
identity linkstate-linkstate {
base afi-safi-type;
description
"This identity represents the link-state address family.";
}
identity control-plane-protocol { identity control-plane-protocol {
description description
"Base identity from which control-plane protocol identities are "Base identity from which control-plane protocol identities are

View File

@ -234,7 +234,6 @@ void connected_up(struct interface *ifp, struct connected *ifc)
break; break;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_L2VPN: case AFI_L2VPN:
case AFI_LINKSTATE:
case AFI_MAX: case AFI_MAX:
flog_warn(EC_ZEBRA_CONNECTED_AFI_UNKNOWN, flog_warn(EC_ZEBRA_CONNECTED_AFI_UNKNOWN,
"Received unknown AFI: %s", afi2str(afi)); "Received unknown AFI: %s", afi2str(afi));
@ -425,7 +424,6 @@ void connected_down(struct interface *ifp, struct connected *ifc)
break; break;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_L2VPN: case AFI_L2VPN:
case AFI_LINKSTATE:
case AFI_MAX: case AFI_MAX:
zlog_warn("Unknown AFI: %s", afi2str(afi)); zlog_warn("Unknown AFI: %s", afi2str(afi));
break; break;

View File

@ -102,7 +102,6 @@ int router_id_get(afi_t afi, struct prefix *p, struct zebra_vrf *zvrf)
return 0; return 0;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_L2VPN: case AFI_L2VPN:
case AFI_LINKSTATE:
case AFI_MAX: case AFI_MAX:
return -1; return -1;
} }
@ -127,7 +126,6 @@ static int router_id_set(afi_t afi, struct prefix *p, struct zebra_vrf *zvrf)
break; break;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_L2VPN: case AFI_L2VPN:
case AFI_LINKSTATE:
case AFI_MAX: case AFI_MAX:
return -1; return -1;
} }

View File

@ -544,7 +544,6 @@ int zsend_redistribute_route(int cmd, struct zserv *client,
client->redist_v6_del_cnt++; client->redist_v6_del_cnt++;
break; break;
case AFI_L2VPN: case AFI_L2VPN:
case AFI_LINKSTATE:
case AFI_MAX: case AFI_MAX:
case AFI_UNSPEC: case AFI_UNSPEC:
break; break;

View File

@ -2288,7 +2288,6 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe,
break; break;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_L2VPN: case AFI_L2VPN:
case AFI_LINKSTATE:
case AFI_MAX: case AFI_MAX:
flog_err(EC_LIB_DEVELOPMENT, flog_err(EC_LIB_DEVELOPMENT,
"%s: unknown address-family: %u", __func__, "%s: unknown address-family: %u", __func__,
@ -2332,7 +2331,6 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe,
break; break;
case AFI_UNSPEC: case AFI_UNSPEC:
case AFI_L2VPN: case AFI_L2VPN:
case AFI_LINKSTATE:
case AFI_MAX: case AFI_MAX:
assert(afi != AFI_IP && afi != AFI_IP6); assert(afi != AFI_IP && afi != AFI_IP6);
break; break;