]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP message definition header. |
2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro | |
3 | ||
4 | This file is part of GNU Zebra. | |
5 | ||
6 | GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU General Public License as published by the | |
8 | Free Software Foundation; either version 2, or (at your option) any | |
9 | later version. | |
10 | ||
11 | GNU Zebra is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Zebra; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
00d252cb | 21 | #ifndef _QUAGGA_BGPD_H |
22 | #define _QUAGGA_BGPD_H | |
23 | ||
718e3744 | 24 | /* For union sockunion. */ |
25 | #include "sockunion.h" | |
26 | ||
27 | /* Typedef BGP specific types. */ | |
0b2aa3a0 PJ |
28 | typedef u_int32_t as_t; |
29 | typedef u_int16_t as16_t; /* we may still encounter 16 Bit asnums */ | |
718e3744 | 30 | typedef u_int16_t bgp_size_t; |
31 | ||
32 | /* BGP master for system wide configurations and variables. */ | |
33 | struct bgp_master | |
34 | { | |
35 | /* BGP instance list. */ | |
36 | struct list *bgp; | |
37 | ||
38 | /* BGP thread master. */ | |
39 | struct thread_master *master; | |
40 | ||
200df115 | 41 | /* work queues */ |
42 | struct work_queue *process_main_queue; | |
43 | struct work_queue *process_rsclient_queue; | |
200df115 | 44 | |
0df7c91f PJ |
45 | /* Listening sockets */ |
46 | struct list *listen_sockets; | |
47 | ||
718e3744 | 48 | /* BGP port number. */ |
49 | u_int16_t port; | |
50 | ||
3a02d1f7 PJ |
51 | /* Listener address */ |
52 | char *address; | |
53 | ||
718e3744 | 54 | /* BGP start time. */ |
55 | time_t start_time; | |
56 | ||
57 | /* Various BGP global configuration. */ | |
58 | u_char options; | |
59 | #define BGP_OPT_NO_FIB (1 << 0) | |
60 | #define BGP_OPT_MULTIPLE_INSTANCE (1 << 1) | |
61 | #define BGP_OPT_CONFIG_CISCO (1 << 2) | |
62 | }; | |
63 | ||
64 | /* BGP instance structure. */ | |
65 | struct bgp | |
66 | { | |
67 | /* AS number of this BGP instance. */ | |
68 | as_t as; | |
69 | ||
70 | /* Name of this BGP instance. */ | |
71 | char *name; | |
200df115 | 72 | |
0088b5dc SH |
73 | /* Reference count to allow peer_delete to finish after bgp_delete */ |
74 | int lock; | |
75 | ||
718e3744 | 76 | /* Self peer. */ |
77 | struct peer *peer_self; | |
78 | ||
79 | /* BGP peer. */ | |
80 | struct list *peer; | |
81 | ||
82 | /* BGP peer group. */ | |
83 | struct list *group; | |
84 | ||
fee0f4c6 | 85 | /* BGP route-server-clients. */ |
86 | struct list *rsclient; | |
87 | ||
718e3744 | 88 | /* BGP configuration. */ |
89 | u_int16_t config; | |
90 | #define BGP_CONFIG_ROUTER_ID (1 << 0) | |
91 | #define BGP_CONFIG_CLUSTER_ID (1 << 1) | |
92 | #define BGP_CONFIG_CONFEDERATION (1 << 2) | |
718e3744 | 93 | |
94 | /* BGP router identifier. */ | |
95 | struct in_addr router_id; | |
18a6dce6 | 96 | struct in_addr router_id_static; |
718e3744 | 97 | |
98 | /* BGP route reflector cluster ID. */ | |
99 | struct in_addr cluster_id; | |
100 | ||
101 | /* BGP confederation information. */ | |
102 | as_t confed_id; | |
103 | as_t *confed_peers; | |
104 | int confed_peers_cnt; | |
105 | ||
106 | /* BGP flags. */ | |
107 | u_int16_t flags; | |
108 | #define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0) | |
109 | #define BGP_FLAG_DETERMINISTIC_MED (1 << 1) | |
110 | #define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2) | |
111 | #define BGP_FLAG_MED_CONFED (1 << 3) | |
112 | #define BGP_FLAG_NO_DEFAULT_IPV4 (1 << 4) | |
113 | #define BGP_FLAG_NO_CLIENT_TO_CLIENT (1 << 5) | |
114 | #define BGP_FLAG_ENFORCE_FIRST_AS (1 << 6) | |
115 | #define BGP_FLAG_COMPARE_ROUTER_ID (1 << 7) | |
116 | #define BGP_FLAG_ASPATH_IGNORE (1 << 8) | |
117 | #define BGP_FLAG_IMPORT_CHECK (1 << 9) | |
118 | #define BGP_FLAG_NO_FAST_EXT_FAILOVER (1 << 10) | |
848973c7 | 119 | #define BGP_FLAG_LOG_NEIGHBOR_CHANGES (1 << 11) |
538621f2 | 120 | #define BGP_FLAG_GRACEFUL_RESTART (1 << 12) |
6811845b | 121 | #define BGP_FLAG_ASPATH_CONFED (1 << 13) |
718e3744 | 122 | |
123 | /* BGP Per AF flags */ | |
124 | u_int16_t af_flags[AFI_MAX][SAFI_MAX]; | |
125 | #define BGP_CONFIG_DAMPENING (1 << 0) | |
126 | ||
127 | /* Static route configuration. */ | |
128 | struct bgp_table *route[AFI_MAX][SAFI_MAX]; | |
129 | ||
130 | /* Aggregate address configuration. */ | |
131 | struct bgp_table *aggregate[AFI_MAX][SAFI_MAX]; | |
132 | ||
133 | /* BGP routing information base. */ | |
134 | struct bgp_table *rib[AFI_MAX][SAFI_MAX]; | |
135 | ||
136 | /* BGP redistribute configuration. */ | |
137 | u_char redist[AFI_MAX][ZEBRA_ROUTE_MAX]; | |
138 | ||
139 | /* BGP redistribute metric configuration. */ | |
140 | u_char redist_metric_flag[AFI_MAX][ZEBRA_ROUTE_MAX]; | |
141 | u_int32_t redist_metric[AFI_MAX][ZEBRA_ROUTE_MAX]; | |
142 | ||
143 | /* BGP redistribute route-map. */ | |
144 | struct | |
145 | { | |
146 | char *name; | |
147 | struct route_map *map; | |
148 | } rmap[AFI_MAX][ZEBRA_ROUTE_MAX]; | |
149 | ||
150 | /* BGP distance configuration. */ | |
151 | u_char distance_ebgp; | |
152 | u_char distance_ibgp; | |
153 | u_char distance_local; | |
154 | ||
155 | /* BGP default local-preference. */ | |
156 | u_int32_t default_local_pref; | |
157 | ||
158 | /* BGP default timer. */ | |
159 | u_int32_t default_holdtime; | |
160 | u_int32_t default_keepalive; | |
538621f2 | 161 | |
162 | /* BGP graceful restart */ | |
93406d87 | 163 | u_int32_t restart_time; |
164 | u_int32_t stalepath_time; | |
165b5fff JB |
165 | |
166 | /* Maximum-paths configuration */ | |
167 | struct bgp_maxpaths_cfg { | |
168 | u_int16_t maxpaths_ebgp; | |
169 | u_int16_t maxpaths_ibgp; | |
170 | } maxpaths[AFI_MAX][SAFI_MAX]; | |
718e3744 | 171 | }; |
172 | ||
173 | /* BGP peer-group support. */ | |
174 | struct peer_group | |
175 | { | |
176 | /* Name of the peer-group. */ | |
177 | char *name; | |
178 | ||
179 | /* Pointer to BGP. */ | |
180 | struct bgp *bgp; | |
181 | ||
182 | /* Peer-group client list. */ | |
183 | struct list *peer; | |
184 | ||
185 | /* Peer-group config */ | |
186 | struct peer *conf; | |
187 | }; | |
188 | ||
189 | /* BGP Notify message format. */ | |
190 | struct bgp_notify | |
191 | { | |
192 | u_char code; | |
193 | u_char subcode; | |
194 | char *data; | |
195 | bgp_size_t length; | |
196 | }; | |
197 | ||
198 | /* Next hop self address. */ | |
199 | struct bgp_nexthop | |
200 | { | |
201 | struct interface *ifp; | |
202 | struct in_addr v4; | |
203 | #ifdef HAVE_IPV6 | |
204 | struct in6_addr v6_global; | |
205 | struct in6_addr v6_local; | |
206 | #endif /* HAVE_IPV6 */ | |
207 | }; | |
208 | ||
209 | /* BGP router distinguisher value. */ | |
210 | #define BGP_RD_SIZE 8 | |
211 | ||
212 | struct bgp_rd | |
213 | { | |
214 | u_char val[BGP_RD_SIZE]; | |
215 | }; | |
216 | ||
fee0f4c6 | 217 | #define RMAP_IN 0 |
218 | #define RMAP_OUT 1 | |
219 | #define RMAP_IMPORT 2 | |
220 | #define RMAP_EXPORT 3 | |
221 | #define RMAP_MAX 4 | |
222 | ||
718e3744 | 223 | /* BGP filter structure. */ |
224 | struct bgp_filter | |
225 | { | |
226 | /* Distribute-list. */ | |
227 | struct | |
228 | { | |
229 | char *name; | |
230 | struct access_list *alist; | |
231 | } dlist[FILTER_MAX]; | |
232 | ||
233 | /* Prefix-list. */ | |
234 | struct | |
235 | { | |
236 | char *name; | |
237 | struct prefix_list *plist; | |
238 | } plist[FILTER_MAX]; | |
239 | ||
240 | /* Filter-list. */ | |
241 | struct | |
242 | { | |
243 | char *name; | |
244 | struct as_list *aslist; | |
245 | } aslist[FILTER_MAX]; | |
246 | ||
247 | /* Route-map. */ | |
248 | struct | |
249 | { | |
250 | char *name; | |
251 | struct route_map *map; | |
fee0f4c6 | 252 | } map[RMAP_MAX]; |
718e3744 | 253 | |
254 | /* Unsuppress-map. */ | |
255 | struct | |
256 | { | |
257 | char *name; | |
258 | struct route_map *map; | |
259 | } usmap; | |
260 | }; | |
261 | ||
6d85b15b JBD |
262 | /* IBGP/EBGP identifier. We also have a CONFED peer, which is to say, |
263 | a peer who's AS is part of our Confederation. */ | |
264 | typedef enum | |
265 | { | |
266 | BGP_PEER_IBGP = 1, | |
267 | BGP_PEER_EBGP, | |
268 | BGP_PEER_INTERNAL, | |
269 | BGP_PEER_CONFED, | |
270 | } bgp_peer_sort_t; | |
271 | ||
718e3744 | 272 | /* BGP neighbor structure. */ |
273 | struct peer | |
274 | { | |
275 | /* BGP structure. */ | |
276 | struct bgp *bgp; | |
277 | ||
200df115 | 278 | /* reference count, primarily to allow bgp_process'ing of route_node's |
279 | * to be done after a struct peer is deleted. | |
280 | * | |
281 | * named 'lock' for hysterical reasons within Quagga. | |
282 | */ | |
283 | int lock; | |
284 | ||
718e3744 | 285 | /* BGP peer group. */ |
286 | struct peer_group *group; | |
287 | u_char af_group[AFI_MAX][SAFI_MAX]; | |
288 | ||
289 | /* Peer's remote AS number. */ | |
290 | as_t as; | |
291 | ||
292 | /* Peer's local AS number. */ | |
293 | as_t local_as; | |
294 | ||
6d85b15b JBD |
295 | bgp_peer_sort_t sort; |
296 | ||
718e3744 | 297 | /* Peer's Change local AS number. */ |
298 | as_t change_local_as; | |
299 | ||
300 | /* Remote router ID. */ | |
301 | struct in_addr remote_id; | |
302 | ||
303 | /* Local router ID. */ | |
304 | struct in_addr local_id; | |
305 | ||
fee0f4c6 | 306 | /* Peer specific RIB when configured as route-server-client. */ |
307 | struct bgp_table *rib[AFI_MAX][SAFI_MAX]; | |
308 | ||
718e3744 | 309 | /* Packet receive and send buffer. */ |
310 | struct stream *ibuf; | |
311 | struct stream_fifo *obuf; | |
312 | struct stream *work; | |
313 | ||
314 | /* Status of the peer. */ | |
315 | int status; | |
316 | int ostatus; | |
317 | ||
0b2aa3a0 PJ |
318 | /* Peer index, used for dumping TABLE_DUMP_V2 format */ |
319 | uint16_t table_dump_index; | |
320 | ||
718e3744 | 321 | /* Peer information */ |
eb821189 | 322 | int fd; /* File descriptor */ |
323 | int ttl; /* TTL of TCP connection to the peer. */ | |
fa411a21 | 324 | int gtsm_hops; /* minimum hopcount to peer */ |
eb821189 | 325 | char *desc; /* Description of the peer. */ |
326 | unsigned short port; /* Destination port for peer */ | |
327 | char *host; /* Printable address of the peer. */ | |
328 | union sockunion su; /* Sockunion address of the peer. */ | |
329 | time_t uptime; /* Last Up/Down time */ | |
330 | time_t readtime; /* Last read time */ | |
331 | time_t resettime; /* Last reset time */ | |
718e3744 | 332 | |
eb821189 | 333 | unsigned int ifindex; /* ifindex of the BGP connection. */ |
334 | char *ifname; /* bind interface name. */ | |
335 | char *update_if; | |
336 | union sockunion *update_source; | |
337 | struct zlog *log; | |
eb821189 | 338 | |
339 | union sockunion *su_local; /* Sockunion of local address. */ | |
340 | union sockunion *su_remote; /* Sockunion of remote address. */ | |
341 | int shared_network; /* Is this peer shared same network. */ | |
342 | struct bgp_nexthop nexthop; /* Nexthop */ | |
718e3744 | 343 | |
344 | /* Peer address family configuration. */ | |
345 | u_char afc[AFI_MAX][SAFI_MAX]; | |
346 | u_char afc_nego[AFI_MAX][SAFI_MAX]; | |
347 | u_char afc_adv[AFI_MAX][SAFI_MAX]; | |
348 | u_char afc_recv[AFI_MAX][SAFI_MAX]; | |
349 | ||
0a486e5f | 350 | /* Capability flags (reset in bgp_stop) */ |
0b2aa3a0 | 351 | u_int16_t cap; |
718e3744 | 352 | #define PEER_CAP_REFRESH_ADV (1 << 0) /* refresh advertised */ |
353 | #define PEER_CAP_REFRESH_OLD_RCV (1 << 1) /* refresh old received */ | |
354 | #define PEER_CAP_REFRESH_NEW_RCV (1 << 2) /* refresh rfc received */ | |
355 | #define PEER_CAP_DYNAMIC_ADV (1 << 3) /* dynamic advertised */ | |
356 | #define PEER_CAP_DYNAMIC_RCV (1 << 4) /* dynamic received */ | |
538621f2 | 357 | #define PEER_CAP_RESTART_ADV (1 << 5) /* restart advertised */ |
358 | #define PEER_CAP_RESTART_RCV (1 << 6) /* restart received */ | |
0b2aa3a0 PJ |
359 | #define PEER_CAP_AS4_ADV (1 << 7) /* as4 advertised */ |
360 | #define PEER_CAP_AS4_RCV (1 << 8) /* as4 received */ | |
718e3744 | 361 | |
0a486e5f | 362 | /* Capability flags (reset in bgp_stop) */ |
718e3744 | 363 | u_int16_t af_cap[AFI_MAX][SAFI_MAX]; |
364 | #define PEER_CAP_ORF_PREFIX_SM_ADV (1 << 0) /* send-mode advertised */ | |
365 | #define PEER_CAP_ORF_PREFIX_RM_ADV (1 << 1) /* receive-mode advertised */ | |
366 | #define PEER_CAP_ORF_PREFIX_SM_RCV (1 << 2) /* send-mode received */ | |
367 | #define PEER_CAP_ORF_PREFIX_RM_RCV (1 << 3) /* receive-mode received */ | |
368 | #define PEER_CAP_ORF_PREFIX_SM_OLD_RCV (1 << 4) /* send-mode received */ | |
369 | #define PEER_CAP_ORF_PREFIX_RM_OLD_RCV (1 << 5) /* receive-mode received */ | |
93406d87 | 370 | #define PEER_CAP_RESTART_AF_RCV (1 << 6) /* graceful restart afi/safi received */ |
371 | #define PEER_CAP_RESTART_AF_PRESERVE_RCV (1 << 7) /* graceful restart afi/safi F-bit received */ | |
718e3744 | 372 | |
373 | /* Global configuration flags. */ | |
374 | u_int32_t flags; | |
375 | #define PEER_FLAG_PASSIVE (1 << 0) /* passive mode */ | |
376 | #define PEER_FLAG_SHUTDOWN (1 << 1) /* shutdown */ | |
377 | #define PEER_FLAG_DONT_CAPABILITY (1 << 2) /* dont-capability */ | |
378 | #define PEER_FLAG_OVERRIDE_CAPABILITY (1 << 3) /* override-capability */ | |
379 | #define PEER_FLAG_STRICT_CAP_MATCH (1 << 4) /* strict-match */ | |
c9502438 | 380 | #define PEER_FLAG_DYNAMIC_CAPABILITY (1 << 5) /* dynamic capability */ |
6ffd2079 | 381 | #define PEER_FLAG_DISABLE_CONNECTED_CHECK (1 << 6) /* disable-connected-check */ |
c9502438 | 382 | #define PEER_FLAG_LOCAL_AS_NO_PREPEND (1 << 7) /* local-as no-prepend */ |
718e3744 | 383 | |
93406d87 | 384 | /* NSF mode (graceful restart) */ |
385 | u_char nsf[AFI_MAX][SAFI_MAX]; | |
386 | ||
718e3744 | 387 | /* Per AF configuration flags. */ |
388 | u_int32_t af_flags[AFI_MAX][SAFI_MAX]; | |
389 | #define PEER_FLAG_SEND_COMMUNITY (1 << 0) /* send-community */ | |
390 | #define PEER_FLAG_SEND_EXT_COMMUNITY (1 << 1) /* send-community ext. */ | |
391 | #define PEER_FLAG_NEXTHOP_SELF (1 << 2) /* next-hop-self */ | |
392 | #define PEER_FLAG_REFLECTOR_CLIENT (1 << 3) /* reflector-client */ | |
393 | #define PEER_FLAG_RSERVER_CLIENT (1 << 4) /* route-server-client */ | |
394 | #define PEER_FLAG_SOFT_RECONFIG (1 << 5) /* soft-reconfiguration */ | |
395 | #define PEER_FLAG_AS_PATH_UNCHANGED (1 << 6) /* transparent-as */ | |
396 | #define PEER_FLAG_NEXTHOP_UNCHANGED (1 << 7) /* transparent-next-hop */ | |
397 | #define PEER_FLAG_MED_UNCHANGED (1 << 8) /* transparent-next-hop */ | |
398 | #define PEER_FLAG_DEFAULT_ORIGINATE (1 << 9) /* default-originate */ | |
399 | #define PEER_FLAG_REMOVE_PRIVATE_AS (1 << 10) /* remove-private-as */ | |
400 | #define PEER_FLAG_ALLOWAS_IN (1 << 11) /* set allowas-in */ | |
401 | #define PEER_FLAG_ORF_PREFIX_SM (1 << 12) /* orf capability send-mode */ | |
402 | #define PEER_FLAG_ORF_PREFIX_RM (1 << 13) /* orf capability receive-mode */ | |
403 | #define PEER_FLAG_MAX_PREFIX (1 << 14) /* maximum prefix */ | |
404 | #define PEER_FLAG_MAX_PREFIX_WARNING (1 << 15) /* maximum prefix warning-only */ | |
0df7c91f PJ |
405 | #define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1 << 16) /* leave link-local nexthop unchanged */ |
406 | ||
407 | /* MD5 password */ | |
408 | char *password; | |
718e3744 | 409 | |
410 | /* default-originate route-map. */ | |
411 | struct | |
412 | { | |
413 | char *name; | |
414 | struct route_map *map; | |
415 | } default_rmap[AFI_MAX][SAFI_MAX]; | |
416 | ||
417 | /* Peer status flags. */ | |
418 | u_int16_t sflags; | |
419 | #define PEER_STATUS_ACCEPT_PEER (1 << 0) /* accept peer */ | |
420 | #define PEER_STATUS_PREFIX_OVERFLOW (1 << 1) /* prefix-overflow */ | |
421 | #define PEER_STATUS_CAPABILITY_OPEN (1 << 2) /* capability open send */ | |
422 | #define PEER_STATUS_HAVE_ACCEPT (1 << 3) /* accept peer's parent */ | |
423 | #define PEER_STATUS_GROUP (1 << 4) /* peer-group conf */ | |
93406d87 | 424 | #define PEER_STATUS_NSF_MODE (1 << 5) /* NSF aware peer */ |
425 | #define PEER_STATUS_NSF_WAIT (1 << 6) /* wait comeback peer */ | |
718e3744 | 426 | |
0a486e5f | 427 | /* Peer status af flags (reset in bgp_stop) */ |
718e3744 | 428 | u_int16_t af_sflags[AFI_MAX][SAFI_MAX]; |
429 | #define PEER_STATUS_ORF_PREFIX_SEND (1 << 0) /* prefix-list send peer */ | |
430 | #define PEER_STATUS_ORF_WAIT_REFRESH (1 << 1) /* wait refresh received peer */ | |
431 | #define PEER_STATUS_DEFAULT_ORIGINATE (1 << 2) /* default-originate peer */ | |
e0701b79 | 432 | #define PEER_STATUS_PREFIX_THRESHOLD (1 << 3) /* exceed prefix-threshold */ |
433 | #define PEER_STATUS_PREFIX_LIMIT (1 << 4) /* exceed prefix-limit */ | |
93406d87 | 434 | #define PEER_STATUS_EOR_SEND (1 << 5) /* end-of-rib send to peer */ |
435 | #define PEER_STATUS_EOR_RECEIVED (1 << 6) /* end-of-rib received from peer */ | |
e0701b79 | 436 | |
718e3744 | 437 | /* Default attribute value for the peer. */ |
438 | u_int32_t config; | |
439 | #define PEER_CONFIG_WEIGHT (1 << 0) /* Default weight. */ | |
440 | #define PEER_CONFIG_TIMER (1 << 1) /* keepalive & holdtime */ | |
441 | #define PEER_CONFIG_CONNECT (1 << 2) /* connect */ | |
442 | #define PEER_CONFIG_ROUTEADV (1 << 3) /* route advertise */ | |
443 | u_int32_t weight; | |
444 | u_int32_t holdtime; | |
445 | u_int32_t keepalive; | |
446 | u_int32_t connect; | |
447 | u_int32_t routeadv; | |
448 | ||
449 | /* Timer values. */ | |
450 | u_int32_t v_start; | |
451 | u_int32_t v_connect; | |
452 | u_int32_t v_holdtime; | |
453 | u_int32_t v_keepalive; | |
454 | u_int32_t v_asorig; | |
455 | u_int32_t v_routeadv; | |
0a486e5f | 456 | u_int32_t v_pmax_restart; |
93406d87 | 457 | u_int32_t v_gr_restart; |
718e3744 | 458 | |
459 | /* Threads. */ | |
460 | struct thread *t_read; | |
461 | struct thread *t_write; | |
462 | struct thread *t_start; | |
463 | struct thread *t_connect; | |
464 | struct thread *t_holdtime; | |
465 | struct thread *t_keepalive; | |
466 | struct thread *t_asorig; | |
467 | struct thread *t_routeadv; | |
0a486e5f | 468 | struct thread *t_pmax_restart; |
93406d87 | 469 | struct thread *t_gr_restart; |
470 | struct thread *t_gr_stale; | |
64e580a7 PJ |
471 | |
472 | /* workqueues */ | |
473 | struct work_queue *clear_node_queue; | |
474 | ||
718e3744 | 475 | /* Statistics field */ |
476 | u_int32_t open_in; /* Open message input count */ | |
477 | u_int32_t open_out; /* Open message output count */ | |
478 | u_int32_t update_in; /* Update message input count */ | |
479 | u_int32_t update_out; /* Update message ouput count */ | |
480 | time_t update_time; /* Update message received time. */ | |
481 | u_int32_t keepalive_in; /* Keepalive input count */ | |
482 | u_int32_t keepalive_out; /* Keepalive output count */ | |
483 | u_int32_t notify_in; /* Notify input count */ | |
484 | u_int32_t notify_out; /* Notify output count */ | |
485 | u_int32_t refresh_in; /* Route Refresh input count */ | |
486 | u_int32_t refresh_out; /* Route Refresh output count */ | |
487 | u_int32_t dynamic_cap_in; /* Dynamic Capability input count. */ | |
488 | u_int32_t dynamic_cap_out; /* Dynamic Capability output count. */ | |
489 | ||
490 | /* BGP state count */ | |
491 | u_int32_t established; /* Established */ | |
492 | u_int32_t dropped; /* Dropped */ | |
493 | ||
494 | /* Syncronization list and time. */ | |
495 | struct bgp_synchronize *sync[AFI_MAX][SAFI_MAX]; | |
496 | time_t synctime; | |
497 | ||
498 | /* Send prefix count. */ | |
499 | unsigned long scount[AFI_MAX][SAFI_MAX]; | |
500 | ||
501 | /* Announcement attribute hash. */ | |
502 | struct hash *hash[AFI_MAX][SAFI_MAX]; | |
503 | ||
504 | /* Notify data. */ | |
505 | struct bgp_notify notify; | |
506 | ||
507 | /* Whole packet size to be read. */ | |
508 | unsigned long packet_size; | |
509 | ||
510 | /* Filter structure. */ | |
511 | struct bgp_filter filter[AFI_MAX][SAFI_MAX]; | |
512 | ||
513 | /* ORF Prefix-list */ | |
514 | struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX]; | |
515 | ||
516 | /* Prefix count. */ | |
517 | unsigned long pcount[AFI_MAX][SAFI_MAX]; | |
518 | ||
519 | /* Max prefix count. */ | |
520 | unsigned long pmax[AFI_MAX][SAFI_MAX]; | |
e0701b79 | 521 | u_char pmax_threshold[AFI_MAX][SAFI_MAX]; |
0a486e5f | 522 | u_int16_t pmax_restart[AFI_MAX][SAFI_MAX]; |
e0701b79 | 523 | #define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75 |
718e3744 | 524 | |
525 | /* allowas-in. */ | |
526 | char allowas_in[AFI_MAX][SAFI_MAX]; | |
ac41b2a2 | 527 | |
e0701b79 | 528 | /* peer reset cause */ |
529 | char last_reset; | |
530 | #define PEER_DOWN_RID_CHANGE 1 /* bgp router-id command */ | |
531 | #define PEER_DOWN_REMOTE_AS_CHANGE 2 /* neighbor remote-as command */ | |
532 | #define PEER_DOWN_LOCAL_AS_CHANGE 3 /* neighbor local-as command */ | |
533 | #define PEER_DOWN_CLID_CHANGE 4 /* bgp cluster-id command */ | |
534 | #define PEER_DOWN_CONFED_ID_CHANGE 5 /* bgp confederation identifier command */ | |
535 | #define PEER_DOWN_CONFED_PEER_CHANGE 6 /* bgp confederation peer command */ | |
536 | #define PEER_DOWN_RR_CLIENT_CHANGE 7 /* neighbor route-reflector-client command */ | |
537 | #define PEER_DOWN_RS_CLIENT_CHANGE 8 /* neighbor route-server-client command */ | |
538 | #define PEER_DOWN_UPDATE_SOURCE_CHANGE 9 /* neighbor update-source command */ | |
539 | #define PEER_DOWN_AF_ACTIVATE 10 /* neighbor activate command */ | |
540 | #define PEER_DOWN_USER_SHUTDOWN 11 /* neighbor shutdown command */ | |
541 | #define PEER_DOWN_USER_RESET 12 /* clear ip bgp command */ | |
542 | #define PEER_DOWN_NOTIFY_RECEIVED 13 /* notification received */ | |
543 | #define PEER_DOWN_NOTIFY_SEND 14 /* notification send */ | |
544 | #define PEER_DOWN_CLOSE_SESSION 15 /* tcp session close */ | |
545 | #define PEER_DOWN_NEIGHBOR_DELETE 16 /* neghbor delete */ | |
546 | #define PEER_DOWN_RMAP_BIND 17 /* neghbor peer-group command */ | |
547 | #define PEER_DOWN_RMAP_UNBIND 18 /* no neighbor peer-group command */ | |
548 | #define PEER_DOWN_CAPABILITY_CHANGE 19 /* neighbor capability command */ | |
549 | #define PEER_DOWN_PASSIVE_CHANGE 20 /* neighbor passive command */ | |
550 | #define PEER_DOWN_MULTIHOP_CHANGE 21 /* neighbor multihop command */ | |
93406d87 | 551 | #define PEER_DOWN_NSF_CLOSE_SESSION 22 /* NSF tcp session close */ |
e0701b79 | 552 | |
ac41b2a2 | 553 | /* The kind of route-map Flags.*/ |
554 | u_char rmap_type; | |
555 | #define PEER_RMAP_TYPE_IN (1 << 0) /* neighbor route-map in */ | |
556 | #define PEER_RMAP_TYPE_OUT (1 << 1) /* neighbor route-map out */ | |
557 | #define PEER_RMAP_TYPE_NETWORK (1 << 2) /* network route-map */ | |
558 | #define PEER_RMAP_TYPE_REDISTRIBUTE (1 << 3) /* redistribute route-map */ | |
559 | #define PEER_RMAP_TYPE_DEFAULT (1 << 4) /* default-originate route-map */ | |
560 | #define PEER_RMAP_TYPE_NOSET (1 << 5) /* not allow to set commands */ | |
fee0f4c6 | 561 | #define PEER_RMAP_TYPE_IMPORT (1 << 6) /* neighbor route-map import */ |
562 | #define PEER_RMAP_TYPE_EXPORT (1 << 7) /* neighbor route-map export */ | |
718e3744 | 563 | }; |
564 | ||
0df7c91f PJ |
565 | #define PEER_PASSWORD_MINLEN (1) |
566 | #define PEER_PASSWORD_MAXLEN (80) | |
567 | ||
718e3744 | 568 | /* This structure's member directly points incoming packet data |
569 | stream. */ | |
570 | struct bgp_nlri | |
571 | { | |
572 | /* AFI. */ | |
573 | afi_t afi; | |
574 | ||
575 | /* SAFI. */ | |
576 | safi_t safi; | |
577 | ||
578 | /* Pointer to NLRI byte stream. */ | |
579 | u_char *nlri; | |
580 | ||
581 | /* Length of whole NLRI. */ | |
582 | bgp_size_t length; | |
583 | }; | |
584 | ||
585 | /* BGP versions. */ | |
586 | #define BGP_VERSION_4 4 | |
718e3744 | 587 | |
588 | /* Default BGP port number. */ | |
589 | #define BGP_PORT_DEFAULT 179 | |
590 | ||
591 | /* BGP message header and packet size. */ | |
592 | #define BGP_MARKER_SIZE 16 | |
593 | #define BGP_HEADER_SIZE 19 | |
594 | #define BGP_MAX_PACKET_SIZE 4096 | |
595 | ||
596 | /* BGP minimum message size. */ | |
597 | #define BGP_MSG_OPEN_MIN_SIZE (BGP_HEADER_SIZE + 10) | |
598 | #define BGP_MSG_UPDATE_MIN_SIZE (BGP_HEADER_SIZE + 4) | |
599 | #define BGP_MSG_NOTIFY_MIN_SIZE (BGP_HEADER_SIZE + 2) | |
600 | #define BGP_MSG_KEEPALIVE_MIN_SIZE (BGP_HEADER_SIZE + 0) | |
601 | #define BGP_MSG_ROUTE_REFRESH_MIN_SIZE (BGP_HEADER_SIZE + 4) | |
602 | #define BGP_MSG_CAPABILITY_MIN_SIZE (BGP_HEADER_SIZE + 3) | |
603 | ||
604 | /* BGP message types. */ | |
605 | #define BGP_MSG_OPEN 1 | |
606 | #define BGP_MSG_UPDATE 2 | |
607 | #define BGP_MSG_NOTIFY 3 | |
608 | #define BGP_MSG_KEEPALIVE 4 | |
609 | #define BGP_MSG_ROUTE_REFRESH_NEW 5 | |
610 | #define BGP_MSG_CAPABILITY 6 | |
611 | #define BGP_MSG_ROUTE_REFRESH_OLD 128 | |
612 | ||
613 | /* BGP open optional parameter. */ | |
614 | #define BGP_OPEN_OPT_AUTH 1 | |
615 | #define BGP_OPEN_OPT_CAP 2 | |
616 | ||
617 | /* BGP4 attribute type codes. */ | |
618 | #define BGP_ATTR_ORIGIN 1 | |
619 | #define BGP_ATTR_AS_PATH 2 | |
620 | #define BGP_ATTR_NEXT_HOP 3 | |
621 | #define BGP_ATTR_MULTI_EXIT_DISC 4 | |
622 | #define BGP_ATTR_LOCAL_PREF 5 | |
623 | #define BGP_ATTR_ATOMIC_AGGREGATE 6 | |
624 | #define BGP_ATTR_AGGREGATOR 7 | |
625 | #define BGP_ATTR_COMMUNITIES 8 | |
626 | #define BGP_ATTR_ORIGINATOR_ID 9 | |
627 | #define BGP_ATTR_CLUSTER_LIST 10 | |
628 | #define BGP_ATTR_DPA 11 | |
629 | #define BGP_ATTR_ADVERTISER 12 | |
630 | #define BGP_ATTR_RCID_PATH 13 | |
631 | #define BGP_ATTR_MP_REACH_NLRI 14 | |
632 | #define BGP_ATTR_MP_UNREACH_NLRI 15 | |
633 | #define BGP_ATTR_EXT_COMMUNITIES 16 | |
0b2aa3a0 PJ |
634 | #define BGP_ATTR_AS4_PATH 17 |
635 | #define BGP_ATTR_AS4_AGGREGATOR 18 | |
41367172 | 636 | #define BGP_ATTR_AS_PATHLIMIT 21 |
718e3744 | 637 | |
638 | /* BGP update origin. */ | |
639 | #define BGP_ORIGIN_IGP 0 | |
640 | #define BGP_ORIGIN_EGP 1 | |
641 | #define BGP_ORIGIN_INCOMPLETE 2 | |
642 | ||
643 | /* BGP notify message codes. */ | |
644 | #define BGP_NOTIFY_HEADER_ERR 1 | |
645 | #define BGP_NOTIFY_OPEN_ERR 2 | |
646 | #define BGP_NOTIFY_UPDATE_ERR 3 | |
647 | #define BGP_NOTIFY_HOLD_ERR 4 | |
648 | #define BGP_NOTIFY_FSM_ERR 5 | |
649 | #define BGP_NOTIFY_CEASE 6 | |
650 | #define BGP_NOTIFY_CAPABILITY_ERR 7 | |
651 | #define BGP_NOTIFY_MAX 8 | |
652 | ||
4b4e07d2 DT |
653 | #define BGP_NOTIFY_SUBCODE_UNSPECIFIC 0 |
654 | ||
718e3744 | 655 | /* BGP_NOTIFY_HEADER_ERR sub codes. */ |
656 | #define BGP_NOTIFY_HEADER_NOT_SYNC 1 | |
657 | #define BGP_NOTIFY_HEADER_BAD_MESLEN 2 | |
658 | #define BGP_NOTIFY_HEADER_BAD_MESTYPE 3 | |
659 | #define BGP_NOTIFY_HEADER_MAX 4 | |
660 | ||
661 | /* BGP_NOTIFY_OPEN_ERR sub codes. */ | |
662 | #define BGP_NOTIFY_OPEN_UNSUP_VERSION 1 | |
663 | #define BGP_NOTIFY_OPEN_BAD_PEER_AS 2 | |
664 | #define BGP_NOTIFY_OPEN_BAD_BGP_IDENT 3 | |
665 | #define BGP_NOTIFY_OPEN_UNSUP_PARAM 4 | |
666 | #define BGP_NOTIFY_OPEN_AUTH_FAILURE 5 | |
667 | #define BGP_NOTIFY_OPEN_UNACEP_HOLDTIME 6 | |
668 | #define BGP_NOTIFY_OPEN_UNSUP_CAPBL 7 | |
669 | #define BGP_NOTIFY_OPEN_MAX 8 | |
670 | ||
671 | /* BGP_NOTIFY_UPDATE_ERR sub codes. */ | |
672 | #define BGP_NOTIFY_UPDATE_MAL_ATTR 1 | |
673 | #define BGP_NOTIFY_UPDATE_UNREC_ATTR 2 | |
674 | #define BGP_NOTIFY_UPDATE_MISS_ATTR 3 | |
675 | #define BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR 4 | |
676 | #define BGP_NOTIFY_UPDATE_ATTR_LENG_ERR 5 | |
677 | #define BGP_NOTIFY_UPDATE_INVAL_ORIGIN 6 | |
678 | #define BGP_NOTIFY_UPDATE_AS_ROUTE_LOOP 7 | |
679 | #define BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP 8 | |
680 | #define BGP_NOTIFY_UPDATE_OPT_ATTR_ERR 9 | |
681 | #define BGP_NOTIFY_UPDATE_INVAL_NETWORK 10 | |
682 | #define BGP_NOTIFY_UPDATE_MAL_AS_PATH 11 | |
683 | #define BGP_NOTIFY_UPDATE_MAX 12 | |
684 | ||
4b4e07d2 | 685 | /* BGP_NOTIFY_CEASE sub codes (RFC 4486). */ |
718e3744 | 686 | #define BGP_NOTIFY_CEASE_MAX_PREFIX 1 |
687 | #define BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN 2 | |
688 | #define BGP_NOTIFY_CEASE_PEER_UNCONFIG 3 | |
689 | #define BGP_NOTIFY_CEASE_ADMIN_RESET 4 | |
690 | #define BGP_NOTIFY_CEASE_CONNECT_REJECT 5 | |
691 | #define BGP_NOTIFY_CEASE_CONFIG_CHANGE 6 | |
545acafb | 692 | #define BGP_NOTIFY_CEASE_COLLISION_RESOLUTION 7 |
693 | #define BGP_NOTIFY_CEASE_OUT_OF_RESOURCE 8 | |
694 | #define BGP_NOTIFY_CEASE_MAX 9 | |
718e3744 | 695 | |
696 | /* BGP_NOTIFY_CAPABILITY_ERR sub codes (draft-ietf-idr-dynamic-cap-02). */ | |
697 | #define BGP_NOTIFY_CAPABILITY_INVALID_ACTION 1 | |
698 | #define BGP_NOTIFY_CAPABILITY_INVALID_LENGTH 2 | |
699 | #define BGP_NOTIFY_CAPABILITY_MALFORMED_CODE 3 | |
700 | #define BGP_NOTIFY_CAPABILITY_MAX 4 | |
701 | ||
702 | /* BGP finite state machine status. */ | |
703 | #define Idle 1 | |
704 | #define Connect 2 | |
705 | #define Active 3 | |
706 | #define OpenSent 4 | |
707 | #define OpenConfirm 5 | |
708 | #define Established 6 | |
ca058a30 PJ |
709 | #define Clearing 7 |
710 | #define Deleted 8 | |
711 | #define BGP_STATUS_MAX 9 | |
718e3744 | 712 | |
713 | /* BGP finite state machine events. */ | |
714 | #define BGP_Start 1 | |
715 | #define BGP_Stop 2 | |
716 | #define TCP_connection_open 3 | |
717 | #define TCP_connection_closed 4 | |
718 | #define TCP_connection_open_failed 5 | |
719 | #define TCP_fatal_error 6 | |
720 | #define ConnectRetry_timer_expired 7 | |
721 | #define Hold_Timer_expired 8 | |
722 | #define KeepAlive_timer_expired 9 | |
723 | #define Receive_OPEN_message 10 | |
724 | #define Receive_KEEPALIVE_message 11 | |
725 | #define Receive_UPDATE_message 12 | |
726 | #define Receive_NOTIFICATION_message 13 | |
ca058a30 PJ |
727 | #define Clearing_Completed 14 |
728 | #define BGP_EVENTS_MAX 15 | |
718e3744 | 729 | |
730 | /* BGP timers default value. */ | |
731 | #define BGP_INIT_START_TIMER 5 | |
732 | #define BGP_ERROR_START_TIMER 30 | |
733 | #define BGP_DEFAULT_HOLDTIME 180 | |
734 | #define BGP_DEFAULT_KEEPALIVE 60 | |
735 | #define BGP_DEFAULT_ASORIGINATE 15 | |
736 | #define BGP_DEFAULT_EBGP_ROUTEADV 30 | |
737 | #define BGP_DEFAULT_IBGP_ROUTEADV 5 | |
738 | #define BGP_CLEAR_CONNECT_RETRY 20 | |
739 | #define BGP_DEFAULT_CONNECT_RETRY 120 | |
740 | ||
741 | /* BGP default local preference. */ | |
742 | #define BGP_DEFAULT_LOCAL_PREF 100 | |
743 | ||
538621f2 | 744 | /* BGP graceful restart */ |
745 | #define BGP_DEFAULT_RESTART_TIME 120 | |
746 | #define BGP_DEFAULT_STALEPATH_TIME 360 | |
747 | ||
42e6d745 DO |
748 | /* RFC4364 */ |
749 | #define SAFI_MPLS_LABELED_VPN 128 | |
718e3744 | 750 | |
751 | /* Max TTL value. */ | |
752 | #define TTL_MAX 255 | |
753 | ||
754 | /* BGP uptime string length. */ | |
755 | #define BGP_UPTIME_LEN 25 | |
756 | ||
757 | /* Default configuration settings for bgpd. */ | |
758 | #define BGP_VTY_PORT 2605 | |
718e3744 | 759 | #define BGP_DEFAULT_CONFIG "bgpd.conf" |
760 | ||
761 | /* Check AS path loop when we send NLRI. */ | |
762 | /* #define BGP_SEND_ASPATH_CHECK */ | |
763 | ||
718e3744 | 764 | /* Flag for peer_clear_soft(). */ |
765 | enum bgp_clear_type | |
766 | { | |
767 | BGP_CLEAR_SOFT_NONE, | |
768 | BGP_CLEAR_SOFT_OUT, | |
769 | BGP_CLEAR_SOFT_IN, | |
770 | BGP_CLEAR_SOFT_BOTH, | |
fee0f4c6 | 771 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, |
772 | BGP_CLEAR_SOFT_RSCLIENT | |
718e3744 | 773 | }; |
774 | ||
775 | /* Macros. */ | |
776 | #define BGP_INPUT(P) ((P)->ibuf) | |
777 | #define BGP_INPUT_PNT(P) (STREAM_PNT(BGP_INPUT(P))) | |
778 | ||
718e3744 | 779 | /* Count prefix size from mask length */ |
780 | #define PSIZE(a) (((a) + 7) / (8)) | |
781 | ||
782 | /* BGP error codes. */ | |
783 | #define BGP_SUCCESS 0 | |
784 | #define BGP_ERR_INVALID_VALUE -1 | |
785 | #define BGP_ERR_INVALID_FLAG -2 | |
786 | #define BGP_ERR_INVALID_AS -3 | |
787 | #define BGP_ERR_INVALID_BGP -4 | |
788 | #define BGP_ERR_PEER_GROUP_MEMBER -5 | |
789 | #define BGP_ERR_MULTIPLE_INSTANCE_USED -6 | |
790 | #define BGP_ERR_PEER_GROUP_MEMBER_EXISTS -7 | |
791 | #define BGP_ERR_PEER_BELONGS_TO_GROUP -8 | |
792 | #define BGP_ERR_PEER_GROUP_AF_UNCONFIGURED -9 | |
793 | #define BGP_ERR_PEER_GROUP_NO_REMOTE_AS -10 | |
794 | #define BGP_ERR_PEER_GROUP_CANT_CHANGE -11 | |
795 | #define BGP_ERR_PEER_GROUP_MISMATCH -12 | |
796 | #define BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT -13 | |
797 | #define BGP_ERR_MULTIPLE_INSTANCE_NOT_SET -14 | |
798 | #define BGP_ERR_AS_MISMATCH -15 | |
799 | #define BGP_ERR_PEER_INACTIVE -16 | |
800 | #define BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER -17 | |
801 | #define BGP_ERR_PEER_GROUP_HAS_THE_FLAG -18 | |
802 | #define BGP_ERR_PEER_FLAG_CONFLICT -19 | |
803 | #define BGP_ERR_PEER_GROUP_SHUTDOWN -20 | |
804 | #define BGP_ERR_PEER_FILTER_CONFLICT -21 | |
805 | #define BGP_ERR_NOT_INTERNAL_PEER -22 | |
806 | #define BGP_ERR_REMOVE_PRIVATE_AS -23 | |
807 | #define BGP_ERR_AF_UNCONFIGURED -24 | |
808 | #define BGP_ERR_SOFT_RECONFIG_UNCONFIGURED -25 | |
809 | #define BGP_ERR_INSTANCE_MISMATCH -26 | |
810 | #define BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP -27 | |
811 | #define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS -28 | |
0df7c91f | 812 | #define BGP_ERR_TCPSIG_FAILED -29 |
fa411a21 | 813 | #define BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK -30 |
f5a4827d SH |
814 | #define BGP_ERR_NO_IBGP_WITH_TTLHACK -31 |
815 | #define BGP_ERR_MAX -32 | |
718e3744 | 816 | |
817 | extern struct bgp_master *bm; | |
818 | ||
819 | extern struct thread_master *master; | |
820 | ||
821 | /* Prototypes. */ | |
94f2b392 | 822 | extern void bgp_terminate (void); |
823 | extern void bgp_reset (void); | |
65957886 | 824 | extern time_t bgp_clock (void); |
94f2b392 | 825 | extern void bgp_zclient_reset (void); |
826 | extern int bgp_nexthop_set (union sockunion *, union sockunion *, | |
718e3744 | 827 | struct bgp_nexthop *, struct peer *); |
94f2b392 | 828 | extern struct bgp *bgp_get_default (void); |
829 | extern struct bgp *bgp_lookup (as_t, const char *); | |
830 | extern struct bgp *bgp_lookup_by_name (const char *); | |
831 | extern struct peer *peer_lookup (struct bgp *, union sockunion *); | |
832 | extern struct peer_group *peer_group_lookup (struct bgp *, const char *); | |
833 | extern struct peer_group *peer_group_get (struct bgp *, const char *); | |
834 | extern struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *, | |
718e3744 | 835 | int *); |
200df115 | 836 | extern struct peer *peer_lock (struct peer *); |
837 | extern struct peer *peer_unlock (struct peer *); | |
6d85b15b | 838 | extern bgp_peer_sort_t peer_sort (struct peer *peer); |
94f2b392 | 839 | extern int peer_active (struct peer *); |
840 | extern int peer_active_nego (struct peer *); | |
841 | extern struct peer *peer_create_accept (struct bgp *); | |
842 | extern char *peer_uptime (time_t, char *, size_t); | |
843 | extern int bgp_config_write (struct vty *); | |
844 | extern void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *); | |
718e3744 | 845 | \f |
94f2b392 | 846 | extern void bgp_master_init (void); |
718e3744 | 847 | |
94f2b392 | 848 | extern void bgp_init (void); |
7621f336 | 849 | extern int bgp_socket_init (void); |
94f2b392 | 850 | extern void bgp_route_map_init (void); |
718e3744 | 851 | |
94f2b392 | 852 | extern int bgp_option_set (int); |
853 | extern int bgp_option_unset (int); | |
854 | extern int bgp_option_check (int); | |
718e3744 | 855 | |
94f2b392 | 856 | extern int bgp_get (struct bgp **, as_t *, const char *); |
857 | extern int bgp_delete (struct bgp *); | |
718e3744 | 858 | |
94f2b392 | 859 | extern int bgp_flag_set (struct bgp *, int); |
860 | extern int bgp_flag_unset (struct bgp *, int); | |
861 | extern int bgp_flag_check (struct bgp *, int); | |
718e3744 | 862 | |
0088b5dc SH |
863 | extern void bgp_lock (struct bgp *); |
864 | extern void bgp_unlock (struct bgp *); | |
865 | ||
94f2b392 | 866 | extern int bgp_router_id_set (struct bgp *, struct in_addr *); |
718e3744 | 867 | |
94f2b392 | 868 | extern int bgp_cluster_id_set (struct bgp *, struct in_addr *); |
869 | extern int bgp_cluster_id_unset (struct bgp *); | |
718e3744 | 870 | |
94f2b392 | 871 | extern int bgp_confederation_id_set (struct bgp *, as_t); |
872 | extern int bgp_confederation_id_unset (struct bgp *); | |
873 | extern int bgp_confederation_peers_check (struct bgp *, as_t); | |
718e3744 | 874 | |
94f2b392 | 875 | extern int bgp_confederation_peers_add (struct bgp *, as_t); |
876 | extern int bgp_confederation_peers_remove (struct bgp *, as_t); | |
718e3744 | 877 | |
94f2b392 | 878 | extern int bgp_timers_set (struct bgp *, u_int32_t, u_int32_t); |
879 | extern int bgp_timers_unset (struct bgp *); | |
718e3744 | 880 | |
94f2b392 | 881 | extern int bgp_default_local_preference_set (struct bgp *, u_int32_t); |
882 | extern int bgp_default_local_preference_unset (struct bgp *); | |
718e3744 | 883 | |
94f2b392 | 884 | extern int peer_rsclient_active (struct peer *); |
fee0f4c6 | 885 | |
94f2b392 | 886 | extern int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t); |
887 | extern int peer_group_remote_as (struct bgp *, const char *, as_t *); | |
888 | extern int peer_delete (struct peer *peer); | |
889 | extern int peer_group_delete (struct peer_group *); | |
890 | extern int peer_group_remote_as_delete (struct peer_group *); | |
718e3744 | 891 | |
94f2b392 | 892 | extern int peer_activate (struct peer *, afi_t, safi_t); |
893 | extern int peer_deactivate (struct peer *, afi_t, safi_t); | |
718e3744 | 894 | |
94f2b392 | 895 | extern int peer_group_bind (struct bgp *, union sockunion *, struct peer_group *, |
718e3744 | 896 | afi_t, safi_t, as_t *); |
94f2b392 | 897 | extern int peer_group_unbind (struct bgp *, struct peer *, struct peer_group *, |
718e3744 | 898 | afi_t, safi_t); |
899 | ||
94f2b392 | 900 | extern int peer_flag_set (struct peer *, u_int32_t); |
901 | extern int peer_flag_unset (struct peer *, u_int32_t); | |
718e3744 | 902 | |
94f2b392 | 903 | extern int peer_af_flag_set (struct peer *, afi_t, safi_t, u_int32_t); |
904 | extern int peer_af_flag_unset (struct peer *, afi_t, safi_t, u_int32_t); | |
905 | extern int peer_af_flag_check (struct peer *, afi_t, safi_t, u_int32_t); | |
718e3744 | 906 | |
94f2b392 | 907 | extern int peer_ebgp_multihop_set (struct peer *, int); |
908 | extern int peer_ebgp_multihop_unset (struct peer *); | |
718e3744 | 909 | |
94f2b392 | 910 | extern int peer_description_set (struct peer *, char *); |
911 | extern int peer_description_unset (struct peer *); | |
718e3744 | 912 | |
94f2b392 | 913 | extern int peer_update_source_if_set (struct peer *, const char *); |
914 | extern int peer_update_source_addr_set (struct peer *, union sockunion *); | |
915 | extern int peer_update_source_unset (struct peer *); | |
718e3744 | 916 | |
94f2b392 | 917 | extern int peer_default_originate_set (struct peer *, afi_t, safi_t, const char *); |
918 | extern int peer_default_originate_unset (struct peer *, afi_t, safi_t); | |
718e3744 | 919 | |
94f2b392 | 920 | extern int peer_port_set (struct peer *, u_int16_t); |
921 | extern int peer_port_unset (struct peer *); | |
718e3744 | 922 | |
94f2b392 | 923 | extern int peer_weight_set (struct peer *, u_int16_t); |
924 | extern int peer_weight_unset (struct peer *); | |
718e3744 | 925 | |
94f2b392 | 926 | extern int peer_timers_set (struct peer *, u_int32_t, u_int32_t); |
927 | extern int peer_timers_unset (struct peer *); | |
718e3744 | 928 | |
94f2b392 | 929 | extern int peer_timers_connect_set (struct peer *, u_int32_t); |
930 | extern int peer_timers_connect_unset (struct peer *); | |
718e3744 | 931 | |
94f2b392 | 932 | extern int peer_advertise_interval_set (struct peer *, u_int32_t); |
933 | extern int peer_advertise_interval_unset (struct peer *); | |
718e3744 | 934 | |
94f2b392 | 935 | extern int peer_interface_set (struct peer *, const char *); |
936 | extern int peer_interface_unset (struct peer *); | |
718e3744 | 937 | |
94f2b392 | 938 | extern int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *); |
939 | extern int peer_distribute_unset (struct peer *, afi_t, safi_t, int); | |
718e3744 | 940 | |
94f2b392 | 941 | extern int peer_allowas_in_set (struct peer *, afi_t, safi_t, int); |
942 | extern int peer_allowas_in_unset (struct peer *, afi_t, safi_t); | |
718e3744 | 943 | |
94f2b392 | 944 | extern int peer_local_as_set (struct peer *, as_t, int); |
945 | extern int peer_local_as_unset (struct peer *); | |
718e3744 | 946 | |
94f2b392 | 947 | extern int peer_prefix_list_set (struct peer *, afi_t, safi_t, int, const char *); |
948 | extern int peer_prefix_list_unset (struct peer *, afi_t, safi_t, int); | |
718e3744 | 949 | |
94f2b392 | 950 | extern int peer_aslist_set (struct peer *, afi_t, safi_t, int, const char *); |
951 | extern int peer_aslist_unset (struct peer *,afi_t, safi_t, int); | |
718e3744 | 952 | |
94f2b392 | 953 | extern int peer_route_map_set (struct peer *, afi_t, safi_t, int, const char *); |
954 | extern int peer_route_map_unset (struct peer *, afi_t, safi_t, int); | |
718e3744 | 955 | |
94f2b392 | 956 | extern int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, const char *); |
0df7c91f PJ |
957 | |
958 | extern int peer_password_set (struct peer *, const char *); | |
959 | extern int peer_password_unset (struct peer *); | |
960 | ||
94f2b392 | 961 | extern int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t); |
718e3744 | 962 | |
94f2b392 | 963 | extern int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int, u_int16_t); |
964 | extern int peer_maximum_prefix_unset (struct peer *, afi_t, safi_t); | |
718e3744 | 965 | |
94f2b392 | 966 | extern int peer_clear (struct peer *); |
967 | extern int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type); | |
93406d87 | 968 | |
fa411a21 NH |
969 | extern int peer_ttl_security_hops_set (struct peer *, int); |
970 | extern int peer_ttl_security_hops_unset (struct peer *); | |
971 | ||
00d252cb | 972 | #endif /* _QUAGGA_BGPD_H */ |