summaryrefslogtreecommitdiff
path: root/net/openbgpd/files/patch-bgpd_bgpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/openbgpd/files/patch-bgpd_bgpd.h')
-rw-r--r--net/openbgpd/files/patch-bgpd_bgpd.h324
1 files changed, 299 insertions, 25 deletions
diff --git a/net/openbgpd/files/patch-bgpd_bgpd.h b/net/openbgpd/files/patch-bgpd_bgpd.h
index d522bad36b14..c374b981553c 100644
--- a/net/openbgpd/files/patch-bgpd_bgpd.h
+++ b/net/openbgpd/files/patch-bgpd_bgpd.h
@@ -2,17 +2,25 @@ Index: bgpd/bgpd.h
===================================================================
RCS file: /home/cvs/private/hrs/openbgpd/bgpd/bgpd.h,v
retrieving revision 1.1.1.8
-retrieving revision 1.11
-diff -u -p -r1.1.1.8 -r1.11
+retrieving revision 1.12
+diff -u -p -r1.1.1.8 -r1.12
--- bgpd/bgpd.h 14 Feb 2010 20:19:57 -0000 1.1.1.8
-+++ bgpd/bgpd.h 10 Apr 2010 12:16:23 -0000 1.11
++++ bgpd/bgpd.h 2 Jul 2011 16:06:38 -0000 1.12
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.241 2009/06/12 16:42:53 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.255 2010/04/06 13:25:08 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
-@@ -30,11 +30,16 @@
+@@ -21,6 +21,7 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/queue.h>
++#include <sys/tree.h>
+ #include <net/route.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+@@ -30,11 +31,16 @@
#include <poll.h>
#include <stdarg.h>
@@ -30,7 +38,7 @@ diff -u -p -r1.1.1.8 -r1.11
#define BGPD_USER "_bgpd"
#define PEER_DESCR_LEN 32
#define PFTABLE_LEN 16
-@@ -42,8 +47,6 @@
+@@ -42,8 +48,6 @@
#define IPSEC_ENC_KEY_LEN 32
#define IPSEC_AUTH_KEY_LEN 20
@@ -39,7 +47,30 @@ diff -u -p -r1.1.1.8 -r1.11
#define MAX_PKTSIZE 4096
#define MIN_HOLDTIME 3
#define READ_BUF_SIZE 65535
-@@ -109,18 +112,74 @@ enum reconf_action {
+@@ -55,13 +59,8 @@
+ #define BGPD_OPT_NOACTION 0x0004
+ #define BGPD_OPT_FORCE_DEMOTE 0x0008
+
+-#define BGPD_FLAG_NO_FIB_UPDATE 0x0001
+ #define BGPD_FLAG_NO_EVALUATE 0x0002
+ #define BGPD_FLAG_REFLECTOR 0x0004
+-#define BGPD_FLAG_REDIST_STATIC 0x0008
+-#define BGPD_FLAG_REDIST_CONNECTED 0x0010
+-#define BGPD_FLAG_REDIST6_STATIC 0x0020
+-#define BGPD_FLAG_REDIST6_CONNECTED 0x0040
+ #define BGPD_FLAG_NEXTHOP_BGP 0x0080
+ #define BGPD_FLAG_NEXTHOP_DEFAULT 0x1000
+ #define BGPD_FLAG_DECISION_MASK 0x0f00
+@@ -83,6 +82,8 @@
+ #define F_REJECT 0x0080
+ #define F_BLACKHOLE 0x0100
+ #define F_LONGER 0x0200
++#define F_MPLS 0x0400
++#define F_REDISTRIBUTED 0x0800
+ #define F_CTL_DETAIL 0x1000 /* only used by bgpctl */
+ #define F_CTL_ADJ_IN 0x2000
+ #define F_CTL_ADJ_OUT 0x4000
+@@ -109,18 +110,74 @@ enum reconf_action {
RECONF_DELETE
};
@@ -118,7 +149,25 @@ diff -u -p -r1.1.1.8 -r1.11
#define addr8 ba.addr8
#define addr16 ba.addr16
#define addr32 ba.addr32
-@@ -205,11 +264,10 @@ struct peer_auth {
+@@ -141,17 +198,12 @@ TAILQ_HEAD(listen_addrs, listen_addr);
+ TAILQ_HEAD(filter_set_head, filter_set);
+
+ struct bgpd_config {
+- struct filter_set_head connectset;
+- struct filter_set_head connectset6;
+- struct filter_set_head staticset;
+- struct filter_set_head staticset6;
+ struct listen_addrs *listen_addrs;
+ char *csock;
+ char *rcsock;
+ int opts;
+ int flags;
+ int log;
+- u_int rtableid;
+ u_int32_t bgpid;
+ u_int32_t clusterid;
+ u_int32_t as;
+@@ -205,11 +257,10 @@ struct peer_auth {
};
struct capabilities {
@@ -134,7 +183,7 @@ diff -u -p -r1.1.1.8 -r1.11
};
struct peer_config {
-@@ -248,6 +306,7 @@ struct peer_config {
+@@ -248,21 +299,31 @@ struct peer_config {
u_int8_t ttlsec; /* TTL security hack */
u_int8_t flags;
u_int8_t pad[3];
@@ -142,15 +191,119 @@ diff -u -p -r1.1.1.8 -r1.11
};
#define PEERFLAG_TRANS_AS 0x01
-@@ -292,6 +351,7 @@ enum imsg_type {
+
++enum network_type {
++ NETWORK_DEFAULT,
++ NETWORK_STATIC,
++ NETWORK_CONNECTED
++};
++
+ struct network_config {
+ struct bgpd_addr prefix;
+ struct filter_set_head attrset;
++ u_int rtableid;
++ enum network_type type;
+ u_int8_t prefixlen;
++ u_int8_t old; /* used for reloading */
+ };
+
+ TAILQ_HEAD(network_head, network);
+
+ struct network {
+- struct network_config net;
+- TAILQ_ENTRY(network) entry;
++ struct network_config net;
++ TAILQ_ENTRY(network) entry;
+ };
+
+ enum imsg_type {
+@@ -276,7 +337,6 @@ enum imsg_type {
+ IMSG_CTL_NEIGHBOR_CLEAR,
+ IMSG_CTL_NEIGHBOR_RREFRESH,
+ IMSG_CTL_KROUTE,
+- IMSG_CTL_KROUTE6,
+ IMSG_CTL_KROUTE_ADDR,
+ IMSG_CTL_RESULT,
+ IMSG_CTL_SHOW_NEIGHBOR,
+@@ -288,10 +348,11 @@ enum imsg_type {
+ IMSG_CTL_SHOW_RIB_ATTR,
+ IMSG_CTL_SHOW_RIB_COMMUNITY,
+ IMSG_CTL_SHOW_NETWORK,
+- IMSG_CTL_SHOW_NETWORK6,
IMSG_CTL_SHOW_RIB_MEM,
IMSG_CTL_SHOW_TERSE,
IMSG_CTL_SHOW_TIMER,
+ IMSG_CTL_LOG_VERBOSE,
++ IMSG_CTL_SHOW_FIB_TABLES,
IMSG_NETWORK_ADD,
IMSG_NETWORK_REMOVE,
IMSG_NETWORK_FLUSH,
-@@ -400,14 +460,12 @@ struct kroute6 {
+@@ -302,6 +363,11 @@ enum imsg_type {
+ IMSG_RECONF_PEER,
+ IMSG_RECONF_FILTER,
+ IMSG_RECONF_LISTENER,
++ IMSG_RECONF_CTRL,
++ IMSG_RECONF_RDOMAIN,
++ IMSG_RECONF_RDOMAIN_EXPORT,
++ IMSG_RECONF_RDOMAIN_IMPORT,
++ IMSG_RECONF_RDOMAIN_DONE,
+ IMSG_RECONF_DONE,
+ IMSG_UPDATE,
+ IMSG_UPDATE_ERR,
+@@ -313,8 +379,6 @@ enum imsg_type {
+ IMSG_MRT_CLOSE,
+ IMSG_KROUTE_CHANGE,
+ IMSG_KROUTE_DELETE,
+- IMSG_KROUTE6_CHANGE,
+- IMSG_KROUTE6_DELETE,
+ IMSG_NEXTHOP_ADD,
+ IMSG_NEXTHOP_REMOVE,
+ IMSG_NEXTHOP_UPDATE,
+@@ -379,9 +443,43 @@ enum suberr_cease {
+ ERR_CEASE_RSRC_EXHAUST
+ };
+
++struct kroute_node;
++struct kroute6_node;
++struct knexthop_node;
++RB_HEAD(kroute_tree, kroute_node);
++RB_HEAD(kroute6_tree, kroute6_node);
++RB_HEAD(knexthop_tree, knexthop_node);
++
++struct ktable {
++ char descr[PEER_DESCR_LEN];
++ char ifmpe[IFNAMSIZ];
++ struct kroute_tree krt;
++ struct kroute6_tree krt6;
++ struct knexthop_tree knt;
++ struct network_head krn;
++ u_int rtableid;
++ u_int nhtableid; /* rdomain id for nexthop lookup */
++ u_int ifindex; /* ifindex of ifmpe */
++ int nhrefcnt; /* refcnt for nexthop table */
++ enum reconf_action state;
++ u_int8_t fib_conf; /* configured FIB sync flag */
++ u_int8_t fib_sync; /* is FIB synced with kernel? */
++};
++
++struct kroute_full {
++ struct bgpd_addr prefix;
++ struct bgpd_addr nexthop;
++ char label[RTLABEL_LEN];
++ u_int16_t flags;
++ u_short ifindex;
++ u_int8_t prefixlen;
++ u_int8_t priority;
++};
++
+ struct kroute {
+ struct in_addr prefix;
+ struct in_addr nexthop;
++ u_int32_t mplslabel;
+ u_int16_t flags;
+ u_int16_t labelid;
+ u_short ifindex;
+@@ -400,14 +498,12 @@ struct kroute6 {
};
struct kroute_nexthop {
@@ -167,7 +320,7 @@ diff -u -p -r1.1.1.8 -r1.11
};
struct kif {
-@@ -423,8 +481,7 @@ struct kif {
+@@ -423,8 +519,7 @@ struct kif {
struct session_up {
struct bgpd_addr local_addr;
struct bgpd_addr remote_addr;
@@ -177,7 +330,7 @@ diff -u -p -r1.1.1.8 -r1.11
u_int32_t remote_bgpid;
u_int16_t short_as;
};
-@@ -437,8 +494,13 @@ struct pftable_msg {
+@@ -437,8 +532,13 @@ struct pftable_msg {
struct ctl_show_nexthop {
struct bgpd_addr addr;
@@ -188,14 +341,66 @@ diff -u -p -r1.1.1.8 -r1.11
+ struct kroute6 kr6;
+ } kr;
+ u_int8_t valid;
-+ u_int8_t krvalid;;
++ u_int8_t krvalid;
};
struct ctl_neighbor {
-@@ -508,6 +570,28 @@ struct filter_community {
- int type;
+@@ -447,20 +547,10 @@ struct ctl_neighbor {
+ int show_timers;
+ };
+
+-struct kroute_label {
+- struct kroute kr;
+- char label[RTLABEL_LEN];
+-};
+-
+-struct kroute6_label {
+- struct kroute6 kr;
+- char label[RTLABEL_LEN];
+-};
+-
+-#define F_RIB_ELIGIBLE 0x01
+-#define F_RIB_ACTIVE 0x02
+-#define F_RIB_INTERNAL 0x04
+-#define F_RIB_ANNOUNCE 0x08
++#define F_PREF_ELIGIBLE 0x01
++#define F_PREF_ACTIVE 0x02
++#define F_PREF_INTERNAL 0x04
++#define F_PREF_ANNOUNCE 0x08
+
+ struct ctl_show_rib {
+ struct bgpd_addr true_nexthop;
+@@ -498,16 +588,52 @@ enum as_spec {
+ AS_EMPTY
+ };
+
++enum aslen_spec {
++ ASLEN_NONE,
++ ASLEN_MAX,
++ ASLEN_SEQ
++};
++
+ struct filter_as {
+- enum as_spec type;
+ u_int32_t as;
++ u_int16_t flags;
++ enum as_spec type;
};
++struct filter_aslen {
++ u_int aslen;
++ enum aslen_spec type;
++};
++
++#define AS_FLAG_NEIGHBORAS 0x01
++
+ struct filter_community {
+- int as;
+- int type;
++ int as;
++ int type;
++};
++
+struct filter_extcommunity {
+ u_int16_t flags;
+ u_int8_t type;
@@ -215,13 +420,13 @@ diff -u -p -r1.1.1.8 -r1.11
+ } ext_ip;
+ u_int64_t ext_opaq; /* only 48 bits */
+ } data;
-+};
-+
+ };
+
+
struct ctl_show_rib_request {
char rib[PEER_DESCR_LEN];
struct ctl_neighbor neighbor;
-@@ -518,8 +602,8 @@ struct ctl_show_rib_request {
+@@ -518,8 +644,8 @@ struct ctl_show_rib_request {
pid_t pid;
u_int16_t flags;
enum imsg_type type;
@@ -231,7 +436,7 @@ diff -u -p -r1.1.1.8 -r1.11
};
enum filter_actions {
-@@ -585,6 +669,28 @@ struct filter_peers {
+@@ -585,6 +711,28 @@ struct filter_peers {
#define EXT_COMMUNITY_OSPF_RTR_TYPE 6 /* RFC 4577 */
#define EXT_COMMUNITY_OSPF_RTR_ID 7 /* RFC 4577 */
#define EXT_COMMUNITY_BGP_COLLECT 8 /* RFC 4384 */
@@ -260,7 +465,7 @@ diff -u -p -r1.1.1.8 -r1.11
struct filter_prefix {
-@@ -594,16 +700,17 @@ struct filter_prefix {
+@@ -594,16 +742,18 @@ struct filter_prefix {
struct filter_prefixlen {
enum comp_ops op;
@@ -278,12 +483,13 @@ diff -u -p -r1.1.1.8 -r1.11
+ struct filter_prefix prefix;
+ struct filter_prefixlen prefixlen;
+ struct filter_as as;
++ struct filter_aslen aslen;
+ struct filter_community community;
+ struct filter_extcommunity ext_community;
};
TAILQ_HEAD(filter_head, filter_rule);
-@@ -635,10 +742,13 @@ enum action_types {
+@@ -635,10 +785,13 @@ enum action_types {
ACTION_SET_NEXTHOP_SELF,
ACTION_SET_COMMUNITY,
ACTION_DEL_COMMUNITY,
@@ -298,7 +504,7 @@ diff -u -p -r1.1.1.8 -r1.11
};
struct filter_set {
-@@ -650,23 +760,31 @@ struct filter_set {
+@@ -650,23 +803,53 @@ struct filter_set {
int32_t relative;
struct bgpd_addr nexthop;
struct filter_community community;
@@ -313,15 +519,37 @@ diff -u -p -r1.1.1.8 -r1.11
-struct rrefresh {
- u_int16_t afi;
- u_int8_t safi;
++struct rdomain {
++ SIMPLEQ_ENTRY(rdomain) entry;
++ char descr[PEER_DESCR_LEN];
++ char ifmpe[IFNAMSIZ];
++ struct filter_set_head import;
++ struct filter_set_head export;
++ struct network_head net_l;
++ u_int64_t rd;
++ u_int rtableid;
++ u_int label;
++ int flags;
++};
++SIMPLEQ_HEAD(rdomain_head, rdomain);
++
+struct rde_rib {
+ SIMPLEQ_ENTRY(rde_rib) entry;
+ char name[PEER_DESCR_LEN];
++ u_int rtableid;
+ u_int16_t id;
+ u_int16_t flags;
};
+SIMPLEQ_HEAD(rib_names, rde_rib);
+extern struct rib_names ribnames;
+
++/* rde_rib flags */
++#define F_RIB_ENTRYLOCK 0x0001
++#define F_RIB_NOEVALUATE 0x0002
++#define F_RIB_NOFIB 0x0004
++#define F_RIB_NOFIBSYNC 0x0008
++#define F_RIB_HASNOFIB (F_RIB_NOFIB | F_RIB_NOEVALUATE)
++
+/* 4-byte magic AS number */
+#define AS_TRANS 23456
@@ -335,7 +563,7 @@ diff -u -p -r1.1.1.8 -r1.11
int64_t nexthop_cnt;
int64_t aspath_cnt;
int64_t aspath_size;
-@@ -677,28 +795,17 @@ struct rde_memstats {
+@@ -677,38 +860,29 @@ struct rde_memstats {
int64_t attr_dcnt;
};
@@ -375,7 +603,12 @@ diff -u -p -r1.1.1.8 -r1.11
/* prototypes */
/* bgpd.c */
-@@ -709,6 +816,7 @@ int bgpd_filternexthop(struct kroute *
+ void send_nexthop_update(struct kroute_nexthop *);
+ void send_imsg_session(int, pid_t, void *, u_int16_t);
+-int bgpd_redistribute(int, struct kroute *, struct kroute6 *);
++int send_network(int, struct network_config *,
++ struct filter_set_head *);
+ int bgpd_filternexthop(struct kroute *, struct kroute6 *);
/* log.c */
void log_init(int);
@@ -383,7 +616,48 @@ diff -u -p -r1.1.1.8 -r1.11
void vlog(int, const char *, va_list);
void log_peer_warn(const struct peer_config *, const char *, ...);
void log_peer_warnx(const struct peer_config *, const char *, ...);
-@@ -779,11 +887,20 @@ const char *log_addr(const struct bgpd_a
+@@ -726,19 +900,22 @@ int cmdline_symset(char *);
+ int host(const char *, struct bgpd_addr *, u_int8_t *);
+
+ /* kroute.c */
+-int kr_init(int, u_int);
+-int kr_change(struct kroute_label *);
+-int kr_delete(struct kroute_label *);
+-int kr6_change(struct kroute6_label *);
+-int kr6_delete(struct kroute6_label *);
++int kr_init(void);
++int ktable_update(u_int, char *, char *, int);
++void ktable_preload(void);
++void ktable_postload(void);
++int ktable_exists(u_int, u_int *);
++int kr_change(u_int, struct kroute_full *);
++int kr_delete(u_int, struct kroute_full *);
+ void kr_shutdown(void);
+-void kr_fib_couple(void);
+-void kr_fib_decouple(void);
++void kr_fib_couple(u_int);
++void kr_fib_decouple(u_int);
+ int kr_dispatch_msg(void);
+-int kr_nexthop_add(struct bgpd_addr *);
+-void kr_nexthop_delete(struct bgpd_addr *);
++int kr_nexthop_add(u_int32_t, struct bgpd_addr *);
++void kr_nexthop_delete(u_int32_t, struct bgpd_addr *);
+ void kr_show_route(struct imsg *);
+ void kr_ifinfo(char *);
++int kr_net_reload(u_int, struct network_head *);
+ int kr_reload(void);
+ struct in6_addr *prefixlen2mask6(u_int8_t prefixlen);
+
+@@ -772,6 +949,8 @@ void pftable_ref(u_int16_t);
+ /* rde_filter.c */
+ 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 *);
+ const char *filterset_name(enum action_types);
+
+ /* util.c */
+@@ -779,11 +958,20 @@ const char *log_addr(const struct bgpd_a
const char *log_in6addr(const struct in6_addr *);
const char *log_sockaddr(struct sockaddr *);
const char *log_as(u_int32_t);