paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* BGP message definition header. |
| 2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro |
| 3 | |
| 4 | This file is part of GNU Zebra. |
| 5 | |
| 6 | GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | under the terms of the GNU General Public License as published by the |
| 8 | Free Software Foundation; either version 2, or (at your option) any |
| 9 | later version. |
| 10 | |
| 11 | GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | 02111-1307, USA. */ |
| 20 | |
paul | 00d252c | 2005-05-23 14:19:54 +0000 | [diff] [blame] | 21 | #ifndef _QUAGGA_BGPD_H |
| 22 | #define _QUAGGA_BGPD_H |
| 23 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 24 | /* For union sockunion. */ |
| 25 | #include "sockunion.h" |
| 26 | |
| 27 | /* Typedef BGP specific types. */ |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 28 | typedef u_int32_t as_t; |
| 29 | typedef u_int16_t as16_t; /* we may still encounter 16 Bit asnums */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 30 | typedef u_int16_t bgp_size_t; |
| 31 | |
| 32 | /* BGP master for system wide configurations and variables. */ |
| 33 | struct bgp_master |
| 34 | { |
| 35 | /* BGP instance list. */ |
| 36 | struct list *bgp; |
| 37 | |
| 38 | /* BGP thread master. */ |
| 39 | struct thread_master *master; |
| 40 | |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 41 | /* work queues */ |
| 42 | struct work_queue *process_main_queue; |
| 43 | struct work_queue *process_rsclient_queue; |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 44 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 45 | /* Listening sockets */ |
| 46 | struct list *listen_sockets; |
| 47 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 48 | /* BGP port number. */ |
| 49 | u_int16_t port; |
| 50 | |
Paul Jakma | 3a02d1f | 2007-11-01 14:29:11 +0000 | [diff] [blame] | 51 | /* Listener address */ |
| 52 | char *address; |
| 53 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 54 | /* 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 Jakma | cccbc01 | 2012-06-14 10:40:26 +0100 | [diff] [blame] | 62 | #define BGP_OPT_NO_LISTEN (1 << 3) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | /* BGP instance structure. */ |
| 66 | struct bgp |
| 67 | { |
| 68 | /* AS number of this BGP instance. */ |
| 69 | as_t as; |
| 70 | |
| 71 | /* Name of this BGP instance. */ |
| 72 | char *name; |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 73 | |
Stephen Hemminger | 0088b5d | 2009-05-21 08:51:03 -0700 | [diff] [blame] | 74 | /* Reference count to allow peer_delete to finish after bgp_delete */ |
| 75 | int lock; |
| 76 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 77 | /* Self peer. */ |
| 78 | struct peer *peer_self; |
| 79 | |
| 80 | /* BGP peer. */ |
| 81 | struct list *peer; |
| 82 | |
| 83 | /* BGP peer group. */ |
| 84 | struct list *group; |
| 85 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 86 | /* BGP route-server-clients. */ |
| 87 | struct list *rsclient; |
| 88 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 89 | /* BGP configuration. */ |
| 90 | u_int16_t config; |
| 91 | #define BGP_CONFIG_ROUTER_ID (1 << 0) |
| 92 | #define BGP_CONFIG_CLUSTER_ID (1 << 1) |
| 93 | #define BGP_CONFIG_CONFEDERATION (1 << 2) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 94 | |
| 95 | /* BGP router identifier. */ |
| 96 | struct in_addr router_id; |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 97 | struct in_addr router_id_static; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 98 | |
| 99 | /* BGP route reflector cluster ID. */ |
| 100 | struct in_addr cluster_id; |
| 101 | |
| 102 | /* BGP confederation information. */ |
| 103 | as_t confed_id; |
| 104 | as_t *confed_peers; |
| 105 | int confed_peers_cnt; |
| 106 | |
Vipin Kumar | dd49eb1 | 2014-09-30 14:36:38 -0700 | [diff] [blame] | 107 | struct thread *t_startup; |
| 108 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 109 | /* BGP flags. */ |
Dinesh Dutt | 083e5e2 | 2015-11-09 20:21:54 -0500 | [diff] [blame] | 110 | u_int32_t flags; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 111 | #define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0) |
| 112 | #define BGP_FLAG_DETERMINISTIC_MED (1 << 1) |
| 113 | #define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2) |
| 114 | #define BGP_FLAG_MED_CONFED (1 << 3) |
| 115 | #define BGP_FLAG_NO_DEFAULT_IPV4 (1 << 4) |
| 116 | #define BGP_FLAG_NO_CLIENT_TO_CLIENT (1 << 5) |
| 117 | #define BGP_FLAG_ENFORCE_FIRST_AS (1 << 6) |
| 118 | #define BGP_FLAG_COMPARE_ROUTER_ID (1 << 7) |
| 119 | #define BGP_FLAG_ASPATH_IGNORE (1 << 8) |
| 120 | #define BGP_FLAG_IMPORT_CHECK (1 << 9) |
| 121 | #define BGP_FLAG_NO_FAST_EXT_FAILOVER (1 << 10) |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 122 | #define BGP_FLAG_LOG_NEIGHBOR_CHANGES (1 << 11) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 123 | #define BGP_FLAG_GRACEFUL_RESTART (1 << 12) |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 124 | #define BGP_FLAG_ASPATH_CONFED (1 << 13) |
Pradosh Mohapatra | 2fdd455 | 2013-09-07 07:02:36 +0000 | [diff] [blame] | 125 | #define BGP_FLAG_ASPATH_MULTIPATH_RELAX (1 << 14) |
Lou Berger | 82dd707 | 2016-01-12 13:41:57 -0500 | [diff] [blame] | 126 | #define BGP_FLAG_DELETING (1 << 15) |
Dinesh Dutt | 083e5e2 | 2015-11-09 20:21:54 -0500 | [diff] [blame] | 127 | #define BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY (1 << 16) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 128 | |
| 129 | /* BGP Per AF flags */ |
| 130 | u_int16_t af_flags[AFI_MAX][SAFI_MAX]; |
| 131 | #define BGP_CONFIG_DAMPENING (1 << 0) |
| 132 | |
| 133 | /* Static route configuration. */ |
| 134 | struct bgp_table *route[AFI_MAX][SAFI_MAX]; |
| 135 | |
| 136 | /* Aggregate address configuration. */ |
| 137 | struct bgp_table *aggregate[AFI_MAX][SAFI_MAX]; |
| 138 | |
| 139 | /* BGP routing information base. */ |
| 140 | struct bgp_table *rib[AFI_MAX][SAFI_MAX]; |
| 141 | |
| 142 | /* BGP redistribute configuration. */ |
| 143 | u_char redist[AFI_MAX][ZEBRA_ROUTE_MAX]; |
| 144 | |
| 145 | /* BGP redistribute metric configuration. */ |
| 146 | u_char redist_metric_flag[AFI_MAX][ZEBRA_ROUTE_MAX]; |
| 147 | u_int32_t redist_metric[AFI_MAX][ZEBRA_ROUTE_MAX]; |
| 148 | |
| 149 | /* BGP redistribute route-map. */ |
| 150 | struct |
| 151 | { |
| 152 | char *name; |
| 153 | struct route_map *map; |
| 154 | } rmap[AFI_MAX][ZEBRA_ROUTE_MAX]; |
| 155 | |
| 156 | /* BGP distance configuration. */ |
| 157 | u_char distance_ebgp; |
| 158 | u_char distance_ibgp; |
| 159 | u_char distance_local; |
Roman Hoog Antink | 6184c39 | 2014-03-17 14:01:42 +0100 | [diff] [blame] | 160 | |
| 161 | /* BGP ipv6 distance configuration. */ |
| 162 | u_char ipv6_distance_ebgp; |
| 163 | u_char ipv6_distance_ibgp; |
| 164 | u_char ipv6_distance_local; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 165 | |
| 166 | /* BGP default local-preference. */ |
| 167 | u_int32_t default_local_pref; |
| 168 | |
| 169 | /* BGP default timer. */ |
| 170 | u_int32_t default_holdtime; |
| 171 | u_int32_t default_keepalive; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 172 | |
| 173 | /* BGP graceful restart */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 174 | u_int32_t restart_time; |
| 175 | u_int32_t stalepath_time; |
Josh Bailey | 165b5ff | 2011-07-20 20:43:22 -0700 | [diff] [blame] | 176 | |
| 177 | /* Maximum-paths configuration */ |
| 178 | struct bgp_maxpaths_cfg { |
| 179 | u_int16_t maxpaths_ebgp; |
| 180 | u_int16_t maxpaths_ibgp; |
| 181 | } maxpaths[AFI_MAX][SAFI_MAX]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 182 | }; |
| 183 | |
| 184 | /* BGP peer-group support. */ |
| 185 | struct peer_group |
| 186 | { |
| 187 | /* Name of the peer-group. */ |
| 188 | char *name; |
| 189 | |
| 190 | /* Pointer to BGP. */ |
| 191 | struct bgp *bgp; |
| 192 | |
| 193 | /* Peer-group client list. */ |
| 194 | struct list *peer; |
| 195 | |
| 196 | /* Peer-group config */ |
| 197 | struct peer *conf; |
| 198 | }; |
| 199 | |
| 200 | /* BGP Notify message format. */ |
| 201 | struct bgp_notify |
| 202 | { |
| 203 | u_char code; |
| 204 | u_char subcode; |
| 205 | char *data; |
| 206 | bgp_size_t length; |
| 207 | }; |
| 208 | |
| 209 | /* Next hop self address. */ |
| 210 | struct bgp_nexthop |
| 211 | { |
| 212 | struct interface *ifp; |
| 213 | struct in_addr v4; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 214 | struct in6_addr v6_global; |
| 215 | struct in6_addr v6_local; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 216 | }; |
| 217 | |
| 218 | /* BGP router distinguisher value. */ |
| 219 | #define BGP_RD_SIZE 8 |
| 220 | |
| 221 | struct bgp_rd |
| 222 | { |
| 223 | u_char val[BGP_RD_SIZE]; |
| 224 | }; |
| 225 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 226 | #define RMAP_IN 0 |
| 227 | #define RMAP_OUT 1 |
| 228 | #define RMAP_IMPORT 2 |
| 229 | #define RMAP_EXPORT 3 |
| 230 | #define RMAP_MAX 4 |
| 231 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 232 | /* BGP filter structure. */ |
| 233 | struct bgp_filter |
| 234 | { |
| 235 | /* Distribute-list. */ |
| 236 | struct |
| 237 | { |
| 238 | char *name; |
| 239 | struct access_list *alist; |
| 240 | } dlist[FILTER_MAX]; |
| 241 | |
| 242 | /* Prefix-list. */ |
| 243 | struct |
| 244 | { |
| 245 | char *name; |
| 246 | struct prefix_list *plist; |
| 247 | } plist[FILTER_MAX]; |
| 248 | |
| 249 | /* Filter-list. */ |
| 250 | struct |
| 251 | { |
| 252 | char *name; |
| 253 | struct as_list *aslist; |
| 254 | } aslist[FILTER_MAX]; |
| 255 | |
| 256 | /* Route-map. */ |
| 257 | struct |
| 258 | { |
| 259 | char *name; |
| 260 | struct route_map *map; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 261 | } map[RMAP_MAX]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 262 | |
| 263 | /* Unsuppress-map. */ |
| 264 | struct |
| 265 | { |
| 266 | char *name; |
| 267 | struct route_map *map; |
| 268 | } usmap; |
| 269 | }; |
| 270 | |
Jorge Boncompte [DTI2] | 6d85b15 | 2012-05-07 16:52:54 +0000 | [diff] [blame] | 271 | /* IBGP/EBGP identifier. We also have a CONFED peer, which is to say, |
| 272 | a peer who's AS is part of our Confederation. */ |
| 273 | typedef enum |
| 274 | { |
| 275 | BGP_PEER_IBGP = 1, |
| 276 | BGP_PEER_EBGP, |
| 277 | BGP_PEER_INTERNAL, |
| 278 | BGP_PEER_CONFED, |
| 279 | } bgp_peer_sort_t; |
| 280 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 281 | /* BGP neighbor structure. */ |
| 282 | struct peer |
| 283 | { |
| 284 | /* BGP structure. */ |
| 285 | struct bgp *bgp; |
| 286 | |
paul | 200df11 | 2005-06-01 11:17:05 +0000 | [diff] [blame] | 287 | /* reference count, primarily to allow bgp_process'ing of route_node's |
| 288 | * to be done after a struct peer is deleted. |
| 289 | * |
| 290 | * named 'lock' for hysterical reasons within Quagga. |
| 291 | */ |
| 292 | int lock; |
| 293 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 294 | /* BGP peer group. */ |
| 295 | struct peer_group *group; |
| 296 | u_char af_group[AFI_MAX][SAFI_MAX]; |
| 297 | |
| 298 | /* Peer's remote AS number. */ |
| 299 | as_t as; |
| 300 | |
| 301 | /* Peer's local AS number. */ |
| 302 | as_t local_as; |
| 303 | |
Jorge Boncompte [DTI2] | 6d85b15 | 2012-05-07 16:52:54 +0000 | [diff] [blame] | 304 | bgp_peer_sort_t sort; |
| 305 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 306 | /* Peer's Change local AS number. */ |
| 307 | as_t change_local_as; |
| 308 | |
| 309 | /* Remote router ID. */ |
| 310 | struct in_addr remote_id; |
| 311 | |
| 312 | /* Local router ID. */ |
| 313 | struct in_addr local_id; |
| 314 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 315 | /* Peer specific RIB when configured as route-server-client. */ |
| 316 | struct bgp_table *rib[AFI_MAX][SAFI_MAX]; |
| 317 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 318 | /* Packet receive and send buffer. */ |
| 319 | struct stream *ibuf; |
| 320 | struct stream_fifo *obuf; |
| 321 | struct stream *work; |
| 322 | |
Pradosh Mohapatra | 8c71e48 | 2014-01-15 06:57:57 +0000 | [diff] [blame] | 323 | /* We use a separate stream to encode MP_REACH_NLRI for efficient |
| 324 | * NLRI packing. peer->work stores all the other attributes. The |
| 325 | * actual packet is then constructed by concatenating the two. |
| 326 | */ |
| 327 | struct stream *scratch; |
| 328 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 329 | /* Status of the peer. */ |
| 330 | int status; |
| 331 | int ostatus; |
| 332 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 333 | /* Peer index, used for dumping TABLE_DUMP_V2 format */ |
| 334 | uint16_t table_dump_index; |
| 335 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 336 | /* Peer information */ |
paul | eb82118 | 2004-05-01 08:44:08 +0000 | [diff] [blame] | 337 | int fd; /* File descriptor */ |
| 338 | int ttl; /* TTL of TCP connection to the peer. */ |
Timo Teräs | ef75770 | 2015-04-29 09:43:04 +0300 | [diff] [blame] | 339 | int rtt; /* Estimated round-trip-time from TCP_INFO */ |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 340 | int gtsm_hops; /* minimum hopcount to peer */ |
paul | eb82118 | 2004-05-01 08:44:08 +0000 | [diff] [blame] | 341 | char *desc; /* Description of the peer. */ |
| 342 | unsigned short port; /* Destination port for peer */ |
| 343 | char *host; /* Printable address of the peer. */ |
| 344 | union sockunion su; /* Sockunion address of the peer. */ |
| 345 | time_t uptime; /* Last Up/Down time */ |
| 346 | time_t readtime; /* Last read time */ |
| 347 | time_t resettime; /* Last reset time */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 348 | |
Paul Jakma | 9099f9b | 2016-01-18 10:12:10 +0000 | [diff] [blame] | 349 | ifindex_t ifindex; /* ifindex of the BGP connection. */ |
paul | eb82118 | 2004-05-01 08:44:08 +0000 | [diff] [blame] | 350 | char *ifname; /* bind interface name. */ |
| 351 | char *update_if; |
| 352 | union sockunion *update_source; |
| 353 | struct zlog *log; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 354 | |
paul | eb82118 | 2004-05-01 08:44:08 +0000 | [diff] [blame] | 355 | union sockunion *su_local; /* Sockunion of local address. */ |
| 356 | union sockunion *su_remote; /* Sockunion of remote address. */ |
| 357 | int shared_network; /* Is this peer shared same network. */ |
| 358 | struct bgp_nexthop nexthop; /* Nexthop */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 359 | |
| 360 | /* Peer address family configuration. */ |
| 361 | u_char afc[AFI_MAX][SAFI_MAX]; |
| 362 | u_char afc_nego[AFI_MAX][SAFI_MAX]; |
| 363 | u_char afc_adv[AFI_MAX][SAFI_MAX]; |
| 364 | u_char afc_recv[AFI_MAX][SAFI_MAX]; |
| 365 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 366 | /* Capability flags (reset in bgp_stop) */ |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 367 | u_int16_t cap; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 368 | #define PEER_CAP_REFRESH_ADV (1 << 0) /* refresh advertised */ |
| 369 | #define PEER_CAP_REFRESH_OLD_RCV (1 << 1) /* refresh old received */ |
| 370 | #define PEER_CAP_REFRESH_NEW_RCV (1 << 2) /* refresh rfc received */ |
| 371 | #define PEER_CAP_DYNAMIC_ADV (1 << 3) /* dynamic advertised */ |
| 372 | #define PEER_CAP_DYNAMIC_RCV (1 << 4) /* dynamic received */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 373 | #define PEER_CAP_RESTART_ADV (1 << 5) /* restart advertised */ |
| 374 | #define PEER_CAP_RESTART_RCV (1 << 6) /* restart received */ |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 375 | #define PEER_CAP_AS4_ADV (1 << 7) /* as4 advertised */ |
| 376 | #define PEER_CAP_AS4_RCV (1 << 8) /* as4 received */ |
Vipin Kumar | dd49eb1 | 2014-09-30 14:36:38 -0700 | [diff] [blame] | 377 | #define PEER_CAP_RESTART_BIT_ADV (1 << 9) /* sent restart state */ |
| 378 | #define PEER_CAP_RESTART_BIT_RCV (1 << 10) /* peer restart state */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 379 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 380 | /* Capability flags (reset in bgp_stop) */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 381 | u_int16_t af_cap[AFI_MAX][SAFI_MAX]; |
| 382 | #define PEER_CAP_ORF_PREFIX_SM_ADV (1 << 0) /* send-mode advertised */ |
| 383 | #define PEER_CAP_ORF_PREFIX_RM_ADV (1 << 1) /* receive-mode advertised */ |
| 384 | #define PEER_CAP_ORF_PREFIX_SM_RCV (1 << 2) /* send-mode received */ |
| 385 | #define PEER_CAP_ORF_PREFIX_RM_RCV (1 << 3) /* receive-mode received */ |
| 386 | #define PEER_CAP_ORF_PREFIX_SM_OLD_RCV (1 << 4) /* send-mode received */ |
| 387 | #define PEER_CAP_ORF_PREFIX_RM_OLD_RCV (1 << 5) /* receive-mode received */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 388 | #define PEER_CAP_RESTART_AF_RCV (1 << 6) /* graceful restart afi/safi received */ |
| 389 | #define PEER_CAP_RESTART_AF_PRESERVE_RCV (1 << 7) /* graceful restart afi/safi F-bit received */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 390 | |
| 391 | /* Global configuration flags. */ |
| 392 | u_int32_t flags; |
| 393 | #define PEER_FLAG_PASSIVE (1 << 0) /* passive mode */ |
| 394 | #define PEER_FLAG_SHUTDOWN (1 << 1) /* shutdown */ |
| 395 | #define PEER_FLAG_DONT_CAPABILITY (1 << 2) /* dont-capability */ |
| 396 | #define PEER_FLAG_OVERRIDE_CAPABILITY (1 << 3) /* override-capability */ |
| 397 | #define PEER_FLAG_STRICT_CAP_MATCH (1 << 4) /* strict-match */ |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 398 | #define PEER_FLAG_DYNAMIC_CAPABILITY (1 << 5) /* dynamic capability */ |
hasso | 6ffd207 | 2005-02-02 14:50:11 +0000 | [diff] [blame] | 399 | #define PEER_FLAG_DISABLE_CONNECTED_CHECK (1 << 6) /* disable-connected-check */ |
hasso | c950243 | 2005-02-01 22:01:48 +0000 | [diff] [blame] | 400 | #define PEER_FLAG_LOCAL_AS_NO_PREPEND (1 << 7) /* local-as no-prepend */ |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 401 | #define PEER_FLAG_LOCAL_AS_REPLACE_AS (1 << 8) /* local-as no-prepend replace-as */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 402 | |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 403 | /* NSF mode (graceful restart) */ |
| 404 | u_char nsf[AFI_MAX][SAFI_MAX]; |
| 405 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 406 | /* Per AF configuration flags. */ |
| 407 | u_int32_t af_flags[AFI_MAX][SAFI_MAX]; |
| 408 | #define PEER_FLAG_SEND_COMMUNITY (1 << 0) /* send-community */ |
| 409 | #define PEER_FLAG_SEND_EXT_COMMUNITY (1 << 1) /* send-community ext. */ |
| 410 | #define PEER_FLAG_NEXTHOP_SELF (1 << 2) /* next-hop-self */ |
| 411 | #define PEER_FLAG_REFLECTOR_CLIENT (1 << 3) /* reflector-client */ |
| 412 | #define PEER_FLAG_RSERVER_CLIENT (1 << 4) /* route-server-client */ |
| 413 | #define PEER_FLAG_SOFT_RECONFIG (1 << 5) /* soft-reconfiguration */ |
| 414 | #define PEER_FLAG_AS_PATH_UNCHANGED (1 << 6) /* transparent-as */ |
| 415 | #define PEER_FLAG_NEXTHOP_UNCHANGED (1 << 7) /* transparent-next-hop */ |
| 416 | #define PEER_FLAG_MED_UNCHANGED (1 << 8) /* transparent-next-hop */ |
| 417 | #define PEER_FLAG_DEFAULT_ORIGINATE (1 << 9) /* default-originate */ |
| 418 | #define PEER_FLAG_REMOVE_PRIVATE_AS (1 << 10) /* remove-private-as */ |
| 419 | #define PEER_FLAG_ALLOWAS_IN (1 << 11) /* set allowas-in */ |
| 420 | #define PEER_FLAG_ORF_PREFIX_SM (1 << 12) /* orf capability send-mode */ |
| 421 | #define PEER_FLAG_ORF_PREFIX_RM (1 << 13) /* orf capability receive-mode */ |
| 422 | #define PEER_FLAG_MAX_PREFIX (1 << 14) /* maximum prefix */ |
| 423 | #define PEER_FLAG_MAX_PREFIX_WARNING (1 << 15) /* maximum prefix warning-only */ |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 424 | #define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1 << 16) /* leave link-local nexthop unchanged */ |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 425 | #define PEER_FLAG_NEXTHOP_SELF_ALL (1 << 17) /* next-hop-self all */ |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 426 | |
| 427 | /* MD5 password */ |
| 428 | char *password; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 429 | |
| 430 | /* default-originate route-map. */ |
| 431 | struct |
| 432 | { |
| 433 | char *name; |
| 434 | struct route_map *map; |
| 435 | } default_rmap[AFI_MAX][SAFI_MAX]; |
| 436 | |
| 437 | /* Peer status flags. */ |
| 438 | u_int16_t sflags; |
| 439 | #define PEER_STATUS_ACCEPT_PEER (1 << 0) /* accept peer */ |
| 440 | #define PEER_STATUS_PREFIX_OVERFLOW (1 << 1) /* prefix-overflow */ |
| 441 | #define PEER_STATUS_CAPABILITY_OPEN (1 << 2) /* capability open send */ |
| 442 | #define PEER_STATUS_HAVE_ACCEPT (1 << 3) /* accept peer's parent */ |
| 443 | #define PEER_STATUS_GROUP (1 << 4) /* peer-group conf */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 444 | #define PEER_STATUS_NSF_MODE (1 << 5) /* NSF aware peer */ |
| 445 | #define PEER_STATUS_NSF_WAIT (1 << 6) /* wait comeback peer */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 446 | |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 447 | /* Peer status af flags (reset in bgp_stop) */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 448 | u_int16_t af_sflags[AFI_MAX][SAFI_MAX]; |
| 449 | #define PEER_STATUS_ORF_PREFIX_SEND (1 << 0) /* prefix-list send peer */ |
| 450 | #define PEER_STATUS_ORF_WAIT_REFRESH (1 << 1) /* wait refresh received peer */ |
| 451 | #define PEER_STATUS_DEFAULT_ORIGINATE (1 << 2) /* default-originate peer */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 452 | #define PEER_STATUS_PREFIX_THRESHOLD (1 << 3) /* exceed prefix-threshold */ |
| 453 | #define PEER_STATUS_PREFIX_LIMIT (1 << 4) /* exceed prefix-limit */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 454 | #define PEER_STATUS_EOR_SEND (1 << 5) /* end-of-rib send to peer */ |
| 455 | #define PEER_STATUS_EOR_RECEIVED (1 << 6) /* end-of-rib received from peer */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 456 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 457 | /* Default attribute value for the peer. */ |
| 458 | u_int32_t config; |
| 459 | #define PEER_CONFIG_WEIGHT (1 << 0) /* Default weight. */ |
| 460 | #define PEER_CONFIG_TIMER (1 << 1) /* keepalive & holdtime */ |
| 461 | #define PEER_CONFIG_CONNECT (1 << 2) /* connect */ |
| 462 | #define PEER_CONFIG_ROUTEADV (1 << 3) /* route advertise */ |
| 463 | u_int32_t weight; |
| 464 | u_int32_t holdtime; |
| 465 | u_int32_t keepalive; |
| 466 | u_int32_t connect; |
| 467 | u_int32_t routeadv; |
| 468 | |
| 469 | /* Timer values. */ |
| 470 | u_int32_t v_start; |
| 471 | u_int32_t v_connect; |
| 472 | u_int32_t v_holdtime; |
| 473 | u_int32_t v_keepalive; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 474 | u_int32_t v_routeadv; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 475 | u_int32_t v_pmax_restart; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 476 | u_int32_t v_gr_restart; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 477 | |
| 478 | /* Threads. */ |
| 479 | struct thread *t_read; |
| 480 | struct thread *t_write; |
| 481 | struct thread *t_start; |
| 482 | struct thread *t_connect; |
| 483 | struct thread *t_holdtime; |
| 484 | struct thread *t_keepalive; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 485 | struct thread *t_routeadv; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 486 | struct thread *t_pmax_restart; |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 487 | struct thread *t_gr_restart; |
| 488 | struct thread *t_gr_stale; |
Paul Jakma | 64e580a | 2006-02-21 01:09:01 +0000 | [diff] [blame] | 489 | |
| 490 | /* workqueues */ |
| 491 | struct work_queue *clear_node_queue; |
| 492 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 493 | /* Statistics field */ |
| 494 | u_int32_t open_in; /* Open message input count */ |
| 495 | u_int32_t open_out; /* Open message output count */ |
| 496 | u_int32_t update_in; /* Update message input count */ |
| 497 | u_int32_t update_out; /* Update message ouput count */ |
| 498 | time_t update_time; /* Update message received time. */ |
| 499 | u_int32_t keepalive_in; /* Keepalive input count */ |
| 500 | u_int32_t keepalive_out; /* Keepalive output count */ |
| 501 | u_int32_t notify_in; /* Notify input count */ |
| 502 | u_int32_t notify_out; /* Notify output count */ |
| 503 | u_int32_t refresh_in; /* Route Refresh input count */ |
| 504 | u_int32_t refresh_out; /* Route Refresh output count */ |
| 505 | u_int32_t dynamic_cap_in; /* Dynamic Capability input count. */ |
| 506 | u_int32_t dynamic_cap_out; /* Dynamic Capability output count. */ |
| 507 | |
| 508 | /* BGP state count */ |
| 509 | u_int32_t established; /* Established */ |
| 510 | u_int32_t dropped; /* Dropped */ |
| 511 | |
| 512 | /* Syncronization list and time. */ |
| 513 | struct bgp_synchronize *sync[AFI_MAX][SAFI_MAX]; |
| 514 | time_t synctime; |
| 515 | |
| 516 | /* Send prefix count. */ |
| 517 | unsigned long scount[AFI_MAX][SAFI_MAX]; |
| 518 | |
| 519 | /* Announcement attribute hash. */ |
| 520 | struct hash *hash[AFI_MAX][SAFI_MAX]; |
| 521 | |
| 522 | /* Notify data. */ |
| 523 | struct bgp_notify notify; |
| 524 | |
| 525 | /* Whole packet size to be read. */ |
| 526 | unsigned long packet_size; |
| 527 | |
| 528 | /* Filter structure. */ |
| 529 | struct bgp_filter filter[AFI_MAX][SAFI_MAX]; |
| 530 | |
| 531 | /* ORF Prefix-list */ |
| 532 | struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX]; |
| 533 | |
| 534 | /* Prefix count. */ |
| 535 | unsigned long pcount[AFI_MAX][SAFI_MAX]; |
| 536 | |
| 537 | /* Max prefix count. */ |
| 538 | unsigned long pmax[AFI_MAX][SAFI_MAX]; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 539 | u_char pmax_threshold[AFI_MAX][SAFI_MAX]; |
hasso | 0a486e5 | 2005-02-01 20:57:17 +0000 | [diff] [blame] | 540 | u_int16_t pmax_restart[AFI_MAX][SAFI_MAX]; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 541 | #define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 542 | |
| 543 | /* allowas-in. */ |
| 544 | char allowas_in[AFI_MAX][SAFI_MAX]; |
paul | ac41b2a | 2003-08-12 05:32:27 +0000 | [diff] [blame] | 545 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 546 | /* peer reset cause */ |
| 547 | char last_reset; |
| 548 | #define PEER_DOWN_RID_CHANGE 1 /* bgp router-id command */ |
| 549 | #define PEER_DOWN_REMOTE_AS_CHANGE 2 /* neighbor remote-as command */ |
| 550 | #define PEER_DOWN_LOCAL_AS_CHANGE 3 /* neighbor local-as command */ |
| 551 | #define PEER_DOWN_CLID_CHANGE 4 /* bgp cluster-id command */ |
| 552 | #define PEER_DOWN_CONFED_ID_CHANGE 5 /* bgp confederation identifier command */ |
| 553 | #define PEER_DOWN_CONFED_PEER_CHANGE 6 /* bgp confederation peer command */ |
| 554 | #define PEER_DOWN_RR_CLIENT_CHANGE 7 /* neighbor route-reflector-client command */ |
| 555 | #define PEER_DOWN_RS_CLIENT_CHANGE 8 /* neighbor route-server-client command */ |
| 556 | #define PEER_DOWN_UPDATE_SOURCE_CHANGE 9 /* neighbor update-source command */ |
| 557 | #define PEER_DOWN_AF_ACTIVATE 10 /* neighbor activate command */ |
| 558 | #define PEER_DOWN_USER_SHUTDOWN 11 /* neighbor shutdown command */ |
| 559 | #define PEER_DOWN_USER_RESET 12 /* clear ip bgp command */ |
| 560 | #define PEER_DOWN_NOTIFY_RECEIVED 13 /* notification received */ |
| 561 | #define PEER_DOWN_NOTIFY_SEND 14 /* notification send */ |
| 562 | #define PEER_DOWN_CLOSE_SESSION 15 /* tcp session close */ |
| 563 | #define PEER_DOWN_NEIGHBOR_DELETE 16 /* neghbor delete */ |
| 564 | #define PEER_DOWN_RMAP_BIND 17 /* neghbor peer-group command */ |
| 565 | #define PEER_DOWN_RMAP_UNBIND 18 /* no neighbor peer-group command */ |
| 566 | #define PEER_DOWN_CAPABILITY_CHANGE 19 /* neighbor capability command */ |
| 567 | #define PEER_DOWN_PASSIVE_CHANGE 20 /* neighbor passive command */ |
| 568 | #define PEER_DOWN_MULTIHOP_CHANGE 21 /* neighbor multihop command */ |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 569 | #define PEER_DOWN_NSF_CLOSE_SESSION 22 /* NSF tcp session close */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 570 | |
paul | ac41b2a | 2003-08-12 05:32:27 +0000 | [diff] [blame] | 571 | /* The kind of route-map Flags.*/ |
| 572 | u_char rmap_type; |
| 573 | #define PEER_RMAP_TYPE_IN (1 << 0) /* neighbor route-map in */ |
| 574 | #define PEER_RMAP_TYPE_OUT (1 << 1) /* neighbor route-map out */ |
| 575 | #define PEER_RMAP_TYPE_NETWORK (1 << 2) /* network route-map */ |
| 576 | #define PEER_RMAP_TYPE_REDISTRIBUTE (1 << 3) /* redistribute route-map */ |
| 577 | #define PEER_RMAP_TYPE_DEFAULT (1 << 4) /* default-originate route-map */ |
| 578 | #define PEER_RMAP_TYPE_NOSET (1 << 5) /* not allow to set commands */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 579 | #define PEER_RMAP_TYPE_IMPORT (1 << 6) /* neighbor route-map import */ |
| 580 | #define PEER_RMAP_TYPE_EXPORT (1 << 7) /* neighbor route-map export */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 581 | }; |
| 582 | |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 583 | #define PEER_PASSWORD_MINLEN (1) |
| 584 | #define PEER_PASSWORD_MAXLEN (80) |
| 585 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 586 | /* This structure's member directly points incoming packet data |
| 587 | stream. */ |
| 588 | struct bgp_nlri |
| 589 | { |
| 590 | /* AFI. */ |
| 591 | afi_t afi; |
| 592 | |
| 593 | /* SAFI. */ |
| 594 | safi_t safi; |
| 595 | |
| 596 | /* Pointer to NLRI byte stream. */ |
| 597 | u_char *nlri; |
| 598 | |
| 599 | /* Length of whole NLRI. */ |
| 600 | bgp_size_t length; |
| 601 | }; |
| 602 | |
| 603 | /* BGP versions. */ |
| 604 | #define BGP_VERSION_4 4 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 605 | |
| 606 | /* Default BGP port number. */ |
| 607 | #define BGP_PORT_DEFAULT 179 |
| 608 | |
| 609 | /* BGP message header and packet size. */ |
| 610 | #define BGP_MARKER_SIZE 16 |
| 611 | #define BGP_HEADER_SIZE 19 |
| 612 | #define BGP_MAX_PACKET_SIZE 4096 |
| 613 | |
| 614 | /* BGP minimum message size. */ |
| 615 | #define BGP_MSG_OPEN_MIN_SIZE (BGP_HEADER_SIZE + 10) |
| 616 | #define BGP_MSG_UPDATE_MIN_SIZE (BGP_HEADER_SIZE + 4) |
| 617 | #define BGP_MSG_NOTIFY_MIN_SIZE (BGP_HEADER_SIZE + 2) |
| 618 | #define BGP_MSG_KEEPALIVE_MIN_SIZE (BGP_HEADER_SIZE + 0) |
| 619 | #define BGP_MSG_ROUTE_REFRESH_MIN_SIZE (BGP_HEADER_SIZE + 4) |
| 620 | #define BGP_MSG_CAPABILITY_MIN_SIZE (BGP_HEADER_SIZE + 3) |
| 621 | |
| 622 | /* BGP message types. */ |
| 623 | #define BGP_MSG_OPEN 1 |
| 624 | #define BGP_MSG_UPDATE 2 |
| 625 | #define BGP_MSG_NOTIFY 3 |
| 626 | #define BGP_MSG_KEEPALIVE 4 |
| 627 | #define BGP_MSG_ROUTE_REFRESH_NEW 5 |
| 628 | #define BGP_MSG_CAPABILITY 6 |
| 629 | #define BGP_MSG_ROUTE_REFRESH_OLD 128 |
| 630 | |
| 631 | /* BGP open optional parameter. */ |
| 632 | #define BGP_OPEN_OPT_AUTH 1 |
| 633 | #define BGP_OPEN_OPT_CAP 2 |
| 634 | |
| 635 | /* BGP4 attribute type codes. */ |
| 636 | #define BGP_ATTR_ORIGIN 1 |
| 637 | #define BGP_ATTR_AS_PATH 2 |
| 638 | #define BGP_ATTR_NEXT_HOP 3 |
| 639 | #define BGP_ATTR_MULTI_EXIT_DISC 4 |
| 640 | #define BGP_ATTR_LOCAL_PREF 5 |
| 641 | #define BGP_ATTR_ATOMIC_AGGREGATE 6 |
| 642 | #define BGP_ATTR_AGGREGATOR 7 |
| 643 | #define BGP_ATTR_COMMUNITIES 8 |
| 644 | #define BGP_ATTR_ORIGINATOR_ID 9 |
| 645 | #define BGP_ATTR_CLUSTER_LIST 10 |
| 646 | #define BGP_ATTR_DPA 11 |
| 647 | #define BGP_ATTR_ADVERTISER 12 |
| 648 | #define BGP_ATTR_RCID_PATH 13 |
| 649 | #define BGP_ATTR_MP_REACH_NLRI 14 |
| 650 | #define BGP_ATTR_MP_UNREACH_NLRI 15 |
| 651 | #define BGP_ATTR_EXT_COMMUNITIES 16 |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 652 | #define BGP_ATTR_AS4_PATH 17 |
| 653 | #define BGP_ATTR_AS4_AGGREGATOR 18 |
Paul Jakma | 4136717 | 2007-08-06 15:24:51 +0000 | [diff] [blame] | 654 | #define BGP_ATTR_AS_PATHLIMIT 21 |
Lou Berger | c374178 | 2016-01-12 13:42:01 -0500 | [diff] [blame] | 655 | #define BGP_ATTR_ENCAP 23 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 656 | |
| 657 | /* BGP update origin. */ |
| 658 | #define BGP_ORIGIN_IGP 0 |
| 659 | #define BGP_ORIGIN_EGP 1 |
| 660 | #define BGP_ORIGIN_INCOMPLETE 2 |
| 661 | |
| 662 | /* BGP notify message codes. */ |
| 663 | #define BGP_NOTIFY_HEADER_ERR 1 |
| 664 | #define BGP_NOTIFY_OPEN_ERR 2 |
| 665 | #define BGP_NOTIFY_UPDATE_ERR 3 |
| 666 | #define BGP_NOTIFY_HOLD_ERR 4 |
| 667 | #define BGP_NOTIFY_FSM_ERR 5 |
| 668 | #define BGP_NOTIFY_CEASE 6 |
| 669 | #define BGP_NOTIFY_CAPABILITY_ERR 7 |
| 670 | #define BGP_NOTIFY_MAX 8 |
| 671 | |
Dmitrij Tejblum | 4b4e07d | 2011-09-21 23:13:22 +0400 | [diff] [blame] | 672 | #define BGP_NOTIFY_SUBCODE_UNSPECIFIC 0 |
| 673 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 674 | /* BGP_NOTIFY_HEADER_ERR sub codes. */ |
| 675 | #define BGP_NOTIFY_HEADER_NOT_SYNC 1 |
| 676 | #define BGP_NOTIFY_HEADER_BAD_MESLEN 2 |
| 677 | #define BGP_NOTIFY_HEADER_BAD_MESTYPE 3 |
| 678 | #define BGP_NOTIFY_HEADER_MAX 4 |
| 679 | |
| 680 | /* BGP_NOTIFY_OPEN_ERR sub codes. */ |
Paul Jakma | 68ec424 | 2015-11-25 17:14:34 +0000 | [diff] [blame] | 681 | #define BGP_NOTIFY_OPEN_UNSPECIFIC 0 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 682 | #define BGP_NOTIFY_OPEN_UNSUP_VERSION 1 |
| 683 | #define BGP_NOTIFY_OPEN_BAD_PEER_AS 2 |
| 684 | #define BGP_NOTIFY_OPEN_BAD_BGP_IDENT 3 |
| 685 | #define BGP_NOTIFY_OPEN_UNSUP_PARAM 4 |
| 686 | #define BGP_NOTIFY_OPEN_AUTH_FAILURE 5 |
| 687 | #define BGP_NOTIFY_OPEN_UNACEP_HOLDTIME 6 |
| 688 | #define BGP_NOTIFY_OPEN_UNSUP_CAPBL 7 |
| 689 | #define BGP_NOTIFY_OPEN_MAX 8 |
| 690 | |
| 691 | /* BGP_NOTIFY_UPDATE_ERR sub codes. */ |
| 692 | #define BGP_NOTIFY_UPDATE_MAL_ATTR 1 |
| 693 | #define BGP_NOTIFY_UPDATE_UNREC_ATTR 2 |
| 694 | #define BGP_NOTIFY_UPDATE_MISS_ATTR 3 |
| 695 | #define BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR 4 |
| 696 | #define BGP_NOTIFY_UPDATE_ATTR_LENG_ERR 5 |
| 697 | #define BGP_NOTIFY_UPDATE_INVAL_ORIGIN 6 |
| 698 | #define BGP_NOTIFY_UPDATE_AS_ROUTE_LOOP 7 |
| 699 | #define BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP 8 |
| 700 | #define BGP_NOTIFY_UPDATE_OPT_ATTR_ERR 9 |
| 701 | #define BGP_NOTIFY_UPDATE_INVAL_NETWORK 10 |
| 702 | #define BGP_NOTIFY_UPDATE_MAL_AS_PATH 11 |
| 703 | #define BGP_NOTIFY_UPDATE_MAX 12 |
| 704 | |
Dmitrij Tejblum | 4b4e07d | 2011-09-21 23:13:22 +0400 | [diff] [blame] | 705 | /* BGP_NOTIFY_CEASE sub codes (RFC 4486). */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 706 | #define BGP_NOTIFY_CEASE_MAX_PREFIX 1 |
| 707 | #define BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN 2 |
| 708 | #define BGP_NOTIFY_CEASE_PEER_UNCONFIG 3 |
| 709 | #define BGP_NOTIFY_CEASE_ADMIN_RESET 4 |
| 710 | #define BGP_NOTIFY_CEASE_CONNECT_REJECT 5 |
| 711 | #define BGP_NOTIFY_CEASE_CONFIG_CHANGE 6 |
paul | 545acaf | 2004-04-20 15:13:15 +0000 | [diff] [blame] | 712 | #define BGP_NOTIFY_CEASE_COLLISION_RESOLUTION 7 |
| 713 | #define BGP_NOTIFY_CEASE_OUT_OF_RESOURCE 8 |
| 714 | #define BGP_NOTIFY_CEASE_MAX 9 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 715 | |
| 716 | /* BGP_NOTIFY_CAPABILITY_ERR sub codes (draft-ietf-idr-dynamic-cap-02). */ |
| 717 | #define BGP_NOTIFY_CAPABILITY_INVALID_ACTION 1 |
| 718 | #define BGP_NOTIFY_CAPABILITY_INVALID_LENGTH 2 |
| 719 | #define BGP_NOTIFY_CAPABILITY_MALFORMED_CODE 3 |
| 720 | #define BGP_NOTIFY_CAPABILITY_MAX 4 |
| 721 | |
| 722 | /* BGP finite state machine status. */ |
| 723 | #define Idle 1 |
| 724 | #define Connect 2 |
| 725 | #define Active 3 |
| 726 | #define OpenSent 4 |
| 727 | #define OpenConfirm 5 |
| 728 | #define Established 6 |
Paul Jakma | ca058a3 | 2006-09-14 02:58:49 +0000 | [diff] [blame] | 729 | #define Clearing 7 |
| 730 | #define Deleted 8 |
| 731 | #define BGP_STATUS_MAX 9 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 732 | |
| 733 | /* BGP finite state machine events. */ |
| 734 | #define BGP_Start 1 |
| 735 | #define BGP_Stop 2 |
| 736 | #define TCP_connection_open 3 |
| 737 | #define TCP_connection_closed 4 |
| 738 | #define TCP_connection_open_failed 5 |
| 739 | #define TCP_fatal_error 6 |
| 740 | #define ConnectRetry_timer_expired 7 |
| 741 | #define Hold_Timer_expired 8 |
| 742 | #define KeepAlive_timer_expired 9 |
| 743 | #define Receive_OPEN_message 10 |
| 744 | #define Receive_KEEPALIVE_message 11 |
| 745 | #define Receive_UPDATE_message 12 |
| 746 | #define Receive_NOTIFICATION_message 13 |
Paul Jakma | ca058a3 | 2006-09-14 02:58:49 +0000 | [diff] [blame] | 747 | #define Clearing_Completed 14 |
| 748 | #define BGP_EVENTS_MAX 15 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 749 | |
| 750 | /* BGP timers default value. */ |
| 751 | #define BGP_INIT_START_TIMER 5 |
Paul Jakma | c0cb90c | 2016-03-08 18:14:50 +0000 | [diff] [blame] | 752 | #define BGP_DEFAULT_HOLDTIME 180 |
| 753 | #define BGP_DEFAULT_KEEPALIVE 60 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 754 | #define BGP_DEFAULT_EBGP_ROUTEADV 30 |
| 755 | #define BGP_DEFAULT_IBGP_ROUTEADV 5 |
| 756 | #define BGP_CLEAR_CONNECT_RETRY 20 |
Daniel Walton | f822ad4 | 2015-10-21 06:42:47 -0700 | [diff] [blame] | 757 | #define BGP_DEFAULT_CONNECT_RETRY 10 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 758 | |
| 759 | /* BGP default local preference. */ |
| 760 | #define BGP_DEFAULT_LOCAL_PREF 100 |
| 761 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 762 | /* BGP graceful restart */ |
| 763 | #define BGP_DEFAULT_RESTART_TIME 120 |
| 764 | #define BGP_DEFAULT_STALEPATH_TIME 360 |
| 765 | |
Denis Ovsienko | 42e6d74 | 2011-07-14 12:36:19 +0400 | [diff] [blame] | 766 | /* RFC4364 */ |
| 767 | #define SAFI_MPLS_LABELED_VPN 128 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 768 | |
| 769 | /* Max TTL value. */ |
| 770 | #define TTL_MAX 255 |
| 771 | |
| 772 | /* BGP uptime string length. */ |
| 773 | #define BGP_UPTIME_LEN 25 |
| 774 | |
| 775 | /* Default configuration settings for bgpd. */ |
| 776 | #define BGP_VTY_PORT 2605 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 777 | #define BGP_DEFAULT_CONFIG "bgpd.conf" |
| 778 | |
| 779 | /* Check AS path loop when we send NLRI. */ |
| 780 | /* #define BGP_SEND_ASPATH_CHECK */ |
| 781 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 782 | /* Flag for peer_clear_soft(). */ |
| 783 | enum bgp_clear_type |
| 784 | { |
| 785 | BGP_CLEAR_SOFT_NONE, |
| 786 | BGP_CLEAR_SOFT_OUT, |
| 787 | BGP_CLEAR_SOFT_IN, |
| 788 | BGP_CLEAR_SOFT_BOTH, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 789 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, |
| 790 | BGP_CLEAR_SOFT_RSCLIENT |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 791 | }; |
| 792 | |
| 793 | /* Macros. */ |
| 794 | #define BGP_INPUT(P) ((P)->ibuf) |
| 795 | #define BGP_INPUT_PNT(P) (STREAM_PNT(BGP_INPUT(P))) |
Vitaliy Senchyshyn | 6aa136f | 2013-10-02 10:40:20 +0000 | [diff] [blame] | 796 | #define BGP_IS_VALID_STATE_FOR_NOTIF(S)\ |
| 797 | (((S) == OpenSent) || ((S) == OpenConfirm) || ((S) == Established)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 798 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 799 | /* BGP error codes. */ |
| 800 | #define BGP_SUCCESS 0 |
| 801 | #define BGP_ERR_INVALID_VALUE -1 |
| 802 | #define BGP_ERR_INVALID_FLAG -2 |
| 803 | #define BGP_ERR_INVALID_AS -3 |
| 804 | #define BGP_ERR_INVALID_BGP -4 |
| 805 | #define BGP_ERR_PEER_GROUP_MEMBER -5 |
| 806 | #define BGP_ERR_MULTIPLE_INSTANCE_USED -6 |
| 807 | #define BGP_ERR_PEER_GROUP_MEMBER_EXISTS -7 |
| 808 | #define BGP_ERR_PEER_BELONGS_TO_GROUP -8 |
| 809 | #define BGP_ERR_PEER_GROUP_AF_UNCONFIGURED -9 |
| 810 | #define BGP_ERR_PEER_GROUP_NO_REMOTE_AS -10 |
| 811 | #define BGP_ERR_PEER_GROUP_CANT_CHANGE -11 |
| 812 | #define BGP_ERR_PEER_GROUP_MISMATCH -12 |
| 813 | #define BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT -13 |
| 814 | #define BGP_ERR_MULTIPLE_INSTANCE_NOT_SET -14 |
| 815 | #define BGP_ERR_AS_MISMATCH -15 |
| 816 | #define BGP_ERR_PEER_INACTIVE -16 |
| 817 | #define BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER -17 |
| 818 | #define BGP_ERR_PEER_GROUP_HAS_THE_FLAG -18 |
| 819 | #define BGP_ERR_PEER_FLAG_CONFLICT -19 |
| 820 | #define BGP_ERR_PEER_GROUP_SHUTDOWN -20 |
| 821 | #define BGP_ERR_PEER_FILTER_CONFLICT -21 |
| 822 | #define BGP_ERR_NOT_INTERNAL_PEER -22 |
| 823 | #define BGP_ERR_REMOVE_PRIVATE_AS -23 |
| 824 | #define BGP_ERR_AF_UNCONFIGURED -24 |
| 825 | #define BGP_ERR_SOFT_RECONFIG_UNCONFIGURED -25 |
| 826 | #define BGP_ERR_INSTANCE_MISMATCH -26 |
| 827 | #define BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP -27 |
| 828 | #define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS -28 |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 829 | #define BGP_ERR_TCPSIG_FAILED -29 |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 830 | #define BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK -30 |
Stephen Hemminger | f5a4827 | 2011-03-24 17:30:21 +0000 | [diff] [blame] | 831 | #define BGP_ERR_NO_IBGP_WITH_TTLHACK -31 |
| 832 | #define BGP_ERR_MAX -32 |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 833 | #define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS_REMOTE_AS -33 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 834 | |
| 835 | extern struct bgp_master *bm; |
| 836 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 837 | /* Prototypes. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 838 | extern void bgp_terminate (void); |
| 839 | extern void bgp_reset (void); |
Stephen Hemminger | 6595788 | 2010-01-15 16:22:10 +0300 | [diff] [blame] | 840 | extern time_t bgp_clock (void); |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 841 | extern void bgp_zclient_reset (void); |
| 842 | extern int bgp_nexthop_set (union sockunion *, union sockunion *, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 843 | struct bgp_nexthop *, struct peer *); |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 844 | extern struct bgp *bgp_get_default (void); |
| 845 | extern struct bgp *bgp_lookup (as_t, const char *); |
| 846 | extern struct bgp *bgp_lookup_by_name (const char *); |
| 847 | extern struct peer *peer_lookup (struct bgp *, union sockunion *); |
| 848 | extern struct peer_group *peer_group_lookup (struct bgp *, const char *); |
| 849 | extern struct peer_group *peer_group_get (struct bgp *, const char *); |
| 850 | extern struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 851 | int *); |
Donald Sharp | 104576d | 2015-09-16 13:17:55 -0400 | [diff] [blame] | 852 | |
| 853 | /* |
| 854 | * Peers are incredibly easy to memory leak |
| 855 | * due to the various ways that they are actually used |
| 856 | * Provide some functionality to debug locks and unlocks |
| 857 | */ |
| 858 | extern struct peer *peer_lock_with_caller(const char *, struct peer *); |
| 859 | extern struct peer *peer_unlock_with_caller(const char *, struct peer *); |
| 860 | #define peer_unlock(A) peer_unlock_with_caller(__FUNCTION__, (A)) |
| 861 | #define peer_lock(B) peer_lock_with_caller(__FUNCTION__, (B)) |
| 862 | |
Jorge Boncompte [DTI2] | 6d85b15 | 2012-05-07 16:52:54 +0000 | [diff] [blame] | 863 | extern bgp_peer_sort_t peer_sort (struct peer *peer); |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 864 | extern int peer_active (struct peer *); |
| 865 | extern int peer_active_nego (struct peer *); |
| 866 | extern struct peer *peer_create_accept (struct bgp *); |
| 867 | extern char *peer_uptime (time_t, char *, size_t); |
| 868 | extern int bgp_config_write (struct vty *); |
| 869 | extern void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *); |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 870 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 871 | extern void bgp_master_init (void); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 872 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 873 | extern void bgp_init (void); |
| 874 | extern void bgp_route_map_init (void); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 875 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 876 | extern int bgp_option_set (int); |
| 877 | extern int bgp_option_unset (int); |
| 878 | extern int bgp_option_check (int); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 879 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 880 | extern int bgp_get (struct bgp **, as_t *, const char *); |
| 881 | extern int bgp_delete (struct bgp *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 882 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 883 | extern int bgp_flag_set (struct bgp *, int); |
| 884 | extern int bgp_flag_unset (struct bgp *, int); |
| 885 | extern int bgp_flag_check (struct bgp *, int); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 886 | |
Stephen Hemminger | 0088b5d | 2009-05-21 08:51:03 -0700 | [diff] [blame] | 887 | extern void bgp_lock (struct bgp *); |
| 888 | extern void bgp_unlock (struct bgp *); |
| 889 | |
David Lamparter | 584083d | 2016-05-24 18:58:08 +0200 | [diff] [blame] | 890 | extern void bgp_router_id_zebra_bump (void); |
| 891 | extern int bgp_router_id_static_set (struct bgp *, struct in_addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 892 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 893 | extern int bgp_cluster_id_set (struct bgp *, struct in_addr *); |
| 894 | extern int bgp_cluster_id_unset (struct bgp *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 895 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 896 | extern int bgp_confederation_id_set (struct bgp *, as_t); |
| 897 | extern int bgp_confederation_id_unset (struct bgp *); |
| 898 | extern int bgp_confederation_peers_check (struct bgp *, as_t); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 899 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 900 | extern int bgp_confederation_peers_add (struct bgp *, as_t); |
| 901 | extern int bgp_confederation_peers_remove (struct bgp *, as_t); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 902 | |
David Lamparter | dfb9bd7 | 2016-05-24 18:58:07 +0200 | [diff] [blame] | 903 | extern int bgp_timers_set (struct bgp *, u_int32_t keepalive, u_int32_t holdtime); |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 904 | extern int bgp_timers_unset (struct bgp *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 905 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 906 | extern int bgp_default_local_preference_set (struct bgp *, u_int32_t); |
| 907 | extern int bgp_default_local_preference_unset (struct bgp *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 908 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 909 | extern int peer_rsclient_active (struct peer *); |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame] | 910 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 911 | extern int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t); |
| 912 | extern int peer_group_remote_as (struct bgp *, const char *, as_t *); |
| 913 | extern int peer_delete (struct peer *peer); |
| 914 | extern int peer_group_delete (struct peer_group *); |
| 915 | extern int peer_group_remote_as_delete (struct peer_group *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 916 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 917 | extern int peer_activate (struct peer *, afi_t, safi_t); |
| 918 | extern int peer_deactivate (struct peer *, afi_t, safi_t); |
David Lamparter | dfb9bd7 | 2016-05-24 18:58:07 +0200 | [diff] [blame] | 919 | extern int peer_afc_set (struct peer *, afi_t, safi_t, int); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 920 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 921 | extern int peer_group_bind (struct bgp *, union sockunion *, struct peer_group *, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 922 | afi_t, safi_t, as_t *); |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 923 | extern int peer_group_unbind (struct bgp *, struct peer *, struct peer_group *, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 924 | afi_t, safi_t); |
| 925 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 926 | extern int peer_flag_set (struct peer *, u_int32_t); |
| 927 | extern int peer_flag_unset (struct peer *, u_int32_t); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 928 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 929 | extern int peer_af_flag_set (struct peer *, afi_t, safi_t, u_int32_t); |
| 930 | extern int peer_af_flag_unset (struct peer *, afi_t, safi_t, u_int32_t); |
| 931 | extern int peer_af_flag_check (struct peer *, afi_t, safi_t, u_int32_t); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 932 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 933 | extern int peer_ebgp_multihop_set (struct peer *, int); |
| 934 | extern int peer_ebgp_multihop_unset (struct peer *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 935 | |
David Lamparter | dfb9bd7 | 2016-05-24 18:58:07 +0200 | [diff] [blame] | 936 | extern int peer_description_set (struct peer *, const char *); |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 937 | extern int peer_description_unset (struct peer *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 938 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 939 | extern int peer_update_source_if_set (struct peer *, const char *); |
David Lamparter | dfb9bd7 | 2016-05-24 18:58:07 +0200 | [diff] [blame] | 940 | extern int peer_update_source_addr_set (struct peer *, const union sockunion *); |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 941 | extern int peer_update_source_unset (struct peer *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 942 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 943 | extern int peer_default_originate_set (struct peer *, afi_t, safi_t, const char *); |
| 944 | extern int peer_default_originate_unset (struct peer *, afi_t, safi_t); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 945 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 946 | extern int peer_port_set (struct peer *, u_int16_t); |
| 947 | extern int peer_port_unset (struct peer *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 948 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 949 | extern int peer_weight_set (struct peer *, u_int16_t); |
| 950 | extern int peer_weight_unset (struct peer *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 951 | |
David Lamparter | dfb9bd7 | 2016-05-24 18:58:07 +0200 | [diff] [blame] | 952 | extern int peer_timers_set (struct peer *, u_int32_t keepalive, u_int32_t holdtime); |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 953 | extern int peer_timers_unset (struct peer *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 954 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 955 | extern int peer_timers_connect_set (struct peer *, u_int32_t); |
| 956 | extern int peer_timers_connect_unset (struct peer *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 957 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 958 | extern int peer_advertise_interval_set (struct peer *, u_int32_t); |
| 959 | extern int peer_advertise_interval_unset (struct peer *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 960 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 961 | extern int peer_interface_set (struct peer *, const char *); |
| 962 | extern int peer_interface_unset (struct peer *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 963 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 964 | extern int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *); |
| 965 | extern int peer_distribute_unset (struct peer *, afi_t, safi_t, int); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 966 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 967 | extern int peer_allowas_in_set (struct peer *, afi_t, safi_t, int); |
| 968 | extern int peer_allowas_in_unset (struct peer *, afi_t, safi_t); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 969 | |
Andrew Certain | 9d3f970 | 2012-11-07 23:50:07 +0000 | [diff] [blame] | 970 | extern int peer_local_as_set (struct peer *, as_t, int, int); |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 971 | extern int peer_local_as_unset (struct peer *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 972 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 973 | extern int peer_prefix_list_set (struct peer *, afi_t, safi_t, int, const char *); |
| 974 | extern int peer_prefix_list_unset (struct peer *, afi_t, safi_t, int); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 975 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 976 | extern int peer_aslist_set (struct peer *, afi_t, safi_t, int, const char *); |
| 977 | extern int peer_aslist_unset (struct peer *,afi_t, safi_t, int); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 978 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 979 | extern int peer_route_map_set (struct peer *, afi_t, safi_t, int, const char *); |
| 980 | extern int peer_route_map_unset (struct peer *, afi_t, safi_t, int); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 981 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 982 | extern int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, const char *); |
Paul Jakma | 0df7c91 | 2008-07-21 21:02:49 +0000 | [diff] [blame] | 983 | |
| 984 | extern int peer_password_set (struct peer *, const char *); |
| 985 | extern int peer_password_unset (struct peer *); |
| 986 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 987 | extern int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 988 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 989 | extern int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int, u_int16_t); |
| 990 | extern int peer_maximum_prefix_unset (struct peer *, afi_t, safi_t); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 991 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 992 | extern int peer_clear (struct peer *); |
| 993 | extern int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type); |
hasso | 93406d8 | 2005-02-02 14:40:33 +0000 | [diff] [blame] | 994 | |
Nick Hilliard | fa411a2 | 2011-03-23 15:33:17 +0000 | [diff] [blame] | 995 | extern int peer_ttl_security_hops_set (struct peer *, int); |
| 996 | extern int peer_ttl_security_hops_unset (struct peer *); |
| 997 | |
paul | 00d252c | 2005-05-23 14:19:54 +0000 | [diff] [blame] | 998 | #endif /* _QUAGGA_BGPD_H */ |