blob: 89dde8f10151259adff62d13ed02449f1623e979 [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)
Paul Jakmad664ae12007-08-31 14:27:37 +010062#define BGP_OPT_ALWAYS_OPEN (1 << 3)
paul718e3742002-12-13 20:15:29 +000063};
64
65/* BGP instance structure. */
66struct bgp
67{
68 /* AS number of this BGP instance. */
69 as_t as;
70
71 /* Name of this BGP instance. */
72 char *name;
paul200df112005-06-01 11:17:05 +000073
paul718e3742002-12-13 20:15:29 +000074 /* Self peer. */
75 struct peer *peer_self;
76
77 /* BGP peer. */
78 struct list *peer;
79
80 /* BGP peer group. */
81 struct list *group;
82
paulfee0f4c2004-09-13 05:12:46 +000083 /* BGP route-server-clients. */
84 struct list *rsclient;
85
paul718e3742002-12-13 20:15:29 +000086 /* BGP configuration. */
87 u_int16_t config;
88#define BGP_CONFIG_ROUTER_ID (1 << 0)
89#define BGP_CONFIG_CLUSTER_ID (1 << 1)
90#define BGP_CONFIG_CONFEDERATION (1 << 2)
paul718e3742002-12-13 20:15:29 +000091
92 /* BGP router identifier. */
93 struct in_addr router_id;
hasso18a6dce2004-10-03 18:18:34 +000094 struct in_addr router_id_static;
paul718e3742002-12-13 20:15:29 +000095
96 /* BGP route reflector cluster ID. */
97 struct in_addr cluster_id;
98
99 /* BGP confederation information. */
100 as_t confed_id;
101 as_t *confed_peers;
102 int confed_peers_cnt;
103
104 /* BGP flags. */
105 u_int16_t flags;
106#define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0)
107#define BGP_FLAG_DETERMINISTIC_MED (1 << 1)
108#define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2)
109#define BGP_FLAG_MED_CONFED (1 << 3)
110#define BGP_FLAG_NO_DEFAULT_IPV4 (1 << 4)
111#define BGP_FLAG_NO_CLIENT_TO_CLIENT (1 << 5)
112#define BGP_FLAG_ENFORCE_FIRST_AS (1 << 6)
113#define BGP_FLAG_COMPARE_ROUTER_ID (1 << 7)
114#define BGP_FLAG_ASPATH_IGNORE (1 << 8)
115#define BGP_FLAG_IMPORT_CHECK (1 << 9)
116#define BGP_FLAG_NO_FAST_EXT_FAILOVER (1 << 10)
paul848973c2003-08-13 00:32:49 +0000117#define BGP_FLAG_LOG_NEIGHBOR_CHANGES (1 << 11)
hasso538621f2004-05-21 09:31:30 +0000118#define BGP_FLAG_GRACEFUL_RESTART (1 << 12)
hasso68118452005-04-08 15:40:36 +0000119#define BGP_FLAG_ASPATH_CONFED (1 << 13)
paul718e3742002-12-13 20:15:29 +0000120
121 /* BGP Per AF flags */
122 u_int16_t af_flags[AFI_MAX][SAFI_MAX];
123#define BGP_CONFIG_DAMPENING (1 << 0)
124
125 /* Static route configuration. */
126 struct bgp_table *route[AFI_MAX][SAFI_MAX];
127
128 /* Aggregate address configuration. */
129 struct bgp_table *aggregate[AFI_MAX][SAFI_MAX];
130
131 /* BGP routing information base. */
132 struct bgp_table *rib[AFI_MAX][SAFI_MAX];
133
134 /* BGP redistribute configuration. */
135 u_char redist[AFI_MAX][ZEBRA_ROUTE_MAX];
136
137 /* BGP redistribute metric configuration. */
138 u_char redist_metric_flag[AFI_MAX][ZEBRA_ROUTE_MAX];
139 u_int32_t redist_metric[AFI_MAX][ZEBRA_ROUTE_MAX];
140
141 /* BGP redistribute route-map. */
142 struct
143 {
144 char *name;
145 struct route_map *map;
146 } rmap[AFI_MAX][ZEBRA_ROUTE_MAX];
147
148 /* BGP distance configuration. */
149 u_char distance_ebgp;
150 u_char distance_ibgp;
151 u_char distance_local;
152
153 /* BGP default local-preference. */
154 u_int32_t default_local_pref;
155
156 /* BGP default timer. */
157 u_int32_t default_holdtime;
158 u_int32_t default_keepalive;
hasso538621f2004-05-21 09:31:30 +0000159
160 /* BGP graceful restart */
hasso93406d82005-02-02 14:40:33 +0000161 u_int32_t restart_time;
162 u_int32_t stalepath_time;
paul718e3742002-12-13 20:15:29 +0000163};
164
165/* BGP peer-group support. */
166struct peer_group
167{
168 /* Name of the peer-group. */
169 char *name;
170
171 /* Pointer to BGP. */
172 struct bgp *bgp;
173
174 /* Peer-group client list. */
175 struct list *peer;
176
177 /* Peer-group config */
178 struct peer *conf;
179};
180
181/* BGP Notify message format. */
182struct bgp_notify
183{
184 u_char code;
185 u_char subcode;
186 char *data;
187 bgp_size_t length;
188};
189
190/* Next hop self address. */
191struct bgp_nexthop
192{
193 struct interface *ifp;
194 struct in_addr v4;
195#ifdef HAVE_IPV6
196 struct in6_addr v6_global;
197 struct in6_addr v6_local;
198#endif /* HAVE_IPV6 */
199};
200
201/* BGP router distinguisher value. */
202#define BGP_RD_SIZE 8
203
204struct bgp_rd
205{
206 u_char val[BGP_RD_SIZE];
207};
208
paulfee0f4c2004-09-13 05:12:46 +0000209#define RMAP_IN 0
210#define RMAP_OUT 1
211#define RMAP_IMPORT 2
212#define RMAP_EXPORT 3
213#define RMAP_MAX 4
214
paul718e3742002-12-13 20:15:29 +0000215/* BGP filter structure. */
216struct bgp_filter
217{
218 /* Distribute-list. */
219 struct
220 {
221 char *name;
222 struct access_list *alist;
223 } dlist[FILTER_MAX];
224
225 /* Prefix-list. */
226 struct
227 {
228 char *name;
229 struct prefix_list *plist;
230 } plist[FILTER_MAX];
231
232 /* Filter-list. */
233 struct
234 {
235 char *name;
236 struct as_list *aslist;
237 } aslist[FILTER_MAX];
238
239 /* Route-map. */
240 struct
241 {
242 char *name;
243 struct route_map *map;
paulfee0f4c2004-09-13 05:12:46 +0000244 } map[RMAP_MAX];
paul718e3742002-12-13 20:15:29 +0000245
246 /* Unsuppress-map. */
247 struct
248 {
249 char *name;
250 struct route_map *map;
251 } usmap;
252};
253
254/* BGP neighbor structure. */
255struct peer
256{
257 /* BGP structure. */
258 struct bgp *bgp;
259
paul200df112005-06-01 11:17:05 +0000260 /* reference count, primarily to allow bgp_process'ing of route_node's
261 * to be done after a struct peer is deleted.
262 *
263 * named 'lock' for hysterical reasons within Quagga.
264 */
265 int lock;
266
paul718e3742002-12-13 20:15:29 +0000267 /* BGP peer group. */
268 struct peer_group *group;
269 u_char af_group[AFI_MAX][SAFI_MAX];
270
271 /* Peer's remote AS number. */
272 as_t as;
273
274 /* Peer's local AS number. */
275 as_t local_as;
276
277 /* Peer's Change local AS number. */
278 as_t change_local_as;
279
280 /* Remote router ID. */
281 struct in_addr remote_id;
282
283 /* Local router ID. */
284 struct in_addr local_id;
285
paulfee0f4c2004-09-13 05:12:46 +0000286 /* Peer specific RIB when configured as route-server-client. */
287 struct bgp_table *rib[AFI_MAX][SAFI_MAX];
288
paul718e3742002-12-13 20:15:29 +0000289 /* Packet receive and send buffer. */
290 struct stream *ibuf;
291 struct stream_fifo *obuf;
292 struct stream *work;
293
294 /* Status of the peer. */
295 int status;
296 int ostatus;
297
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000298 /* Peer index, used for dumping TABLE_DUMP_V2 format */
299 uint16_t table_dump_index;
300
paul718e3742002-12-13 20:15:29 +0000301 /* Peer information */
pauleb821182004-05-01 08:44:08 +0000302 int fd; /* File descriptor */
303 int ttl; /* TTL of TCP connection to the peer. */
304 char *desc; /* Description of the peer. */
305 unsigned short port; /* Destination port for peer */
306 char *host; /* Printable address of the peer. */
307 union sockunion su; /* Sockunion address of the peer. */
308 time_t uptime; /* Last Up/Down time */
309 time_t readtime; /* Last read time */
310 time_t resettime; /* Last reset time */
paul718e3742002-12-13 20:15:29 +0000311
pauleb821182004-05-01 08:44:08 +0000312 unsigned int ifindex; /* ifindex of the BGP connection. */
313 char *ifname; /* bind interface name. */
314 char *update_if;
315 union sockunion *update_source;
316 struct zlog *log;
paul718e3742002-12-13 20:15:29 +0000317
pauleb821182004-05-01 08:44:08 +0000318 union sockunion *su_local; /* Sockunion of local address. */
319 union sockunion *su_remote; /* Sockunion of remote address. */
320 int shared_network; /* Is this peer shared same network. */
321 struct bgp_nexthop nexthop; /* Nexthop */
paul718e3742002-12-13 20:15:29 +0000322
323 /* Peer address family configuration. */
324 u_char afc[AFI_MAX][SAFI_MAX];
325 u_char afc_nego[AFI_MAX][SAFI_MAX];
326 u_char afc_adv[AFI_MAX][SAFI_MAX];
327 u_char afc_recv[AFI_MAX][SAFI_MAX];
328
hasso0a486e52005-02-01 20:57:17 +0000329 /* Capability flags (reset in bgp_stop) */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000330 u_int16_t cap;
paul718e3742002-12-13 20:15:29 +0000331#define PEER_CAP_REFRESH_ADV (1 << 0) /* refresh advertised */
332#define PEER_CAP_REFRESH_OLD_RCV (1 << 1) /* refresh old received */
333#define PEER_CAP_REFRESH_NEW_RCV (1 << 2) /* refresh rfc received */
334#define PEER_CAP_DYNAMIC_ADV (1 << 3) /* dynamic advertised */
335#define PEER_CAP_DYNAMIC_RCV (1 << 4) /* dynamic received */
hasso538621f2004-05-21 09:31:30 +0000336#define PEER_CAP_RESTART_ADV (1 << 5) /* restart advertised */
337#define PEER_CAP_RESTART_RCV (1 << 6) /* restart received */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000338#define PEER_CAP_AS4_ADV (1 << 7) /* as4 advertised */
339#define PEER_CAP_AS4_RCV (1 << 8) /* as4 received */
paul718e3742002-12-13 20:15:29 +0000340
hasso0a486e52005-02-01 20:57:17 +0000341 /* Capability flags (reset in bgp_stop) */
paul718e3742002-12-13 20:15:29 +0000342 u_int16_t af_cap[AFI_MAX][SAFI_MAX];
343#define PEER_CAP_ORF_PREFIX_SM_ADV (1 << 0) /* send-mode advertised */
344#define PEER_CAP_ORF_PREFIX_RM_ADV (1 << 1) /* receive-mode advertised */
345#define PEER_CAP_ORF_PREFIX_SM_RCV (1 << 2) /* send-mode received */
346#define PEER_CAP_ORF_PREFIX_RM_RCV (1 << 3) /* receive-mode received */
347#define PEER_CAP_ORF_PREFIX_SM_OLD_RCV (1 << 4) /* send-mode received */
348#define PEER_CAP_ORF_PREFIX_RM_OLD_RCV (1 << 5) /* receive-mode received */
hasso93406d82005-02-02 14:40:33 +0000349#define PEER_CAP_RESTART_AF_RCV (1 << 6) /* graceful restart afi/safi received */
350#define PEER_CAP_RESTART_AF_PRESERVE_RCV (1 << 7) /* graceful restart afi/safi F-bit received */
paul718e3742002-12-13 20:15:29 +0000351
352 /* Global configuration flags. */
353 u_int32_t flags;
354#define PEER_FLAG_PASSIVE (1 << 0) /* passive mode */
355#define PEER_FLAG_SHUTDOWN (1 << 1) /* shutdown */
356#define PEER_FLAG_DONT_CAPABILITY (1 << 2) /* dont-capability */
357#define PEER_FLAG_OVERRIDE_CAPABILITY (1 << 3) /* override-capability */
358#define PEER_FLAG_STRICT_CAP_MATCH (1 << 4) /* strict-match */
hassoc9502432005-02-01 22:01:48 +0000359#define PEER_FLAG_DYNAMIC_CAPABILITY (1 << 5) /* dynamic capability */
hasso6ffd2072005-02-02 14:50:11 +0000360#define PEER_FLAG_DISABLE_CONNECTED_CHECK (1 << 6) /* disable-connected-check */
hassoc9502432005-02-01 22:01:48 +0000361#define PEER_FLAG_LOCAL_AS_NO_PREPEND (1 << 7) /* local-as no-prepend */
paul718e3742002-12-13 20:15:29 +0000362
hasso93406d82005-02-02 14:40:33 +0000363 /* NSF mode (graceful restart) */
364 u_char nsf[AFI_MAX][SAFI_MAX];
365
paul718e3742002-12-13 20:15:29 +0000366 /* Per AF configuration flags. */
367 u_int32_t af_flags[AFI_MAX][SAFI_MAX];
368#define PEER_FLAG_SEND_COMMUNITY (1 << 0) /* send-community */
369#define PEER_FLAG_SEND_EXT_COMMUNITY (1 << 1) /* send-community ext. */
370#define PEER_FLAG_NEXTHOP_SELF (1 << 2) /* next-hop-self */
371#define PEER_FLAG_REFLECTOR_CLIENT (1 << 3) /* reflector-client */
372#define PEER_FLAG_RSERVER_CLIENT (1 << 4) /* route-server-client */
373#define PEER_FLAG_SOFT_RECONFIG (1 << 5) /* soft-reconfiguration */
374#define PEER_FLAG_AS_PATH_UNCHANGED (1 << 6) /* transparent-as */
375#define PEER_FLAG_NEXTHOP_UNCHANGED (1 << 7) /* transparent-next-hop */
376#define PEER_FLAG_MED_UNCHANGED (1 << 8) /* transparent-next-hop */
377#define PEER_FLAG_DEFAULT_ORIGINATE (1 << 9) /* default-originate */
378#define PEER_FLAG_REMOVE_PRIVATE_AS (1 << 10) /* remove-private-as */
379#define PEER_FLAG_ALLOWAS_IN (1 << 11) /* set allowas-in */
380#define PEER_FLAG_ORF_PREFIX_SM (1 << 12) /* orf capability send-mode */
381#define PEER_FLAG_ORF_PREFIX_RM (1 << 13) /* orf capability receive-mode */
382#define PEER_FLAG_MAX_PREFIX (1 << 14) /* maximum prefix */
383#define PEER_FLAG_MAX_PREFIX_WARNING (1 << 15) /* maximum prefix warning-only */
Paul Jakma0df7c912008-07-21 21:02:49 +0000384#define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1 << 16) /* leave link-local nexthop unchanged */
385
386 /* MD5 password */
387 char *password;
paul718e3742002-12-13 20:15:29 +0000388
389 /* default-originate route-map. */
390 struct
391 {
392 char *name;
393 struct route_map *map;
394 } default_rmap[AFI_MAX][SAFI_MAX];
395
396 /* Peer status flags. */
397 u_int16_t sflags;
398#define PEER_STATUS_ACCEPT_PEER (1 << 0) /* accept peer */
399#define PEER_STATUS_PREFIX_OVERFLOW (1 << 1) /* prefix-overflow */
400#define PEER_STATUS_CAPABILITY_OPEN (1 << 2) /* capability open send */
401#define PEER_STATUS_HAVE_ACCEPT (1 << 3) /* accept peer's parent */
402#define PEER_STATUS_GROUP (1 << 4) /* peer-group conf */
hasso93406d82005-02-02 14:40:33 +0000403#define PEER_STATUS_NSF_MODE (1 << 5) /* NSF aware peer */
404#define PEER_STATUS_NSF_WAIT (1 << 6) /* wait comeback peer */
paul718e3742002-12-13 20:15:29 +0000405
hasso0a486e52005-02-01 20:57:17 +0000406 /* Peer status af flags (reset in bgp_stop) */
paul718e3742002-12-13 20:15:29 +0000407 u_int16_t af_sflags[AFI_MAX][SAFI_MAX];
408#define PEER_STATUS_ORF_PREFIX_SEND (1 << 0) /* prefix-list send peer */
409#define PEER_STATUS_ORF_WAIT_REFRESH (1 << 1) /* wait refresh received peer */
410#define PEER_STATUS_DEFAULT_ORIGINATE (1 << 2) /* default-originate peer */
hassoe0701b72004-05-20 09:19:34 +0000411#define PEER_STATUS_PREFIX_THRESHOLD (1 << 3) /* exceed prefix-threshold */
412#define PEER_STATUS_PREFIX_LIMIT (1 << 4) /* exceed prefix-limit */
hasso93406d82005-02-02 14:40:33 +0000413#define PEER_STATUS_EOR_SEND (1 << 5) /* end-of-rib send to peer */
414#define PEER_STATUS_EOR_RECEIVED (1 << 6) /* end-of-rib received from peer */
hassoe0701b72004-05-20 09:19:34 +0000415
paul718e3742002-12-13 20:15:29 +0000416 /* Default attribute value for the peer. */
417 u_int32_t config;
418#define PEER_CONFIG_WEIGHT (1 << 0) /* Default weight. */
419#define PEER_CONFIG_TIMER (1 << 1) /* keepalive & holdtime */
420#define PEER_CONFIG_CONNECT (1 << 2) /* connect */
421#define PEER_CONFIG_ROUTEADV (1 << 3) /* route advertise */
422 u_int32_t weight;
423 u_int32_t holdtime;
424 u_int32_t keepalive;
425 u_int32_t connect;
426 u_int32_t routeadv;
427
428 /* Timer values. */
429 u_int32_t v_start;
430 u_int32_t v_connect;
431 u_int32_t v_holdtime;
432 u_int32_t v_keepalive;
433 u_int32_t v_asorig;
434 u_int32_t v_routeadv;
hasso0a486e52005-02-01 20:57:17 +0000435 u_int32_t v_pmax_restart;
hasso93406d82005-02-02 14:40:33 +0000436 u_int32_t v_gr_restart;
paul718e3742002-12-13 20:15:29 +0000437
438 /* Threads. */
439 struct thread *t_read;
440 struct thread *t_write;
441 struct thread *t_start;
442 struct thread *t_connect;
443 struct thread *t_holdtime;
444 struct thread *t_keepalive;
445 struct thread *t_asorig;
446 struct thread *t_routeadv;
hasso0a486e52005-02-01 20:57:17 +0000447 struct thread *t_pmax_restart;
hasso93406d82005-02-02 14:40:33 +0000448 struct thread *t_gr_restart;
449 struct thread *t_gr_stale;
Paul Jakma64e580a2006-02-21 01:09:01 +0000450
451 /* workqueues */
452 struct work_queue *clear_node_queue;
453
paul718e3742002-12-13 20:15:29 +0000454 /* Statistics field */
455 u_int32_t open_in; /* Open message input count */
456 u_int32_t open_out; /* Open message output count */
457 u_int32_t update_in; /* Update message input count */
458 u_int32_t update_out; /* Update message ouput count */
459 time_t update_time; /* Update message received time. */
460 u_int32_t keepalive_in; /* Keepalive input count */
461 u_int32_t keepalive_out; /* Keepalive output count */
462 u_int32_t notify_in; /* Notify input count */
463 u_int32_t notify_out; /* Notify output count */
464 u_int32_t refresh_in; /* Route Refresh input count */
465 u_int32_t refresh_out; /* Route Refresh output count */
466 u_int32_t dynamic_cap_in; /* Dynamic Capability input count. */
467 u_int32_t dynamic_cap_out; /* Dynamic Capability output count. */
468
469 /* BGP state count */
470 u_int32_t established; /* Established */
471 u_int32_t dropped; /* Dropped */
472
473 /* Syncronization list and time. */
474 struct bgp_synchronize *sync[AFI_MAX][SAFI_MAX];
475 time_t synctime;
476
477 /* Send prefix count. */
478 unsigned long scount[AFI_MAX][SAFI_MAX];
479
480 /* Announcement attribute hash. */
481 struct hash *hash[AFI_MAX][SAFI_MAX];
482
483 /* Notify data. */
484 struct bgp_notify notify;
485
486 /* Whole packet size to be read. */
487 unsigned long packet_size;
488
489 /* Filter structure. */
490 struct bgp_filter filter[AFI_MAX][SAFI_MAX];
491
492 /* ORF Prefix-list */
493 struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX];
494
495 /* Prefix count. */
496 unsigned long pcount[AFI_MAX][SAFI_MAX];
497
498 /* Max prefix count. */
499 unsigned long pmax[AFI_MAX][SAFI_MAX];
hassoe0701b72004-05-20 09:19:34 +0000500 u_char pmax_threshold[AFI_MAX][SAFI_MAX];
hasso0a486e52005-02-01 20:57:17 +0000501 u_int16_t pmax_restart[AFI_MAX][SAFI_MAX];
hassoe0701b72004-05-20 09:19:34 +0000502#define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75
paul718e3742002-12-13 20:15:29 +0000503
504 /* allowas-in. */
505 char allowas_in[AFI_MAX][SAFI_MAX];
paulac41b2a2003-08-12 05:32:27 +0000506
hassoe0701b72004-05-20 09:19:34 +0000507 /* peer reset cause */
508 char last_reset;
509#define PEER_DOWN_RID_CHANGE 1 /* bgp router-id command */
510#define PEER_DOWN_REMOTE_AS_CHANGE 2 /* neighbor remote-as command */
511#define PEER_DOWN_LOCAL_AS_CHANGE 3 /* neighbor local-as command */
512#define PEER_DOWN_CLID_CHANGE 4 /* bgp cluster-id command */
513#define PEER_DOWN_CONFED_ID_CHANGE 5 /* bgp confederation identifier command */
514#define PEER_DOWN_CONFED_PEER_CHANGE 6 /* bgp confederation peer command */
515#define PEER_DOWN_RR_CLIENT_CHANGE 7 /* neighbor route-reflector-client command */
516#define PEER_DOWN_RS_CLIENT_CHANGE 8 /* neighbor route-server-client command */
517#define PEER_DOWN_UPDATE_SOURCE_CHANGE 9 /* neighbor update-source command */
518#define PEER_DOWN_AF_ACTIVATE 10 /* neighbor activate command */
519#define PEER_DOWN_USER_SHUTDOWN 11 /* neighbor shutdown command */
520#define PEER_DOWN_USER_RESET 12 /* clear ip bgp command */
521#define PEER_DOWN_NOTIFY_RECEIVED 13 /* notification received */
522#define PEER_DOWN_NOTIFY_SEND 14 /* notification send */
523#define PEER_DOWN_CLOSE_SESSION 15 /* tcp session close */
524#define PEER_DOWN_NEIGHBOR_DELETE 16 /* neghbor delete */
525#define PEER_DOWN_RMAP_BIND 17 /* neghbor peer-group command */
526#define PEER_DOWN_RMAP_UNBIND 18 /* no neighbor peer-group command */
527#define PEER_DOWN_CAPABILITY_CHANGE 19 /* neighbor capability command */
528#define PEER_DOWN_PASSIVE_CHANGE 20 /* neighbor passive command */
529#define PEER_DOWN_MULTIHOP_CHANGE 21 /* neighbor multihop command */
hasso93406d82005-02-02 14:40:33 +0000530#define PEER_DOWN_NSF_CLOSE_SESSION 22 /* NSF tcp session close */
hassoe0701b72004-05-20 09:19:34 +0000531
paulac41b2a2003-08-12 05:32:27 +0000532 /* The kind of route-map Flags.*/
533 u_char rmap_type;
534#define PEER_RMAP_TYPE_IN (1 << 0) /* neighbor route-map in */
535#define PEER_RMAP_TYPE_OUT (1 << 1) /* neighbor route-map out */
536#define PEER_RMAP_TYPE_NETWORK (1 << 2) /* network route-map */
537#define PEER_RMAP_TYPE_REDISTRIBUTE (1 << 3) /* redistribute route-map */
538#define PEER_RMAP_TYPE_DEFAULT (1 << 4) /* default-originate route-map */
539#define PEER_RMAP_TYPE_NOSET (1 << 5) /* not allow to set commands */
paulfee0f4c2004-09-13 05:12:46 +0000540#define PEER_RMAP_TYPE_IMPORT (1 << 6) /* neighbor route-map import */
541#define PEER_RMAP_TYPE_EXPORT (1 << 7) /* neighbor route-map export */
paul718e3742002-12-13 20:15:29 +0000542};
543
Paul Jakma0df7c912008-07-21 21:02:49 +0000544#define PEER_PASSWORD_MINLEN (1)
545#define PEER_PASSWORD_MAXLEN (80)
546
paul718e3742002-12-13 20:15:29 +0000547/* This structure's member directly points incoming packet data
548 stream. */
549struct bgp_nlri
550{
551 /* AFI. */
552 afi_t afi;
553
554 /* SAFI. */
555 safi_t safi;
556
557 /* Pointer to NLRI byte stream. */
558 u_char *nlri;
559
560 /* Length of whole NLRI. */
561 bgp_size_t length;
562};
563
564/* BGP versions. */
565#define BGP_VERSION_4 4
paul718e3742002-12-13 20:15:29 +0000566
567/* Default BGP port number. */
568#define BGP_PORT_DEFAULT 179
569
570/* BGP message header and packet size. */
571#define BGP_MARKER_SIZE 16
572#define BGP_HEADER_SIZE 19
573#define BGP_MAX_PACKET_SIZE 4096
574
575/* BGP minimum message size. */
576#define BGP_MSG_OPEN_MIN_SIZE (BGP_HEADER_SIZE + 10)
577#define BGP_MSG_UPDATE_MIN_SIZE (BGP_HEADER_SIZE + 4)
578#define BGP_MSG_NOTIFY_MIN_SIZE (BGP_HEADER_SIZE + 2)
579#define BGP_MSG_KEEPALIVE_MIN_SIZE (BGP_HEADER_SIZE + 0)
580#define BGP_MSG_ROUTE_REFRESH_MIN_SIZE (BGP_HEADER_SIZE + 4)
581#define BGP_MSG_CAPABILITY_MIN_SIZE (BGP_HEADER_SIZE + 3)
582
583/* BGP message types. */
584#define BGP_MSG_OPEN 1
585#define BGP_MSG_UPDATE 2
586#define BGP_MSG_NOTIFY 3
587#define BGP_MSG_KEEPALIVE 4
588#define BGP_MSG_ROUTE_REFRESH_NEW 5
589#define BGP_MSG_CAPABILITY 6
590#define BGP_MSG_ROUTE_REFRESH_OLD 128
591
592/* BGP open optional parameter. */
593#define BGP_OPEN_OPT_AUTH 1
594#define BGP_OPEN_OPT_CAP 2
595
596/* BGP4 attribute type codes. */
597#define BGP_ATTR_ORIGIN 1
598#define BGP_ATTR_AS_PATH 2
599#define BGP_ATTR_NEXT_HOP 3
600#define BGP_ATTR_MULTI_EXIT_DISC 4
601#define BGP_ATTR_LOCAL_PREF 5
602#define BGP_ATTR_ATOMIC_AGGREGATE 6
603#define BGP_ATTR_AGGREGATOR 7
604#define BGP_ATTR_COMMUNITIES 8
605#define BGP_ATTR_ORIGINATOR_ID 9
606#define BGP_ATTR_CLUSTER_LIST 10
607#define BGP_ATTR_DPA 11
608#define BGP_ATTR_ADVERTISER 12
609#define BGP_ATTR_RCID_PATH 13
610#define BGP_ATTR_MP_REACH_NLRI 14
611#define BGP_ATTR_MP_UNREACH_NLRI 15
612#define BGP_ATTR_EXT_COMMUNITIES 16
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000613#define BGP_ATTR_AS4_PATH 17
614#define BGP_ATTR_AS4_AGGREGATOR 18
Paul Jakma41367172007-08-06 15:24:51 +0000615#define BGP_ATTR_AS_PATHLIMIT 21
paul718e3742002-12-13 20:15:29 +0000616
617/* BGP update origin. */
618#define BGP_ORIGIN_IGP 0
619#define BGP_ORIGIN_EGP 1
620#define BGP_ORIGIN_INCOMPLETE 2
621
622/* BGP notify message codes. */
623#define BGP_NOTIFY_HEADER_ERR 1
624#define BGP_NOTIFY_OPEN_ERR 2
625#define BGP_NOTIFY_UPDATE_ERR 3
626#define BGP_NOTIFY_HOLD_ERR 4
627#define BGP_NOTIFY_FSM_ERR 5
628#define BGP_NOTIFY_CEASE 6
629#define BGP_NOTIFY_CAPABILITY_ERR 7
630#define BGP_NOTIFY_MAX 8
631
632/* BGP_NOTIFY_HEADER_ERR sub codes. */
633#define BGP_NOTIFY_HEADER_NOT_SYNC 1
634#define BGP_NOTIFY_HEADER_BAD_MESLEN 2
635#define BGP_NOTIFY_HEADER_BAD_MESTYPE 3
636#define BGP_NOTIFY_HEADER_MAX 4
637
638/* BGP_NOTIFY_OPEN_ERR sub codes. */
639#define BGP_NOTIFY_OPEN_UNSUP_VERSION 1
640#define BGP_NOTIFY_OPEN_BAD_PEER_AS 2
641#define BGP_NOTIFY_OPEN_BAD_BGP_IDENT 3
642#define BGP_NOTIFY_OPEN_UNSUP_PARAM 4
643#define BGP_NOTIFY_OPEN_AUTH_FAILURE 5
644#define BGP_NOTIFY_OPEN_UNACEP_HOLDTIME 6
645#define BGP_NOTIFY_OPEN_UNSUP_CAPBL 7
646#define BGP_NOTIFY_OPEN_MAX 8
647
648/* BGP_NOTIFY_UPDATE_ERR sub codes. */
649#define BGP_NOTIFY_UPDATE_MAL_ATTR 1
650#define BGP_NOTIFY_UPDATE_UNREC_ATTR 2
651#define BGP_NOTIFY_UPDATE_MISS_ATTR 3
652#define BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR 4
653#define BGP_NOTIFY_UPDATE_ATTR_LENG_ERR 5
654#define BGP_NOTIFY_UPDATE_INVAL_ORIGIN 6
655#define BGP_NOTIFY_UPDATE_AS_ROUTE_LOOP 7
656#define BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP 8
657#define BGP_NOTIFY_UPDATE_OPT_ATTR_ERR 9
658#define BGP_NOTIFY_UPDATE_INVAL_NETWORK 10
659#define BGP_NOTIFY_UPDATE_MAL_AS_PATH 11
660#define BGP_NOTIFY_UPDATE_MAX 12
661
paul545acaf2004-04-20 15:13:15 +0000662/* BGP_NOTIFY_CEASE sub codes (draft-ietf-idr-cease-subcode-05). */
paul718e3742002-12-13 20:15:29 +0000663#define BGP_NOTIFY_CEASE_MAX_PREFIX 1
664#define BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN 2
665#define BGP_NOTIFY_CEASE_PEER_UNCONFIG 3
666#define BGP_NOTIFY_CEASE_ADMIN_RESET 4
667#define BGP_NOTIFY_CEASE_CONNECT_REJECT 5
668#define BGP_NOTIFY_CEASE_CONFIG_CHANGE 6
paul545acaf2004-04-20 15:13:15 +0000669#define BGP_NOTIFY_CEASE_COLLISION_RESOLUTION 7
670#define BGP_NOTIFY_CEASE_OUT_OF_RESOURCE 8
671#define BGP_NOTIFY_CEASE_MAX 9
paul718e3742002-12-13 20:15:29 +0000672
673/* BGP_NOTIFY_CAPABILITY_ERR sub codes (draft-ietf-idr-dynamic-cap-02). */
674#define BGP_NOTIFY_CAPABILITY_INVALID_ACTION 1
675#define BGP_NOTIFY_CAPABILITY_INVALID_LENGTH 2
676#define BGP_NOTIFY_CAPABILITY_MALFORMED_CODE 3
677#define BGP_NOTIFY_CAPABILITY_MAX 4
678
679/* BGP finite state machine status. */
680#define Idle 1
681#define Connect 2
682#define Active 3
683#define OpenSent 4
684#define OpenConfirm 5
685#define Established 6
Paul Jakmaca058a32006-09-14 02:58:49 +0000686#define Clearing 7
687#define Deleted 8
688#define BGP_STATUS_MAX 9
paul718e3742002-12-13 20:15:29 +0000689
690/* BGP finite state machine events. */
691#define BGP_Start 1
692#define BGP_Stop 2
693#define TCP_connection_open 3
694#define TCP_connection_closed 4
695#define TCP_connection_open_failed 5
696#define TCP_fatal_error 6
697#define ConnectRetry_timer_expired 7
698#define Hold_Timer_expired 8
699#define KeepAlive_timer_expired 9
700#define Receive_OPEN_message 10
701#define Receive_KEEPALIVE_message 11
702#define Receive_UPDATE_message 12
703#define Receive_NOTIFICATION_message 13
Paul Jakmaca058a32006-09-14 02:58:49 +0000704#define Clearing_Completed 14
705#define BGP_EVENTS_MAX 15
paul718e3742002-12-13 20:15:29 +0000706
707/* BGP timers default value. */
708#define BGP_INIT_START_TIMER 5
709#define BGP_ERROR_START_TIMER 30
710#define BGP_DEFAULT_HOLDTIME 180
711#define BGP_DEFAULT_KEEPALIVE 60
712#define BGP_DEFAULT_ASORIGINATE 15
713#define BGP_DEFAULT_EBGP_ROUTEADV 30
714#define BGP_DEFAULT_IBGP_ROUTEADV 5
715#define BGP_CLEAR_CONNECT_RETRY 20
716#define BGP_DEFAULT_CONNECT_RETRY 120
717
718/* BGP default local preference. */
719#define BGP_DEFAULT_LOCAL_PREF 100
720
hasso538621f2004-05-21 09:31:30 +0000721/* BGP graceful restart */
722#define BGP_DEFAULT_RESTART_TIME 120
723#define BGP_DEFAULT_STALEPATH_TIME 360
724
paul718e3742002-12-13 20:15:29 +0000725/* SAFI which used in open capability negotiation. */
726#define BGP_SAFI_VPNV4 128
727#define BGP_SAFI_VPNV6 129
728
729/* Max TTL value. */
730#define TTL_MAX 255
731
732/* BGP uptime string length. */
733#define BGP_UPTIME_LEN 25
734
735/* Default configuration settings for bgpd. */
736#define BGP_VTY_PORT 2605
paul718e3742002-12-13 20:15:29 +0000737#define BGP_DEFAULT_CONFIG "bgpd.conf"
738
739/* Check AS path loop when we send NLRI. */
740/* #define BGP_SEND_ASPATH_CHECK */
741
742/* IBGP/EBGP identifier. We also have a CONFED peer, which is to say,
743 a peer who's AS is part of our Confederation. */
744enum
745{
746 BGP_PEER_IBGP,
747 BGP_PEER_EBGP,
748 BGP_PEER_INTERNAL,
749 BGP_PEER_CONFED
750};
751
752/* Flag for peer_clear_soft(). */
753enum bgp_clear_type
754{
755 BGP_CLEAR_SOFT_NONE,
756 BGP_CLEAR_SOFT_OUT,
757 BGP_CLEAR_SOFT_IN,
758 BGP_CLEAR_SOFT_BOTH,
paulfee0f4c2004-09-13 05:12:46 +0000759 BGP_CLEAR_SOFT_IN_ORF_PREFIX,
760 BGP_CLEAR_SOFT_RSCLIENT
paul718e3742002-12-13 20:15:29 +0000761};
762
763/* Macros. */
764#define BGP_INPUT(P) ((P)->ibuf)
765#define BGP_INPUT_PNT(P) (STREAM_PNT(BGP_INPUT(P)))
766
paul718e3742002-12-13 20:15:29 +0000767/* Count prefix size from mask length */
768#define PSIZE(a) (((a) + 7) / (8))
769
770/* BGP error codes. */
771#define BGP_SUCCESS 0
772#define BGP_ERR_INVALID_VALUE -1
773#define BGP_ERR_INVALID_FLAG -2
774#define BGP_ERR_INVALID_AS -3
775#define BGP_ERR_INVALID_BGP -4
776#define BGP_ERR_PEER_GROUP_MEMBER -5
777#define BGP_ERR_MULTIPLE_INSTANCE_USED -6
778#define BGP_ERR_PEER_GROUP_MEMBER_EXISTS -7
779#define BGP_ERR_PEER_BELONGS_TO_GROUP -8
780#define BGP_ERR_PEER_GROUP_AF_UNCONFIGURED -9
781#define BGP_ERR_PEER_GROUP_NO_REMOTE_AS -10
782#define BGP_ERR_PEER_GROUP_CANT_CHANGE -11
783#define BGP_ERR_PEER_GROUP_MISMATCH -12
784#define BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT -13
785#define BGP_ERR_MULTIPLE_INSTANCE_NOT_SET -14
786#define BGP_ERR_AS_MISMATCH -15
787#define BGP_ERR_PEER_INACTIVE -16
788#define BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER -17
789#define BGP_ERR_PEER_GROUP_HAS_THE_FLAG -18
790#define BGP_ERR_PEER_FLAG_CONFLICT -19
791#define BGP_ERR_PEER_GROUP_SHUTDOWN -20
792#define BGP_ERR_PEER_FILTER_CONFLICT -21
793#define BGP_ERR_NOT_INTERNAL_PEER -22
794#define BGP_ERR_REMOVE_PRIVATE_AS -23
795#define BGP_ERR_AF_UNCONFIGURED -24
796#define BGP_ERR_SOFT_RECONFIG_UNCONFIGURED -25
797#define BGP_ERR_INSTANCE_MISMATCH -26
798#define BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP -27
799#define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS -28
Paul Jakma0df7c912008-07-21 21:02:49 +0000800#define BGP_ERR_TCPSIG_FAILED -29
801#define BGP_ERR_MAX -30
paul718e3742002-12-13 20:15:29 +0000802
803extern struct bgp_master *bm;
804
805extern struct thread_master *master;
806
807/* Prototypes. */
paul94f2b392005-06-28 12:44:16 +0000808extern void bgp_terminate (void);
809extern void bgp_reset (void);
810extern void bgp_zclient_reset (void);
811extern int bgp_nexthop_set (union sockunion *, union sockunion *,
paul718e3742002-12-13 20:15:29 +0000812 struct bgp_nexthop *, struct peer *);
paul94f2b392005-06-28 12:44:16 +0000813extern struct bgp *bgp_get_default (void);
814extern struct bgp *bgp_lookup (as_t, const char *);
815extern struct bgp *bgp_lookup_by_name (const char *);
816extern struct peer *peer_lookup (struct bgp *, union sockunion *);
817extern struct peer_group *peer_group_lookup (struct bgp *, const char *);
818extern struct peer_group *peer_group_get (struct bgp *, const char *);
819extern struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *,
paul718e3742002-12-13 20:15:29 +0000820 int *);
paul200df112005-06-01 11:17:05 +0000821extern struct peer *peer_lock (struct peer *);
822extern struct peer *peer_unlock (struct peer *);
paul94f2b392005-06-28 12:44:16 +0000823extern int peer_sort (struct peer *peer);
824extern int peer_active (struct peer *);
825extern int peer_active_nego (struct peer *);
826extern struct peer *peer_create_accept (struct bgp *);
827extern char *peer_uptime (time_t, char *, size_t);
828extern int bgp_config_write (struct vty *);
829extern void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *);
paul718e3742002-12-13 20:15:29 +0000830
paul94f2b392005-06-28 12:44:16 +0000831extern void bgp_master_init (void);
paul718e3742002-12-13 20:15:29 +0000832
paul94f2b392005-06-28 12:44:16 +0000833extern void bgp_init (void);
834extern void bgp_route_map_init (void);
paul718e3742002-12-13 20:15:29 +0000835
paul94f2b392005-06-28 12:44:16 +0000836extern int bgp_option_set (int);
837extern int bgp_option_unset (int);
838extern int bgp_option_check (int);
paul718e3742002-12-13 20:15:29 +0000839
paul94f2b392005-06-28 12:44:16 +0000840extern int bgp_get (struct bgp **, as_t *, const char *);
841extern int bgp_delete (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000842
paul94f2b392005-06-28 12:44:16 +0000843extern int bgp_flag_set (struct bgp *, int);
844extern int bgp_flag_unset (struct bgp *, int);
845extern int bgp_flag_check (struct bgp *, int);
paul718e3742002-12-13 20:15:29 +0000846
paul94f2b392005-06-28 12:44:16 +0000847extern int bgp_router_id_set (struct bgp *, struct in_addr *);
paul718e3742002-12-13 20:15:29 +0000848
paul94f2b392005-06-28 12:44:16 +0000849extern int bgp_cluster_id_set (struct bgp *, struct in_addr *);
850extern int bgp_cluster_id_unset (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000851
paul94f2b392005-06-28 12:44:16 +0000852extern int bgp_confederation_id_set (struct bgp *, as_t);
853extern int bgp_confederation_id_unset (struct bgp *);
854extern int bgp_confederation_peers_check (struct bgp *, as_t);
paul718e3742002-12-13 20:15:29 +0000855
paul94f2b392005-06-28 12:44:16 +0000856extern int bgp_confederation_peers_add (struct bgp *, as_t);
857extern int bgp_confederation_peers_remove (struct bgp *, as_t);
paul718e3742002-12-13 20:15:29 +0000858
paul94f2b392005-06-28 12:44:16 +0000859extern int bgp_timers_set (struct bgp *, u_int32_t, u_int32_t);
860extern int bgp_timers_unset (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000861
paul94f2b392005-06-28 12:44:16 +0000862extern int bgp_default_local_preference_set (struct bgp *, u_int32_t);
863extern int bgp_default_local_preference_unset (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000864
paul94f2b392005-06-28 12:44:16 +0000865extern int peer_rsclient_active (struct peer *);
paulfee0f4c2004-09-13 05:12:46 +0000866
paul94f2b392005-06-28 12:44:16 +0000867extern int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t);
868extern int peer_group_remote_as (struct bgp *, const char *, as_t *);
869extern int peer_delete (struct peer *peer);
870extern int peer_group_delete (struct peer_group *);
871extern int peer_group_remote_as_delete (struct peer_group *);
paul718e3742002-12-13 20:15:29 +0000872
paul94f2b392005-06-28 12:44:16 +0000873extern int peer_activate (struct peer *, afi_t, safi_t);
874extern int peer_deactivate (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000875
paul94f2b392005-06-28 12:44:16 +0000876extern int peer_group_bind (struct bgp *, union sockunion *, struct peer_group *,
paul718e3742002-12-13 20:15:29 +0000877 afi_t, safi_t, as_t *);
paul94f2b392005-06-28 12:44:16 +0000878extern int peer_group_unbind (struct bgp *, struct peer *, struct peer_group *,
paul718e3742002-12-13 20:15:29 +0000879 afi_t, safi_t);
880
paul94f2b392005-06-28 12:44:16 +0000881extern int peer_flag_set (struct peer *, u_int32_t);
882extern int peer_flag_unset (struct peer *, u_int32_t);
paul718e3742002-12-13 20:15:29 +0000883
paul94f2b392005-06-28 12:44:16 +0000884extern int peer_af_flag_set (struct peer *, afi_t, safi_t, u_int32_t);
885extern int peer_af_flag_unset (struct peer *, afi_t, safi_t, u_int32_t);
886extern int peer_af_flag_check (struct peer *, afi_t, safi_t, u_int32_t);
paul718e3742002-12-13 20:15:29 +0000887
paul94f2b392005-06-28 12:44:16 +0000888extern int peer_ebgp_multihop_set (struct peer *, int);
889extern int peer_ebgp_multihop_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000890
paul94f2b392005-06-28 12:44:16 +0000891extern int peer_description_set (struct peer *, char *);
892extern int peer_description_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000893
paul94f2b392005-06-28 12:44:16 +0000894extern int peer_update_source_if_set (struct peer *, const char *);
895extern int peer_update_source_addr_set (struct peer *, union sockunion *);
896extern int peer_update_source_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000897
paul94f2b392005-06-28 12:44:16 +0000898extern int peer_default_originate_set (struct peer *, afi_t, safi_t, const char *);
899extern int peer_default_originate_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000900
paul94f2b392005-06-28 12:44:16 +0000901extern int peer_port_set (struct peer *, u_int16_t);
902extern int peer_port_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000903
paul94f2b392005-06-28 12:44:16 +0000904extern int peer_weight_set (struct peer *, u_int16_t);
905extern int peer_weight_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000906
paul94f2b392005-06-28 12:44:16 +0000907extern int peer_timers_set (struct peer *, u_int32_t, u_int32_t);
908extern int peer_timers_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000909
paul94f2b392005-06-28 12:44:16 +0000910extern int peer_timers_connect_set (struct peer *, u_int32_t);
911extern int peer_timers_connect_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000912
paul94f2b392005-06-28 12:44:16 +0000913extern int peer_advertise_interval_set (struct peer *, u_int32_t);
914extern int peer_advertise_interval_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000915
paul94f2b392005-06-28 12:44:16 +0000916extern int peer_interface_set (struct peer *, const char *);
917extern int peer_interface_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000918
paul94f2b392005-06-28 12:44:16 +0000919extern int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *);
920extern int peer_distribute_unset (struct peer *, afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000921
paul94f2b392005-06-28 12:44:16 +0000922extern int peer_allowas_in_set (struct peer *, afi_t, safi_t, int);
923extern int peer_allowas_in_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000924
paul94f2b392005-06-28 12:44:16 +0000925extern int peer_local_as_set (struct peer *, as_t, int);
926extern int peer_local_as_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000927
paul94f2b392005-06-28 12:44:16 +0000928extern int peer_prefix_list_set (struct peer *, afi_t, safi_t, int, const char *);
929extern int peer_prefix_list_unset (struct peer *, afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000930
paul94f2b392005-06-28 12:44:16 +0000931extern int peer_aslist_set (struct peer *, afi_t, safi_t, int, const char *);
932extern int peer_aslist_unset (struct peer *,afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000933
paul94f2b392005-06-28 12:44:16 +0000934extern int peer_route_map_set (struct peer *, afi_t, safi_t, int, const char *);
935extern int peer_route_map_unset (struct peer *, afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000936
paul94f2b392005-06-28 12:44:16 +0000937extern int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, const char *);
Paul Jakma0df7c912008-07-21 21:02:49 +0000938
939extern int peer_password_set (struct peer *, const char *);
940extern int peer_password_unset (struct peer *);
941
paul94f2b392005-06-28 12:44:16 +0000942extern int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000943
paul94f2b392005-06-28 12:44:16 +0000944extern int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int, u_int16_t);
945extern int peer_maximum_prefix_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000946
paul94f2b392005-06-28 12:44:16 +0000947extern int peer_clear (struct peer *);
948extern int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type);
hasso93406d82005-02-02 14:40:33 +0000949
paul94f2b392005-06-28 12:44:16 +0000950extern void peer_nsf_stop (struct peer *);
paul00d252c2005-05-23 14:19:54 +0000951
952#endif /* _QUAGGA_BGPD_H */