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