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 | |
| 21 | /* For union sockunion. */ |
| 22 | #include "sockunion.h" |
| 23 | |
| 24 | /* Typedef BGP specific types. */ |
| 25 | typedef u_int16_t as_t; |
| 26 | typedef u_int16_t bgp_size_t; |
| 27 | |
| 28 | /* BGP master for system wide configurations and variables. */ |
| 29 | struct bgp_master |
| 30 | { |
| 31 | /* BGP instance list. */ |
| 32 | struct list *bgp; |
| 33 | |
| 34 | /* BGP thread master. */ |
| 35 | struct thread_master *master; |
| 36 | |
| 37 | /* BGP port number. */ |
| 38 | u_int16_t port; |
| 39 | |
| 40 | /* BGP start time. */ |
| 41 | time_t start_time; |
| 42 | |
| 43 | /* Various BGP global configuration. */ |
| 44 | u_char options; |
| 45 | #define BGP_OPT_NO_FIB (1 << 0) |
| 46 | #define BGP_OPT_MULTIPLE_INSTANCE (1 << 1) |
| 47 | #define BGP_OPT_CONFIG_CISCO (1 << 2) |
| 48 | }; |
| 49 | |
| 50 | /* BGP instance structure. */ |
| 51 | struct bgp |
| 52 | { |
| 53 | /* AS number of this BGP instance. */ |
| 54 | as_t as; |
| 55 | |
| 56 | /* Name of this BGP instance. */ |
| 57 | char *name; |
| 58 | |
| 59 | /* Self peer. */ |
| 60 | struct peer *peer_self; |
| 61 | |
| 62 | /* BGP peer. */ |
| 63 | struct list *peer; |
| 64 | |
| 65 | /* BGP peer group. */ |
| 66 | struct list *group; |
| 67 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame^] | 68 | /* BGP route-server-clients. */ |
| 69 | struct list *rsclient; |
| 70 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 71 | /* BGP configuration. */ |
| 72 | u_int16_t config; |
| 73 | #define BGP_CONFIG_ROUTER_ID (1 << 0) |
| 74 | #define BGP_CONFIG_CLUSTER_ID (1 << 1) |
| 75 | #define BGP_CONFIG_CONFEDERATION (1 << 2) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 76 | |
| 77 | /* BGP router identifier. */ |
| 78 | struct in_addr router_id; |
| 79 | |
| 80 | /* BGP route reflector cluster ID. */ |
| 81 | struct in_addr cluster_id; |
| 82 | |
| 83 | /* BGP confederation information. */ |
| 84 | as_t confed_id; |
| 85 | as_t *confed_peers; |
| 86 | int confed_peers_cnt; |
| 87 | |
| 88 | /* BGP flags. */ |
| 89 | u_int16_t flags; |
| 90 | #define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0) |
| 91 | #define BGP_FLAG_DETERMINISTIC_MED (1 << 1) |
| 92 | #define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2) |
| 93 | #define BGP_FLAG_MED_CONFED (1 << 3) |
| 94 | #define BGP_FLAG_NO_DEFAULT_IPV4 (1 << 4) |
| 95 | #define BGP_FLAG_NO_CLIENT_TO_CLIENT (1 << 5) |
| 96 | #define BGP_FLAG_ENFORCE_FIRST_AS (1 << 6) |
| 97 | #define BGP_FLAG_COMPARE_ROUTER_ID (1 << 7) |
| 98 | #define BGP_FLAG_ASPATH_IGNORE (1 << 8) |
| 99 | #define BGP_FLAG_IMPORT_CHECK (1 << 9) |
| 100 | #define BGP_FLAG_NO_FAST_EXT_FAILOVER (1 << 10) |
paul | 848973c | 2003-08-13 00:32:49 +0000 | [diff] [blame] | 101 | #define BGP_FLAG_LOG_NEIGHBOR_CHANGES (1 << 11) |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 102 | #define BGP_FLAG_GRACEFUL_RESTART (1 << 12) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 103 | |
| 104 | /* BGP Per AF flags */ |
| 105 | u_int16_t af_flags[AFI_MAX][SAFI_MAX]; |
| 106 | #define BGP_CONFIG_DAMPENING (1 << 0) |
| 107 | |
| 108 | /* Static route configuration. */ |
| 109 | struct bgp_table *route[AFI_MAX][SAFI_MAX]; |
| 110 | |
| 111 | /* Aggregate address configuration. */ |
| 112 | struct bgp_table *aggregate[AFI_MAX][SAFI_MAX]; |
| 113 | |
| 114 | /* BGP routing information base. */ |
| 115 | struct bgp_table *rib[AFI_MAX][SAFI_MAX]; |
| 116 | |
| 117 | /* BGP redistribute configuration. */ |
| 118 | u_char redist[AFI_MAX][ZEBRA_ROUTE_MAX]; |
| 119 | |
| 120 | /* BGP redistribute metric configuration. */ |
| 121 | u_char redist_metric_flag[AFI_MAX][ZEBRA_ROUTE_MAX]; |
| 122 | u_int32_t redist_metric[AFI_MAX][ZEBRA_ROUTE_MAX]; |
| 123 | |
| 124 | /* BGP redistribute route-map. */ |
| 125 | struct |
| 126 | { |
| 127 | char *name; |
| 128 | struct route_map *map; |
| 129 | } rmap[AFI_MAX][ZEBRA_ROUTE_MAX]; |
| 130 | |
| 131 | /* BGP distance configuration. */ |
| 132 | u_char distance_ebgp; |
| 133 | u_char distance_ibgp; |
| 134 | u_char distance_local; |
| 135 | |
| 136 | /* BGP default local-preference. */ |
| 137 | u_int32_t default_local_pref; |
| 138 | |
| 139 | /* BGP default timer. */ |
| 140 | u_int32_t default_holdtime; |
| 141 | u_int32_t default_keepalive; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 142 | |
| 143 | /* BGP graceful restart */ |
| 144 | u_int16_t restart_time; |
| 145 | u_int16_t stalepath_time; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 146 | }; |
| 147 | |
| 148 | /* BGP peer-group support. */ |
| 149 | struct peer_group |
| 150 | { |
| 151 | /* Name of the peer-group. */ |
| 152 | char *name; |
| 153 | |
| 154 | /* Pointer to BGP. */ |
| 155 | struct bgp *bgp; |
| 156 | |
| 157 | /* Peer-group client list. */ |
| 158 | struct list *peer; |
| 159 | |
| 160 | /* Peer-group config */ |
| 161 | struct peer *conf; |
| 162 | }; |
| 163 | |
| 164 | /* BGP Notify message format. */ |
| 165 | struct bgp_notify |
| 166 | { |
| 167 | u_char code; |
| 168 | u_char subcode; |
| 169 | char *data; |
| 170 | bgp_size_t length; |
| 171 | }; |
| 172 | |
| 173 | /* Next hop self address. */ |
| 174 | struct bgp_nexthop |
| 175 | { |
| 176 | struct interface *ifp; |
| 177 | struct in_addr v4; |
| 178 | #ifdef HAVE_IPV6 |
| 179 | struct in6_addr v6_global; |
| 180 | struct in6_addr v6_local; |
| 181 | #endif /* HAVE_IPV6 */ |
| 182 | }; |
| 183 | |
| 184 | /* BGP router distinguisher value. */ |
| 185 | #define BGP_RD_SIZE 8 |
| 186 | |
| 187 | struct bgp_rd |
| 188 | { |
| 189 | u_char val[BGP_RD_SIZE]; |
| 190 | }; |
| 191 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame^] | 192 | #define RMAP_IN 0 |
| 193 | #define RMAP_OUT 1 |
| 194 | #define RMAP_IMPORT 2 |
| 195 | #define RMAP_EXPORT 3 |
| 196 | #define RMAP_MAX 4 |
| 197 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 198 | /* BGP filter structure. */ |
| 199 | struct bgp_filter |
| 200 | { |
| 201 | /* Distribute-list. */ |
| 202 | struct |
| 203 | { |
| 204 | char *name; |
| 205 | struct access_list *alist; |
| 206 | } dlist[FILTER_MAX]; |
| 207 | |
| 208 | /* Prefix-list. */ |
| 209 | struct |
| 210 | { |
| 211 | char *name; |
| 212 | struct prefix_list *plist; |
| 213 | } plist[FILTER_MAX]; |
| 214 | |
| 215 | /* Filter-list. */ |
| 216 | struct |
| 217 | { |
| 218 | char *name; |
| 219 | struct as_list *aslist; |
| 220 | } aslist[FILTER_MAX]; |
| 221 | |
| 222 | /* Route-map. */ |
| 223 | struct |
| 224 | { |
| 225 | char *name; |
| 226 | struct route_map *map; |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame^] | 227 | } map[RMAP_MAX]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 228 | |
| 229 | /* Unsuppress-map. */ |
| 230 | struct |
| 231 | { |
| 232 | char *name; |
| 233 | struct route_map *map; |
| 234 | } usmap; |
| 235 | }; |
| 236 | |
| 237 | /* BGP neighbor structure. */ |
| 238 | struct peer |
| 239 | { |
| 240 | /* BGP structure. */ |
| 241 | struct bgp *bgp; |
| 242 | |
| 243 | /* BGP peer group. */ |
| 244 | struct peer_group *group; |
| 245 | u_char af_group[AFI_MAX][SAFI_MAX]; |
| 246 | |
| 247 | /* Peer's remote AS number. */ |
| 248 | as_t as; |
| 249 | |
| 250 | /* Peer's local AS number. */ |
| 251 | as_t local_as; |
| 252 | |
| 253 | /* Peer's Change local AS number. */ |
| 254 | as_t change_local_as; |
| 255 | |
| 256 | /* Remote router ID. */ |
| 257 | struct in_addr remote_id; |
| 258 | |
| 259 | /* Local router ID. */ |
| 260 | struct in_addr local_id; |
| 261 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame^] | 262 | /* Peer specific RIB when configured as route-server-client. */ |
| 263 | struct bgp_table *rib[AFI_MAX][SAFI_MAX]; |
| 264 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 265 | /* Packet receive and send buffer. */ |
| 266 | struct stream *ibuf; |
| 267 | struct stream_fifo *obuf; |
| 268 | struct stream *work; |
| 269 | |
| 270 | /* Status of the peer. */ |
| 271 | int status; |
| 272 | int ostatus; |
| 273 | |
| 274 | /* Peer information */ |
paul | eb82118 | 2004-05-01 08:44:08 +0000 | [diff] [blame] | 275 | int fd; /* File descriptor */ |
| 276 | int ttl; /* TTL of TCP connection to the peer. */ |
| 277 | char *desc; /* Description of the peer. */ |
| 278 | unsigned short port; /* Destination port for peer */ |
| 279 | char *host; /* Printable address of the peer. */ |
| 280 | union sockunion su; /* Sockunion address of the peer. */ |
| 281 | time_t uptime; /* Last Up/Down time */ |
| 282 | time_t readtime; /* Last read time */ |
| 283 | time_t resettime; /* Last reset time */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 284 | |
paul | eb82118 | 2004-05-01 08:44:08 +0000 | [diff] [blame] | 285 | unsigned int ifindex; /* ifindex of the BGP connection. */ |
| 286 | char *ifname; /* bind interface name. */ |
| 287 | char *update_if; |
| 288 | union sockunion *update_source; |
| 289 | struct zlog *log; |
| 290 | u_char version; /* Peer BGP version. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 291 | |
paul | eb82118 | 2004-05-01 08:44:08 +0000 | [diff] [blame] | 292 | union sockunion *su_local; /* Sockunion of local address. */ |
| 293 | union sockunion *su_remote; /* Sockunion of remote address. */ |
| 294 | int shared_network; /* Is this peer shared same network. */ |
| 295 | struct bgp_nexthop nexthop; /* Nexthop */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 296 | |
| 297 | /* Peer address family configuration. */ |
| 298 | u_char afc[AFI_MAX][SAFI_MAX]; |
| 299 | u_char afc_nego[AFI_MAX][SAFI_MAX]; |
| 300 | u_char afc_adv[AFI_MAX][SAFI_MAX]; |
| 301 | u_char afc_recv[AFI_MAX][SAFI_MAX]; |
| 302 | |
| 303 | /* Capability Flags.*/ |
| 304 | u_char cap; |
| 305 | #define PEER_CAP_REFRESH_ADV (1 << 0) /* refresh advertised */ |
| 306 | #define PEER_CAP_REFRESH_OLD_RCV (1 << 1) /* refresh old received */ |
| 307 | #define PEER_CAP_REFRESH_NEW_RCV (1 << 2) /* refresh rfc received */ |
| 308 | #define PEER_CAP_DYNAMIC_ADV (1 << 3) /* dynamic advertised */ |
| 309 | #define PEER_CAP_DYNAMIC_RCV (1 << 4) /* dynamic received */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 310 | #define PEER_CAP_RESTART_ADV (1 << 5) /* restart advertised */ |
| 311 | #define PEER_CAP_RESTART_RCV (1 << 6) /* restart received */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 312 | |
| 313 | /* Capability Flags.*/ |
| 314 | u_int16_t af_cap[AFI_MAX][SAFI_MAX]; |
| 315 | #define PEER_CAP_ORF_PREFIX_SM_ADV (1 << 0) /* send-mode advertised */ |
| 316 | #define PEER_CAP_ORF_PREFIX_RM_ADV (1 << 1) /* receive-mode advertised */ |
| 317 | #define PEER_CAP_ORF_PREFIX_SM_RCV (1 << 2) /* send-mode received */ |
| 318 | #define PEER_CAP_ORF_PREFIX_RM_RCV (1 << 3) /* receive-mode received */ |
| 319 | #define PEER_CAP_ORF_PREFIX_SM_OLD_RCV (1 << 4) /* send-mode received */ |
| 320 | #define PEER_CAP_ORF_PREFIX_RM_OLD_RCV (1 << 5) /* receive-mode received */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 321 | #define PEER_CAP_RESTART_AF_RCV (1 << 6) /* graceful restart received */ |
| 322 | |
| 323 | /* Gracefull Restart */ |
| 324 | u_int16_t restart_time_rcv; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 325 | |
| 326 | /* Global configuration flags. */ |
| 327 | u_int32_t flags; |
| 328 | #define PEER_FLAG_PASSIVE (1 << 0) /* passive mode */ |
| 329 | #define PEER_FLAG_SHUTDOWN (1 << 1) /* shutdown */ |
| 330 | #define PEER_FLAG_DONT_CAPABILITY (1 << 2) /* dont-capability */ |
| 331 | #define PEER_FLAG_OVERRIDE_CAPABILITY (1 << 3) /* override-capability */ |
| 332 | #define PEER_FLAG_STRICT_CAP_MATCH (1 << 4) /* strict-match */ |
| 333 | #define PEER_FLAG_NO_ROUTE_REFRESH_CAP (1 << 5) /* route-refresh */ |
| 334 | #define PEER_FLAG_DYNAMIC_CAPABILITY (1 << 6) /* dynamic capability */ |
| 335 | #define PEER_FLAG_ENFORCE_MULTIHOP (1 << 7) /* enforce-multihop */ |
| 336 | #define PEER_FLAG_LOCAL_AS_NO_PREPEND (1 << 8) /* local-as no-prepend */ |
| 337 | |
| 338 | /* Per AF configuration flags. */ |
| 339 | u_int32_t af_flags[AFI_MAX][SAFI_MAX]; |
| 340 | #define PEER_FLAG_SEND_COMMUNITY (1 << 0) /* send-community */ |
| 341 | #define PEER_FLAG_SEND_EXT_COMMUNITY (1 << 1) /* send-community ext. */ |
| 342 | #define PEER_FLAG_NEXTHOP_SELF (1 << 2) /* next-hop-self */ |
| 343 | #define PEER_FLAG_REFLECTOR_CLIENT (1 << 3) /* reflector-client */ |
| 344 | #define PEER_FLAG_RSERVER_CLIENT (1 << 4) /* route-server-client */ |
| 345 | #define PEER_FLAG_SOFT_RECONFIG (1 << 5) /* soft-reconfiguration */ |
| 346 | #define PEER_FLAG_AS_PATH_UNCHANGED (1 << 6) /* transparent-as */ |
| 347 | #define PEER_FLAG_NEXTHOP_UNCHANGED (1 << 7) /* transparent-next-hop */ |
| 348 | #define PEER_FLAG_MED_UNCHANGED (1 << 8) /* transparent-next-hop */ |
| 349 | #define PEER_FLAG_DEFAULT_ORIGINATE (1 << 9) /* default-originate */ |
| 350 | #define PEER_FLAG_REMOVE_PRIVATE_AS (1 << 10) /* remove-private-as */ |
| 351 | #define PEER_FLAG_ALLOWAS_IN (1 << 11) /* set allowas-in */ |
| 352 | #define PEER_FLAG_ORF_PREFIX_SM (1 << 12) /* orf capability send-mode */ |
| 353 | #define PEER_FLAG_ORF_PREFIX_RM (1 << 13) /* orf capability receive-mode */ |
| 354 | #define PEER_FLAG_MAX_PREFIX (1 << 14) /* maximum prefix */ |
| 355 | #define PEER_FLAG_MAX_PREFIX_WARNING (1 << 15) /* maximum prefix warning-only */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame^] | 356 | #define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1 << 16) /* leave link-local nexthop unchanged */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 357 | |
| 358 | /* default-originate route-map. */ |
| 359 | struct |
| 360 | { |
| 361 | char *name; |
| 362 | struct route_map *map; |
| 363 | } default_rmap[AFI_MAX][SAFI_MAX]; |
| 364 | |
| 365 | /* Peer status flags. */ |
| 366 | u_int16_t sflags; |
| 367 | #define PEER_STATUS_ACCEPT_PEER (1 << 0) /* accept peer */ |
| 368 | #define PEER_STATUS_PREFIX_OVERFLOW (1 << 1) /* prefix-overflow */ |
| 369 | #define PEER_STATUS_CAPABILITY_OPEN (1 << 2) /* capability open send */ |
| 370 | #define PEER_STATUS_HAVE_ACCEPT (1 << 3) /* accept peer's parent */ |
| 371 | #define PEER_STATUS_GROUP (1 << 4) /* peer-group conf */ |
| 372 | |
| 373 | /* Peer status af flags. */ |
| 374 | u_int16_t af_sflags[AFI_MAX][SAFI_MAX]; |
| 375 | #define PEER_STATUS_ORF_PREFIX_SEND (1 << 0) /* prefix-list send peer */ |
| 376 | #define PEER_STATUS_ORF_WAIT_REFRESH (1 << 1) /* wait refresh received peer */ |
| 377 | #define PEER_STATUS_DEFAULT_ORIGINATE (1 << 2) /* default-originate peer */ |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 378 | #define PEER_STATUS_PREFIX_THRESHOLD (1 << 3) /* exceed prefix-threshold */ |
| 379 | #define PEER_STATUS_PREFIX_LIMIT (1 << 4) /* exceed prefix-limit */ |
| 380 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 381 | |
| 382 | /* Default attribute value for the peer. */ |
| 383 | u_int32_t config; |
| 384 | #define PEER_CONFIG_WEIGHT (1 << 0) /* Default weight. */ |
| 385 | #define PEER_CONFIG_TIMER (1 << 1) /* keepalive & holdtime */ |
| 386 | #define PEER_CONFIG_CONNECT (1 << 2) /* connect */ |
| 387 | #define PEER_CONFIG_ROUTEADV (1 << 3) /* route advertise */ |
| 388 | u_int32_t weight; |
| 389 | u_int32_t holdtime; |
| 390 | u_int32_t keepalive; |
| 391 | u_int32_t connect; |
| 392 | u_int32_t routeadv; |
| 393 | |
| 394 | /* Timer values. */ |
| 395 | u_int32_t v_start; |
| 396 | u_int32_t v_connect; |
| 397 | u_int32_t v_holdtime; |
| 398 | u_int32_t v_keepalive; |
| 399 | u_int32_t v_asorig; |
| 400 | u_int32_t v_routeadv; |
| 401 | |
| 402 | /* Threads. */ |
| 403 | struct thread *t_read; |
| 404 | struct thread *t_write; |
| 405 | struct thread *t_start; |
| 406 | struct thread *t_connect; |
| 407 | struct thread *t_holdtime; |
| 408 | struct thread *t_keepalive; |
| 409 | struct thread *t_asorig; |
| 410 | struct thread *t_routeadv; |
| 411 | |
| 412 | /* Statistics field */ |
| 413 | u_int32_t open_in; /* Open message input count */ |
| 414 | u_int32_t open_out; /* Open message output count */ |
| 415 | u_int32_t update_in; /* Update message input count */ |
| 416 | u_int32_t update_out; /* Update message ouput count */ |
| 417 | time_t update_time; /* Update message received time. */ |
| 418 | u_int32_t keepalive_in; /* Keepalive input count */ |
| 419 | u_int32_t keepalive_out; /* Keepalive output count */ |
| 420 | u_int32_t notify_in; /* Notify input count */ |
| 421 | u_int32_t notify_out; /* Notify output count */ |
| 422 | u_int32_t refresh_in; /* Route Refresh input count */ |
| 423 | u_int32_t refresh_out; /* Route Refresh output count */ |
| 424 | u_int32_t dynamic_cap_in; /* Dynamic Capability input count. */ |
| 425 | u_int32_t dynamic_cap_out; /* Dynamic Capability output count. */ |
| 426 | |
| 427 | /* BGP state count */ |
| 428 | u_int32_t established; /* Established */ |
| 429 | u_int32_t dropped; /* Dropped */ |
| 430 | |
| 431 | /* Syncronization list and time. */ |
| 432 | struct bgp_synchronize *sync[AFI_MAX][SAFI_MAX]; |
| 433 | time_t synctime; |
| 434 | |
| 435 | /* Send prefix count. */ |
| 436 | unsigned long scount[AFI_MAX][SAFI_MAX]; |
| 437 | |
| 438 | /* Announcement attribute hash. */ |
| 439 | struct hash *hash[AFI_MAX][SAFI_MAX]; |
| 440 | |
| 441 | /* Notify data. */ |
| 442 | struct bgp_notify notify; |
| 443 | |
| 444 | /* Whole packet size to be read. */ |
| 445 | unsigned long packet_size; |
| 446 | |
| 447 | /* Filter structure. */ |
| 448 | struct bgp_filter filter[AFI_MAX][SAFI_MAX]; |
| 449 | |
| 450 | /* ORF Prefix-list */ |
| 451 | struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX]; |
| 452 | |
| 453 | /* Prefix count. */ |
| 454 | unsigned long pcount[AFI_MAX][SAFI_MAX]; |
| 455 | |
| 456 | /* Max prefix count. */ |
| 457 | unsigned long pmax[AFI_MAX][SAFI_MAX]; |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 458 | u_char pmax_threshold[AFI_MAX][SAFI_MAX]; |
| 459 | #define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 460 | |
| 461 | /* allowas-in. */ |
| 462 | char allowas_in[AFI_MAX][SAFI_MAX]; |
paul | ac41b2a | 2003-08-12 05:32:27 +0000 | [diff] [blame] | 463 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 464 | /* peer reset cause */ |
| 465 | char last_reset; |
| 466 | #define PEER_DOWN_RID_CHANGE 1 /* bgp router-id command */ |
| 467 | #define PEER_DOWN_REMOTE_AS_CHANGE 2 /* neighbor remote-as command */ |
| 468 | #define PEER_DOWN_LOCAL_AS_CHANGE 3 /* neighbor local-as command */ |
| 469 | #define PEER_DOWN_CLID_CHANGE 4 /* bgp cluster-id command */ |
| 470 | #define PEER_DOWN_CONFED_ID_CHANGE 5 /* bgp confederation identifier command */ |
| 471 | #define PEER_DOWN_CONFED_PEER_CHANGE 6 /* bgp confederation peer command */ |
| 472 | #define PEER_DOWN_RR_CLIENT_CHANGE 7 /* neighbor route-reflector-client command */ |
| 473 | #define PEER_DOWN_RS_CLIENT_CHANGE 8 /* neighbor route-server-client command */ |
| 474 | #define PEER_DOWN_UPDATE_SOURCE_CHANGE 9 /* neighbor update-source command */ |
| 475 | #define PEER_DOWN_AF_ACTIVATE 10 /* neighbor activate command */ |
| 476 | #define PEER_DOWN_USER_SHUTDOWN 11 /* neighbor shutdown command */ |
| 477 | #define PEER_DOWN_USER_RESET 12 /* clear ip bgp command */ |
| 478 | #define PEER_DOWN_NOTIFY_RECEIVED 13 /* notification received */ |
| 479 | #define PEER_DOWN_NOTIFY_SEND 14 /* notification send */ |
| 480 | #define PEER_DOWN_CLOSE_SESSION 15 /* tcp session close */ |
| 481 | #define PEER_DOWN_NEIGHBOR_DELETE 16 /* neghbor delete */ |
| 482 | #define PEER_DOWN_RMAP_BIND 17 /* neghbor peer-group command */ |
| 483 | #define PEER_DOWN_RMAP_UNBIND 18 /* no neighbor peer-group command */ |
| 484 | #define PEER_DOWN_CAPABILITY_CHANGE 19 /* neighbor capability command */ |
| 485 | #define PEER_DOWN_PASSIVE_CHANGE 20 /* neighbor passive command */ |
| 486 | #define PEER_DOWN_MULTIHOP_CHANGE 21 /* neighbor multihop command */ |
| 487 | |
paul | ac41b2a | 2003-08-12 05:32:27 +0000 | [diff] [blame] | 488 | /* The kind of route-map Flags.*/ |
| 489 | u_char rmap_type; |
| 490 | #define PEER_RMAP_TYPE_IN (1 << 0) /* neighbor route-map in */ |
| 491 | #define PEER_RMAP_TYPE_OUT (1 << 1) /* neighbor route-map out */ |
| 492 | #define PEER_RMAP_TYPE_NETWORK (1 << 2) /* network route-map */ |
| 493 | #define PEER_RMAP_TYPE_REDISTRIBUTE (1 << 3) /* redistribute route-map */ |
| 494 | #define PEER_RMAP_TYPE_DEFAULT (1 << 4) /* default-originate route-map */ |
| 495 | #define PEER_RMAP_TYPE_NOSET (1 << 5) /* not allow to set commands */ |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame^] | 496 | #define PEER_RMAP_TYPE_IMPORT (1 << 6) /* neighbor route-map import */ |
| 497 | #define PEER_RMAP_TYPE_EXPORT (1 << 7) /* neighbor route-map export */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 498 | }; |
| 499 | |
| 500 | /* This structure's member directly points incoming packet data |
| 501 | stream. */ |
| 502 | struct bgp_nlri |
| 503 | { |
| 504 | /* AFI. */ |
| 505 | afi_t afi; |
| 506 | |
| 507 | /* SAFI. */ |
| 508 | safi_t safi; |
| 509 | |
| 510 | /* Pointer to NLRI byte stream. */ |
| 511 | u_char *nlri; |
| 512 | |
| 513 | /* Length of whole NLRI. */ |
| 514 | bgp_size_t length; |
| 515 | }; |
| 516 | |
| 517 | /* BGP versions. */ |
| 518 | #define BGP_VERSION_4 4 |
| 519 | #define BGP_VERSION_MP_4_DRAFT_00 40 |
| 520 | |
| 521 | /* Default BGP port number. */ |
| 522 | #define BGP_PORT_DEFAULT 179 |
| 523 | |
| 524 | /* BGP message header and packet size. */ |
| 525 | #define BGP_MARKER_SIZE 16 |
| 526 | #define BGP_HEADER_SIZE 19 |
| 527 | #define BGP_MAX_PACKET_SIZE 4096 |
| 528 | |
| 529 | /* BGP minimum message size. */ |
| 530 | #define BGP_MSG_OPEN_MIN_SIZE (BGP_HEADER_SIZE + 10) |
| 531 | #define BGP_MSG_UPDATE_MIN_SIZE (BGP_HEADER_SIZE + 4) |
| 532 | #define BGP_MSG_NOTIFY_MIN_SIZE (BGP_HEADER_SIZE + 2) |
| 533 | #define BGP_MSG_KEEPALIVE_MIN_SIZE (BGP_HEADER_SIZE + 0) |
| 534 | #define BGP_MSG_ROUTE_REFRESH_MIN_SIZE (BGP_HEADER_SIZE + 4) |
| 535 | #define BGP_MSG_CAPABILITY_MIN_SIZE (BGP_HEADER_SIZE + 3) |
| 536 | |
| 537 | /* BGP message types. */ |
| 538 | #define BGP_MSG_OPEN 1 |
| 539 | #define BGP_MSG_UPDATE 2 |
| 540 | #define BGP_MSG_NOTIFY 3 |
| 541 | #define BGP_MSG_KEEPALIVE 4 |
| 542 | #define BGP_MSG_ROUTE_REFRESH_NEW 5 |
| 543 | #define BGP_MSG_CAPABILITY 6 |
| 544 | #define BGP_MSG_ROUTE_REFRESH_OLD 128 |
| 545 | |
| 546 | /* BGP open optional parameter. */ |
| 547 | #define BGP_OPEN_OPT_AUTH 1 |
| 548 | #define BGP_OPEN_OPT_CAP 2 |
| 549 | |
| 550 | /* BGP4 attribute type codes. */ |
| 551 | #define BGP_ATTR_ORIGIN 1 |
| 552 | #define BGP_ATTR_AS_PATH 2 |
| 553 | #define BGP_ATTR_NEXT_HOP 3 |
| 554 | #define BGP_ATTR_MULTI_EXIT_DISC 4 |
| 555 | #define BGP_ATTR_LOCAL_PREF 5 |
| 556 | #define BGP_ATTR_ATOMIC_AGGREGATE 6 |
| 557 | #define BGP_ATTR_AGGREGATOR 7 |
| 558 | #define BGP_ATTR_COMMUNITIES 8 |
| 559 | #define BGP_ATTR_ORIGINATOR_ID 9 |
| 560 | #define BGP_ATTR_CLUSTER_LIST 10 |
| 561 | #define BGP_ATTR_DPA 11 |
| 562 | #define BGP_ATTR_ADVERTISER 12 |
| 563 | #define BGP_ATTR_RCID_PATH 13 |
| 564 | #define BGP_ATTR_MP_REACH_NLRI 14 |
| 565 | #define BGP_ATTR_MP_UNREACH_NLRI 15 |
| 566 | #define BGP_ATTR_EXT_COMMUNITIES 16 |
| 567 | |
| 568 | /* BGP update origin. */ |
| 569 | #define BGP_ORIGIN_IGP 0 |
| 570 | #define BGP_ORIGIN_EGP 1 |
| 571 | #define BGP_ORIGIN_INCOMPLETE 2 |
| 572 | |
| 573 | /* BGP notify message codes. */ |
| 574 | #define BGP_NOTIFY_HEADER_ERR 1 |
| 575 | #define BGP_NOTIFY_OPEN_ERR 2 |
| 576 | #define BGP_NOTIFY_UPDATE_ERR 3 |
| 577 | #define BGP_NOTIFY_HOLD_ERR 4 |
| 578 | #define BGP_NOTIFY_FSM_ERR 5 |
| 579 | #define BGP_NOTIFY_CEASE 6 |
| 580 | #define BGP_NOTIFY_CAPABILITY_ERR 7 |
| 581 | #define BGP_NOTIFY_MAX 8 |
| 582 | |
| 583 | /* BGP_NOTIFY_HEADER_ERR sub codes. */ |
| 584 | #define BGP_NOTIFY_HEADER_NOT_SYNC 1 |
| 585 | #define BGP_NOTIFY_HEADER_BAD_MESLEN 2 |
| 586 | #define BGP_NOTIFY_HEADER_BAD_MESTYPE 3 |
| 587 | #define BGP_NOTIFY_HEADER_MAX 4 |
| 588 | |
| 589 | /* BGP_NOTIFY_OPEN_ERR sub codes. */ |
| 590 | #define BGP_NOTIFY_OPEN_UNSUP_VERSION 1 |
| 591 | #define BGP_NOTIFY_OPEN_BAD_PEER_AS 2 |
| 592 | #define BGP_NOTIFY_OPEN_BAD_BGP_IDENT 3 |
| 593 | #define BGP_NOTIFY_OPEN_UNSUP_PARAM 4 |
| 594 | #define BGP_NOTIFY_OPEN_AUTH_FAILURE 5 |
| 595 | #define BGP_NOTIFY_OPEN_UNACEP_HOLDTIME 6 |
| 596 | #define BGP_NOTIFY_OPEN_UNSUP_CAPBL 7 |
| 597 | #define BGP_NOTIFY_OPEN_MAX 8 |
| 598 | |
| 599 | /* BGP_NOTIFY_UPDATE_ERR sub codes. */ |
| 600 | #define BGP_NOTIFY_UPDATE_MAL_ATTR 1 |
| 601 | #define BGP_NOTIFY_UPDATE_UNREC_ATTR 2 |
| 602 | #define BGP_NOTIFY_UPDATE_MISS_ATTR 3 |
| 603 | #define BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR 4 |
| 604 | #define BGP_NOTIFY_UPDATE_ATTR_LENG_ERR 5 |
| 605 | #define BGP_NOTIFY_UPDATE_INVAL_ORIGIN 6 |
| 606 | #define BGP_NOTIFY_UPDATE_AS_ROUTE_LOOP 7 |
| 607 | #define BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP 8 |
| 608 | #define BGP_NOTIFY_UPDATE_OPT_ATTR_ERR 9 |
| 609 | #define BGP_NOTIFY_UPDATE_INVAL_NETWORK 10 |
| 610 | #define BGP_NOTIFY_UPDATE_MAL_AS_PATH 11 |
| 611 | #define BGP_NOTIFY_UPDATE_MAX 12 |
| 612 | |
paul | 545acaf | 2004-04-20 15:13:15 +0000 | [diff] [blame] | 613 | /* BGP_NOTIFY_CEASE sub codes (draft-ietf-idr-cease-subcode-05). */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 614 | #define BGP_NOTIFY_CEASE_MAX_PREFIX 1 |
| 615 | #define BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN 2 |
| 616 | #define BGP_NOTIFY_CEASE_PEER_UNCONFIG 3 |
| 617 | #define BGP_NOTIFY_CEASE_ADMIN_RESET 4 |
| 618 | #define BGP_NOTIFY_CEASE_CONNECT_REJECT 5 |
| 619 | #define BGP_NOTIFY_CEASE_CONFIG_CHANGE 6 |
paul | 545acaf | 2004-04-20 15:13:15 +0000 | [diff] [blame] | 620 | #define BGP_NOTIFY_CEASE_COLLISION_RESOLUTION 7 |
| 621 | #define BGP_NOTIFY_CEASE_OUT_OF_RESOURCE 8 |
| 622 | #define BGP_NOTIFY_CEASE_MAX 9 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 623 | |
| 624 | /* BGP_NOTIFY_CAPABILITY_ERR sub codes (draft-ietf-idr-dynamic-cap-02). */ |
| 625 | #define BGP_NOTIFY_CAPABILITY_INVALID_ACTION 1 |
| 626 | #define BGP_NOTIFY_CAPABILITY_INVALID_LENGTH 2 |
| 627 | #define BGP_NOTIFY_CAPABILITY_MALFORMED_CODE 3 |
| 628 | #define BGP_NOTIFY_CAPABILITY_MAX 4 |
| 629 | |
| 630 | /* BGP finite state machine status. */ |
| 631 | #define Idle 1 |
| 632 | #define Connect 2 |
| 633 | #define Active 3 |
| 634 | #define OpenSent 4 |
| 635 | #define OpenConfirm 5 |
| 636 | #define Established 6 |
| 637 | #define BGP_STATUS_MAX 7 |
| 638 | |
| 639 | /* BGP finite state machine events. */ |
| 640 | #define BGP_Start 1 |
| 641 | #define BGP_Stop 2 |
| 642 | #define TCP_connection_open 3 |
| 643 | #define TCP_connection_closed 4 |
| 644 | #define TCP_connection_open_failed 5 |
| 645 | #define TCP_fatal_error 6 |
| 646 | #define ConnectRetry_timer_expired 7 |
| 647 | #define Hold_Timer_expired 8 |
| 648 | #define KeepAlive_timer_expired 9 |
| 649 | #define Receive_OPEN_message 10 |
| 650 | #define Receive_KEEPALIVE_message 11 |
| 651 | #define Receive_UPDATE_message 12 |
| 652 | #define Receive_NOTIFICATION_message 13 |
| 653 | #define BGP_EVENTS_MAX 14 |
| 654 | |
| 655 | /* BGP timers default value. */ |
| 656 | #define BGP_INIT_START_TIMER 5 |
| 657 | #define BGP_ERROR_START_TIMER 30 |
| 658 | #define BGP_DEFAULT_HOLDTIME 180 |
| 659 | #define BGP_DEFAULT_KEEPALIVE 60 |
| 660 | #define BGP_DEFAULT_ASORIGINATE 15 |
| 661 | #define BGP_DEFAULT_EBGP_ROUTEADV 30 |
| 662 | #define BGP_DEFAULT_IBGP_ROUTEADV 5 |
| 663 | #define BGP_CLEAR_CONNECT_RETRY 20 |
| 664 | #define BGP_DEFAULT_CONNECT_RETRY 120 |
| 665 | |
| 666 | /* BGP default local preference. */ |
| 667 | #define BGP_DEFAULT_LOCAL_PREF 100 |
| 668 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 669 | /* BGP graceful restart */ |
| 670 | #define BGP_DEFAULT_RESTART_TIME 120 |
| 671 | #define BGP_DEFAULT_STALEPATH_TIME 360 |
| 672 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 673 | /* SAFI which used in open capability negotiation. */ |
| 674 | #define BGP_SAFI_VPNV4 128 |
| 675 | #define BGP_SAFI_VPNV6 129 |
| 676 | |
| 677 | /* Max TTL value. */ |
| 678 | #define TTL_MAX 255 |
| 679 | |
| 680 | /* BGP uptime string length. */ |
| 681 | #define BGP_UPTIME_LEN 25 |
| 682 | |
| 683 | /* Default configuration settings for bgpd. */ |
| 684 | #define BGP_VTY_PORT 2605 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 685 | #define BGP_DEFAULT_CONFIG "bgpd.conf" |
| 686 | |
| 687 | /* Check AS path loop when we send NLRI. */ |
| 688 | /* #define BGP_SEND_ASPATH_CHECK */ |
| 689 | |
| 690 | /* IBGP/EBGP identifier. We also have a CONFED peer, which is to say, |
| 691 | a peer who's AS is part of our Confederation. */ |
| 692 | enum |
| 693 | { |
| 694 | BGP_PEER_IBGP, |
| 695 | BGP_PEER_EBGP, |
| 696 | BGP_PEER_INTERNAL, |
| 697 | BGP_PEER_CONFED |
| 698 | }; |
| 699 | |
| 700 | /* Flag for peer_clear_soft(). */ |
| 701 | enum bgp_clear_type |
| 702 | { |
| 703 | BGP_CLEAR_SOFT_NONE, |
| 704 | BGP_CLEAR_SOFT_OUT, |
| 705 | BGP_CLEAR_SOFT_IN, |
| 706 | BGP_CLEAR_SOFT_BOTH, |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame^] | 707 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, |
| 708 | BGP_CLEAR_SOFT_RSCLIENT |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 709 | }; |
| 710 | |
| 711 | /* Macros. */ |
| 712 | #define BGP_INPUT(P) ((P)->ibuf) |
| 713 | #define BGP_INPUT_PNT(P) (STREAM_PNT(BGP_INPUT(P))) |
| 714 | |
| 715 | /* Macro to check BGP information is alive or not. */ |
| 716 | #define BGP_INFO_HOLDDOWN(BI) \ |
| 717 | (! CHECK_FLAG ((BI)->flags, BGP_INFO_VALID) \ |
| 718 | || CHECK_FLAG ((BI)->flags, BGP_INFO_HISTORY) \ |
| 719 | || CHECK_FLAG ((BI)->flags, BGP_INFO_DAMPED)) |
| 720 | |
| 721 | /* Count prefix size from mask length */ |
| 722 | #define PSIZE(a) (((a) + 7) / (8)) |
| 723 | |
| 724 | /* BGP error codes. */ |
| 725 | #define BGP_SUCCESS 0 |
| 726 | #define BGP_ERR_INVALID_VALUE -1 |
| 727 | #define BGP_ERR_INVALID_FLAG -2 |
| 728 | #define BGP_ERR_INVALID_AS -3 |
| 729 | #define BGP_ERR_INVALID_BGP -4 |
| 730 | #define BGP_ERR_PEER_GROUP_MEMBER -5 |
| 731 | #define BGP_ERR_MULTIPLE_INSTANCE_USED -6 |
| 732 | #define BGP_ERR_PEER_GROUP_MEMBER_EXISTS -7 |
| 733 | #define BGP_ERR_PEER_BELONGS_TO_GROUP -8 |
| 734 | #define BGP_ERR_PEER_GROUP_AF_UNCONFIGURED -9 |
| 735 | #define BGP_ERR_PEER_GROUP_NO_REMOTE_AS -10 |
| 736 | #define BGP_ERR_PEER_GROUP_CANT_CHANGE -11 |
| 737 | #define BGP_ERR_PEER_GROUP_MISMATCH -12 |
| 738 | #define BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT -13 |
| 739 | #define BGP_ERR_MULTIPLE_INSTANCE_NOT_SET -14 |
| 740 | #define BGP_ERR_AS_MISMATCH -15 |
| 741 | #define BGP_ERR_PEER_INACTIVE -16 |
| 742 | #define BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER -17 |
| 743 | #define BGP_ERR_PEER_GROUP_HAS_THE_FLAG -18 |
| 744 | #define BGP_ERR_PEER_FLAG_CONFLICT -19 |
| 745 | #define BGP_ERR_PEER_GROUP_SHUTDOWN -20 |
| 746 | #define BGP_ERR_PEER_FILTER_CONFLICT -21 |
| 747 | #define BGP_ERR_NOT_INTERNAL_PEER -22 |
| 748 | #define BGP_ERR_REMOVE_PRIVATE_AS -23 |
| 749 | #define BGP_ERR_AF_UNCONFIGURED -24 |
| 750 | #define BGP_ERR_SOFT_RECONFIG_UNCONFIGURED -25 |
| 751 | #define BGP_ERR_INSTANCE_MISMATCH -26 |
| 752 | #define BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP -27 |
| 753 | #define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS -28 |
| 754 | #define BGP_ERR_MAX -29 |
| 755 | |
| 756 | extern struct bgp_master *bm; |
| 757 | |
| 758 | extern struct thread_master *master; |
| 759 | |
| 760 | /* Prototypes. */ |
| 761 | void bgp_terminate (void); |
| 762 | void bgp_reset (void); |
| 763 | void bgp_zclient_reset (); |
| 764 | int bgp_nexthop_set (union sockunion *, union sockunion *, |
| 765 | struct bgp_nexthop *, struct peer *); |
paul | 6cbbc3c | 2003-04-28 17:11:02 +0000 | [diff] [blame] | 766 | struct bgp_master *bgp_get_master (); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 767 | struct bgp *bgp_get_default (); |
| 768 | struct bgp *bgp_lookup (as_t, char *); |
| 769 | struct bgp *bgp_lookup_by_name (char *); |
| 770 | struct peer *peer_lookup (struct bgp *, union sockunion *); |
| 771 | struct peer_group *peer_group_lookup (struct bgp *, char *); |
| 772 | struct peer_group *peer_group_get (struct bgp *, char *); |
| 773 | struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *, |
| 774 | int *); |
| 775 | int peer_sort (struct peer *peer); |
| 776 | int peer_active (struct peer *); |
| 777 | int peer_active_nego (struct peer *); |
| 778 | struct peer *peer_create_accept (struct bgp *); |
| 779 | char *peer_uptime (time_t, char *, size_t); |
| 780 | void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *); |
| 781 | |
| 782 | void bgp_master_init (); |
| 783 | |
| 784 | void bgp_init (); |
| 785 | |
| 786 | int bgp_option_set (int); |
| 787 | int bgp_option_unset (int); |
| 788 | int bgp_option_check (int); |
| 789 | |
| 790 | int bgp_get (struct bgp **, as_t *, char *); |
| 791 | int bgp_delete (struct bgp *); |
| 792 | |
| 793 | int bgp_flag_set (struct bgp *, int); |
| 794 | int bgp_flag_unset (struct bgp *, int); |
| 795 | int bgp_flag_check (struct bgp *, int); |
| 796 | |
| 797 | int bgp_router_id_set (struct bgp *, struct in_addr *); |
| 798 | int bgp_router_id_unset (struct bgp *); |
| 799 | |
| 800 | int bgp_cluster_id_set (struct bgp *, struct in_addr *); |
| 801 | int bgp_cluster_id_unset (struct bgp *); |
| 802 | |
| 803 | int bgp_confederation_id_set (struct bgp *, as_t); |
| 804 | int bgp_confederation_id_unset (struct bgp *); |
| 805 | int bgp_confederation_peers_check (struct bgp *, as_t); |
| 806 | |
| 807 | int bgp_confederation_peers_add (struct bgp *, as_t); |
| 808 | int bgp_confederation_peers_remove (struct bgp *, as_t); |
| 809 | |
| 810 | int bgp_timers_set (struct bgp *, u_int32_t, u_int32_t); |
| 811 | int bgp_timers_unset (struct bgp *); |
| 812 | |
| 813 | int bgp_default_local_preference_set (struct bgp *, u_int32_t); |
| 814 | int bgp_default_local_preference_unset (struct bgp *); |
| 815 | |
paul | fee0f4c | 2004-09-13 05:12:46 +0000 | [diff] [blame^] | 816 | int peer_rsclient_active (struct peer *); |
| 817 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 818 | int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t); |
| 819 | int peer_group_remote_as (struct bgp *, char *, as_t *); |
| 820 | int peer_delete (struct peer *peer); |
| 821 | int peer_group_delete (struct peer_group *); |
| 822 | int peer_group_remote_as_delete (struct peer_group *); |
| 823 | |
| 824 | int peer_activate (struct peer *, afi_t, safi_t); |
| 825 | int peer_deactivate (struct peer *, afi_t, safi_t); |
| 826 | |
| 827 | int peer_group_bind (struct bgp *, union sockunion *, struct peer_group *, |
| 828 | afi_t, safi_t, as_t *); |
| 829 | int peer_group_unbind (struct bgp *, struct peer *, struct peer_group *, |
| 830 | afi_t, safi_t); |
| 831 | |
| 832 | int peer_flag_set (struct peer *, u_int32_t); |
| 833 | int peer_flag_unset (struct peer *, u_int32_t); |
| 834 | |
| 835 | int peer_af_flag_set (struct peer *, afi_t, safi_t, u_int32_t); |
| 836 | int peer_af_flag_unset (struct peer *, afi_t, safi_t, u_int32_t); |
| 837 | int peer_af_flag_check (struct peer *, afi_t, safi_t, u_int32_t); |
| 838 | |
| 839 | int peer_ebgp_multihop_set (struct peer *, int); |
| 840 | int peer_ebgp_multihop_unset (struct peer *); |
| 841 | |
| 842 | int peer_description_set (struct peer *, char *); |
| 843 | int peer_description_unset (struct peer *); |
| 844 | |
| 845 | int peer_update_source_if_set (struct peer *, char *); |
| 846 | int peer_update_source_addr_set (struct peer *, union sockunion *); |
| 847 | int peer_update_source_unset (struct peer *); |
| 848 | |
| 849 | int peer_default_originate_set (struct peer *, afi_t, safi_t, char *); |
| 850 | int peer_default_originate_unset (struct peer *, afi_t, safi_t); |
| 851 | |
| 852 | int peer_port_set (struct peer *, u_int16_t); |
| 853 | int peer_port_unset (struct peer *); |
| 854 | |
| 855 | int peer_weight_set (struct peer *, u_int16_t); |
| 856 | int peer_weight_unset (struct peer *); |
| 857 | |
| 858 | int peer_timers_set (struct peer *, u_int32_t, u_int32_t); |
| 859 | int peer_timers_unset (struct peer *); |
| 860 | |
| 861 | int peer_timers_connect_set (struct peer *, u_int32_t); |
| 862 | int peer_timers_connect_unset (struct peer *); |
| 863 | |
| 864 | int peer_advertise_interval_set (struct peer *, u_int32_t); |
| 865 | int peer_advertise_interval_unset (struct peer *); |
| 866 | |
| 867 | int peer_version_set (struct peer *, int); |
| 868 | int peer_version_unset (struct peer *); |
| 869 | |
| 870 | int peer_interface_set (struct peer *, char *); |
| 871 | int peer_interface_unset (struct peer *); |
| 872 | |
| 873 | int peer_distribute_set (struct peer *, afi_t, safi_t, int, char *); |
| 874 | int peer_distribute_unset (struct peer *, afi_t, safi_t, int); |
| 875 | |
| 876 | int peer_allowas_in_set (struct peer *, afi_t, safi_t, int); |
| 877 | int peer_allowas_in_unset (struct peer *, afi_t, safi_t); |
| 878 | |
| 879 | int peer_local_as_set (struct peer *, as_t, int); |
| 880 | int peer_local_as_unset (struct peer *); |
| 881 | |
| 882 | int peer_prefix_list_set (struct peer *, afi_t, safi_t, int, char *); |
| 883 | int peer_prefix_list_unset (struct peer *, afi_t, safi_t, int); |
| 884 | |
| 885 | int peer_aslist_set (struct peer *, afi_t, safi_t, int, char *); |
| 886 | int peer_aslist_unset (struct peer *,afi_t, safi_t, int); |
| 887 | |
| 888 | int peer_route_map_set (struct peer *, afi_t, safi_t, int, char *); |
| 889 | int peer_route_map_unset (struct peer *, afi_t, safi_t, int); |
| 890 | |
| 891 | int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, char *); |
| 892 | int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t); |
| 893 | |
hasso | e0701b7 | 2004-05-20 09:19:34 +0000 | [diff] [blame] | 894 | int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 895 | int peer_maximum_prefix_unset (struct peer *, afi_t, safi_t); |
| 896 | |
| 897 | int peer_clear (struct peer *); |
| 898 | int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type); |