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