2007-12-23 10:26:13 -08:00
|
|
|
/* $OpenBSD: bgpd.h,v 1.221 2007/12/23 18:26:13 henning 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>
|
2005-06-13 14:16:18 -07:00
|
|
|
#include <net/route.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>
|
2004-04-25 18:59:26 -07:00
|
|
|
#include <net/pfkeyv2.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>
|
|
|
|
|
|
|
|
#define BGP_VERSION 4
|
|
|
|
#define BGP_PORT 179
|
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"
|
2003-12-25 09:07:24 -08:00
|
|
|
#define PEER_DESCR_LEN 32
|
2004-05-07 03:06:15 -07:00
|
|
|
#define PFTABLE_LEN 16
|
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
|
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
|
2003-12-25 09:07:24 -08:00
|
|
|
#define RT_BUF_SIZE 16384
|
2005-03-15 02:18:39 -08:00
|
|
|
#define MAX_RTSOCK_BUF 128 * 1024
|
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
|
|
|
|
2003-12-25 09:07:24 -08:00
|
|
|
#define BGPD_FLAG_NO_FIB_UPDATE 0x0001
|
2004-03-01 08:02:01 -08:00
|
|
|
#define BGPD_FLAG_NO_EVALUATE 0x0002
|
2004-05-21 08:36:40 -07:00
|
|
|
#define BGPD_FLAG_REFLECTOR 0x0004
|
2005-04-28 06:54:45 -07:00
|
|
|
#define BGPD_FLAG_REDIST_STATIC 0x0008
|
|
|
|
#define BGPD_FLAG_REDIST_CONNECTED 0x0010
|
2005-06-09 08:32:03 -07:00
|
|
|
#define BGPD_FLAG_REDIST6_STATIC 0x0020
|
|
|
|
#define BGPD_FLAG_REDIST6_CONNECTED 0x0040
|
2006-03-22 05:30:35 -08:00
|
|
|
#define BGPD_FLAG_NEXTHOP_BGP 0x0080
|
|
|
|
#define BGPD_FLAG_NEXTHOP_DEFAULT 0x1000
|
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
|
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"
|
|
|
|
|
2004-07-05 09:54:53 -07:00
|
|
|
#define F_BGPD_INSERTED 0x0001
|
|
|
|
#define F_KERNEL 0x0002
|
|
|
|
#define F_CONNECTED 0x0004
|
|
|
|
#define F_NEXTHOP 0x0008
|
|
|
|
#define F_DOWN 0x0010
|
|
|
|
#define F_STATIC 0x0020
|
2005-06-24 07:01:52 -07:00
|
|
|
#define F_DYNAMIC 0x0040
|
2004-07-05 09:54:53 -07:00
|
|
|
#define F_REJECT 0x0080
|
|
|
|
#define F_BLACKHOLE 0x0100
|
2005-06-24 07:01:52 -07:00
|
|
|
#define F_LONGER 0x0200
|
2006-03-22 02:18:49 -08:00
|
|
|
#define F_CTL_DETAIL 0x1000 /* only used by bgpctl */
|
2006-08-23 01:13:04 -07:00
|
|
|
#define F_CTL_ADJ_IN 0x2000
|
|
|
|
#define F_CTL_ADJ_OUT 0x4000
|
2004-01-09 05:47:07 -08:00
|
|
|
|
2007-01-26 09:40:48 -08:00
|
|
|
/*
|
|
|
|
* Limit the number of control messages generated by the RDE and queued in
|
|
|
|
* session enigine. The RDE limit defines how many imsg are generated in
|
|
|
|
* on poll round. The if the SE limit is hit the RDE control socket will no
|
|
|
|
* longer be polled.
|
|
|
|
*/
|
|
|
|
#define RDE_RUNNER_ROUNDS 100
|
|
|
|
#define SESSION_CTL_QUEUE_MAX 10000
|
|
|
|
|
2003-12-20 10:32:22 -08:00
|
|
|
enum {
|
|
|
|
PROC_MAIN,
|
|
|
|
PROC_SE,
|
|
|
|
PROC_RDE
|
|
|
|
} bgpd_process;
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
enum reconf_action {
|
|
|
|
RECONF_NONE,
|
|
|
|
RECONF_KEEP,
|
|
|
|
RECONF_REINIT,
|
|
|
|
RECONF_DELETE
|
|
|
|
};
|
|
|
|
|
2003-12-21 14:16:53 -08:00
|
|
|
struct buf {
|
2004-06-20 11:35:11 -07:00
|
|
|
TAILQ_ENTRY(buf) entry;
|
2003-12-21 14:16:53 -08:00
|
|
|
u_char *buf;
|
2005-02-01 13:36:01 -08:00
|
|
|
size_t size;
|
|
|
|
size_t wpos;
|
|
|
|
size_t rpos;
|
2004-06-20 10:49:46 -07:00
|
|
|
int fd;
|
2003-12-21 14:16:53 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct msgbuf {
|
2005-04-26 08:18:22 -07:00
|
|
|
TAILQ_HEAD(, buf) bufs;
|
2003-12-21 14:16:53 -08:00
|
|
|
u_int32_t queued;
|
2004-04-29 12:56:04 -07:00
|
|
|
int fd;
|
2003-12-21 14:16:53 -08:00
|
|
|
};
|
|
|
|
|
2004-01-04 10:51:23 -08:00
|
|
|
struct bgpd_addr {
|
|
|
|
sa_family_t af;
|
|
|
|
union {
|
|
|
|
struct in_addr v4;
|
|
|
|
struct in6_addr v6;
|
2004-01-11 14:01:13 -08:00
|
|
|
u_int8_t addr8[16];
|
|
|
|
u_int16_t addr16[8];
|
|
|
|
u_int32_t addr32[4];
|
2004-01-04 10:51:23 -08:00
|
|
|
} ba; /* 128-bit address */
|
2004-02-16 09:24:04 -08:00
|
|
|
u_int32_t scope_id; /* iface scope id for v6 */
|
2004-07-05 09:54:53 -07:00
|
|
|
#define v4 ba.v4
|
|
|
|
#define v6 ba.v6
|
|
|
|
#define addr8 ba.addr8
|
|
|
|
#define addr16 ba.addr16
|
|
|
|
#define addr32 ba.addr32
|
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 {
|
|
|
|
TAILQ_ENTRY(listen_addr) entry;
|
|
|
|
struct sockaddr_storage sa;
|
|
|
|
int fd;
|
|
|
|
enum reconf_action reconf;
|
|
|
|
u_int8_t flags;
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
struct bgpd_config {
|
2005-04-28 06:54:45 -07:00
|
|
|
struct filter_set_head connectset;
|
2005-06-09 08:32:03 -07:00
|
|
|
struct filter_set_head connectset6;
|
2005-04-28 06:54:45 -07:00
|
|
|
struct filter_set_head staticset;
|
2005-06-09 08:32:03 -07:00
|
|
|
struct filter_set_head staticset6;
|
2004-12-23 07:08:43 -08:00
|
|
|
struct listen_addrs *listen_addrs;
|
2006-03-15 03:33:42 -08:00
|
|
|
char *csock;
|
2006-01-24 02:03:44 -08:00
|
|
|
char *rcsock;
|
2004-06-06 10:38:10 -07:00
|
|
|
int opts;
|
2004-12-23 07:08:43 -08:00
|
|
|
int flags;
|
|
|
|
int log;
|
2006-11-28 08:39:34 -08:00
|
|
|
u_int rtableid;
|
2004-06-06 10:38:10 -07:00
|
|
|
u_int32_t bgpid;
|
|
|
|
u_int32_t clusterid;
|
2007-04-23 06:04:24 -07:00
|
|
|
u_int32_t as;
|
|
|
|
u_int16_t short_as;
|
2004-06-06 10:38:10 -07:00
|
|
|
u_int16_t holdtime;
|
|
|
|
u_int16_t min_holdtime;
|
2003-12-17 03:46:54 -08:00
|
|
|
};
|
|
|
|
|
2003-12-28 06:34:30 -08:00
|
|
|
struct buf_read {
|
2003-12-24 15:14:23 -08:00
|
|
|
u_char buf[READ_BUF_SIZE];
|
|
|
|
u_char *rptr;
|
2005-03-23 02:46:26 -08:00
|
|
|
size_t wpos;
|
2003-12-17 03:46:54 -08:00
|
|
|
};
|
|
|
|
|
2004-01-13 05:45:49 -08:00
|
|
|
enum announce_type {
|
2004-02-01 11:46:05 -08:00
|
|
|
ANNOUNCE_UNDEF,
|
2004-01-13 05:45:49 -08:00
|
|
|
ANNOUNCE_SELF,
|
|
|
|
ANNOUNCE_NONE,
|
2004-07-30 07:44:30 -07:00
|
|
|
ANNOUNCE_DEFAULT_ROUTE,
|
2004-01-13 05:45:49 -08:00
|
|
|
ANNOUNCE_ALL
|
|
|
|
};
|
|
|
|
|
2004-02-26 06:00:33 -08:00
|
|
|
enum enforce_as {
|
|
|
|
ENFORCE_AS_UNDEF,
|
|
|
|
ENFORCE_AS_OFF,
|
|
|
|
ENFORCE_AS_ON
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2004-04-27 15:42:13 -07:00
|
|
|
struct peer_auth {
|
|
|
|
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];
|
2004-04-27 15:06:54 -07:00
|
|
|
u_int32_t spi_in;
|
|
|
|
u_int32_t spi_out;
|
2004-12-23 07:08:43 -08:00
|
|
|
enum auth_method method;
|
|
|
|
u_int8_t md5key_len;
|
2004-04-27 15:06:54 -07:00
|
|
|
u_int8_t auth_alg_in;
|
|
|
|
u_int8_t auth_alg_out;
|
|
|
|
u_int8_t auth_keylen_in;
|
|
|
|
u_int8_t auth_keylen_out;
|
|
|
|
u_int8_t enc_alg_in;
|
|
|
|
u_int8_t enc_alg_out;
|
|
|
|
u_int8_t enc_keylen_in;
|
|
|
|
u_int8_t enc_keylen_out;
|
2004-04-25 18:59:26 -07:00
|
|
|
};
|
|
|
|
|
2004-11-18 09:07:38 -08:00
|
|
|
struct capabilities {
|
2007-03-16 07:06:57 -07:00
|
|
|
u_int8_t mp_v4; /* multiprotocol extensions, RFC 4760 */
|
2004-11-18 09:07:38 -08:00
|
|
|
u_int8_t mp_v6;
|
|
|
|
u_int8_t refresh; /* route refresh, RFC 2918 */
|
2007-05-15 07:35:30 -07:00
|
|
|
u_int8_t restart; /* graceful restart, RFC 4724 */
|
|
|
|
u_int8_t as4byte; /* draft-ietf-idr-as4bytes-13 */
|
2004-11-18 09:07:38 -08:00
|
|
|
};
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
struct peer_config {
|
2004-01-27 08:49:53 -08:00
|
|
|
struct bgpd_addr remote_addr;
|
|
|
|
struct bgpd_addr local_addr;
|
2004-12-23 07:08:43 -08:00
|
|
|
struct peer_auth auth;
|
|
|
|
struct capabilities capabilities;
|
|
|
|
char group[PEER_DESCR_LEN];
|
|
|
|
char descr[PEER_DESCR_LEN];
|
|
|
|
char if_depend[IFNAMSIZ];
|
2006-06-17 07:06:09 -07:00
|
|
|
char demote_group[IFNAMSIZ];
|
2004-12-23 07:08:43 -08:00
|
|
|
u_int32_t id;
|
|
|
|
u_int32_t groupid;
|
2007-04-23 06:04:24 -07:00
|
|
|
u_int32_t remote_as;
|
2004-02-08 17:46:34 -08:00
|
|
|
u_int32_t max_prefix;
|
2004-01-13 05:45:49 -08:00
|
|
|
enum announce_type announce_type;
|
2004-02-26 06:00:33 -08:00
|
|
|
enum enforce_as enforce_as;
|
2004-12-23 07:08:43 -08:00
|
|
|
enum reconf_action reconf_action;
|
2006-08-04 05:01:48 -07:00
|
|
|
u_int16_t max_prefix_restart;
|
2004-12-23 07:39:22 -08:00
|
|
|
u_int16_t holdtime;
|
|
|
|
u_int16_t min_holdtime;
|
2004-12-23 07:08:43 -08:00
|
|
|
u_int8_t template;
|
|
|
|
u_int8_t remote_masklen;
|
|
|
|
u_int8_t cloned;
|
|
|
|
u_int8_t ebgp; /* 1 = ebgp, 0 = ibgp */
|
|
|
|
u_int8_t distance; /* 1 = direct, >1 = multihop */
|
|
|
|
u_int8_t passive;
|
2005-10-19 03:42:06 -07:00
|
|
|
u_int8_t down;
|
2004-11-18 09:07:38 -08:00
|
|
|
u_int8_t announce_capa;
|
2004-05-21 08:36:40 -07:00
|
|
|
u_int8_t reflector_client;
|
2006-02-10 06:34:40 -08:00
|
|
|
u_int8_t softreconfig_in;
|
|
|
|
u_int8_t softreconfig_out;
|
2006-12-05 04:08:13 -08:00
|
|
|
u_int8_t ttlsec; /* TTL security hack */
|
2003-12-17 03:46:54 -08:00
|
|
|
};
|
|
|
|
|
2004-01-17 11:35:35 -08:00
|
|
|
struct network_config {
|
|
|
|
struct bgpd_addr prefix;
|
2004-11-23 05:07:01 -08:00
|
|
|
struct filter_set_head attrset;
|
2004-12-23 07:08:43 -08:00
|
|
|
u_int8_t prefixlen;
|
2004-01-17 11:35:35 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
TAILQ_HEAD(network_head, network);
|
|
|
|
|
|
|
|
struct network {
|
|
|
|
struct network_config net;
|
2004-06-20 11:35:11 -07:00
|
|
|
TAILQ_ENTRY(network) entry;
|
2004-01-17 11:35:35 -08:00
|
|
|
};
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
/* ipc messages */
|
|
|
|
|
|
|
|
#define IMSG_HEADER_SIZE sizeof(struct imsg_hdr)
|
2003-12-25 09:07:24 -08:00
|
|
|
#define MAX_IMSGSIZE 8192
|
2003-12-17 03:46:54 -08:00
|
|
|
|
2004-06-20 10:49:46 -07:00
|
|
|
struct imsg_fd {
|
|
|
|
TAILQ_ENTRY(imsg_fd) entry;
|
2004-04-29 12:56:04 -07:00
|
|
|
int fd;
|
2004-06-20 10:49:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct imsgbuf {
|
2004-07-04 19:13:43 -07:00
|
|
|
TAILQ_HEAD(fds, imsg_fd) fds;
|
2004-06-20 10:49:46 -07:00
|
|
|
struct buf_read r;
|
|
|
|
struct msgbuf w;
|
2004-12-23 07:08:43 -08:00
|
|
|
int fd;
|
|
|
|
pid_t pid;
|
2003-12-21 15:26:37 -08:00
|
|
|
};
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
enum imsg_type {
|
|
|
|
IMSG_NONE,
|
|
|
|
IMSG_RECONF_CONF,
|
|
|
|
IMSG_RECONF_PEER,
|
2004-02-07 03:42:30 -08:00
|
|
|
IMSG_RECONF_FILTER,
|
2004-06-06 10:38:10 -07:00
|
|
|
IMSG_RECONF_LISTENER,
|
2003-12-17 03:46:54 -08:00
|
|
|
IMSG_RECONF_DONE,
|
|
|
|
IMSG_UPDATE,
|
|
|
|
IMSG_UPDATE_ERR,
|
2004-11-23 05:07:01 -08:00
|
|
|
IMSG_SESSION_ADD,
|
2003-12-17 03:46:54 -08:00
|
|
|
IMSG_SESSION_UP,
|
|
|
|
IMSG_SESSION_DOWN,
|
2004-07-03 10:19:59 -07:00
|
|
|
IMSG_MRT_OPEN,
|
|
|
|
IMSG_MRT_REOPEN,
|
|
|
|
IMSG_MRT_CLOSE,
|
2003-12-22 07:22:13 -08:00
|
|
|
IMSG_KROUTE_CHANGE,
|
2003-12-25 15:22:13 -08:00
|
|
|
IMSG_KROUTE_DELETE,
|
2005-05-27 10:52:10 -07:00
|
|
|
IMSG_KROUTE6_CHANGE,
|
|
|
|
IMSG_KROUTE6_DELETE,
|
2003-12-25 15:22:13 -08:00
|
|
|
IMSG_NEXTHOP_ADD,
|
|
|
|
IMSG_NEXTHOP_REMOVE,
|
2004-01-01 15:46:47 -08:00
|
|
|
IMSG_NEXTHOP_UPDATE,
|
2004-05-07 03:06:15 -07:00
|
|
|
IMSG_PFTABLE_ADD,
|
|
|
|
IMSG_PFTABLE_REMOVE,
|
|
|
|
IMSG_PFTABLE_COMMIT,
|
2004-05-21 04:48:56 -07:00
|
|
|
IMSG_NETWORK_ADD,
|
|
|
|
IMSG_NETWORK_REMOVE,
|
|
|
|
IMSG_NETWORK_FLUSH,
|
2004-11-23 05:07:01 -08:00
|
|
|
IMSG_NETWORK_DONE,
|
|
|
|
IMSG_FILTER_SET,
|
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,
|
2004-01-09 11:08:50 -08:00
|
|
|
IMSG_CTL_KROUTE,
|
2005-05-27 10:52:10 -07:00
|
|
|
IMSG_CTL_KROUTE6,
|
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,
|
|
|
|
IMSG_CTL_SHOW_RIB_AS,
|
2004-04-26 20:53:42 -07:00
|
|
|
IMSG_CTL_SHOW_RIB_PREFIX,
|
2006-03-22 02:18:49 -08:00
|
|
|
IMSG_CTL_SHOW_RIB_ATTR,
|
2007-03-28 05:33:32 -07:00
|
|
|
IMSG_CTL_SHOW_RIB_COMMUNITY,
|
2004-05-21 04:48:56 -07:00
|
|
|
IMSG_CTL_SHOW_NETWORK,
|
2005-09-20 06:31:53 -07:00
|
|
|
IMSG_CTL_SHOW_NETWORK6,
|
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,
|
2004-10-19 05:02:49 -07:00
|
|
|
IMSG_REFRESH,
|
2006-06-17 07:06:09 -07:00
|
|
|
IMSG_IFINFO,
|
|
|
|
IMSG_DEMOTE
|
2003-12-17 03:46:54 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct imsg_hdr {
|
|
|
|
u_int32_t peerid;
|
2004-01-09 05:47:07 -08:00
|
|
|
pid_t pid;
|
2004-12-23 07:08:43 -08:00
|
|
|
enum imsg_type type;
|
|
|
|
u_int16_t len;
|
2003-12-17 03:46:54 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct imsg {
|
|
|
|
struct imsg_hdr hdr;
|
2003-12-20 12:25:20 -08:00
|
|
|
void *data;
|
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,
|
|
|
|
CTL_RES_NOMEM
|
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,
|
|
|
|
ERR_CEASE
|
|
|
|
};
|
|
|
|
|
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,
|
|
|
|
ERR_CEASE_RSRC_EXHAUST
|
|
|
|
};
|
|
|
|
|
2003-12-22 07:22:13 -08:00
|
|
|
struct kroute {
|
2004-01-27 13:56:21 -08:00
|
|
|
struct in_addr prefix;
|
|
|
|
struct in_addr nexthop;
|
2004-07-05 09:54:53 -07:00
|
|
|
u_int16_t flags;
|
2005-06-13 14:16:18 -07:00
|
|
|
u_int16_t labelid;
|
2004-01-09 05:47:07 -08:00
|
|
|
u_short ifindex;
|
2004-12-23 07:39:22 -08:00
|
|
|
u_int8_t prefixlen;
|
2003-12-22 07:22:13 -08:00
|
|
|
};
|
|
|
|
|
2004-06-22 00:22:31 -07:00
|
|
|
struct kroute6 {
|
|
|
|
struct in6_addr prefix;
|
|
|
|
struct in6_addr nexthop;
|
2004-07-05 09:54:53 -07:00
|
|
|
u_int16_t flags;
|
2005-06-13 14:16:18 -07:00
|
|
|
u_int16_t labelid;
|
2004-06-22 00:22:31 -07:00
|
|
|
u_short ifindex;
|
2004-12-23 07:39:22 -08:00
|
|
|
u_int8_t prefixlen;
|
2004-06-22 00:22:31 -07:00
|
|
|
};
|
|
|
|
|
2003-12-25 15:15:58 -08:00
|
|
|
struct kroute_nexthop {
|
2004-06-22 00:22:31 -07:00
|
|
|
union {
|
|
|
|
struct kroute kr4;
|
|
|
|
struct kroute6 kr6;
|
|
|
|
} kr;
|
2004-12-23 07:08:43 -08:00
|
|
|
struct bgpd_addr nexthop;
|
|
|
|
struct bgpd_addr gateway;
|
|
|
|
u_int8_t valid;
|
|
|
|
u_int8_t connected;
|
2003-12-25 15:15:58 -08:00
|
|
|
};
|
|
|
|
|
2004-01-17 10:05:46 -08:00
|
|
|
struct kif {
|
2004-01-17 10:27:19 -08:00
|
|
|
char ifname[IFNAMSIZ];
|
2007-09-11 10:07:59 -07:00
|
|
|
u_int64_t baudrate;
|
2004-12-23 07:08:43 -08:00
|
|
|
int flags;
|
|
|
|
u_short ifindex;
|
2004-01-18 11:15:00 -08:00
|
|
|
u_int8_t media_type;
|
2004-01-17 13:06:55 -08:00
|
|
|
u_int8_t link_state;
|
2004-01-21 19:07:51 -08:00
|
|
|
u_int8_t nh_reachable; /* for nexthop verification */
|
2004-01-17 10:05:46 -08:00
|
|
|
};
|
|
|
|
|
2004-01-11 12:13:00 -08:00
|
|
|
struct session_up {
|
|
|
|
struct bgpd_addr local_addr;
|
|
|
|
struct bgpd_addr remote_addr;
|
2004-11-18 09:17:56 -08:00
|
|
|
struct capabilities capa_announced;
|
|
|
|
struct capabilities capa_received;
|
2004-12-23 07:39:22 -08:00
|
|
|
u_int32_t remote_bgpid;
|
2007-04-23 06:04:24 -07:00
|
|
|
u_int16_t short_as;
|
2004-01-11 12:13:00 -08:00
|
|
|
};
|
|
|
|
|
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];
|
2004-05-07 03:06:15 -07:00
|
|
|
u_int8_t len;
|
|
|
|
};
|
|
|
|
|
2004-01-10 18:35:13 -08:00
|
|
|
struct ctl_show_nexthop {
|
|
|
|
struct bgpd_addr addr;
|
|
|
|
u_int8_t valid;
|
2005-03-14 04:25:50 -08:00
|
|
|
struct kif kif;
|
2004-01-10 18:35:13 -08:00
|
|
|
};
|
|
|
|
|
2004-12-23 09:26:51 -08:00
|
|
|
struct ctl_neighbor {
|
|
|
|
struct bgpd_addr addr;
|
|
|
|
char descr[PEER_DESCR_LEN];
|
2007-12-23 10:26:13 -08:00
|
|
|
int show_timers;
|
2004-12-23 09:26:51 -08:00
|
|
|
};
|
|
|
|
|
2005-06-13 14:16:18 -07:00
|
|
|
struct kroute_label {
|
|
|
|
struct kroute kr;
|
|
|
|
char label[RTLABEL_LEN];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct kroute6_label {
|
|
|
|
struct kroute6 kr;
|
|
|
|
char label[RTLABEL_LEN];
|
|
|
|
};
|
|
|
|
|
2004-07-05 09:54:53 -07:00
|
|
|
#define F_RIB_ELIGIBLE 0x01
|
|
|
|
#define F_RIB_ACTIVE 0x02
|
|
|
|
#define F_RIB_INTERNAL 0x04
|
|
|
|
#define F_RIB_ANNOUNCE 0x08
|
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];
|
2004-02-26 08:16:41 -08:00
|
|
|
time_t lastchange;
|
2006-03-22 02:18:49 -08:00
|
|
|
u_int32_t remote_id;
|
2004-02-26 08:16:41 -08:00
|
|
|
u_int32_t local_pref;
|
|
|
|
u_int32_t med;
|
2006-01-20 08:40:17 -08:00
|
|
|
u_int32_t prefix_cnt;
|
|
|
|
u_int32_t active_cnt;
|
|
|
|
u_int32_t adjrib_cnt;
|
2004-12-23 07:08:43 -08:00
|
|
|
u_int16_t aspath_len;
|
2005-06-28 05:12:34 -07:00
|
|
|
u_int16_t flags;
|
2004-02-26 08:16:41 -08:00
|
|
|
u_int8_t prefixlen;
|
|
|
|
u_int8_t origin;
|
|
|
|
/* plus a aspath_len bytes long aspath */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ctl_show_rib_prefix {
|
|
|
|
struct bgpd_addr prefix;
|
2004-12-23 07:08:43 -08:00
|
|
|
time_t lastchange;
|
2005-06-28 05:12:34 -07:00
|
|
|
u_int16_t flags;
|
2004-02-26 08:16:41 -08:00
|
|
|
u_int8_t prefixlen;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum as_spec {
|
|
|
|
AS_NONE,
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2004-11-19 06:43:56 -08:00
|
|
|
struct filter_as {
|
2004-02-26 08:16:41 -08:00
|
|
|
enum as_spec type;
|
2007-04-23 06:04:24 -07:00
|
|
|
u_int32_t as;
|
2004-02-26 08:16:41 -08:00
|
|
|
};
|
|
|
|
|
2007-03-28 05:33:32 -07:00
|
|
|
struct filter_community {
|
|
|
|
int as;
|
|
|
|
int type;
|
|
|
|
};
|
|
|
|
|
2006-06-15 03:04:40 -07:00
|
|
|
struct ctl_show_rib_request {
|
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;
|
2007-03-28 05:33:32 -07:00
|
|
|
struct filter_community community;
|
2006-08-23 01:13:04 -07:00
|
|
|
u_int32_t peerid;
|
2006-06-15 03:04:40 -07:00
|
|
|
pid_t pid;
|
|
|
|
u_int16_t flags;
|
2007-01-26 09:40:48 -08:00
|
|
|
enum imsg_type type;
|
2006-06-15 03:04:40 -07:00
|
|
|
sa_family_t af;
|
|
|
|
u_int8_t prefixlen;
|
|
|
|
};
|
|
|
|
|
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 {
|
|
|
|
u_int32_t peerid;
|
|
|
|
u_int32_t groupid;
|
|
|
|
};
|
|
|
|
|
2004-03-11 09:12:51 -08:00
|
|
|
/* special community type */
|
2004-07-05 09:54:53 -07:00
|
|
|
#define COMMUNITY_ERROR -1
|
|
|
|
#define COMMUNITY_ANY -2
|
2006-02-02 06:06:05 -08:00
|
|
|
#define COMMUNITY_NEIGHBOR_AS -3
|
2007-05-28 10:26:33 -07:00
|
|
|
#define COMMUNITY_UNSET -4
|
2004-07-05 09:54:53 -07:00
|
|
|
#define COMMUNITY_WELLKNOWN 0xffff
|
|
|
|
#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
|
|
|
|
2004-07-27 08:26:45 -07:00
|
|
|
struct filter_prefix {
|
|
|
|
struct bgpd_addr addr;
|
|
|
|
u_int8_t len;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct filter_prefixlen {
|
|
|
|
enum comp_ops op;
|
2004-12-23 07:08:43 -08:00
|
|
|
sa_family_t af;
|
2004-07-27 08:26:45 -07:00
|
|
|
u_int8_t len_min;
|
|
|
|
u_int8_t len_max;
|
|
|
|
};
|
|
|
|
|
2004-02-06 12:18:18 -08:00
|
|
|
struct filter_match {
|
2004-07-27 08:26:45 -07:00
|
|
|
struct filter_prefix prefix;
|
|
|
|
struct filter_prefixlen prefixlen;
|
2004-11-19 06:43:56 -08:00
|
|
|
struct filter_as as;
|
2004-07-27 08:26:45 -07:00
|
|
|
struct filter_community community;
|
2004-02-06 12:18:18 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
TAILQ_HEAD(filter_head, filter_rule);
|
|
|
|
|
|
|
|
struct filter_rule {
|
2004-06-20 11:35:11 -07:00
|
|
|
TAILQ_ENTRY(filter_rule) entry;
|
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;
|
2004-12-23 07:08:43 -08:00
|
|
|
enum filter_actions action;
|
|
|
|
enum directions dir;
|
|
|
|
u_int8_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,
|
|
|
|
ACTION_SET_NEXTHOP,
|
|
|
|
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,
|
2004-11-23 05:07:01 -08:00
|
|
|
ACTION_SET_COMMUNITY,
|
2006-02-09 13:05:09 -08:00
|
|
|
ACTION_DEL_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,
|
|
|
|
ACTION_RTLABEL_ID
|
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 {
|
|
|
|
u_int8_t prepend;
|
2005-06-29 02:43:25 -07:00
|
|
|
u_int16_t id;
|
2004-11-23 05:07:01 -08:00
|
|
|
u_int32_t metric;
|
2005-03-14 09:32:04 -08:00
|
|
|
int32_t relative;
|
2004-11-23 05:07:01 -08:00
|
|
|
struct bgpd_addr nexthop;
|
|
|
|
struct filter_community community;
|
|
|
|
char pftable[PFTABLE_LEN];
|
2005-06-29 02:43:25 -07:00
|
|
|
char rtlabel[RTLABEL_LEN];
|
2004-11-23 05:07:01 -08:00
|
|
|
} action;
|
2004-12-23 07:08:43 -08:00
|
|
|
enum action_types type;
|
2004-02-06 12:18:18 -08:00
|
|
|
};
|
|
|
|
|
2004-04-26 20:53:42 -07:00
|
|
|
struct rrefresh {
|
|
|
|
u_int16_t afi;
|
|
|
|
u_int8_t safi;
|
|
|
|
};
|
|
|
|
|
2006-01-03 14:49:17 -08:00
|
|
|
struct rde_memstats {
|
|
|
|
int64_t path_cnt;
|
|
|
|
int64_t prefix_cnt;
|
|
|
|
int64_t pt4_cnt;
|
|
|
|
int64_t pt6_cnt;
|
|
|
|
int64_t nexthop_cnt;
|
|
|
|
int64_t aspath_cnt;
|
|
|
|
int64_t aspath_size;
|
|
|
|
int64_t aspath_refs;
|
|
|
|
int64_t attr_cnt;
|
2006-01-05 08:00:07 -08:00
|
|
|
int64_t attr_refs;
|
2006-01-03 14:49:17 -08:00
|
|
|
int64_t attr_data;
|
2006-01-04 04:45:53 -08:00
|
|
|
int64_t attr_dcnt;
|
2006-01-03 14:49:17 -08:00
|
|
|
};
|
|
|
|
|
2007-03-16 07:06:57 -07:00
|
|
|
/* Address Family Numbers as per RFC 1700 */
|
2004-07-05 09:54:53 -07:00
|
|
|
#define AFI_IPv4 1
|
|
|
|
#define AFI_IPv6 2
|
|
|
|
#define AFI_ALL 0xffff
|
2004-04-10 10:27:28 -07:00
|
|
|
|
2007-03-16 07:06:57 -07:00
|
|
|
/* Subsequent Address Family Identifier as per RFC 4760 */
|
2004-11-18 07:40:58 -08:00
|
|
|
#define SAFI_NONE 0x00
|
|
|
|
#define SAFI_UNICAST 0x01
|
|
|
|
#define SAFI_MULTICAST 0x02
|
2004-07-05 09:54:53 -07:00
|
|
|
#define SAFI_ALL 0xff
|
2004-04-10 10:27:28 -07:00
|
|
|
|
2007-04-23 06:04:24 -07:00
|
|
|
/* 4-byte magic AS number */
|
|
|
|
#define AS_TRANS 23456
|
|
|
|
|
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 *);
|
2004-01-09 05:47:07 -08:00
|
|
|
void send_imsg_session(int, pid_t, void *, u_int16_t);
|
2005-05-27 10:52:10 -07:00
|
|
|
int bgpd_redistribute(int, struct kroute *, struct kroute6 *);
|
2006-03-22 05:30:35 -08:00
|
|
|
int bgpd_filternexthop(struct kroute *, struct kroute6 *);
|
2003-12-25 16:14:04 -08:00
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
/* buffer.c */
|
2005-02-01 13:36:01 -08:00
|
|
|
struct buf *buf_open(size_t);
|
2006-08-27 06:40:21 -07:00
|
|
|
struct buf *buf_grow(struct buf *, size_t);
|
2005-11-02 07:34:43 -08:00
|
|
|
int buf_add(struct buf *, const void *, size_t);
|
2005-02-01 13:36:01 -08:00
|
|
|
void *buf_reserve(struct buf *, size_t);
|
2003-12-21 14:16:53 -08:00
|
|
|
int buf_close(struct msgbuf *, struct buf *);
|
2004-07-03 10:19:59 -07:00
|
|
|
int buf_write(int, struct buf *);
|
2003-12-21 14:16:53 -08:00
|
|
|
void buf_free(struct buf *);
|
|
|
|
void msgbuf_init(struct msgbuf *);
|
|
|
|
void msgbuf_clear(struct msgbuf *);
|
|
|
|
int msgbuf_write(struct msgbuf *);
|
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
/* log.c */
|
|
|
|
void log_init(int);
|
|
|
|
void vlog(int, const char *, va_list);
|
2004-01-22 12:59:16 -08:00
|
|
|
void log_peer_warn(const struct peer_config *, const char *, ...);
|
|
|
|
void log_peer_warnx(const struct peer_config *, const char *, ...);
|
2004-01-21 19:18:03 -08:00
|
|
|
void log_warn(const char *, ...);
|
2004-01-22 11:13:56 -08:00
|
|
|
void log_warnx(const char *, ...);
|
|
|
|
void log_info(const char *, ...);
|
2004-01-22 13:08:59 -08:00
|
|
|
void log_debug(const char *, ...);
|
2006-04-25 01:44:08 -07:00
|
|
|
void fatal(const char *) __dead;
|
|
|
|
void fatalx(const char *) __dead;
|
2003-12-17 03:46:54 -08:00
|
|
|
|
|
|
|
/* parse.y */
|
|
|
|
int cmdline_symset(char *);
|
|
|
|
|
2004-02-10 15:10:23 -08:00
|
|
|
/* config.c */
|
2004-03-02 11:45:04 -08:00
|
|
|
int host(const char *, struct bgpd_addr *, u_int8_t *);
|
2004-02-10 15:10:23 -08:00
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
/* imsg.c */
|
2003-12-21 15:26:37 -08:00
|
|
|
void imsg_init(struct imsgbuf *, int);
|
2004-01-01 15:09:08 -08:00
|
|
|
int imsg_read(struct imsgbuf *);
|
2003-12-21 15:28:39 -08:00
|
|
|
int imsg_get(struct imsgbuf *, struct imsg *);
|
2004-09-16 10:58:13 -07:00
|
|
|
int imsg_compose(struct imsgbuf *, enum imsg_type, u_int32_t, pid_t, int,
|
2005-11-02 07:34:43 -08:00
|
|
|
const void *, u_int16_t);
|
2004-09-16 10:58:13 -07:00
|
|
|
struct buf *imsg_create(struct imsgbuf *, enum imsg_type, u_int32_t, pid_t,
|
2004-09-16 10:36:29 -07:00
|
|
|
u_int16_t);
|
2005-11-02 07:34:43 -08:00
|
|
|
int imsg_add(struct buf *, const void *, u_int16_t);
|
2004-02-16 06:26:29 -08:00
|
|
|
int imsg_close(struct imsgbuf *, struct buf *);
|
2003-12-17 03:46:54 -08:00
|
|
|
void imsg_free(struct imsg *);
|
2004-06-20 10:49:46 -07:00
|
|
|
int imsg_get_fd(struct imsgbuf *);
|
2003-12-17 03:46:54 -08:00
|
|
|
|
2003-12-22 07:22:13 -08:00
|
|
|
/* kroute.c */
|
2006-11-28 08:39:34 -08:00
|
|
|
int kr_init(int, u_int);
|
2005-06-13 14:16:18 -07:00
|
|
|
int kr_change(struct kroute_label *);
|
|
|
|
int kr_delete(struct kroute_label *);
|
|
|
|
int kr6_change(struct kroute6_label *);
|
|
|
|
int kr6_delete(struct kroute6_label *);
|
2004-06-25 13:08:46 -07:00
|
|
|
void kr_shutdown(void);
|
|
|
|
void kr_fib_couple(void);
|
|
|
|
void kr_fib_decouple(void);
|
|
|
|
int kr_dispatch_msg(void);
|
|
|
|
int kr_nexthop_add(struct bgpd_addr *);
|
|
|
|
void kr_nexthop_delete(struct bgpd_addr *);
|
|
|
|
void kr_show_route(struct imsg *);
|
2004-10-19 05:02:49 -07:00
|
|
|
void kr_ifinfo(char *);
|
2006-03-22 05:30:35 -08:00
|
|
|
int kr_reload(void);
|
2004-06-25 13:08:46 -07:00
|
|
|
in_addr_t prefixlen2mask(u_int8_t);
|
|
|
|
struct in6_addr *prefixlen2mask6(u_int8_t prefixlen);
|
|
|
|
void inet6applymask(struct in6_addr *, const struct in6_addr *,
|
2004-06-22 13:28:58 -07:00
|
|
|
int);
|
|
|
|
|
2004-01-01 15:46:47 -08:00
|
|
|
/* control.c */
|
2006-01-24 02:03:44 -08:00
|
|
|
void control_cleanup(const char *);
|
2004-01-09 05:47:07 -08:00
|
|
|
int control_imsg_relay(struct imsg *);
|
2004-01-01 15:46:47 -08:00
|
|
|
|
2004-05-07 03:06:15 -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-25 12:24:37 -07:00
|
|
|
/* name2id.c */
|
2005-11-02 07:34:43 -08:00
|
|
|
u_int16_t rtlabel_name2id(const char *);
|
2005-06-25 12:24:37 -07:00
|
|
|
const char *rtlabel_id2name(u_int16_t);
|
|
|
|
void rtlabel_unref(u_int16_t);
|
2005-06-29 02:43:25 -07:00
|
|
|
void rtlabel_ref(u_int16_t);
|
2005-11-02 07:34:43 -08:00
|
|
|
u_int16_t pftable_name2id(const char *);
|
2005-07-01 02:19:24 -07:00
|
|
|
const char *pftable_id2name(u_int16_t);
|
|
|
|
void pftable_unref(u_int16_t);
|
|
|
|
void pftable_ref(u_int16_t);
|
|
|
|
|
2005-06-29 02:43:25 -07:00
|
|
|
|
|
|
|
/* rde_filter.c */
|
2005-07-04 02:37:24 -07:00
|
|
|
void filterset_free(struct filter_set_head *);
|
|
|
|
int filterset_cmp(struct filter_set *, struct filter_set *);
|
2006-04-26 10:13:14 -07:00
|
|
|
const char *filterset_name(enum action_types);
|
2005-06-25 12:24:37 -07:00
|
|
|
|
2006-01-03 14:19:59 -08:00
|
|
|
/* util.c */
|
|
|
|
const char *log_addr(const struct bgpd_addr *);
|
|
|
|
const char *log_in6addr(const struct in6_addr *);
|
2007-04-23 06:04:24 -07:00
|
|
|
const char *log_sockaddr(struct sockaddr *);
|
|
|
|
const char *log_as(u_int32_t);
|
2006-01-03 14:19:59 -08:00
|
|
|
int aspath_snprint(char *, size_t, void *, u_int16_t);
|
|
|
|
int aspath_asprint(char **, void *, u_int16_t);
|
|
|
|
size_t aspath_strlen(void *, u_int16_t);
|
2005-06-25 12:24:37 -07:00
|
|
|
|
2003-12-17 03:46:54 -08:00
|
|
|
#endif /* __BGPD_H__ */
|