summaryrefslogtreecommitdiff
path: root/net/openbgpd/files/patch-bgpd_session.h
blob: 6ffbd79abd1ff04da0e468f15dff546761130587 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
Index: bgpd/session.h
===================================================================
RCS file: /home/cvs/private/hrs/openbgpd/bgpd/session.h,v
retrieving revision 1.1.1.7
retrieving revision 1.1.1.10
diff -u -p -r1.1.1.7 -r1.1.1.10
--- bgpd/session.h	14 Feb 2010 20:19:57 -0000	1.1.1.7
+++ bgpd/session.h	13 Oct 2012 18:22:50 -0000	1.1.1.10
@@ -1,4 +1,4 @@
-/*	$OpenBSD: session.h,v 1.101 2009/06/05 20:26:38 claudio Exp $ */
+/*	$OpenBSD: session.h,v 1.113 2012/04/12 17:26:09 claudio Exp $ */
 
 /*
  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -94,6 +94,13 @@ enum suberr_open {
 	ERR_OPEN_CAPA
 };
 
+enum suberr_fsm {
+	ERR_FSM_UNSPECIFIC = 0,
+	ERR_FSM_UNEX_OPENSENT,
+	ERR_FSM_UNEX_OPENCONFIRM,
+	ERR_FSM_UNEX_ESTABLISHED
+};
+
 enum opt_params {
 	OPT_PARAM_NONE,
 	OPT_PARAM_AUTH,
@@ -109,7 +116,7 @@ enum capa_codes {
 };
 
 struct bgp_msg {
-	struct buf	*buf;
+	struct ibuf	*buf;
 	enum msg_type	 type;
 	u_int16_t	 len;
 };
@@ -155,8 +162,10 @@ struct peer_stats {
 	u_int64_t		 msg_sent_rrefresh;
 	u_int64_t		 prefix_rcvd_update;
 	u_int64_t		 prefix_rcvd_withdraw;
+	u_int64_t		 prefix_rcvd_eor;
 	u_int64_t		 prefix_sent_update;
 	u_int64_t		 prefix_sent_withdraw;
+	u_int64_t		 prefix_sent_eor;
 	time_t			 last_updown;
 	time_t			 last_read;
 	u_int32_t		 prefix_cnt;
@@ -172,6 +181,7 @@ enum Timer {
 	Timer_IdleHold,
 	Timer_IdleHoldReset,
 	Timer_CarpUndemote,
+	Timer_RestartTimeout,
 	Timer_Max
 };
 
@@ -189,6 +199,7 @@ struct peer {
 	struct {
 		struct capabilities	ann;
 		struct capabilities	peer;
+		struct capabilities	neg;
 	}			 capa;
 	struct {
 		struct bgpd_addr	local_addr;
@@ -201,7 +212,7 @@ struct peer {
 	struct sockaddr_storage	 sa_remote;
 	struct peer_timer_head	 timers;
 	struct msgbuf		 wbuf;
-	struct buf_read		*rbuf;
+	struct ibuf_read	*rbuf;
 	struct peer		*next;
 	int			 fd;
 	int			 lasterr;
@@ -217,47 +228,25 @@ struct peer {
 	u_int8_t		 passive;
 };
 
-struct peer	*peers;
+extern struct peer	*peers;
+extern time_t		 pauseaccept;
 
 struct ctl_timer {
 	enum Timer	type;
 	time_t		val;
 };
 
-/* session.c */
-void		 session_socket_blockmode(int, enum blockmodes);
-pid_t		 session_main(struct bgpd_config *, struct peer *,
-		    struct network_head *, struct filter_head *,
-		    struct mrt_head *, struct rib_names *,
-		    int[2], int[2], int[2], int[2]);
-void		 bgp_fsm(struct peer *, enum session_events);
-int		 session_neighbor_rrefresh(struct peer *p);
-struct peer	*getpeerbyaddr(struct bgpd_addr *);
-struct peer	*getpeerbydesc(const char *);
-int		 imsg_compose_parent(int, pid_t, void *, u_int16_t);
-int		 imsg_compose_rde(int, pid_t, void *, u_int16_t);
-
-/* log.c */
-char		*log_fmt_peer(const struct peer_config *);
-void		 log_statechange(struct peer *, enum session_state,
-		    enum session_events);
-void		 log_notification(const struct peer *, u_int8_t, u_int8_t,
-		    u_char *, u_int16_t);
-void		 log_conn_attempt(const struct peer *, struct sockaddr *);
-
-/* parse.y */
-int	 parse_config(char *, struct bgpd_config *, struct mrt_head *,
-	    struct peer **, struct network_head *, struct filter_head *);
+/* carp.c */
+int	 carp_demote_init(char *, int);
+void	 carp_demote_shutdown(void);
+int	 carp_demote_get(char *);
+int	 carp_demote_set(char *, int);
 
 /* config.c */
 int	 merge_config(struct bgpd_config *, struct bgpd_config *,
 	    struct peer *, struct listen_addrs *);
 void	 prepare_listeners(struct bgpd_config *);
-
-/* rde.c */
-pid_t	 rde_main(struct bgpd_config *, struct peer *, struct network_head *,
-	    struct filter_head *, struct mrt_head *, struct rib_names *,
-	    int[2], int[2], int[2], int[2], int);
+int	 get_mpe_label(struct rdomain *);
 
 /* control.c */
 int	control_init(int, char *);
@@ -266,7 +255,27 @@ void	control_shutdown(int);
 int	control_dispatch_msg(struct pollfd *, u_int *);
 unsigned int	control_accept(int, int);
 
+/* log.c */
+char		*log_fmt_peer(const struct peer_config *);
+void		 log_statechange(struct peer *, enum session_state,
+		    enum session_events);
+void		 log_notification(const struct peer *, u_int8_t, u_int8_t,
+		    u_char *, u_int16_t, const char *);
+void		 log_conn_attempt(const struct peer *, struct sockaddr *);
+
+/* mrt.c */
+void		 mrt_dump_bgp_msg(struct mrt *, void *, u_int16_t,
+		     struct peer *);
+void		 mrt_dump_state(struct mrt *, u_int16_t, u_int16_t,
+		     struct peer *);
+
+/* parse.y */
+int	 parse_config(char *, struct bgpd_config *, struct mrt_head *,
+	    struct peer **, struct network_head *, struct filter_head *,
+	    struct rdomain_head *);
+
 /* pfkey.c */
+int	pfkey_read(int, struct sadb_msg *);
 int	pfkey_establish(struct peer *);
 int	pfkey_remove(struct peer *);
 int	pfkey_init(struct bgpd_sysdep *);
@@ -274,15 +283,24 @@ int	pfkey_init(struct bgpd_sysdep *);
 /* printconf.c */
 void	print_config(struct bgpd_config *, struct rib_names *,
 	    struct network_head *, struct peer *, struct filter_head *,
-	    struct mrt_head *);
+	    struct mrt_head *, struct rdomain_head *);
 
-/* carp.c */
-int	 carp_demote_init(char *, int);
-void	 carp_demote_shutdown(void);
-int	 carp_demote_get(char *);
-int	 carp_demote_set(char *, int);
+/* rde.c */
+pid_t	 rde_main(int[2], int[2], int[2], int[2], int);
+
+/* session.c */
+void		 session_socket_blockmode(int, enum blockmodes);
+pid_t		 session_main(int[2], int[2], int[2], int[2]);
+void		 bgp_fsm(struct peer *, enum session_events);
+int		 session_neighbor_rrefresh(struct peer *p);
+struct peer	*getpeerbyaddr(struct bgpd_addr *);
+struct peer	*getpeerbydesc(const char *);
+int		 imsg_compose_parent(int, u_int32_t, pid_t, void *, u_int16_t);
+int		 imsg_compose_rde(int, pid_t, void *, u_int16_t);
+void	 	 session_stop(struct peer *, u_int8_t);
 
 /* timer.c */
+time_t			 getmonotime(void);
 struct peer_timer	*timer_get(struct peer *, enum Timer);
 struct peer_timer	*timer_nextisdue(struct peer *);
 time_t			 timer_nextduein(struct peer *);