blob: afe0663571d6e77993d2feeef930042a8c0014d6 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* 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
paul00d252c2005-05-23 14:19:54 +000021#ifndef _QUAGGA_BGPD_H
22#define _QUAGGA_BGPD_H
23
paul718e3742002-12-13 20:15:29 +000024/* For union sockunion. */
25#include "sockunion.h"
26
27/* Typedef BGP specific types. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +000028typedef u_int32_t as_t;
29typedef u_int16_t as16_t; /* we may still encounter 16 Bit asnums */
paul718e3742002-12-13 20:15:29 +000030typedef u_int16_t bgp_size_t;
31
32/* BGP master for system wide configurations and variables. */
33struct bgp_master
34{
35 /* BGP instance list. */
36 struct list *bgp;
37
38 /* BGP thread master. */
39 struct thread_master *master;
40
paul200df112005-06-01 11:17:05 +000041 /* work queues */
42 struct work_queue *process_main_queue;
43 struct work_queue *process_rsclient_queue;
paul200df112005-06-01 11:17:05 +000044
Paul Jakma0df7c912008-07-21 21:02:49 +000045 /* Listening sockets */
46 struct list *listen_sockets;
47
paul718e3742002-12-13 20:15:29 +000048 /* BGP port number. */
49 u_int16_t port;
50
Paul Jakma3a02d1f2007-11-01 14:29:11 +000051 /* Listener address */
52 char *address;
53
paul718e3742002-12-13 20:15:29 +000054 /* BGP start time. */
55 time_t start_time;
56
57 /* Various BGP global configuration. */
58 u_char options;
59#define BGP_OPT_NO_FIB (1 << 0)
60#define BGP_OPT_MULTIPLE_INSTANCE (1 << 1)
61#define BGP_OPT_CONFIG_CISCO (1 << 2)
62};
63
64/* BGP instance structure. */
65struct bgp
66{
67 /* AS number of this BGP instance. */
68 as_t as;
69
70 /* Name of this BGP instance. */
71 char *name;
paul200df112005-06-01 11:17:05 +000072
paul718e3742002-12-13 20:15:29 +000073 /* Self peer. */
74 struct peer *peer_self;
75
76 /* BGP peer. */
77 struct list *peer;
78
79 /* BGP peer group. */
80 struct list *group;
81
paulfee0f4c2004-09-13 05:12:46 +000082 /* BGP route-server-clients. */
83 struct list *rsclient;
84
paul718e3742002-12-13 20:15:29 +000085 /* BGP configuration. */
86 u_int16_t config;
87#define BGP_CONFIG_ROUTER_ID (1 << 0)
88#define BGP_CONFIG_CLUSTER_ID (1 << 1)
89#define BGP_CONFIG_CONFEDERATION (1 << 2)
paul718e3742002-12-13 20:15:29 +000090
91 /* BGP router identifier. */
92 struct in_addr router_id;
hasso18a6dce2004-10-03 18:18:34 +000093 struct in_addr router_id_static;
paul718e3742002-12-13 20:15:29 +000094
95 /* BGP route reflector cluster ID. */
96 struct in_addr cluster_id;
97
98 /* BGP confederation information. */
99 as_t confed_id;
100 as_t *confed_peers;
101 int confed_peers_cnt;
102
103 /* BGP flags. */
104 u_int16_t flags;
105#define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0)
106#define BGP_FLAG_DETERMINISTIC_MED (1 << 1)
107#define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2)
108#define BGP_FLAG_MED_CONFED (1 << 3)
109#define BGP_FLAG_NO_DEFAULT_IPV4 (1 << 4)
110#define BGP_FLAG_NO_CLIENT_TO_CLIENT (1 << 5)
111#define BGP_FLAG_ENFORCE_FIRST_AS (1 << 6)
112#define BGP_FLAG_COMPARE_ROUTER_ID (1 << 7)
113#define BGP_FLAG_ASPATH_IGNORE (1 << 8)
114#define BGP_FLAG_IMPORT_CHECK (1 << 9)
115#define BGP_FLAG_NO_FAST_EXT_FAILOVER (1 << 10)
paul848973c2003-08-13 00:32:49 +0000116#define BGP_FLAG_LOG_NEIGHBOR_CHANGES (1 << 11)
hasso538621f2004-05-21 09:31:30 +0000117#define BGP_FLAG_GRACEFUL_RESTART (1 << 12)
hasso68118452005-04-08 15:40:36 +0000118#define BGP_FLAG_ASPATH_CONFED (1 << 13)
paul718e3742002-12-13 20:15:29 +0000119
120 /* BGP Per AF flags */
121 u_int16_t af_flags[AFI_MAX][SAFI_MAX];
122#define BGP_CONFIG_DAMPENING (1 << 0)
123
124 /* Static route configuration. */
125 struct bgp_table *route[AFI_MAX][SAFI_MAX];
126
127 /* Aggregate address configuration. */
128 struct bgp_table *aggregate[AFI_MAX][SAFI_MAX];
129
130 /* BGP routing information base. */
131 struct bgp_table *rib[AFI_MAX][SAFI_MAX];
132
133 /* BGP redistribute configuration. */
134 u_char redist[AFI_MAX][ZEBRA_ROUTE_MAX];
135
136 /* BGP redistribute metric configuration. */
137 u_char redist_metric_flag[AFI_MAX][ZEBRA_ROUTE_MAX];
138 u_int32_t redist_metric[AFI_MAX][ZEBRA_ROUTE_MAX];
139
140 /* BGP redistribute route-map. */
141 struct
142 {
143 char *name;
144 struct route_map *map;
145 } rmap[AFI_MAX][ZEBRA_ROUTE_MAX];
146
147 /* BGP distance configuration. */
148 u_char distance_ebgp;
149 u_char distance_ibgp;
150 u_char distance_local;
151
152 /* BGP default local-preference. */
153 u_int32_t default_local_pref;
154
155 /* BGP default timer. */
156 u_int32_t default_holdtime;
157 u_int32_t default_keepalive;
hasso538621f2004-05-21 09:31:30 +0000158
159 /* BGP graceful restart */
hasso93406d82005-02-02 14:40:33 +0000160 u_int32_t restart_time;
161 u_int32_t stalepath_time;
paul718e3742002-12-13 20:15:29 +0000162};
163
164/* BGP peer-group support. */
165struct peer_group
166{
167 /* Name of the peer-group. */
168 char *name;
169
170 /* Pointer to BGP. */
171 struct bgp *bgp;
172
173 /* Peer-group client list. */
174 struct list *peer;
175
176 /* Peer-group config */
177 struct peer *conf;
178};
179
180/* BGP Notify message format. */
181struct bgp_notify
182{
183 u_char code;
184 u_char subcode;
185 char *data;
186 bgp_size_t length;
187};
188
189/* Next hop self address. */
190struct bgp_nexthop
191{
192 struct interface *ifp;
193 struct in_addr v4;
194#ifdef HAVE_IPV6
195 struct in6_addr v6_global;
196 struct in6_addr v6_local;
197#endif /* HAVE_IPV6 */
198};
199
200/* BGP router distinguisher value. */
201#define BGP_RD_SIZE 8
202
203struct bgp_rd
204{
205 u_char val[BGP_RD_SIZE];
206};
207
paulfee0f4c2004-09-13 05:12:46 +0000208#define RMAP_IN 0
209#define RMAP_OUT 1
210#define RMAP_IMPORT 2
211#define RMAP_EXPORT 3
212#define RMAP_MAX 4
213
paul718e3742002-12-13 20:15:29 +0000214/* BGP filter structure. */
215struct bgp_filter
216{
217 /* Distribute-list. */
218 struct
219 {
220 char *name;
221 struct access_list *alist;
222 } dlist[FILTER_MAX];
223
224 /* Prefix-list. */
225 struct
226 {
227 char *name;
228 struct prefix_list *plist;
229 } plist[FILTER_MAX];
230
231 /* Filter-list. */
232 struct
233 {
234 char *name;
235 struct as_list *aslist;
236 } aslist[FILTER_MAX];
237
238 /* Route-map. */
239 struct
240 {
241 char *name;
242 struct route_map *map;
paulfee0f4c2004-09-13 05:12:46 +0000243 } map[RMAP_MAX];
paul718e3742002-12-13 20:15:29 +0000244
245 /* Unsuppress-map. */
246 struct
247 {
248 char *name;
249 struct route_map *map;
250 } usmap;
251};
252
253/* BGP neighbor structure. */
254struct peer
255{
256 /* BGP structure. */
257 struct bgp *bgp;
258
paul200df112005-06-01 11:17:05 +0000259 /* reference count, primarily to allow bgp_process'ing of route_node's
260 * to be done after a struct peer is deleted.
261 *
262 * named 'lock' for hysterical reasons within Quagga.
263 */
264 int lock;
265
paul718e3742002-12-13 20:15:29 +0000266 /* BGP peer group. */
267 struct peer_group *group;
268 u_char af_group[AFI_MAX][SAFI_MAX];
269
270 /* Peer's remote AS number. */
271 as_t as;
272
273 /* Peer's local AS number. */
274 as_t local_as;
275
276 /* Peer's Change local AS number. */
277 as_t change_local_as;
278
279 /* Remote router ID. */
280 struct in_addr remote_id;
281
282 /* Local router ID. */
283 struct in_addr local_id;
284
paulfee0f4c2004-09-13 05:12:46 +0000285 /* Peer specific RIB when configured as route-server-client. */
286 struct bgp_table *rib[AFI_MAX][SAFI_MAX];
287
paul718e3742002-12-13 20:15:29 +0000288 /* Packet receive and send buffer. */
289 struct stream *ibuf;
290 struct stream_fifo *obuf;
291 struct stream *work;
292
293 /* Status of the peer. */
294 int status;
295 int ostatus;
296
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000297 /* Peer index, used for dumping TABLE_DUMP_V2 format */
298 uint16_t table_dump_index;
299
paul718e3742002-12-13 20:15:29 +0000300 /* Peer information */
pauleb821182004-05-01 08:44:08 +0000301 int fd; /* File descriptor */
302 int ttl; /* TTL of TCP connection to the peer. */
303 char *desc; /* Description of the peer. */
304 unsigned short port; /* Destination port for peer */
305 char *host; /* Printable address of the peer. */
306 union sockunion su; /* Sockunion address of the peer. */
307 time_t uptime; /* Last Up/Down time */
308 time_t readtime; /* Last read time */
309 time_t resettime; /* Last reset time */
paul718e3742002-12-13 20:15:29 +0000310
pauleb821182004-05-01 08:44:08 +0000311 unsigned int ifindex; /* ifindex of the BGP connection. */
312 char *ifname; /* bind interface name. */
313 char *update_if;
314 union sockunion *update_source;
315 struct zlog *log;
paul718e3742002-12-13 20:15:29 +0000316
pauleb821182004-05-01 08:44:08 +0000317 union sockunion *su_local; /* Sockunion of local address. */
318 union sockunion *su_remote; /* Sockunion of remote address. */
319 int shared_network; /* Is this peer shared same network. */
320 struct bgp_nexthop nexthop; /* Nexthop */
paul718e3742002-12-13 20:15:29 +0000321
322 /* Peer address family configuration. */
323 u_char afc[AFI_MAX][SAFI_MAX];
324 u_char afc_nego[AFI_MAX][SAFI_MAX];
325 u_char afc_adv[AFI_MAX][SAFI_MAX];
326 u_char afc_recv[AFI_MAX][SAFI_MAX];
327
hasso0a486e52005-02-01 20:57:17 +0000328 /* Capability flags (reset in bgp_stop) */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000329 u_int16_t cap;
paul718e3742002-12-13 20:15:29 +0000330#define PEER_CAP_REFRESH_ADV (1 << 0) /* refresh advertised */
331#define PEER_CAP_REFRESH_OLD_RCV (1 << 1) /* refresh old received */
332#define PEER_CAP_REFRESH_NEW_RCV (1 << 2) /* refresh rfc received */
333#define PEER_CAP_DYNAMIC_ADV (1 << 3) /* dynamic advertised */
334#define PEER_CAP_DYNAMIC_RCV (1 << 4) /* dynamic received */
hasso538621f2004-05-21 09:31:30 +0000335#define PEER_CAP_RESTART_ADV (1 << 5) /* restart advertised */
336#define PEER_CAP_RESTART_RCV (1 << 6) /* restart received */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000337#define PEER_CAP_AS4_ADV (1 << 7) /* as4 advertised */
338#define PEER_CAP_AS4_RCV (1 << 8) /* as4 received */
paul718e3742002-12-13 20:15:29 +0000339
hasso0a486e52005-02-01 20:57:17 +0000340 /* Capability flags (reset in bgp_stop) */
paul718e3742002-12-13 20:15:29 +0000341 u_int16_t af_cap[AFI_MAX][SAFI_MAX];
342#define PEER_CAP_ORF_PREFIX_SM_ADV (1 << 0) /* send-mode advertised */
343#define PEER_CAP_ORF_PREFIX_RM_ADV (1 << 1) /* receive-mode advertised */
344#define PEER_CAP_ORF_PREFIX_SM_RCV (1 << 2) /* send-mode received */
345#define PEER_CAP_ORF_PREFIX_RM_RCV (1 << 3) /* receive-mode received */
346#define PEER_CAP_ORF_PREFIX_SM_OLD_RCV (1 << 4) /* send-mode received */
347#define PEER_CAP_ORF_PREFIX_RM_OLD_RCV (1 << 5) /* receive-mode received */
hasso93406d82005-02-02 14:40:33 +0000348#define PEER_CAP_RESTART_AF_RCV (1 << 6) /* graceful restart afi/safi received */
349#define PEER_CAP_RESTART_AF_PRESERVE_RCV (1 << 7) /* graceful restart afi/safi F-bit received */
paul718e3742002-12-13 20:15:29 +0000350
351 /* Global configuration flags. */
352 u_int32_t flags;
353#define PEER_FLAG_PASSIVE (1 << 0) /* passive mode */
354#define PEER_FLAG_SHUTDOWN (1 << 1) /* shutdown */
355#define PEER_FLAG_DONT_CAPABILITY (1 << 2) /* dont-capability */
356#define PEER_FLAG_OVERRIDE_CAPABILITY (1 << 3) /* override-capability */
357#define PEER_FLAG_STRICT_CAP_MATCH (1 << 4) /* strict-match */
hassoc9502432005-02-01 22:01:48 +0000358#define PEER_FLAG_DYNAMIC_CAPABILITY (1 << 5) /* dynamic capability */
hasso6ffd2072005-02-02 14:50:11 +0000359#define PEER_FLAG_DISABLE_CONNECTED_CHECK (1 << 6) /* disable-connected-check */
hassoc9502432005-02-01 22:01:48 +0000360#define PEER_FLAG_LOCAL_AS_NO_PREPEND (1 << 7) /* local-as no-prepend */
paul718e3742002-12-13 20:15:29 +0000361
hasso93406d82005-02-02 14:40:33 +0000362 /* NSF mode (graceful restart) */
363 u_char nsf[AFI_MAX][SAFI_MAX];
364
paul718e3742002-12-13 20:15:29 +0000365 /* Per AF configuration flags. */
366 u_int32_t af_flags[AFI_MAX][SAFI_MAX];
367#define PEER_FLAG_SEND_COMMUNITY (1 << 0) /* send-community */
368#define PEER_FLAG_SEND_EXT_COMMUNITY (1 << 1) /* send-community ext. */
369#define PEER_FLAG_NEXTHOP_SELF (1 << 2) /* next-hop-self */
370#define PEER_FLAG_REFLECTOR_CLIENT (1 << 3) /* reflector-client */
371#define PEER_FLAG_RSERVER_CLIENT (1 << 4) /* route-server-client */
372#define PEER_FLAG_SOFT_RECONFIG (1 << 5) /* soft-reconfiguration */
373#define PEER_FLAG_AS_PATH_UNCHANGED (1 << 6) /* transparent-as */
374#define PEER_FLAG_NEXTHOP_UNCHANGED (1 << 7) /* transparent-next-hop */
375#define PEER_FLAG_MED_UNCHANGED (1 << 8) /* transparent-next-hop */
376#define PEER_FLAG_DEFAULT_ORIGINATE (1 << 9) /* default-originate */
377#define PEER_FLAG_REMOVE_PRIVATE_AS (1 << 10) /* remove-private-as */
378#define PEER_FLAG_ALLOWAS_IN (1 << 11) /* set allowas-in */
379#define PEER_FLAG_ORF_PREFIX_SM (1 << 12) /* orf capability send-mode */
380#define PEER_FLAG_ORF_PREFIX_RM (1 << 13) /* orf capability receive-mode */
381#define PEER_FLAG_MAX_PREFIX (1 << 14) /* maximum prefix */
382#define PEER_FLAG_MAX_PREFIX_WARNING (1 << 15) /* maximum prefix warning-only */
Paul Jakma0df7c912008-07-21 21:02:49 +0000383#define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1 << 16) /* leave link-local nexthop unchanged */
384
385 /* MD5 password */
386 char *password;
paul718e3742002-12-13 20:15:29 +0000387
388 /* default-originate route-map. */
389 struct
390 {
391 char *name;
392 struct route_map *map;
393 } default_rmap[AFI_MAX][SAFI_MAX];
394
395 /* Peer status flags. */
396 u_int16_t sflags;
397#define PEER_STATUS_ACCEPT_PEER (1 << 0) /* accept peer */
398#define PEER_STATUS_PREFIX_OVERFLOW (1 << 1) /* prefix-overflow */
399#define PEER_STATUS_CAPABILITY_OPEN (1 << 2) /* capability open send */
400#define PEER_STATUS_HAVE_ACCEPT (1 << 3) /* accept peer's parent */
401#define PEER_STATUS_GROUP (1 << 4) /* peer-group conf */
hasso93406d82005-02-02 14:40:33 +0000402#define PEER_STATUS_NSF_MODE (1 << 5) /* NSF aware peer */
403#define PEER_STATUS_NSF_WAIT (1 << 6) /* wait comeback peer */
paul718e3742002-12-13 20:15:29 +0000404
hasso0a486e52005-02-01 20:57:17 +0000405 /* Peer status af flags (reset in bgp_stop) */
paul718e3742002-12-13 20:15:29 +0000406 u_int16_t af_sflags[AFI_MAX][SAFI_MAX];
407#define PEER_STATUS_ORF_PREFIX_SEND (1 << 0) /* prefix-list send peer */
408#define PEER_STATUS_ORF_WAIT_REFRESH (1 << 1) /* wait refresh received peer */
409#define PEER_STATUS_DEFAULT_ORIGINATE (1 << 2) /* default-originate peer */
hassoe0701b72004-05-20 09:19:34 +0000410#define PEER_STATUS_PREFIX_THRESHOLD (1 << 3) /* exceed prefix-threshold */
411#define PEER_STATUS_PREFIX_LIMIT (1 << 4) /* exceed prefix-limit */
hasso93406d82005-02-02 14:40:33 +0000412#define PEER_STATUS_EOR_SEND (1 << 5) /* end-of-rib send to peer */
413#define PEER_STATUS_EOR_RECEIVED (1 << 6) /* end-of-rib received from peer */
hassoe0701b72004-05-20 09:19:34 +0000414
paul718e3742002-12-13 20:15:29 +0000415 /* Default attribute value for the peer. */
416 u_int32_t config;
417#define PEER_CONFIG_WEIGHT (1 << 0) /* Default weight. */
418#define PEER_CONFIG_TIMER (1 << 1) /* keepalive & holdtime */
419#define PEER_CONFIG_CONNECT (1 << 2) /* connect */
420#define PEER_CONFIG_ROUTEADV (1 << 3) /* route advertise */
421 u_int32_t weight;
422 u_int32_t holdtime;
423 u_int32_t keepalive;
424 u_int32_t connect;
425 u_int32_t routeadv;
426
427 /* Timer values. */
428 u_int32_t v_start;
429 u_int32_t v_connect;
430 u_int32_t v_holdtime;
431 u_int32_t v_keepalive;
432 u_int32_t v_asorig;
433 u_int32_t v_routeadv;
hasso0a486e52005-02-01 20:57:17 +0000434 u_int32_t v_pmax_restart;
hasso93406d82005-02-02 14:40:33 +0000435 u_int32_t v_gr_restart;
paul718e3742002-12-13 20:15:29 +0000436
437 /* Threads. */
438 struct thread *t_read;
439 struct thread *t_write;
440 struct thread *t_start;
441 struct thread *t_connect;
442 struct thread *t_holdtime;
443 struct thread *t_keepalive;
444 struct thread *t_asorig;
445 struct thread *t_routeadv;
hasso0a486e52005-02-01 20:57:17 +0000446 struct thread *t_pmax_restart;
hasso93406d82005-02-02 14:40:33 +0000447 struct thread *t_gr_restart;
448 struct thread *t_gr_stale;
Paul Jakma64e580a2006-02-21 01:09:01 +0000449
450 /* workqueues */
451 struct work_queue *clear_node_queue;
452
paul718e3742002-12-13 20:15:29 +0000453 /* Statistics field */
454 u_int32_t open_in; /* Open message input count */
455 u_int32_t open_out; /* Open message output count */
456 u_int32_t update_in; /* Update message input count */
457 u_int32_t update_out; /* Update message ouput count */
458 time_t update_time; /* Update message received time. */
459 u_int32_t keepalive_in; /* Keepalive input count */
460 u_int32_t keepalive_out; /* Keepalive output count */
461 u_int32_t notify_in; /* Notify input count */
462 u_int32_t notify_out; /* Notify output count */
463 u_int32_t refresh_in; /* Route Refresh input count */
464 u_int32_t refresh_out; /* Route Refresh output count */
465 u_int32_t dynamic_cap_in; /* Dynamic Capability input count. */
466 u_int32_t dynamic_cap_out; /* Dynamic Capability output count. */
467
468 /* BGP state count */
469 u_int32_t established; /* Established */
470 u_int32_t dropped; /* Dropped */
471
472 /* Syncronization list and time. */
473 struct bgp_synchronize *sync[AFI_MAX][SAFI_MAX];
474 time_t synctime;
475
476 /* Send prefix count. */
477 unsigned long scount[AFI_MAX][SAFI_MAX];
478
479 /* Announcement attribute hash. */
480 struct hash *hash[AFI_MAX][SAFI_MAX];
481
482 /* Notify data. */
483 struct bgp_notify notify;
484
485 /* Whole packet size to be read. */
486 unsigned long packet_size;
487
488 /* Filter structure. */
489 struct bgp_filter filter[AFI_MAX][SAFI_MAX];
490
491 /* ORF Prefix-list */
492 struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX];
493
494 /* Prefix count. */
495 unsigned long pcount[AFI_MAX][SAFI_MAX];
496
497 /* Max prefix count. */
498 unsigned long pmax[AFI_MAX][SAFI_MAX];
hassoe0701b72004-05-20 09:19:34 +0000499 u_char pmax_threshold[AFI_MAX][SAFI_MAX];
hasso0a486e52005-02-01 20:57:17 +0000500 u_int16_t pmax_restart[AFI_MAX][SAFI_MAX];
hassoe0701b72004-05-20 09:19:34 +0000501#define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75
paul718e3742002-12-13 20:15:29 +0000502
503 /* allowas-in. */
504 char allowas_in[AFI_MAX][SAFI_MAX];
paulac41b2a2003-08-12 05:32:27 +0000505
hassoe0701b72004-05-20 09:19:34 +0000506 /* peer reset cause */
507 char last_reset;
508#define PEER_DOWN_RID_CHANGE 1 /* bgp router-id command */
509#define PEER_DOWN_REMOTE_AS_CHANGE 2 /* neighbor remote-as command */
510#define PEER_DOWN_LOCAL_AS_CHANGE 3 /* neighbor local-as command */
511#define PEER_DOWN_CLID_CHANGE 4 /* bgp cluster-id command */
512#define PEER_DOWN_CONFED_ID_CHANGE 5 /* bgp confederation identifier command */
513#define PEER_DOWN_CONFED_PEER_CHANGE 6 /* bgp confederation peer command */
514#define PEER_DOWN_RR_CLIENT_CHANGE 7 /* neighbor route-reflector-client command */
515#define PEER_DOWN_RS_CLIENT_CHANGE 8 /* neighbor route-server-client command */
516#define PEER_DOWN_UPDATE_SOURCE_CHANGE 9 /* neighbor update-source command */
517#define PEER_DOWN_AF_ACTIVATE 10 /* neighbor activate command */
518#define PEER_DOWN_USER_SHUTDOWN 11 /* neighbor shutdown command */
519#define PEER_DOWN_USER_RESET 12 /* clear ip bgp command */
520#define PEER_DOWN_NOTIFY_RECEIVED 13 /* notification received */
521#define PEER_DOWN_NOTIFY_SEND 14 /* notification send */
522#define PEER_DOWN_CLOSE_SESSION 15 /* tcp session close */
523#define PEER_DOWN_NEIGHBOR_DELETE 16 /* neghbor delete */
524#define PEER_DOWN_RMAP_BIND 17 /* neghbor peer-group command */
525#define PEER_DOWN_RMAP_UNBIND 18 /* no neighbor peer-group command */
526#define PEER_DOWN_CAPABILITY_CHANGE 19 /* neighbor capability command */
527#define PEER_DOWN_PASSIVE_CHANGE 20 /* neighbor passive command */
528#define PEER_DOWN_MULTIHOP_CHANGE 21 /* neighbor multihop command */
hasso93406d82005-02-02 14:40:33 +0000529#define PEER_DOWN_NSF_CLOSE_SESSION 22 /* NSF tcp session close */
hassoe0701b72004-05-20 09:19:34 +0000530
paulac41b2a2003-08-12 05:32:27 +0000531 /* The kind of route-map Flags.*/
532 u_char rmap_type;
533#define PEER_RMAP_TYPE_IN (1 << 0) /* neighbor route-map in */
534#define PEER_RMAP_TYPE_OUT (1 << 1) /* neighbor route-map out */
535#define PEER_RMAP_TYPE_NETWORK (1 << 2) /* network route-map */
536#define PEER_RMAP_TYPE_REDISTRIBUTE (1 << 3) /* redistribute route-map */
537#define PEER_RMAP_TYPE_DEFAULT (1 << 4) /* default-originate route-map */
538#define PEER_RMAP_TYPE_NOSET (1 << 5) /* not allow to set commands */
paulfee0f4c2004-09-13 05:12:46 +0000539#define PEER_RMAP_TYPE_IMPORT (1 << 6) /* neighbor route-map import */
540#define PEER_RMAP_TYPE_EXPORT (1 << 7) /* neighbor route-map export */
paul718e3742002-12-13 20:15:29 +0000541};
542
Paul Jakma0df7c912008-07-21 21:02:49 +0000543#define PEER_PASSWORD_MINLEN (1)
544#define PEER_PASSWORD_MAXLEN (80)
545
paul718e3742002-12-13 20:15:29 +0000546/* This structure's member directly points incoming packet data
547 stream. */
548struct bgp_nlri
549{
550 /* AFI. */
551 afi_t afi;
552
553 /* SAFI. */
554 safi_t safi;
555
556 /* Pointer to NLRI byte stream. */
557 u_char *nlri;
558
559 /* Length of whole NLRI. */
560 bgp_size_t length;
561};
562
563/* BGP versions. */
564#define BGP_VERSION_4 4
paul718e3742002-12-13 20:15:29 +0000565
566/* Default BGP port number. */
567#define BGP_PORT_DEFAULT 179
568
569/* BGP message header and packet size. */
570#define BGP_MARKER_SIZE 16
571#define BGP_HEADER_SIZE 19
572#define BGP_MAX_PACKET_SIZE 4096
573
574/* BGP minimum message size. */
575#define BGP_MSG_OPEN_MIN_SIZE (BGP_HEADER_SIZE + 10)
576#define BGP_MSG_UPDATE_MIN_SIZE (BGP_HEADER_SIZE + 4)
577#define BGP_MSG_NOTIFY_MIN_SIZE (BGP_HEADER_SIZE + 2)
578#define BGP_MSG_KEEPALIVE_MIN_SIZE (BGP_HEADER_SIZE + 0)
579#define BGP_MSG_ROUTE_REFRESH_MIN_SIZE (BGP_HEADER_SIZE + 4)
580#define BGP_MSG_CAPABILITY_MIN_SIZE (BGP_HEADER_SIZE + 3)
581
582/* BGP message types. */
583#define BGP_MSG_OPEN 1
584#define BGP_MSG_UPDATE 2
585#define BGP_MSG_NOTIFY 3
586#define BGP_MSG_KEEPALIVE 4
587#define BGP_MSG_ROUTE_REFRESH_NEW 5
588#define BGP_MSG_CAPABILITY 6
589#define BGP_MSG_ROUTE_REFRESH_OLD 128
590
591/* BGP open optional parameter. */
592#define BGP_OPEN_OPT_AUTH 1
593#define BGP_OPEN_OPT_CAP 2
594
595/* BGP4 attribute type codes. */
596#define BGP_ATTR_ORIGIN 1
597#define BGP_ATTR_AS_PATH 2
598#define BGP_ATTR_NEXT_HOP 3
599#define BGP_ATTR_MULTI_EXIT_DISC 4
600#define BGP_ATTR_LOCAL_PREF 5
601#define BGP_ATTR_ATOMIC_AGGREGATE 6
602#define BGP_ATTR_AGGREGATOR 7
603#define BGP_ATTR_COMMUNITIES 8
604#define BGP_ATTR_ORIGINATOR_ID 9
605#define BGP_ATTR_CLUSTER_LIST 10
606#define BGP_ATTR_DPA 11
607#define BGP_ATTR_ADVERTISER 12
608#define BGP_ATTR_RCID_PATH 13
609#define BGP_ATTR_MP_REACH_NLRI 14
610#define BGP_ATTR_MP_UNREACH_NLRI 15
611#define BGP_ATTR_EXT_COMMUNITIES 16
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000612#define BGP_ATTR_AS4_PATH 17
613#define BGP_ATTR_AS4_AGGREGATOR 18
Paul Jakma41367172007-08-06 15:24:51 +0000614#define BGP_ATTR_AS_PATHLIMIT 21
paul718e3742002-12-13 20:15:29 +0000615
616/* BGP update origin. */
617#define BGP_ORIGIN_IGP 0
618#define BGP_ORIGIN_EGP 1
619#define BGP_ORIGIN_INCOMPLETE 2
620
621/* BGP notify message codes. */
622#define BGP_NOTIFY_HEADER_ERR 1
623#define BGP_NOTIFY_OPEN_ERR 2
624#define BGP_NOTIFY_UPDATE_ERR 3
625#define BGP_NOTIFY_HOLD_ERR 4
626#define BGP_NOTIFY_FSM_ERR 5
627#define BGP_NOTIFY_CEASE 6
628#define BGP_NOTIFY_CAPABILITY_ERR 7
629#define BGP_NOTIFY_MAX 8
630
631/* BGP_NOTIFY_HEADER_ERR sub codes. */
632#define BGP_NOTIFY_HEADER_NOT_SYNC 1
633#define BGP_NOTIFY_HEADER_BAD_MESLEN 2
634#define BGP_NOTIFY_HEADER_BAD_MESTYPE 3
635#define BGP_NOTIFY_HEADER_MAX 4
636
637/* BGP_NOTIFY_OPEN_ERR sub codes. */
638#define BGP_NOTIFY_OPEN_UNSUP_VERSION 1
639#define BGP_NOTIFY_OPEN_BAD_PEER_AS 2
640#define BGP_NOTIFY_OPEN_BAD_BGP_IDENT 3
641#define BGP_NOTIFY_OPEN_UNSUP_PARAM 4
642#define BGP_NOTIFY_OPEN_AUTH_FAILURE 5
643#define BGP_NOTIFY_OPEN_UNACEP_HOLDTIME 6
644#define BGP_NOTIFY_OPEN_UNSUP_CAPBL 7
645#define BGP_NOTIFY_OPEN_MAX 8
646
647/* BGP_NOTIFY_UPDATE_ERR sub codes. */
648#define BGP_NOTIFY_UPDATE_MAL_ATTR 1
649#define BGP_NOTIFY_UPDATE_UNREC_ATTR 2
650#define BGP_NOTIFY_UPDATE_MISS_ATTR 3
651#define BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR 4
652#define BGP_NOTIFY_UPDATE_ATTR_LENG_ERR 5
653#define BGP_NOTIFY_UPDATE_INVAL_ORIGIN 6
654#define BGP_NOTIFY_UPDATE_AS_ROUTE_LOOP 7
655#define BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP 8
656#define BGP_NOTIFY_UPDATE_OPT_ATTR_ERR 9
657#define BGP_NOTIFY_UPDATE_INVAL_NETWORK 10
658#define BGP_NOTIFY_UPDATE_MAL_AS_PATH 11
659#define BGP_NOTIFY_UPDATE_MAX 12
660
paul545acaf2004-04-20 15:13:15 +0000661/* BGP_NOTIFY_CEASE sub codes (draft-ietf-idr-cease-subcode-05). */
paul718e3742002-12-13 20:15:29 +0000662#define BGP_NOTIFY_CEASE_MAX_PREFIX 1
663#define BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN 2
664#define BGP_NOTIFY_CEASE_PEER_UNCONFIG 3
665#define BGP_NOTIFY_CEASE_ADMIN_RESET 4
666#define BGP_NOTIFY_CEASE_CONNECT_REJECT 5
667#define BGP_NOTIFY_CEASE_CONFIG_CHANGE 6
paul545acaf2004-04-20 15:13:15 +0000668#define BGP_NOTIFY_CEASE_COLLISION_RESOLUTION 7
669#define BGP_NOTIFY_CEASE_OUT_OF_RESOURCE 8
670#define BGP_NOTIFY_CEASE_MAX 9
paul718e3742002-12-13 20:15:29 +0000671
672/* BGP_NOTIFY_CAPABILITY_ERR sub codes (draft-ietf-idr-dynamic-cap-02). */
673#define BGP_NOTIFY_CAPABILITY_INVALID_ACTION 1
674#define BGP_NOTIFY_CAPABILITY_INVALID_LENGTH 2
675#define BGP_NOTIFY_CAPABILITY_MALFORMED_CODE 3
676#define BGP_NOTIFY_CAPABILITY_MAX 4
677
678/* BGP finite state machine status. */
679#define Idle 1
680#define Connect 2
681#define Active 3
682#define OpenSent 4
683#define OpenConfirm 5
684#define Established 6
Paul Jakmaca058a32006-09-14 02:58:49 +0000685#define Clearing 7
686#define Deleted 8
687#define BGP_STATUS_MAX 9
paul718e3742002-12-13 20:15:29 +0000688
689/* BGP finite state machine events. */
690#define BGP_Start 1
691#define BGP_Stop 2
692#define TCP_connection_open 3
693#define TCP_connection_closed 4
694#define TCP_connection_open_failed 5
695#define TCP_fatal_error 6
696#define ConnectRetry_timer_expired 7
697#define Hold_Timer_expired 8
698#define KeepAlive_timer_expired 9
699#define Receive_OPEN_message 10
700#define Receive_KEEPALIVE_message 11
701#define Receive_UPDATE_message 12
702#define Receive_NOTIFICATION_message 13
Paul Jakmaca058a32006-09-14 02:58:49 +0000703#define Clearing_Completed 14
704#define BGP_EVENTS_MAX 15
paul718e3742002-12-13 20:15:29 +0000705
706/* BGP timers default value. */
707#define BGP_INIT_START_TIMER 5
708#define BGP_ERROR_START_TIMER 30
709#define BGP_DEFAULT_HOLDTIME 180
710#define BGP_DEFAULT_KEEPALIVE 60
711#define BGP_DEFAULT_ASORIGINATE 15
712#define BGP_DEFAULT_EBGP_ROUTEADV 30
713#define BGP_DEFAULT_IBGP_ROUTEADV 5
714#define BGP_CLEAR_CONNECT_RETRY 20
715#define BGP_DEFAULT_CONNECT_RETRY 120
716
717/* BGP default local preference. */
718#define BGP_DEFAULT_LOCAL_PREF 100
719
hasso538621f2004-05-21 09:31:30 +0000720/* BGP graceful restart */
721#define BGP_DEFAULT_RESTART_TIME 120
722#define BGP_DEFAULT_STALEPATH_TIME 360
723
paul718e3742002-12-13 20:15:29 +0000724/* SAFI which used in open capability negotiation. */
725#define BGP_SAFI_VPNV4 128
726#define BGP_SAFI_VPNV6 129
727
728/* Max TTL value. */
729#define TTL_MAX 255
730
731/* BGP uptime string length. */
732#define BGP_UPTIME_LEN 25
733
734/* Default configuration settings for bgpd. */
735#define BGP_VTY_PORT 2605
paul718e3742002-12-13 20:15:29 +0000736#define BGP_DEFAULT_CONFIG "bgpd.conf"
737
738/* Check AS path loop when we send NLRI. */
739/* #define BGP_SEND_ASPATH_CHECK */
740
741/* IBGP/EBGP identifier. We also have a CONFED peer, which is to say,
742 a peer who's AS is part of our Confederation. */
743enum
744{
745 BGP_PEER_IBGP,
746 BGP_PEER_EBGP,
747 BGP_PEER_INTERNAL,
748 BGP_PEER_CONFED
749};
750
751/* Flag for peer_clear_soft(). */
752enum bgp_clear_type
753{
754 BGP_CLEAR_SOFT_NONE,
755 BGP_CLEAR_SOFT_OUT,
756 BGP_CLEAR_SOFT_IN,
757 BGP_CLEAR_SOFT_BOTH,
paulfee0f4c2004-09-13 05:12:46 +0000758 BGP_CLEAR_SOFT_IN_ORF_PREFIX,
759 BGP_CLEAR_SOFT_RSCLIENT
paul718e3742002-12-13 20:15:29 +0000760};
761
762/* Macros. */
763#define BGP_INPUT(P) ((P)->ibuf)
764#define BGP_INPUT_PNT(P) (STREAM_PNT(BGP_INPUT(P)))
765
paul718e3742002-12-13 20:15:29 +0000766/* Count prefix size from mask length */
767#define PSIZE(a) (((a) + 7) / (8))
768
769/* BGP error codes. */
770#define BGP_SUCCESS 0
771#define BGP_ERR_INVALID_VALUE -1
772#define BGP_ERR_INVALID_FLAG -2
773#define BGP_ERR_INVALID_AS -3
774#define BGP_ERR_INVALID_BGP -4
775#define BGP_ERR_PEER_GROUP_MEMBER -5
776#define BGP_ERR_MULTIPLE_INSTANCE_USED -6
777#define BGP_ERR_PEER_GROUP_MEMBER_EXISTS -7
778#define BGP_ERR_PEER_BELONGS_TO_GROUP -8
779#define BGP_ERR_PEER_GROUP_AF_UNCONFIGURED -9
780#define BGP_ERR_PEER_GROUP_NO_REMOTE_AS -10
781#define BGP_ERR_PEER_GROUP_CANT_CHANGE -11
782#define BGP_ERR_PEER_GROUP_MISMATCH -12
783#define BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT -13
784#define BGP_ERR_MULTIPLE_INSTANCE_NOT_SET -14
785#define BGP_ERR_AS_MISMATCH -15
786#define BGP_ERR_PEER_INACTIVE -16
787#define BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER -17
788#define BGP_ERR_PEER_GROUP_HAS_THE_FLAG -18
789#define BGP_ERR_PEER_FLAG_CONFLICT -19
790#define BGP_ERR_PEER_GROUP_SHUTDOWN -20
791#define BGP_ERR_PEER_FILTER_CONFLICT -21
792#define BGP_ERR_NOT_INTERNAL_PEER -22
793#define BGP_ERR_REMOVE_PRIVATE_AS -23
794#define BGP_ERR_AF_UNCONFIGURED -24
795#define BGP_ERR_SOFT_RECONFIG_UNCONFIGURED -25
796#define BGP_ERR_INSTANCE_MISMATCH -26
797#define BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP -27
798#define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS -28
Paul Jakma0df7c912008-07-21 21:02:49 +0000799#define BGP_ERR_TCPSIG_FAILED -29
800#define BGP_ERR_MAX -30
paul718e3742002-12-13 20:15:29 +0000801
802extern struct bgp_master *bm;
803
804extern struct thread_master *master;
805
806/* Prototypes. */
paul94f2b392005-06-28 12:44:16 +0000807extern void bgp_terminate (void);
808extern void bgp_reset (void);
809extern void bgp_zclient_reset (void);
810extern int bgp_nexthop_set (union sockunion *, union sockunion *,
paul718e3742002-12-13 20:15:29 +0000811 struct bgp_nexthop *, struct peer *);
paul94f2b392005-06-28 12:44:16 +0000812extern struct bgp *bgp_get_default (void);
813extern struct bgp *bgp_lookup (as_t, const char *);
814extern struct bgp *bgp_lookup_by_name (const char *);
815extern struct peer *peer_lookup (struct bgp *, union sockunion *);
816extern struct peer_group *peer_group_lookup (struct bgp *, const char *);
817extern struct peer_group *peer_group_get (struct bgp *, const char *);
818extern struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *,
paul718e3742002-12-13 20:15:29 +0000819 int *);
paul200df112005-06-01 11:17:05 +0000820extern struct peer *peer_lock (struct peer *);
821extern struct peer *peer_unlock (struct peer *);
paul94f2b392005-06-28 12:44:16 +0000822extern int peer_sort (struct peer *peer);
823extern int peer_active (struct peer *);
824extern int peer_active_nego (struct peer *);
825extern struct peer *peer_create_accept (struct bgp *);
826extern char *peer_uptime (time_t, char *, size_t);
827extern int bgp_config_write (struct vty *);
828extern void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *);
paul718e3742002-12-13 20:15:29 +0000829
paul94f2b392005-06-28 12:44:16 +0000830extern void bgp_master_init (void);
paul718e3742002-12-13 20:15:29 +0000831
paul94f2b392005-06-28 12:44:16 +0000832extern void bgp_init (void);
833extern void bgp_route_map_init (void);
paul718e3742002-12-13 20:15:29 +0000834
paul94f2b392005-06-28 12:44:16 +0000835extern int bgp_option_set (int);
836extern int bgp_option_unset (int);
837extern int bgp_option_check (int);
paul718e3742002-12-13 20:15:29 +0000838
paul94f2b392005-06-28 12:44:16 +0000839extern int bgp_get (struct bgp **, as_t *, const char *);
840extern int bgp_delete (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000841
paul94f2b392005-06-28 12:44:16 +0000842extern int bgp_flag_set (struct bgp *, int);
843extern int bgp_flag_unset (struct bgp *, int);
844extern int bgp_flag_check (struct bgp *, int);
paul718e3742002-12-13 20:15:29 +0000845
paul94f2b392005-06-28 12:44:16 +0000846extern int bgp_router_id_set (struct bgp *, struct in_addr *);
paul718e3742002-12-13 20:15:29 +0000847
paul94f2b392005-06-28 12:44:16 +0000848extern int bgp_cluster_id_set (struct bgp *, struct in_addr *);
849extern int bgp_cluster_id_unset (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000850
paul94f2b392005-06-28 12:44:16 +0000851extern int bgp_confederation_id_set (struct bgp *, as_t);
852extern int bgp_confederation_id_unset (struct bgp *);
853extern int bgp_confederation_peers_check (struct bgp *, as_t);
paul718e3742002-12-13 20:15:29 +0000854
paul94f2b392005-06-28 12:44:16 +0000855extern int bgp_confederation_peers_add (struct bgp *, as_t);
856extern int bgp_confederation_peers_remove (struct bgp *, as_t);
paul718e3742002-12-13 20:15:29 +0000857
paul94f2b392005-06-28 12:44:16 +0000858extern int bgp_timers_set (struct bgp *, u_int32_t, u_int32_t);
859extern int bgp_timers_unset (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000860
paul94f2b392005-06-28 12:44:16 +0000861extern int bgp_default_local_preference_set (struct bgp *, u_int32_t);
862extern int bgp_default_local_preference_unset (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000863
paul94f2b392005-06-28 12:44:16 +0000864extern int peer_rsclient_active (struct peer *);
paulfee0f4c2004-09-13 05:12:46 +0000865
paul94f2b392005-06-28 12:44:16 +0000866extern int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t);
867extern int peer_group_remote_as (struct bgp *, const char *, as_t *);
868extern int peer_delete (struct peer *peer);
869extern int peer_group_delete (struct peer_group *);
870extern int peer_group_remote_as_delete (struct peer_group *);
paul718e3742002-12-13 20:15:29 +0000871
paul94f2b392005-06-28 12:44:16 +0000872extern int peer_activate (struct peer *, afi_t, safi_t);
873extern int peer_deactivate (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000874
paul94f2b392005-06-28 12:44:16 +0000875extern int peer_group_bind (struct bgp *, union sockunion *, struct peer_group *,
paul718e3742002-12-13 20:15:29 +0000876 afi_t, safi_t, as_t *);
paul94f2b392005-06-28 12:44:16 +0000877extern int peer_group_unbind (struct bgp *, struct peer *, struct peer_group *,
paul718e3742002-12-13 20:15:29 +0000878 afi_t, safi_t);
879
paul94f2b392005-06-28 12:44:16 +0000880extern int peer_flag_set (struct peer *, u_int32_t);
881extern int peer_flag_unset (struct peer *, u_int32_t);
paul718e3742002-12-13 20:15:29 +0000882
paul94f2b392005-06-28 12:44:16 +0000883extern int peer_af_flag_set (struct peer *, afi_t, safi_t, u_int32_t);
884extern int peer_af_flag_unset (struct peer *, afi_t, safi_t, u_int32_t);
885extern int peer_af_flag_check (struct peer *, afi_t, safi_t, u_int32_t);
paul718e3742002-12-13 20:15:29 +0000886
paul94f2b392005-06-28 12:44:16 +0000887extern int peer_ebgp_multihop_set (struct peer *, int);
888extern int peer_ebgp_multihop_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000889
paul94f2b392005-06-28 12:44:16 +0000890extern int peer_description_set (struct peer *, char *);
891extern int peer_description_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000892
paul94f2b392005-06-28 12:44:16 +0000893extern int peer_update_source_if_set (struct peer *, const char *);
894extern int peer_update_source_addr_set (struct peer *, union sockunion *);
895extern int peer_update_source_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000896
paul94f2b392005-06-28 12:44:16 +0000897extern int peer_default_originate_set (struct peer *, afi_t, safi_t, const char *);
898extern int peer_default_originate_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000899
paul94f2b392005-06-28 12:44:16 +0000900extern int peer_port_set (struct peer *, u_int16_t);
901extern int peer_port_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000902
paul94f2b392005-06-28 12:44:16 +0000903extern int peer_weight_set (struct peer *, u_int16_t);
904extern int peer_weight_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000905
paul94f2b392005-06-28 12:44:16 +0000906extern int peer_timers_set (struct peer *, u_int32_t, u_int32_t);
907extern int peer_timers_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000908
paul94f2b392005-06-28 12:44:16 +0000909extern int peer_timers_connect_set (struct peer *, u_int32_t);
910extern int peer_timers_connect_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000911
paul94f2b392005-06-28 12:44:16 +0000912extern int peer_advertise_interval_set (struct peer *, u_int32_t);
913extern int peer_advertise_interval_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000914
paul94f2b392005-06-28 12:44:16 +0000915extern int peer_interface_set (struct peer *, const char *);
916extern int peer_interface_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000917
paul94f2b392005-06-28 12:44:16 +0000918extern int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *);
919extern int peer_distribute_unset (struct peer *, afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000920
paul94f2b392005-06-28 12:44:16 +0000921extern int peer_allowas_in_set (struct peer *, afi_t, safi_t, int);
922extern int peer_allowas_in_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000923
paul94f2b392005-06-28 12:44:16 +0000924extern int peer_local_as_set (struct peer *, as_t, int);
925extern int peer_local_as_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000926
paul94f2b392005-06-28 12:44:16 +0000927extern int peer_prefix_list_set (struct peer *, afi_t, safi_t, int, const char *);
928extern int peer_prefix_list_unset (struct peer *, afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000929
paul94f2b392005-06-28 12:44:16 +0000930extern int peer_aslist_set (struct peer *, afi_t, safi_t, int, const char *);
931extern int peer_aslist_unset (struct peer *,afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000932
paul94f2b392005-06-28 12:44:16 +0000933extern int peer_route_map_set (struct peer *, afi_t, safi_t, int, const char *);
934extern int peer_route_map_unset (struct peer *, afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000935
paul94f2b392005-06-28 12:44:16 +0000936extern int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, const char *);
Paul Jakma0df7c912008-07-21 21:02:49 +0000937
938extern int peer_password_set (struct peer *, const char *);
939extern int peer_password_unset (struct peer *);
940
paul94f2b392005-06-28 12:44:16 +0000941extern int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000942
paul94f2b392005-06-28 12:44:16 +0000943extern int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int, u_int16_t);
944extern int peer_maximum_prefix_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000945
paul94f2b392005-06-28 12:44:16 +0000946extern int peer_clear (struct peer *);
947extern int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type);
hasso93406d82005-02-02 14:40:33 +0000948
paul94f2b392005-06-28 12:44:16 +0000949extern void peer_nsf_stop (struct peer *);
paul00d252c2005-05-23 14:19:54 +0000950
951#endif /* _QUAGGA_BGPD_H */