2024-11-21 05:29:52 -08:00
|
|
|
/* $OpenBSD: bgpd.h,v 1.500 2024/11/21 13:29:52 claudio Exp $ */
|
2003-12-17 03:46:54 -08:00
|
|
|
|
|
|
|
/*
|
2004-01-05 19:43:50 -08:00
|
|
|
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
2003-12-17 03:46:54 -08:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
#ifndef __BGPD_H__
|
2003-12-25 09:07:24 -08:00
|
|
|
#define __BGPD_H__
|
2003-12-17 03:46:54 -08:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
2004-01-17 10:27:19 -08:00
|
|
|
#include <sys/socket.h>
|
2003-12-17 03:46:54 -08:00
|
|
|
#include <sys/queue.h>
|
2010-05-19 05:44:14 -07:00
|
|
|
#include <sys/tree.h>
|
2003-12-17 03:46:54 -08:00
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
2004-01-17 10:27:19 -08:00
|
|
|
#include <net/if.h>
|
2003-12-17 03:46:54 -08:00
|
|
|
|
2004-01-01 15:46:47 -08:00
|
|
|
#include <poll.h>
|
2003-12-17 03:46:54 -08:00
|
|
|
#include <stdarg.h>
|
2022-02-06 01:51:19 -08:00
|
|
|
#include <stdint.h>
|
2003-12-17 03:46:54 -08:00
|
|
|
|
2009-06-06 11:31:42 -07:00
|
|
|
#include <imsg.h>
|
2009-06-05 23:33:15 -07:00
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
#define BGP_VERSION 4
|
2024-08-12 02:04:23 -07:00
|
|
|
#define RTR_MAX_VERSION 2
|
|
|
|
#define RTR_DEFAULT_VERSION 1
|
2003-12-17 03:46:54 -08:00
|
|
|
#define BGP_PORT 179
|
2022-02-23 03:20:35 -08:00
|
|
|
#define RTR_PORT 323
|
2003-12-25 09:07:24 -08:00
|
|
|
#define CONFFILE "/etc/bgpd.conf"
|
2003-12-17 03:46:54 -08:00
|
|
|
#define BGPD_USER "_bgpd"
|
2024-03-18 03:49:24 -07:00
|
|
|
#define PEER_DESCR_LEN 64
|
2020-05-10 06:38:46 -07:00
|
|
|
#define REASON_LEN 256 /* includes NUL terminator */
|
2013-01-09 00:04:25 -08:00
|
|
|
#define PFTABLE_LEN 32
|
2022-09-23 08:50:41 -07:00
|
|
|
#define ROUTELABEL_LEN 32
|
2004-01-28 15:31:28 -08:00
|
|
|
#define TCP_MD5_KEY_LEN 80
|
2004-04-25 18:59:26 -07:00
|
|
|
#define IPSEC_ENC_KEY_LEN 32
|
2004-07-05 09:54:53 -07:00
|
|
|
#define IPSEC_AUTH_KEY_LEN 20
|
2019-05-03 08:20:29 -07:00
|
|
|
#define SET_NAME_LEN 128
|
2003-12-17 03:46:54 -08:00
|
|
|
|
|
|
|
#define MAX_PKTSIZE 4096
|
|
|
|
#define MIN_HOLDTIME 3
|
2003-12-24 15:14:23 -08:00
|
|
|
#define READ_BUF_SIZE 65535
|
2019-07-19 00:40:41 -07:00
|
|
|
#define MAX_SOCK_BUF (4 * READ_BUF_SIZE)
|
2003-12-25 09:07:24 -08:00
|
|
|
#define RT_BUF_SIZE 16384
|
2018-02-07 16:16:18 -08:00
|
|
|
#define MAX_RTSOCK_BUF (2 * 1024 * 1024)
|
2018-11-28 00:32:26 -08:00
|
|
|
#define MAX_COMM_MATCH 3
|
2024-04-09 05:09:19 -07:00
|
|
|
#define MAX_ASPA_SPAS_COUNT 10000
|
2003-12-17 03:46:54 -08:00
|
|
|
|
2003-12-25 09:07:24 -08:00
|
|
|
#define BGPD_OPT_VERBOSE 0x0001
|
|
|
|
#define BGPD_OPT_VERBOSE2 0x0002
|
|
|
|
#define BGPD_OPT_NOACTION 0x0004
|
2006-06-17 07:06:09 -07:00
|
|
|
#define BGPD_OPT_FORCE_DEMOTE 0x0008
|
2003-12-17 03:46:54 -08:00
|
|
|
|
2004-05-21 08:36:40 -07:00
|
|
|
#define BGPD_FLAG_REFLECTOR 0x0004
|
2019-08-07 03:26:41 -07:00
|
|
|
#define BGPD_FLAG_NEXTHOP_BGP 0x0010
|
|
|
|
#define BGPD_FLAG_NEXTHOP_DEFAULT 0x0020
|
2004-11-11 02:35:15 -08:00
|
|
|
#define BGPD_FLAG_DECISION_MASK 0x0f00
|
|
|
|
#define BGPD_FLAG_DECISION_ROUTEAGE 0x0100
|
2005-03-11 04:54:19 -08:00
|
|
|
#define BGPD_FLAG_DECISION_TRANS_AS 0x0200
|
2005-08-09 13:27:25 -07:00
|
|
|
#define BGPD_FLAG_DECISION_MED_ALWAYS 0x0400
|
2021-03-02 01:45:07 -08:00
|
|
|
#define BGPD_FLAG_DECISION_ALL_PATHS 0x0800
|
|
|
|
#define BGPD_FLAG_NO_AS_SET 0x1000
|
2003-12-24 05:49:21 -08:00
|
|
|
|
2004-07-05 09:54:53 -07:00
|
|
|
#define BGPD_LOG_UPDATES 0x0001
|
2003-12-26 12:52:14 -08:00
|
|
|
|
2004-01-01 18:27:57 -08:00
|
|
|
#define SOCKET_NAME "/var/run/bgpd.sock"
|
|
|
|
|
2022-06-15 03:10:03 -07:00
|
|
|
#define F_BGPD 0x0001
|
2022-07-27 10:23:17 -07:00
|
|
|
#define F_BGPD_INSERTED 0x0002
|
2004-07-05 09:54:53 -07:00
|
|
|
#define F_CONNECTED 0x0004
|
2022-07-28 03:41:18 -07:00
|
|
|
#define F_STATIC 0x0008
|
|
|
|
#define F_NEXTHOP 0x0010
|
|
|
|
#define F_REJECT 0x0020
|
|
|
|
#define F_BLACKHOLE 0x0040
|
|
|
|
#define F_MPLS 0x0080
|
2005-06-24 07:01:52 -07:00
|
|
|
#define F_LONGER 0x0200
|
2019-09-27 03:33:06 -07:00
|
|
|
#define F_SHORTER 0x0400
|
2023-03-13 09:52:41 -07:00
|
|
|
#define F_CTL_DETAIL 0x1000 /* only set on requests */
|
|
|
|
#define F_CTL_ADJ_IN 0x2000 /* only set on requests */
|
|
|
|
#define F_CTL_ADJ_OUT 0x4000 /* only set on requests */
|
2022-03-21 03:15:34 -07:00
|
|
|
#define F_CTL_BEST 0x8000
|
2023-03-13 09:52:41 -07:00
|
|
|
#define F_CTL_INELIGIBLE 0x10000 /* only set on requests */
|
|
|
|
#define F_CTL_LEAKED 0x20000 /* only set on requests */
|
|
|
|
#define F_CTL_INVALID 0x40000 /* only set on requests */
|
2018-10-03 04:36:39 -07:00
|
|
|
#define F_CTL_OVS_VALID 0x80000
|
|
|
|
#define F_CTL_OVS_INVALID 0x100000
|
|
|
|
#define F_CTL_OVS_NOTFOUND 0x200000
|
2023-03-13 09:52:41 -07:00
|
|
|
#define F_CTL_NEIGHBORS 0x400000 /* only used by bgpctl */
|
|
|
|
#define F_CTL_HAS_PATHID 0x800000 /* only set on requests */
|
2023-01-24 06:13:11 -08:00
|
|
|
#define F_CTL_AVS_VALID 0x1000000
|
|
|
|
#define F_CTL_AVS_INVALID 0x2000000
|
|
|
|
#define F_CTL_AVS_UNKNOWN 0x4000000
|
2024-08-14 12:09:51 -07:00
|
|
|
#define F_CTL_FILTERED 0x8000000 /* only set on requests */
|
2023-03-13 09:52:41 -07:00
|
|
|
#define F_CTL_SSV 0x80000000 /* only used by bgpctl */
|
2004-01-09 05:47:07 -08:00
|
|
|
|
2021-06-17 09:05:25 -07:00
|
|
|
#define CTASSERT(x) extern char _ctassert[(x) ? 1 : -1 ] \
|
|
|
|
__attribute__((__unused__))
|
|
|
|
|
2018-10-01 16:09:53 -07:00
|
|
|
/*
|
|
|
|
* Note that these numeric assignments differ from the numbers commonly
|
|
|
|
* used in route origin validation context.
|
|
|
|
*/
|
|
|
|
#define ROA_NOTFOUND 0x0 /* default */
|
|
|
|
#define ROA_INVALID 0x1
|
|
|
|
#define ROA_VALID 0x2
|
|
|
|
#define ROA_MASK 0x3
|
|
|
|
|
2023-01-11 05:53:17 -08:00
|
|
|
#define ASPA_UNKNOWN 0x00 /* default */
|
|
|
|
#define ASPA_INVALID 0x01
|
|
|
|
#define ASPA_VALID 0x02
|
|
|
|
#define ASPA_MASK 0x03
|
|
|
|
#define ASPA_NEVER_KNOWN 0x08 /* unknown and check never needed */
|
|
|
|
|
2007-01-26 09:40:48 -08:00
|
|
|
/*
|
2017-05-28 05:21:36 -07:00
|
|
|
* Limit the number of messages queued in the session engine.
|
|
|
|
* The SE will send an IMSG_XOFF messages to the RDE if the high water mark
|
|
|
|
* is reached. The RDE should then throttle this peer or control connection.
|
|
|
|
* Once the message queue in the SE drops below the low water mark an
|
|
|
|
* IMSG_XON message will be sent and the RDE will produce more messages again.
|
2007-01-26 09:40:48 -08:00
|
|
|
*/
|
|
|
|
#define RDE_RUNNER_ROUNDS 100
|
2019-07-19 00:40:41 -07:00
|
|
|
#define SESS_MSG_HIGH_MARK 2000
|
|
|
|
#define SESS_MSG_LOW_MARK 500
|
2017-05-28 05:21:36 -07:00
|
|
|
#define CTL_MSG_HIGH_MARK 500
|
|
|
|
#define CTL_MSG_LOW_MARK 100
|
2007-01-26 09:40:48 -08:00
|
|
|
|
2015-07-20 09:10:37 -07:00
|
|
|
enum bgpd_process {
|
2003-12-20 10:32:22 -08:00
|
|
|
PROC_MAIN,
|
|
|
|
PROC_SE,
|
2021-02-16 00:29:16 -08:00
|
|
|
PROC_RDE,
|
|
|
|
PROC_RTR,
|
2020-11-05 03:52:59 -08:00
|
|
|
};
|
2003-12-20 10:32:22 -08:00
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
enum reconf_action {
|
|
|
|
RECONF_NONE,
|
|
|
|
RECONF_KEEP,
|
|
|
|
RECONF_REINIT,
|
2013-08-14 13:34:25 -07:00
|
|
|
RECONF_RELOAD,
|
2003-12-17 03:46:54 -08:00
|
|
|
RECONF_DELETE
|
|
|
|
};
|
|
|
|
|
2009-12-08 06:03:40 -08:00
|
|
|
/* Address Family Numbers as per RFC 1700 */
|
|
|
|
#define AFI_UNSPEC 0
|
|
|
|
#define AFI_IPv4 1
|
|
|
|
#define AFI_IPv6 2
|
|
|
|
|
|
|
|
/* Subsequent Address Family Identifier as per RFC 4760 */
|
2023-04-03 03:48:00 -07:00
|
|
|
#define SAFI_NONE 0
|
|
|
|
#define SAFI_UNICAST 1
|
|
|
|
#define SAFI_MULTICAST 2
|
|
|
|
#define SAFI_MPLS 4
|
|
|
|
#define SAFI_MPLSVPN 128
|
|
|
|
#define SAFI_FLOWSPEC 133
|
|
|
|
#define SAFI_VPNFLOWSPEC 134
|
2009-12-08 06:03:40 -08:00
|
|
|
|
|
|
|
struct aid {
|
2022-02-06 01:51:19 -08:00
|
|
|
uint16_t afi;
|
2009-12-08 06:03:40 -08:00
|
|
|
sa_family_t af;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t safi;
|
2023-03-29 07:35:38 -07:00
|
|
|
const char *name;
|
2009-12-08 06:03:40 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct aid aid_vals[];
|
|
|
|
|
|
|
|
#define AID_UNSPEC 0
|
|
|
|
#define AID_INET 1
|
|
|
|
#define AID_INET6 2
|
2010-01-12 22:02:37 -08:00
|
|
|
#define AID_VPN_IPv4 3
|
2018-12-30 05:53:07 -08:00
|
|
|
#define AID_VPN_IPv6 4
|
2023-04-03 03:48:00 -07:00
|
|
|
#define AID_FLOWSPECv4 5
|
|
|
|
#define AID_FLOWSPECv6 6
|
|
|
|
#define AID_MAX 7
|
2012-09-11 22:56:22 -07:00
|
|
|
#define AID_MIN 1 /* skip AID_UNSPEC since that is a dummy */
|
2009-12-08 06:03:40 -08:00
|
|
|
|
|
|
|
#define AID_VALS { \
|
|
|
|
/* afi, af, safii, name */ \
|
|
|
|
{ AFI_UNSPEC, AF_UNSPEC, SAFI_NONE, "unspec"}, \
|
|
|
|
{ AFI_IPv4, AF_INET, SAFI_UNICAST, "IPv4 unicast" }, \
|
2010-01-12 22:02:37 -08:00
|
|
|
{ AFI_IPv6, AF_INET6, SAFI_UNICAST, "IPv6 unicast" }, \
|
2018-12-30 05:53:07 -08:00
|
|
|
{ AFI_IPv4, AF_INET, SAFI_MPLSVPN, "IPv4 vpn" }, \
|
2023-04-03 03:48:00 -07:00
|
|
|
{ AFI_IPv6, AF_INET6, SAFI_MPLSVPN, "IPv6 vpn" }, \
|
|
|
|
{ AFI_IPv4, AF_INET, SAFI_FLOWSPEC, "IPv4 flowspec" }, \
|
|
|
|
{ AFI_IPv6, AF_INET6, SAFI_FLOWSPEC, "IPv6 flowspec" }, \
|
2009-12-08 06:03:40 -08:00
|
|
|
}
|
|
|
|
|
2010-01-12 22:02:37 -08:00
|
|
|
#define BGP_MPLS_BOS 0x01
|
|
|
|
|
2004-01-04 10:51:23 -08:00
|
|
|
struct bgpd_addr {
|
|
|
|
union {
|
|
|
|
struct in_addr v4;
|
|
|
|
struct in6_addr v6;
|
2010-01-12 22:02:37 -08:00
|
|
|
/* maximum size for a prefix is 256 bits */
|
2024-02-13 08:35:43 -08:00
|
|
|
}; /* 128-bit address */
|
2022-02-06 01:51:19 -08:00
|
|
|
uint64_t rd; /* route distinguisher for VPN addrs */
|
|
|
|
uint32_t scope_id; /* iface scope id for v6 */
|
|
|
|
uint8_t aid;
|
|
|
|
uint8_t labellen; /* size of the labelstack */
|
|
|
|
uint8_t labelstack[18]; /* max that makes sense */
|
2004-01-04 10:51:23 -08:00
|
|
|
};
|
|
|
|
|
2004-07-05 09:54:53 -07:00
|
|
|
#define DEFAULT_LISTENER 0x01
|
|
|
|
#define LISTENER_LISTENING 0x02
|
2004-06-06 10:38:10 -07:00
|
|
|
|
|
|
|
struct listen_addr {
|
2019-02-18 01:43:57 -08:00
|
|
|
TAILQ_ENTRY(listen_addr) entry;
|
|
|
|
struct sockaddr_storage sa;
|
|
|
|
int fd;
|
|
|
|
enum reconf_action reconf;
|
|
|
|
socklen_t sa_len;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t flags;
|
2004-06-06 10:38:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
TAILQ_HEAD(listen_addrs, listen_addr);
|
2005-07-01 06:38:14 -07:00
|
|
|
TAILQ_HEAD(filter_set_head, filter_set);
|
2004-06-06 10:38:10 -07:00
|
|
|
|
2019-03-31 09:57:38 -07:00
|
|
|
struct peer;
|
2019-05-27 02:14:32 -07:00
|
|
|
RB_HEAD(peer_head, peer);
|
2019-03-31 09:57:38 -07:00
|
|
|
|
2019-02-11 07:44:25 -08:00
|
|
|
struct l3vpn;
|
|
|
|
SIMPLEQ_HEAD(l3vpn_head, l3vpn);
|
2015-07-16 11:26:04 -07:00
|
|
|
|
|
|
|
struct network;
|
|
|
|
TAILQ_HEAD(network_head, network);
|
|
|
|
|
2023-04-18 05:11:27 -07:00
|
|
|
struct flowspec_config;
|
|
|
|
RB_HEAD(flowspec_tree, flowspec_config);
|
|
|
|
|
2018-02-09 17:24:28 -08:00
|
|
|
struct prefixset;
|
|
|
|
SIMPLEQ_HEAD(prefixset_head, prefixset);
|
2018-09-29 01:11:11 -07:00
|
|
|
struct prefixset_item;
|
|
|
|
RB_HEAD(prefixset_tree, prefixset_item);
|
|
|
|
|
|
|
|
struct tentry_v4;
|
|
|
|
struct tentry_v6;
|
|
|
|
struct trie_head {
|
|
|
|
struct tentry_v4 *root_v4;
|
|
|
|
struct tentry_v6 *root_v6;
|
|
|
|
int match_default_v4;
|
|
|
|
int match_default_v6;
|
2020-12-29 23:29:56 -08:00
|
|
|
size_t v4_cnt;
|
|
|
|
size_t v6_cnt;
|
2018-09-29 01:11:11 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct rde_prefixset {
|
|
|
|
char name[SET_NAME_LEN];
|
|
|
|
struct trie_head th;
|
|
|
|
SIMPLEQ_ENTRY(rde_prefixset) entry;
|
2020-12-29 23:29:56 -08:00
|
|
|
time_t lastchange;
|
2018-09-29 01:11:11 -07:00
|
|
|
int dirty;
|
|
|
|
};
|
|
|
|
SIMPLEQ_HEAD(rde_prefixset_head, rde_prefixset);
|
2018-02-09 17:24:28 -08:00
|
|
|
|
2020-12-29 07:30:34 -08:00
|
|
|
struct roa {
|
|
|
|
RB_ENTRY(roa) entry;
|
|
|
|
uint8_t aid;
|
|
|
|
uint8_t prefixlen;
|
|
|
|
uint8_t maxlen;
|
|
|
|
uint8_t pad;
|
|
|
|
uint32_t asnum;
|
2021-09-01 05:39:52 -07:00
|
|
|
time_t expires;
|
2020-12-29 07:30:34 -08:00
|
|
|
union {
|
|
|
|
struct in_addr inet;
|
|
|
|
struct in6_addr inet6;
|
|
|
|
} prefix;
|
|
|
|
};
|
|
|
|
|
|
|
|
RB_HEAD(roa_tree, roa);
|
2023-04-18 05:11:27 -07:00
|
|
|
struct aspa_set;
|
2022-11-18 02:17:23 -08:00
|
|
|
RB_HEAD(aspa_tree, aspa_set);
|
2020-12-29 07:30:34 -08:00
|
|
|
|
2018-09-20 04:45:59 -07:00
|
|
|
struct set_table;
|
2018-09-06 22:43:33 -07:00
|
|
|
struct as_set;
|
|
|
|
SIMPLEQ_HEAD(as_set_head, as_set);
|
|
|
|
|
2015-07-16 11:26:04 -07:00
|
|
|
struct filter_rule;
|
|
|
|
TAILQ_HEAD(filter_head, filter_rule);
|
|
|
|
|
2021-02-16 00:29:16 -08:00
|
|
|
struct rtr_config;
|
|
|
|
SIMPLEQ_HEAD(rtr_config_head, rtr_config);
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
struct bgpd_config {
|
2019-03-31 09:57:38 -07:00
|
|
|
struct peer_head peers;
|
2019-02-11 07:44:25 -08:00
|
|
|
struct l3vpn_head l3vpns;
|
2015-07-16 11:26:04 -07:00
|
|
|
struct network_head networks;
|
2023-04-18 05:11:27 -07:00
|
|
|
struct flowspec_tree flowspecs;
|
2015-07-16 11:26:04 -07:00
|
|
|
struct filter_head *filters;
|
2004-12-23 07:08:43 -08:00
|
|
|
struct listen_addrs *listen_addrs;
|
2015-07-16 11:26:04 -07:00
|
|
|
struct mrt_head *mrt;
|
2018-09-29 01:11:11 -07:00
|
|
|
struct prefixset_head prefixsets;
|
|
|
|
struct prefixset_head originsets;
|
2020-12-29 07:30:34 -08:00
|
|
|
struct roa_tree roa;
|
2022-11-18 02:17:23 -08:00
|
|
|
struct aspa_tree aspa;
|
2018-09-29 01:11:11 -07:00
|
|
|
struct rde_prefixset_head rde_prefixsets;
|
|
|
|
struct rde_prefixset_head rde_originsets;
|
2019-08-05 01:46:55 -07:00
|
|
|
struct as_set_head as_sets;
|
2021-02-16 00:29:16 -08:00
|
|
|
struct rtr_config_head rtrs;
|
2006-03-15 03:33:42 -08:00
|
|
|
char *csock;
|
2006-01-24 02:03:44 -08:00
|
|
|
char *rcsock;
|
2004-12-23 07:08:43 -08:00
|
|
|
int flags;
|
|
|
|
int log;
|
2017-05-28 08:16:33 -07:00
|
|
|
u_int default_tableid;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t bgpid;
|
|
|
|
uint32_t clusterid;
|
|
|
|
uint32_t as;
|
|
|
|
uint16_t short_as;
|
|
|
|
uint16_t holdtime;
|
|
|
|
uint16_t min_holdtime;
|
|
|
|
uint16_t connectretry;
|
|
|
|
uint8_t fib_priority;
|
2024-08-14 12:09:51 -07:00
|
|
|
uint8_t filtered_in_locrib;
|
2003-12-17 03:46:54 -08:00
|
|
|
};
|
|
|
|
|
2015-03-13 19:43:02 -07:00
|
|
|
extern int cmd_opts;
|
|
|
|
|
2022-07-11 10:08:21 -07:00
|
|
|
enum addpath_mode {
|
|
|
|
ADDPATH_EVAL_NONE,
|
|
|
|
ADDPATH_EVAL_BEST,
|
|
|
|
ADDPATH_EVAL_ECMP,
|
|
|
|
ADDPATH_EVAL_AS_WIDE,
|
|
|
|
ADDPATH_EVAL_ALL,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct addpath_eval {
|
|
|
|
enum addpath_mode mode;
|
|
|
|
int extrapaths;
|
|
|
|
int maxpaths;
|
|
|
|
};
|
|
|
|
|
2018-06-13 02:33:51 -07:00
|
|
|
enum export_type {
|
|
|
|
EXPORT_UNSET,
|
|
|
|
EXPORT_NONE,
|
|
|
|
EXPORT_DEFAULT_ROUTE
|
2004-01-13 05:45:49 -08:00
|
|
|
};
|
|
|
|
|
2004-02-26 06:00:33 -08:00
|
|
|
enum enforce_as {
|
|
|
|
ENFORCE_AS_UNDEF,
|
|
|
|
ENFORCE_AS_OFF,
|
|
|
|
ENFORCE_AS_ON
|
|
|
|
};
|
|
|
|
|
2023-01-04 06:33:30 -08:00
|
|
|
enum role {
|
|
|
|
ROLE_NONE,
|
|
|
|
ROLE_CUSTOMER,
|
|
|
|
ROLE_PROVIDER,
|
|
|
|
ROLE_RS,
|
|
|
|
ROLE_RS_CLIENT,
|
|
|
|
ROLE_PEER,
|
|
|
|
};
|
|
|
|
|
2004-04-27 15:06:54 -07:00
|
|
|
enum auth_method {
|
2004-05-06 04:57:55 -07:00
|
|
|
AUTH_NONE,
|
|
|
|
AUTH_MD5SIG,
|
2004-04-27 17:38:39 -07:00
|
|
|
AUTH_IPSEC_MANUAL_ESP,
|
|
|
|
AUTH_IPSEC_MANUAL_AH,
|
2004-04-27 21:34:46 -07:00
|
|
|
AUTH_IPSEC_IKE_ESP,
|
|
|
|
AUTH_IPSEC_IKE_AH
|
2004-04-27 15:06:54 -07:00
|
|
|
};
|
2004-04-27 18:08:38 -07:00
|
|
|
|
2022-06-15 07:09:30 -07:00
|
|
|
enum auth_alg {
|
|
|
|
AUTH_AALG_NONE,
|
|
|
|
AUTH_AALG_SHA1HMAC,
|
|
|
|
AUTH_AALG_MD5HMAC,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum auth_enc_alg {
|
|
|
|
AUTH_EALG_NONE,
|
|
|
|
AUTH_EALG_3DESCBC,
|
|
|
|
AUTH_EALG_AES,
|
|
|
|
};
|
|
|
|
|
2024-10-01 04:49:24 -07:00
|
|
|
struct auth_config {
|
2004-04-27 15:42:13 -07:00
|
|
|
char md5key[TCP_MD5_KEY_LEN];
|
2004-12-23 07:08:43 -08:00
|
|
|
char auth_key_in[IPSEC_AUTH_KEY_LEN];
|
|
|
|
char auth_key_out[IPSEC_AUTH_KEY_LEN];
|
|
|
|
char enc_key_in[IPSEC_ENC_KEY_LEN];
|
|
|
|
char enc_key_out[IPSEC_ENC_KEY_LEN];
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t spi_in;
|
|
|
|
uint32_t spi_out;
|
2004-12-23 07:08:43 -08:00
|
|
|
enum auth_method method;
|
2022-06-15 07:09:30 -07:00
|
|
|
enum auth_alg auth_alg_in;
|
|
|
|
enum auth_alg auth_alg_out;
|
|
|
|
enum auth_enc_alg enc_alg_in;
|
|
|
|
enum auth_enc_alg enc_alg_out;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t md5key_len;
|
|
|
|
uint8_t auth_keylen_in;
|
|
|
|
uint8_t auth_keylen_out;
|
|
|
|
uint8_t enc_keylen_in;
|
|
|
|
uint8_t enc_keylen_out;
|
2004-04-25 18:59:26 -07:00
|
|
|
};
|
|
|
|
|
2004-11-18 09:07:38 -08:00
|
|
|
struct capabilities {
|
2012-09-11 22:56:22 -07:00
|
|
|
struct {
|
|
|
|
int16_t timeout; /* graceful restart timeout */
|
|
|
|
int8_t flags[AID_MAX]; /* graceful restart per AID flags */
|
|
|
|
int8_t restart; /* graceful restart, RFC 4724 */
|
|
|
|
} grestart;
|
|
|
|
int8_t mp[AID_MAX]; /* multiprotocol extensions, RFC 4760 */
|
2023-01-04 06:33:30 -08:00
|
|
|
int8_t add_path[AID_MAX]; /* ADD_PATH, RFC 7911 */
|
2012-09-11 22:56:22 -07:00
|
|
|
int8_t refresh; /* route refresh, RFC 2918 */
|
|
|
|
int8_t as4byte; /* 4-byte ASnum, RFC 4893 */
|
2021-05-27 01:27:48 -07:00
|
|
|
int8_t enhanced_rr; /* enhanced route refresh, RFC 7313 */
|
2023-03-09 05:12:19 -08:00
|
|
|
int8_t policy; /* Open Policy, RFC 9234, 2 = enforce */
|
2004-11-18 09:07:38 -08:00
|
|
|
};
|
|
|
|
|
2024-03-22 00:19:28 -07:00
|
|
|
enum capa_codes {
|
|
|
|
CAPA_NONE = 0,
|
|
|
|
CAPA_MP = 1,
|
|
|
|
CAPA_REFRESH = 2,
|
|
|
|
CAPA_ROLE = 9,
|
|
|
|
CAPA_RESTART = 64,
|
|
|
|
CAPA_AS4BYTE = 65,
|
|
|
|
CAPA_ADD_PATH = 69,
|
|
|
|
CAPA_ENHANCED_RR = 70,
|
|
|
|
};
|
|
|
|
|
2022-06-27 06:26:51 -07:00
|
|
|
/* flags for RFC 4724 - graceful restart */
|
2012-09-11 22:56:22 -07:00
|
|
|
#define CAPA_GR_PRESENT 0x01
|
|
|
|
#define CAPA_GR_RESTART 0x02
|
|
|
|
#define CAPA_GR_FORWARD 0x04
|
|
|
|
#define CAPA_GR_RESTARTING 0x08
|
|
|
|
#define CAPA_GR_TIMEMASK 0x0fff
|
|
|
|
#define CAPA_GR_R_FLAG 0x8000
|
|
|
|
#define CAPA_GR_F_FLAG 0x80
|
|
|
|
|
2022-06-27 06:26:51 -07:00
|
|
|
/* flags for RFC 7911 - enhanced router refresh */
|
2021-05-27 01:27:48 -07:00
|
|
|
#define CAPA_AP_RECV 0x01
|
|
|
|
#define CAPA_AP_SEND 0x02
|
|
|
|
#define CAPA_AP_BIDIR 0x03
|
2024-04-09 02:03:18 -07:00
|
|
|
#define CAPA_AP_MASK 0x0f
|
|
|
|
#define CAPA_AP_RECV_ENFORCE 0x10 /* internal only */
|
|
|
|
#define CAPA_AP_SEND_ENFORCE 0x20 /* internal only */
|
2021-05-27 01:27:48 -07:00
|
|
|
|
2022-06-27 06:26:51 -07:00
|
|
|
/* values for RFC 9234 - BGP Open Policy */
|
|
|
|
#define CAPA_ROLE_PROVIDER 0x00
|
|
|
|
#define CAPA_ROLE_RS 0x01
|
|
|
|
#define CAPA_ROLE_RS_CLIENT 0x02
|
|
|
|
#define CAPA_ROLE_CUSTOMER 0x03
|
|
|
|
#define CAPA_ROLE_PEER 0x04
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
struct peer_config {
|
2004-01-27 08:49:53 -08:00
|
|
|
struct bgpd_addr remote_addr;
|
2020-04-23 09:13:11 -07:00
|
|
|
struct bgpd_addr local_addr_v4;
|
|
|
|
struct bgpd_addr local_addr_v6;
|
2004-12-23 07:08:43 -08:00
|
|
|
struct capabilities capabilities;
|
2022-07-11 10:08:21 -07:00
|
|
|
struct addpath_eval eval;
|
2004-12-23 07:08:43 -08:00
|
|
|
char group[PEER_DESCR_LEN];
|
|
|
|
char descr[PEER_DESCR_LEN];
|
2020-05-10 06:38:46 -07:00
|
|
|
char reason[REASON_LEN];
|
2009-06-05 12:52:32 -07:00
|
|
|
char rib[PEER_DESCR_LEN];
|
2004-12-23 07:08:43 -08:00
|
|
|
char if_depend[IFNAMSIZ];
|
2006-06-17 07:06:09 -07:00
|
|
|
char demote_group[IFNAMSIZ];
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t id;
|
|
|
|
uint32_t groupid;
|
|
|
|
uint32_t remote_as;
|
|
|
|
uint32_t local_as;
|
|
|
|
uint32_t max_prefix;
|
|
|
|
uint32_t max_out_prefix;
|
2018-06-13 02:33:51 -07:00
|
|
|
enum export_type export_type;
|
2004-02-26 06:00:33 -08:00
|
|
|
enum enforce_as enforce_as;
|
2017-05-27 11:12:23 -07:00
|
|
|
enum enforce_as enforce_local_as;
|
2023-01-04 06:33:30 -08:00
|
|
|
enum role role;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint16_t max_prefix_restart;
|
|
|
|
uint16_t max_out_prefix_restart;
|
|
|
|
uint16_t holdtime;
|
|
|
|
uint16_t min_holdtime;
|
|
|
|
uint16_t local_short_as;
|
2022-02-23 03:20:35 -08:00
|
|
|
uint16_t remote_port;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t template;
|
|
|
|
uint8_t remote_masklen;
|
|
|
|
uint8_t ebgp; /* 0 = ibgp else ebgp */
|
|
|
|
uint8_t distance; /* 1 = direct, >1 = multihop */
|
|
|
|
uint8_t passive;
|
|
|
|
uint8_t down;
|
|
|
|
uint8_t reflector_client;
|
|
|
|
uint8_t ttlsec; /* TTL security hack */
|
|
|
|
uint8_t flags;
|
2003-12-17 03:46:54 -08:00
|
|
|
};
|
|
|
|
|
2019-06-21 22:36:40 -07:00
|
|
|
#define PEER_ID_NONE 0
|
|
|
|
#define PEER_ID_SELF 1
|
|
|
|
#define PEER_ID_STATIC_MIN 2 /* exclude self */
|
|
|
|
#define PEER_ID_STATIC_MAX (UINT_MAX / 2)
|
|
|
|
#define PEER_ID_DYN_MAX UINT_MAX
|
|
|
|
|
2009-03-26 06:59:30 -07:00
|
|
|
#define PEERFLAG_TRANS_AS 0x01
|
2015-09-21 02:47:15 -07:00
|
|
|
#define PEERFLAG_LOG_UPDATES 0x02
|
2021-03-02 01:45:07 -08:00
|
|
|
#define PEERFLAG_EVALUATE_ALL 0x04
|
|
|
|
#define PEERFLAG_NO_AS_SET 0x08
|
2009-03-26 06:59:30 -07:00
|
|
|
|
2023-02-09 05:43:23 -08:00
|
|
|
struct rde_peer_stats {
|
|
|
|
uint64_t prefix_rcvd_update;
|
|
|
|
uint64_t prefix_rcvd_withdraw;
|
|
|
|
uint64_t prefix_rcvd_eor;
|
|
|
|
uint64_t prefix_sent_update;
|
|
|
|
uint64_t prefix_sent_withdraw;
|
|
|
|
uint64_t prefix_sent_eor;
|
|
|
|
uint32_t prefix_cnt;
|
|
|
|
uint32_t prefix_out_cnt;
|
|
|
|
uint32_t pending_update;
|
|
|
|
uint32_t pending_withdraw;
|
|
|
|
};
|
|
|
|
|
2010-05-17 08:49:29 -07:00
|
|
|
enum network_type {
|
2018-07-10 05:40:41 -07:00
|
|
|
NETWORK_DEFAULT, /* from network statements */
|
2010-05-17 08:49:29 -07:00
|
|
|
NETWORK_STATIC,
|
2012-05-27 11:52:07 -07:00
|
|
|
NETWORK_CONNECTED,
|
2016-10-05 00:38:06 -07:00
|
|
|
NETWORK_RTLABEL,
|
2018-07-11 07:08:46 -07:00
|
|
|
NETWORK_MRTCLONE,
|
2018-09-08 08:25:27 -07:00
|
|
|
NETWORK_PRIORITY,
|
2018-09-09 04:00:51 -07:00
|
|
|
NETWORK_PREFIXSET,
|
2010-05-17 08:49:29 -07:00
|
|
|
};
|
|
|
|
|
2004-01-17 11:35:35 -08:00
|
|
|
struct network_config {
|
2012-05-27 11:52:07 -07:00
|
|
|
struct bgpd_addr prefix;
|
|
|
|
struct filter_set_head attrset;
|
2018-09-09 04:00:51 -07:00
|
|
|
char psname[SET_NAME_LEN];
|
2022-02-06 01:51:19 -08:00
|
|
|
uint64_t rd;
|
2012-05-27 11:52:07 -07:00
|
|
|
enum network_type type;
|
2022-07-20 05:43:27 -07:00
|
|
|
uint16_t rtlabel;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t prefixlen;
|
|
|
|
uint8_t priority;
|
|
|
|
uint8_t old; /* used for reloading */
|
2004-01-17 11:35:35 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct network {
|
2023-04-18 05:11:27 -07:00
|
|
|
struct network_config net;
|
|
|
|
TAILQ_ENTRY(network) entry;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct flowspec {
|
|
|
|
uint16_t len;
|
|
|
|
uint8_t aid;
|
2023-04-19 00:12:22 -07:00
|
|
|
uint8_t flags;
|
2023-04-18 05:11:27 -07:00
|
|
|
uint8_t data[1];
|
|
|
|
};
|
|
|
|
#define FLOWSPEC_SIZE (offsetof(struct flowspec, data))
|
|
|
|
|
|
|
|
struct flowspec_config {
|
|
|
|
RB_ENTRY(flowspec_config) entry;
|
|
|
|
struct filter_set_head attrset;
|
|
|
|
struct flowspec *flow;
|
|
|
|
enum reconf_action reconf_action;
|
2004-01-17 11:35:35 -08:00
|
|
|
};
|
|
|
|
|
2021-02-16 00:29:16 -08:00
|
|
|
enum rtr_error {
|
|
|
|
NO_ERROR = -1,
|
|
|
|
CORRUPT_DATA = 0,
|
|
|
|
INTERNAL_ERROR,
|
|
|
|
NO_DATA_AVAILABLE,
|
|
|
|
INVALID_REQUEST,
|
|
|
|
UNSUPP_PROTOCOL_VERS,
|
|
|
|
UNSUPP_PDU_TYPE,
|
|
|
|
UNK_REC_WDRAWL,
|
|
|
|
DUP_REC_RECV,
|
|
|
|
UNEXP_PROTOCOL_VERS,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rtr_config {
|
|
|
|
SIMPLEQ_ENTRY(rtr_config) entry;
|
|
|
|
char descr[PEER_DESCR_LEN];
|
2024-10-08 05:28:09 -07:00
|
|
|
struct auth_config auth;
|
2021-02-16 00:29:16 -08:00
|
|
|
struct bgpd_addr remote_addr;
|
|
|
|
struct bgpd_addr local_addr;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t id;
|
2023-03-09 09:21:21 -08:00
|
|
|
uint16_t remote_port;
|
2024-08-12 02:04:23 -07:00
|
|
|
uint8_t min_version;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rtr_config_msg {
|
|
|
|
char descr[PEER_DESCR_LEN];
|
|
|
|
uint8_t min_version;
|
2021-02-16 00:29:16 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ctl_show_rtr {
|
|
|
|
char descr[PEER_DESCR_LEN];
|
2024-01-11 05:08:39 -08:00
|
|
|
char state[PEER_DESCR_LEN];
|
2024-08-12 02:04:23 -07:00
|
|
|
char last_sent_msg[REASON_LEN];
|
|
|
|
char last_recv_msg[REASON_LEN];
|
2021-02-16 00:29:16 -08:00
|
|
|
struct bgpd_addr remote_addr;
|
|
|
|
struct bgpd_addr local_addr;
|
|
|
|
uint32_t serial;
|
|
|
|
uint32_t refresh;
|
|
|
|
uint32_t retry;
|
|
|
|
uint32_t expire;
|
|
|
|
int session_id;
|
2022-07-28 06:11:48 -07:00
|
|
|
enum rtr_error last_sent_error;
|
2021-02-16 00:29:16 -08:00
|
|
|
enum rtr_error last_recv_error;
|
2024-08-12 02:04:23 -07:00
|
|
|
uint16_t remote_port;
|
|
|
|
uint8_t version;
|
|
|
|
uint8_t min_version;
|
2021-02-16 00:29:16 -08:00
|
|
|
};
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
enum imsg_type {
|
|
|
|
IMSG_NONE,
|
2004-01-04 11:39:46 -08:00
|
|
|
IMSG_CTL_END,
|
2004-01-05 08:21:14 -08:00
|
|
|
IMSG_CTL_RELOAD,
|
|
|
|
IMSG_CTL_FIB_COUPLE,
|
2004-01-06 15:14:58 -08:00
|
|
|
IMSG_CTL_FIB_DECOUPLE,
|
|
|
|
IMSG_CTL_NEIGHBOR_UP,
|
2004-01-09 05:47:07 -08:00
|
|
|
IMSG_CTL_NEIGHBOR_DOWN,
|
2004-08-20 08:49:02 -07:00
|
|
|
IMSG_CTL_NEIGHBOR_CLEAR,
|
2006-05-23 05:11:38 -07:00
|
|
|
IMSG_CTL_NEIGHBOR_RREFRESH,
|
2013-03-07 13:26:28 -08:00
|
|
|
IMSG_CTL_NEIGHBOR_DESTROY,
|
2004-01-09 11:08:50 -08:00
|
|
|
IMSG_CTL_KROUTE,
|
2004-01-10 18:35:13 -08:00
|
|
|
IMSG_CTL_KROUTE_ADDR,
|
2005-10-19 05:32:16 -07:00
|
|
|
IMSG_CTL_RESULT,
|
|
|
|
IMSG_CTL_SHOW_NEIGHBOR,
|
2004-01-17 10:05:46 -08:00
|
|
|
IMSG_CTL_SHOW_NEXTHOP,
|
2004-02-26 08:16:41 -08:00
|
|
|
IMSG_CTL_SHOW_INTERFACE,
|
|
|
|
IMSG_CTL_SHOW_RIB,
|
2004-04-26 20:53:42 -07:00
|
|
|
IMSG_CTL_SHOW_RIB_PREFIX,
|
2019-06-17 04:02:19 -07:00
|
|
|
IMSG_CTL_SHOW_RIB_COMMUNITIES,
|
2006-03-22 02:18:49 -08:00
|
|
|
IMSG_CTL_SHOW_RIB_ATTR,
|
2004-05-21 04:48:56 -07:00
|
|
|
IMSG_CTL_SHOW_NETWORK,
|
2023-04-20 05:53:27 -07:00
|
|
|
IMSG_CTL_SHOW_FLOWSPEC,
|
2006-01-03 14:49:17 -08:00
|
|
|
IMSG_CTL_SHOW_RIB_MEM,
|
2006-01-24 07:28:02 -08:00
|
|
|
IMSG_CTL_SHOW_TERSE,
|
2007-12-23 10:26:13 -08:00
|
|
|
IMSG_CTL_SHOW_TIMER,
|
2009-11-02 12:38:15 -08:00
|
|
|
IMSG_CTL_LOG_VERBOSE,
|
2010-05-03 06:09:38 -07:00
|
|
|
IMSG_CTL_SHOW_FIB_TABLES,
|
2020-12-29 23:29:56 -08:00
|
|
|
IMSG_CTL_SHOW_SET,
|
2021-02-16 00:29:16 -08:00
|
|
|
IMSG_CTL_SHOW_RTR,
|
2018-12-22 08:12:40 -08:00
|
|
|
IMSG_CTL_TERMINATE,
|
2009-06-06 14:35:32 -07:00
|
|
|
IMSG_NETWORK_ADD,
|
2012-05-27 11:52:07 -07:00
|
|
|
IMSG_NETWORK_ASPATH,
|
|
|
|
IMSG_NETWORK_ATTR,
|
2009-06-06 14:35:32 -07:00
|
|
|
IMSG_NETWORK_REMOVE,
|
|
|
|
IMSG_NETWORK_FLUSH,
|
|
|
|
IMSG_NETWORK_DONE,
|
2023-04-19 00:12:22 -07:00
|
|
|
IMSG_FLOWSPEC_ADD,
|
|
|
|
IMSG_FLOWSPEC_DONE,
|
|
|
|
IMSG_FLOWSPEC_REMOVE,
|
2023-04-20 05:53:27 -07:00
|
|
|
IMSG_FLOWSPEC_FLUSH,
|
2009-06-06 14:35:32 -07:00
|
|
|
IMSG_FILTER_SET,
|
2015-07-20 09:10:37 -07:00
|
|
|
IMSG_SOCKET_CONN,
|
|
|
|
IMSG_SOCKET_CONN_CTL,
|
2021-02-16 00:29:16 -08:00
|
|
|
IMSG_SOCKET_CONN_RTR,
|
2024-10-08 05:28:09 -07:00
|
|
|
IMSG_SOCKET_SETUP,
|
|
|
|
IMSG_SOCKET_TEARDOWN,
|
2009-06-06 14:35:32 -07:00
|
|
|
IMSG_RECONF_CONF,
|
2009-06-06 17:30:23 -07:00
|
|
|
IMSG_RECONF_RIB,
|
2009-06-06 14:35:32 -07:00
|
|
|
IMSG_RECONF_PEER,
|
2024-10-01 04:49:24 -07:00
|
|
|
IMSG_RECONF_PEER_AUTH,
|
2009-06-06 14:35:32 -07:00
|
|
|
IMSG_RECONF_FILTER,
|
|
|
|
IMSG_RECONF_LISTENER,
|
2010-06-27 12:53:34 -07:00
|
|
|
IMSG_RECONF_CTRL,
|
2019-02-11 07:44:25 -08:00
|
|
|
IMSG_RECONF_VPN,
|
|
|
|
IMSG_RECONF_VPN_EXPORT,
|
|
|
|
IMSG_RECONF_VPN_IMPORT,
|
|
|
|
IMSG_RECONF_VPN_DONE,
|
2018-09-29 01:11:11 -07:00
|
|
|
IMSG_RECONF_PREFIX_SET,
|
|
|
|
IMSG_RECONF_PREFIX_SET_ITEM,
|
2018-09-06 22:43:33 -07:00
|
|
|
IMSG_RECONF_AS_SET,
|
|
|
|
IMSG_RECONF_AS_SET_ITEMS,
|
|
|
|
IMSG_RECONF_AS_SET_DONE,
|
2018-09-29 01:11:11 -07:00
|
|
|
IMSG_RECONF_ORIGIN_SET,
|
2018-09-20 21:55:27 -07:00
|
|
|
IMSG_RECONF_ROA_SET,
|
2020-12-29 07:30:34 -08:00
|
|
|
IMSG_RECONF_ROA_ITEM,
|
2022-11-18 02:17:23 -08:00
|
|
|
IMSG_RECONF_ASPA,
|
|
|
|
IMSG_RECONF_ASPA_TAS,
|
|
|
|
IMSG_RECONF_ASPA_DONE,
|
2023-01-17 08:09:01 -08:00
|
|
|
IMSG_RECONF_ASPA_PREP,
|
2021-02-16 00:29:16 -08:00
|
|
|
IMSG_RECONF_RTR_CONFIG,
|
2018-09-29 00:58:06 -07:00
|
|
|
IMSG_RECONF_DRAIN,
|
2009-06-06 14:35:32 -07:00
|
|
|
IMSG_RECONF_DONE,
|
|
|
|
IMSG_UPDATE,
|
|
|
|
IMSG_UPDATE_ERR,
|
|
|
|
IMSG_SESSION_ADD,
|
|
|
|
IMSG_SESSION_UP,
|
|
|
|
IMSG_SESSION_DOWN,
|
2012-09-11 22:56:22 -07:00
|
|
|
IMSG_SESSION_STALE,
|
2022-08-26 07:10:52 -07:00
|
|
|
IMSG_SESSION_NOGRACE,
|
2012-09-11 22:56:22 -07:00
|
|
|
IMSG_SESSION_FLUSH,
|
|
|
|
IMSG_SESSION_RESTARTED,
|
2022-06-23 06:09:03 -07:00
|
|
|
IMSG_SESSION_DEPENDON,
|
2019-05-08 05:41:55 -07:00
|
|
|
IMSG_PFKEY_RELOAD,
|
2009-06-06 14:35:32 -07:00
|
|
|
IMSG_MRT_OPEN,
|
|
|
|
IMSG_MRT_REOPEN,
|
|
|
|
IMSG_MRT_CLOSE,
|
|
|
|
IMSG_KROUTE_CHANGE,
|
|
|
|
IMSG_KROUTE_DELETE,
|
2019-07-22 23:26:44 -07:00
|
|
|
IMSG_KROUTE_FLUSH,
|
2009-06-06 14:35:32 -07:00
|
|
|
IMSG_NEXTHOP_ADD,
|
|
|
|
IMSG_NEXTHOP_REMOVE,
|
|
|
|
IMSG_NEXTHOP_UPDATE,
|
|
|
|
IMSG_PFTABLE_ADD,
|
|
|
|
IMSG_PFTABLE_REMOVE,
|
|
|
|
IMSG_PFTABLE_COMMIT,
|
2004-10-19 05:02:49 -07:00
|
|
|
IMSG_REFRESH,
|
2017-05-28 05:21:36 -07:00
|
|
|
IMSG_DEMOTE,
|
|
|
|
IMSG_XON,
|
|
|
|
IMSG_XOFF
|
2003-12-17 03:46:54 -08:00
|
|
|
};
|
|
|
|
|
2006-06-17 07:06:09 -07:00
|
|
|
struct demote_msg {
|
|
|
|
char demote_group[IFNAMSIZ];
|
|
|
|
int level;
|
|
|
|
};
|
|
|
|
|
2005-10-19 05:32:16 -07:00
|
|
|
enum ctl_results {
|
|
|
|
CTL_RES_OK,
|
2006-01-24 02:03:44 -08:00
|
|
|
CTL_RES_NOSUCHPEER,
|
2006-05-23 05:11:38 -07:00
|
|
|
CTL_RES_DENIED,
|
2006-05-27 14:24:36 -07:00
|
|
|
CTL_RES_NOCAP,
|
2007-01-26 09:40:48 -08:00
|
|
|
CTL_RES_PARSE_ERROR,
|
2012-09-18 02:45:50 -07:00
|
|
|
CTL_RES_PENDING,
|
2013-03-07 13:26:28 -08:00
|
|
|
CTL_RES_NOMEM,
|
|
|
|
CTL_RES_BADPEER,
|
2018-11-10 03:19:01 -08:00
|
|
|
CTL_RES_BADSTATE,
|
2023-08-30 01:16:28 -07:00
|
|
|
CTL_RES_NOSUCHRIB,
|
|
|
|
CTL_RES_OPNOTSUPP,
|
2005-10-19 05:32:16 -07:00
|
|
|
};
|
|
|
|
|
2004-01-05 14:57:58 -08:00
|
|
|
/* needed for session.h parse prototype */
|
|
|
|
LIST_HEAD(mrt_head, mrt);
|
|
|
|
|
2004-02-16 04:53:15 -08:00
|
|
|
/* error codes and subcodes needed in SE and RDE */
|
|
|
|
enum err_codes {
|
|
|
|
ERR_HEADER = 1,
|
|
|
|
ERR_OPEN,
|
|
|
|
ERR_UPDATE,
|
|
|
|
ERR_HOLDTIMEREXPIRED,
|
|
|
|
ERR_FSM,
|
2021-05-27 01:27:48 -07:00
|
|
|
ERR_CEASE,
|
2024-02-19 02:15:35 -08:00
|
|
|
ERR_RREFRESH,
|
|
|
|
ERR_SENDHOLDTIMEREXPIRED,
|
2004-02-16 04:53:15 -08:00
|
|
|
};
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
enum suberr_update {
|
2004-01-13 05:34:56 -08:00
|
|
|
ERR_UPD_UNSPECIFIC,
|
|
|
|
ERR_UPD_ATTRLIST,
|
2003-12-17 03:46:54 -08:00
|
|
|
ERR_UPD_UNKNWN_WK_ATTR,
|
|
|
|
ERR_UPD_MISSNG_WK_ATTR,
|
|
|
|
ERR_UPD_ATTRFLAGS,
|
|
|
|
ERR_UPD_ATTRLEN,
|
|
|
|
ERR_UPD_ORIGIN,
|
|
|
|
ERR_UPD_LOOP,
|
|
|
|
ERR_UPD_NEXTHOP,
|
|
|
|
ERR_UPD_OPTATTR,
|
|
|
|
ERR_UPD_NETWORK,
|
|
|
|
ERR_UPD_ASPATH
|
|
|
|
};
|
|
|
|
|
2004-02-16 04:53:15 -08:00
|
|
|
enum suberr_cease {
|
|
|
|
ERR_CEASE_MAX_PREFIX = 1,
|
|
|
|
ERR_CEASE_ADMIN_DOWN,
|
|
|
|
ERR_CEASE_PEER_UNCONF,
|
|
|
|
ERR_CEASE_ADMIN_RESET,
|
|
|
|
ERR_CEASE_CONN_REJECT,
|
|
|
|
ERR_CEASE_OTHER_CHANGE,
|
|
|
|
ERR_CEASE_COLLISION,
|
2020-01-21 03:10:24 -08:00
|
|
|
ERR_CEASE_RSRC_EXHAUST,
|
|
|
|
ERR_CEASE_HARD_RESET,
|
|
|
|
ERR_CEASE_MAX_SENT_PREFIX
|
2004-02-16 04:53:15 -08:00
|
|
|
};
|
|
|
|
|
2021-05-27 01:27:48 -07:00
|
|
|
enum suberr_rrefresh {
|
|
|
|
ERR_RR_INV_LEN = 1
|
|
|
|
};
|
|
|
|
|
2022-06-23 00:43:37 -07:00
|
|
|
struct kroute;
|
|
|
|
struct kroute6;
|
|
|
|
struct knexthop;
|
2019-02-11 07:44:25 -08:00
|
|
|
struct kredist_node;
|
2022-06-23 00:43:37 -07:00
|
|
|
RB_HEAD(kroute_tree, kroute);
|
|
|
|
RB_HEAD(kroute6_tree, kroute6);
|
|
|
|
RB_HEAD(knexthop_tree, knexthop);
|
2019-02-11 07:44:25 -08:00
|
|
|
RB_HEAD(kredist_tree, kredist_node);
|
2010-05-03 06:09:38 -07:00
|
|
|
|
|
|
|
struct ktable {
|
|
|
|
char descr[PEER_DESCR_LEN];
|
|
|
|
struct kroute_tree krt;
|
|
|
|
struct kroute6_tree krt6;
|
|
|
|
struct knexthop_tree knt;
|
2019-02-11 07:44:25 -08:00
|
|
|
struct kredist_tree kredist;
|
2010-05-03 06:09:38 -07:00
|
|
|
struct network_head krn;
|
|
|
|
u_int rtableid;
|
|
|
|
u_int nhtableid; /* rdomain id for nexthop lookup */
|
|
|
|
int nhrefcnt; /* refcnt for nexthop table */
|
|
|
|
enum reconf_action state;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t fib_conf; /* configured FIB sync flag */
|
|
|
|
uint8_t fib_sync; /* is FIB synced with kernel? */
|
2010-05-03 06:09:38 -07:00
|
|
|
};
|
|
|
|
|
2010-04-13 02:09:48 -07:00
|
|
|
struct kroute_full {
|
|
|
|
struct bgpd_addr prefix;
|
|
|
|
struct bgpd_addr nexthop;
|
2022-09-23 08:50:41 -07:00
|
|
|
char label[ROUTELABEL_LEN];
|
2022-06-30 13:33:14 -07:00
|
|
|
uint32_t mplslabel;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint16_t flags;
|
2010-04-13 02:09:48 -07:00
|
|
|
u_short ifindex;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t prefixlen;
|
|
|
|
uint8_t priority;
|
2010-04-13 02:09:48 -07:00
|
|
|
};
|
|
|
|
|
2003-12-25 15:15:58 -08:00
|
|
|
struct kroute_nexthop {
|
2004-12-23 07:08:43 -08:00
|
|
|
struct bgpd_addr nexthop;
|
|
|
|
struct bgpd_addr gateway;
|
2010-04-06 06:25:08 -07:00
|
|
|
struct bgpd_addr net;
|
2022-08-10 07:17:01 -07:00
|
|
|
uint8_t netlen;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t valid;
|
|
|
|
uint8_t connected;
|
2003-12-25 15:15:58 -08:00
|
|
|
};
|
|
|
|
|
2022-06-23 06:09:03 -07:00
|
|
|
struct session_dependon {
|
2004-01-17 10:27:19 -08:00
|
|
|
char ifname[IFNAMSIZ];
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t depend_state; /* for session depend on */
|
2004-01-17 10:05:46 -08:00
|
|
|
};
|
|
|
|
|
2004-01-11 12:13:00 -08:00
|
|
|
struct session_up {
|
2020-02-12 02:33:56 -08:00
|
|
|
struct bgpd_addr local_v4_addr;
|
|
|
|
struct bgpd_addr local_v6_addr;
|
2004-01-11 12:13:00 -08:00
|
|
|
struct bgpd_addr remote_addr;
|
2009-12-08 06:03:40 -08:00
|
|
|
struct capabilities capa;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t remote_bgpid;
|
2023-10-16 03:25:45 -07:00
|
|
|
unsigned int if_scope;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint16_t short_as;
|
2004-01-11 12:13:00 -08:00
|
|
|
};
|
|
|
|
|
2021-05-27 01:27:48 -07:00
|
|
|
struct route_refresh {
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t aid;
|
|
|
|
uint8_t subtype;
|
2021-05-27 01:27:48 -07:00
|
|
|
};
|
|
|
|
#define ROUTE_REFRESH_REQUEST 0
|
|
|
|
#define ROUTE_REFRESH_BEGIN_RR 1
|
|
|
|
#define ROUTE_REFRESH_END_RR 2
|
|
|
|
|
2004-05-07 03:06:15 -07:00
|
|
|
struct pftable_msg {
|
|
|
|
struct bgpd_addr addr;
|
2004-12-23 07:08:43 -08:00
|
|
|
char pftable[PFTABLE_LEN];
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t len;
|
2004-05-07 03:06:15 -07:00
|
|
|
};
|
|
|
|
|
2019-02-21 03:17:22 -08:00
|
|
|
struct ctl_show_interface {
|
|
|
|
char ifname[IFNAMSIZ];
|
|
|
|
char linkstate[32];
|
|
|
|
char media[32];
|
2022-02-06 01:51:19 -08:00
|
|
|
uint64_t baudrate;
|
2019-02-21 03:17:22 -08:00
|
|
|
u_int rdomain;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t nh_reachable;
|
|
|
|
uint8_t is_up;
|
2019-02-21 03:17:22 -08:00
|
|
|
};
|
|
|
|
|
2004-01-10 18:35:13 -08:00
|
|
|
struct ctl_show_nexthop {
|
2019-02-21 03:17:22 -08:00
|
|
|
struct bgpd_addr addr;
|
|
|
|
struct ctl_show_interface iface;
|
2022-06-22 07:48:51 -07:00
|
|
|
struct kroute_full kr;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t valid;
|
|
|
|
uint8_t krvalid;
|
2004-01-10 18:35:13 -08:00
|
|
|
};
|
|
|
|
|
2020-12-29 23:29:56 -08:00
|
|
|
struct ctl_show_set {
|
|
|
|
char name[SET_NAME_LEN];
|
|
|
|
time_t lastchange;
|
|
|
|
size_t v4_cnt;
|
|
|
|
size_t v6_cnt;
|
|
|
|
size_t as_cnt;
|
|
|
|
enum {
|
|
|
|
ASNUM_SET,
|
|
|
|
PREFIX_SET,
|
|
|
|
ORIGIN_SET,
|
|
|
|
ROA_SET,
|
2023-01-17 08:09:01 -08:00
|
|
|
ASPA_SET,
|
2020-12-29 23:29:56 -08:00
|
|
|
} type;
|
|
|
|
};
|
|
|
|
|
2004-12-23 09:26:51 -08:00
|
|
|
struct ctl_neighbor {
|
|
|
|
struct bgpd_addr addr;
|
|
|
|
char descr[PEER_DESCR_LEN];
|
2020-05-10 06:38:46 -07:00
|
|
|
char reason[REASON_LEN];
|
2007-12-23 10:26:13 -08:00
|
|
|
int show_timers;
|
2019-01-20 15:27:48 -08:00
|
|
|
int is_group;
|
2004-12-23 09:26:51 -08:00
|
|
|
};
|
|
|
|
|
2022-07-07 05:16:04 -07:00
|
|
|
#define F_PREF_ELIGIBLE 0x001
|
|
|
|
#define F_PREF_BEST 0x002
|
|
|
|
#define F_PREF_INTERNAL 0x004
|
|
|
|
#define F_PREF_ANNOUNCE 0x008
|
|
|
|
#define F_PREF_STALE 0x010
|
|
|
|
#define F_PREF_INVALID 0x020
|
|
|
|
#define F_PREF_PATH_ID 0x040
|
2023-03-13 09:52:41 -07:00
|
|
|
#define F_PREF_OTC_LEAK 0x080
|
2022-07-07 05:16:04 -07:00
|
|
|
#define F_PREF_ECMP 0x100
|
|
|
|
#define F_PREF_AS_WIDE 0x200
|
2024-08-14 12:09:51 -07:00
|
|
|
#define F_PREF_FILTERED 0x400
|
2004-02-26 08:16:41 -08:00
|
|
|
|
|
|
|
struct ctl_show_rib {
|
2006-06-14 10:08:56 -07:00
|
|
|
struct bgpd_addr true_nexthop;
|
|
|
|
struct bgpd_addr exit_nexthop;
|
2004-12-23 07:08:43 -08:00
|
|
|
struct bgpd_addr prefix;
|
2006-03-22 02:18:49 -08:00
|
|
|
struct bgpd_addr remote_addr;
|
|
|
|
char descr[PEER_DESCR_LEN];
|
2020-01-09 03:55:25 -08:00
|
|
|
time_t age;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t remote_id;
|
|
|
|
uint32_t path_id;
|
|
|
|
uint32_t local_pref;
|
|
|
|
uint32_t med;
|
|
|
|
uint32_t weight;
|
|
|
|
uint32_t flags;
|
|
|
|
uint8_t prefixlen;
|
|
|
|
uint8_t origin;
|
2023-01-24 03:28:41 -08:00
|
|
|
uint8_t roa_validation_state;
|
|
|
|
uint8_t aspa_validation_state;
|
2022-07-07 05:16:04 -07:00
|
|
|
int8_t dmetric;
|
2019-11-26 17:21:54 -08:00
|
|
|
/* plus an aspath */
|
2004-02-26 08:16:41 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum as_spec {
|
2018-09-26 08:48:01 -07:00
|
|
|
AS_UNDEF,
|
2004-02-26 08:16:41 -08:00
|
|
|
AS_ALL,
|
|
|
|
AS_SOURCE,
|
|
|
|
AS_TRANSIT,
|
2007-03-06 08:52:48 -08:00
|
|
|
AS_PEER,
|
2004-02-26 08:16:41 -08:00
|
|
|
AS_EMPTY
|
|
|
|
};
|
|
|
|
|
2010-05-17 09:08:20 -07:00
|
|
|
enum aslen_spec {
|
|
|
|
ASLEN_NONE,
|
|
|
|
ASLEN_MAX,
|
|
|
|
ASLEN_SEQ
|
|
|
|
};
|
|
|
|
|
2018-09-06 22:43:33 -07:00
|
|
|
#define AS_FLAG_NEIGHBORAS 0x01
|
|
|
|
#define AS_FLAG_AS_SET_NAME 0x02
|
|
|
|
#define AS_FLAG_AS_SET 0x04
|
|
|
|
|
2004-11-19 06:43:56 -08:00
|
|
|
struct filter_as {
|
2018-09-06 22:43:33 -07:00
|
|
|
char name[SET_NAME_LEN];
|
|
|
|
struct as_set *aset;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t as_min;
|
|
|
|
uint32_t as_max;
|
2018-09-06 22:43:33 -07:00
|
|
|
enum as_spec type;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t flags;
|
|
|
|
uint8_t op;
|
2004-02-26 08:16:41 -08:00
|
|
|
};
|
|
|
|
|
2010-05-17 09:08:20 -07:00
|
|
|
struct filter_aslen {
|
|
|
|
u_int aslen;
|
|
|
|
enum aslen_spec type;
|
|
|
|
};
|
|
|
|
|
2018-02-09 17:24:28 -08:00
|
|
|
#define PREFIXSET_FLAG_FILTER 0x01
|
|
|
|
#define PREFIXSET_FLAG_DIRTY 0x02 /* prefix-set changed at reload */
|
2018-09-08 08:25:27 -07:00
|
|
|
#define PREFIXSET_FLAG_OPS 0x04 /* indiv. prefixes have prefixlenops */
|
|
|
|
#define PREFIXSET_FLAG_LONGER 0x08 /* filter all prefixes with or-longer */
|
2018-02-09 17:24:28 -08:00
|
|
|
|
|
|
|
struct filter_prefixset {
|
|
|
|
int flags;
|
2018-09-06 22:43:33 -07:00
|
|
|
char name[SET_NAME_LEN];
|
2018-09-07 03:49:22 -07:00
|
|
|
struct rde_prefixset *ps;
|
2018-02-09 17:24:28 -08:00
|
|
|
};
|
|
|
|
|
2018-09-29 01:11:11 -07:00
|
|
|
struct filter_originset {
|
|
|
|
char name[SET_NAME_LEN];
|
|
|
|
struct rde_prefixset *ps;
|
|
|
|
};
|
|
|
|
|
2023-01-24 06:13:11 -08:00
|
|
|
struct filter_vs {
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t validity;
|
|
|
|
uint8_t is_set;
|
2018-09-29 01:11:11 -07:00
|
|
|
};
|
|
|
|
|
2019-06-17 04:02:19 -07:00
|
|
|
/*
|
|
|
|
* Communities are encoded depending on their type. The low byte of flags
|
|
|
|
* is the COMMUNITY_TYPE (BASIC, LARGE, EXT). BASIC encoding is just using
|
|
|
|
* data1 and data2, LARGE uses all data fields and EXT is also using all
|
2019-06-17 14:17:04 -07:00
|
|
|
* data fields. The 4-byte flags fields consists of up to 3 data flags
|
2019-06-17 04:02:19 -07:00
|
|
|
* for e.g. COMMUNITY_ANY and the low byte is the community type.
|
|
|
|
* If flags is 0 the community struct is unused. If the upper 24bit of
|
|
|
|
* flags is 0 a fast compare can be used.
|
2022-02-06 01:51:19 -08:00
|
|
|
* The code uses a type cast to uint8_t to access the type.
|
2019-06-17 04:02:19 -07:00
|
|
|
*/
|
|
|
|
struct community {
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t flags;
|
|
|
|
uint32_t data1;
|
|
|
|
uint32_t data2;
|
|
|
|
uint32_t data3;
|
2009-12-16 07:40:55 -08:00
|
|
|
};
|
|
|
|
|
2006-06-15 03:04:40 -07:00
|
|
|
struct ctl_show_rib_request {
|
2009-06-05 23:04:10 -07:00
|
|
|
char rib[PEER_DESCR_LEN];
|
2006-08-23 01:13:04 -07:00
|
|
|
struct ctl_neighbor neighbor;
|
2006-06-15 03:04:40 -07:00
|
|
|
struct bgpd_addr prefix;
|
|
|
|
struct filter_as as;
|
2019-06-17 04:02:19 -07:00
|
|
|
struct community community;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t flags;
|
|
|
|
uint32_t path_id;
|
2006-06-15 03:04:40 -07:00
|
|
|
pid_t pid;
|
2007-01-26 09:40:48 -08:00
|
|
|
enum imsg_type type;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t validation_state;
|
|
|
|
uint8_t prefixlen;
|
|
|
|
uint8_t aid;
|
2006-06-15 03:04:40 -07:00
|
|
|
};
|
|
|
|
|
2024-01-08 07:08:34 -08:00
|
|
|
struct ctl_kroute_req {
|
|
|
|
int flags;
|
|
|
|
sa_family_t af;
|
|
|
|
};
|
|
|
|
|
2004-02-06 12:18:18 -08:00
|
|
|
enum filter_actions {
|
|
|
|
ACTION_NONE,
|
|
|
|
ACTION_ALLOW,
|
|
|
|
ACTION_DENY
|
|
|
|
};
|
|
|
|
|
|
|
|
enum directions {
|
2004-12-23 07:39:22 -08:00
|
|
|
DIR_IN = 1,
|
2005-11-01 02:58:29 -08:00
|
|
|
DIR_OUT
|
2004-02-06 12:18:18 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum from_spec {
|
|
|
|
FROM_ALL,
|
|
|
|
FROM_ADDRESS,
|
|
|
|
FROM_DESCR,
|
|
|
|
FROM_GROUP
|
|
|
|
};
|
|
|
|
|
|
|
|
enum comp_ops {
|
|
|
|
OP_NONE,
|
|
|
|
OP_RANGE,
|
2004-02-24 07:43:03 -08:00
|
|
|
OP_XRANGE,
|
2004-02-06 12:18:18 -08:00
|
|
|
OP_EQ,
|
|
|
|
OP_NE,
|
|
|
|
OP_LE,
|
|
|
|
OP_LT,
|
|
|
|
OP_GE,
|
|
|
|
OP_GT
|
|
|
|
};
|
|
|
|
|
|
|
|
struct filter_peers {
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t peerid;
|
|
|
|
uint32_t groupid;
|
|
|
|
uint32_t remote_as;
|
|
|
|
uint16_t ribid;
|
|
|
|
uint8_t ebgp;
|
|
|
|
uint8_t ibgp;
|
2004-02-06 12:18:18 -08:00
|
|
|
};
|
|
|
|
|
2019-06-17 04:02:19 -07:00
|
|
|
/* special community type, keep in sync with the attribute type */
|
2018-11-28 00:32:26 -08:00
|
|
|
#define COMMUNITY_TYPE_NONE 0
|
2019-06-17 04:02:19 -07:00
|
|
|
#define COMMUNITY_TYPE_BASIC 8
|
|
|
|
#define COMMUNITY_TYPE_EXT 16
|
|
|
|
#define COMMUNITY_TYPE_LARGE 32
|
2018-11-28 00:32:26 -08:00
|
|
|
|
|
|
|
#define COMMUNITY_ANY 1
|
|
|
|
#define COMMUNITY_NEIGHBOR_AS 2
|
|
|
|
#define COMMUNITY_LOCAL_AS 3
|
|
|
|
|
|
|
|
/* wellknown community definitions */
|
2004-07-05 09:54:53 -07:00
|
|
|
#define COMMUNITY_WELLKNOWN 0xffff
|
2018-11-04 06:34:00 -08:00
|
|
|
#define COMMUNITY_GRACEFUL_SHUTDOWN 0x0000 /* RFC 8326 */
|
2017-05-27 02:26:42 -07:00
|
|
|
#define COMMUNITY_BLACKHOLE 0x029A /* RFC 7999 */
|
2004-07-05 09:54:53 -07:00
|
|
|
#define COMMUNITY_NO_EXPORT 0xff01
|
|
|
|
#define COMMUNITY_NO_ADVERTISE 0xff02
|
|
|
|
#define COMMUNITY_NO_EXPSUBCONFED 0xff03
|
2007-03-16 07:06:57 -07:00
|
|
|
#define COMMUNITY_NO_PEER 0xff04 /* RFC 3765 */
|
2004-03-11 09:12:51 -08:00
|
|
|
|
2008-01-23 00:11:32 -08:00
|
|
|
/* extended community definitions */
|
|
|
|
#define EXT_COMMUNITY_IANA 0x80
|
2019-06-17 04:02:19 -07:00
|
|
|
#define EXT_COMMUNITY_NON_TRANSITIVE 0x40
|
2008-01-23 00:11:32 -08:00
|
|
|
#define EXT_COMMUNITY_VALUE 0x3f
|
2023-04-03 03:48:00 -07:00
|
|
|
/* extended transitive types */
|
2017-05-31 03:44:00 -07:00
|
|
|
#define EXT_COMMUNITY_TRANS_TWO_AS 0x00 /* 2 octet AS specific */
|
|
|
|
#define EXT_COMMUNITY_TRANS_IPV4 0x01 /* IPv4 specific */
|
|
|
|
#define EXT_COMMUNITY_TRANS_FOUR_AS 0x02 /* 4 octet AS specific */
|
|
|
|
#define EXT_COMMUNITY_TRANS_OPAQUE 0x03 /* opaque ext community */
|
2022-06-27 06:26:51 -07:00
|
|
|
#define EXT_COMMUNITY_TRANS_EVPN 0x06 /* EVPN RFC 7432 */
|
2023-04-03 03:48:00 -07:00
|
|
|
/* extended non-transitive types */
|
2017-05-31 03:44:00 -07:00
|
|
|
#define EXT_COMMUNITY_NON_TRANS_TWO_AS 0x40 /* 2 octet AS specific */
|
|
|
|
#define EXT_COMMUNITY_NON_TRANS_IPV4 0x41 /* IPv4 specific */
|
|
|
|
#define EXT_COMMUNITY_NON_TRANS_FOUR_AS 0x42 /* 4 octet AS specific */
|
|
|
|
#define EXT_COMMUNITY_NON_TRANS_OPAQUE 0x43 /* opaque ext community */
|
2019-02-26 02:49:15 -08:00
|
|
|
#define EXT_COMMUNITY_UNKNOWN -1
|
2023-04-03 03:48:00 -07:00
|
|
|
/* generic transitive types */
|
|
|
|
#define EXT_COMMUNITY_GEN_TWO_AS 0x80 /* 2 octet AS specific */
|
|
|
|
#define EXT_COMMUNITY_GEN_IPV4 0x81 /* IPv4 specific */
|
|
|
|
#define EXT_COMMUNITY_GEN_FOUR_AS 0x82 /* 4 octet AS specific */
|
2017-05-31 03:44:00 -07:00
|
|
|
|
2022-06-27 06:26:51 -07:00
|
|
|
/* BGP Origin Validation State Extended Community RFC 8097 */
|
2019-02-26 02:49:15 -08:00
|
|
|
#define EXT_COMMUNITY_SUBTYPE_OVS 0
|
2017-05-31 03:44:00 -07:00
|
|
|
#define EXT_COMMUNITY_OVS_VALID 0
|
|
|
|
#define EXT_COMMUNITY_OVS_NOTFOUND 1
|
|
|
|
#define EXT_COMMUNITY_OVS_INVALID 2
|
|
|
|
|
2009-12-16 07:40:55 -08:00
|
|
|
/* other handy defines */
|
|
|
|
#define EXT_COMMUNITY_OPAQUE_MAX 0xffffffffffffULL
|
2010-03-05 07:25:00 -08:00
|
|
|
#define EXT_COMMUNITY_FLAG_VALID 0x01
|
2009-12-16 07:40:55 -08:00
|
|
|
|
|
|
|
struct ext_comm_pairs {
|
2022-05-25 09:03:34 -07:00
|
|
|
uint8_t type;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t subtype;
|
2017-05-31 03:44:00 -07:00
|
|
|
const char *subname;
|
2009-12-16 07:40:55 -08:00
|
|
|
};
|
|
|
|
|
2017-05-31 03:44:00 -07:00
|
|
|
#define IANA_EXT_COMMUNITIES { \
|
|
|
|
{ EXT_COMMUNITY_TRANS_TWO_AS, 0x02, "rt" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_TWO_AS, 0x03, "soo" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_TWO_AS, 0x05, "odi" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_TWO_AS, 0x08, "bdc" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_TWO_AS, 0x09, "srcas" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_TWO_AS, 0x0a, "l2vid" }, \
|
|
|
|
\
|
|
|
|
{ EXT_COMMUNITY_TRANS_FOUR_AS, 0x02, "rt" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_FOUR_AS, 0x03, "soo" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_FOUR_AS, 0x05, "odi" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_FOUR_AS, 0x08, "bdc" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_FOUR_AS, 0x09, "srcas" }, \
|
|
|
|
\
|
|
|
|
{ EXT_COMMUNITY_TRANS_IPV4, 0x02, "rt" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_IPV4, 0x03, "soo" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_IPV4, 0x05, "odi" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_IPV4, 0x07, "ori" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_IPV4, 0x0a, "l2vid" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_IPV4, 0x0b, "vrfri" }, \
|
|
|
|
\
|
|
|
|
{ EXT_COMMUNITY_TRANS_OPAQUE, 0x06, "ort" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_OPAQUE, 0x0d, "defgw" }, \
|
|
|
|
\
|
2019-02-26 02:49:15 -08:00
|
|
|
{ EXT_COMMUNITY_NON_TRANS_OPAQUE, EXT_COMMUNITY_SUBTYPE_OVS, "ovs" }, \
|
2017-05-31 03:44:00 -07:00
|
|
|
\
|
|
|
|
{ EXT_COMMUNITY_TRANS_EVPN, 0x00, "mac-mob" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_EVPN, 0x01, "esi-lab" }, \
|
|
|
|
{ EXT_COMMUNITY_TRANS_EVPN, 0x02, "esi-rt" }, \
|
2017-08-06 05:28:31 -07:00
|
|
|
\
|
2023-04-03 03:48:00 -07:00
|
|
|
{ EXT_COMMUNITY_GEN_TWO_AS, 0x06, "flow-rate" }, \
|
|
|
|
{ EXT_COMMUNITY_GEN_TWO_AS, 0x0c, "flow-pps" }, \
|
|
|
|
{ EXT_COMMUNITY_GEN_TWO_AS, 0x07, "flow-action" }, \
|
|
|
|
{ EXT_COMMUNITY_GEN_TWO_AS, 0x08, "flow-rt-redir" }, \
|
|
|
|
{ EXT_COMMUNITY_GEN_IPV4, 0x08, "flow-rt-redir" }, \
|
|
|
|
{ EXT_COMMUNITY_GEN_FOUR_AS, 0x08, "flow-rt-redir" }, \
|
|
|
|
{ EXT_COMMUNITY_GEN_TWO_AS, 0x09, "flow-dscp" }, \
|
|
|
|
\
|
2017-08-06 06:23:12 -07:00
|
|
|
{ 0 } \
|
2009-12-16 07:40:55 -08:00
|
|
|
}
|
2008-01-23 00:11:32 -08:00
|
|
|
|
2017-05-31 03:44:00 -07:00
|
|
|
extern const struct ext_comm_pairs iana_ext_comms[];
|
2008-01-23 00:11:32 -08:00
|
|
|
|
2023-04-03 03:48:00 -07:00
|
|
|
/* BGP flowspec defines RFC 8955 and 8956 */
|
2023-04-17 01:02:21 -07:00
|
|
|
#define FLOWSPEC_LEN_LIMIT 0xf0
|
|
|
|
#define FLOWSPEC_OP_EOL 0x80
|
|
|
|
#define FLOWSPEC_OP_AND 0x40
|
|
|
|
#define FLOWSPEC_OP_LEN_MASK 0x30
|
|
|
|
#define FLOWSPEC_OP_LEN_SHIFT 4
|
2023-04-03 03:48:00 -07:00
|
|
|
#define FLOWSPEC_OP_LEN(op) \
|
|
|
|
(1 << (((op) & FLOWSPEC_OP_LEN_MASK) >> FLOWSPEC_OP_LEN_SHIFT))
|
2023-04-17 01:02:21 -07:00
|
|
|
#define FLOWSPEC_OP_NUM_LT 0x04
|
|
|
|
#define FLOWSPEC_OP_NUM_GT 0x02
|
|
|
|
#define FLOWSPEC_OP_NUM_EQ 0x01
|
|
|
|
#define FLOWSPEC_OP_NUM_LE (FLOWSPEC_OP_NUM_LT | FLOWSPEC_OP_NUM_EQ)
|
|
|
|
#define FLOWSPEC_OP_NUM_GE (FLOWSPEC_OP_NUM_GT | FLOWSPEC_OP_NUM_EQ)
|
|
|
|
#define FLOWSPEC_OP_NUM_NOT (FLOWSPEC_OP_NUM_GT | FLOWSPEC_OP_NUM_LT)
|
|
|
|
#define FLOWSPEC_OP_NUM_MASK 0x07
|
|
|
|
#define FLOWSPEC_OP_BIT_NOT 0x02
|
|
|
|
#define FLOWSPEC_OP_BIT_MATCH 0x01
|
|
|
|
#define FLOWSPEC_OP_BIT_MASK 0x03
|
2023-04-03 03:48:00 -07:00
|
|
|
|
|
|
|
#define FLOWSPEC_TYPE_MIN 1
|
|
|
|
#define FLOWSPEC_TYPE_DEST 1
|
|
|
|
#define FLOWSPEC_TYPE_SOURCE 2
|
|
|
|
#define FLOWSPEC_TYPE_PROTO 3
|
|
|
|
#define FLOWSPEC_TYPE_PORT 4
|
|
|
|
#define FLOWSPEC_TYPE_DST_PORT 5
|
|
|
|
#define FLOWSPEC_TYPE_SRC_PORT 6
|
|
|
|
#define FLOWSPEC_TYPE_ICMP_TYPE 7
|
|
|
|
#define FLOWSPEC_TYPE_ICMP_CODE 8
|
|
|
|
#define FLOWSPEC_TYPE_TCP_FLAGS 9
|
|
|
|
#define FLOWSPEC_TYPE_PKT_LEN 10
|
|
|
|
#define FLOWSPEC_TYPE_DSCP 11
|
|
|
|
#define FLOWSPEC_TYPE_FRAG 12
|
|
|
|
#define FLOWSPEC_TYPE_FLOW 13
|
2023-04-17 01:02:21 -07:00
|
|
|
#define FLOWSPEC_TYPE_MAX 14
|
2023-04-03 03:48:00 -07:00
|
|
|
|
2024-01-23 08:08:35 -08:00
|
|
|
#define FLOWSPEC_TCP_FLAG_STRING "FSRPAUEW"
|
|
|
|
#define FLOWSPEC_FRAG_STRING4 "DIFL"
|
|
|
|
#define FLOWSPEC_FRAG_STRING6 " IFL"
|
2023-04-18 05:11:27 -07:00
|
|
|
|
2004-07-27 08:26:45 -07:00
|
|
|
struct filter_prefix {
|
|
|
|
struct bgpd_addr addr;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t op;
|
|
|
|
uint8_t len;
|
|
|
|
uint8_t len_min;
|
|
|
|
uint8_t len_max;
|
2004-07-27 08:26:45 -07:00
|
|
|
};
|
|
|
|
|
2012-11-13 01:47:20 -08:00
|
|
|
struct filter_nexthop {
|
|
|
|
struct bgpd_addr addr;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t flags;
|
2012-11-13 01:47:20 -08:00
|
|
|
#define FILTER_NEXTHOP_ADDR 1
|
|
|
|
#define FILTER_NEXTHOP_NEIGHBOR 2
|
|
|
|
};
|
|
|
|
|
2004-02-06 12:18:18 -08:00
|
|
|
struct filter_match {
|
2010-03-05 07:25:00 -08:00
|
|
|
struct filter_prefix prefix;
|
2012-11-13 01:47:20 -08:00
|
|
|
struct filter_nexthop nexthop;
|
2010-03-05 07:25:00 -08:00
|
|
|
struct filter_as as;
|
2010-05-17 09:08:20 -07:00
|
|
|
struct filter_aslen aslen;
|
2019-06-17 04:02:19 -07:00
|
|
|
struct community community[MAX_COMM_MATCH];
|
2018-02-09 17:24:28 -08:00
|
|
|
struct filter_prefixset prefixset;
|
2018-09-29 01:11:11 -07:00
|
|
|
struct filter_originset originset;
|
2023-01-24 06:13:11 -08:00
|
|
|
struct filter_vs ovs;
|
|
|
|
struct filter_vs avs;
|
2022-05-31 02:45:33 -07:00
|
|
|
int maxcomm;
|
|
|
|
int maxextcomm;
|
|
|
|
int maxlargecomm;
|
2004-02-06 12:18:18 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct filter_rule {
|
2004-06-20 11:35:11 -07:00
|
|
|
TAILQ_ENTRY(filter_rule) entry;
|
2009-06-05 18:10:29 -07:00
|
|
|
char rib[PEER_DESCR_LEN];
|
2004-02-06 12:18:18 -08:00
|
|
|
struct filter_peers peer;
|
|
|
|
struct filter_match match;
|
2004-11-23 05:07:01 -08:00
|
|
|
struct filter_set_head set;
|
2023-03-09 23:57:15 -08:00
|
|
|
#define RDE_FILTER_SKIP_PEERID 0
|
2015-11-06 08:23:26 -08:00
|
|
|
#define RDE_FILTER_SKIP_GROUPID 1
|
|
|
|
#define RDE_FILTER_SKIP_REMOTE_AS 2
|
2023-03-09 23:57:15 -08:00
|
|
|
#define RDE_FILTER_SKIP_COUNT 3
|
2018-11-14 06:03:36 -08:00
|
|
|
struct filter_rule *skip[RDE_FILTER_SKIP_COUNT];
|
2004-12-23 07:08:43 -08:00
|
|
|
enum filter_actions action;
|
|
|
|
enum directions dir;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t quick;
|
2004-11-23 05:07:01 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum action_types {
|
|
|
|
ACTION_SET_LOCALPREF,
|
2005-03-14 09:32:04 -08:00
|
|
|
ACTION_SET_RELATIVE_LOCALPREF,
|
2004-11-23 05:07:01 -08:00
|
|
|
ACTION_SET_MED,
|
2005-03-14 09:32:04 -08:00
|
|
|
ACTION_SET_RELATIVE_MED,
|
2005-04-12 07:32:00 -07:00
|
|
|
ACTION_SET_WEIGHT,
|
|
|
|
ACTION_SET_RELATIVE_WEIGHT,
|
2004-11-23 05:07:01 -08:00
|
|
|
ACTION_SET_PREPEND_SELF,
|
|
|
|
ACTION_SET_PREPEND_PEER,
|
2019-02-04 10:53:10 -08:00
|
|
|
ACTION_SET_AS_OVERRIDE,
|
2004-11-23 05:07:01 -08:00
|
|
|
ACTION_SET_NEXTHOP,
|
2020-11-05 03:51:13 -08:00
|
|
|
ACTION_SET_NEXTHOP_REF,
|
2004-11-23 05:07:01 -08:00
|
|
|
ACTION_SET_NEXTHOP_REJECT,
|
|
|
|
ACTION_SET_NEXTHOP_BLACKHOLE,
|
2005-03-11 04:54:19 -08:00
|
|
|
ACTION_SET_NEXTHOP_NOMODIFY,
|
2006-04-04 05:03:26 -07:00
|
|
|
ACTION_SET_NEXTHOP_SELF,
|
2006-02-09 13:05:09 -08:00
|
|
|
ACTION_DEL_COMMUNITY,
|
2018-12-06 04:38:00 -08:00
|
|
|
ACTION_SET_COMMUNITY,
|
2005-06-29 02:43:25 -07:00
|
|
|
ACTION_PFTABLE,
|
2005-07-01 02:19:24 -07:00
|
|
|
ACTION_PFTABLE_ID,
|
2005-06-29 02:43:25 -07:00
|
|
|
ACTION_RTLABEL,
|
2009-11-26 05:40:43 -08:00
|
|
|
ACTION_RTLABEL_ID,
|
|
|
|
ACTION_SET_ORIGIN
|
2004-11-23 05:07:01 -08:00
|
|
|
};
|
|
|
|
|
2018-06-25 07:28:33 -07:00
|
|
|
struct nexthop;
|
2004-11-23 05:07:01 -08:00
|
|
|
struct filter_set {
|
2005-07-01 06:38:14 -07:00
|
|
|
TAILQ_ENTRY(filter_set) entry;
|
2004-11-23 05:07:01 -08:00
|
|
|
union {
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t prepend;
|
|
|
|
uint16_t id;
|
|
|
|
uint32_t metric;
|
2018-06-25 07:28:33 -07:00
|
|
|
int32_t relative;
|
|
|
|
struct bgpd_addr nexthop;
|
2020-11-05 03:51:13 -08:00
|
|
|
struct nexthop *nh_ref;
|
2019-06-17 04:02:19 -07:00
|
|
|
struct community community;
|
2018-06-25 07:28:33 -07:00
|
|
|
char pftable[PFTABLE_LEN];
|
2022-09-23 08:50:41 -07:00
|
|
|
char rtlabel[ROUTELABEL_LEN];
|
2022-02-06 01:51:19 -08:00
|
|
|
uint8_t origin;
|
|
|
|
} action;
|
2004-12-23 07:08:43 -08:00
|
|
|
enum action_types type;
|
2004-02-06 12:18:18 -08:00
|
|
|
};
|
|
|
|
|
2018-09-18 08:14:07 -07:00
|
|
|
struct roa_set {
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t as; /* must be first */
|
|
|
|
uint32_t maxlen; /* change type for better struct layout */
|
2018-09-18 08:14:07 -07:00
|
|
|
};
|
|
|
|
|
2018-02-09 17:24:28 -08:00
|
|
|
struct prefixset_item {
|
2018-09-20 00:46:39 -07:00
|
|
|
struct filter_prefix p;
|
|
|
|
RB_ENTRY(prefixset_item) entry;
|
2018-02-09 17:24:28 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct prefixset {
|
|
|
|
int sflags;
|
2018-09-06 22:43:33 -07:00
|
|
|
char name[SET_NAME_LEN];
|
2018-09-20 00:46:39 -07:00
|
|
|
struct prefixset_tree psitems;
|
2020-12-29 07:30:34 -08:00
|
|
|
struct roa_tree roaitems;
|
2018-02-09 17:24:28 -08:00
|
|
|
SIMPLEQ_ENTRY(prefixset) entry;
|
|
|
|
};
|
|
|
|
|
2018-09-20 04:45:59 -07:00
|
|
|
struct as_set {
|
|
|
|
char name[SET_NAME_LEN];
|
|
|
|
SIMPLEQ_ENTRY(as_set) entry;
|
|
|
|
struct set_table *set;
|
2020-12-29 23:29:56 -08:00
|
|
|
time_t lastchange;
|
2018-09-20 04:45:59 -07:00
|
|
|
int dirty;
|
|
|
|
};
|
|
|
|
|
2022-11-18 02:17:23 -08:00
|
|
|
struct aspa_set {
|
|
|
|
time_t expires;
|
|
|
|
uint32_t as;
|
|
|
|
uint32_t num;
|
|
|
|
uint32_t *tas;
|
|
|
|
RB_ENTRY(aspa_set) entry;
|
|
|
|
};
|
|
|
|
|
2023-01-17 08:09:01 -08:00
|
|
|
struct aspa_prep {
|
|
|
|
size_t datasize;
|
|
|
|
uint32_t entries;
|
|
|
|
};
|
|
|
|
|
2019-02-11 07:44:25 -08:00
|
|
|
struct l3vpn {
|
|
|
|
SIMPLEQ_ENTRY(l3vpn) entry;
|
2010-05-17 08:49:29 -07:00
|
|
|
char descr[PEER_DESCR_LEN];
|
|
|
|
char ifmpe[IFNAMSIZ];
|
|
|
|
struct filter_set_head import;
|
|
|
|
struct filter_set_head export;
|
|
|
|
struct network_head net_l;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint64_t rd;
|
2010-05-17 08:49:29 -07:00
|
|
|
u_int rtableid;
|
|
|
|
u_int label;
|
|
|
|
int flags;
|
|
|
|
};
|
|
|
|
|
2009-06-03 21:46:42 -07:00
|
|
|
struct rde_rib {
|
|
|
|
SIMPLEQ_ENTRY(rde_rib) entry;
|
|
|
|
char name[PEER_DESCR_LEN];
|
2010-05-03 06:09:38 -07:00
|
|
|
u_int rtableid;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint16_t id;
|
|
|
|
uint16_t flags;
|
2009-06-03 21:46:42 -07:00
|
|
|
};
|
|
|
|
SIMPLEQ_HEAD(rib_names, rde_rib);
|
|
|
|
extern struct rib_names ribnames;
|
|
|
|
|
2010-05-03 06:09:38 -07:00
|
|
|
/* rde_rib flags */
|
2017-01-24 16:11:07 -08:00
|
|
|
#define F_RIB_LOCAL 0x0001
|
2010-05-03 06:09:38 -07:00
|
|
|
#define F_RIB_NOEVALUATE 0x0002
|
|
|
|
#define F_RIB_NOFIB 0x0004
|
|
|
|
#define F_RIB_NOFIBSYNC 0x0008
|
|
|
|
|
2007-04-23 06:04:24 -07:00
|
|
|
/* 4-byte magic AS number */
|
|
|
|
#define AS_TRANS 23456
|
2018-09-29 01:11:11 -07:00
|
|
|
/* AS_NONE for origin validation */
|
|
|
|
#define AS_NONE 0
|
2007-04-23 06:04:24 -07:00
|
|
|
|
2009-12-01 06:28:05 -08:00
|
|
|
struct rde_memstats {
|
2019-02-19 01:13:23 -08:00
|
|
|
long long path_cnt;
|
|
|
|
long long path_refs;
|
|
|
|
long long prefix_cnt;
|
|
|
|
long long rib_cnt;
|
|
|
|
long long pt_cnt[AID_MAX];
|
2023-03-28 05:06:15 -07:00
|
|
|
long long pt_size[AID_MAX];
|
2019-02-19 01:13:23 -08:00
|
|
|
long long nexthop_cnt;
|
|
|
|
long long aspath_cnt;
|
|
|
|
long long aspath_size;
|
2019-06-17 04:02:19 -07:00
|
|
|
long long comm_cnt;
|
|
|
|
long long comm_nmemb;
|
|
|
|
long long comm_size;
|
|
|
|
long long comm_refs;
|
2019-02-19 01:13:23 -08:00
|
|
|
long long attr_cnt;
|
|
|
|
long long attr_refs;
|
|
|
|
long long attr_data;
|
|
|
|
long long attr_dcnt;
|
|
|
|
long long aset_cnt;
|
|
|
|
long long aset_size;
|
|
|
|
long long aset_nmemb;
|
|
|
|
long long pset_cnt;
|
|
|
|
long long pset_size;
|
2009-12-01 06:28:05 -08:00
|
|
|
};
|
|
|
|
|
2011-09-18 02:31:25 -07:00
|
|
|
#define MRT_FILE_LEN 512
|
|
|
|
#define MRT2MC(x) ((struct mrt_config *)(x))
|
|
|
|
|
|
|
|
enum mrt_type {
|
|
|
|
MRT_NONE,
|
|
|
|
MRT_TABLE_DUMP,
|
|
|
|
MRT_TABLE_DUMP_MP,
|
|
|
|
MRT_TABLE_DUMP_V2,
|
|
|
|
MRT_ALL_IN,
|
|
|
|
MRT_ALL_OUT,
|
|
|
|
MRT_UPDATE_IN,
|
|
|
|
MRT_UPDATE_OUT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum mrt_state {
|
|
|
|
MRT_STATE_RUNNING,
|
|
|
|
MRT_STATE_OPEN,
|
|
|
|
MRT_STATE_REOPEN,
|
|
|
|
MRT_STATE_REMOVE
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mrt {
|
|
|
|
char rib[PEER_DESCR_LEN];
|
|
|
|
LIST_ENTRY(mrt) entry;
|
2024-11-21 05:29:52 -08:00
|
|
|
struct msgbuf *wbuf;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t peer_id;
|
|
|
|
uint32_t group_id;
|
2024-11-21 05:28:34 -08:00
|
|
|
int fd;
|
2011-09-18 02:31:25 -07:00
|
|
|
enum mrt_type type;
|
|
|
|
enum mrt_state state;
|
2022-02-06 01:51:19 -08:00
|
|
|
uint16_t seqnum;
|
2011-09-18 02:31:25 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mrt_config {
|
|
|
|
struct mrt conf;
|
|
|
|
char name[MRT_FILE_LEN]; /* base file name */
|
|
|
|
char file[MRT_FILE_LEN]; /* actual file name */
|
|
|
|
time_t ReopenTimer;
|
2013-05-11 07:42:28 -07:00
|
|
|
int ReopenTimerInterval;
|
2011-09-18 02:31:25 -07:00
|
|
|
};
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
/* prototypes */
|
2003-12-25 16:14:04 -08:00
|
|
|
/* bgpd.c */
|
|
|
|
void send_nexthop_update(struct kroute_nexthop *);
|
2022-02-06 01:51:19 -08:00
|
|
|
void send_imsg_session(int, pid_t, void *, uint16_t);
|
2010-05-17 08:49:29 -07:00
|
|
|
int send_network(int, struct network_config *,
|
2022-07-28 06:11:48 -07:00
|
|
|
struct filter_set_head *);
|
2022-07-23 03:24:00 -07:00
|
|
|
int bgpd_oknexthop(struct kroute_full *);
|
2024-09-04 08:06:36 -07:00
|
|
|
int bgpd_has_bgpnh(void);
|
2015-07-20 09:10:37 -07:00
|
|
|
void set_pollfd(struct pollfd *, struct imsgbuf *);
|
|
|
|
int handle_pollfd(struct pollfd *, struct imsgbuf *);
|
2003-12-25 16:14:04 -08:00
|
|
|
|
2011-09-18 02:31:25 -07:00
|
|
|
/* control.c */
|
2023-02-09 05:43:23 -08:00
|
|
|
int control_imsg_relay(struct imsg *, struct peer *);
|
2003-12-17 03:46:54 -08:00
|
|
|
|
2004-02-10 15:10:23 -08:00
|
|
|
/* config.c */
|
2015-07-16 11:26:04 -07:00
|
|
|
struct bgpd_config *new_config(void);
|
2019-03-06 23:42:36 -08:00
|
|
|
void copy_config(struct bgpd_config *, struct bgpd_config *);
|
2022-07-20 05:43:27 -07:00
|
|
|
void network_free(struct network *);
|
2023-04-18 05:11:27 -07:00
|
|
|
struct flowspec_config *flowspec_alloc(uint8_t, int);
|
|
|
|
void flowspec_free(struct flowspec_config *);
|
2019-08-05 01:46:55 -07:00
|
|
|
void free_l3vpns(struct l3vpn_head *);
|
2019-03-06 23:42:36 -08:00
|
|
|
void free_config(struct bgpd_config *);
|
|
|
|
void free_prefixsets(struct prefixset_head *);
|
|
|
|
void free_rde_prefixsets(struct rde_prefixset_head *);
|
|
|
|
void free_prefixtree(struct prefixset_tree *);
|
2020-12-29 07:30:34 -08:00
|
|
|
void free_roatree(struct roa_tree *);
|
2022-11-18 02:17:23 -08:00
|
|
|
void free_aspa(struct aspa_set *);
|
|
|
|
void free_aspatree(struct aspa_tree *);
|
2021-02-16 00:29:16 -08:00
|
|
|
void free_rtrs(struct rtr_config_head *);
|
2019-03-06 23:42:36 -08:00
|
|
|
void filterlist_free(struct filter_head *);
|
2022-02-06 01:51:19 -08:00
|
|
|
int host(const char *, struct bgpd_addr *, uint8_t *);
|
|
|
|
uint32_t get_bgpid(void);
|
2022-07-20 05:43:27 -07:00
|
|
|
void expand_networks(struct bgpd_config *, struct network_head *);
|
2018-09-20 00:46:39 -07:00
|
|
|
RB_PROTOTYPE(prefixset_tree, prefixset_item, entry, prefixset_cmp);
|
2020-12-29 07:30:34 -08:00
|
|
|
RB_PROTOTYPE(roa_tree, roa, entry, roa_cmp);
|
2022-11-18 02:17:23 -08:00
|
|
|
RB_PROTOTYPE(aspa_tree, aspa_set, entry, aspa_cmp);
|
2023-04-18 05:11:27 -07:00
|
|
|
RB_PROTOTYPE(flowspec_tree, flowspec_config, entry, flowspec_config_cmp);
|
2004-02-10 15:10:23 -08:00
|
|
|
|
2003-12-22 07:22:13 -08:00
|
|
|
/* kroute.c */
|
2022-06-05 05:43:13 -07:00
|
|
|
int kr_init(int *, uint8_t);
|
2022-09-21 14:12:03 -07:00
|
|
|
int kr_default_prio(void);
|
|
|
|
int kr_check_prio(long long);
|
2022-06-05 05:43:13 -07:00
|
|
|
int ktable_update(u_int, char *, int);
|
2010-05-03 06:09:38 -07:00
|
|
|
void ktable_preload(void);
|
2022-06-05 05:43:13 -07:00
|
|
|
void ktable_postload(void);
|
2010-05-03 06:09:38 -07:00
|
|
|
int ktable_exists(u_int, u_int *);
|
2022-06-05 05:43:13 -07:00
|
|
|
int kr_change(u_int, struct kroute_full *);
|
|
|
|
int kr_delete(u_int, struct kroute_full *);
|
2019-07-22 23:26:44 -07:00
|
|
|
int kr_flush(u_int);
|
2022-06-09 09:45:19 -07:00
|
|
|
void kr_shutdown(void);
|
2022-06-05 05:43:13 -07:00
|
|
|
void kr_fib_couple(u_int);
|
|
|
|
void kr_fib_couple_all(void);
|
|
|
|
void kr_fib_decouple(u_int);
|
|
|
|
void kr_fib_decouple_all(void);
|
|
|
|
void kr_fib_prio_set(uint8_t);
|
2022-06-09 09:45:19 -07:00
|
|
|
int kr_dispatch_msg(void);
|
|
|
|
int kr_nexthop_add(uint32_t, struct bgpd_addr *);
|
|
|
|
void kr_nexthop_delete(uint32_t, struct bgpd_addr *);
|
2004-06-25 13:08:46 -07:00
|
|
|
void kr_show_route(struct imsg *);
|
2004-10-19 05:02:49 -07:00
|
|
|
void kr_ifinfo(char *);
|
2022-02-06 01:51:19 -08:00
|
|
|
void kr_net_reload(u_int, uint64_t, struct network_head *);
|
2006-03-22 05:30:35 -08:00
|
|
|
int kr_reload(void);
|
2019-02-18 01:58:19 -08:00
|
|
|
int get_mpe_config(const char *, u_int *, u_int *);
|
2023-10-16 03:25:45 -07:00
|
|
|
uint8_t mask2prefixlen(sa_family_t, struct sockaddr *);
|
2004-06-22 13:28:58 -07:00
|
|
|
|
2011-09-18 02:31:25 -07:00
|
|
|
/* log.c */
|
2017-05-28 13:14:15 -07:00
|
|
|
void log_peer_info(const struct peer_config *, const char *, ...)
|
|
|
|
__attribute__((__format__ (printf, 2, 3)));
|
2016-06-06 08:59:10 -07:00
|
|
|
void log_peer_warn(const struct peer_config *, const char *, ...)
|
|
|
|
__attribute__((__format__ (printf, 2, 3)));
|
|
|
|
void log_peer_warnx(const struct peer_config *, const char *, ...)
|
|
|
|
__attribute__((__format__ (printf, 2, 3)));
|
2004-01-01 15:46:47 -08:00
|
|
|
|
2011-09-18 02:31:25 -07:00
|
|
|
/* mrt.c */
|
|
|
|
void mrt_write(struct mrt *);
|
|
|
|
void mrt_clean(struct mrt *);
|
|
|
|
void mrt_init(struct imsgbuf *, struct imsgbuf *);
|
2019-02-14 05:13:33 -08:00
|
|
|
time_t mrt_timeout(struct mrt_head *);
|
2011-09-18 02:31:25 -07:00
|
|
|
void mrt_reconfigure(struct mrt_head *);
|
|
|
|
void mrt_handler(struct mrt_head *);
|
|
|
|
struct mrt *mrt_get(struct mrt_head *, struct mrt *);
|
2019-03-06 23:42:36 -08:00
|
|
|
void mrt_mergeconfig(struct mrt_head *, struct mrt_head *);
|
2004-05-07 03:06:15 -07:00
|
|
|
|
2005-06-25 12:24:37 -07:00
|
|
|
/* name2id.c */
|
2022-02-06 01:51:19 -08:00
|
|
|
uint16_t rtlabel_name2id(const char *);
|
|
|
|
const char *rtlabel_id2name(uint16_t);
|
|
|
|
void rtlabel_unref(uint16_t);
|
|
|
|
uint16_t rtlabel_ref(uint16_t);
|
|
|
|
uint16_t pftable_name2id(const char *);
|
|
|
|
const char *pftable_id2name(uint16_t);
|
|
|
|
void pftable_unref(uint16_t);
|
|
|
|
uint16_t pftable_ref(uint16_t);
|
2005-07-01 02:19:24 -07:00
|
|
|
|
2011-09-18 02:31:25 -07:00
|
|
|
/* parse.y */
|
2022-07-28 06:11:48 -07:00
|
|
|
int cmdline_symset(char *);
|
2021-02-16 00:29:16 -08:00
|
|
|
struct prefixset *find_prefixset(char *, struct prefixset_head *);
|
|
|
|
struct bgpd_config *parse_config(char *, struct peer_head *,
|
|
|
|
struct rtr_config_head *);
|
2011-09-18 02:31:25 -07:00
|
|
|
|
|
|
|
/* pftable.c */
|
|
|
|
int pftable_exists(const char *);
|
|
|
|
int pftable_add(const char *);
|
|
|
|
int pftable_clear_all(void);
|
|
|
|
int pftable_addr_add(struct pftable_msg *);
|
|
|
|
int pftable_addr_remove(struct pftable_msg *);
|
|
|
|
int pftable_commit(void);
|
2005-06-29 02:43:25 -07:00
|
|
|
|
|
|
|
/* rde_filter.c */
|
2020-02-14 05:54:31 -08:00
|
|
|
void filterset_free(struct filter_set_head *);
|
|
|
|
int filterset_cmp(struct filter_set *, struct filter_set *);
|
|
|
|
void filterset_move(struct filter_set_head *, struct filter_set_head *);
|
|
|
|
void filterset_copy(struct filter_set_head *, struct filter_set_head *);
|
2006-04-26 10:13:14 -07:00
|
|
|
const char *filterset_name(enum action_types);
|
2005-06-25 12:24:37 -07:00
|
|
|
|
2018-09-06 22:43:33 -07:00
|
|
|
/* rde_sets.c */
|
|
|
|
struct as_set *as_sets_lookup(struct as_set_head *, const char *);
|
2018-09-20 04:45:59 -07:00
|
|
|
struct as_set *as_sets_new(struct as_set_head *, const char *, size_t,
|
|
|
|
size_t);
|
2018-09-06 22:43:33 -07:00
|
|
|
void as_sets_free(struct as_set_head *);
|
|
|
|
void as_sets_mark_dirty(struct as_set_head *, struct as_set_head *);
|
2022-02-06 01:51:19 -08:00
|
|
|
int as_set_match(const struct as_set *, uint32_t);
|
2018-09-20 04:45:59 -07:00
|
|
|
|
|
|
|
struct set_table *set_new(size_t, size_t);
|
2019-06-17 06:35:42 -07:00
|
|
|
void set_free(struct set_table *);
|
2018-09-20 04:45:59 -07:00
|
|
|
int set_add(struct set_table *, void *, size_t);
|
|
|
|
void *set_get(struct set_table *, size_t *);
|
|
|
|
void set_prep(struct set_table *);
|
2022-02-06 01:51:19 -08:00
|
|
|
void *set_match(const struct set_table *, uint32_t);
|
2018-09-20 04:45:59 -07:00
|
|
|
int set_equal(const struct set_table *,
|
|
|
|
const struct set_table *);
|
2020-12-29 23:29:56 -08:00
|
|
|
size_t set_nmemb(const struct set_table *);
|
2018-09-06 22:43:33 -07:00
|
|
|
|
2019-03-06 23:42:36 -08:00
|
|
|
/* rde_trie.c */
|
2022-02-06 01:51:19 -08:00
|
|
|
int trie_add(struct trie_head *, struct bgpd_addr *, uint8_t, uint8_t,
|
|
|
|
uint8_t);
|
2020-12-29 07:30:34 -08:00
|
|
|
int trie_roa_add(struct trie_head *, struct roa *);
|
2019-03-06 23:42:36 -08:00
|
|
|
void trie_free(struct trie_head *);
|
2022-02-06 01:51:19 -08:00
|
|
|
int trie_match(struct trie_head *, struct bgpd_addr *, uint8_t, int);
|
|
|
|
int trie_roa_check(struct trie_head *, struct bgpd_addr *, uint8_t,
|
|
|
|
uint32_t);
|
2019-03-06 23:42:36 -08:00
|
|
|
void trie_dump(struct trie_head *);
|
|
|
|
int trie_equal(struct trie_head *, struct trie_head *);
|
|
|
|
|
2020-01-09 03:51:18 -08:00
|
|
|
/* timer.c */
|
|
|
|
time_t getmonotime(void);
|
|
|
|
|
2006-01-03 14:19:59 -08:00
|
|
|
/* util.c */
|
2024-03-22 08:41:34 -07:00
|
|
|
char *ibuf_get_string(struct ibuf *, size_t);
|
2006-01-03 14:19:59 -08:00
|
|
|
const char *log_addr(const struct bgpd_addr *);
|
|
|
|
const char *log_in6addr(const struct in6_addr *);
|
2019-02-18 01:43:57 -08:00
|
|
|
const char *log_sockaddr(struct sockaddr *, socklen_t);
|
2022-02-06 01:51:19 -08:00
|
|
|
const char *log_as(uint32_t);
|
|
|
|
const char *log_rd(uint64_t);
|
2022-05-25 09:03:34 -07:00
|
|
|
const char *log_ext_subtype(int, uint8_t);
|
2020-05-10 06:38:46 -07:00
|
|
|
const char *log_reason(const char *);
|
2024-01-30 05:50:08 -08:00
|
|
|
const char *log_aspath_error(int);
|
2024-01-10 05:31:09 -08:00
|
|
|
const char *log_roa(struct roa *);
|
|
|
|
const char *log_aspa(struct aspa_set *);
|
2021-02-16 00:29:16 -08:00
|
|
|
const char *log_rtr_error(enum rtr_error);
|
2023-01-04 06:33:30 -08:00
|
|
|
const char *log_policy(enum role);
|
2024-03-22 00:19:28 -07:00
|
|
|
const char *log_capability(uint8_t);
|
2024-01-30 05:50:08 -08:00
|
|
|
int aspath_asprint(char **, struct ibuf *);
|
2022-02-06 01:51:19 -08:00
|
|
|
uint32_t aspath_extract(const void *, int);
|
2024-01-30 05:50:08 -08:00
|
|
|
int aspath_verify(struct ibuf *, int, int);
|
2018-07-20 07:58:20 -07:00
|
|
|
#define AS_ERR_LEN -1
|
|
|
|
#define AS_ERR_TYPE -2
|
|
|
|
#define AS_ERR_BAD -3
|
|
|
|
#define AS_ERR_SOFT -4
|
2024-01-30 05:50:08 -08:00
|
|
|
struct ibuf *aspath_inflate(struct ibuf *);
|
2023-04-17 01:02:21 -07:00
|
|
|
int extract_prefix(const u_char *, int, void *, uint8_t, uint8_t);
|
2024-01-23 08:13:35 -08:00
|
|
|
int nlri_get_prefix(struct ibuf *, struct bgpd_addr *, uint8_t *);
|
|
|
|
int nlri_get_prefix6(struct ibuf *, struct bgpd_addr *, uint8_t *);
|
|
|
|
int nlri_get_vpn4(struct ibuf *, struct bgpd_addr *, uint8_t *,
|
|
|
|
int);
|
|
|
|
int nlri_get_vpn6(struct ibuf *, struct bgpd_addr *, uint8_t *,
|
|
|
|
int);
|
2011-09-20 14:19:06 -07:00
|
|
|
int prefix_compare(const struct bgpd_addr *,
|
|
|
|
const struct bgpd_addr *, int);
|
2018-09-04 05:00:29 -07:00
|
|
|
void inet4applymask(struct in_addr *, const struct in_addr *, int);
|
2009-06-12 09:42:53 -07:00
|
|
|
void inet6applymask(struct in6_addr *, const struct in6_addr *,
|
|
|
|
int);
|
2022-06-19 03:30:09 -07:00
|
|
|
void applymask(struct bgpd_addr *, const struct bgpd_addr *, int);
|
2022-02-06 01:51:19 -08:00
|
|
|
const char *aid2str(uint8_t);
|
|
|
|
int aid2afi(uint8_t, uint16_t *, uint8_t *);
|
|
|
|
int afi2aid(uint16_t, uint8_t, uint8_t *);
|
|
|
|
sa_family_t aid2af(uint8_t);
|
|
|
|
int af2aid(sa_family_t, uint8_t, uint8_t *);
|
|
|
|
struct sockaddr *addr2sa(const struct bgpd_addr *, uint16_t, socklen_t *);
|
|
|
|
void sa2addr(struct sockaddr *, struct bgpd_addr *, uint16_t *);
|
2019-02-18 04:35:08 -08:00
|
|
|
const char * get_baudrate(unsigned long long, char *);
|
2005-06-25 12:24:37 -07:00
|
|
|
|
2023-04-17 01:02:21 -07:00
|
|
|
/* flowspec.c */
|
|
|
|
int flowspec_valid(const uint8_t *, int, int);
|
|
|
|
int flowspec_cmp(const uint8_t *, int, const uint8_t *, int, int);
|
|
|
|
int flowspec_get_component(const uint8_t *, int, int, int,
|
|
|
|
const uint8_t **, int *);
|
|
|
|
int flowspec_get_addr(const uint8_t *, int, int, int, struct bgpd_addr *,
|
|
|
|
uint8_t *, uint8_t *);
|
|
|
|
const char *flowspec_fmt_label(int);
|
|
|
|
const char *flowspec_fmt_num_op(const uint8_t *, int, int *);
|
|
|
|
const char *flowspec_fmt_bin_op(const uint8_t *, int, int *, const char *);
|
|
|
|
|
2016-09-02 07:00:29 -07:00
|
|
|
static const char * const log_procnames[] = {
|
|
|
|
"parent",
|
|
|
|
"SE",
|
2021-02-16 00:29:16 -08:00
|
|
|
"RDE",
|
|
|
|
"RTR"
|
2016-09-02 07:00:29 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* logmsg.c and needed by bgpctl */
|
|
|
|
static const char * const statenames[] = {
|
|
|
|
"None",
|
|
|
|
"Idle",
|
|
|
|
"Connect",
|
|
|
|
"Active",
|
|
|
|
"OpenSent",
|
|
|
|
"OpenConfirm",
|
|
|
|
"Established"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char * const msgtypenames[] = {
|
|
|
|
"NONE",
|
|
|
|
"OPEN",
|
|
|
|
"UPDATE",
|
|
|
|
"NOTIFICATION",
|
|
|
|
"KEEPALIVE",
|
|
|
|
"RREFRESH"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char * const eventnames[] = {
|
|
|
|
"None",
|
|
|
|
"Start",
|
|
|
|
"Stop",
|
|
|
|
"Connection opened",
|
|
|
|
"Connection closed",
|
|
|
|
"Connection open failed",
|
|
|
|
"Fatal error",
|
|
|
|
"ConnectRetryTimer expired",
|
|
|
|
"HoldTimer expired",
|
|
|
|
"KeepaliveTimer expired",
|
2020-12-23 05:20:47 -08:00
|
|
|
"SendHoldTimer expired",
|
2016-09-02 07:00:29 -07:00
|
|
|
"OPEN message received",
|
|
|
|
"KEEPALIVE message received",
|
|
|
|
"UPDATE message received",
|
|
|
|
"NOTIFICATION received"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char * const errnames[] = {
|
|
|
|
"none",
|
|
|
|
"Header error",
|
|
|
|
"error in OPEN message",
|
|
|
|
"error in UPDATE message",
|
|
|
|
"HoldTimer expired",
|
|
|
|
"Finite State Machine error",
|
2021-05-27 01:27:48 -07:00
|
|
|
"Cease",
|
|
|
|
"error in ROUTE-REFRESH message"
|
2016-09-02 07:00:29 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char * const suberr_header_names[] = {
|
|
|
|
"none",
|
|
|
|
"synchronization error",
|
|
|
|
"wrong length",
|
|
|
|
"unknown message type"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char * const suberr_open_names[] = {
|
|
|
|
"none",
|
|
|
|
"version mismatch",
|
|
|
|
"AS unacceptable",
|
|
|
|
"BGPID invalid",
|
|
|
|
"optional parameter error",
|
|
|
|
"authentication error",
|
|
|
|
"unacceptable holdtime",
|
|
|
|
"unsupported capability",
|
2022-06-27 06:26:51 -07:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
"role mismatch",
|
2016-09-02 07:00:29 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char * const suberr_fsm_names[] = {
|
|
|
|
"unspecified error",
|
|
|
|
"received unexpected message in OpenSent",
|
|
|
|
"received unexpected message in OpenConfirm",
|
|
|
|
"received unexpected message in Established"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char * const suberr_update_names[] = {
|
|
|
|
"none",
|
|
|
|
"attribute list error",
|
|
|
|
"unknown well-known attribute",
|
|
|
|
"well-known attribute missing",
|
|
|
|
"attribute flags error",
|
|
|
|
"attribute length wrong",
|
|
|
|
"origin unacceptable",
|
|
|
|
"loop detected",
|
|
|
|
"nexthop unacceptable",
|
|
|
|
"optional attribute error",
|
|
|
|
"network unacceptable",
|
|
|
|
"AS-Path unacceptable"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char * const suberr_cease_names[] = {
|
|
|
|
"none",
|
2020-01-21 03:10:24 -08:00
|
|
|
"received max-prefix exceeded",
|
2016-09-02 07:00:29 -07:00
|
|
|
"administratively down",
|
|
|
|
"peer unconfigured",
|
|
|
|
"administrative reset",
|
|
|
|
"connection rejected",
|
|
|
|
"other config change",
|
|
|
|
"collision",
|
2020-01-21 03:10:24 -08:00
|
|
|
"resource exhaustion",
|
|
|
|
"hard reset",
|
|
|
|
"sent max-prefix exceeded"
|
2016-09-02 07:00:29 -07:00
|
|
|
};
|
|
|
|
|
2021-05-27 01:27:48 -07:00
|
|
|
static const char * const suberr_rrefresh_names[] = {
|
|
|
|
"none",
|
|
|
|
"invalid message length"
|
|
|
|
};
|
|
|
|
|
2016-09-02 07:00:29 -07:00
|
|
|
static const char * const ctl_res_strerror[] = {
|
|
|
|
"no error",
|
|
|
|
"no such neighbor",
|
|
|
|
"permission denied",
|
|
|
|
"neighbor does not have this capability",
|
|
|
|
"config file has errors, reload failed",
|
|
|
|
"previous reload still running",
|
|
|
|
"out of memory",
|
|
|
|
"not a cloned peer",
|
2018-11-10 03:19:01 -08:00
|
|
|
"peer still active, down peer first",
|
2023-08-30 01:16:28 -07:00
|
|
|
"no such RIB",
|
|
|
|
"operation not supported",
|
2016-09-02 07:00:29 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char * const timernames[] = {
|
|
|
|
"None",
|
|
|
|
"ConnectRetryTimer",
|
|
|
|
"KeepaliveTimer",
|
|
|
|
"HoldTimer",
|
2020-12-23 05:20:47 -08:00
|
|
|
"SendHoldTimer",
|
2016-09-02 07:00:29 -07:00
|
|
|
"IdleHoldTimer",
|
|
|
|
"IdleHoldResetTimer",
|
|
|
|
"CarpUndemoteTimer",
|
2021-02-16 00:29:16 -08:00
|
|
|
"RestartTimer",
|
|
|
|
"RTR RefreshTimer",
|
|
|
|
"RTR RetryTimer",
|
|
|
|
"RTR ExpireTimer",
|
2023-03-28 05:15:23 -07:00
|
|
|
"RTR ActiveTimer",
|
2016-09-02 07:00:29 -07:00
|
|
|
""
|
|
|
|
};
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
#endif /* __BGPD_H__ */
|