bgpd.h 36 KB

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