blob: e04575d80a18bec5c566c0f48df0a6c4468cf165 [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
paul718e3742002-12-13 20:15:29 +000045 /* BGP port number. */
46 u_int16_t port;
47
48 /* BGP start time. */
49 time_t start_time;
50
51 /* Various BGP global configuration. */
52 u_char options;
53#define BGP_OPT_NO_FIB (1 << 0)
54#define BGP_OPT_MULTIPLE_INSTANCE (1 << 1)
55#define BGP_OPT_CONFIG_CISCO (1 << 2)
56};
57
58/* BGP instance structure. */
59struct bgp
60{
61 /* AS number of this BGP instance. */
62 as_t as;
63
64 /* Name of this BGP instance. */
65 char *name;
paul200df112005-06-01 11:17:05 +000066
paul718e3742002-12-13 20:15:29 +000067 /* Self peer. */
68 struct peer *peer_self;
69
70 /* BGP peer. */
71 struct list *peer;
72
73 /* BGP peer group. */
74 struct list *group;
75
paulfee0f4c2004-09-13 05:12:46 +000076 /* BGP route-server-clients. */
77 struct list *rsclient;
78
paul718e3742002-12-13 20:15:29 +000079 /* BGP configuration. */
80 u_int16_t config;
81#define BGP_CONFIG_ROUTER_ID (1 << 0)
82#define BGP_CONFIG_CLUSTER_ID (1 << 1)
83#define BGP_CONFIG_CONFEDERATION (1 << 2)
paul718e3742002-12-13 20:15:29 +000084
85 /* BGP router identifier. */
86 struct in_addr router_id;
hasso18a6dce2004-10-03 18:18:34 +000087 struct in_addr router_id_static;
paul718e3742002-12-13 20:15:29 +000088
89 /* BGP route reflector cluster ID. */
90 struct in_addr cluster_id;
91
92 /* BGP confederation information. */
93 as_t confed_id;
94 as_t *confed_peers;
95 int confed_peers_cnt;
96
97 /* BGP flags. */
98 u_int16_t flags;
99#define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0)
100#define BGP_FLAG_DETERMINISTIC_MED (1 << 1)
101#define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2)
102#define BGP_FLAG_MED_CONFED (1 << 3)
103#define BGP_FLAG_NO_DEFAULT_IPV4 (1 << 4)
104#define BGP_FLAG_NO_CLIENT_TO_CLIENT (1 << 5)
105#define BGP_FLAG_ENFORCE_FIRST_AS (1 << 6)
106#define BGP_FLAG_COMPARE_ROUTER_ID (1 << 7)
107#define BGP_FLAG_ASPATH_IGNORE (1 << 8)
108#define BGP_FLAG_IMPORT_CHECK (1 << 9)
109#define BGP_FLAG_NO_FAST_EXT_FAILOVER (1 << 10)
paul848973c2003-08-13 00:32:49 +0000110#define BGP_FLAG_LOG_NEIGHBOR_CHANGES (1 << 11)
hasso538621f2004-05-21 09:31:30 +0000111#define BGP_FLAG_GRACEFUL_RESTART (1 << 12)
hasso68118452005-04-08 15:40:36 +0000112#define BGP_FLAG_ASPATH_CONFED (1 << 13)
paul718e3742002-12-13 20:15:29 +0000113
114 /* BGP Per AF flags */
115 u_int16_t af_flags[AFI_MAX][SAFI_MAX];
116#define BGP_CONFIG_DAMPENING (1 << 0)
117
118 /* Static route configuration. */
119 struct bgp_table *route[AFI_MAX][SAFI_MAX];
120
121 /* Aggregate address configuration. */
122 struct bgp_table *aggregate[AFI_MAX][SAFI_MAX];
123
124 /* BGP routing information base. */
125 struct bgp_table *rib[AFI_MAX][SAFI_MAX];
126
127 /* BGP redistribute configuration. */
128 u_char redist[AFI_MAX][ZEBRA_ROUTE_MAX];
129
130 /* BGP redistribute metric configuration. */
131 u_char redist_metric_flag[AFI_MAX][ZEBRA_ROUTE_MAX];
132 u_int32_t redist_metric[AFI_MAX][ZEBRA_ROUTE_MAX];
133
134 /* BGP redistribute route-map. */
135 struct
136 {
137 char *name;
138 struct route_map *map;
139 } rmap[AFI_MAX][ZEBRA_ROUTE_MAX];
140
141 /* BGP distance configuration. */
142 u_char distance_ebgp;
143 u_char distance_ibgp;
144 u_char distance_local;
145
146 /* BGP default local-preference. */
147 u_int32_t default_local_pref;
148
149 /* BGP default timer. */
150 u_int32_t default_holdtime;
151 u_int32_t default_keepalive;
hasso538621f2004-05-21 09:31:30 +0000152
153 /* BGP graceful restart */
hasso93406d82005-02-02 14:40:33 +0000154 u_int32_t restart_time;
155 u_int32_t stalepath_time;
paul718e3742002-12-13 20:15:29 +0000156};
157
158/* BGP peer-group support. */
159struct peer_group
160{
161 /* Name of the peer-group. */
162 char *name;
163
164 /* Pointer to BGP. */
165 struct bgp *bgp;
166
167 /* Peer-group client list. */
168 struct list *peer;
169
170 /* Peer-group config */
171 struct peer *conf;
172};
173
174/* BGP Notify message format. */
175struct bgp_notify
176{
177 u_char code;
178 u_char subcode;
179 char *data;
180 bgp_size_t length;
181};
182
183/* Next hop self address. */
184struct bgp_nexthop
185{
186 struct interface *ifp;
187 struct in_addr v4;
188#ifdef HAVE_IPV6
189 struct in6_addr v6_global;
190 struct in6_addr v6_local;
191#endif /* HAVE_IPV6 */
192};
193
194/* BGP router distinguisher value. */
195#define BGP_RD_SIZE 8
196
197struct bgp_rd
198{
199 u_char val[BGP_RD_SIZE];
200};
201
paulfee0f4c2004-09-13 05:12:46 +0000202#define RMAP_IN 0
203#define RMAP_OUT 1
204#define RMAP_IMPORT 2
205#define RMAP_EXPORT 3
206#define RMAP_MAX 4
207
paul718e3742002-12-13 20:15:29 +0000208/* BGP filter structure. */
209struct bgp_filter
210{
211 /* Distribute-list. */
212 struct
213 {
214 char *name;
215 struct access_list *alist;
216 } dlist[FILTER_MAX];
217
218 /* Prefix-list. */
219 struct
220 {
221 char *name;
222 struct prefix_list *plist;
223 } plist[FILTER_MAX];
224
225 /* Filter-list. */
226 struct
227 {
228 char *name;
229 struct as_list *aslist;
230 } aslist[FILTER_MAX];
231
232 /* Route-map. */
233 struct
234 {
235 char *name;
236 struct route_map *map;
paulfee0f4c2004-09-13 05:12:46 +0000237 } map[RMAP_MAX];
paul718e3742002-12-13 20:15:29 +0000238
239 /* Unsuppress-map. */
240 struct
241 {
242 char *name;
243 struct route_map *map;
244 } usmap;
245};
246
247/* BGP neighbor structure. */
248struct peer
249{
250 /* BGP structure. */
251 struct bgp *bgp;
252
paul200df112005-06-01 11:17:05 +0000253 /* reference count, primarily to allow bgp_process'ing of route_node's
254 * to be done after a struct peer is deleted.
255 *
256 * named 'lock' for hysterical reasons within Quagga.
257 */
258 int lock;
259
paul718e3742002-12-13 20:15:29 +0000260 /* BGP peer group. */
261 struct peer_group *group;
262 u_char af_group[AFI_MAX][SAFI_MAX];
263
264 /* Peer's remote AS number. */
265 as_t as;
266
267 /* Peer's local AS number. */
268 as_t local_as;
269
270 /* Peer's Change local AS number. */
271 as_t change_local_as;
272
273 /* Remote router ID. */
274 struct in_addr remote_id;
275
276 /* Local router ID. */
277 struct in_addr local_id;
278
paulfee0f4c2004-09-13 05:12:46 +0000279 /* Peer specific RIB when configured as route-server-client. */
280 struct bgp_table *rib[AFI_MAX][SAFI_MAX];
281
paul718e3742002-12-13 20:15:29 +0000282 /* Packet receive and send buffer. */
283 struct stream *ibuf;
284 struct stream_fifo *obuf;
285 struct stream *work;
286
287 /* Status of the peer. */
288 int status;
289 int ostatus;
290
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000291 /* Peer index, used for dumping TABLE_DUMP_V2 format */
292 uint16_t table_dump_index;
293
paul718e3742002-12-13 20:15:29 +0000294 /* Peer information */
pauleb821182004-05-01 08:44:08 +0000295 int fd; /* File descriptor */
296 int ttl; /* TTL of TCP connection to the peer. */
297 char *desc; /* Description of the peer. */
298 unsigned short port; /* Destination port for peer */
299 char *host; /* Printable address of the peer. */
300 union sockunion su; /* Sockunion address of the peer. */
301 time_t uptime; /* Last Up/Down time */
302 time_t readtime; /* Last read time */
303 time_t resettime; /* Last reset time */
paul718e3742002-12-13 20:15:29 +0000304
pauleb821182004-05-01 08:44:08 +0000305 unsigned int ifindex; /* ifindex of the BGP connection. */
306 char *ifname; /* bind interface name. */
307 char *update_if;
308 union sockunion *update_source;
309 struct zlog *log;
paul718e3742002-12-13 20:15:29 +0000310
pauleb821182004-05-01 08:44:08 +0000311 union sockunion *su_local; /* Sockunion of local address. */
312 union sockunion *su_remote; /* Sockunion of remote address. */
313 int shared_network; /* Is this peer shared same network. */
314 struct bgp_nexthop nexthop; /* Nexthop */
paul718e3742002-12-13 20:15:29 +0000315
316 /* Peer address family configuration. */
317 u_char afc[AFI_MAX][SAFI_MAX];
318 u_char afc_nego[AFI_MAX][SAFI_MAX];
319 u_char afc_adv[AFI_MAX][SAFI_MAX];
320 u_char afc_recv[AFI_MAX][SAFI_MAX];
321
hasso0a486e52005-02-01 20:57:17 +0000322 /* Capability flags (reset in bgp_stop) */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000323 u_int16_t cap;
paul718e3742002-12-13 20:15:29 +0000324#define PEER_CAP_REFRESH_ADV (1 << 0) /* refresh advertised */
325#define PEER_CAP_REFRESH_OLD_RCV (1 << 1) /* refresh old received */
326#define PEER_CAP_REFRESH_NEW_RCV (1 << 2) /* refresh rfc received */
327#define PEER_CAP_DYNAMIC_ADV (1 << 3) /* dynamic advertised */
328#define PEER_CAP_DYNAMIC_RCV (1 << 4) /* dynamic received */
hasso538621f2004-05-21 09:31:30 +0000329#define PEER_CAP_RESTART_ADV (1 << 5) /* restart advertised */
330#define PEER_CAP_RESTART_RCV (1 << 6) /* restart received */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000331#define PEER_CAP_AS4_ADV (1 << 7) /* as4 advertised */
332#define PEER_CAP_AS4_RCV (1 << 8) /* as4 received */
paul718e3742002-12-13 20:15:29 +0000333
hasso0a486e52005-02-01 20:57:17 +0000334 /* Capability flags (reset in bgp_stop) */
paul718e3742002-12-13 20:15:29 +0000335 u_int16_t af_cap[AFI_MAX][SAFI_MAX];
336#define PEER_CAP_ORF_PREFIX_SM_ADV (1 << 0) /* send-mode advertised */
337#define PEER_CAP_ORF_PREFIX_RM_ADV (1 << 1) /* receive-mode advertised */
338#define PEER_CAP_ORF_PREFIX_SM_RCV (1 << 2) /* send-mode received */
339#define PEER_CAP_ORF_PREFIX_RM_RCV (1 << 3) /* receive-mode received */
340#define PEER_CAP_ORF_PREFIX_SM_OLD_RCV (1 << 4) /* send-mode received */
341#define PEER_CAP_ORF_PREFIX_RM_OLD_RCV (1 << 5) /* receive-mode received */
hasso93406d82005-02-02 14:40:33 +0000342#define PEER_CAP_RESTART_AF_RCV (1 << 6) /* graceful restart afi/safi received */
343#define PEER_CAP_RESTART_AF_PRESERVE_RCV (1 << 7) /* graceful restart afi/safi F-bit received */
paul718e3742002-12-13 20:15:29 +0000344
345 /* Global configuration flags. */
346 u_int32_t flags;
347#define PEER_FLAG_PASSIVE (1 << 0) /* passive mode */
348#define PEER_FLAG_SHUTDOWN (1 << 1) /* shutdown */
349#define PEER_FLAG_DONT_CAPABILITY (1 << 2) /* dont-capability */
350#define PEER_FLAG_OVERRIDE_CAPABILITY (1 << 3) /* override-capability */
351#define PEER_FLAG_STRICT_CAP_MATCH (1 << 4) /* strict-match */
hassoc9502432005-02-01 22:01:48 +0000352#define PEER_FLAG_DYNAMIC_CAPABILITY (1 << 5) /* dynamic capability */
hasso6ffd2072005-02-02 14:50:11 +0000353#define PEER_FLAG_DISABLE_CONNECTED_CHECK (1 << 6) /* disable-connected-check */
hassoc9502432005-02-01 22:01:48 +0000354#define PEER_FLAG_LOCAL_AS_NO_PREPEND (1 << 7) /* local-as no-prepend */
paul718e3742002-12-13 20:15:29 +0000355
hasso93406d82005-02-02 14:40:33 +0000356 /* NSF mode (graceful restart) */
357 u_char nsf[AFI_MAX][SAFI_MAX];
358
paul718e3742002-12-13 20:15:29 +0000359 /* Per AF configuration flags. */
360 u_int32_t af_flags[AFI_MAX][SAFI_MAX];
361#define PEER_FLAG_SEND_COMMUNITY (1 << 0) /* send-community */
362#define PEER_FLAG_SEND_EXT_COMMUNITY (1 << 1) /* send-community ext. */
363#define PEER_FLAG_NEXTHOP_SELF (1 << 2) /* next-hop-self */
364#define PEER_FLAG_REFLECTOR_CLIENT (1 << 3) /* reflector-client */
365#define PEER_FLAG_RSERVER_CLIENT (1 << 4) /* route-server-client */
366#define PEER_FLAG_SOFT_RECONFIG (1 << 5) /* soft-reconfiguration */
367#define PEER_FLAG_AS_PATH_UNCHANGED (1 << 6) /* transparent-as */
368#define PEER_FLAG_NEXTHOP_UNCHANGED (1 << 7) /* transparent-next-hop */
369#define PEER_FLAG_MED_UNCHANGED (1 << 8) /* transparent-next-hop */
370#define PEER_FLAG_DEFAULT_ORIGINATE (1 << 9) /* default-originate */
371#define PEER_FLAG_REMOVE_PRIVATE_AS (1 << 10) /* remove-private-as */
372#define PEER_FLAG_ALLOWAS_IN (1 << 11) /* set allowas-in */
373#define PEER_FLAG_ORF_PREFIX_SM (1 << 12) /* orf capability send-mode */
374#define PEER_FLAG_ORF_PREFIX_RM (1 << 13) /* orf capability receive-mode */
375#define PEER_FLAG_MAX_PREFIX (1 << 14) /* maximum prefix */
376#define PEER_FLAG_MAX_PREFIX_WARNING (1 << 15) /* maximum prefix warning-only */
paulfee0f4c2004-09-13 05:12:46 +0000377#define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1 << 16) /* leave link-local nexthop unchanged */
paul718e3742002-12-13 20:15:29 +0000378
379 /* default-originate route-map. */
380 struct
381 {
382 char *name;
383 struct route_map *map;
384 } default_rmap[AFI_MAX][SAFI_MAX];
385
386 /* Peer status flags. */
387 u_int16_t sflags;
388#define PEER_STATUS_ACCEPT_PEER (1 << 0) /* accept peer */
389#define PEER_STATUS_PREFIX_OVERFLOW (1 << 1) /* prefix-overflow */
390#define PEER_STATUS_CAPABILITY_OPEN (1 << 2) /* capability open send */
391#define PEER_STATUS_HAVE_ACCEPT (1 << 3) /* accept peer's parent */
392#define PEER_STATUS_GROUP (1 << 4) /* peer-group conf */
hasso93406d82005-02-02 14:40:33 +0000393#define PEER_STATUS_NSF_MODE (1 << 5) /* NSF aware peer */
394#define PEER_STATUS_NSF_WAIT (1 << 6) /* wait comeback peer */
paul718e3742002-12-13 20:15:29 +0000395
hasso0a486e52005-02-01 20:57:17 +0000396 /* Peer status af flags (reset in bgp_stop) */
paul718e3742002-12-13 20:15:29 +0000397 u_int16_t af_sflags[AFI_MAX][SAFI_MAX];
398#define PEER_STATUS_ORF_PREFIX_SEND (1 << 0) /* prefix-list send peer */
399#define PEER_STATUS_ORF_WAIT_REFRESH (1 << 1) /* wait refresh received peer */
400#define PEER_STATUS_DEFAULT_ORIGINATE (1 << 2) /* default-originate peer */
hassoe0701b72004-05-20 09:19:34 +0000401#define PEER_STATUS_PREFIX_THRESHOLD (1 << 3) /* exceed prefix-threshold */
402#define PEER_STATUS_PREFIX_LIMIT (1 << 4) /* exceed prefix-limit */
hasso93406d82005-02-02 14:40:33 +0000403#define PEER_STATUS_EOR_SEND (1 << 5) /* end-of-rib send to peer */
404#define PEER_STATUS_EOR_RECEIVED (1 << 6) /* end-of-rib received from peer */
hassoe0701b72004-05-20 09:19:34 +0000405
paul718e3742002-12-13 20:15:29 +0000406 /* Default attribute value for the peer. */
407 u_int32_t config;
408#define PEER_CONFIG_WEIGHT (1 << 0) /* Default weight. */
409#define PEER_CONFIG_TIMER (1 << 1) /* keepalive & holdtime */
410#define PEER_CONFIG_CONNECT (1 << 2) /* connect */
411#define PEER_CONFIG_ROUTEADV (1 << 3) /* route advertise */
412 u_int32_t weight;
413 u_int32_t holdtime;
414 u_int32_t keepalive;
415 u_int32_t connect;
416 u_int32_t routeadv;
417
418 /* Timer values. */
419 u_int32_t v_start;
420 u_int32_t v_connect;
421 u_int32_t v_holdtime;
422 u_int32_t v_keepalive;
423 u_int32_t v_asorig;
424 u_int32_t v_routeadv;
hasso0a486e52005-02-01 20:57:17 +0000425 u_int32_t v_pmax_restart;
hasso93406d82005-02-02 14:40:33 +0000426 u_int32_t v_gr_restart;
paul718e3742002-12-13 20:15:29 +0000427
428 /* Threads. */
429 struct thread *t_read;
430 struct thread *t_write;
431 struct thread *t_start;
432 struct thread *t_connect;
433 struct thread *t_holdtime;
434 struct thread *t_keepalive;
435 struct thread *t_asorig;
436 struct thread *t_routeadv;
hasso0a486e52005-02-01 20:57:17 +0000437 struct thread *t_pmax_restart;
hasso93406d82005-02-02 14:40:33 +0000438 struct thread *t_gr_restart;
439 struct thread *t_gr_stale;
Paul Jakma64e580a2006-02-21 01:09:01 +0000440
441 /* workqueues */
442 struct work_queue *clear_node_queue;
443
paul718e3742002-12-13 20:15:29 +0000444 /* Statistics field */
445 u_int32_t open_in; /* Open message input count */
446 u_int32_t open_out; /* Open message output count */
447 u_int32_t update_in; /* Update message input count */
448 u_int32_t update_out; /* Update message ouput count */
449 time_t update_time; /* Update message received time. */
450 u_int32_t keepalive_in; /* Keepalive input count */
451 u_int32_t keepalive_out; /* Keepalive output count */
452 u_int32_t notify_in; /* Notify input count */
453 u_int32_t notify_out; /* Notify output count */
454 u_int32_t refresh_in; /* Route Refresh input count */
455 u_int32_t refresh_out; /* Route Refresh output count */
456 u_int32_t dynamic_cap_in; /* Dynamic Capability input count. */
457 u_int32_t dynamic_cap_out; /* Dynamic Capability output count. */
458
459 /* BGP state count */
460 u_int32_t established; /* Established */
461 u_int32_t dropped; /* Dropped */
462
463 /* Syncronization list and time. */
464 struct bgp_synchronize *sync[AFI_MAX][SAFI_MAX];
465 time_t synctime;
466
467 /* Send prefix count. */
468 unsigned long scount[AFI_MAX][SAFI_MAX];
469
470 /* Announcement attribute hash. */
471 struct hash *hash[AFI_MAX][SAFI_MAX];
472
473 /* Notify data. */
474 struct bgp_notify notify;
475
476 /* Whole packet size to be read. */
477 unsigned long packet_size;
478
479 /* Filter structure. */
480 struct bgp_filter filter[AFI_MAX][SAFI_MAX];
481
482 /* ORF Prefix-list */
483 struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX];
484
485 /* Prefix count. */
486 unsigned long pcount[AFI_MAX][SAFI_MAX];
487
488 /* Max prefix count. */
489 unsigned long pmax[AFI_MAX][SAFI_MAX];
hassoe0701b72004-05-20 09:19:34 +0000490 u_char pmax_threshold[AFI_MAX][SAFI_MAX];
hasso0a486e52005-02-01 20:57:17 +0000491 u_int16_t pmax_restart[AFI_MAX][SAFI_MAX];
hassoe0701b72004-05-20 09:19:34 +0000492#define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75
paul718e3742002-12-13 20:15:29 +0000493
494 /* allowas-in. */
495 char allowas_in[AFI_MAX][SAFI_MAX];
paulac41b2a2003-08-12 05:32:27 +0000496
hassoe0701b72004-05-20 09:19:34 +0000497 /* peer reset cause */
498 char last_reset;
499#define PEER_DOWN_RID_CHANGE 1 /* bgp router-id command */
500#define PEER_DOWN_REMOTE_AS_CHANGE 2 /* neighbor remote-as command */
501#define PEER_DOWN_LOCAL_AS_CHANGE 3 /* neighbor local-as command */
502#define PEER_DOWN_CLID_CHANGE 4 /* bgp cluster-id command */
503#define PEER_DOWN_CONFED_ID_CHANGE 5 /* bgp confederation identifier command */
504#define PEER_DOWN_CONFED_PEER_CHANGE 6 /* bgp confederation peer command */
505#define PEER_DOWN_RR_CLIENT_CHANGE 7 /* neighbor route-reflector-client command */
506#define PEER_DOWN_RS_CLIENT_CHANGE 8 /* neighbor route-server-client command */
507#define PEER_DOWN_UPDATE_SOURCE_CHANGE 9 /* neighbor update-source command */
508#define PEER_DOWN_AF_ACTIVATE 10 /* neighbor activate command */
509#define PEER_DOWN_USER_SHUTDOWN 11 /* neighbor shutdown command */
510#define PEER_DOWN_USER_RESET 12 /* clear ip bgp command */
511#define PEER_DOWN_NOTIFY_RECEIVED 13 /* notification received */
512#define PEER_DOWN_NOTIFY_SEND 14 /* notification send */
513#define PEER_DOWN_CLOSE_SESSION 15 /* tcp session close */
514#define PEER_DOWN_NEIGHBOR_DELETE 16 /* neghbor delete */
515#define PEER_DOWN_RMAP_BIND 17 /* neghbor peer-group command */
516#define PEER_DOWN_RMAP_UNBIND 18 /* no neighbor peer-group command */
517#define PEER_DOWN_CAPABILITY_CHANGE 19 /* neighbor capability command */
518#define PEER_DOWN_PASSIVE_CHANGE 20 /* neighbor passive command */
519#define PEER_DOWN_MULTIHOP_CHANGE 21 /* neighbor multihop command */
hasso93406d82005-02-02 14:40:33 +0000520#define PEER_DOWN_NSF_CLOSE_SESSION 22 /* NSF tcp session close */
hassoe0701b72004-05-20 09:19:34 +0000521
paulac41b2a2003-08-12 05:32:27 +0000522 /* The kind of route-map Flags.*/
523 u_char rmap_type;
524#define PEER_RMAP_TYPE_IN (1 << 0) /* neighbor route-map in */
525#define PEER_RMAP_TYPE_OUT (1 << 1) /* neighbor route-map out */
526#define PEER_RMAP_TYPE_NETWORK (1 << 2) /* network route-map */
527#define PEER_RMAP_TYPE_REDISTRIBUTE (1 << 3) /* redistribute route-map */
528#define PEER_RMAP_TYPE_DEFAULT (1 << 4) /* default-originate route-map */
529#define PEER_RMAP_TYPE_NOSET (1 << 5) /* not allow to set commands */
paulfee0f4c2004-09-13 05:12:46 +0000530#define PEER_RMAP_TYPE_IMPORT (1 << 6) /* neighbor route-map import */
531#define PEER_RMAP_TYPE_EXPORT (1 << 7) /* neighbor route-map export */
paul718e3742002-12-13 20:15:29 +0000532};
533
534/* This structure's member directly points incoming packet data
535 stream. */
536struct bgp_nlri
537{
538 /* AFI. */
539 afi_t afi;
540
541 /* SAFI. */
542 safi_t safi;
543
544 /* Pointer to NLRI byte stream. */
545 u_char *nlri;
546
547 /* Length of whole NLRI. */
548 bgp_size_t length;
549};
550
551/* BGP versions. */
552#define BGP_VERSION_4 4
paul718e3742002-12-13 20:15:29 +0000553
554/* Default BGP port number. */
555#define BGP_PORT_DEFAULT 179
556
557/* BGP message header and packet size. */
558#define BGP_MARKER_SIZE 16
559#define BGP_HEADER_SIZE 19
560#define BGP_MAX_PACKET_SIZE 4096
561
562/* BGP minimum message size. */
563#define BGP_MSG_OPEN_MIN_SIZE (BGP_HEADER_SIZE + 10)
564#define BGP_MSG_UPDATE_MIN_SIZE (BGP_HEADER_SIZE + 4)
565#define BGP_MSG_NOTIFY_MIN_SIZE (BGP_HEADER_SIZE + 2)
566#define BGP_MSG_KEEPALIVE_MIN_SIZE (BGP_HEADER_SIZE + 0)
567#define BGP_MSG_ROUTE_REFRESH_MIN_SIZE (BGP_HEADER_SIZE + 4)
568#define BGP_MSG_CAPABILITY_MIN_SIZE (BGP_HEADER_SIZE + 3)
569
570/* BGP message types. */
571#define BGP_MSG_OPEN 1
572#define BGP_MSG_UPDATE 2
573#define BGP_MSG_NOTIFY 3
574#define BGP_MSG_KEEPALIVE 4
575#define BGP_MSG_ROUTE_REFRESH_NEW 5
576#define BGP_MSG_CAPABILITY 6
577#define BGP_MSG_ROUTE_REFRESH_OLD 128
578
579/* BGP open optional parameter. */
580#define BGP_OPEN_OPT_AUTH 1
581#define BGP_OPEN_OPT_CAP 2
582
583/* BGP4 attribute type codes. */
584#define BGP_ATTR_ORIGIN 1
585#define BGP_ATTR_AS_PATH 2
586#define BGP_ATTR_NEXT_HOP 3
587#define BGP_ATTR_MULTI_EXIT_DISC 4
588#define BGP_ATTR_LOCAL_PREF 5
589#define BGP_ATTR_ATOMIC_AGGREGATE 6
590#define BGP_ATTR_AGGREGATOR 7
591#define BGP_ATTR_COMMUNITIES 8
592#define BGP_ATTR_ORIGINATOR_ID 9
593#define BGP_ATTR_CLUSTER_LIST 10
594#define BGP_ATTR_DPA 11
595#define BGP_ATTR_ADVERTISER 12
596#define BGP_ATTR_RCID_PATH 13
597#define BGP_ATTR_MP_REACH_NLRI 14
598#define BGP_ATTR_MP_UNREACH_NLRI 15
599#define BGP_ATTR_EXT_COMMUNITIES 16
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000600#define BGP_ATTR_AS4_PATH 17
601#define BGP_ATTR_AS4_AGGREGATOR 18
Paul Jakma41367172007-08-06 15:24:51 +0000602#define BGP_ATTR_AS_PATHLIMIT 21
paul718e3742002-12-13 20:15:29 +0000603
604/* BGP update origin. */
605#define BGP_ORIGIN_IGP 0
606#define BGP_ORIGIN_EGP 1
607#define BGP_ORIGIN_INCOMPLETE 2
608
609/* BGP notify message codes. */
610#define BGP_NOTIFY_HEADER_ERR 1
611#define BGP_NOTIFY_OPEN_ERR 2
612#define BGP_NOTIFY_UPDATE_ERR 3
613#define BGP_NOTIFY_HOLD_ERR 4
614#define BGP_NOTIFY_FSM_ERR 5
615#define BGP_NOTIFY_CEASE 6
616#define BGP_NOTIFY_CAPABILITY_ERR 7
617#define BGP_NOTIFY_MAX 8
618
619/* BGP_NOTIFY_HEADER_ERR sub codes. */
620#define BGP_NOTIFY_HEADER_NOT_SYNC 1
621#define BGP_NOTIFY_HEADER_BAD_MESLEN 2
622#define BGP_NOTIFY_HEADER_BAD_MESTYPE 3
623#define BGP_NOTIFY_HEADER_MAX 4
624
625/* BGP_NOTIFY_OPEN_ERR sub codes. */
626#define BGP_NOTIFY_OPEN_UNSUP_VERSION 1
627#define BGP_NOTIFY_OPEN_BAD_PEER_AS 2
628#define BGP_NOTIFY_OPEN_BAD_BGP_IDENT 3
629#define BGP_NOTIFY_OPEN_UNSUP_PARAM 4
630#define BGP_NOTIFY_OPEN_AUTH_FAILURE 5
631#define BGP_NOTIFY_OPEN_UNACEP_HOLDTIME 6
632#define BGP_NOTIFY_OPEN_UNSUP_CAPBL 7
633#define BGP_NOTIFY_OPEN_MAX 8
634
635/* BGP_NOTIFY_UPDATE_ERR sub codes. */
636#define BGP_NOTIFY_UPDATE_MAL_ATTR 1
637#define BGP_NOTIFY_UPDATE_UNREC_ATTR 2
638#define BGP_NOTIFY_UPDATE_MISS_ATTR 3
639#define BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR 4
640#define BGP_NOTIFY_UPDATE_ATTR_LENG_ERR 5
641#define BGP_NOTIFY_UPDATE_INVAL_ORIGIN 6
642#define BGP_NOTIFY_UPDATE_AS_ROUTE_LOOP 7
643#define BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP 8
644#define BGP_NOTIFY_UPDATE_OPT_ATTR_ERR 9
645#define BGP_NOTIFY_UPDATE_INVAL_NETWORK 10
646#define BGP_NOTIFY_UPDATE_MAL_AS_PATH 11
647#define BGP_NOTIFY_UPDATE_MAX 12
648
paul545acaf2004-04-20 15:13:15 +0000649/* BGP_NOTIFY_CEASE sub codes (draft-ietf-idr-cease-subcode-05). */
paul718e3742002-12-13 20:15:29 +0000650#define BGP_NOTIFY_CEASE_MAX_PREFIX 1
651#define BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN 2
652#define BGP_NOTIFY_CEASE_PEER_UNCONFIG 3
653#define BGP_NOTIFY_CEASE_ADMIN_RESET 4
654#define BGP_NOTIFY_CEASE_CONNECT_REJECT 5
655#define BGP_NOTIFY_CEASE_CONFIG_CHANGE 6
paul545acaf2004-04-20 15:13:15 +0000656#define BGP_NOTIFY_CEASE_COLLISION_RESOLUTION 7
657#define BGP_NOTIFY_CEASE_OUT_OF_RESOURCE 8
658#define BGP_NOTIFY_CEASE_MAX 9
paul718e3742002-12-13 20:15:29 +0000659
660/* BGP_NOTIFY_CAPABILITY_ERR sub codes (draft-ietf-idr-dynamic-cap-02). */
661#define BGP_NOTIFY_CAPABILITY_INVALID_ACTION 1
662#define BGP_NOTIFY_CAPABILITY_INVALID_LENGTH 2
663#define BGP_NOTIFY_CAPABILITY_MALFORMED_CODE 3
664#define BGP_NOTIFY_CAPABILITY_MAX 4
665
666/* BGP finite state machine status. */
667#define Idle 1
668#define Connect 2
669#define Active 3
670#define OpenSent 4
671#define OpenConfirm 5
672#define Established 6
Paul Jakmaca058a32006-09-14 02:58:49 +0000673#define Clearing 7
674#define Deleted 8
675#define BGP_STATUS_MAX 9
paul718e3742002-12-13 20:15:29 +0000676
677/* BGP finite state machine events. */
678#define BGP_Start 1
679#define BGP_Stop 2
680#define TCP_connection_open 3
681#define TCP_connection_closed 4
682#define TCP_connection_open_failed 5
683#define TCP_fatal_error 6
684#define ConnectRetry_timer_expired 7
685#define Hold_Timer_expired 8
686#define KeepAlive_timer_expired 9
687#define Receive_OPEN_message 10
688#define Receive_KEEPALIVE_message 11
689#define Receive_UPDATE_message 12
690#define Receive_NOTIFICATION_message 13
Paul Jakmaca058a32006-09-14 02:58:49 +0000691#define Clearing_Completed 14
692#define BGP_EVENTS_MAX 15
paul718e3742002-12-13 20:15:29 +0000693
694/* BGP timers default value. */
695#define BGP_INIT_START_TIMER 5
696#define BGP_ERROR_START_TIMER 30
697#define BGP_DEFAULT_HOLDTIME 180
698#define BGP_DEFAULT_KEEPALIVE 60
699#define BGP_DEFAULT_ASORIGINATE 15
700#define BGP_DEFAULT_EBGP_ROUTEADV 30
701#define BGP_DEFAULT_IBGP_ROUTEADV 5
702#define BGP_CLEAR_CONNECT_RETRY 20
703#define BGP_DEFAULT_CONNECT_RETRY 120
704
705/* BGP default local preference. */
706#define BGP_DEFAULT_LOCAL_PREF 100
707
hasso538621f2004-05-21 09:31:30 +0000708/* BGP graceful restart */
709#define BGP_DEFAULT_RESTART_TIME 120
710#define BGP_DEFAULT_STALEPATH_TIME 360
711
paul718e3742002-12-13 20:15:29 +0000712/* SAFI which used in open capability negotiation. */
713#define BGP_SAFI_VPNV4 128
714#define BGP_SAFI_VPNV6 129
715
716/* Max TTL value. */
717#define TTL_MAX 255
718
719/* BGP uptime string length. */
720#define BGP_UPTIME_LEN 25
721
722/* Default configuration settings for bgpd. */
723#define BGP_VTY_PORT 2605
paul718e3742002-12-13 20:15:29 +0000724#define BGP_DEFAULT_CONFIG "bgpd.conf"
725
726/* Check AS path loop when we send NLRI. */
727/* #define BGP_SEND_ASPATH_CHECK */
728
729/* IBGP/EBGP identifier. We also have a CONFED peer, which is to say,
730 a peer who's AS is part of our Confederation. */
731enum
732{
733 BGP_PEER_IBGP,
734 BGP_PEER_EBGP,
735 BGP_PEER_INTERNAL,
736 BGP_PEER_CONFED
737};
738
739/* Flag for peer_clear_soft(). */
740enum bgp_clear_type
741{
742 BGP_CLEAR_SOFT_NONE,
743 BGP_CLEAR_SOFT_OUT,
744 BGP_CLEAR_SOFT_IN,
745 BGP_CLEAR_SOFT_BOTH,
paulfee0f4c2004-09-13 05:12:46 +0000746 BGP_CLEAR_SOFT_IN_ORF_PREFIX,
747 BGP_CLEAR_SOFT_RSCLIENT
paul718e3742002-12-13 20:15:29 +0000748};
749
750/* Macros. */
751#define BGP_INPUT(P) ((P)->ibuf)
752#define BGP_INPUT_PNT(P) (STREAM_PNT(BGP_INPUT(P)))
753
paul718e3742002-12-13 20:15:29 +0000754/* Count prefix size from mask length */
755#define PSIZE(a) (((a) + 7) / (8))
756
757/* BGP error codes. */
758#define BGP_SUCCESS 0
759#define BGP_ERR_INVALID_VALUE -1
760#define BGP_ERR_INVALID_FLAG -2
761#define BGP_ERR_INVALID_AS -3
762#define BGP_ERR_INVALID_BGP -4
763#define BGP_ERR_PEER_GROUP_MEMBER -5
764#define BGP_ERR_MULTIPLE_INSTANCE_USED -6
765#define BGP_ERR_PEER_GROUP_MEMBER_EXISTS -7
766#define BGP_ERR_PEER_BELONGS_TO_GROUP -8
767#define BGP_ERR_PEER_GROUP_AF_UNCONFIGURED -9
768#define BGP_ERR_PEER_GROUP_NO_REMOTE_AS -10
769#define BGP_ERR_PEER_GROUP_CANT_CHANGE -11
770#define BGP_ERR_PEER_GROUP_MISMATCH -12
771#define BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT -13
772#define BGP_ERR_MULTIPLE_INSTANCE_NOT_SET -14
773#define BGP_ERR_AS_MISMATCH -15
774#define BGP_ERR_PEER_INACTIVE -16
775#define BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER -17
776#define BGP_ERR_PEER_GROUP_HAS_THE_FLAG -18
777#define BGP_ERR_PEER_FLAG_CONFLICT -19
778#define BGP_ERR_PEER_GROUP_SHUTDOWN -20
779#define BGP_ERR_PEER_FILTER_CONFLICT -21
780#define BGP_ERR_NOT_INTERNAL_PEER -22
781#define BGP_ERR_REMOVE_PRIVATE_AS -23
782#define BGP_ERR_AF_UNCONFIGURED -24
783#define BGP_ERR_SOFT_RECONFIG_UNCONFIGURED -25
784#define BGP_ERR_INSTANCE_MISMATCH -26
785#define BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP -27
786#define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS -28
787#define BGP_ERR_MAX -29
788
789extern struct bgp_master *bm;
790
791extern struct thread_master *master;
792
793/* Prototypes. */
paul94f2b392005-06-28 12:44:16 +0000794extern void bgp_terminate (void);
795extern void bgp_reset (void);
796extern void bgp_zclient_reset (void);
797extern int bgp_nexthop_set (union sockunion *, union sockunion *,
paul718e3742002-12-13 20:15:29 +0000798 struct bgp_nexthop *, struct peer *);
paul94f2b392005-06-28 12:44:16 +0000799extern struct bgp *bgp_get_default (void);
800extern struct bgp *bgp_lookup (as_t, const char *);
801extern struct bgp *bgp_lookup_by_name (const char *);
802extern struct peer *peer_lookup (struct bgp *, union sockunion *);
803extern struct peer_group *peer_group_lookup (struct bgp *, const char *);
804extern struct peer_group *peer_group_get (struct bgp *, const char *);
805extern struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *,
paul718e3742002-12-13 20:15:29 +0000806 int *);
paul200df112005-06-01 11:17:05 +0000807extern struct peer *peer_lock (struct peer *);
808extern struct peer *peer_unlock (struct peer *);
paul94f2b392005-06-28 12:44:16 +0000809extern int peer_sort (struct peer *peer);
810extern int peer_active (struct peer *);
811extern int peer_active_nego (struct peer *);
812extern struct peer *peer_create_accept (struct bgp *);
813extern char *peer_uptime (time_t, char *, size_t);
814extern int bgp_config_write (struct vty *);
815extern void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *);
paul718e3742002-12-13 20:15:29 +0000816
paul94f2b392005-06-28 12:44:16 +0000817extern void bgp_master_init (void);
paul718e3742002-12-13 20:15:29 +0000818
paul94f2b392005-06-28 12:44:16 +0000819extern void bgp_init (void);
820extern void bgp_route_map_init (void);
paul718e3742002-12-13 20:15:29 +0000821
paul94f2b392005-06-28 12:44:16 +0000822extern int bgp_option_set (int);
823extern int bgp_option_unset (int);
824extern int bgp_option_check (int);
paul718e3742002-12-13 20:15:29 +0000825
paul94f2b392005-06-28 12:44:16 +0000826extern int bgp_get (struct bgp **, as_t *, const char *);
827extern int bgp_delete (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000828
paul94f2b392005-06-28 12:44:16 +0000829extern int bgp_flag_set (struct bgp *, int);
830extern int bgp_flag_unset (struct bgp *, int);
831extern int bgp_flag_check (struct bgp *, int);
paul718e3742002-12-13 20:15:29 +0000832
paul94f2b392005-06-28 12:44:16 +0000833extern int bgp_router_id_set (struct bgp *, struct in_addr *);
paul718e3742002-12-13 20:15:29 +0000834
paul94f2b392005-06-28 12:44:16 +0000835extern int bgp_cluster_id_set (struct bgp *, struct in_addr *);
836extern int bgp_cluster_id_unset (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000837
paul94f2b392005-06-28 12:44:16 +0000838extern int bgp_confederation_id_set (struct bgp *, as_t);
839extern int bgp_confederation_id_unset (struct bgp *);
840extern int bgp_confederation_peers_check (struct bgp *, as_t);
paul718e3742002-12-13 20:15:29 +0000841
paul94f2b392005-06-28 12:44:16 +0000842extern int bgp_confederation_peers_add (struct bgp *, as_t);
843extern int bgp_confederation_peers_remove (struct bgp *, as_t);
paul718e3742002-12-13 20:15:29 +0000844
paul94f2b392005-06-28 12:44:16 +0000845extern int bgp_timers_set (struct bgp *, u_int32_t, u_int32_t);
846extern int bgp_timers_unset (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000847
paul94f2b392005-06-28 12:44:16 +0000848extern int bgp_default_local_preference_set (struct bgp *, u_int32_t);
849extern int bgp_default_local_preference_unset (struct bgp *);
paul718e3742002-12-13 20:15:29 +0000850
paul94f2b392005-06-28 12:44:16 +0000851extern int peer_rsclient_active (struct peer *);
paulfee0f4c2004-09-13 05:12:46 +0000852
paul94f2b392005-06-28 12:44:16 +0000853extern int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t);
854extern int peer_group_remote_as (struct bgp *, const char *, as_t *);
855extern int peer_delete (struct peer *peer);
856extern int peer_group_delete (struct peer_group *);
857extern int peer_group_remote_as_delete (struct peer_group *);
paul718e3742002-12-13 20:15:29 +0000858
paul94f2b392005-06-28 12:44:16 +0000859extern int peer_activate (struct peer *, afi_t, safi_t);
860extern int peer_deactivate (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000861
paul94f2b392005-06-28 12:44:16 +0000862extern int peer_group_bind (struct bgp *, union sockunion *, struct peer_group *,
paul718e3742002-12-13 20:15:29 +0000863 afi_t, safi_t, as_t *);
paul94f2b392005-06-28 12:44:16 +0000864extern int peer_group_unbind (struct bgp *, struct peer *, struct peer_group *,
paul718e3742002-12-13 20:15:29 +0000865 afi_t, safi_t);
866
paul94f2b392005-06-28 12:44:16 +0000867extern int peer_flag_set (struct peer *, u_int32_t);
868extern int peer_flag_unset (struct peer *, u_int32_t);
paul718e3742002-12-13 20:15:29 +0000869
paul94f2b392005-06-28 12:44:16 +0000870extern int peer_af_flag_set (struct peer *, afi_t, safi_t, u_int32_t);
871extern int peer_af_flag_unset (struct peer *, afi_t, safi_t, u_int32_t);
872extern int peer_af_flag_check (struct peer *, afi_t, safi_t, u_int32_t);
paul718e3742002-12-13 20:15:29 +0000873
paul94f2b392005-06-28 12:44:16 +0000874extern int peer_ebgp_multihop_set (struct peer *, int);
875extern int peer_ebgp_multihop_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000876
paul94f2b392005-06-28 12:44:16 +0000877extern int peer_description_set (struct peer *, char *);
878extern int peer_description_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000879
paul94f2b392005-06-28 12:44:16 +0000880extern int peer_update_source_if_set (struct peer *, const char *);
881extern int peer_update_source_addr_set (struct peer *, union sockunion *);
882extern int peer_update_source_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000883
paul94f2b392005-06-28 12:44:16 +0000884extern int peer_default_originate_set (struct peer *, afi_t, safi_t, const char *);
885extern int peer_default_originate_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000886
paul94f2b392005-06-28 12:44:16 +0000887extern int peer_port_set (struct peer *, u_int16_t);
888extern int peer_port_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000889
paul94f2b392005-06-28 12:44:16 +0000890extern int peer_weight_set (struct peer *, u_int16_t);
891extern int peer_weight_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000892
paul94f2b392005-06-28 12:44:16 +0000893extern int peer_timers_set (struct peer *, u_int32_t, u_int32_t);
894extern int peer_timers_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000895
paul94f2b392005-06-28 12:44:16 +0000896extern int peer_timers_connect_set (struct peer *, u_int32_t);
897extern int peer_timers_connect_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000898
paul94f2b392005-06-28 12:44:16 +0000899extern int peer_advertise_interval_set (struct peer *, u_int32_t);
900extern int peer_advertise_interval_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000901
paul94f2b392005-06-28 12:44:16 +0000902extern int peer_interface_set (struct peer *, const char *);
903extern int peer_interface_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000904
paul94f2b392005-06-28 12:44:16 +0000905extern int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *);
906extern int peer_distribute_unset (struct peer *, afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000907
paul94f2b392005-06-28 12:44:16 +0000908extern int peer_allowas_in_set (struct peer *, afi_t, safi_t, int);
909extern int peer_allowas_in_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000910
paul94f2b392005-06-28 12:44:16 +0000911extern int peer_local_as_set (struct peer *, as_t, int);
912extern int peer_local_as_unset (struct peer *);
paul718e3742002-12-13 20:15:29 +0000913
paul94f2b392005-06-28 12:44:16 +0000914extern int peer_prefix_list_set (struct peer *, afi_t, safi_t, int, const char *);
915extern int peer_prefix_list_unset (struct peer *, afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000916
paul94f2b392005-06-28 12:44:16 +0000917extern int peer_aslist_set (struct peer *, afi_t, safi_t, int, const char *);
918extern int peer_aslist_unset (struct peer *,afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000919
paul94f2b392005-06-28 12:44:16 +0000920extern int peer_route_map_set (struct peer *, afi_t, safi_t, int, const char *);
921extern int peer_route_map_unset (struct peer *, afi_t, safi_t, int);
paul718e3742002-12-13 20:15:29 +0000922
paul94f2b392005-06-28 12:44:16 +0000923extern int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, const char *);
924extern int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000925
paul94f2b392005-06-28 12:44:16 +0000926extern int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int, u_int16_t);
927extern int peer_maximum_prefix_unset (struct peer *, afi_t, safi_t);
paul718e3742002-12-13 20:15:29 +0000928
paul94f2b392005-06-28 12:44:16 +0000929extern int peer_clear (struct peer *);
930extern int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type);
hasso93406d82005-02-02 14:40:33 +0000931
paul94f2b392005-06-28 12:44:16 +0000932extern void peer_nsf_stop (struct peer *);
paul00d252c2005-05-23 14:19:54 +0000933
934#endif /* _QUAGGA_BGPD_H */