bgpd.h 35 KB

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