Line | Count | Source |
1 | | // SPDX-License-Identifier: GPL-2.0-or-later |
2 | | /* BGP message definition header. |
3 | | * Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro |
4 | | */ |
5 | | |
6 | | #ifndef _QUAGGA_BGPD_H |
7 | | #define _QUAGGA_BGPD_H |
8 | | |
9 | | #include "qobj.h" |
10 | | #include <pthread.h> |
11 | | |
12 | | #include "hook.h" |
13 | | #include "frr_pthread.h" |
14 | | #include "lib/json.h" |
15 | | #include "vrf.h" |
16 | | #include "vty.h" |
17 | | #include "srv6.h" |
18 | | #include "iana_afi.h" |
19 | | #include "asn.h" |
20 | | |
21 | | /* For union sockunion. */ |
22 | | #include "queue.h" |
23 | | #include "sockunion.h" |
24 | | #include "routemap.h" |
25 | | #include "linklist.h" |
26 | | #include "defaults.h" |
27 | | #include "bgp_memory.h" |
28 | | #include "bitfield.h" |
29 | | #include "vxlan.h" |
30 | | #include "bgp_labelpool.h" |
31 | | #include "bgp_addpath_types.h" |
32 | | #include "bgp_nexthop.h" |
33 | | #include "bgp_io.h" |
34 | | |
35 | | #include "lib/bfd.h" |
36 | | |
37 | 9 | #define BGP_MAX_HOSTNAME 64 /* Linux max, is larger than most other sys */ |
38 | 1 | #define BGP_PEER_MAX_HASH_SIZE 16384 |
39 | | |
40 | | /* Default interval for IPv6 RAs when triggered by BGP unnumbered neighbor. */ |
41 | 0 | #define BGP_UNNUM_DEFAULT_RA_INTERVAL 10 |
42 | | |
43 | | struct update_subgroup; |
44 | | struct bpacket; |
45 | | struct bgp_pbr_config; |
46 | | |
47 | | /* |
48 | | * Allow the neighbor XXXX remote-as to take internal or external |
49 | | * AS_SPECIFIED is zero to auto-inherit original non-feature/enhancement |
50 | | * behavior |
51 | | * in the system. |
52 | | */ |
53 | | enum { AS_UNSPECIFIED = 0, |
54 | | AS_SPECIFIED, |
55 | | AS_INTERNAL, |
56 | | AS_EXTERNAL, |
57 | | }; |
58 | | |
59 | | /* Zebra Gracaful Restart states */ |
60 | | enum zebra_gr_mode { |
61 | | ZEBRA_GR_DISABLE = 0, |
62 | | ZEBRA_GR_ENABLE |
63 | | }; |
64 | | |
65 | | /* Typedef BGP specific types. */ |
66 | | typedef uint16_t as16_t; /* we may still encounter 16 Bit asnums */ |
67 | | typedef uint16_t bgp_size_t; |
68 | | |
69 | | enum bgp_af_index { |
70 | | BGP_AF_START, |
71 | | BGP_AF_IPV4_UNICAST = BGP_AF_START, |
72 | | BGP_AF_IPV4_MULTICAST, |
73 | | BGP_AF_IPV4_VPN, |
74 | | BGP_AF_IPV6_UNICAST, |
75 | | BGP_AF_IPV6_MULTICAST, |
76 | | BGP_AF_IPV6_VPN, |
77 | | BGP_AF_IPV4_ENCAP, |
78 | | BGP_AF_IPV6_ENCAP, |
79 | | BGP_AF_L2VPN_EVPN, |
80 | | BGP_AF_IPV4_LBL_UNICAST, |
81 | | BGP_AF_IPV6_LBL_UNICAST, |
82 | | BGP_AF_IPV4_FLOWSPEC, |
83 | | BGP_AF_IPV6_FLOWSPEC, |
84 | | BGP_AF_MAX |
85 | | }; |
86 | | |
87 | 14 | #define AF_FOREACH(af) for ((af) = BGP_AF_START; (af) < BGP_AF_MAX; (af)++) |
88 | | |
89 | | #define FOREACH_SAFI(safi) \ |
90 | 0 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) |
91 | | |
92 | | extern struct frr_pthread *bgp_pth_io; |
93 | | extern struct frr_pthread *bgp_pth_ka; |
94 | | |
95 | | /* BGP master for system wide configurations and variables. */ |
96 | | struct bgp_master { |
97 | | /* BGP instance list. */ |
98 | | struct list *bgp; |
99 | | |
100 | | /* BGP thread master. */ |
101 | | struct event_loop *master; |
102 | | |
103 | | /* Listening sockets */ |
104 | | struct list *listen_sockets; |
105 | | |
106 | | /* BGP port number. */ |
107 | | uint16_t port; |
108 | | |
109 | | /* Listener addresses */ |
110 | | struct list *addresses; |
111 | | |
112 | | /* The Mac table */ |
113 | | struct hash *self_mac_hash; |
114 | | |
115 | | /* BGP start time. */ |
116 | | time_t start_time; |
117 | | |
118 | | /* Various BGP global configuration. */ |
119 | | uint8_t options; |
120 | | |
121 | 2 | #define BGP_OPT_NO_FIB (1 << 0) |
122 | 4 | #define BGP_OPT_NO_LISTEN (1 << 1) |
123 | 4 | #define BGP_OPT_NO_ZEBRA (1 << 2) |
124 | | |
125 | | uint64_t updgrp_idspace; |
126 | | uint64_t subgrp_idspace; |
127 | | |
128 | | /* timer to dampen route map changes */ |
129 | | struct event *t_rmap_update; /* Handle route map updates */ |
130 | | uint32_t rmap_update_timer; /* Route map update timer */ |
131 | 1 | #define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */ |
132 | | |
133 | | /* Id space for automatic RD derivation for an EVI/VRF */ |
134 | | bitfield_t rd_idspace; |
135 | | |
136 | | /* dynamic mpls label allocation pool */ |
137 | | struct labelpool labelpool; |
138 | | |
139 | | /* BGP-EVPN VRF ID. Defaults to default VRF (if any) */ |
140 | | struct bgp* bgp_evpn; |
141 | | |
142 | | /* How big should we set the socket buffer size */ |
143 | | uint32_t socket_buffer; |
144 | | |
145 | | /* Should we do wait for fib install globally? */ |
146 | | bool wait_for_fib; |
147 | | |
148 | | /* EVPN multihoming */ |
149 | | struct bgp_evpn_mh_info *mh_info; |
150 | | |
151 | | /* global update-delay timer values */ |
152 | | uint16_t v_update_delay; |
153 | | uint16_t v_establish_wait; |
154 | | |
155 | | uint32_t flags; |
156 | | #define BM_FLAG_GRACEFUL_SHUTDOWN (1 << 0) |
157 | | #define BM_FLAG_SEND_EXTRA_DATA_TO_ZEBRA (1 << 1) |
158 | | |
159 | | bool terminating; /* global flag that sigint terminate seen */ |
160 | | |
161 | | /* DSCP value for TCP sessions */ |
162 | | uint8_t tcp_dscp; |
163 | | |
164 | 2 | #define BM_DEFAULT_Q_LIMIT 10000 |
165 | | uint32_t inq_limit; |
166 | | uint32_t outq_limit; |
167 | | |
168 | | QOBJ_FIELDS; |
169 | | }; |
170 | | DECLARE_QOBJ_TYPE(bgp_master); |
171 | | |
172 | | /* BGP route-map structure. */ |
173 | | struct bgp_rmap { |
174 | | char *name; |
175 | | struct route_map *map; |
176 | | }; |
177 | | |
178 | | struct bgp_redist { |
179 | | unsigned short instance; |
180 | | |
181 | | /* BGP redistribute metric configuration. */ |
182 | | uint8_t redist_metric_flag; |
183 | | uint32_t redist_metric; |
184 | | |
185 | | /* BGP redistribute route-map. */ |
186 | | struct bgp_rmap rmap; |
187 | | }; |
188 | | |
189 | | enum vpn_policy_direction { |
190 | | BGP_VPN_POLICY_DIR_FROMVPN = 0, |
191 | | BGP_VPN_POLICY_DIR_TOVPN = 1, |
192 | | BGP_VPN_POLICY_DIR_MAX = 2 |
193 | | }; |
194 | | |
195 | | struct vpn_policy { |
196 | | struct bgp *bgp; /* parent */ |
197 | | afi_t afi; |
198 | | struct ecommunity *rtlist[BGP_VPN_POLICY_DIR_MAX]; |
199 | | struct ecommunity *import_redirect_rtlist; |
200 | | char *rmap_name[BGP_VPN_POLICY_DIR_MAX]; |
201 | | struct route_map *rmap[BGP_VPN_POLICY_DIR_MAX]; |
202 | | |
203 | | /* should be mpls_label_t? */ |
204 | | uint32_t tovpn_label; /* may be MPLS_LABEL_NONE */ |
205 | | uint32_t tovpn_zebra_vrf_label_last_sent; |
206 | | char *tovpn_rd_pretty; |
207 | | struct prefix_rd tovpn_rd; |
208 | | struct prefix tovpn_nexthop; /* unset => set to 0 */ |
209 | | uint32_t flags; |
210 | | #define BGP_VPN_POLICY_TOVPN_LABEL_AUTO (1 << 0) |
211 | | #define BGP_VPN_POLICY_TOVPN_RD_SET (1 << 1) |
212 | | #define BGP_VPN_POLICY_TOVPN_NEXTHOP_SET (1 << 2) |
213 | | #define BGP_VPN_POLICY_TOVPN_SID_AUTO (1 << 3) |
214 | | #define BGP_VPN_POLICY_TOVPN_LABEL_PER_NEXTHOP (1 << 4) |
215 | | |
216 | | /* |
217 | | * If we are importing another vrf into us keep a list of |
218 | | * vrf names that are being imported into us. |
219 | | */ |
220 | | struct list *import_vrf; |
221 | | |
222 | | /* |
223 | | * if we are being exported to another vrf keep a list of |
224 | | * vrf names that we are being exported to. |
225 | | */ |
226 | | struct list *export_vrf; |
227 | | |
228 | | /* |
229 | | * Segment-Routing SRv6 Mode |
230 | | */ |
231 | | uint32_t tovpn_sid_index; /* unset => set to 0 */ |
232 | | struct in6_addr *tovpn_sid; |
233 | | struct srv6_locator_chunk *tovpn_sid_locator; |
234 | | uint32_t tovpn_sid_transpose_label; |
235 | | struct in6_addr *tovpn_zebra_vrf_sid_last_sent; |
236 | | }; |
237 | | |
238 | | /* |
239 | | * Type of 'struct bgp'. |
240 | | * - Default: The default instance |
241 | | * - VRF: A specific (non-default) VRF |
242 | | * - View: An instance used for route exchange |
243 | | * The "default" instance is treated separately to simplify the code. Note |
244 | | * that if deployed in a Multi-VRF environment, it may not exist. |
245 | | */ |
246 | | enum bgp_instance_type { |
247 | | BGP_INSTANCE_TYPE_DEFAULT, |
248 | | BGP_INSTANCE_TYPE_VRF, |
249 | | BGP_INSTANCE_TYPE_VIEW |
250 | | }; |
251 | | |
252 | | #define BGP_SEND_EOR(bgp, afi, safi) \ |
253 | 0 | (!CHECK_FLAG(bgp->flags, BGP_FLAG_GR_DISABLE_EOR) \ |
254 | 0 | && ((bgp->gr_info[afi][safi].t_select_deferral == NULL) \ |
255 | 0 | || (bgp->gr_info[afi][safi].eor_required \ |
256 | 0 | == bgp->gr_info[afi][safi].eor_received))) |
257 | | |
258 | | /* BGP GR Global ds */ |
259 | | |
260 | | #define BGP_GLOBAL_GR_MODE 4 |
261 | | #define BGP_GLOBAL_GR_EVENT_CMD 4 |
262 | | |
263 | | /* Graceful restart selection deferral timer info */ |
264 | | struct graceful_restart_info { |
265 | | /* Count of EOR message expected */ |
266 | | uint32_t eor_required; |
267 | | /* Count of EOR received */ |
268 | | uint32_t eor_received; |
269 | | /* Deferral Timer */ |
270 | | struct event *t_select_deferral; |
271 | | /* Routes Deferred */ |
272 | | uint32_t gr_deferred; |
273 | | /* Best route select */ |
274 | | struct event *t_route_select; |
275 | | /* AFI, SAFI enabled */ |
276 | | bool af_enabled[AFI_MAX][SAFI_MAX]; |
277 | | /* Route update completed */ |
278 | | bool route_sync[AFI_MAX][SAFI_MAX]; |
279 | | }; |
280 | | |
281 | | enum global_mode { |
282 | | GLOBAL_HELPER = 0, /* This is the default mode */ |
283 | | GLOBAL_GR, |
284 | | GLOBAL_DISABLE, |
285 | | GLOBAL_INVALID |
286 | | }; |
287 | | |
288 | | enum global_gr_command { |
289 | | GLOBAL_GR_CMD = 0, |
290 | | NO_GLOBAL_GR_CMD, |
291 | | GLOBAL_DISABLE_CMD, |
292 | | NO_GLOBAL_DISABLE_CMD |
293 | | }; |
294 | | |
295 | 3 | #define BGP_GR_SUCCESS 0 |
296 | 0 | #define BGP_GR_FAILURE 1 |
297 | | |
298 | | /* Handling of BGP link bandwidth (LB) on receiver - whether and how to |
299 | | * do weighted ECMP. Note: This applies after multipath computation. |
300 | | */ |
301 | | enum bgp_link_bw_handling { |
302 | | /* Do ECMP if some paths don't have LB - default */ |
303 | | BGP_LINK_BW_ECMP, |
304 | | /* Completely ignore LB, just do regular ECMP */ |
305 | | BGP_LINK_BW_IGNORE_BW, |
306 | | /* Skip paths without LB, do wECMP on others */ |
307 | | BGP_LINK_BW_SKIP_MISSING, |
308 | | /* Do wECMP with default weight for paths not having LB */ |
309 | | BGP_LINK_BW_DEFWT_4_MISSING |
310 | | }; |
311 | | |
312 | | RB_HEAD(bgp_es_vrf_rb_head, bgp_evpn_es_vrf); |
313 | | RB_PROTOTYPE(bgp_es_vrf_rb_head, bgp_evpn_es_vrf, rb_node, bgp_es_vrf_rb_cmp); |
314 | | |
315 | | struct bgp_snmp_stats { |
316 | | /* SNMP variables for mplsL3Vpn*/ |
317 | | time_t creation_time; |
318 | | time_t modify_time; |
319 | | bool active; |
320 | | uint32_t routes_added; |
321 | | uint32_t routes_deleted; |
322 | | }; |
323 | | |
324 | | struct bgp_srv6_function { |
325 | | struct in6_addr sid; |
326 | | char locator_name[SRV6_LOCNAME_SIZE]; |
327 | | }; |
328 | | |
329 | | struct as_confed { |
330 | | as_t as; |
331 | | char *as_pretty; |
332 | | }; |
333 | | |
334 | | /* BGP instance structure. */ |
335 | | struct bgp { |
336 | | /* AS number of this BGP instance. */ |
337 | | as_t as; |
338 | | char *as_pretty; |
339 | | |
340 | | /* Name of this BGP instance. */ |
341 | | char *name; |
342 | | char *name_pretty; /* printable "VRF|VIEW name|default" */ |
343 | | |
344 | | /* Type of instance and VRF id. */ |
345 | | enum bgp_instance_type inst_type; |
346 | | vrf_id_t vrf_id; |
347 | | |
348 | | /* Reference count to allow peer_delete to finish after bgp_delete */ |
349 | | int lock; |
350 | | |
351 | | /* Self peer. */ |
352 | | struct peer *peer_self; |
353 | | |
354 | | /* BGP peer. */ |
355 | | struct list *peer; |
356 | | struct hash *peerhash; |
357 | | |
358 | | /* BGP peer group. */ |
359 | | struct list *group; |
360 | | |
361 | | /* The maximum number of BGP dynamic neighbors that can be created */ |
362 | | int dynamic_neighbors_limit; |
363 | | |
364 | | /* The current number of BGP dynamic neighbors */ |
365 | | int dynamic_neighbors_count; |
366 | | |
367 | | struct hash *update_groups[BGP_AF_MAX]; |
368 | | |
369 | | /* |
370 | | * Global statistics for update groups. |
371 | | */ |
372 | | struct { |
373 | | uint32_t join_events; |
374 | | uint32_t prune_events; |
375 | | uint32_t merge_events; |
376 | | uint32_t split_events; |
377 | | uint32_t updgrp_switch_events; |
378 | | uint32_t peer_refreshes_combined; |
379 | | uint32_t adj_count; |
380 | | uint32_t merge_checks_triggered; |
381 | | |
382 | | uint32_t updgrps_created; |
383 | | uint32_t updgrps_deleted; |
384 | | uint32_t subgrps_created; |
385 | | uint32_t subgrps_deleted; |
386 | | } update_group_stats; |
387 | | |
388 | | struct bgp_snmp_stats *snmp_stats; |
389 | | |
390 | | /* BGP configuration. */ |
391 | | uint16_t config; |
392 | 2 | #define BGP_CONFIG_CLUSTER_ID (1 << 0) |
393 | 0 | #define BGP_CONFIG_CONFEDERATION (1 << 1) |
394 | | #define BGP_CONFIG_ASNOTATION (1 << 2) |
395 | | |
396 | | /* BGP router identifier. */ |
397 | | struct in_addr router_id; |
398 | | struct in_addr router_id_static; |
399 | | struct in_addr router_id_zebra; |
400 | | |
401 | | /* BGP route reflector cluster ID. */ |
402 | | struct in_addr cluster_id; |
403 | | |
404 | | /* BGP confederation information. */ |
405 | | as_t confed_id; |
406 | | char *confed_id_pretty; |
407 | | struct as_confed *confed_peers; |
408 | | int confed_peers_cnt; |
409 | | |
410 | | /* start-up timer on only once at the beginning */ |
411 | | struct event *t_startup; |
412 | | |
413 | | uint32_t v_maxmed_onstartup; /* Duration of max-med on start-up */ |
414 | 0 | #define BGP_MAXMED_ONSTARTUP_UNCONFIGURED 0 /* 0 means off, its the default */ |
415 | | uint32_t maxmed_onstartup_value; /* Max-med value when active on |
416 | | start-up */ |
417 | | |
418 | | /* non-null when max-med onstartup is on */ |
419 | | struct event *t_maxmed_onstartup; |
420 | | uint8_t maxmed_onstartup_over; /* Flag to make it effective only once */ |
421 | | |
422 | | bool v_maxmed_admin; /* true/false if max-med administrative is on/off |
423 | | */ |
424 | 0 | #define BGP_MAXMED_ADMIN_UNCONFIGURED false /* Off by default */ |
425 | | uint32_t maxmed_admin_value; /* Max-med value when administrative in on |
426 | | */ |
427 | 0 | #define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */ |
428 | | |
429 | | uint8_t maxmed_active; /* 1/0 if max-med is active or not */ |
430 | | uint32_t maxmed_value; /* Max-med value when its active */ |
431 | | |
432 | | /* BGP update delay on startup */ |
433 | | struct event *t_update_delay; |
434 | | struct event *t_establish_wait; |
435 | | struct event *t_revalidate[AFI_MAX][SAFI_MAX]; |
436 | | |
437 | | uint8_t update_delay_over; |
438 | | uint8_t main_zebra_update_hold; |
439 | | uint8_t main_peers_update_hold; |
440 | | uint16_t v_update_delay; |
441 | | uint16_t v_establish_wait; |
442 | | char update_delay_begin_time[64]; |
443 | | char update_delay_end_time[64]; |
444 | | char update_delay_zebra_resume_time[64]; |
445 | | char update_delay_peers_resume_time[64]; |
446 | | uint32_t established; |
447 | | uint32_t restarted_peers; |
448 | | uint32_t implicit_eors; |
449 | | uint32_t explicit_eors; |
450 | 2 | #define BGP_UPDATE_DELAY_DEF 0 |
451 | | #define BGP_UPDATE_DELAY_MIN 0 |
452 | | #define BGP_UPDATE_DELAY_MAX 3600 |
453 | | |
454 | | /* Reference bandwidth for BGP link-bandwidth. Used when |
455 | | * the LB value has to be computed based on some other |
456 | | * factor (e.g., number of multipaths for the prefix) |
457 | | * Value is in Mbps |
458 | | */ |
459 | | uint32_t lb_ref_bw; |
460 | 1 | #define BGP_LINK_BW_REF_BW 1 |
461 | | |
462 | | /* BGP flags. */ |
463 | | uint64_t flags; |
464 | | #define BGP_FLAG_ALWAYS_COMPARE_MED (1ULL << 0) |
465 | | #define BGP_FLAG_DETERMINISTIC_MED (1ULL << 1) |
466 | | #define BGP_FLAG_MED_MISSING_AS_WORST (1ULL << 2) |
467 | | #define BGP_FLAG_MED_CONFED (1ULL << 3) |
468 | | #define BGP_FLAG_NO_CLIENT_TO_CLIENT (1ULL << 4) |
469 | | #define BGP_FLAG_COMPARE_ROUTER_ID (1ULL << 5) |
470 | | #define BGP_FLAG_ASPATH_IGNORE (1ULL << 6) |
471 | | #define BGP_FLAG_IMPORT_CHECK (1ULL << 7) |
472 | | #define BGP_FLAG_NO_FAST_EXT_FAILOVER (1ULL << 8) |
473 | | #define BGP_FLAG_LOG_NEIGHBOR_CHANGES (1ULL << 9) |
474 | | |
475 | | /* This flag is set when we have full BGP Graceful-Restart mode enable */ |
476 | | #define BGP_FLAG_GRACEFUL_RESTART (1ULL << 10) |
477 | | |
478 | | #define BGP_FLAG_ASPATH_CONFED (1ULL << 11) |
479 | | #define BGP_FLAG_ASPATH_MULTIPATH_RELAX (1ULL << 12) |
480 | | #define BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY (1ULL << 13) |
481 | | #define BGP_FLAG_DISABLE_NH_CONNECTED_CHK (1ULL << 14) |
482 | | #define BGP_FLAG_MULTIPATH_RELAX_AS_SET (1ULL << 15) |
483 | | #define BGP_FLAG_FORCE_STATIC_PROCESS (1ULL << 16) |
484 | | #define BGP_FLAG_SHOW_HOSTNAME (1ULL << 17) |
485 | | #define BGP_FLAG_GR_PRESERVE_FWD (1ULL << 18) |
486 | | #define BGP_FLAG_GRACEFUL_SHUTDOWN (1ULL << 19) |
487 | | #define BGP_FLAG_DELETE_IN_PROGRESS (1ULL << 20) |
488 | | #define BGP_FLAG_SELECT_DEFER_DISABLE (1ULL << 21) |
489 | | #define BGP_FLAG_GR_DISABLE_EOR (1ULL << 22) |
490 | | #define BGP_FLAG_EBGP_REQUIRES_POLICY (1ULL << 23) |
491 | | #define BGP_FLAG_SHOW_NEXTHOP_HOSTNAME (1ULL << 24) |
492 | | |
493 | | /* This flag is set if the instance is in administrative shutdown */ |
494 | | #define BGP_FLAG_SHUTDOWN (1ULL << 25) |
495 | | #define BGP_FLAG_SUPPRESS_FIB_PENDING (1ULL << 26) |
496 | | #define BGP_FLAG_SUPPRESS_DUPLICATES (1ULL << 27) |
497 | | #define BGP_FLAG_PEERTYPE_MULTIPATH_RELAX (1ULL << 29) |
498 | | /* Indicate Graceful Restart support for BGP NOTIFICATION messages */ |
499 | | #define BGP_FLAG_GRACEFUL_NOTIFICATION (1ULL << 30) |
500 | | /* Send Hard Reset CEASE Notification for 'Administrative Reset' */ |
501 | | #define BGP_FLAG_HARD_ADMIN_RESET (1ULL << 31) |
502 | | /* Evaluate the AIGP attribute during the best path selection process */ |
503 | | #define BGP_FLAG_COMPARE_AIGP (1ULL << 32) |
504 | | /* For BGP-LU, force IPv4 local prefixes to use ipv4-explicit-null label */ |
505 | 0 | #define BGP_FLAG_LU_IPV4_EXPLICIT_NULL (1ULL << 33) |
506 | | /* For BGP-LU, force IPv6 local prefixes to use ipv6-explicit-null label */ |
507 | 0 | #define BGP_FLAG_LU_IPV6_EXPLICIT_NULL (1ULL << 34) |
508 | | |
509 | | /* BGP default address-families. |
510 | | * New peers inherit enabled afi/safis from bgp instance. |
511 | | */ |
512 | | uint16_t default_af[AFI_MAX][SAFI_MAX]; |
513 | | |
514 | | enum global_mode GLOBAL_GR_FSM[BGP_GLOBAL_GR_MODE] |
515 | | [BGP_GLOBAL_GR_EVENT_CMD]; |
516 | | enum global_mode global_gr_present_state; |
517 | | |
518 | | /* This variable stores the current Graceful Restart state of Zebra |
519 | | * - ZEBRA_GR_ENABLE / ZEBRA_GR_DISABLE |
520 | | */ |
521 | | enum zebra_gr_mode present_zebra_gr_state; |
522 | | |
523 | | /* BGP Per AF flags */ |
524 | | uint16_t af_flags[AFI_MAX][SAFI_MAX]; |
525 | | #define BGP_CONFIG_DAMPENING (1 << 0) |
526 | | /* l2vpn evpn flags - 1 << 0 is used for DAMPENNG */ |
527 | | #define BGP_L2VPN_EVPN_ADV_IPV4_UNICAST (1 << 1) |
528 | | #define BGP_L2VPN_EVPN_ADV_IPV4_UNICAST_GW_IP (1 << 2) |
529 | | #define BGP_L2VPN_EVPN_ADV_IPV6_UNICAST (1 << 3) |
530 | | #define BGP_L2VPN_EVPN_ADV_IPV6_UNICAST_GW_IP (1 << 4) |
531 | | #define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 (1 << 5) |
532 | | #define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 (1 << 6) |
533 | | /* import/export between address families */ |
534 | 0 | #define BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT (1 << 7) |
535 | 0 | #define BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT (1 << 8) |
536 | | /* vrf-route leaking flags */ |
537 | | #define BGP_CONFIG_VRF_TO_VRF_IMPORT (1 << 9) |
538 | | #define BGP_CONFIG_VRF_TO_VRF_EXPORT (1 << 10) |
539 | | /* vpnvx retain flag */ |
540 | | #define BGP_VPNVX_RETAIN_ROUTE_TARGET_ALL (1 << 11) |
541 | | |
542 | | /* BGP per AF peer count */ |
543 | | uint32_t af_peer_count[AFI_MAX][SAFI_MAX]; |
544 | | |
545 | | /* Tree for next-hop lookup cache. */ |
546 | | struct bgp_nexthop_cache_head nexthop_cache_table[AFI_MAX]; |
547 | | |
548 | | /* Tree for import-check */ |
549 | | struct bgp_nexthop_cache_head import_check_table[AFI_MAX]; |
550 | | |
551 | | struct bgp_table *connected_table[AFI_MAX]; |
552 | | |
553 | | struct hash *address_hash; |
554 | | |
555 | | /* DB for all local tunnel-ips - used mainly for martian checks |
556 | | Currently it only has all VxLan tunnel IPs*/ |
557 | | struct hash *tip_hash; |
558 | | |
559 | | /* Static route configuration. */ |
560 | | struct bgp_table *route[AFI_MAX][SAFI_MAX]; |
561 | | |
562 | | /* Aggregate address configuration. */ |
563 | | struct bgp_table *aggregate[AFI_MAX][SAFI_MAX]; |
564 | | |
565 | | /* BGP routing information base. */ |
566 | | struct bgp_table *rib[AFI_MAX][SAFI_MAX]; |
567 | | |
568 | | /* BGP table route-map. */ |
569 | | struct bgp_rmap table_map[AFI_MAX][SAFI_MAX]; |
570 | | |
571 | | /* BGP redistribute configuration. */ |
572 | | struct list *redist[AFI_MAX][ZEBRA_ROUTE_MAX]; |
573 | | |
574 | | /* Allocate MPLS labels */ |
575 | | uint8_t allocate_mpls_labels[AFI_MAX][SAFI_MAX]; |
576 | | |
577 | | /* Tree for next-hop lookup cache. */ |
578 | | struct bgp_label_per_nexthop_cache_head |
579 | | mpls_labels_per_nexthop[AFI_MAX]; |
580 | | |
581 | | /* Allocate hash entries to store policy routing information |
582 | | * The hash are used to host pbr rules somewhere. |
583 | | * Actually, pbr will only be used by flowspec |
584 | | * those hash elements will have relationship together as |
585 | | * illustrated in below diagram: |
586 | | * |
587 | | * pbr_action a <----- pbr_match i <--- pbr_match_entry 1..n |
588 | | * <----- pbr_match j <--- pbr_match_entry 1..m |
589 | | * <----- pbr_rule k |
590 | | * |
591 | | * - here in BGP structure, the list of match and actions will |
592 | | * stand for the list of ipset sets, and table_ids in the kernel |
593 | | * - the arrow above between pbr_match and pbr_action indicate |
594 | | * that a backpointer permits match to find the action |
595 | | * - the arrow betwen match_entry and match is a hash list |
596 | | * contained in match, that lists the whole set of entries |
597 | | */ |
598 | | struct hash *pbr_match_hash; |
599 | | struct hash *pbr_rule_hash; |
600 | | struct hash *pbr_action_hash; |
601 | | |
602 | | /* timer to re-evaluate neighbor default-originate route-maps */ |
603 | | struct event *t_rmap_def_originate_eval; |
604 | | #define RMAP_DEFAULT_ORIGINATE_EVAL_TIMER 5 |
605 | | |
606 | | /* BGP distance configuration. */ |
607 | | uint8_t distance_ebgp[AFI_MAX][SAFI_MAX]; |
608 | | uint8_t distance_ibgp[AFI_MAX][SAFI_MAX]; |
609 | | uint8_t distance_local[AFI_MAX][SAFI_MAX]; |
610 | | |
611 | | /* BGP default local-preference. */ |
612 | | uint32_t default_local_pref; |
613 | | |
614 | | /* BGP default subgroup pkt queue max */ |
615 | | uint32_t default_subgroup_pkt_queue_max; |
616 | | |
617 | | /* BGP default timer. */ |
618 | | uint32_t default_holdtime; |
619 | | uint32_t default_keepalive; |
620 | | uint32_t default_connect_retry; |
621 | | uint32_t default_delayopen; |
622 | | |
623 | | /* BGP minimum holdtime. */ |
624 | | uint16_t default_min_holdtime; |
625 | | |
626 | | /* BGP graceful restart */ |
627 | | uint32_t restart_time; |
628 | | uint32_t stalepath_time; |
629 | | uint32_t select_defer_time; |
630 | | struct graceful_restart_info gr_info[AFI_MAX][SAFI_MAX]; |
631 | | uint32_t rib_stale_time; |
632 | | |
633 | | /* BGP Long-lived Graceful Restart */ |
634 | | uint32_t llgr_stale_time; |
635 | | |
636 | | #define BGP_ROUTE_SELECT_DELAY 1 |
637 | 0 | #define BGP_MAX_BEST_ROUTE_SELECT 10000 |
638 | | /* Maximum-paths configuration */ |
639 | | struct bgp_maxpaths_cfg { |
640 | | uint16_t maxpaths_ebgp; |
641 | | uint16_t maxpaths_ibgp; |
642 | | bool same_clusterlen; |
643 | | } maxpaths[AFI_MAX][SAFI_MAX]; |
644 | | |
645 | | _Atomic uint32_t wpkt_quanta; // max # packets to write per i/o cycle |
646 | | _Atomic uint32_t rpkt_quanta; // max # packets to read per i/o cycle |
647 | | |
648 | | /* Automatic coalesce adjust on/off */ |
649 | | bool heuristic_coalesce; |
650 | | /* Actual coalesce time */ |
651 | | uint32_t coalesce_time; |
652 | | |
653 | | /* Auto-shutdown new peers */ |
654 | | bool autoshutdown; |
655 | | |
656 | | struct bgp_addpath_bgp_data tx_addpath; |
657 | | |
658 | | #ifdef ENABLE_BGP_VNC |
659 | | struct rfapi_cfg *rfapi_cfg; |
660 | | struct rfapi *rfapi; |
661 | | #endif |
662 | | |
663 | | /* EVPN related information */ |
664 | | |
665 | | /* EVI hash table */ |
666 | | struct hash *vnihash; |
667 | | |
668 | | /* |
669 | | * VNI hash table based on SVI ifindex as its key. |
670 | | * We use SVI ifindex as key to lookup a VNI table for gateway IP |
671 | | * overlay index recursive lookup. |
672 | | * For this purpose, a hashtable is added which optimizes this lookup. |
673 | | */ |
674 | | struct hash *vni_svi_hash; |
675 | | |
676 | | /* EVPN enable - advertise gateway macip routes */ |
677 | | int advertise_gw_macip; |
678 | | |
679 | | /* EVPN enable - advertise local VNIs and their MACs etc. */ |
680 | | int advertise_all_vni; |
681 | | |
682 | | /* draft-ietf-idr-deprecate-as-set-confed-set |
683 | | * Reject aspaths with AS_SET and/or AS_CONFED_SET. |
684 | | */ |
685 | | bool reject_as_sets; |
686 | | |
687 | | struct bgp_evpn_info *evpn_info; |
688 | | |
689 | | /* EVPN - use RFC 8365 to auto-derive RT */ |
690 | | int advertise_autort_rfc8365; |
691 | | |
692 | | /* |
693 | | * Flooding mechanism for BUM packets for VxLAN-EVPN. |
694 | | */ |
695 | | enum vxlan_flood_control vxlan_flood_ctrl; |
696 | | |
697 | | /* Hash table of Import RTs to EVIs */ |
698 | | struct hash *import_rt_hash; |
699 | | |
700 | | /* Hash table of VRF import RTs to VRFs */ |
701 | | struct hash *vrf_import_rt_hash; |
702 | | |
703 | | /* L3-VNI corresponding to this vrf */ |
704 | | vni_t l3vni; |
705 | | |
706 | | /* router-mac to be used in mac-ip routes for this vrf */ |
707 | | struct ethaddr rmac; |
708 | | |
709 | | /* originator ip - to be used as NH for type-5 routes */ |
710 | | struct in_addr originator_ip; |
711 | | |
712 | | /* SVI associated with the L3-VNI corresponding to this vrf */ |
713 | | ifindex_t l3vni_svi_ifindex; |
714 | | |
715 | | /* RB tree of ES-VRFs */ |
716 | | struct bgp_es_vrf_rb_head es_vrf_rb_tree; |
717 | | |
718 | | /* Hash table of EVPN nexthops maintained per-tenant-VRF */ |
719 | | struct hash *evpn_nh_table; |
720 | | |
721 | | /* |
722 | | * Flag resolve_overlay_index is used for recursive resolution |
723 | | * procedures for EVPN type-5 route's gateway IP overlay index. |
724 | | * When this flag is set, we build remote-ip-hash for |
725 | | * all L2VNIs and resolve overlay index nexthops using this hash. |
726 | | * Overlay index nexthops remain unresolved if this flag is not set. |
727 | | */ |
728 | | bool resolve_overlay_index; |
729 | | |
730 | | /* vrf flags */ |
731 | | uint32_t vrf_flags; |
732 | | #define BGP_VRF_AUTO (1 << 0) |
733 | | #define BGP_VRF_IMPORT_RT_CFGD (1 << 1) |
734 | | #define BGP_VRF_EXPORT_RT_CFGD (1 << 2) |
735 | | #define BGP_VRF_IMPORT_AUTO_RT_CFGD (1 << 3) /* retain auto when cfgd */ |
736 | | #define BGP_VRF_EXPORT_AUTO_RT_CFGD (1 << 4) /* retain auto when cfgd */ |
737 | | #define BGP_VRF_RD_CFGD (1 << 5) |
738 | | #define BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY (1 << 6) |
739 | | /* per-VRF toVPN SID */ |
740 | | #define BGP_VRF_TOVPN_SID_AUTO (1 << 7) |
741 | | |
742 | | /* unique ID for auto derivation of RD for this vrf */ |
743 | | uint16_t vrf_rd_id; |
744 | | |
745 | | /* Automatically derived RD for this VRF */ |
746 | | struct prefix_rd vrf_prd_auto; |
747 | | |
748 | | /* RD for this VRF */ |
749 | | struct prefix_rd vrf_prd; |
750 | | char *vrf_prd_pretty; |
751 | | |
752 | | /* import rt list for the vrf instance */ |
753 | | struct list *vrf_import_rtl; |
754 | | |
755 | | /* export rt list for the vrf instance */ |
756 | | struct list *vrf_export_rtl; |
757 | | |
758 | | /* list of corresponding l2vnis (struct bgpevpn) */ |
759 | | struct list *l2vnis; |
760 | | |
761 | | /* route map for advertise ipv4/ipv6 unicast (type-5 routes) */ |
762 | | struct bgp_rmap adv_cmd_rmap[AFI_MAX][SAFI_MAX]; |
763 | | |
764 | | struct vpn_policy vpn_policy[AFI_MAX]; |
765 | | |
766 | | struct bgp_pbr_config *bgp_pbr_cfg; |
767 | | |
768 | | /* Count of peers in established state */ |
769 | | uint32_t established_peers; |
770 | | |
771 | | /* Weighted ECMP related config. */ |
772 | | enum bgp_link_bw_handling lb_handling; |
773 | | |
774 | | /* Process Queue for handling routes */ |
775 | | struct work_queue *process_queue; |
776 | | |
777 | | bool fast_convergence; |
778 | | |
779 | | /* BGP Conditional advertisement */ |
780 | | uint32_t condition_check_period; |
781 | | uint32_t condition_filter_count; |
782 | | struct event *t_condition_check; |
783 | | |
784 | | /* BGP VPN SRv6 backend */ |
785 | | bool srv6_enabled; |
786 | | char srv6_locator_name[SRV6_LOCNAME_SIZE]; |
787 | | struct list *srv6_locator_chunks; |
788 | | struct list *srv6_functions; |
789 | | uint32_t tovpn_sid_index; /* unset => set to 0 */ |
790 | | struct in6_addr *tovpn_sid; |
791 | | struct srv6_locator_chunk *tovpn_sid_locator; |
792 | | uint32_t tovpn_sid_transpose_label; |
793 | | struct in6_addr *tovpn_zebra_vrf_sid_last_sent; |
794 | | |
795 | | /* TCP keepalive parameters for BGP connection */ |
796 | | uint16_t tcp_keepalive_idle; |
797 | | uint16_t tcp_keepalive_intvl; |
798 | | uint16_t tcp_keepalive_probes; |
799 | | |
800 | | struct timeval ebgprequirespolicywarning; |
801 | 0 | #define FIFTEENMINUTE2USEC (int64_t)15 * 60 * 1000000 |
802 | | |
803 | | bool allow_martian; |
804 | | |
805 | | enum asnotation_mode asnotation; |
806 | | |
807 | | QOBJ_FIELDS; |
808 | | }; |
809 | | DECLARE_QOBJ_TYPE(bgp); |
810 | | |
811 | | struct bgp_interface { |
812 | | #define BGP_INTERFACE_MPLS_BGP_FORWARDING (1 << 0) |
813 | | uint32_t flags; |
814 | | }; |
815 | | |
816 | | DECLARE_HOOK(bgp_inst_delete, (struct bgp *bgp), (bgp)); |
817 | | DECLARE_HOOK(bgp_inst_config_write, |
818 | | (struct bgp *bgp, struct vty *vty), |
819 | | (bgp, vty)); |
820 | | DECLARE_HOOK(bgp_config_end, (struct bgp *bgp), (bgp)); |
821 | | |
822 | | /* Thread callback information */ |
823 | | struct afi_safi_info { |
824 | | afi_t afi; |
825 | | safi_t safi; |
826 | | struct bgp *bgp; |
827 | | }; |
828 | | |
829 | | #define BGP_ROUTE_ADV_HOLD(bgp) (bgp->main_peers_update_hold) |
830 | | |
831 | | #define IS_BGP_INST_KNOWN_TO_ZEBRA(bgp) \ |
832 | 1 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT \ |
833 | 1 | || (bgp->inst_type == BGP_INSTANCE_TYPE_VRF \ |
834 | 0 | && bgp->vrf_id != VRF_UNKNOWN)) |
835 | | |
836 | | #define BGP_SELECT_DEFER_DISABLE(bgp) \ |
837 | 0 | (CHECK_FLAG(bgp->flags, BGP_FLAG_SELECT_DEFER_DISABLE)) |
838 | | |
839 | | #define BGP_SUPPRESS_FIB_ENABLED(bgp) \ |
840 | 0 | (CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING) \ |
841 | 0 | || bm->wait_for_fib) |
842 | | |
843 | | /* BGP peer-group support. */ |
844 | | struct peer_group { |
845 | | /* Name of the peer-group. */ |
846 | | char *name; |
847 | | |
848 | | /* Pointer to BGP. */ |
849 | | struct bgp *bgp; |
850 | | |
851 | | /* Peer-group client list. */ |
852 | | struct list *peer; |
853 | | |
854 | | /** Dynamic neighbor listening ranges */ |
855 | | struct list *listen_range[AFI_MAX]; |
856 | | |
857 | | /* Peer-group config */ |
858 | | struct peer *conf; |
859 | | }; |
860 | | |
861 | | /* BGP Notify message format. */ |
862 | | struct bgp_notify { |
863 | | uint8_t code; |
864 | | uint8_t subcode; |
865 | | char *data; |
866 | | bgp_size_t length; |
867 | | uint8_t *raw_data; |
868 | | bool hard_reset; |
869 | | }; |
870 | | |
871 | | /* Next hop self address. */ |
872 | | struct bgp_nexthop { |
873 | | struct interface *ifp; |
874 | | struct in_addr v4; |
875 | | struct in6_addr v6_global; |
876 | | struct in6_addr v6_local; |
877 | | }; |
878 | | |
879 | | /* BGP addpath values */ |
880 | 68 | #define BGP_ADDPATH_RX 1 |
881 | 68 | #define BGP_ADDPATH_TX 2 |
882 | 13.2k | #define BGP_ADDPATH_ID_LEN 4 |
883 | | |
884 | | #define BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE 1 |
885 | | |
886 | | /* Route map direction */ |
887 | 2.34k | #define RMAP_IN 0 |
888 | 0 | #define RMAP_OUT 1 |
889 | 0 | #define RMAP_MAX 2 |
890 | | |
891 | 2 | #define BGP_DEFAULT_TTL 1 |
892 | 0 | #define BGP_GTSM_HOPS_DISABLED 0 |
893 | 0 | #define BGP_GTSM_HOPS_CONNECTED 1 |
894 | | |
895 | | /* Advertise map */ |
896 | 0 | #define CONDITION_NON_EXIST false |
897 | 0 | #define CONDITION_EXIST true |
898 | | |
899 | | enum update_type { UPDATE_TYPE_WITHDRAW, UPDATE_TYPE_ADVERTISE }; |
900 | | |
901 | | #include "filter.h" |
902 | | |
903 | | /* BGP filter structure. */ |
904 | | struct bgp_filter { |
905 | | /* Distribute-list. */ |
906 | | struct { |
907 | | char *name; |
908 | | struct access_list *alist; |
909 | | } dlist[FILTER_MAX]; |
910 | | |
911 | | /* Prefix-list. */ |
912 | | struct { |
913 | | char *name; |
914 | | struct prefix_list *plist; |
915 | | } plist[FILTER_MAX]; |
916 | | |
917 | | /* Filter-list. */ |
918 | | struct { |
919 | | char *name; |
920 | | struct as_list *aslist; |
921 | | } aslist[FILTER_MAX]; |
922 | | |
923 | | /* Route-map. */ |
924 | | struct { |
925 | | char *name; |
926 | | struct route_map *map; |
927 | | } map[RMAP_MAX]; |
928 | | |
929 | | /* Unsuppress-map. */ |
930 | | struct { |
931 | | char *name; |
932 | | struct route_map *map; |
933 | | } usmap; |
934 | | |
935 | | /* Advertise-map */ |
936 | | struct { |
937 | | char *aname; |
938 | | struct route_map *amap; |
939 | | |
940 | | bool condition; |
941 | | |
942 | | char *cname; |
943 | | struct route_map *cmap; |
944 | | |
945 | | enum update_type update_type; |
946 | | } advmap; |
947 | | }; |
948 | | |
949 | | /* IBGP/EBGP identifier. We also have a CONFED peer, which is to say, |
950 | | a peer who's AS is part of our Confederation. */ |
951 | | enum bgp_peer_sort { |
952 | | BGP_PEER_UNSPECIFIED, |
953 | | BGP_PEER_IBGP, |
954 | | BGP_PEER_EBGP, |
955 | | BGP_PEER_INTERNAL, |
956 | | BGP_PEER_CONFED, |
957 | | }; |
958 | | |
959 | | /* BGP message header and packet size. */ |
960 | 18.9k | #define BGP_MARKER_SIZE 16 |
961 | 3.76k | #define BGP_HEADER_SIZE 19 |
962 | 14 | #define BGP_STANDARD_MESSAGE_MAX_PACKET_SIZE 4096 |
963 | 4 | #define BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE 65535 |
964 | 4 | #define BGP_MAX_PACKET_SIZE BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE |
965 | 0 | #define BGP_MAX_PACKET_SIZE_OVERFLOW 1024 |
966 | | |
967 | | /* |
968 | | * Trigger delay for bgp_announce_route(). |
969 | | */ |
970 | | #define BGP_ANNOUNCE_ROUTE_SHORT_DELAY_MS 100 |
971 | | #define BGP_ANNOUNCE_ROUTE_DELAY_MS 500 |
972 | | |
973 | | struct peer_af { |
974 | | /* back pointer to the peer */ |
975 | | struct peer *peer; |
976 | | |
977 | | /* which subgroup the peer_af belongs to */ |
978 | | struct update_subgroup *subgroup; |
979 | | |
980 | | /* for being part of an update subgroup's peer list */ |
981 | | LIST_ENTRY(peer_af) subgrp_train; |
982 | | |
983 | | /* for being part of a packet's peer list */ |
984 | | LIST_ENTRY(peer_af) pkt_train; |
985 | | |
986 | | struct bpacket *next_pkt_to_send; |
987 | | |
988 | | /* |
989 | | * Trigger timer for bgp_announce_route(). |
990 | | */ |
991 | | struct event *t_announce_route; |
992 | | |
993 | | afi_t afi; |
994 | | safi_t safi; |
995 | | int afid; |
996 | | }; |
997 | | /* BGP GR per peer ds */ |
998 | | |
999 | | #define BGP_PEER_GR_MODE 5 |
1000 | | #define BGP_PEER_GR_EVENT_CMD 6 |
1001 | | |
1002 | | enum peer_mode { |
1003 | | PEER_HELPER = 0, |
1004 | | PEER_GR, |
1005 | | PEER_DISABLE, |
1006 | | PEER_INVALID, |
1007 | | PEER_GLOBAL_INHERIT /* This is the default mode */ |
1008 | | |
1009 | | }; |
1010 | | |
1011 | | enum peer_gr_command { |
1012 | | PEER_GR_CMD = 0, |
1013 | | NO_PEER_GR_CMD, |
1014 | | PEER_DISABLE_CMD, |
1015 | | NO_PEER_DISABLE_CMD, |
1016 | | PEER_HELPER_CMD, |
1017 | | NO_PEER_HELPER_CMD |
1018 | | }; |
1019 | | |
1020 | | typedef unsigned int (*bgp_peer_gr_action_ptr)(struct peer *, int, int); |
1021 | | |
1022 | | struct bgp_peer_gr { |
1023 | | enum peer_mode next_state; |
1024 | | bgp_peer_gr_action_ptr action_fun; |
1025 | | }; |
1026 | | |
1027 | | /* |
1028 | | * BGP FSM event codes, per RFC 4271 ss. 8.1 |
1029 | | */ |
1030 | | enum bgp_fsm_rfc_codes { |
1031 | | BGP_FSM_ManualStart = 1, |
1032 | | BGP_FSM_ManualStop = 2, |
1033 | | BGP_FSM_AutomaticStart = 3, |
1034 | | BGP_FSM_ManualStart_with_PassiveTcpEstablishment = 4, |
1035 | | BGP_FSM_AutomaticStart_with_PassiveTcpEstablishment = 5, |
1036 | | BGP_FSM_AutomaticStart_with_DampPeerOscillations = 6, |
1037 | | BGP_FSM_AutomaticStart_with_DampPeerOscillations_and_PassiveTcpEstablishment = |
1038 | | 7, |
1039 | | BGP_FSM_AutomaticStop = 8, |
1040 | | BGP_FSM_ConnectRetryTimer_Expires = 9, |
1041 | | BGP_FSM_HoldTimer_Expires = 10, |
1042 | | BGP_FSM_KeepaliveTimer_Expires = 11, |
1043 | | BGP_FSM_DelayOpenTimer_Expires = 12, |
1044 | | BGP_FSM_IdleHoldTimer_Expires = 13, |
1045 | | BGP_FSM_TcpConnection_Valid = 14, |
1046 | | BGP_FSM_Tcp_CR_Invalid = 15, |
1047 | | BGP_FSM_Tcp_CR_Acked = 16, |
1048 | | BGP_FSM_TcpConnectionConfirmed = 17, |
1049 | | BGP_FSM_TcpConnectionFails = 18, |
1050 | | BGP_FSM_BGPOpen = 19, |
1051 | | BGP_FSM_BGPOpen_with_DelayOpenTimer_running = 20, |
1052 | | BGP_FSM_BGPHeaderErr = 21, |
1053 | | BGP_FSM_BGPOpenMsgErr = 22, |
1054 | | BGP_FSM_OpenCollisionDump = 23, |
1055 | | BGP_FSM_NotifMsgVerErr = 24, |
1056 | | BGP_FSM_NotifMsg = 25, |
1057 | | BGP_FSM_KeepAliveMsg = 26, |
1058 | | BGP_FSM_UpdateMsg = 27, |
1059 | | BGP_FSM_UpdateMsgErr = 28 |
1060 | | }; |
1061 | | |
1062 | | /* |
1063 | | * BGP finite state machine events |
1064 | | * |
1065 | | * Note: these do not correspond to RFC-defined event codes. Those are |
1066 | | * defined elsewhere. |
1067 | | */ |
1068 | | enum bgp_fsm_events { |
1069 | | BGP_Start = 1, |
1070 | | BGP_Stop, |
1071 | | TCP_connection_open, |
1072 | | TCP_connection_open_w_delay, |
1073 | | TCP_connection_closed, |
1074 | | TCP_connection_open_failed, |
1075 | | TCP_fatal_error, |
1076 | | ConnectRetry_timer_expired, |
1077 | | Hold_Timer_expired, |
1078 | | KeepAlive_timer_expired, |
1079 | | DelayOpen_timer_expired, |
1080 | | Receive_OPEN_message, |
1081 | | Receive_KEEPALIVE_message, |
1082 | | Receive_UPDATE_message, |
1083 | | Receive_NOTIFICATION_message, |
1084 | | Clearing_Completed, |
1085 | | BGP_EVENTS_MAX, |
1086 | | }; |
1087 | | |
1088 | | /* BGP finite state machine status. */ |
1089 | | enum bgp_fsm_status { |
1090 | | Idle = 1, |
1091 | | Connect, |
1092 | | Active, |
1093 | | OpenSent, |
1094 | | OpenConfirm, |
1095 | | Established, |
1096 | | Clearing, |
1097 | | Deleted, |
1098 | | BGP_STATUS_MAX, |
1099 | | }; |
1100 | | |
1101 | | #define PEER_HOSTNAME(peer) ((peer)->host ? (peer)->host : "(unknown peer)") |
1102 | | |
1103 | | struct llgr_info { |
1104 | | uint32_t stale_time; |
1105 | | uint8_t flags; |
1106 | | }; |
1107 | | |
1108 | | /* BGP neighbor structure. */ |
1109 | | struct peer { |
1110 | | /* BGP structure. */ |
1111 | | struct bgp *bgp; |
1112 | | |
1113 | | /* reference count, primarily to allow bgp_process'ing of route_node's |
1114 | | * to be done after a struct peer is deleted. |
1115 | | * |
1116 | | * named 'lock' for hysterical reasons within Quagga. |
1117 | | */ |
1118 | | int lock; |
1119 | | |
1120 | | /* BGP peer group. */ |
1121 | | struct peer_group *group; |
1122 | | |
1123 | | /* BGP peer_af structures, per configured AF on this peer */ |
1124 | | struct peer_af *peer_af_array[BGP_AF_MAX]; |
1125 | | |
1126 | | /* Peer's remote AS number. */ |
1127 | | int as_type; |
1128 | | as_t as; |
1129 | | /* for vty as format */ |
1130 | | char *as_pretty; |
1131 | | |
1132 | | /* Peer's local AS number. */ |
1133 | | as_t local_as; |
1134 | | |
1135 | | enum bgp_peer_sort sort; |
1136 | | |
1137 | | /* Peer's Change local AS number. */ |
1138 | | as_t change_local_as; |
1139 | | /* for vty as format */ |
1140 | | char *change_local_as_pretty; |
1141 | | |
1142 | | /* Remote router ID. */ |
1143 | | struct in_addr remote_id; |
1144 | | |
1145 | | /* Local router ID. */ |
1146 | | struct in_addr local_id; |
1147 | | |
1148 | | /* Packet receive and send buffer. */ |
1149 | | pthread_mutex_t io_mtx; // guards ibuf, obuf |
1150 | | struct stream_fifo *ibuf; // packets waiting to be processed |
1151 | | struct stream_fifo *obuf; // packets waiting to be written |
1152 | | |
1153 | | struct ringbuf *ibuf_work; // WiP buffer used by bgp_read() only |
1154 | | |
1155 | | struct stream *curr; // the current packet being parsed |
1156 | | |
1157 | | /* the doppelganger peer structure, due to dual TCP conn setup */ |
1158 | | struct peer *doppelganger; |
1159 | | |
1160 | | /* Status of the peer. */ |
1161 | | enum bgp_fsm_status status; |
1162 | | enum bgp_fsm_status ostatus; |
1163 | | |
1164 | | /* FSM events, stored for debug purposes. |
1165 | | * Note: uchar used for reduced memory usage. |
1166 | | */ |
1167 | | enum bgp_fsm_events cur_event; |
1168 | | enum bgp_fsm_events last_event; |
1169 | | enum bgp_fsm_events last_major_event; |
1170 | | |
1171 | | /* Peer index, used for dumping TABLE_DUMP_V2 format */ |
1172 | | uint16_t table_dump_index; |
1173 | | |
1174 | | /* Peer information */ |
1175 | | int fd; /* File descriptor */ |
1176 | | int ttl; /* TTL of TCP connection to the peer. */ |
1177 | | int rtt; /* Estimated round-trip-time from TCP_INFO */ |
1178 | | int rtt_expected; /* Expected round-trip-time for a peer */ |
1179 | | uint8_t rtt_keepalive_rcv; /* Received count for RTT shutdown */ |
1180 | | uint8_t rtt_keepalive_conf; /* Configured count for RTT shutdown */ |
1181 | | int gtsm_hops; /* minimum hopcount to peer */ |
1182 | | char *desc; /* Description of the peer. */ |
1183 | | unsigned short port; /* Destination port for peer */ |
1184 | | char *host; /* Printable address of the peer. */ |
1185 | | union sockunion su; /* Sockunion address of the peer. */ |
1186 | 4 | #define BGP_PEER_SU_UNSPEC(peer) (peer->su.sa.sa_family == AF_UNSPEC) |
1187 | | time_t uptime; /* Last Up/Down time */ |
1188 | | time_t readtime; /* Last read time */ |
1189 | | time_t resettime; /* Last reset time */ |
1190 | | |
1191 | | char *conf_if; /* neighbor interface config name. */ |
1192 | | struct interface *ifp; /* corresponding interface */ |
1193 | | char *ifname; /* bind interface name. */ |
1194 | | char *update_if; |
1195 | | union sockunion *update_source; |
1196 | | |
1197 | | union sockunion *su_local; /* Sockunion of local address. */ |
1198 | | union sockunion *su_remote; /* Sockunion of remote address. */ |
1199 | | int shared_network; /* Is this peer shared same network. */ |
1200 | | struct bgp_nexthop nexthop; /* Nexthop */ |
1201 | | |
1202 | | /* Roles in bgp session */ |
1203 | | uint8_t local_role; |
1204 | | uint8_t remote_role; |
1205 | 0 | #define ROLE_PROVIDER 0 |
1206 | 0 | #define ROLE_RS_SERVER 1 |
1207 | 0 | #define ROLE_RS_CLIENT 2 |
1208 | 0 | #define ROLE_CUSTOMER 3 |
1209 | 0 | #define ROLE_PEER 4 |
1210 | 34 | #define ROLE_UNDEFINED 255 |
1211 | | |
1212 | | #define ROLE_NAME_MAX_LEN 20 |
1213 | | |
1214 | | /* Peer address family configuration. */ |
1215 | | uint8_t afc[AFI_MAX][SAFI_MAX]; |
1216 | | uint8_t afc_nego[AFI_MAX][SAFI_MAX]; |
1217 | | uint8_t afc_adv[AFI_MAX][SAFI_MAX]; |
1218 | | uint8_t afc_recv[AFI_MAX][SAFI_MAX]; |
1219 | | |
1220 | | /* Capability flags (reset in bgp_stop) */ |
1221 | | uint32_t cap; |
1222 | | #define PEER_CAP_REFRESH_ADV (1U << 0) /* refresh advertised */ |
1223 | | #define PEER_CAP_REFRESH_OLD_RCV (1U << 1) /* refresh old received */ |
1224 | | #define PEER_CAP_REFRESH_NEW_RCV (1U << 2) /* refresh rfc received */ |
1225 | | #define PEER_CAP_DYNAMIC_ADV (1U << 3) /* dynamic advertised */ |
1226 | | #define PEER_CAP_DYNAMIC_RCV (1U << 4) /* dynamic received */ |
1227 | | #define PEER_CAP_RESTART_ADV (1U << 5) /* restart advertised */ |
1228 | | #define PEER_CAP_RESTART_RCV (1U << 6) /* restart received */ |
1229 | | #define PEER_CAP_AS4_ADV (1U << 7) /* as4 advertised */ |
1230 | 0 | #define PEER_CAP_AS4_RCV (1U << 8) /* as4 received */ |
1231 | | /* sent graceful-restart restart (R) bit */ |
1232 | | #define PEER_CAP_GRACEFUL_RESTART_R_BIT_ADV (1U << 9) |
1233 | | /* received graceful-restart restart (R) bit */ |
1234 | | #define PEER_CAP_GRACEFUL_RESTART_R_BIT_RCV (1U << 10) |
1235 | | #define PEER_CAP_ADDPATH_ADV (1U << 11) /* addpath advertised */ |
1236 | | #define PEER_CAP_ADDPATH_RCV (1U << 12) /* addpath received */ |
1237 | | #define PEER_CAP_ENHE_ADV (1U << 13) /* Extended nexthop advertised */ |
1238 | | #define PEER_CAP_ENHE_RCV (1U << 14) /* Extended nexthop received */ |
1239 | | #define PEER_CAP_HOSTNAME_ADV (1U << 15) /* hostname advertised */ |
1240 | | #define PEER_CAP_HOSTNAME_RCV (1U << 16) /* hostname received */ |
1241 | | #define PEER_CAP_ENHANCED_RR_ADV (1U << 17) /* enhanced rr advertised */ |
1242 | | #define PEER_CAP_ENHANCED_RR_RCV (1U << 18) /* enhanced rr received */ |
1243 | | #define PEER_CAP_EXTENDED_MESSAGE_ADV (1U << 19) |
1244 | | #define PEER_CAP_EXTENDED_MESSAGE_RCV (1U << 20) |
1245 | | #define PEER_CAP_LLGR_ADV (1U << 21) |
1246 | | #define PEER_CAP_LLGR_RCV (1U << 22) |
1247 | | /* sent graceful-restart notification (N) bit */ |
1248 | | #define PEER_CAP_GRACEFUL_RESTART_N_BIT_ADV (1U << 23) |
1249 | | /* received graceful-restart notification (N) bit */ |
1250 | | #define PEER_CAP_GRACEFUL_RESTART_N_BIT_RCV (1U << 24) |
1251 | | #define PEER_CAP_ROLE_ADV (1U << 25) /* role advertised */ |
1252 | | #define PEER_CAP_ROLE_RCV (1U << 26) /* role received */ |
1253 | | #define PEER_CAP_SOFT_VERSION_ADV (1U << 27) |
1254 | | #define PEER_CAP_SOFT_VERSION_RCV (1U << 28) |
1255 | | |
1256 | | /* Capability flags (reset in bgp_stop) */ |
1257 | | uint32_t af_cap[AFI_MAX][SAFI_MAX]; |
1258 | 0 | #define PEER_CAP_ORF_PREFIX_SM_ADV (1U << 0) /* send-mode advertised */ |
1259 | 0 | #define PEER_CAP_ORF_PREFIX_RM_ADV (1U << 1) /* receive-mode advertised */ |
1260 | 0 | #define PEER_CAP_ORF_PREFIX_SM_RCV (1U << 2) /* send-mode received */ |
1261 | 0 | #define PEER_CAP_ORF_PREFIX_RM_RCV (1U << 3) /* receive-mode received */ |
1262 | 0 | #define PEER_CAP_ORF_PREFIX_SM_OLD_RCV (1U << 4) /* send-mode received */ |
1263 | 0 | #define PEER_CAP_ORF_PREFIX_RM_OLD_RCV (1U << 5) /* receive-mode received */ |
1264 | | #define PEER_CAP_RESTART_AF_RCV (1U << 6) /* graceful restart afi/safi received */ |
1265 | | #define PEER_CAP_RESTART_AF_PRESERVE_RCV (1U << 7) /* graceful restart afi/safi F-bit received */ |
1266 | 0 | #define PEER_CAP_ADDPATH_AF_TX_ADV (1U << 8) /* addpath tx advertised */ |
1267 | | #define PEER_CAP_ADDPATH_AF_TX_RCV (1U << 9) /* addpath tx received */ |
1268 | | #define PEER_CAP_ADDPATH_AF_RX_ADV (1U << 10) /* addpath rx advertised */ |
1269 | 0 | #define PEER_CAP_ADDPATH_AF_RX_RCV (1U << 11) /* addpath rx received */ |
1270 | | #define PEER_CAP_ENHE_AF_ADV (1U << 12) /* Extended nexthopi afi/safi advertised */ |
1271 | | #define PEER_CAP_ENHE_AF_RCV (1U << 13) /* Extended nexthop afi/safi received */ |
1272 | 0 | #define PEER_CAP_ENHE_AF_NEGO (1U << 14) /* Extended nexthop afi/safi negotiated */ |
1273 | | #define PEER_CAP_LLGR_AF_ADV (1U << 15) |
1274 | | #define PEER_CAP_LLGR_AF_RCV (1U << 16) |
1275 | | |
1276 | | /* Global configuration flags. */ |
1277 | | /* |
1278 | | * Parallel array to flags that indicates whether each flag originates |
1279 | | * from a peer-group or if it is config that is specific to this |
1280 | | * individual peer. If a flag is set independent of the peer-group, the |
1281 | | * same bit should be set here. If this peer is a peer-group, this |
1282 | | * memory region should be all zeros. |
1283 | | * |
1284 | | * The assumption is that the default state for all flags is unset, |
1285 | | * so if a flag is unset, the corresponding override flag is unset too. |
1286 | | * However if a flag is set, the corresponding override flag is set. |
1287 | | */ |
1288 | | uint64_t flags_override; |
1289 | | /* |
1290 | | * Parallel array to flags that indicates whether the default behavior |
1291 | | * of *flags_override* should be inverted. If a flag is unset and the |
1292 | | * corresponding invert flag is set, the corresponding override flag |
1293 | | * would be set. However if a flag is set and the corresponding invert |
1294 | | * flag is unset, the corresponding override flag would be unset. |
1295 | | * |
1296 | | * This can be used for attributes like *send-community*, which are |
1297 | | * implicitely enabled and have to be disabled explicitely, compared to |
1298 | | * 'normal' attributes like *next-hop-self* which are implicitely set. |
1299 | | * |
1300 | | * All operations dealing with flags should apply the following boolean |
1301 | | * logic to keep the internal flag system in a sane state: |
1302 | | * |
1303 | | * value=0 invert=0 Inherit flag if member, otherwise unset flag |
1304 | | * value=0 invert=1 Unset flag unconditionally |
1305 | | * value=1 invert=0 Set flag unconditionally |
1306 | | * value=1 invert=1 Inherit flag if member, otherwise set flag |
1307 | | * |
1308 | | * Contrary to the implementation of *flags_override*, the flag |
1309 | | * inversion state can be set either on the peer OR the peer *and* the |
1310 | | * peer-group. This was done on purpose, as the inversion state of a |
1311 | | * flag can be determined on either the peer or the peer-group. |
1312 | | * |
1313 | | * Example: Enabling the cisco configuration mode inverts all flags |
1314 | | * related to *send-community* unconditionally for both peer-groups and |
1315 | | * peers. |
1316 | | * |
1317 | | * This behavior is different for interface peers though, which enable |
1318 | | * the *extended-nexthop* flag by default, which regular peers do not. |
1319 | | * As the peer-group can contain both regular and interface peers, the |
1320 | | * flag inversion state must be set on the peer only. |
1321 | | * |
1322 | | * When a peer inherits the configuration from a peer-group and the |
1323 | | * inversion state of the flag differs between peer and peer-group, the |
1324 | | * newly set value must equal to the inverted state of the peer-group. |
1325 | | */ |
1326 | | uint64_t flags_invert; |
1327 | | /* |
1328 | | * Effective array for storing the peer/peer-group flags. In case of a |
1329 | | * peer-group, the peer-specific overrides (see flags_override and |
1330 | | * flags_invert) must be respected. |
1331 | | * When changing the structure of flags/af_flags, do not forget to |
1332 | | * change flags_invert/flags_override too. |
1333 | | */ |
1334 | | uint64_t flags; |
1335 | 0 | #define PEER_FLAG_PASSIVE (1ULL << 0) /* passive mode */ |
1336 | 0 | #define PEER_FLAG_SHUTDOWN (1ULL << 1) /* shutdown */ |
1337 | 0 | #define PEER_FLAG_DONT_CAPABILITY (1ULL << 2) /* dont-capability */ |
1338 | 0 | #define PEER_FLAG_OVERRIDE_CAPABILITY (1ULL << 3) /* override-capability */ |
1339 | 0 | #define PEER_FLAG_STRICT_CAP_MATCH (1ULL << 4) /* strict-match */ |
1340 | 0 | #define PEER_FLAG_DYNAMIC_CAPABILITY (1ULL << 5) /* dynamic capability */ |
1341 | 0 | #define PEER_FLAG_DISABLE_CONNECTED_CHECK (1ULL << 6) /* disable-connected-check */ |
1342 | 0 | #define PEER_FLAG_LOCAL_AS_NO_PREPEND (1ULL << 7) /* local-as no-prepend */ |
1343 | 0 | #define PEER_FLAG_LOCAL_AS_REPLACE_AS (1ULL << 8) /* local-as no-prepend replace-as */ |
1344 | | #define PEER_FLAG_DELETE (1ULL << 9) /* mark the peer for deleting */ |
1345 | | #define PEER_FLAG_CONFIG_NODE (1ULL << 10) /* the node to update configs on */ |
1346 | | #define PEER_FLAG_LONESOUL (1ULL << 11) |
1347 | | #define PEER_FLAG_DYNAMIC_NEIGHBOR (1ULL << 12) /* dynamic neighbor */ |
1348 | 0 | #define PEER_FLAG_CAPABILITY_ENHE (1ULL << 13) /* Extended next-hop (rfc 5549)*/ |
1349 | 0 | #define PEER_FLAG_IFPEER_V6ONLY (1ULL << 14) /* if-based peer is v6 only */ |
1350 | | #define PEER_FLAG_IS_RFAPI_HD (1ULL << 15) /* attached to rfapi HD */ |
1351 | 0 | #define PEER_FLAG_ENFORCE_FIRST_AS (1ULL << 16) /* enforce-first-as */ |
1352 | 0 | #define PEER_FLAG_ROUTEADV (1ULL << 17) /* route advertise */ |
1353 | 0 | #define PEER_FLAG_TIMER (1ULL << 18) /* keepalive & holdtime */ |
1354 | 0 | #define PEER_FLAG_TIMER_CONNECT (1ULL << 19) /* connect timer */ |
1355 | 0 | #define PEER_FLAG_PASSWORD (1ULL << 20) /* password */ |
1356 | 0 | #define PEER_FLAG_LOCAL_AS (1ULL << 21) /* local-as */ |
1357 | 0 | #define PEER_FLAG_UPDATE_SOURCE (1ULL << 22) /* update-source */ |
1358 | | |
1359 | | /* BGP-GR Peer related flags */ |
1360 | | #define PEER_FLAG_GRACEFUL_RESTART_HELPER (1ULL << 23) /* Helper */ |
1361 | | #define PEER_FLAG_GRACEFUL_RESTART (1ULL << 24) /* Graceful Restart */ |
1362 | | #define PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT (1ULL << 25) /* Global-Inherit */ |
1363 | 0 | #define PEER_FLAG_RTT_SHUTDOWN (1ULL << 26) /* shutdown rtt */ |
1364 | 0 | #define PEER_FLAG_TIMER_DELAYOPEN (1ULL << 27) /* delayopen timer */ |
1365 | | #define PEER_FLAG_TCP_MSS (1ULL << 28) /* tcp-mss */ |
1366 | | /* Disable IEEE floating-point link bandwidth encoding in |
1367 | | * extended communities. |
1368 | | */ |
1369 | 0 | #define PEER_FLAG_DISABLE_LINK_BW_ENCODING_IEEE (1ULL << 29) |
1370 | | /* force the extended format for Optional Parameters in OPEN message */ |
1371 | 0 | #define PEER_FLAG_EXTENDED_OPT_PARAMS (1ULL << 30) |
1372 | | |
1373 | | /* BGP Open Policy flags. |
1374 | | * Enforce using roles on both sides: |
1375 | | * `local-role ROLE strict-mode` configured. |
1376 | | */ |
1377 | | #define PEER_FLAG_ROLE_STRICT_MODE (1ULL << 31) |
1378 | | /* `local-role` configured */ |
1379 | 0 | #define PEER_FLAG_ROLE (1ULL << 32) |
1380 | 0 | #define PEER_FLAG_PORT (1ULL << 33) |
1381 | 0 | #define PEER_FLAG_AIGP (1ULL << 34) |
1382 | 0 | #define PEER_FLAG_GRACEFUL_SHUTDOWN (1ULL << 35) |
1383 | 0 | #define PEER_FLAG_CAPABILITY_SOFT_VERSION (1ULL << 36) |
1384 | | |
1385 | | /* |
1386 | | *GR-Disabled mode means unset PEER_FLAG_GRACEFUL_RESTART |
1387 | | *& PEER_FLAG_GRACEFUL_RESTART_HELPER |
1388 | | *and PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT |
1389 | | */ |
1390 | | |
1391 | | struct bgp_peer_gr PEER_GR_FSM[BGP_PEER_GR_MODE][BGP_PEER_GR_EVENT_CMD]; |
1392 | | enum peer_mode peer_gr_present_state; |
1393 | | /* Non stop forwarding afi-safi count for BGP gr feature*/ |
1394 | | uint8_t nsf_af_count; |
1395 | | |
1396 | | uint8_t peer_gr_new_status_flag; |
1397 | | #define PEER_GRACEFUL_RESTART_NEW_STATE_HELPER (1U << 0) |
1398 | | #define PEER_GRACEFUL_RESTART_NEW_STATE_RESTART (1U << 1) |
1399 | | #define PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT (1U << 2) |
1400 | | |
1401 | | /* outgoing message sent in CEASE_ADMIN_SHUTDOWN notify */ |
1402 | | char *tx_shutdown_message; |
1403 | | |
1404 | | /* NSF mode (graceful restart) */ |
1405 | | uint8_t nsf[AFI_MAX][SAFI_MAX]; |
1406 | | /* EOR Send time */ |
1407 | | time_t eor_stime[AFI_MAX][SAFI_MAX]; |
1408 | | /* Last update packet sent time */ |
1409 | | time_t pkt_stime[AFI_MAX][SAFI_MAX]; |
1410 | | |
1411 | | /* Peer Per AF flags */ |
1412 | | /* |
1413 | | * Please consult the comments for *flags_override*, *flags_invert* and |
1414 | | * *flags* to understand what these three arrays do. The address-family |
1415 | | * specific attributes are being treated the exact same way as global |
1416 | | * peer attributes. |
1417 | | */ |
1418 | | uint64_t af_flags_override[AFI_MAX][SAFI_MAX]; |
1419 | | uint64_t af_flags_invert[AFI_MAX][SAFI_MAX]; |
1420 | | uint64_t af_flags[AFI_MAX][SAFI_MAX]; |
1421 | 0 | #define PEER_FLAG_SEND_COMMUNITY (1ULL << 0) |
1422 | 0 | #define PEER_FLAG_SEND_EXT_COMMUNITY (1ULL << 1) |
1423 | 0 | #define PEER_FLAG_NEXTHOP_SELF (1ULL << 2) |
1424 | 0 | #define PEER_FLAG_REFLECTOR_CLIENT (1ULL << 3) |
1425 | 0 | #define PEER_FLAG_RSERVER_CLIENT (1ULL << 4) |
1426 | 0 | #define PEER_FLAG_SOFT_RECONFIG (1ULL << 5) |
1427 | 0 | #define PEER_FLAG_AS_PATH_UNCHANGED (1ULL << 6) |
1428 | 0 | #define PEER_FLAG_NEXTHOP_UNCHANGED (1ULL << 7) |
1429 | 0 | #define PEER_FLAG_MED_UNCHANGED (1ULL << 8) |
1430 | 0 | #define PEER_FLAG_DEFAULT_ORIGINATE (1ULL << 9) |
1431 | 0 | #define PEER_FLAG_REMOVE_PRIVATE_AS (1ULL << 10) |
1432 | 0 | #define PEER_FLAG_ALLOWAS_IN (1ULL << 11) |
1433 | 0 | #define PEER_FLAG_ORF_PREFIX_SM (1ULL << 12) |
1434 | 0 | #define PEER_FLAG_ORF_PREFIX_RM (1ULL << 13) |
1435 | 0 | #define PEER_FLAG_MAX_PREFIX (1ULL << 14) |
1436 | 0 | #define PEER_FLAG_MAX_PREFIX_WARNING (1ULL << 15) |
1437 | 0 | #define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1ULL << 16) |
1438 | 0 | #define PEER_FLAG_FORCE_NEXTHOP_SELF (1ULL << 17) |
1439 | 0 | #define PEER_FLAG_REMOVE_PRIVATE_AS_ALL (1ULL << 18) |
1440 | 0 | #define PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE (1ULL << 19) |
1441 | 0 | #define PEER_FLAG_AS_OVERRIDE (1ULL << 20) |
1442 | 0 | #define PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE (1ULL << 21) |
1443 | 0 | #define PEER_FLAG_WEIGHT (1ULL << 22) |
1444 | 0 | #define PEER_FLAG_ALLOWAS_IN_ORIGIN (1ULL << 23) |
1445 | 0 | #define PEER_FLAG_SEND_LARGE_COMMUNITY (1ULL << 24) |
1446 | 0 | #define PEER_FLAG_MAX_PREFIX_OUT (1ULL << 25) |
1447 | 0 | #define PEER_FLAG_MAX_PREFIX_FORCE (1ULL << 26) |
1448 | 0 | #define PEER_FLAG_DISABLE_ADDPATH_RX (1ULL << 27) |
1449 | 0 | #define PEER_FLAG_SOO (1ULL << 28) |
1450 | 0 | #define PEER_FLAG_ACCEPT_OWN (1ULL << 63) |
1451 | | |
1452 | | enum bgp_addpath_strat addpath_type[AFI_MAX][SAFI_MAX]; |
1453 | | |
1454 | | /* MD5 password */ |
1455 | | char *password; |
1456 | | |
1457 | | /* default-originate route-map. */ |
1458 | | struct { |
1459 | | char *name; |
1460 | | struct route_map *map; |
1461 | | } default_rmap[AFI_MAX][SAFI_MAX]; |
1462 | | |
1463 | | /* Peer status flags. */ |
1464 | | uint16_t sflags; |
1465 | | #define PEER_STATUS_ACCEPT_PEER (1U << 0) /* accept peer */ |
1466 | | #define PEER_STATUS_PREFIX_OVERFLOW (1U << 1) /* prefix-overflow */ |
1467 | | #define PEER_STATUS_CAPABILITY_OPEN (1U << 2) /* capability open send */ |
1468 | | #define PEER_STATUS_HAVE_ACCEPT (1U << 3) /* accept peer's parent */ |
1469 | | #define PEER_STATUS_GROUP (1U << 4) /* peer-group conf */ |
1470 | | #define PEER_STATUS_NSF_MODE (1U << 5) /* NSF aware peer */ |
1471 | | #define PEER_STATUS_NSF_WAIT (1U << 6) /* wait comeback peer */ |
1472 | | /* received extended format encoding for OPEN message */ |
1473 | | #define PEER_STATUS_EXT_OPT_PARAMS_LENGTH (1U << 7) |
1474 | | |
1475 | | /* Peer status af flags (reset in bgp_stop) */ |
1476 | | uint16_t af_sflags[AFI_MAX][SAFI_MAX]; |
1477 | | #define PEER_STATUS_ORF_PREFIX_SEND (1U << 0) /* prefix-list send peer */ |
1478 | | #define PEER_STATUS_ORF_WAIT_REFRESH (1U << 1) /* wait refresh received peer */ |
1479 | | #define PEER_STATUS_PREFIX_THRESHOLD (1U << 2) /* exceed prefix-threshold */ |
1480 | | #define PEER_STATUS_PREFIX_LIMIT (1U << 3) /* exceed prefix-limit */ |
1481 | | #define PEER_STATUS_EOR_SEND (1U << 4) /* end-of-rib send to peer */ |
1482 | | #define PEER_STATUS_EOR_RECEIVED (1U << 5) /* end-of-rib received from peer */ |
1483 | | #define PEER_STATUS_ENHANCED_REFRESH (1U << 6) /* Enhanced Route Refresh */ |
1484 | | #define PEER_STATUS_BORR_SEND (1U << 7) /* BoRR send to peer */ |
1485 | | #define PEER_STATUS_BORR_RECEIVED (1U << 8) /* BoRR received from peer */ |
1486 | | #define PEER_STATUS_EORR_SEND (1U << 9) /* EoRR send to peer */ |
1487 | | #define PEER_STATUS_EORR_RECEIVED (1U << 10) /* EoRR received from peer */ |
1488 | | /* LLGR aware peer */ |
1489 | | #define PEER_STATUS_LLGR_WAIT (1U << 11) |
1490 | | #define PEER_STATUS_REFRESH_PENDING (1U << 12) /* refresh request from peer */ |
1491 | | #define PEER_STATUS_RTT_SHUTDOWN (1U << 13) /* In shutdown state due to RTT */ |
1492 | | |
1493 | | /* Configured timer values. */ |
1494 | | _Atomic uint32_t holdtime; |
1495 | | _Atomic uint32_t keepalive; |
1496 | | _Atomic uint32_t connect; |
1497 | | _Atomic uint32_t routeadv; |
1498 | | _Atomic uint32_t delayopen; |
1499 | | |
1500 | | /* Timer values. */ |
1501 | | _Atomic uint32_t v_start; |
1502 | | _Atomic uint32_t v_connect; |
1503 | | _Atomic uint32_t v_holdtime; |
1504 | | _Atomic uint32_t v_keepalive; |
1505 | | _Atomic uint32_t v_routeadv; |
1506 | | _Atomic uint32_t v_delayopen; |
1507 | | _Atomic uint32_t v_pmax_restart; |
1508 | | _Atomic uint32_t v_gr_restart; |
1509 | | |
1510 | | /* Threads. */ |
1511 | | struct event *t_read; |
1512 | | struct event *t_write; |
1513 | | struct event *t_start; |
1514 | | struct event *t_connect_check_r; |
1515 | | struct event *t_connect_check_w; |
1516 | | struct event *t_connect; |
1517 | | struct event *t_holdtime; |
1518 | | struct event *t_routeadv; |
1519 | | struct event *t_delayopen; |
1520 | | struct event *t_pmax_restart; |
1521 | | struct event *t_gr_restart; |
1522 | | struct event *t_gr_stale; |
1523 | | struct event *t_llgr_stale[AFI_MAX][SAFI_MAX]; |
1524 | | struct event *t_revalidate_all[AFI_MAX][SAFI_MAX]; |
1525 | | struct event *t_generate_updgrp_packets; |
1526 | | struct event *t_process_packet; |
1527 | | struct event *t_process_packet_error; |
1528 | | struct event *t_refresh_stalepath; |
1529 | | |
1530 | | /* Thread flags. */ |
1531 | | _Atomic uint32_t thread_flags; |
1532 | | #define PEER_THREAD_WRITES_ON (1U << 0) |
1533 | | #define PEER_THREAD_READS_ON (1U << 1) |
1534 | | #define PEER_THREAD_KEEPALIVES_ON (1U << 2) |
1535 | | #define PEER_THREAD_SUBGRP_ADV_DELAY (1U << 3) |
1536 | | |
1537 | | /* workqueues */ |
1538 | | struct work_queue *clear_node_queue; |
1539 | | |
1540 | | #define PEER_TOTAL_RX(peer) \ |
1541 | 0 | atomic_load_explicit(&peer->open_in, memory_order_relaxed) \ |
1542 | 0 | + atomic_load_explicit(&peer->update_in, memory_order_relaxed) \ |
1543 | 0 | + atomic_load_explicit(&peer->notify_in, memory_order_relaxed) \ |
1544 | 0 | + atomic_load_explicit(&peer->refresh_in, \ |
1545 | 0 | memory_order_relaxed) \ |
1546 | 0 | + atomic_load_explicit(&peer->keepalive_in, \ |
1547 | 0 | memory_order_relaxed) \ |
1548 | 0 | + atomic_load_explicit(&peer->dynamic_cap_in, \ |
1549 | 0 | memory_order_relaxed) |
1550 | | |
1551 | | #define PEER_TOTAL_TX(peer) \ |
1552 | 0 | atomic_load_explicit(&peer->open_out, memory_order_relaxed) \ |
1553 | 0 | + atomic_load_explicit(&peer->update_out, \ |
1554 | 0 | memory_order_relaxed) \ |
1555 | 0 | + atomic_load_explicit(&peer->notify_out, \ |
1556 | 0 | memory_order_relaxed) \ |
1557 | 0 | + atomic_load_explicit(&peer->refresh_out, \ |
1558 | 0 | memory_order_relaxed) \ |
1559 | 0 | + atomic_load_explicit(&peer->keepalive_out, \ |
1560 | 0 | memory_order_relaxed) \ |
1561 | 0 | + atomic_load_explicit(&peer->dynamic_cap_out, \ |
1562 | 0 | memory_order_relaxed) |
1563 | | |
1564 | | /* Statistics field */ |
1565 | | _Atomic uint32_t open_in; /* Open message input count */ |
1566 | | _Atomic uint32_t open_out; /* Open message output count */ |
1567 | | _Atomic uint32_t update_in; /* Update message input count */ |
1568 | | _Atomic uint32_t update_out; /* Update message ouput count */ |
1569 | | _Atomic time_t update_time; /* Update message received time. */ |
1570 | | _Atomic uint32_t keepalive_in; /* Keepalive input count */ |
1571 | | _Atomic uint32_t keepalive_out; /* Keepalive output count */ |
1572 | | _Atomic uint32_t notify_in; /* Notify input count */ |
1573 | | _Atomic uint32_t notify_out; /* Notify output count */ |
1574 | | _Atomic uint32_t refresh_in; /* Route Refresh input count */ |
1575 | | _Atomic uint32_t refresh_out; /* Route Refresh output count */ |
1576 | | _Atomic uint32_t dynamic_cap_in; /* Dynamic Capability input count. */ |
1577 | | _Atomic uint32_t dynamic_cap_out; /* Dynamic Capability output count. */ |
1578 | | |
1579 | | uint32_t stat_pfx_filter; |
1580 | | uint32_t stat_pfx_aspath_loop; |
1581 | | uint32_t stat_pfx_originator_loop; |
1582 | | uint32_t stat_pfx_cluster_loop; |
1583 | | uint32_t stat_pfx_nh_invalid; |
1584 | | uint32_t stat_pfx_dup_withdraw; |
1585 | | uint32_t stat_upd_7606; /* RFC7606: treat-as-withdraw */ |
1586 | | |
1587 | | /* BGP state count */ |
1588 | | uint32_t established; /* Established */ |
1589 | | uint32_t dropped; /* Dropped */ |
1590 | | |
1591 | | /* Update delay related fields */ |
1592 | | uint8_t update_delay_over; /* When this is set, BGP is no more waiting |
1593 | | for EOR */ |
1594 | | |
1595 | | time_t synctime; |
1596 | | /* timestamp when the last UPDATE msg was written */ |
1597 | | _Atomic time_t last_write; |
1598 | | /* timestamp when the last msg was written */ |
1599 | | _Atomic time_t last_update; |
1600 | | |
1601 | | /* only updated under io_mtx. |
1602 | | * last_sendq_warn is only for ratelimiting log warning messages. |
1603 | | */ |
1604 | | time_t last_sendq_ok, last_sendq_warn; |
1605 | | |
1606 | | /* Notify data. */ |
1607 | | struct bgp_notify notify; |
1608 | | |
1609 | | /* Filter structure. */ |
1610 | | struct bgp_filter filter[AFI_MAX][SAFI_MAX]; |
1611 | | |
1612 | | /* |
1613 | | * Parallel array to filter that indicates whether each filter |
1614 | | * originates from a peer-group or if it is config that is specific to |
1615 | | * this individual peer. If a filter is set independent of the |
1616 | | * peer-group the appropriate bit should be set here. If this peer is a |
1617 | | * peer-group, this memory region should be all zeros. The assumption |
1618 | | * is that the default state for all flags is unset. Due to filters |
1619 | | * having a direction (e.g. in/out/...), this array has a third |
1620 | | * dimension for storing the overrides independently per direction. |
1621 | | * |
1622 | | * Notes: |
1623 | | * - if a filter for an individual peer is unset, the corresponding |
1624 | | * override flag is unset and the peer is considered to be back in |
1625 | | * sync with the peer-group. |
1626 | | * - This does *not* contain the filter values, rather it contains |
1627 | | * whether the filter in filter (struct bgp_filter) is peer-specific. |
1628 | | */ |
1629 | | uint8_t filter_override[AFI_MAX][SAFI_MAX][FILTER_MAX]; |
1630 | 0 | #define PEER_FT_DISTRIBUTE_LIST (1U << 0) /* distribute-list */ |
1631 | 0 | #define PEER_FT_FILTER_LIST (1U << 1) /* filter-list */ |
1632 | 0 | #define PEER_FT_PREFIX_LIST (1U << 2) /* prefix-list */ |
1633 | 0 | #define PEER_FT_ROUTE_MAP (1U << 3) /* route-map */ |
1634 | 0 | #define PEER_FT_UNSUPPRESS_MAP (1U << 4) /* unsuppress-map */ |
1635 | 0 | #define PEER_FT_ADVERTISE_MAP (1U << 5) /* advertise-map */ |
1636 | | |
1637 | | /* ORF Prefix-list */ |
1638 | | struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX]; |
1639 | | |
1640 | | /* Text description of last attribute rcvd */ |
1641 | | char rcvd_attr_str[BUFSIZ]; |
1642 | | |
1643 | | /* Track if we printed the attribute in debugs */ |
1644 | | int rcvd_attr_printed; |
1645 | | |
1646 | | /* Accepted prefix count */ |
1647 | | uint32_t pcount[AFI_MAX][SAFI_MAX]; |
1648 | | |
1649 | | /* Max prefix count. */ |
1650 | | uint32_t pmax[AFI_MAX][SAFI_MAX]; |
1651 | | uint8_t pmax_threshold[AFI_MAX][SAFI_MAX]; |
1652 | | uint16_t pmax_restart[AFI_MAX][SAFI_MAX]; |
1653 | 0 | #define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75 |
1654 | | |
1655 | | /* Send prefix count. */ |
1656 | | uint32_t pmax_out[AFI_MAX][SAFI_MAX]; |
1657 | | |
1658 | | /* allowas-in. */ |
1659 | | char allowas_in[AFI_MAX][SAFI_MAX]; |
1660 | | |
1661 | | /* soo */ |
1662 | | struct ecommunity *soo[AFI_MAX][SAFI_MAX]; |
1663 | | |
1664 | | /* weight */ |
1665 | | unsigned long weight[AFI_MAX][SAFI_MAX]; |
1666 | | |
1667 | | /* peer reset cause */ |
1668 | | uint8_t last_reset; |
1669 | 0 | #define PEER_DOWN_RID_CHANGE 1U /* bgp router-id command */ |
1670 | 0 | #define PEER_DOWN_REMOTE_AS_CHANGE 2U /* neighbor remote-as command */ |
1671 | 0 | #define PEER_DOWN_LOCAL_AS_CHANGE 3U /* neighbor local-as command */ |
1672 | 0 | #define PEER_DOWN_CLID_CHANGE 4U /* bgp cluster-id command */ |
1673 | 0 | #define PEER_DOWN_CONFED_ID_CHANGE 5U /* bgp confederation id command */ |
1674 | 0 | #define PEER_DOWN_CONFED_PEER_CHANGE 6U /* bgp confederation peer command */ |
1675 | 0 | #define PEER_DOWN_RR_CLIENT_CHANGE 7U /* neighbor rr-client command */ |
1676 | 0 | #define PEER_DOWN_RS_CLIENT_CHANGE 8U /* neighbor rs-client command */ |
1677 | 0 | #define PEER_DOWN_UPDATE_SOURCE_CHANGE 9U /* neighbor update-source command */ |
1678 | 0 | #define PEER_DOWN_AF_ACTIVATE 10U /* neighbor activate command */ |
1679 | 0 | #define PEER_DOWN_USER_SHUTDOWN 11U /* neighbor shutdown command */ |
1680 | 0 | #define PEER_DOWN_USER_RESET 12U /* clear ip bgp command */ |
1681 | 13 | #define PEER_DOWN_NOTIFY_RECEIVED 13U /* notification received */ |
1682 | 723 | #define PEER_DOWN_NOTIFY_SEND 14U /* notification send */ |
1683 | 0 | #define PEER_DOWN_CLOSE_SESSION 15U /* tcp session close */ |
1684 | 0 | #define PEER_DOWN_NEIGHBOR_DELETE 16U /* neghbor delete */ |
1685 | 0 | #define PEER_DOWN_RMAP_BIND 17U /* neghbor peer-group command */ |
1686 | | #define PEER_DOWN_RMAP_UNBIND 18U /* no neighbor peer-group command */ |
1687 | 0 | #define PEER_DOWN_CAPABILITY_CHANGE 19U /* neighbor capability command */ |
1688 | 0 | #define PEER_DOWN_PASSIVE_CHANGE 20U /* neighbor passive command */ |
1689 | 0 | #define PEER_DOWN_MULTIHOP_CHANGE 21U /* neighbor multihop command */ |
1690 | 0 | #define PEER_DOWN_NSF_CLOSE_SESSION 22U /* NSF tcp session close */ |
1691 | 0 | #define PEER_DOWN_V6ONLY_CHANGE 23U /* if-based peering v6only toggled */ |
1692 | 0 | #define PEER_DOWN_BFD_DOWN 24U /* BFD down */ |
1693 | 0 | #define PEER_DOWN_IF_DOWN 25U /* Interface down */ |
1694 | 0 | #define PEER_DOWN_NBR_ADDR_DEL 26U /* Peer address lost */ |
1695 | 0 | #define PEER_DOWN_WAITING_NHT 27U /* Waiting for NHT to resolve */ |
1696 | 0 | #define PEER_DOWN_NBR_ADDR 28U /* Waiting for peer IPv6 IP Addr */ |
1697 | 0 | #define PEER_DOWN_VRF_UNINIT 29U /* Associated VRF is not init yet */ |
1698 | 1 | #define PEER_DOWN_NOAFI_ACTIVATED 30U /* No AFI/SAFI activated for peer */ |
1699 | 0 | #define PEER_DOWN_AS_SETS_REJECT 31U /* Reject routes with AS_SET */ |
1700 | 0 | #define PEER_DOWN_WAITING_OPEN 32U /* Waiting for open to succeed */ |
1701 | 0 | #define PEER_DOWN_PFX_COUNT 33U /* Reached received prefix count */ |
1702 | 0 | #define PEER_DOWN_SOCKET_ERROR 34U /* Some socket error happened */ |
1703 | 0 | #define PEER_DOWN_RTT_SHUTDOWN 35U /* Automatically shutdown due to RTT */ |
1704 | | /* |
1705 | | * Remember to update peer_down_str in bgp_fsm.c when you add |
1706 | | * a new value to the last_reset reason |
1707 | | */ |
1708 | | |
1709 | | struct stream *last_reset_cause; |
1710 | | |
1711 | | /* The kind of route-map Flags.*/ |
1712 | | uint16_t rmap_type; |
1713 | | #define PEER_RMAP_TYPE_IN (1U << 0) /* neighbor route-map in */ |
1714 | | #define PEER_RMAP_TYPE_OUT (1U << 1) /* neighbor route-map out */ |
1715 | | #define PEER_RMAP_TYPE_NETWORK (1U << 2) /* network route-map */ |
1716 | | #define PEER_RMAP_TYPE_REDISTRIBUTE (1U << 3) /* redistribute route-map */ |
1717 | | #define PEER_RMAP_TYPE_DEFAULT (1U << 4) /* default-originate route-map */ |
1718 | | #define PEER_RMAP_TYPE_NOSET (1U << 5) /* not allow to set commands */ |
1719 | | #define PEER_RMAP_TYPE_IMPORT (1U << 6) /* neighbor route-map import */ |
1720 | | #define PEER_RMAP_TYPE_EXPORT (1U << 7) /* neighbor route-map export */ |
1721 | | #define PEER_RMAP_TYPE_AGGREGATE (1U << 8) /* aggregate-address route-map */ |
1722 | | |
1723 | | /** Peer overwrite configuration. */ |
1724 | | struct bfd_session_config { |
1725 | | /** |
1726 | | * Manual configuration bit. |
1727 | | * |
1728 | | * This flag only makes sense for real peers (and not groups), |
1729 | | * it keeps track if the user explicitly configured BFD for a |
1730 | | * peer. |
1731 | | */ |
1732 | | bool manual; |
1733 | | /** Control Plane Independent. */ |
1734 | | bool cbit; |
1735 | | /** Detection multiplier. */ |
1736 | | uint8_t detection_multiplier; |
1737 | | /** Minimum required RX interval. */ |
1738 | | uint32_t min_rx; |
1739 | | /** Minimum required TX interval. */ |
1740 | | uint32_t min_tx; |
1741 | | /** Profile name. */ |
1742 | | char profile[BFD_PROFILE_NAME_LEN]; |
1743 | | /** Peer BFD session */ |
1744 | | struct bfd_session_params *session; |
1745 | | } * bfd_config; |
1746 | | |
1747 | | /* hostname and domainname advertised by host */ |
1748 | | char *hostname; |
1749 | | char *domainname; |
1750 | | |
1751 | | /* Sender side AS path loop detection. */ |
1752 | | bool as_path_loop_detection; |
1753 | | |
1754 | | /* Extended Message Support */ |
1755 | | uint16_t max_packet_size; |
1756 | | |
1757 | | /* Conditional advertisement */ |
1758 | | bool advmap_config_change[AFI_MAX][SAFI_MAX]; |
1759 | | bool advmap_table_change; |
1760 | | |
1761 | | /* set TCP max segment size */ |
1762 | | uint32_t tcp_mss; |
1763 | | |
1764 | | /* Long-lived Graceful Restart */ |
1765 | | struct llgr_info llgr[AFI_MAX][SAFI_MAX]; |
1766 | | |
1767 | | bool shut_during_cfg; |
1768 | | |
1769 | 0 | #define BGP_ATTR_MAX 255 |
1770 | | /* Path attributes discard */ |
1771 | | bool discard_attrs[BGP_ATTR_MAX]; |
1772 | | |
1773 | | /* Path attributes treat-as-withdraw */ |
1774 | | bool withdraw_attrs[BGP_ATTR_MAX]; |
1775 | | |
1776 | | /* BGP Software Version Capability */ |
1777 | 4 | #define BGP_MAX_SOFT_VERSION 64 |
1778 | | char *soft_version; |
1779 | | |
1780 | | QOBJ_FIELDS; |
1781 | | }; |
1782 | | DECLARE_QOBJ_TYPE(peer); |
1783 | | |
1784 | | /* Inherit peer attribute from peer-group. */ |
1785 | | #define PEER_ATTR_INHERIT(peer, group, attr) \ |
1786 | 0 | ((peer)->attr = (group)->conf->attr) |
1787 | | #define PEER_STR_ATTR_INHERIT(peer, group, attr, mt) \ |
1788 | 0 | do { \ |
1789 | 0 | XFREE(mt, (peer)->attr); \ |
1790 | 0 | if ((group)->conf->attr) \ |
1791 | 0 | (peer)->attr = XSTRDUP(mt, (group)->conf->attr); \ |
1792 | 0 | else \ |
1793 | 0 | (peer)->attr = NULL; \ |
1794 | 0 | } while (0) |
1795 | | #define PEER_SU_ATTR_INHERIT(peer, group, attr) \ |
1796 | 0 | do { \ |
1797 | 0 | if ((peer)->attr) \ |
1798 | 0 | sockunion_free((peer)->attr); \ |
1799 | 0 | if ((group)->conf->attr) \ |
1800 | 0 | (peer)->attr = sockunion_dup((group)->conf->attr); \ |
1801 | 0 | else \ |
1802 | 0 | (peer)->attr = NULL; \ |
1803 | 0 | } while (0) |
1804 | | |
1805 | | /* Check if suppress start/restart of sessions to peer. */ |
1806 | | #define BGP_PEER_START_SUPPRESSED(P) \ |
1807 | 0 | (CHECK_FLAG((P)->flags, PEER_FLAG_SHUTDOWN) || \ |
1808 | 0 | CHECK_FLAG((P)->sflags, PEER_STATUS_PREFIX_OVERFLOW) || \ |
1809 | 0 | CHECK_FLAG((P)->bgp->flags, BGP_FLAG_SHUTDOWN) || \ |
1810 | 0 | (P)->shut_during_cfg) |
1811 | | |
1812 | | #define PEER_ROUTE_ADV_DELAY(peer) \ |
1813 | 0 | (CHECK_FLAG(peer->thread_flags, PEER_THREAD_SUBGRP_ADV_DELAY)) |
1814 | | |
1815 | 0 | #define PEER_PASSWORD_MINLEN (1) |
1816 | 0 | #define PEER_PASSWORD_MAXLEN (80) |
1817 | | |
1818 | | /* This structure's member directly points incoming packet data |
1819 | | stream. */ |
1820 | | struct bgp_nlri { |
1821 | | /* AFI. */ |
1822 | | uint16_t afi; /* iana_afi_t */ |
1823 | | |
1824 | | /* SAFI. */ |
1825 | | uint8_t safi; /* iana_safi_t */ |
1826 | | |
1827 | | /* Pointer to NLRI byte stream. */ |
1828 | | uint8_t *nlri; |
1829 | | |
1830 | | /* Length of whole NLRI. */ |
1831 | | bgp_size_t length; |
1832 | | }; |
1833 | | |
1834 | | /* BGP versions. */ |
1835 | 41 | #define BGP_VERSION_4 4 |
1836 | | |
1837 | | /* Default BGP port number. */ |
1838 | 4 | #define BGP_PORT_DEFAULT 179 |
1839 | | |
1840 | | /* Extended BGP Administrative Shutdown Communication */ |
1841 | 0 | #define BGP_ADMIN_SHUTDOWN_MSG_LEN 255 |
1842 | | |
1843 | | /* BGP minimum message size. */ |
1844 | 65 | #define BGP_MSG_OPEN_MIN_SIZE (BGP_HEADER_SIZE + 10) |
1845 | 632 | #define BGP_MSG_UPDATE_MIN_SIZE (BGP_HEADER_SIZE + 4) |
1846 | 13 | #define BGP_MSG_NOTIFY_MIN_SIZE (BGP_HEADER_SIZE + 2) |
1847 | 3 | #define BGP_MSG_KEEPALIVE_MIN_SIZE (BGP_HEADER_SIZE + 0) |
1848 | 317 | #define BGP_MSG_ROUTE_REFRESH_MIN_SIZE (BGP_HEADER_SIZE + 4) |
1849 | 10 | #define BGP_MSG_CAPABILITY_MIN_SIZE (BGP_HEADER_SIZE + 3) |
1850 | | |
1851 | | /* BGP message types. */ |
1852 | 3.39k | #define BGP_MSG_OPEN 1 |
1853 | 3.89k | #define BGP_MSG_UPDATE 2 |
1854 | 3.37k | #define BGP_MSG_NOTIFY 3 |
1855 | 2.62k | #define BGP_MSG_KEEPALIVE 4 |
1856 | 2.71k | #define BGP_MSG_ROUTE_REFRESH_NEW 5 |
1857 | 1.68k | #define BGP_MSG_CAPABILITY 6 |
1858 | 2.63k | #define BGP_MSG_ROUTE_REFRESH_OLD 128 |
1859 | | |
1860 | | /* BGP open optional parameter. */ |
1861 | 357 | #define BGP_OPEN_OPT_CAP 2 |
1862 | | |
1863 | | /* BGP4 attribute type codes. */ |
1864 | 326 | #define BGP_ATTR_ORIGIN 1 |
1865 | 356 | #define BGP_ATTR_AS_PATH 2 |
1866 | 128 | #define BGP_ATTR_NEXT_HOP 3 |
1867 | 57 | #define BGP_ATTR_MULTI_EXIT_DISC 4 |
1868 | 57 | #define BGP_ATTR_LOCAL_PREF 5 |
1869 | 28 | #define BGP_ATTR_ATOMIC_AGGREGATE 6 |
1870 | 11 | #define BGP_ATTR_AGGREGATOR 7 |
1871 | 80 | #define BGP_ATTR_COMMUNITIES 8 |
1872 | 72 | #define BGP_ATTR_ORIGINATOR_ID 9 |
1873 | 80 | #define BGP_ATTR_CLUSTER_LIST 10 |
1874 | 341 | #define BGP_ATTR_MP_REACH_NLRI 14 |
1875 | 11 | #define BGP_ATTR_MP_UNREACH_NLRI 15 |
1876 | 164 | #define BGP_ATTR_EXT_COMMUNITIES 16 |
1877 | 70 | #define BGP_ATTR_AS4_PATH 17 |
1878 | 7 | #define BGP_ATTR_AS4_AGGREGATOR 18 |
1879 | 65 | #define BGP_ATTR_PMSI_TUNNEL 22 |
1880 | 1.24k | #define BGP_ATTR_ENCAP 23 |
1881 | 85 | #define BGP_ATTR_IPV6_EXT_COMMUNITIES 25 |
1882 | 1 | #define BGP_ATTR_AIGP 26 |
1883 | 74 | #define BGP_ATTR_LARGE_COMMUNITIES 32 |
1884 | 71 | #define BGP_ATTR_OTC 35 |
1885 | 38 | #define BGP_ATTR_PREFIX_SID 40 |
1886 | | #define BGP_ATTR_SRTE_COLOR 51 |
1887 | | #ifdef ENABLE_BGP_VNC_ATTR |
1888 | | #define BGP_ATTR_VNC 255 |
1889 | | #endif |
1890 | | |
1891 | | /* BGP update origin. */ |
1892 | 272 | #define BGP_ORIGIN_IGP 0 |
1893 | 108 | #define BGP_ORIGIN_EGP 1 |
1894 | 95 | #define BGP_ORIGIN_INCOMPLETE 2 |
1895 | 0 | #define BGP_ORIGIN_UNSPECIFIED 255 |
1896 | | |
1897 | | /* BGP notify message codes. */ |
1898 | 32 | #define BGP_NOTIFY_HEADER_ERR 1 |
1899 | 86 | #define BGP_NOTIFY_OPEN_ERR 2 |
1900 | 535 | #define BGP_NOTIFY_UPDATE_ERR 3 |
1901 | 0 | #define BGP_NOTIFY_HOLD_ERR 4 |
1902 | 0 | #define BGP_NOTIFY_FSM_ERR 5 |
1903 | 731 | #define BGP_NOTIFY_CEASE 6 |
1904 | 88 | #define BGP_NOTIFY_ROUTE_REFRESH_ERR 7 |
1905 | | |
1906 | | /* Subcodes for BGP Finite State Machine Error */ |
1907 | 0 | #define BGP_NOTIFY_FSM_ERR_SUBCODE_UNSPECIFIC 0 |
1908 | 0 | #define BGP_NOTIFY_FSM_ERR_SUBCODE_OPENSENT 1 |
1909 | 0 | #define BGP_NOTIFY_FSM_ERR_SUBCODE_OPENCONFIRM 2 |
1910 | 0 | #define BGP_NOTIFY_FSM_ERR_SUBCODE_ESTABLISHED 3 |
1911 | | |
1912 | 8 | #define BGP_NOTIFY_SUBCODE_UNSPECIFIC 0 |
1913 | | |
1914 | | /* BGP_NOTIFY_HEADER_ERR sub codes. */ |
1915 | 23 | #define BGP_NOTIFY_HEADER_NOT_SYNC 1 |
1916 | 0 | #define BGP_NOTIFY_HEADER_BAD_MESLEN 2 |
1917 | 9 | #define BGP_NOTIFY_HEADER_BAD_MESTYPE 3 |
1918 | | |
1919 | | /* BGP_NOTIFY_OPEN_ERR sub codes. */ |
1920 | 38 | #define BGP_NOTIFY_OPEN_MALFORMED_ATTR 0 |
1921 | 2 | #define BGP_NOTIFY_OPEN_UNSUP_VERSION 1 |
1922 | 19 | #define BGP_NOTIFY_OPEN_BAD_PEER_AS 2 |
1923 | 0 | #define BGP_NOTIFY_OPEN_BAD_BGP_IDENT 3 |
1924 | 1 | #define BGP_NOTIFY_OPEN_UNSUP_PARAM 4 |
1925 | 0 | #define BGP_NOTIFY_OPEN_UNACEP_HOLDTIME 6 |
1926 | 1 | #define BGP_NOTIFY_OPEN_UNSUP_CAPBL 7 |
1927 | 0 | #define BGP_NOTIFY_OPEN_ROLE_MISMATCH 11 |
1928 | | |
1929 | | /* BGP_NOTIFY_UPDATE_ERR sub codes. */ |
1930 | 67 | #define BGP_NOTIFY_UPDATE_MAL_ATTR 1 |
1931 | 32 | #define BGP_NOTIFY_UPDATE_UNREC_ATTR 2 |
1932 | | #define BGP_NOTIFY_UPDATE_MISS_ATTR 3 |
1933 | 46 | #define BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR 4 |
1934 | 153 | #define BGP_NOTIFY_UPDATE_ATTR_LENG_ERR 5 |
1935 | 1 | #define BGP_NOTIFY_UPDATE_INVAL_ORIGIN 6 |
1936 | 1 | #define BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP 8 |
1937 | 668 | #define BGP_NOTIFY_UPDATE_OPT_ATTR_ERR 9 |
1938 | 78 | #define BGP_NOTIFY_UPDATE_INVAL_NETWORK 10 |
1939 | 19 | #define BGP_NOTIFY_UPDATE_MAL_AS_PATH 11 |
1940 | | |
1941 | | /* BGP_NOTIFY_CEASE sub codes (RFC 4486). */ |
1942 | 0 | #define BGP_NOTIFY_CEASE_MAX_PREFIX 1 |
1943 | 8 | #define BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN 2 |
1944 | 0 | #define BGP_NOTIFY_CEASE_PEER_UNCONFIG 3 |
1945 | 8 | #define BGP_NOTIFY_CEASE_ADMIN_RESET 4 |
1946 | | #define BGP_NOTIFY_CEASE_CONNECT_REJECT 5 |
1947 | 0 | #define BGP_NOTIFY_CEASE_CONFIG_CHANGE 6 |
1948 | 0 | #define BGP_NOTIFY_CEASE_COLLISION_RESOLUTION 7 |
1949 | | #define BGP_NOTIFY_CEASE_OUT_OF_RESOURCE 8 |
1950 | 0 | #define BGP_NOTIFY_CEASE_HARD_RESET 9 |
1951 | 0 | #define BGP_NOTIFY_CEASE_BFD_DOWN 10 |
1952 | | |
1953 | | /* BGP_NOTIFY_ROUTE_REFRESH_ERR sub codes (RFC 7313). */ |
1954 | 88 | #define BGP_NOTIFY_ROUTE_REFRESH_INVALID_MSG_LEN 1 |
1955 | | |
1956 | | /* BGP route refresh optional subtypes. */ |
1957 | 0 | #define BGP_ROUTE_REFRESH_NORMAL 0 |
1958 | 104 | #define BGP_ROUTE_REFRESH_BORR 1 |
1959 | 73 | #define BGP_ROUTE_REFRESH_EORR 2 |
1960 | | |
1961 | | /* BGP timers default value. */ |
1962 | 2 | #define BGP_INIT_START_TIMER 1 |
1963 | | /* The following 3 are RFC defaults that are overridden in bgp_vty.c with |
1964 | | * version-/profile-specific values. The values here do not matter, they only |
1965 | | * exist to provide a clear layering separation between core and CLI. |
1966 | | */ |
1967 | 1 | #define BGP_DEFAULT_HOLDTIME 180 |
1968 | 1 | #define BGP_DEFAULT_KEEPALIVE 60 |
1969 | 1 | #define BGP_DEFAULT_CONNECT_RETRY 120 |
1970 | | |
1971 | 2 | #define BGP_DEFAULT_EBGP_ROUTEADV 0 |
1972 | 0 | #define BGP_DEFAULT_IBGP_ROUTEADV 0 |
1973 | | |
1974 | | /* BGP RFC 4271 DelayOpenTime default value */ |
1975 | 1 | #define BGP_DEFAULT_DELAYOPEN 120 |
1976 | | |
1977 | | /* BGP default local preference. */ |
1978 | 1 | #define BGP_DEFAULT_LOCAL_PREF 100 |
1979 | | |
1980 | | /* BGP local-preference to send when 'bgp graceful-shutdown' |
1981 | | * is configured */ |
1982 | 156 | #define BGP_GSHUT_LOCAL_PREF 0 |
1983 | | |
1984 | | /* BGP default subgroup packet queue max . */ |
1985 | 1 | #define BGP_DEFAULT_SUBGROUP_PKT_QUEUE_MAX 40 |
1986 | | |
1987 | | /* BGP graceful restart */ |
1988 | 1 | #define BGP_DEFAULT_RESTART_TIME 120 |
1989 | 1 | #define BGP_DEFAULT_STALEPATH_TIME 360 |
1990 | 1 | #define BGP_DEFAULT_SELECT_DEFERRAL_TIME 360 |
1991 | 1 | #define BGP_DEFAULT_RIB_STALE_TIME 500 |
1992 | | #define BGP_DEFAULT_UPDATE_ADVERTISEMENT_TIME 1 |
1993 | | |
1994 | | /* BGP Long-lived Graceful Restart */ |
1995 | 1 | #define BGP_DEFAULT_LLGR_STALE_TIME 0 |
1996 | | |
1997 | | /* BGP uptime string length. */ |
1998 | 0 | #define BGP_UPTIME_LEN 25 |
1999 | | |
2000 | | /* Default configuration settings for bgpd. */ |
2001 | | #define BGP_VTY_PORT 2605 |
2002 | | #define BGP_DEFAULT_CONFIG "bgpd.conf" |
2003 | | |
2004 | | /* BGP Dynamic Neighbors feature */ |
2005 | 1 | #define BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT 100 |
2006 | | #define BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN 1 |
2007 | | #define BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX 65535 |
2008 | | |
2009 | | /* BGP AIGP */ |
2010 | | #define BGP_AIGP_TLV_RESERVED 0 /* AIGP Reserved */ |
2011 | 0 | #define BGP_AIGP_TLV_METRIC 1 /* AIGP Metric */ |
2012 | 0 | #define BGP_AIGP_TLV_METRIC_LEN 11 |
2013 | 0 | #define BGP_AIGP_TLV_METRIC_MAX 0xffffffffffffffffULL |
2014 | | #define BGP_AIGP_TLV_METRIC_DESC "Accumulated IGP Metric" |
2015 | | |
2016 | | /* Flag for peer_clear_soft(). */ |
2017 | | enum bgp_clear_type { |
2018 | | BGP_CLEAR_SOFT_NONE, |
2019 | | BGP_CLEAR_SOFT_OUT, |
2020 | | BGP_CLEAR_SOFT_IN, |
2021 | | BGP_CLEAR_SOFT_BOTH, |
2022 | | BGP_CLEAR_SOFT_IN_ORF_PREFIX, |
2023 | | BGP_CLEAR_MESSAGE_STATS |
2024 | | }; |
2025 | | |
2026 | | /* Macros. */ |
2027 | 18.9k | #define BGP_INPUT(P) ((P)->curr) |
2028 | 10.5k | #define BGP_INPUT_PNT(P) (stream_pnt(BGP_INPUT(P))) |
2029 | | #define BGP_IS_VALID_STATE_FOR_NOTIF(S) \ |
2030 | 0 | (((S) == OpenSent) || ((S) == OpenConfirm) || ((S) == Established)) |
2031 | | |
2032 | | /* BGP error codes. */ |
2033 | | enum bgp_create_error_code { |
2034 | | BGP_SUCCESS = 0, |
2035 | | BGP_CREATED = 1, |
2036 | | BGP_ERR_INVALID_VALUE = -1, |
2037 | | BGP_ERR_INVALID_FLAG = -2, |
2038 | | BGP_ERR_INVALID_AS = -3, |
2039 | | BGP_ERR_PEER_GROUP_MEMBER = -4, |
2040 | | BGP_ERR_PEER_GROUP_NO_REMOTE_AS = -5, |
2041 | | BGP_ERR_PEER_GROUP_CANT_CHANGE = -6, |
2042 | | BGP_ERR_PEER_GROUP_MISMATCH = -7, |
2043 | | BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT = -8, |
2044 | | BGP_ERR_AS_MISMATCH = -9, |
2045 | | BGP_ERR_PEER_FLAG_CONFLICT = -10, |
2046 | | BGP_ERR_PEER_GROUP_SHUTDOWN = -11, |
2047 | | BGP_ERR_PEER_FILTER_CONFLICT = -12, |
2048 | | BGP_ERR_NOT_INTERNAL_PEER = -13, |
2049 | | BGP_ERR_REMOVE_PRIVATE_AS = -14, |
2050 | | BGP_ERR_AF_UNCONFIGURED = -15, |
2051 | | BGP_ERR_SOFT_RECONFIG_UNCONFIGURED = -16, |
2052 | | BGP_ERR_INSTANCE_MISMATCH = -17, |
2053 | | BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS = -19, |
2054 | | BGP_ERR_TCPSIG_FAILED = -20, |
2055 | | BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK = -21, |
2056 | | BGP_ERR_NO_IBGP_WITH_TTLHACK = -22, |
2057 | | BGP_ERR_NO_INTERFACE_CONFIG = -23, |
2058 | | BGP_ERR_AS_OVERRIDE = -25, |
2059 | | BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT = -26, |
2060 | | BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS = -27, |
2061 | | BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_NOT_FOUND = -28, |
2062 | | BGP_ERR_INVALID_FOR_DYNAMIC_PEER = -29, |
2063 | | BGP_ERR_INVALID_FOR_DIRECT_PEER = -30, |
2064 | | BGP_ERR_PEER_SAFI_CONFLICT = -31, |
2065 | | |
2066 | | /* BGP GR ERRORS */ |
2067 | | BGP_ERR_GR_INVALID_CMD = -32, |
2068 | | BGP_ERR_GR_OPERATION_FAILED = -33, |
2069 | | BGP_GR_NO_OPERATION = -34, |
2070 | | |
2071 | | /*BGP Open Policy ERRORS */ |
2072 | | BGP_ERR_INVALID_ROLE_NAME = -35, |
2073 | | BGP_ERR_INVALID_INTERNAL_ROLE = -36 |
2074 | | }; |
2075 | | |
2076 | | /* |
2077 | | * Enumeration of different policy kinds a peer can be configured with. |
2078 | | */ |
2079 | | enum bgp_policy_type { |
2080 | | BGP_POLICY_ROUTE_MAP, |
2081 | | BGP_POLICY_FILTER_LIST, |
2082 | | BGP_POLICY_PREFIX_LIST, |
2083 | | BGP_POLICY_DISTRIBUTE_LIST, |
2084 | | }; |
2085 | | |
2086 | | /* peer_flag_change_type. */ |
2087 | | enum peer_change_type { |
2088 | | peer_change_none, |
2089 | | peer_change_reset, |
2090 | | peer_change_reset_in, |
2091 | | peer_change_reset_out, |
2092 | | }; |
2093 | | |
2094 | | extern struct bgp_master *bm; |
2095 | | extern unsigned int multipath_num; |
2096 | | |
2097 | | /* Prototypes. */ |
2098 | | extern void bgp_terminate(void); |
2099 | | extern void bgp_reset(void); |
2100 | | extern void bgp_zclient_reset(void); |
2101 | | extern struct bgp *bgp_get_default(void); |
2102 | | extern struct bgp *bgp_lookup(as_t, const char *); |
2103 | | extern struct bgp *bgp_lookup_by_name(const char *); |
2104 | | extern struct bgp *bgp_lookup_by_vrf_id(vrf_id_t); |
2105 | | extern struct bgp *bgp_get_evpn(void); |
2106 | | extern void bgp_set_evpn(struct bgp *bgp); |
2107 | | extern struct peer *peer_lookup(struct bgp *, union sockunion *); |
2108 | | extern struct peer *peer_lookup_by_conf_if(struct bgp *, const char *); |
2109 | | extern struct peer *peer_lookup_by_hostname(struct bgp *, const char *); |
2110 | | extern void bgp_peer_conf_if_to_su_update(struct peer *); |
2111 | | extern int peer_group_listen_range_del(struct peer_group *, struct prefix *); |
2112 | | extern struct peer_group *peer_group_lookup(struct bgp *, const char *); |
2113 | | extern struct peer_group *peer_group_get(struct bgp *, const char *); |
2114 | | extern struct peer *peer_create_bind_dynamic_neighbor(struct bgp *, |
2115 | | union sockunion *, |
2116 | | struct peer_group *); |
2117 | | extern struct prefix * |
2118 | | peer_group_lookup_dynamic_neighbor_range(struct peer_group *, struct prefix *); |
2119 | | extern struct peer_group *peer_group_lookup_dynamic_neighbor(struct bgp *, |
2120 | | struct prefix *, |
2121 | | struct prefix **); |
2122 | | extern struct peer *peer_lookup_dynamic_neighbor(struct bgp *, |
2123 | | union sockunion *); |
2124 | | |
2125 | | /* |
2126 | | * Peers are incredibly easy to memory leak |
2127 | | * due to the various ways that they are actually used |
2128 | | * Provide some functionality to debug locks and unlocks |
2129 | | */ |
2130 | | extern struct peer *peer_lock_with_caller(const char *, struct peer *); |
2131 | | extern struct peer *peer_unlock_with_caller(const char *, struct peer *); |
2132 | 22 | #define peer_unlock(A) peer_unlock_with_caller(__FUNCTION__, (A)) |
2133 | 25 | #define peer_lock(B) peer_lock_with_caller(__FUNCTION__, (B)) |
2134 | | |
2135 | | extern enum bgp_peer_sort peer_sort(struct peer *peer); |
2136 | | extern enum bgp_peer_sort peer_sort_lookup(struct peer *peer); |
2137 | | |
2138 | | extern bool peer_active(struct peer *); |
2139 | | extern bool peer_active_nego(struct peer *); |
2140 | | extern bool peer_afc_received(struct peer *peer); |
2141 | | extern bool peer_afc_advertised(struct peer *peer); |
2142 | | extern void bgp_recalculate_all_bestpaths(struct bgp *bgp); |
2143 | | extern struct peer *peer_create(union sockunion *su, const char *conf_if, |
2144 | | struct bgp *bgp, as_t local_as, as_t remote_as, |
2145 | | int as_type, struct peer_group *group, |
2146 | | bool config_node, const char *as_str); |
2147 | | extern struct peer *peer_create_accept(struct bgp *); |
2148 | | extern void peer_xfer_config(struct peer *dst, struct peer *src); |
2149 | | extern char *peer_uptime(time_t uptime2, char *buf, size_t len, bool use_json, |
2150 | | json_object *json); |
2151 | | |
2152 | | extern int bgp_config_write(struct vty *); |
2153 | | |
2154 | | extern void bgp_master_init(struct event_loop *master, const int buffer_size, |
2155 | | struct list *addresses); |
2156 | | |
2157 | | extern void bgp_init(unsigned short instance); |
2158 | | extern void bgp_pthreads_run(void); |
2159 | | extern void bgp_pthreads_finish(void); |
2160 | | extern void bgp_route_map_init(void); |
2161 | | extern void bgp_session_reset(struct peer *); |
2162 | | |
2163 | | extern int bgp_option_set(int); |
2164 | | extern int bgp_option_unset(int); |
2165 | | extern int bgp_option_check(int); |
2166 | | |
2167 | | /* set the bgp no-rib option during runtime and remove installed routes */ |
2168 | | extern void bgp_option_norib_set_runtime(void); |
2169 | | |
2170 | | /* unset the bgp no-rib option during runtime and reset all peers */ |
2171 | | extern void bgp_option_norib_unset_runtime(void); |
2172 | | |
2173 | | extern int bgp_get(struct bgp **bgp, as_t *as, const char *name, |
2174 | | enum bgp_instance_type kind, const char *as_pretty, |
2175 | | enum asnotation_mode asnotation); |
2176 | | extern void bgp_instance_up(struct bgp *); |
2177 | | extern void bgp_instance_down(struct bgp *); |
2178 | | extern int bgp_delete(struct bgp *); |
2179 | | |
2180 | | extern int bgp_handle_socket(struct bgp *bgp, struct vrf *vrf, |
2181 | | vrf_id_t old_vrf_id, bool create); |
2182 | | |
2183 | | extern void bgp_router_id_zebra_bump(vrf_id_t, const struct prefix *); |
2184 | | extern void bgp_router_id_static_set(struct bgp *, struct in_addr); |
2185 | | |
2186 | | extern void bm_wait_for_fib_set(bool set); |
2187 | | extern void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set); |
2188 | | extern void bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id); |
2189 | | extern void bgp_cluster_id_unset(struct bgp *bgp); |
2190 | | |
2191 | | extern void bgp_confederation_id_set(struct bgp *bgp, as_t as, |
2192 | | const char *as_str); |
2193 | | extern void bgp_confederation_id_unset(struct bgp *bgp); |
2194 | | extern bool bgp_confederation_peers_check(struct bgp *, as_t); |
2195 | | |
2196 | | extern void bgp_confederation_peers_add(struct bgp *bgp, as_t as, |
2197 | | const char *as_str); |
2198 | | extern void bgp_confederation_peers_remove(struct bgp *bgp, as_t as); |
2199 | | |
2200 | | extern void bgp_timers_set(struct bgp *, uint32_t keepalive, uint32_t holdtime, |
2201 | | uint32_t connect_retry, uint32_t delayopen); |
2202 | | extern void bgp_timers_unset(struct bgp *); |
2203 | | |
2204 | | extern void bgp_default_local_preference_set(struct bgp *bgp, |
2205 | | uint32_t local_pref); |
2206 | | extern void bgp_default_local_preference_unset(struct bgp *bgp); |
2207 | | |
2208 | | extern void bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, |
2209 | | uint32_t queue_size); |
2210 | | extern void bgp_default_subgroup_pkt_queue_max_unset(struct bgp *bgp); |
2211 | | |
2212 | | extern void bgp_listen_limit_set(struct bgp *bgp, int listen_limit); |
2213 | | extern void bgp_listen_limit_unset(struct bgp *bgp); |
2214 | | |
2215 | | extern bool bgp_update_delay_active(struct bgp *); |
2216 | | extern bool bgp_update_delay_configured(struct bgp *); |
2217 | | extern bool bgp_afi_safi_peer_exists(struct bgp *bgp, afi_t afi, safi_t safi); |
2218 | | extern void peer_as_change(struct peer *peer, as_t as, int as_type, |
2219 | | const char *as_str); |
2220 | | extern int peer_remote_as(struct bgp *bgp, union sockunion *su, |
2221 | | const char *conf_if, as_t *as, int as_type, |
2222 | | const char *as_str); |
2223 | | extern int peer_group_remote_as(struct bgp *bgp, const char *peer_str, as_t *as, |
2224 | | int as_type, const char *as_str); |
2225 | | extern int peer_delete(struct peer *peer); |
2226 | | extern void peer_notify_unconfig(struct peer *peer); |
2227 | | extern int peer_group_delete(struct peer_group *); |
2228 | | extern int peer_group_remote_as_delete(struct peer_group *); |
2229 | | extern int peer_group_listen_range_add(struct peer_group *, struct prefix *); |
2230 | | extern void peer_group_notify_unconfig(struct peer_group *group); |
2231 | | |
2232 | | extern int peer_activate(struct peer *, afi_t, safi_t); |
2233 | | extern int peer_deactivate(struct peer *, afi_t, safi_t); |
2234 | | |
2235 | | extern int peer_group_bind(struct bgp *, union sockunion *, struct peer *, |
2236 | | struct peer_group *, as_t *); |
2237 | | |
2238 | | extern int peer_flag_set(struct peer *peer, uint64_t flag); |
2239 | | extern int peer_flag_unset(struct peer *peer, uint64_t flag); |
2240 | | extern void peer_flag_inherit(struct peer *peer, uint64_t flag); |
2241 | | |
2242 | | extern int peer_af_flag_set(struct peer *peer, afi_t afi, safi_t safi, |
2243 | | uint64_t flag); |
2244 | | extern int peer_af_flag_unset(struct peer *peer, afi_t afi, safi_t safi, |
2245 | | uint64_t flag); |
2246 | | extern bool peer_af_flag_check(struct peer *peer, afi_t afi, safi_t safi, |
2247 | | uint64_t flag); |
2248 | | extern void peer_af_flag_inherit(struct peer *peer, afi_t afi, safi_t safi, |
2249 | | uint64_t flag); |
2250 | | extern void peer_change_action(struct peer *peer, afi_t afi, safi_t safi, |
2251 | | enum peer_change_type type); |
2252 | | |
2253 | | extern int peer_ebgp_multihop_set(struct peer *, int); |
2254 | | extern int peer_ebgp_multihop_unset(struct peer *); |
2255 | | extern int is_ebgp_multihop_configured(struct peer *peer); |
2256 | | |
2257 | | extern int peer_role_set(struct peer *peer, uint8_t role, bool strict_mode); |
2258 | | extern int peer_role_unset(struct peer *peer); |
2259 | | |
2260 | | extern void peer_description_set(struct peer *, const char *); |
2261 | | extern void peer_description_unset(struct peer *); |
2262 | | |
2263 | | extern int peer_update_source_if_set(struct peer *, const char *); |
2264 | | extern void peer_update_source_addr_set(struct peer *peer, |
2265 | | const union sockunion *su); |
2266 | | extern void peer_update_source_unset(struct peer *peer); |
2267 | | |
2268 | | extern int peer_default_originate_set(struct peer *peer, afi_t afi, safi_t safi, |
2269 | | const char *rmap, |
2270 | | struct route_map *route_map); |
2271 | | extern int peer_default_originate_unset(struct peer *, afi_t, safi_t); |
2272 | | extern void bgp_tcp_keepalive_set(struct bgp *bgp, uint16_t idle, |
2273 | | uint16_t interval, uint16_t probes); |
2274 | | extern void bgp_tcp_keepalive_unset(struct bgp *bgp); |
2275 | | |
2276 | | extern void peer_port_set(struct peer *, uint16_t); |
2277 | | extern void peer_port_unset(struct peer *); |
2278 | | |
2279 | | extern int peer_weight_set(struct peer *, afi_t, safi_t, uint16_t); |
2280 | | extern int peer_weight_unset(struct peer *, afi_t, safi_t); |
2281 | | |
2282 | | extern int peer_timers_set(struct peer *, uint32_t keepalive, |
2283 | | uint32_t holdtime); |
2284 | | extern int peer_timers_unset(struct peer *); |
2285 | | |
2286 | | extern int peer_timers_connect_set(struct peer *, uint32_t); |
2287 | | extern int peer_timers_connect_unset(struct peer *); |
2288 | | |
2289 | | extern int peer_advertise_interval_set(struct peer *, uint32_t); |
2290 | | extern int peer_advertise_interval_unset(struct peer *); |
2291 | | |
2292 | | extern int peer_timers_delayopen_set(struct peer *peer, uint32_t delayopen); |
2293 | | extern int peer_timers_delayopen_unset(struct peer *peer); |
2294 | | |
2295 | | extern void peer_interface_set(struct peer *, const char *); |
2296 | | extern void peer_interface_unset(struct peer *); |
2297 | | |
2298 | | extern int peer_distribute_set(struct peer *, afi_t, safi_t, int, const char *); |
2299 | | extern int peer_distribute_unset(struct peer *, afi_t, safi_t, int); |
2300 | | |
2301 | | extern int peer_allowas_in_set(struct peer *, afi_t, safi_t, int, int); |
2302 | | extern int peer_allowas_in_unset(struct peer *, afi_t, safi_t); |
2303 | | |
2304 | | extern int peer_local_as_set(struct peer *peer, as_t as, bool no_prepend, |
2305 | | bool replace_as, const char *as_str); |
2306 | | extern int peer_local_as_unset(struct peer *); |
2307 | | |
2308 | | extern int peer_prefix_list_set(struct peer *, afi_t, safi_t, int, |
2309 | | const char *); |
2310 | | extern int peer_prefix_list_unset(struct peer *, afi_t, safi_t, int); |
2311 | | |
2312 | | extern int peer_aslist_set(struct peer *, afi_t, safi_t, int, const char *); |
2313 | | extern int peer_aslist_unset(struct peer *, afi_t, safi_t, int); |
2314 | | |
2315 | | extern int peer_route_map_set(struct peer *peer, afi_t afi, safi_t safi, int, |
2316 | | const char *name, struct route_map *route_map); |
2317 | | extern int peer_route_map_unset(struct peer *, afi_t, safi_t, int); |
2318 | | |
2319 | | extern int peer_unsuppress_map_set(struct peer *peer, afi_t afi, safi_t safi, |
2320 | | const char *name, |
2321 | | struct route_map *route_map); |
2322 | | |
2323 | | extern int peer_advertise_map_set(struct peer *peer, afi_t afi, safi_t safi, |
2324 | | const char *advertise_name, |
2325 | | struct route_map *advertise_map, |
2326 | | const char *condition_name, |
2327 | | struct route_map *condition_map, |
2328 | | bool condition); |
2329 | | |
2330 | | extern int peer_password_set(struct peer *, const char *); |
2331 | | extern int peer_password_unset(struct peer *); |
2332 | | |
2333 | | extern int peer_unsuppress_map_unset(struct peer *, afi_t, safi_t); |
2334 | | |
2335 | | extern int peer_advertise_map_unset(struct peer *peer, afi_t afi, safi_t safi, |
2336 | | const char *advertise_name, |
2337 | | struct route_map *advertise_map, |
2338 | | const char *condition_name, |
2339 | | struct route_map *condition_map, |
2340 | | bool condition); |
2341 | | |
2342 | | extern int peer_maximum_prefix_set(struct peer *, afi_t, safi_t, uint32_t, |
2343 | | uint8_t, int, uint16_t, bool force); |
2344 | | extern int peer_maximum_prefix_unset(struct peer *, afi_t, safi_t); |
2345 | | |
2346 | | extern void peer_maximum_prefix_out_refresh_routes(struct peer *peer, afi_t afi, |
2347 | | safi_t safi); |
2348 | | extern int peer_maximum_prefix_out_set(struct peer *peer, afi_t afi, |
2349 | | safi_t safi, uint32_t max); |
2350 | | extern int peer_maximum_prefix_out_unset(struct peer *peer, afi_t afi, |
2351 | | safi_t safi); |
2352 | | |
2353 | | extern int peer_clear(struct peer *, struct listnode **); |
2354 | | extern int peer_clear_soft(struct peer *, afi_t, safi_t, enum bgp_clear_type); |
2355 | | |
2356 | | extern int peer_ttl_security_hops_set(struct peer *, int); |
2357 | | extern int peer_ttl_security_hops_unset(struct peer *); |
2358 | | |
2359 | | extern void peer_tx_shutdown_message_set(struct peer *, const char *msg); |
2360 | | extern void peer_tx_shutdown_message_unset(struct peer *); |
2361 | | |
2362 | | extern void bgp_route_map_update_timer(struct event *thread); |
2363 | | extern const char *bgp_get_name_by_role(uint8_t role); |
2364 | | extern enum asnotation_mode bgp_get_asnotation(struct bgp *bgp); |
2365 | | |
2366 | | extern void bgp_route_map_terminate(void); |
2367 | | |
2368 | | extern int peer_cmp(struct peer *p1, struct peer *p2); |
2369 | | |
2370 | | extern int bgp_map_afi_safi_iana2int(iana_afi_t pkt_afi, iana_safi_t pkt_safi, |
2371 | | afi_t *afi, safi_t *safi); |
2372 | | extern int bgp_map_afi_safi_int2iana(afi_t afi, safi_t safi, |
2373 | | iana_afi_t *pkt_afi, |
2374 | | iana_safi_t *pkt_safi); |
2375 | | |
2376 | | extern struct peer_af *peer_af_create(struct peer *, afi_t, safi_t); |
2377 | | extern struct peer_af *peer_af_find(struct peer *, afi_t, safi_t); |
2378 | | extern int peer_af_delete(struct peer *, afi_t, safi_t); |
2379 | | |
2380 | | extern void bgp_shutdown_enable(struct bgp *bgp, const char *msg); |
2381 | | extern void bgp_shutdown_disable(struct bgp *bgp); |
2382 | | |
2383 | | extern void bgp_close(void); |
2384 | | extern void bgp_free(struct bgp *); |
2385 | | void bgp_gr_apply_running_config(void); |
2386 | | |
2387 | | /* BGP GR */ |
2388 | | int bgp_global_gr_init(struct bgp *bgp); |
2389 | | int bgp_peer_gr_init(struct peer *peer); |
2390 | | |
2391 | | |
2392 | | #define BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(_bgp, _peer_list) \ |
2393 | 737 | do { \ |
2394 | 737 | struct peer *peer_loop; \ |
2395 | 737 | bool gr_router_detected = false; \ |
2396 | 737 | struct listnode *node = {0}; \ |
2397 | 737 | for (ALL_LIST_ELEMENTS_RO(_peer_list, node, peer_loop)) { \ |
2398 | 737 | if (CHECK_FLAG(peer_loop->flags, \ |
2399 | 737 | PEER_FLAG_GRACEFUL_RESTART)) \ |
2400 | 737 | gr_router_detected = true; \ |
2401 | 737 | } \ |
2402 | 737 | if (gr_router_detected \ |
2403 | 737 | && _bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) { \ |
2404 | 0 | bgp_zebra_send_capabilities(_bgp, false); \ |
2405 | 737 | } else if (!gr_router_detected \ |
2406 | 737 | && _bgp->present_zebra_gr_state \ |
2407 | 737 | == ZEBRA_GR_ENABLE) { \ |
2408 | 0 | bgp_zebra_send_capabilities(_bgp, true); \ |
2409 | 0 | } \ |
2410 | 737 | } while (0) |
2411 | | |
2412 | | static inline struct bgp *bgp_lock(struct bgp *bgp) |
2413 | 4 | { |
2414 | 4 | bgp->lock++; |
2415 | 4 | return bgp; |
2416 | 4 | } Unexecuted instantiation: bgp_main.c:bgp_lock Unexecuted instantiation: bgp_attr.c:bgp_lock Unexecuted instantiation: bgp_attr_evpn.c:bgp_lock Unexecuted instantiation: bgp_clist.c:bgp_lock Unexecuted instantiation: bgp_community.c:bgp_lock Unexecuted instantiation: bgp_community_alias.c:bgp_lock Unexecuted instantiation: bgp_debug.c:bgp_lock Unexecuted instantiation: bgp_dump.c:bgp_lock Unexecuted instantiation: bgp_ecommunity.c:bgp_lock Unexecuted instantiation: bgp_evpn.c:bgp_lock Unexecuted instantiation: bgp_evpn_mh.c:bgp_lock Unexecuted instantiation: bgp_evpn_vty.c:bgp_lock Unexecuted instantiation: bgp_filter.c:bgp_lock Unexecuted instantiation: bgp_flowspec_vty.c:bgp_lock Unexecuted instantiation: bgp_fsm.c:bgp_lock Unexecuted instantiation: bgp_io.c:bgp_lock Unexecuted instantiation: bgp_keepalives.c:bgp_lock Unexecuted instantiation: bgp_labelpool.c:bgp_lock Unexecuted instantiation: bgp_lcommunity.c:bgp_lock Unexecuted instantiation: bgp_mac.c:bgp_lock Unexecuted instantiation: bgp_mpath.c:bgp_lock Unexecuted instantiation: bgp_mplsvpn.c:bgp_lock Unexecuted instantiation: bgp_network.c:bgp_lock Unexecuted instantiation: bgp_nexthop.c:bgp_lock Unexecuted instantiation: bgp_nht.c:bgp_lock Unexecuted instantiation: bgp_packet.c:bgp_lock Unexecuted instantiation: bgp_pbr.c:bgp_lock Unexecuted instantiation: bgp_rd.c:bgp_lock Unexecuted instantiation: bgp_regex.c:bgp_lock Unexecuted instantiation: bgp_route.c:bgp_lock Unexecuted instantiation: bgp_routemap.c:bgp_lock Unexecuted instantiation: bgp_routemap_nb.c:bgp_lock Unexecuted instantiation: bgp_routemap_nb_config.c:bgp_lock Unexecuted instantiation: bgp_table.c:bgp_lock Unexecuted instantiation: bgp_updgrp.c:bgp_lock Unexecuted instantiation: bgp_updgrp_adv.c:bgp_lock Unexecuted instantiation: bgp_updgrp_packet.c:bgp_lock Unexecuted instantiation: bgp_vpn.c:bgp_lock Unexecuted instantiation: bgp_vty.c:bgp_lock Unexecuted instantiation: bgp_zebra.c:bgp_lock Unexecuted instantiation: bgp_rfapi_cfg.c:bgp_lock Unexecuted instantiation: rfapi_import.c:bgp_lock Unexecuted instantiation: rfapi.c:bgp_lock Unexecuted instantiation: rfapi_ap.c:bgp_lock Unexecuted instantiation: rfapi_encap_tlv.c:bgp_lock Unexecuted instantiation: rfapi_nve_addr.c:bgp_lock Unexecuted instantiation: rfapi_monitor.c:bgp_lock Unexecuted instantiation: rfapi_rib.c:bgp_lock Unexecuted instantiation: rfapi_vty.c:bgp_lock Unexecuted instantiation: vnc_export_bgp.c:bgp_lock Unexecuted instantiation: vnc_export_table.c:bgp_lock Unexecuted instantiation: vnc_import_bgp.c:bgp_lock Unexecuted instantiation: vnc_zebra.c:bgp_lock Unexecuted instantiation: bgp_addpath.c:bgp_lock Unexecuted instantiation: bgp_advertise.c:bgp_lock Unexecuted instantiation: bgp_aspath.c:bgp_lock Unexecuted instantiation: bgp_bfd.c:bgp_lock Unexecuted instantiation: bgp_conditional_adv.c:bgp_lock Unexecuted instantiation: bgp_damp.c:bgp_lock Unexecuted instantiation: bgp_encap_tlv.c:bgp_lock Unexecuted instantiation: bgp_flowspec.c:bgp_lock Unexecuted instantiation: bgp_flowspec_util.c:bgp_lock Unexecuted instantiation: bgp_label.c:bgp_lock Unexecuted instantiation: bgp_open.c:bgp_lock Unexecuted instantiation: rfp_example.c:bgp_lock |
2417 | | |
2418 | | static inline void bgp_unlock(struct bgp *bgp) |
2419 | 0 | { |
2420 | 0 | assert(bgp->lock > 0); |
2421 | 0 | if (--bgp->lock == 0) |
2422 | 0 | bgp_free(bgp); |
2423 | 0 | } Unexecuted instantiation: bgp_main.c:bgp_unlock Unexecuted instantiation: bgp_attr.c:bgp_unlock Unexecuted instantiation: bgp_attr_evpn.c:bgp_unlock Unexecuted instantiation: bgp_clist.c:bgp_unlock Unexecuted instantiation: bgp_community.c:bgp_unlock Unexecuted instantiation: bgp_community_alias.c:bgp_unlock Unexecuted instantiation: bgp_debug.c:bgp_unlock Unexecuted instantiation: bgp_dump.c:bgp_unlock Unexecuted instantiation: bgp_ecommunity.c:bgp_unlock Unexecuted instantiation: bgp_evpn.c:bgp_unlock Unexecuted instantiation: bgp_evpn_mh.c:bgp_unlock Unexecuted instantiation: bgp_evpn_vty.c:bgp_unlock Unexecuted instantiation: bgp_filter.c:bgp_unlock Unexecuted instantiation: bgp_flowspec_vty.c:bgp_unlock Unexecuted instantiation: bgp_fsm.c:bgp_unlock Unexecuted instantiation: bgp_io.c:bgp_unlock Unexecuted instantiation: bgp_keepalives.c:bgp_unlock Unexecuted instantiation: bgp_labelpool.c:bgp_unlock Unexecuted instantiation: bgp_lcommunity.c:bgp_unlock Unexecuted instantiation: bgp_mac.c:bgp_unlock Unexecuted instantiation: bgp_mpath.c:bgp_unlock Unexecuted instantiation: bgp_mplsvpn.c:bgp_unlock Unexecuted instantiation: bgp_network.c:bgp_unlock Unexecuted instantiation: bgp_nexthop.c:bgp_unlock Unexecuted instantiation: bgp_nht.c:bgp_unlock Unexecuted instantiation: bgp_packet.c:bgp_unlock Unexecuted instantiation: bgp_pbr.c:bgp_unlock Unexecuted instantiation: bgp_rd.c:bgp_unlock Unexecuted instantiation: bgp_regex.c:bgp_unlock Unexecuted instantiation: bgp_route.c:bgp_unlock Unexecuted instantiation: bgp_routemap.c:bgp_unlock Unexecuted instantiation: bgp_routemap_nb.c:bgp_unlock Unexecuted instantiation: bgp_routemap_nb_config.c:bgp_unlock Unexecuted instantiation: bgp_table.c:bgp_unlock Unexecuted instantiation: bgp_updgrp.c:bgp_unlock Unexecuted instantiation: bgp_updgrp_adv.c:bgp_unlock Unexecuted instantiation: bgp_updgrp_packet.c:bgp_unlock Unexecuted instantiation: bgp_vpn.c:bgp_unlock Unexecuted instantiation: bgp_vty.c:bgp_unlock Unexecuted instantiation: bgp_zebra.c:bgp_unlock Unexecuted instantiation: bgpd.c:bgp_unlock Unexecuted instantiation: bgp_rfapi_cfg.c:bgp_unlock Unexecuted instantiation: rfapi_import.c:bgp_unlock Unexecuted instantiation: rfapi.c:bgp_unlock Unexecuted instantiation: rfapi_ap.c:bgp_unlock Unexecuted instantiation: rfapi_encap_tlv.c:bgp_unlock Unexecuted instantiation: rfapi_nve_addr.c:bgp_unlock Unexecuted instantiation: rfapi_monitor.c:bgp_unlock Unexecuted instantiation: rfapi_rib.c:bgp_unlock Unexecuted instantiation: rfapi_vty.c:bgp_unlock Unexecuted instantiation: vnc_export_bgp.c:bgp_unlock Unexecuted instantiation: vnc_export_table.c:bgp_unlock Unexecuted instantiation: vnc_import_bgp.c:bgp_unlock Unexecuted instantiation: vnc_zebra.c:bgp_unlock Unexecuted instantiation: bgp_addpath.c:bgp_unlock Unexecuted instantiation: bgp_advertise.c:bgp_unlock Unexecuted instantiation: bgp_aspath.c:bgp_unlock Unexecuted instantiation: bgp_bfd.c:bgp_unlock Unexecuted instantiation: bgp_conditional_adv.c:bgp_unlock Unexecuted instantiation: bgp_damp.c:bgp_unlock Unexecuted instantiation: bgp_encap_tlv.c:bgp_unlock Unexecuted instantiation: bgp_flowspec.c:bgp_unlock Unexecuted instantiation: bgp_flowspec_util.c:bgp_unlock Unexecuted instantiation: bgp_label.c:bgp_unlock Unexecuted instantiation: bgp_open.c:bgp_unlock Unexecuted instantiation: rfp_example.c:bgp_unlock |
2424 | | |
2425 | | static inline int afindex(afi_t afi, safi_t safi) |
2426 | 153 | { |
2427 | 153 | switch (afi) { |
2428 | 78 | case AFI_IP: |
2429 | 78 | switch (safi) { |
2430 | 21 | case SAFI_UNICAST: |
2431 | 21 | return BGP_AF_IPV4_UNICAST; |
2432 | 15 | case SAFI_MULTICAST: |
2433 | 15 | return BGP_AF_IPV4_MULTICAST; |
2434 | 13 | case SAFI_LABELED_UNICAST: |
2435 | 13 | return BGP_AF_IPV4_LBL_UNICAST; |
2436 | 24 | case SAFI_MPLS_VPN: |
2437 | 24 | return BGP_AF_IPV4_VPN; |
2438 | 0 | case SAFI_ENCAP: |
2439 | 0 | return BGP_AF_IPV4_ENCAP; |
2440 | 0 | case SAFI_FLOWSPEC: |
2441 | 0 | return BGP_AF_IPV4_FLOWSPEC; |
2442 | 5 | case SAFI_EVPN: |
2443 | 5 | case SAFI_UNSPEC: |
2444 | 5 | case SAFI_MAX: |
2445 | 5 | return BGP_AF_MAX; |
2446 | 78 | } |
2447 | 0 | break; |
2448 | 71 | case AFI_IP6: |
2449 | 71 | switch (safi) { |
2450 | 28 | case SAFI_UNICAST: |
2451 | 28 | return BGP_AF_IPV6_UNICAST; |
2452 | 3 | case SAFI_MULTICAST: |
2453 | 3 | return BGP_AF_IPV6_MULTICAST; |
2454 | 10 | case SAFI_LABELED_UNICAST: |
2455 | 10 | return BGP_AF_IPV6_LBL_UNICAST; |
2456 | 2 | case SAFI_MPLS_VPN: |
2457 | 2 | return BGP_AF_IPV6_VPN; |
2458 | 6 | case SAFI_ENCAP: |
2459 | 6 | return BGP_AF_IPV6_ENCAP; |
2460 | 1 | case SAFI_FLOWSPEC: |
2461 | 1 | return BGP_AF_IPV6_FLOWSPEC; |
2462 | 21 | case SAFI_EVPN: |
2463 | 21 | case SAFI_UNSPEC: |
2464 | 21 | case SAFI_MAX: |
2465 | 21 | return BGP_AF_MAX; |
2466 | 71 | } |
2467 | 0 | break; |
2468 | 4 | case AFI_L2VPN: |
2469 | 4 | switch (safi) { |
2470 | 1 | case SAFI_EVPN: |
2471 | 1 | return BGP_AF_L2VPN_EVPN; |
2472 | 1 | case SAFI_UNICAST: |
2473 | 1 | case SAFI_MULTICAST: |
2474 | 2 | case SAFI_LABELED_UNICAST: |
2475 | 3 | case SAFI_MPLS_VPN: |
2476 | 3 | case SAFI_ENCAP: |
2477 | 3 | case SAFI_FLOWSPEC: |
2478 | 3 | case SAFI_UNSPEC: |
2479 | 3 | case SAFI_MAX: |
2480 | 3 | return BGP_AF_MAX; |
2481 | 4 | } |
2482 | 0 | break; |
2483 | 0 | case AFI_UNSPEC: |
2484 | 0 | case AFI_MAX: |
2485 | 0 | return BGP_AF_MAX; |
2486 | 153 | } |
2487 | | |
2488 | 153 | assert(!"Reached end of function we should never hit"); |
2489 | 0 | } Unexecuted instantiation: bgp_main.c:afindex Unexecuted instantiation: bgp_attr.c:afindex Unexecuted instantiation: bgp_attr_evpn.c:afindex Unexecuted instantiation: bgp_clist.c:afindex Unexecuted instantiation: bgp_community.c:afindex Unexecuted instantiation: bgp_community_alias.c:afindex Unexecuted instantiation: bgp_debug.c:afindex Unexecuted instantiation: bgp_dump.c:afindex Unexecuted instantiation: bgp_ecommunity.c:afindex Unexecuted instantiation: bgp_evpn.c:afindex Unexecuted instantiation: bgp_evpn_mh.c:afindex Unexecuted instantiation: bgp_evpn_vty.c:afindex Unexecuted instantiation: bgp_filter.c:afindex Unexecuted instantiation: bgp_flowspec_vty.c:afindex Unexecuted instantiation: bgp_fsm.c:afindex Unexecuted instantiation: bgp_io.c:afindex Unexecuted instantiation: bgp_keepalives.c:afindex Unexecuted instantiation: bgp_labelpool.c:afindex Unexecuted instantiation: bgp_lcommunity.c:afindex Unexecuted instantiation: bgp_mac.c:afindex Unexecuted instantiation: bgp_mpath.c:afindex Unexecuted instantiation: bgp_mplsvpn.c:afindex Unexecuted instantiation: bgp_network.c:afindex Unexecuted instantiation: bgp_nexthop.c:afindex Unexecuted instantiation: bgp_nht.c:afindex Unexecuted instantiation: bgp_packet.c:afindex Unexecuted instantiation: bgp_pbr.c:afindex Unexecuted instantiation: bgp_rd.c:afindex Unexecuted instantiation: bgp_regex.c:afindex Unexecuted instantiation: bgp_route.c:afindex Unexecuted instantiation: bgp_routemap.c:afindex Unexecuted instantiation: bgp_routemap_nb.c:afindex Unexecuted instantiation: bgp_routemap_nb_config.c:afindex Unexecuted instantiation: bgp_table.c:afindex Unexecuted instantiation: bgp_updgrp.c:afindex Unexecuted instantiation: bgp_updgrp_adv.c:afindex Unexecuted instantiation: bgp_updgrp_packet.c:afindex Unexecuted instantiation: bgp_vpn.c:afindex Unexecuted instantiation: bgp_vty.c:afindex Unexecuted instantiation: bgp_zebra.c:afindex Line | Count | Source | 2426 | 153 | { | 2427 | 153 | switch (afi) { | 2428 | 78 | case AFI_IP: | 2429 | 78 | switch (safi) { | 2430 | 21 | case SAFI_UNICAST: | 2431 | 21 | return BGP_AF_IPV4_UNICAST; | 2432 | 15 | case SAFI_MULTICAST: | 2433 | 15 | return BGP_AF_IPV4_MULTICAST; | 2434 | 13 | case SAFI_LABELED_UNICAST: | 2435 | 13 | return BGP_AF_IPV4_LBL_UNICAST; | 2436 | 24 | case SAFI_MPLS_VPN: | 2437 | 24 | return BGP_AF_IPV4_VPN; | 2438 | 0 | case SAFI_ENCAP: | 2439 | 0 | return BGP_AF_IPV4_ENCAP; | 2440 | 0 | case SAFI_FLOWSPEC: | 2441 | 0 | return BGP_AF_IPV4_FLOWSPEC; | 2442 | 5 | case SAFI_EVPN: | 2443 | 5 | case SAFI_UNSPEC: | 2444 | 5 | case SAFI_MAX: | 2445 | 5 | return BGP_AF_MAX; | 2446 | 78 | } | 2447 | 0 | break; | 2448 | 71 | case AFI_IP6: | 2449 | 71 | switch (safi) { | 2450 | 28 | case SAFI_UNICAST: | 2451 | 28 | return BGP_AF_IPV6_UNICAST; | 2452 | 3 | case SAFI_MULTICAST: | 2453 | 3 | return BGP_AF_IPV6_MULTICAST; | 2454 | 10 | case SAFI_LABELED_UNICAST: | 2455 | 10 | return BGP_AF_IPV6_LBL_UNICAST; | 2456 | 2 | case SAFI_MPLS_VPN: | 2457 | 2 | return BGP_AF_IPV6_VPN; | 2458 | 6 | case SAFI_ENCAP: | 2459 | 6 | return BGP_AF_IPV6_ENCAP; | 2460 | 1 | case SAFI_FLOWSPEC: | 2461 | 1 | return BGP_AF_IPV6_FLOWSPEC; | 2462 | 21 | case SAFI_EVPN: | 2463 | 21 | case SAFI_UNSPEC: | 2464 | 21 | case SAFI_MAX: | 2465 | 21 | return BGP_AF_MAX; | 2466 | 71 | } | 2467 | 0 | break; | 2468 | 4 | case AFI_L2VPN: | 2469 | 4 | switch (safi) { | 2470 | 1 | case SAFI_EVPN: | 2471 | 1 | return BGP_AF_L2VPN_EVPN; | 2472 | 1 | case SAFI_UNICAST: | 2473 | 1 | case SAFI_MULTICAST: | 2474 | 2 | case SAFI_LABELED_UNICAST: | 2475 | 3 | case SAFI_MPLS_VPN: | 2476 | 3 | case SAFI_ENCAP: | 2477 | 3 | case SAFI_FLOWSPEC: | 2478 | 3 | case SAFI_UNSPEC: | 2479 | 3 | case SAFI_MAX: | 2480 | 3 | return BGP_AF_MAX; | 2481 | 4 | } | 2482 | 0 | break; | 2483 | 0 | case AFI_UNSPEC: | 2484 | 0 | case AFI_MAX: | 2485 | 0 | return BGP_AF_MAX; | 2486 | 153 | } | 2487 | | | 2488 | 153 | assert(!"Reached end of function we should never hit"); | 2489 | 0 | } |
Unexecuted instantiation: bgp_rfapi_cfg.c:afindex Unexecuted instantiation: rfapi_import.c:afindex Unexecuted instantiation: rfapi.c:afindex Unexecuted instantiation: rfapi_ap.c:afindex Unexecuted instantiation: rfapi_encap_tlv.c:afindex Unexecuted instantiation: rfapi_nve_addr.c:afindex Unexecuted instantiation: rfapi_monitor.c:afindex Unexecuted instantiation: rfapi_rib.c:afindex Unexecuted instantiation: rfapi_vty.c:afindex Unexecuted instantiation: vnc_export_bgp.c:afindex Unexecuted instantiation: vnc_export_table.c:afindex Unexecuted instantiation: vnc_import_bgp.c:afindex Unexecuted instantiation: vnc_zebra.c:afindex Unexecuted instantiation: bgp_addpath.c:afindex Unexecuted instantiation: bgp_advertise.c:afindex Unexecuted instantiation: bgp_aspath.c:afindex Unexecuted instantiation: bgp_bfd.c:afindex Unexecuted instantiation: bgp_conditional_adv.c:afindex Unexecuted instantiation: bgp_damp.c:afindex Unexecuted instantiation: bgp_encap_tlv.c:afindex Unexecuted instantiation: bgp_flowspec.c:afindex Unexecuted instantiation: bgp_flowspec_util.c:afindex Unexecuted instantiation: bgp_label.c:afindex Unexecuted instantiation: bgp_open.c:afindex Unexecuted instantiation: rfp_example.c:afindex |
2490 | | |
2491 | | /* If the peer is not a peer-group but is bound to a peer-group return 1 */ |
2492 | | static inline int peer_group_active(struct peer *peer) |
2493 | 0 | { |
2494 | 0 | if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP) && peer->group) |
2495 | 0 | return 1; |
2496 | 0 | return 0; |
2497 | 0 | } Unexecuted instantiation: bgp_main.c:peer_group_active Unexecuted instantiation: bgp_attr.c:peer_group_active Unexecuted instantiation: bgp_attr_evpn.c:peer_group_active Unexecuted instantiation: bgp_clist.c:peer_group_active Unexecuted instantiation: bgp_community.c:peer_group_active Unexecuted instantiation: bgp_community_alias.c:peer_group_active Unexecuted instantiation: bgp_debug.c:peer_group_active Unexecuted instantiation: bgp_dump.c:peer_group_active Unexecuted instantiation: bgp_ecommunity.c:peer_group_active Unexecuted instantiation: bgp_evpn.c:peer_group_active Unexecuted instantiation: bgp_evpn_mh.c:peer_group_active Unexecuted instantiation: bgp_evpn_vty.c:peer_group_active Unexecuted instantiation: bgp_filter.c:peer_group_active Unexecuted instantiation: bgp_flowspec_vty.c:peer_group_active Unexecuted instantiation: bgp_fsm.c:peer_group_active Unexecuted instantiation: bgp_io.c:peer_group_active Unexecuted instantiation: bgp_keepalives.c:peer_group_active Unexecuted instantiation: bgp_labelpool.c:peer_group_active Unexecuted instantiation: bgp_lcommunity.c:peer_group_active Unexecuted instantiation: bgp_mac.c:peer_group_active Unexecuted instantiation: bgp_mpath.c:peer_group_active Unexecuted instantiation: bgp_mplsvpn.c:peer_group_active Unexecuted instantiation: bgp_network.c:peer_group_active Unexecuted instantiation: bgp_nexthop.c:peer_group_active Unexecuted instantiation: bgp_nht.c:peer_group_active Unexecuted instantiation: bgp_packet.c:peer_group_active Unexecuted instantiation: bgp_pbr.c:peer_group_active Unexecuted instantiation: bgp_rd.c:peer_group_active Unexecuted instantiation: bgp_regex.c:peer_group_active Unexecuted instantiation: bgp_route.c:peer_group_active Unexecuted instantiation: bgp_routemap.c:peer_group_active Unexecuted instantiation: bgp_routemap_nb.c:peer_group_active Unexecuted instantiation: bgp_routemap_nb_config.c:peer_group_active Unexecuted instantiation: bgp_table.c:peer_group_active Unexecuted instantiation: bgp_updgrp.c:peer_group_active Unexecuted instantiation: bgp_updgrp_adv.c:peer_group_active Unexecuted instantiation: bgp_updgrp_packet.c:peer_group_active Unexecuted instantiation: bgp_vpn.c:peer_group_active Unexecuted instantiation: bgp_vty.c:peer_group_active Unexecuted instantiation: bgp_zebra.c:peer_group_active Unexecuted instantiation: bgpd.c:peer_group_active Unexecuted instantiation: bgp_rfapi_cfg.c:peer_group_active Unexecuted instantiation: rfapi_import.c:peer_group_active Unexecuted instantiation: rfapi.c:peer_group_active Unexecuted instantiation: rfapi_ap.c:peer_group_active Unexecuted instantiation: rfapi_encap_tlv.c:peer_group_active Unexecuted instantiation: rfapi_nve_addr.c:peer_group_active Unexecuted instantiation: rfapi_monitor.c:peer_group_active Unexecuted instantiation: rfapi_rib.c:peer_group_active Unexecuted instantiation: rfapi_vty.c:peer_group_active Unexecuted instantiation: vnc_export_bgp.c:peer_group_active Unexecuted instantiation: vnc_export_table.c:peer_group_active Unexecuted instantiation: vnc_import_bgp.c:peer_group_active Unexecuted instantiation: vnc_zebra.c:peer_group_active Unexecuted instantiation: bgp_addpath.c:peer_group_active Unexecuted instantiation: bgp_advertise.c:peer_group_active Unexecuted instantiation: bgp_aspath.c:peer_group_active Unexecuted instantiation: bgp_bfd.c:peer_group_active Unexecuted instantiation: bgp_conditional_adv.c:peer_group_active Unexecuted instantiation: bgp_damp.c:peer_group_active Unexecuted instantiation: bgp_encap_tlv.c:peer_group_active Unexecuted instantiation: bgp_flowspec.c:peer_group_active Unexecuted instantiation: bgp_flowspec_util.c:peer_group_active Unexecuted instantiation: bgp_label.c:peer_group_active Unexecuted instantiation: bgp_open.c:peer_group_active Unexecuted instantiation: rfp_example.c:peer_group_active |
2498 | | |
2499 | | /* If peer is negotiated at least one address family return 1. */ |
2500 | | static inline int peer_afi_active_nego(const struct peer *peer, afi_t afi) |
2501 | 0 | { |
2502 | 0 | if (peer->afc_nego[afi][SAFI_UNICAST] |
2503 | 0 | || peer->afc_nego[afi][SAFI_MULTICAST] |
2504 | 0 | || peer->afc_nego[afi][SAFI_LABELED_UNICAST] |
2505 | 0 | || peer->afc_nego[afi][SAFI_MPLS_VPN] |
2506 | 0 | || peer->afc_nego[afi][SAFI_ENCAP] |
2507 | 0 | || peer->afc_nego[afi][SAFI_FLOWSPEC] |
2508 | 0 | || peer->afc_nego[afi][SAFI_EVPN]) |
2509 | 0 | return 1; |
2510 | 0 | return 0; |
2511 | 0 | } Unexecuted instantiation: bgp_main.c:peer_afi_active_nego Unexecuted instantiation: bgp_attr.c:peer_afi_active_nego Unexecuted instantiation: bgp_attr_evpn.c:peer_afi_active_nego Unexecuted instantiation: bgp_clist.c:peer_afi_active_nego Unexecuted instantiation: bgp_community.c:peer_afi_active_nego Unexecuted instantiation: bgp_community_alias.c:peer_afi_active_nego Unexecuted instantiation: bgp_debug.c:peer_afi_active_nego Unexecuted instantiation: bgp_dump.c:peer_afi_active_nego Unexecuted instantiation: bgp_ecommunity.c:peer_afi_active_nego Unexecuted instantiation: bgp_evpn.c:peer_afi_active_nego Unexecuted instantiation: bgp_evpn_mh.c:peer_afi_active_nego Unexecuted instantiation: bgp_evpn_vty.c:peer_afi_active_nego Unexecuted instantiation: bgp_filter.c:peer_afi_active_nego Unexecuted instantiation: bgp_flowspec_vty.c:peer_afi_active_nego Unexecuted instantiation: bgp_fsm.c:peer_afi_active_nego Unexecuted instantiation: bgp_io.c:peer_afi_active_nego Unexecuted instantiation: bgp_keepalives.c:peer_afi_active_nego Unexecuted instantiation: bgp_labelpool.c:peer_afi_active_nego Unexecuted instantiation: bgp_lcommunity.c:peer_afi_active_nego Unexecuted instantiation: bgp_mac.c:peer_afi_active_nego Unexecuted instantiation: bgp_mpath.c:peer_afi_active_nego Unexecuted instantiation: bgp_mplsvpn.c:peer_afi_active_nego Unexecuted instantiation: bgp_network.c:peer_afi_active_nego Unexecuted instantiation: bgp_nexthop.c:peer_afi_active_nego Unexecuted instantiation: bgp_nht.c:peer_afi_active_nego Unexecuted instantiation: bgp_packet.c:peer_afi_active_nego Unexecuted instantiation: bgp_pbr.c:peer_afi_active_nego Unexecuted instantiation: bgp_rd.c:peer_afi_active_nego Unexecuted instantiation: bgp_regex.c:peer_afi_active_nego Unexecuted instantiation: bgp_route.c:peer_afi_active_nego Unexecuted instantiation: bgp_routemap.c:peer_afi_active_nego Unexecuted instantiation: bgp_routemap_nb.c:peer_afi_active_nego Unexecuted instantiation: bgp_routemap_nb_config.c:peer_afi_active_nego Unexecuted instantiation: bgp_table.c:peer_afi_active_nego Unexecuted instantiation: bgp_updgrp.c:peer_afi_active_nego Unexecuted instantiation: bgp_updgrp_adv.c:peer_afi_active_nego Unexecuted instantiation: bgp_updgrp_packet.c:peer_afi_active_nego Unexecuted instantiation: bgp_vpn.c:peer_afi_active_nego Unexecuted instantiation: bgp_vty.c:peer_afi_active_nego Unexecuted instantiation: bgp_zebra.c:peer_afi_active_nego Unexecuted instantiation: bgpd.c:peer_afi_active_nego Unexecuted instantiation: bgp_rfapi_cfg.c:peer_afi_active_nego Unexecuted instantiation: rfapi_import.c:peer_afi_active_nego Unexecuted instantiation: rfapi.c:peer_afi_active_nego Unexecuted instantiation: rfapi_ap.c:peer_afi_active_nego Unexecuted instantiation: rfapi_encap_tlv.c:peer_afi_active_nego Unexecuted instantiation: rfapi_nve_addr.c:peer_afi_active_nego Unexecuted instantiation: rfapi_monitor.c:peer_afi_active_nego Unexecuted instantiation: rfapi_rib.c:peer_afi_active_nego Unexecuted instantiation: rfapi_vty.c:peer_afi_active_nego Unexecuted instantiation: vnc_export_bgp.c:peer_afi_active_nego Unexecuted instantiation: vnc_export_table.c:peer_afi_active_nego Unexecuted instantiation: vnc_import_bgp.c:peer_afi_active_nego Unexecuted instantiation: vnc_zebra.c:peer_afi_active_nego Unexecuted instantiation: bgp_addpath.c:peer_afi_active_nego Unexecuted instantiation: bgp_advertise.c:peer_afi_active_nego Unexecuted instantiation: bgp_aspath.c:peer_afi_active_nego Unexecuted instantiation: bgp_bfd.c:peer_afi_active_nego Unexecuted instantiation: bgp_conditional_adv.c:peer_afi_active_nego Unexecuted instantiation: bgp_damp.c:peer_afi_active_nego Unexecuted instantiation: bgp_encap_tlv.c:peer_afi_active_nego Unexecuted instantiation: bgp_flowspec.c:peer_afi_active_nego Unexecuted instantiation: bgp_flowspec_util.c:peer_afi_active_nego Unexecuted instantiation: bgp_label.c:peer_afi_active_nego Unexecuted instantiation: bgp_open.c:peer_afi_active_nego Unexecuted instantiation: rfp_example.c:peer_afi_active_nego |
2512 | | |
2513 | | /* If at least one address family activated for group, return 1. */ |
2514 | | static inline int peer_group_af_configured(struct peer_group *group) |
2515 | 0 | { |
2516 | 0 | struct peer *peer = group->conf; |
2517 | |
|
2518 | 0 | if (peer->afc[AFI_IP][SAFI_UNICAST] || peer->afc[AFI_IP][SAFI_MULTICAST] |
2519 | 0 | || peer->afc[AFI_IP][SAFI_LABELED_UNICAST] |
2520 | 0 | || peer->afc[AFI_IP][SAFI_FLOWSPEC] |
2521 | 0 | || peer->afc[AFI_IP][SAFI_MPLS_VPN] || peer->afc[AFI_IP][SAFI_ENCAP] |
2522 | 0 | || peer->afc[AFI_IP6][SAFI_UNICAST] |
2523 | 0 | || peer->afc[AFI_IP6][SAFI_MULTICAST] |
2524 | 0 | || peer->afc[AFI_IP6][SAFI_LABELED_UNICAST] |
2525 | 0 | || peer->afc[AFI_IP6][SAFI_MPLS_VPN] |
2526 | 0 | || peer->afc[AFI_IP6][SAFI_ENCAP] |
2527 | 0 | || peer->afc[AFI_IP6][SAFI_FLOWSPEC] |
2528 | 0 | || peer->afc[AFI_L2VPN][SAFI_EVPN]) |
2529 | 0 | return 1; |
2530 | 0 | return 0; |
2531 | 0 | } Unexecuted instantiation: bgp_main.c:peer_group_af_configured Unexecuted instantiation: bgp_attr.c:peer_group_af_configured Unexecuted instantiation: bgp_attr_evpn.c:peer_group_af_configured Unexecuted instantiation: bgp_clist.c:peer_group_af_configured Unexecuted instantiation: bgp_community.c:peer_group_af_configured Unexecuted instantiation: bgp_community_alias.c:peer_group_af_configured Unexecuted instantiation: bgp_debug.c:peer_group_af_configured Unexecuted instantiation: bgp_dump.c:peer_group_af_configured Unexecuted instantiation: bgp_ecommunity.c:peer_group_af_configured Unexecuted instantiation: bgp_evpn.c:peer_group_af_configured Unexecuted instantiation: bgp_evpn_mh.c:peer_group_af_configured Unexecuted instantiation: bgp_evpn_vty.c:peer_group_af_configured Unexecuted instantiation: bgp_filter.c:peer_group_af_configured Unexecuted instantiation: bgp_flowspec_vty.c:peer_group_af_configured Unexecuted instantiation: bgp_fsm.c:peer_group_af_configured Unexecuted instantiation: bgp_io.c:peer_group_af_configured Unexecuted instantiation: bgp_keepalives.c:peer_group_af_configured Unexecuted instantiation: bgp_labelpool.c:peer_group_af_configured Unexecuted instantiation: bgp_lcommunity.c:peer_group_af_configured Unexecuted instantiation: bgp_mac.c:peer_group_af_configured Unexecuted instantiation: bgp_mpath.c:peer_group_af_configured Unexecuted instantiation: bgp_mplsvpn.c:peer_group_af_configured Unexecuted instantiation: bgp_network.c:peer_group_af_configured Unexecuted instantiation: bgp_nexthop.c:peer_group_af_configured Unexecuted instantiation: bgp_nht.c:peer_group_af_configured Unexecuted instantiation: bgp_packet.c:peer_group_af_configured Unexecuted instantiation: bgp_pbr.c:peer_group_af_configured Unexecuted instantiation: bgp_rd.c:peer_group_af_configured Unexecuted instantiation: bgp_regex.c:peer_group_af_configured Unexecuted instantiation: bgp_route.c:peer_group_af_configured Unexecuted instantiation: bgp_routemap.c:peer_group_af_configured Unexecuted instantiation: bgp_routemap_nb.c:peer_group_af_configured Unexecuted instantiation: bgp_routemap_nb_config.c:peer_group_af_configured Unexecuted instantiation: bgp_table.c:peer_group_af_configured Unexecuted instantiation: bgp_updgrp.c:peer_group_af_configured Unexecuted instantiation: bgp_updgrp_adv.c:peer_group_af_configured Unexecuted instantiation: bgp_updgrp_packet.c:peer_group_af_configured Unexecuted instantiation: bgp_vpn.c:peer_group_af_configured Unexecuted instantiation: bgp_vty.c:peer_group_af_configured Unexecuted instantiation: bgp_zebra.c:peer_group_af_configured Unexecuted instantiation: bgpd.c:peer_group_af_configured Unexecuted instantiation: bgp_rfapi_cfg.c:peer_group_af_configured Unexecuted instantiation: rfapi_import.c:peer_group_af_configured Unexecuted instantiation: rfapi.c:peer_group_af_configured Unexecuted instantiation: rfapi_ap.c:peer_group_af_configured Unexecuted instantiation: rfapi_encap_tlv.c:peer_group_af_configured Unexecuted instantiation: rfapi_nve_addr.c:peer_group_af_configured Unexecuted instantiation: rfapi_monitor.c:peer_group_af_configured Unexecuted instantiation: rfapi_rib.c:peer_group_af_configured Unexecuted instantiation: rfapi_vty.c:peer_group_af_configured Unexecuted instantiation: vnc_export_bgp.c:peer_group_af_configured Unexecuted instantiation: vnc_export_table.c:peer_group_af_configured Unexecuted instantiation: vnc_import_bgp.c:peer_group_af_configured Unexecuted instantiation: vnc_zebra.c:peer_group_af_configured Unexecuted instantiation: bgp_addpath.c:peer_group_af_configured Unexecuted instantiation: bgp_advertise.c:peer_group_af_configured Unexecuted instantiation: bgp_aspath.c:peer_group_af_configured Unexecuted instantiation: bgp_bfd.c:peer_group_af_configured Unexecuted instantiation: bgp_conditional_adv.c:peer_group_af_configured Unexecuted instantiation: bgp_damp.c:peer_group_af_configured Unexecuted instantiation: bgp_encap_tlv.c:peer_group_af_configured Unexecuted instantiation: bgp_flowspec.c:peer_group_af_configured Unexecuted instantiation: bgp_flowspec_util.c:peer_group_af_configured Unexecuted instantiation: bgp_label.c:peer_group_af_configured Unexecuted instantiation: bgp_open.c:peer_group_af_configured Unexecuted instantiation: rfp_example.c:peer_group_af_configured |
2532 | | |
2533 | | static inline char *timestamp_string(time_t ts) |
2534 | 0 | { |
2535 | 0 | time_t tbuf; |
2536 | 0 | tbuf = time(NULL) - (monotime(NULL) - ts); |
2537 | 0 | return ctime(&tbuf); |
2538 | 0 | } Unexecuted instantiation: bgp_main.c:timestamp_string Unexecuted instantiation: bgp_attr.c:timestamp_string Unexecuted instantiation: bgp_attr_evpn.c:timestamp_string Unexecuted instantiation: bgp_clist.c:timestamp_string Unexecuted instantiation: bgp_community.c:timestamp_string Unexecuted instantiation: bgp_community_alias.c:timestamp_string Unexecuted instantiation: bgp_debug.c:timestamp_string Unexecuted instantiation: bgp_dump.c:timestamp_string Unexecuted instantiation: bgp_ecommunity.c:timestamp_string Unexecuted instantiation: bgp_evpn.c:timestamp_string Unexecuted instantiation: bgp_evpn_mh.c:timestamp_string Unexecuted instantiation: bgp_evpn_vty.c:timestamp_string Unexecuted instantiation: bgp_filter.c:timestamp_string Unexecuted instantiation: bgp_flowspec_vty.c:timestamp_string Unexecuted instantiation: bgp_fsm.c:timestamp_string Unexecuted instantiation: bgp_io.c:timestamp_string Unexecuted instantiation: bgp_keepalives.c:timestamp_string Unexecuted instantiation: bgp_labelpool.c:timestamp_string Unexecuted instantiation: bgp_lcommunity.c:timestamp_string Unexecuted instantiation: bgp_mac.c:timestamp_string Unexecuted instantiation: bgp_mpath.c:timestamp_string Unexecuted instantiation: bgp_mplsvpn.c:timestamp_string Unexecuted instantiation: bgp_network.c:timestamp_string Unexecuted instantiation: bgp_nexthop.c:timestamp_string Unexecuted instantiation: bgp_nht.c:timestamp_string Unexecuted instantiation: bgp_packet.c:timestamp_string Unexecuted instantiation: bgp_pbr.c:timestamp_string Unexecuted instantiation: bgp_rd.c:timestamp_string Unexecuted instantiation: bgp_regex.c:timestamp_string Unexecuted instantiation: bgp_route.c:timestamp_string Unexecuted instantiation: bgp_routemap.c:timestamp_string Unexecuted instantiation: bgp_routemap_nb.c:timestamp_string Unexecuted instantiation: bgp_routemap_nb_config.c:timestamp_string Unexecuted instantiation: bgp_table.c:timestamp_string Unexecuted instantiation: bgp_updgrp.c:timestamp_string Unexecuted instantiation: bgp_updgrp_adv.c:timestamp_string Unexecuted instantiation: bgp_updgrp_packet.c:timestamp_string Unexecuted instantiation: bgp_vpn.c:timestamp_string Unexecuted instantiation: bgp_vty.c:timestamp_string Unexecuted instantiation: bgp_zebra.c:timestamp_string Unexecuted instantiation: bgpd.c:timestamp_string Unexecuted instantiation: bgp_rfapi_cfg.c:timestamp_string Unexecuted instantiation: rfapi_import.c:timestamp_string Unexecuted instantiation: rfapi.c:timestamp_string Unexecuted instantiation: rfapi_ap.c:timestamp_string Unexecuted instantiation: rfapi_encap_tlv.c:timestamp_string Unexecuted instantiation: rfapi_nve_addr.c:timestamp_string Unexecuted instantiation: rfapi_monitor.c:timestamp_string Unexecuted instantiation: rfapi_rib.c:timestamp_string Unexecuted instantiation: rfapi_vty.c:timestamp_string Unexecuted instantiation: vnc_export_bgp.c:timestamp_string Unexecuted instantiation: vnc_export_table.c:timestamp_string Unexecuted instantiation: vnc_import_bgp.c:timestamp_string Unexecuted instantiation: vnc_zebra.c:timestamp_string Unexecuted instantiation: bgp_addpath.c:timestamp_string Unexecuted instantiation: bgp_advertise.c:timestamp_string Unexecuted instantiation: bgp_aspath.c:timestamp_string Unexecuted instantiation: bgp_bfd.c:timestamp_string Unexecuted instantiation: bgp_conditional_adv.c:timestamp_string Unexecuted instantiation: bgp_damp.c:timestamp_string Unexecuted instantiation: bgp_encap_tlv.c:timestamp_string Unexecuted instantiation: bgp_flowspec.c:timestamp_string Unexecuted instantiation: bgp_flowspec_util.c:timestamp_string Unexecuted instantiation: bgp_label.c:timestamp_string Unexecuted instantiation: bgp_open.c:timestamp_string Unexecuted instantiation: rfp_example.c:timestamp_string |
2539 | | |
2540 | | static inline bool peer_established(struct peer *peer) |
2541 | 1.13k | { |
2542 | 1.13k | return peer->status == Established; |
2543 | 1.13k | } Unexecuted instantiation: bgp_main.c:peer_established Unexecuted instantiation: bgp_attr.c:peer_established Unexecuted instantiation: bgp_attr_evpn.c:peer_established Unexecuted instantiation: bgp_clist.c:peer_established Unexecuted instantiation: bgp_community.c:peer_established Unexecuted instantiation: bgp_community_alias.c:peer_established Unexecuted instantiation: bgp_debug.c:peer_established Unexecuted instantiation: bgp_dump.c:peer_established Unexecuted instantiation: bgp_ecommunity.c:peer_established Unexecuted instantiation: bgp_evpn.c:peer_established Unexecuted instantiation: bgp_evpn_mh.c:peer_established Unexecuted instantiation: bgp_evpn_vty.c:peer_established Unexecuted instantiation: bgp_filter.c:peer_established Unexecuted instantiation: bgp_flowspec_vty.c:peer_established Unexecuted instantiation: bgp_fsm.c:peer_established Unexecuted instantiation: bgp_io.c:peer_established Unexecuted instantiation: bgp_keepalives.c:peer_established Unexecuted instantiation: bgp_labelpool.c:peer_established Unexecuted instantiation: bgp_lcommunity.c:peer_established Unexecuted instantiation: bgp_mac.c:peer_established Unexecuted instantiation: bgp_mpath.c:peer_established Unexecuted instantiation: bgp_mplsvpn.c:peer_established Unexecuted instantiation: bgp_network.c:peer_established Unexecuted instantiation: bgp_nexthop.c:peer_established Unexecuted instantiation: bgp_nht.c:peer_established bgp_packet.c:peer_established Line | Count | Source | 2541 | 1.13k | { | 2542 | 1.13k | return peer->status == Established; | 2543 | 1.13k | } |
Unexecuted instantiation: bgp_pbr.c:peer_established Unexecuted instantiation: bgp_rd.c:peer_established Unexecuted instantiation: bgp_regex.c:peer_established Unexecuted instantiation: bgp_route.c:peer_established Unexecuted instantiation: bgp_routemap.c:peer_established Unexecuted instantiation: bgp_routemap_nb.c:peer_established Unexecuted instantiation: bgp_routemap_nb_config.c:peer_established Unexecuted instantiation: bgp_table.c:peer_established Unexecuted instantiation: bgp_updgrp.c:peer_established Unexecuted instantiation: bgp_updgrp_adv.c:peer_established Unexecuted instantiation: bgp_updgrp_packet.c:peer_established Unexecuted instantiation: bgp_vpn.c:peer_established Unexecuted instantiation: bgp_vty.c:peer_established Unexecuted instantiation: bgp_zebra.c:peer_established Line | Count | Source | 2541 | 2 | { | 2542 | 2 | return peer->status == Established; | 2543 | 2 | } |
Unexecuted instantiation: bgp_rfapi_cfg.c:peer_established Unexecuted instantiation: rfapi_import.c:peer_established Unexecuted instantiation: rfapi.c:peer_established Unexecuted instantiation: rfapi_ap.c:peer_established Unexecuted instantiation: rfapi_encap_tlv.c:peer_established Unexecuted instantiation: rfapi_nve_addr.c:peer_established Unexecuted instantiation: rfapi_monitor.c:peer_established Unexecuted instantiation: rfapi_rib.c:peer_established Unexecuted instantiation: rfapi_vty.c:peer_established Unexecuted instantiation: vnc_export_bgp.c:peer_established Unexecuted instantiation: vnc_export_table.c:peer_established Unexecuted instantiation: vnc_import_bgp.c:peer_established Unexecuted instantiation: vnc_zebra.c:peer_established Unexecuted instantiation: bgp_addpath.c:peer_established Unexecuted instantiation: bgp_advertise.c:peer_established Unexecuted instantiation: bgp_aspath.c:peer_established Unexecuted instantiation: bgp_bfd.c:peer_established Unexecuted instantiation: bgp_conditional_adv.c:peer_established Unexecuted instantiation: bgp_damp.c:peer_established Unexecuted instantiation: bgp_encap_tlv.c:peer_established Unexecuted instantiation: bgp_flowspec.c:peer_established Unexecuted instantiation: bgp_flowspec_util.c:peer_established Unexecuted instantiation: bgp_label.c:peer_established Unexecuted instantiation: bgp_open.c:peer_established Unexecuted instantiation: rfp_example.c:peer_established |
2544 | | |
2545 | | static inline bool peer_dynamic_neighbor(struct peer *peer) |
2546 | 0 | { |
2547 | 0 | return CHECK_FLAG(peer->flags, PEER_FLAG_DYNAMIC_NEIGHBOR); |
2548 | 0 | } Unexecuted instantiation: bgp_main.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_attr.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_attr_evpn.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_clist.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_community.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_community_alias.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_debug.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_dump.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_ecommunity.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_evpn.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_evpn_mh.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_evpn_vty.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_filter.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_flowspec_vty.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_fsm.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_io.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_keepalives.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_labelpool.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_lcommunity.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_mac.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_mpath.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_mplsvpn.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_network.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_nexthop.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_nht.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_packet.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_pbr.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_rd.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_regex.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_route.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_routemap.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_routemap_nb.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_routemap_nb_config.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_table.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_updgrp.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_updgrp_adv.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_updgrp_packet.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_vpn.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_vty.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_zebra.c:peer_dynamic_neighbor Unexecuted instantiation: bgpd.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_rfapi_cfg.c:peer_dynamic_neighbor Unexecuted instantiation: rfapi_import.c:peer_dynamic_neighbor Unexecuted instantiation: rfapi.c:peer_dynamic_neighbor Unexecuted instantiation: rfapi_ap.c:peer_dynamic_neighbor Unexecuted instantiation: rfapi_encap_tlv.c:peer_dynamic_neighbor Unexecuted instantiation: rfapi_nve_addr.c:peer_dynamic_neighbor Unexecuted instantiation: rfapi_monitor.c:peer_dynamic_neighbor Unexecuted instantiation: rfapi_rib.c:peer_dynamic_neighbor Unexecuted instantiation: rfapi_vty.c:peer_dynamic_neighbor Unexecuted instantiation: vnc_export_bgp.c:peer_dynamic_neighbor Unexecuted instantiation: vnc_export_table.c:peer_dynamic_neighbor Unexecuted instantiation: vnc_import_bgp.c:peer_dynamic_neighbor Unexecuted instantiation: vnc_zebra.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_addpath.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_advertise.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_aspath.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_bfd.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_conditional_adv.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_damp.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_encap_tlv.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_flowspec.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_flowspec_util.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_label.c:peer_dynamic_neighbor Unexecuted instantiation: bgp_open.c:peer_dynamic_neighbor Unexecuted instantiation: rfp_example.c:peer_dynamic_neighbor |
2549 | | |
2550 | | static inline bool peer_dynamic_neighbor_no_nsf(struct peer *peer) |
2551 | 0 | { |
2552 | 0 | return (peer_dynamic_neighbor(peer) && |
2553 | 0 | !CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)); |
2554 | 0 | } Unexecuted instantiation: bgp_main.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_attr.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_attr_evpn.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_clist.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_community.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_community_alias.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_debug.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_dump.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_ecommunity.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_evpn.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_evpn_mh.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_evpn_vty.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_filter.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_flowspec_vty.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_fsm.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_io.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_keepalives.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_labelpool.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_lcommunity.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_mac.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_mpath.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_mplsvpn.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_network.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_nexthop.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_nht.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_packet.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_pbr.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_rd.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_regex.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_route.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_routemap.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_routemap_nb.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_routemap_nb_config.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_table.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_updgrp.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_updgrp_adv.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_updgrp_packet.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_vpn.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_vty.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_zebra.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgpd.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_rfapi_cfg.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: rfapi_import.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: rfapi.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: rfapi_ap.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: rfapi_encap_tlv.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: rfapi_nve_addr.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: rfapi_monitor.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: rfapi_rib.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: rfapi_vty.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: vnc_export_bgp.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: vnc_export_table.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: vnc_import_bgp.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: vnc_zebra.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_addpath.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_advertise.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_aspath.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_bfd.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_conditional_adv.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_damp.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_encap_tlv.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_flowspec.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_flowspec_util.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_label.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: bgp_open.c:peer_dynamic_neighbor_no_nsf Unexecuted instantiation: rfp_example.c:peer_dynamic_neighbor_no_nsf |
2555 | | |
2556 | | static inline int peer_cap_enhe(struct peer *peer, afi_t afi, safi_t safi) |
2557 | 0 | { |
2558 | 0 | return (CHECK_FLAG(peer->af_cap[afi][safi], PEER_CAP_ENHE_AF_NEGO)); |
2559 | 0 | } Unexecuted instantiation: bgp_main.c:peer_cap_enhe Unexecuted instantiation: bgp_attr.c:peer_cap_enhe Unexecuted instantiation: bgp_attr_evpn.c:peer_cap_enhe Unexecuted instantiation: bgp_clist.c:peer_cap_enhe Unexecuted instantiation: bgp_community.c:peer_cap_enhe Unexecuted instantiation: bgp_community_alias.c:peer_cap_enhe Unexecuted instantiation: bgp_debug.c:peer_cap_enhe Unexecuted instantiation: bgp_dump.c:peer_cap_enhe Unexecuted instantiation: bgp_ecommunity.c:peer_cap_enhe Unexecuted instantiation: bgp_evpn.c:peer_cap_enhe Unexecuted instantiation: bgp_evpn_mh.c:peer_cap_enhe Unexecuted instantiation: bgp_evpn_vty.c:peer_cap_enhe Unexecuted instantiation: bgp_filter.c:peer_cap_enhe Unexecuted instantiation: bgp_flowspec_vty.c:peer_cap_enhe Unexecuted instantiation: bgp_fsm.c:peer_cap_enhe Unexecuted instantiation: bgp_io.c:peer_cap_enhe Unexecuted instantiation: bgp_keepalives.c:peer_cap_enhe Unexecuted instantiation: bgp_labelpool.c:peer_cap_enhe Unexecuted instantiation: bgp_lcommunity.c:peer_cap_enhe Unexecuted instantiation: bgp_mac.c:peer_cap_enhe Unexecuted instantiation: bgp_mpath.c:peer_cap_enhe Unexecuted instantiation: bgp_mplsvpn.c:peer_cap_enhe Unexecuted instantiation: bgp_network.c:peer_cap_enhe Unexecuted instantiation: bgp_nexthop.c:peer_cap_enhe Unexecuted instantiation: bgp_nht.c:peer_cap_enhe Unexecuted instantiation: bgp_packet.c:peer_cap_enhe Unexecuted instantiation: bgp_pbr.c:peer_cap_enhe Unexecuted instantiation: bgp_rd.c:peer_cap_enhe Unexecuted instantiation: bgp_regex.c:peer_cap_enhe Unexecuted instantiation: bgp_route.c:peer_cap_enhe Unexecuted instantiation: bgp_routemap.c:peer_cap_enhe Unexecuted instantiation: bgp_routemap_nb.c:peer_cap_enhe Unexecuted instantiation: bgp_routemap_nb_config.c:peer_cap_enhe Unexecuted instantiation: bgp_table.c:peer_cap_enhe Unexecuted instantiation: bgp_updgrp.c:peer_cap_enhe Unexecuted instantiation: bgp_updgrp_adv.c:peer_cap_enhe Unexecuted instantiation: bgp_updgrp_packet.c:peer_cap_enhe Unexecuted instantiation: bgp_vpn.c:peer_cap_enhe Unexecuted instantiation: bgp_vty.c:peer_cap_enhe Unexecuted instantiation: bgp_zebra.c:peer_cap_enhe Unexecuted instantiation: bgpd.c:peer_cap_enhe Unexecuted instantiation: bgp_rfapi_cfg.c:peer_cap_enhe Unexecuted instantiation: rfapi_import.c:peer_cap_enhe Unexecuted instantiation: rfapi.c:peer_cap_enhe Unexecuted instantiation: rfapi_ap.c:peer_cap_enhe Unexecuted instantiation: rfapi_encap_tlv.c:peer_cap_enhe Unexecuted instantiation: rfapi_nve_addr.c:peer_cap_enhe Unexecuted instantiation: rfapi_monitor.c:peer_cap_enhe Unexecuted instantiation: rfapi_rib.c:peer_cap_enhe Unexecuted instantiation: rfapi_vty.c:peer_cap_enhe Unexecuted instantiation: vnc_export_bgp.c:peer_cap_enhe Unexecuted instantiation: vnc_export_table.c:peer_cap_enhe Unexecuted instantiation: vnc_import_bgp.c:peer_cap_enhe Unexecuted instantiation: vnc_zebra.c:peer_cap_enhe Unexecuted instantiation: bgp_addpath.c:peer_cap_enhe Unexecuted instantiation: bgp_advertise.c:peer_cap_enhe Unexecuted instantiation: bgp_aspath.c:peer_cap_enhe Unexecuted instantiation: bgp_bfd.c:peer_cap_enhe Unexecuted instantiation: bgp_conditional_adv.c:peer_cap_enhe Unexecuted instantiation: bgp_damp.c:peer_cap_enhe Unexecuted instantiation: bgp_encap_tlv.c:peer_cap_enhe Unexecuted instantiation: bgp_flowspec.c:peer_cap_enhe Unexecuted instantiation: bgp_flowspec_util.c:peer_cap_enhe Unexecuted instantiation: bgp_label.c:peer_cap_enhe Unexecuted instantiation: bgp_open.c:peer_cap_enhe Unexecuted instantiation: rfp_example.c:peer_cap_enhe |
2560 | | |
2561 | | /* Lookup VRF for BGP instance based on its type. */ |
2562 | | static inline struct vrf *bgp_vrf_lookup_by_instance_type(struct bgp *bgp) |
2563 | 1 | { |
2564 | 1 | struct vrf *vrf; |
2565 | | |
2566 | 1 | if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) |
2567 | 1 | vrf = vrf_lookup_by_id(VRF_DEFAULT); |
2568 | 0 | else if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) |
2569 | 0 | vrf = vrf_lookup_by_name(bgp->name); |
2570 | 0 | else |
2571 | 0 | vrf = NULL; |
2572 | | |
2573 | 1 | return vrf; |
2574 | 1 | } Unexecuted instantiation: bgp_main.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_attr.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_attr_evpn.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_clist.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_community.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_community_alias.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_debug.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_dump.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_ecommunity.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_evpn.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_evpn_mh.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_evpn_vty.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_filter.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_flowspec_vty.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_fsm.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_io.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_keepalives.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_labelpool.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_lcommunity.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_mac.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_mpath.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_mplsvpn.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_network.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_nexthop.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_nht.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_packet.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_pbr.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_rd.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_regex.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_route.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_routemap.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_routemap_nb.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_routemap_nb_config.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_table.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_updgrp.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_updgrp_adv.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_updgrp_packet.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_vpn.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_vty.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_zebra.c:bgp_vrf_lookup_by_instance_type bgpd.c:bgp_vrf_lookup_by_instance_type Line | Count | Source | 2563 | 1 | { | 2564 | 1 | struct vrf *vrf; | 2565 | | | 2566 | 1 | if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | 2567 | 1 | vrf = vrf_lookup_by_id(VRF_DEFAULT); | 2568 | 0 | else if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) | 2569 | 0 | vrf = vrf_lookup_by_name(bgp->name); | 2570 | 0 | else | 2571 | 0 | vrf = NULL; | 2572 | | | 2573 | 1 | return vrf; | 2574 | 1 | } |
Unexecuted instantiation: bgp_rfapi_cfg.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: rfapi_import.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: rfapi.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: rfapi_ap.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: rfapi_encap_tlv.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: rfapi_nve_addr.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: rfapi_monitor.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: rfapi_rib.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: rfapi_vty.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: vnc_export_bgp.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: vnc_export_table.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: vnc_import_bgp.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: vnc_zebra.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_addpath.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_advertise.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_aspath.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_bfd.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_conditional_adv.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_damp.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_encap_tlv.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_flowspec.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_flowspec_util.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_label.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: bgp_open.c:bgp_vrf_lookup_by_instance_type Unexecuted instantiation: rfp_example.c:bgp_vrf_lookup_by_instance_type |
2575 | | |
2576 | | static inline uint32_t bgp_vrf_interfaces(struct bgp *bgp, bool active) |
2577 | 0 | { |
2578 | 0 | struct vrf *vrf; |
2579 | 0 | struct interface *ifp; |
2580 | 0 | uint32_t count = 0; |
2581 | 0 |
|
2582 | 0 | /* if there is one interface in the vrf which is up then it is deemed |
2583 | 0 | * active |
2584 | 0 | */ |
2585 | 0 | vrf = bgp_vrf_lookup_by_instance_type(bgp); |
2586 | 0 | if (vrf == NULL) |
2587 | 0 | return 0; |
2588 | 0 | RB_FOREACH (ifp, if_name_head, &vrf->ifaces_by_name) { |
2589 | 0 | if (strcmp(ifp->name, bgp->name) == 0) |
2590 | 0 | continue; |
2591 | 0 | if (!active || if_is_up(ifp)) |
2592 | 0 | count++; |
2593 | 0 | } |
2594 | 0 | return count; |
2595 | 0 | } Unexecuted instantiation: bgp_main.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_attr.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_attr_evpn.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_clist.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_community.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_community_alias.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_debug.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_dump.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_ecommunity.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_evpn.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_evpn_mh.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_evpn_vty.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_filter.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_flowspec_vty.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_fsm.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_io.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_keepalives.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_labelpool.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_lcommunity.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_mac.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_mpath.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_mplsvpn.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_network.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_nexthop.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_nht.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_packet.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_pbr.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_rd.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_regex.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_route.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_routemap.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_routemap_nb.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_routemap_nb_config.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_table.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_updgrp.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_updgrp_adv.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_updgrp_packet.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_vpn.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_vty.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_zebra.c:bgp_vrf_interfaces Unexecuted instantiation: bgpd.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_rfapi_cfg.c:bgp_vrf_interfaces Unexecuted instantiation: rfapi_import.c:bgp_vrf_interfaces Unexecuted instantiation: rfapi.c:bgp_vrf_interfaces Unexecuted instantiation: rfapi_ap.c:bgp_vrf_interfaces Unexecuted instantiation: rfapi_encap_tlv.c:bgp_vrf_interfaces Unexecuted instantiation: rfapi_nve_addr.c:bgp_vrf_interfaces Unexecuted instantiation: rfapi_monitor.c:bgp_vrf_interfaces Unexecuted instantiation: rfapi_rib.c:bgp_vrf_interfaces Unexecuted instantiation: rfapi_vty.c:bgp_vrf_interfaces Unexecuted instantiation: vnc_export_bgp.c:bgp_vrf_interfaces Unexecuted instantiation: vnc_export_table.c:bgp_vrf_interfaces Unexecuted instantiation: vnc_import_bgp.c:bgp_vrf_interfaces Unexecuted instantiation: vnc_zebra.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_addpath.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_advertise.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_aspath.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_bfd.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_conditional_adv.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_damp.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_encap_tlv.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_flowspec.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_flowspec_util.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_label.c:bgp_vrf_interfaces Unexecuted instantiation: bgp_open.c:bgp_vrf_interfaces Unexecuted instantiation: rfp_example.c:bgp_vrf_interfaces |
2596 | | |
2597 | | /* Link BGP instance to VRF. */ |
2598 | | static inline void bgp_vrf_link(struct bgp *bgp, struct vrf *vrf) |
2599 | 0 | { |
2600 | 0 | bgp->vrf_id = vrf->vrf_id; |
2601 | 0 | if (vrf->info != (void *)bgp) |
2602 | 0 | vrf->info = (void *)bgp_lock(bgp); |
2603 | 0 | } Unexecuted instantiation: bgp_main.c:bgp_vrf_link Unexecuted instantiation: bgp_attr.c:bgp_vrf_link Unexecuted instantiation: bgp_attr_evpn.c:bgp_vrf_link Unexecuted instantiation: bgp_clist.c:bgp_vrf_link Unexecuted instantiation: bgp_community.c:bgp_vrf_link Unexecuted instantiation: bgp_community_alias.c:bgp_vrf_link Unexecuted instantiation: bgp_debug.c:bgp_vrf_link Unexecuted instantiation: bgp_dump.c:bgp_vrf_link Unexecuted instantiation: bgp_ecommunity.c:bgp_vrf_link Unexecuted instantiation: bgp_evpn.c:bgp_vrf_link Unexecuted instantiation: bgp_evpn_mh.c:bgp_vrf_link Unexecuted instantiation: bgp_evpn_vty.c:bgp_vrf_link Unexecuted instantiation: bgp_filter.c:bgp_vrf_link Unexecuted instantiation: bgp_flowspec_vty.c:bgp_vrf_link Unexecuted instantiation: bgp_fsm.c:bgp_vrf_link Unexecuted instantiation: bgp_io.c:bgp_vrf_link Unexecuted instantiation: bgp_keepalives.c:bgp_vrf_link Unexecuted instantiation: bgp_labelpool.c:bgp_vrf_link Unexecuted instantiation: bgp_lcommunity.c:bgp_vrf_link Unexecuted instantiation: bgp_mac.c:bgp_vrf_link Unexecuted instantiation: bgp_mpath.c:bgp_vrf_link Unexecuted instantiation: bgp_mplsvpn.c:bgp_vrf_link Unexecuted instantiation: bgp_network.c:bgp_vrf_link Unexecuted instantiation: bgp_nexthop.c:bgp_vrf_link Unexecuted instantiation: bgp_nht.c:bgp_vrf_link Unexecuted instantiation: bgp_packet.c:bgp_vrf_link Unexecuted instantiation: bgp_pbr.c:bgp_vrf_link Unexecuted instantiation: bgp_rd.c:bgp_vrf_link Unexecuted instantiation: bgp_regex.c:bgp_vrf_link Unexecuted instantiation: bgp_route.c:bgp_vrf_link Unexecuted instantiation: bgp_routemap.c:bgp_vrf_link Unexecuted instantiation: bgp_routemap_nb.c:bgp_vrf_link Unexecuted instantiation: bgp_routemap_nb_config.c:bgp_vrf_link Unexecuted instantiation: bgp_table.c:bgp_vrf_link Unexecuted instantiation: bgp_updgrp.c:bgp_vrf_link Unexecuted instantiation: bgp_updgrp_adv.c:bgp_vrf_link Unexecuted instantiation: bgp_updgrp_packet.c:bgp_vrf_link Unexecuted instantiation: bgp_vpn.c:bgp_vrf_link Unexecuted instantiation: bgp_vty.c:bgp_vrf_link Unexecuted instantiation: bgp_zebra.c:bgp_vrf_link Unexecuted instantiation: bgpd.c:bgp_vrf_link Unexecuted instantiation: bgp_rfapi_cfg.c:bgp_vrf_link Unexecuted instantiation: rfapi_import.c:bgp_vrf_link Unexecuted instantiation: rfapi.c:bgp_vrf_link Unexecuted instantiation: rfapi_ap.c:bgp_vrf_link Unexecuted instantiation: rfapi_encap_tlv.c:bgp_vrf_link Unexecuted instantiation: rfapi_nve_addr.c:bgp_vrf_link Unexecuted instantiation: rfapi_monitor.c:bgp_vrf_link Unexecuted instantiation: rfapi_rib.c:bgp_vrf_link Unexecuted instantiation: rfapi_vty.c:bgp_vrf_link Unexecuted instantiation: vnc_export_bgp.c:bgp_vrf_link Unexecuted instantiation: vnc_export_table.c:bgp_vrf_link Unexecuted instantiation: vnc_import_bgp.c:bgp_vrf_link Unexecuted instantiation: vnc_zebra.c:bgp_vrf_link Unexecuted instantiation: bgp_addpath.c:bgp_vrf_link Unexecuted instantiation: bgp_advertise.c:bgp_vrf_link Unexecuted instantiation: bgp_aspath.c:bgp_vrf_link Unexecuted instantiation: bgp_bfd.c:bgp_vrf_link Unexecuted instantiation: bgp_conditional_adv.c:bgp_vrf_link Unexecuted instantiation: bgp_damp.c:bgp_vrf_link Unexecuted instantiation: bgp_encap_tlv.c:bgp_vrf_link Unexecuted instantiation: bgp_flowspec.c:bgp_vrf_link Unexecuted instantiation: bgp_flowspec_util.c:bgp_vrf_link Unexecuted instantiation: bgp_label.c:bgp_vrf_link Unexecuted instantiation: bgp_open.c:bgp_vrf_link Unexecuted instantiation: rfp_example.c:bgp_vrf_link |
2604 | | |
2605 | | /* Unlink BGP instance from VRF. */ |
2606 | | static inline void bgp_vrf_unlink(struct bgp *bgp, struct vrf *vrf) |
2607 | 0 | { |
2608 | 0 | if (vrf->info == (void *)bgp) { |
2609 | 0 | vrf->info = NULL; |
2610 | 0 | bgp_unlock(bgp); |
2611 | 0 | } |
2612 | 0 | bgp->vrf_id = VRF_UNKNOWN; |
2613 | 0 | } Unexecuted instantiation: bgp_main.c:bgp_vrf_unlink Unexecuted instantiation: bgp_attr.c:bgp_vrf_unlink Unexecuted instantiation: bgp_attr_evpn.c:bgp_vrf_unlink Unexecuted instantiation: bgp_clist.c:bgp_vrf_unlink Unexecuted instantiation: bgp_community.c:bgp_vrf_unlink Unexecuted instantiation: bgp_community_alias.c:bgp_vrf_unlink Unexecuted instantiation: bgp_debug.c:bgp_vrf_unlink Unexecuted instantiation: bgp_dump.c:bgp_vrf_unlink Unexecuted instantiation: bgp_ecommunity.c:bgp_vrf_unlink Unexecuted instantiation: bgp_evpn.c:bgp_vrf_unlink Unexecuted instantiation: bgp_evpn_mh.c:bgp_vrf_unlink Unexecuted instantiation: bgp_evpn_vty.c:bgp_vrf_unlink Unexecuted instantiation: bgp_filter.c:bgp_vrf_unlink Unexecuted instantiation: bgp_flowspec_vty.c:bgp_vrf_unlink Unexecuted instantiation: bgp_fsm.c:bgp_vrf_unlink Unexecuted instantiation: bgp_io.c:bgp_vrf_unlink Unexecuted instantiation: bgp_keepalives.c:bgp_vrf_unlink Unexecuted instantiation: bgp_labelpool.c:bgp_vrf_unlink Unexecuted instantiation: bgp_lcommunity.c:bgp_vrf_unlink Unexecuted instantiation: bgp_mac.c:bgp_vrf_unlink Unexecuted instantiation: bgp_mpath.c:bgp_vrf_unlink Unexecuted instantiation: bgp_mplsvpn.c:bgp_vrf_unlink Unexecuted instantiation: bgp_network.c:bgp_vrf_unlink Unexecuted instantiation: bgp_nexthop.c:bgp_vrf_unlink Unexecuted instantiation: bgp_nht.c:bgp_vrf_unlink Unexecuted instantiation: bgp_packet.c:bgp_vrf_unlink Unexecuted instantiation: bgp_pbr.c:bgp_vrf_unlink Unexecuted instantiation: bgp_rd.c:bgp_vrf_unlink Unexecuted instantiation: bgp_regex.c:bgp_vrf_unlink Unexecuted instantiation: bgp_route.c:bgp_vrf_unlink Unexecuted instantiation: bgp_routemap.c:bgp_vrf_unlink Unexecuted instantiation: bgp_routemap_nb.c:bgp_vrf_unlink Unexecuted instantiation: bgp_routemap_nb_config.c:bgp_vrf_unlink Unexecuted instantiation: bgp_table.c:bgp_vrf_unlink Unexecuted instantiation: bgp_updgrp.c:bgp_vrf_unlink Unexecuted instantiation: bgp_updgrp_adv.c:bgp_vrf_unlink Unexecuted instantiation: bgp_updgrp_packet.c:bgp_vrf_unlink Unexecuted instantiation: bgp_vpn.c:bgp_vrf_unlink Unexecuted instantiation: bgp_vty.c:bgp_vrf_unlink Unexecuted instantiation: bgp_zebra.c:bgp_vrf_unlink Unexecuted instantiation: bgpd.c:bgp_vrf_unlink Unexecuted instantiation: bgp_rfapi_cfg.c:bgp_vrf_unlink Unexecuted instantiation: rfapi_import.c:bgp_vrf_unlink Unexecuted instantiation: rfapi.c:bgp_vrf_unlink Unexecuted instantiation: rfapi_ap.c:bgp_vrf_unlink Unexecuted instantiation: rfapi_encap_tlv.c:bgp_vrf_unlink Unexecuted instantiation: rfapi_nve_addr.c:bgp_vrf_unlink Unexecuted instantiation: rfapi_monitor.c:bgp_vrf_unlink Unexecuted instantiation: rfapi_rib.c:bgp_vrf_unlink Unexecuted instantiation: rfapi_vty.c:bgp_vrf_unlink Unexecuted instantiation: vnc_export_bgp.c:bgp_vrf_unlink Unexecuted instantiation: vnc_export_table.c:bgp_vrf_unlink Unexecuted instantiation: vnc_import_bgp.c:bgp_vrf_unlink Unexecuted instantiation: vnc_zebra.c:bgp_vrf_unlink Unexecuted instantiation: bgp_addpath.c:bgp_vrf_unlink Unexecuted instantiation: bgp_advertise.c:bgp_vrf_unlink Unexecuted instantiation: bgp_aspath.c:bgp_vrf_unlink Unexecuted instantiation: bgp_bfd.c:bgp_vrf_unlink Unexecuted instantiation: bgp_conditional_adv.c:bgp_vrf_unlink Unexecuted instantiation: bgp_damp.c:bgp_vrf_unlink Unexecuted instantiation: bgp_encap_tlv.c:bgp_vrf_unlink Unexecuted instantiation: bgp_flowspec.c:bgp_vrf_unlink Unexecuted instantiation: bgp_flowspec_util.c:bgp_vrf_unlink Unexecuted instantiation: bgp_label.c:bgp_vrf_unlink Unexecuted instantiation: bgp_open.c:bgp_vrf_unlink Unexecuted instantiation: rfp_example.c:bgp_vrf_unlink |
2614 | | |
2615 | | static inline bool bgp_in_graceful_shutdown(struct bgp *bgp) |
2616 | 2.18k | { |
2617 | | /* True if either set for this instance or globally */ |
2618 | 2.18k | return (!!CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN) || |
2619 | 2.18k | !!CHECK_FLAG(bm->flags, BM_FLAG_GRACEFUL_SHUTDOWN)); |
2620 | 2.18k | } Unexecuted instantiation: bgp_main.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_attr.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_attr_evpn.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_clist.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_community.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_community_alias.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_debug.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_dump.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_ecommunity.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_evpn.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_evpn_mh.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_evpn_vty.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_filter.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_flowspec_vty.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_fsm.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_io.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_keepalives.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_labelpool.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_lcommunity.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_mac.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_mpath.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_mplsvpn.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_network.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_nexthop.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_nht.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_packet.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_pbr.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_rd.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_regex.c:bgp_in_graceful_shutdown bgp_route.c:bgp_in_graceful_shutdown Line | Count | Source | 2616 | 2.18k | { | 2617 | | /* True if either set for this instance or globally */ | 2618 | 2.18k | return (!!CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN) || | 2619 | 2.18k | !!CHECK_FLAG(bm->flags, BM_FLAG_GRACEFUL_SHUTDOWN)); | 2620 | 2.18k | } |
Unexecuted instantiation: bgp_routemap.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_routemap_nb.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_routemap_nb_config.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_table.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_updgrp.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_updgrp_adv.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_updgrp_packet.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_vpn.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_vty.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_zebra.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgpd.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_rfapi_cfg.c:bgp_in_graceful_shutdown Unexecuted instantiation: rfapi_import.c:bgp_in_graceful_shutdown Unexecuted instantiation: rfapi.c:bgp_in_graceful_shutdown Unexecuted instantiation: rfapi_ap.c:bgp_in_graceful_shutdown Unexecuted instantiation: rfapi_encap_tlv.c:bgp_in_graceful_shutdown Unexecuted instantiation: rfapi_nve_addr.c:bgp_in_graceful_shutdown Unexecuted instantiation: rfapi_monitor.c:bgp_in_graceful_shutdown Unexecuted instantiation: rfapi_rib.c:bgp_in_graceful_shutdown Unexecuted instantiation: rfapi_vty.c:bgp_in_graceful_shutdown Unexecuted instantiation: vnc_export_bgp.c:bgp_in_graceful_shutdown Unexecuted instantiation: vnc_export_table.c:bgp_in_graceful_shutdown Unexecuted instantiation: vnc_import_bgp.c:bgp_in_graceful_shutdown Unexecuted instantiation: vnc_zebra.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_addpath.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_advertise.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_aspath.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_bfd.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_conditional_adv.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_damp.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_encap_tlv.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_flowspec.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_flowspec_util.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_label.c:bgp_in_graceful_shutdown Unexecuted instantiation: bgp_open.c:bgp_in_graceful_shutdown Unexecuted instantiation: rfp_example.c:bgp_in_graceful_shutdown |
2621 | | |
2622 | | /* For benefit of rfapi */ |
2623 | | extern struct peer *peer_new(struct bgp *bgp); |
2624 | | |
2625 | | extern struct peer *peer_lookup_in_view(struct vty *vty, struct bgp *bgp, |
2626 | | const char *ip_str, bool use_json); |
2627 | | extern int bgp_lookup_by_as_name_type(struct bgp **bgp_val, as_t *as, |
2628 | | const char *name, |
2629 | | enum bgp_instance_type inst_type); |
2630 | | |
2631 | | /* Hooks */ |
2632 | | DECLARE_HOOK(bgp_vrf_status_changed, (struct bgp *bgp, struct interface *ifp), |
2633 | | (bgp, ifp)); |
2634 | | DECLARE_HOOK(peer_status_changed, (struct peer *peer), (peer)); |
2635 | | DECLARE_HOOK(bgp_snmp_init_stats, (struct bgp *bgp), (bgp)); |
2636 | | DECLARE_HOOK(bgp_snmp_update_last_changed, (struct bgp *bgp), (bgp)); |
2637 | | DECLARE_HOOK(bgp_snmp_update_stats, |
2638 | | (struct bgp_node *rn, struct bgp_path_info *pi, bool added), |
2639 | | (rn, pi, added)); |
2640 | | DECLARE_HOOK(bgp_rpki_prefix_status, |
2641 | | (struct peer * peer, struct attr *attr, |
2642 | | const struct prefix *prefix), |
2643 | | (peer, attr, prefix)); |
2644 | | |
2645 | | void peer_nsf_stop(struct peer *peer); |
2646 | | |
2647 | | void peer_tcp_mss_set(struct peer *peer, uint32_t tcp_mss); |
2648 | | void peer_tcp_mss_unset(struct peer *peer); |
2649 | | |
2650 | | extern void bgp_recalculate_afi_safi_bestpaths(struct bgp *bgp, afi_t afi, |
2651 | | safi_t safi); |
2652 | | extern void peer_on_policy_change(struct peer *peer, afi_t afi, safi_t safi, |
2653 | | int outbound); |
2654 | | extern bool bgp_path_attribute_discard(struct peer *peer, char *buf, |
2655 | | size_t size); |
2656 | | extern bool bgp_path_attribute_treat_as_withdraw(struct peer *peer, char *buf, |
2657 | | size_t size); |
2658 | | #ifdef _FRR_ATTRIBUTE_PRINTFRR |
2659 | | /* clang-format off */ |
2660 | | #pragma FRR printfrr_ext "%pBP" (struct peer *) |
2661 | | /* clang-format on */ |
2662 | | #endif |
2663 | | |
2664 | | #endif /* _QUAGGA_BGPD_H */ |