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