1 /* BGP-4, BGP-4+ packet debug routine
2 * Copyright (C) 1996, 97, 99 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <lib/version.h>
25 #include "lib/printfrr.h"
31 #include "sockunion.h"
36 #include "bgpd/bgpd.h"
37 #include "bgpd/bgp_aspath.h"
38 #include "bgpd/bgp_route.h"
39 #include "bgpd/bgp_attr.h"
40 #include "bgpd/bgp_debug.h"
41 #include "bgpd/bgp_community.h"
42 #include "bgpd/bgp_lcommunity.h"
43 #include "bgpd/bgp_updgrp.h"
44 #include "bgpd/bgp_mplsvpn.h"
45 #include "bgpd/bgp_ecommunity.h"
46 #include "bgpd/bgp_label.h"
47 #include "bgpd/bgp_evpn.h"
48 #include "bgpd/bgp_evpn_private.h"
49 #include "bgpd/bgp_evpn_vty.h"
50 #include "bgpd/bgp_vty.h"
51 #include "bgpd/bgp_flowspec.h"
53 unsigned long conf_bgp_debug_as4
;
54 unsigned long conf_bgp_debug_neighbor_events
;
55 unsigned long conf_bgp_debug_events
;
56 unsigned long conf_bgp_debug_packet
;
57 unsigned long conf_bgp_debug_filter
;
58 unsigned long conf_bgp_debug_keepalive
;
59 unsigned long conf_bgp_debug_update
;
60 unsigned long conf_bgp_debug_bestpath
;
61 unsigned long conf_bgp_debug_zebra
;
62 unsigned long conf_bgp_debug_allow_martians
;
63 unsigned long conf_bgp_debug_nht
;
64 unsigned long conf_bgp_debug_update_groups
;
65 unsigned long conf_bgp_debug_vpn
;
66 unsigned long conf_bgp_debug_flowspec
;
67 unsigned long conf_bgp_debug_labelpool
;
68 unsigned long conf_bgp_debug_pbr
;
69 unsigned long conf_bgp_debug_graceful_restart
;
70 unsigned long conf_bgp_debug_evpn_mh
;
71 unsigned long conf_bgp_debug_bfd
;
73 unsigned long term_bgp_debug_as4
;
74 unsigned long term_bgp_debug_neighbor_events
;
75 unsigned long term_bgp_debug_events
;
76 unsigned long term_bgp_debug_packet
;
77 unsigned long term_bgp_debug_filter
;
78 unsigned long term_bgp_debug_keepalive
;
79 unsigned long term_bgp_debug_update
;
80 unsigned long term_bgp_debug_bestpath
;
81 unsigned long term_bgp_debug_zebra
;
82 unsigned long term_bgp_debug_allow_martians
;
83 unsigned long term_bgp_debug_nht
;
84 unsigned long term_bgp_debug_update_groups
;
85 unsigned long term_bgp_debug_vpn
;
86 unsigned long term_bgp_debug_flowspec
;
87 unsigned long term_bgp_debug_labelpool
;
88 unsigned long term_bgp_debug_pbr
;
89 unsigned long term_bgp_debug_graceful_restart
;
90 unsigned long term_bgp_debug_evpn_mh
;
91 unsigned long term_bgp_debug_bfd
;
93 struct list
*bgp_debug_neighbor_events_peers
= NULL
;
94 struct list
*bgp_debug_keepalive_peers
= NULL
;
95 struct list
*bgp_debug_update_out_peers
= NULL
;
96 struct list
*bgp_debug_update_in_peers
= NULL
;
97 struct list
*bgp_debug_update_prefixes
= NULL
;
98 struct list
*bgp_debug_bestpath_prefixes
= NULL
;
99 struct list
*bgp_debug_zebra_prefixes
= NULL
;
101 /* messages for BGP-4 status */
102 const struct message bgp_status_msg
[] = {{Idle
, "Idle"},
103 {Connect
, "Connect"},
105 {OpenSent
, "OpenSent"},
106 {OpenConfirm
, "OpenConfirm"},
107 {Established
, "Established"},
108 {Clearing
, "Clearing"},
109 {Deleted
, "Deleted"},
112 /* BGP message type string. */
113 const char *const bgp_type_str
[] = {NULL
, "OPEN", "UPDATE",
114 "NOTIFICATION", "KEEPALIVE", "ROUTE-REFRESH",
117 /* message for BGP-4 Notify */
118 static const struct message bgp_notify_msg
[] = {
119 {BGP_NOTIFY_HEADER_ERR
, "Message Header Error"},
120 {BGP_NOTIFY_OPEN_ERR
, "OPEN Message Error"},
121 {BGP_NOTIFY_UPDATE_ERR
, "UPDATE Message Error"},
122 {BGP_NOTIFY_HOLD_ERR
, "Hold Timer Expired"},
123 {BGP_NOTIFY_FSM_ERR
, "Neighbor Events Error"},
124 {BGP_NOTIFY_CEASE
, "Cease"},
125 {BGP_NOTIFY_ROUTE_REFRESH_ERR
, "ROUTE-REFRESH Message Error"},
128 static const struct message bgp_notify_head_msg
[] = {
129 {BGP_NOTIFY_HEADER_NOT_SYNC
, "/Connection Not Synchronized"},
130 {BGP_NOTIFY_HEADER_BAD_MESLEN
, "/Bad Message Length"},
131 {BGP_NOTIFY_HEADER_BAD_MESTYPE
, "/Bad Message Type"},
134 static const struct message bgp_notify_open_msg
[] = {
135 {BGP_NOTIFY_SUBCODE_UNSPECIFIC
, "/Unspecific"},
136 {BGP_NOTIFY_OPEN_UNSUP_VERSION
, "/Unsupported Version Number"},
137 {BGP_NOTIFY_OPEN_BAD_PEER_AS
, "/Bad Peer AS"},
138 {BGP_NOTIFY_OPEN_BAD_BGP_IDENT
, "/Bad BGP Identifier"},
139 {BGP_NOTIFY_OPEN_UNSUP_PARAM
, "/Unsupported Optional Parameter"},
140 {BGP_NOTIFY_OPEN_AUTH_FAILURE
, "/Authentication Failure"},
141 {BGP_NOTIFY_OPEN_UNACEP_HOLDTIME
, "/Unacceptable Hold Time"},
142 {BGP_NOTIFY_OPEN_UNSUP_CAPBL
, "/Unsupported Capability"},
145 static const struct message bgp_notify_update_msg
[] = {
146 {BGP_NOTIFY_SUBCODE_UNSPECIFIC
, "/Unspecific"},
147 {BGP_NOTIFY_UPDATE_MAL_ATTR
, "/Malformed Attribute List"},
148 {BGP_NOTIFY_UPDATE_UNREC_ATTR
, "/Unrecognized Well-known Attribute"},
149 {BGP_NOTIFY_UPDATE_MISS_ATTR
, "/Missing Well-known Attribute"},
150 {BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR
, "/Attribute Flags Error"},
151 {BGP_NOTIFY_UPDATE_ATTR_LENG_ERR
, "/Attribute Length Error"},
152 {BGP_NOTIFY_UPDATE_INVAL_ORIGIN
, "/Invalid ORIGIN Attribute"},
153 {BGP_NOTIFY_UPDATE_AS_ROUTE_LOOP
, "/AS Routing Loop"},
154 {BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP
, "/Invalid NEXT_HOP Attribute"},
155 {BGP_NOTIFY_UPDATE_OPT_ATTR_ERR
, "/Optional Attribute Error"},
156 {BGP_NOTIFY_UPDATE_INVAL_NETWORK
, "/Invalid Network Field"},
157 {BGP_NOTIFY_UPDATE_MAL_AS_PATH
, "/Malformed AS_PATH"},
160 static const struct message bgp_notify_cease_msg
[] = {
161 {BGP_NOTIFY_SUBCODE_UNSPECIFIC
, "/Unspecific"},
162 {BGP_NOTIFY_CEASE_MAX_PREFIX
, "/Maximum Number of Prefixes Reached"},
163 {BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
, "/Administrative Shutdown"},
164 {BGP_NOTIFY_CEASE_PEER_UNCONFIG
, "/Peer De-configured"},
165 {BGP_NOTIFY_CEASE_ADMIN_RESET
, "/Administrative Reset"},
166 {BGP_NOTIFY_CEASE_CONNECT_REJECT
, "/Connection Rejected"},
167 {BGP_NOTIFY_CEASE_CONFIG_CHANGE
, "/Other Configuration Change"},
168 {BGP_NOTIFY_CEASE_COLLISION_RESOLUTION
,
169 "/Connection Collision Resolution"},
170 {BGP_NOTIFY_CEASE_OUT_OF_RESOURCE
, "/Out of Resources"},
173 static const struct message bgp_notify_route_refresh_msg
[] = {
174 {BGP_NOTIFY_SUBCODE_UNSPECIFIC
, "/Unspecific"},
175 {BGP_NOTIFY_ROUTE_REFRESH_INVALID_MSG_LEN
, "/Invalid Message Length"},
178 static const struct message bgp_notify_fsm_msg
[] = {
179 {BGP_NOTIFY_FSM_ERR_SUBCODE_UNSPECIFIC
, "/Unspecific"},
180 {BGP_NOTIFY_FSM_ERR_SUBCODE_OPENSENT
,
181 "/Receive Unexpected Message in OpenSent State"},
182 {BGP_NOTIFY_FSM_ERR_SUBCODE_OPENCONFIRM
,
183 "/Receive Unexpected Message in OpenConfirm State"},
184 {BGP_NOTIFY_FSM_ERR_SUBCODE_ESTABLISHED
,
185 "/Receive Unexpected Message in Established State"},
188 /* Origin strings. */
189 const char *const bgp_origin_str
[] = {"i", "e", "?"};
190 const char *const bgp_origin_long_str
[] = {"IGP", "EGP", "incomplete"};
192 static void bgp_debug_print_evpn_prefix(struct vty
*vty
, const char *desc
,
194 /* Given a string return a pointer the corresponding peer structure */
195 static struct peer
*bgp_find_peer(struct vty
*vty
, const char *peer_str
)
197 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
205 ret
= str2sockunion(peer_str
, &su
);
209 peer
= peer_lookup_by_conf_if(bgp
, peer_str
);
212 peer
= peer_lookup_by_hostname(bgp
, peer_str
);
216 return peer_lookup(bgp
, &su
);
219 static void bgp_debug_list_free(struct list
*list
)
221 struct bgp_debug_filter
*filter
;
222 struct listnode
*node
, *nnode
;
225 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
226 listnode_delete(list
, filter
);
227 prefix_free(&filter
->p
);
228 XFREE(MTYPE_BGP_DEBUG_STR
, filter
->host
);
229 XFREE(MTYPE_BGP_DEBUG_FILTER
, filter
);
234 * Print the desc along with a list of peers/prefixes this debug is
237 static void bgp_debug_list_print(struct vty
*vty
, const char *desc
,
240 struct bgp_debug_filter
*filter
;
241 struct listnode
*node
, *nnode
;
243 vty_out(vty
, "%s", desc
);
245 if (list
&& !list_isempty(list
)) {
246 vty_out(vty
, " for");
247 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
249 vty_out(vty
, " %s", filter
->host
);
251 if (filter
->p
&& filter
->p
->family
== AF_EVPN
)
252 bgp_debug_print_evpn_prefix(vty
, "", filter
->p
);
254 vty_out(vty
, " %pFX", filter
->p
);
262 * Print the command to enable the debug for each peer/prefix this debug is
265 static int bgp_debug_list_conf_print(struct vty
*vty
, const char *desc
,
268 struct bgp_debug_filter
*filter
;
269 struct listnode
*node
, *nnode
;
272 if (list
&& !list_isempty(list
)) {
273 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
275 vty_out(vty
, "%s %s\n", desc
, filter
->host
);
279 if (filter
->p
&& filter
->p
->family
== AF_EVPN
) {
280 bgp_debug_print_evpn_prefix(vty
, desc
,
283 } else if (filter
->p
) {
284 vty_out(vty
, "%s %pFX\n", desc
, filter
->p
);
291 vty_out(vty
, "%s\n", desc
);
298 static void bgp_debug_list_add_entry(struct list
*list
, const char *host
,
299 const struct prefix
*p
)
301 struct bgp_debug_filter
*filter
;
303 filter
= XCALLOC(MTYPE_BGP_DEBUG_FILTER
,
304 sizeof(struct bgp_debug_filter
));
307 filter
->host
= XSTRDUP(MTYPE_BGP_DEBUG_STR
, host
);
311 filter
->p
= prefix_new();
312 prefix_copy(filter
->p
, p
);
315 listnode_add(list
, filter
);
318 static bool bgp_debug_list_remove_entry(struct list
*list
, const char *host
,
321 struct bgp_debug_filter
*filter
;
322 struct listnode
*node
, *nnode
;
324 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
325 if (host
&& strcmp(filter
->host
, host
) == 0) {
326 listnode_delete(list
, filter
);
327 XFREE(MTYPE_BGP_DEBUG_STR
, filter
->host
);
328 XFREE(MTYPE_BGP_DEBUG_FILTER
, filter
);
330 } else if (p
&& filter
->p
->prefixlen
== p
->prefixlen
331 && prefix_match(filter
->p
, p
)) {
332 listnode_delete(list
, filter
);
333 prefix_free(&filter
->p
);
334 XFREE(MTYPE_BGP_DEBUG_FILTER
, filter
);
342 static bool bgp_debug_list_has_entry(struct list
*list
, const char *host
,
343 const struct prefix
*p
)
345 struct bgp_debug_filter
*filter
;
346 struct listnode
*node
, *nnode
;
348 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
350 if (strcmp(filter
->host
, host
) == 0) {
354 if (filter
->p
->prefixlen
== p
->prefixlen
355 && prefix_match(filter
->p
, p
)) {
364 bool bgp_debug_peer_updout_enabled(char *host
)
366 return (bgp_debug_list_has_entry(bgp_debug_update_out_peers
, host
,
370 /* Dump attribute. */
371 bool bgp_dump_attr(struct attr
*attr
, char *buf
, size_t size
)
373 char addrbuf
[BUFSIZ
];
380 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP
)))
381 snprintfrr(buf
, size
, "nexthop %pI4", &attr
->nexthop
);
383 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_ORIGIN
)))
384 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), ", origin %s",
385 bgp_origin_str
[attr
->origin
]);
388 if (attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL
389 || attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL
)
390 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
392 inet_ntop(AF_INET6
, &attr
->mp_nexthop_global
, addrbuf
,
395 if (attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL
)
396 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), "(%s)",
397 inet_ntop(AF_INET6
, &attr
->mp_nexthop_local
, addrbuf
,
400 if (attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV4
)
401 snprintfrr(buf
, size
, "nexthop %pI4", &attr
->nexthop
);
403 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
)))
404 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
405 ", localpref %u", attr
->local_pref
);
407 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
)))
408 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), ", metric %u",
411 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES
)))
412 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
414 community_str(attr
->community
, false));
416 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES
)))
417 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
418 ", large-community %s",
419 lcommunity_str(attr
->lcommunity
, false));
421 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
)))
422 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
424 ecommunity_str(bgp_attr_get_ecommunity(attr
)));
426 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
)))
427 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
428 ", atomic-aggregate");
430 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR
)))
431 snprintfrr(buf
+ strlen(buf
), size
- strlen(buf
),
432 ", aggregated by %u %pI4", attr
->aggregator_as
,
433 &attr
->aggregator_addr
);
435 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)))
436 snprintfrr(buf
+ strlen(buf
), size
- strlen(buf
),
437 ", originator %pI4", &attr
->originator_id
);
439 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))) {
440 struct cluster_list
*cluster
;
443 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
446 cluster
= bgp_attr_get_cluster(attr
);
447 for (i
= 0; i
< cluster
->length
/ 4; i
++)
448 snprintfrr(buf
+ strlen(buf
), size
- strlen(buf
),
449 " %pI4", &cluster
->list
[i
]);
452 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL
)))
453 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
454 ", pmsi tnltype %u", bgp_attr_get_pmsi_tnl_type(attr
));
456 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_AS_PATH
)))
457 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), ", path %s",
458 aspath_print(attr
->aspath
));
460 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID
))) {
461 if (attr
->label_index
!= BGP_INVALID_LABEL_INDEX
)
462 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
463 ", label-index %u", attr
->label_index
);
472 const char *bgp_notify_code_str(char code
)
474 return lookup_msg(bgp_notify_msg
, code
, "Unrecognized Error Code");
477 const char *bgp_notify_subcode_str(char code
, char subcode
)
481 case BGP_NOTIFY_HEADER_ERR
:
482 return lookup_msg(bgp_notify_head_msg
, subcode
,
483 "Unrecognized Error Subcode");
484 case BGP_NOTIFY_OPEN_ERR
:
485 return lookup_msg(bgp_notify_open_msg
, subcode
,
486 "Unrecognized Error Subcode");
487 case BGP_NOTIFY_UPDATE_ERR
:
488 return lookup_msg(bgp_notify_update_msg
, subcode
,
489 "Unrecognized Error Subcode");
490 case BGP_NOTIFY_HOLD_ERR
:
492 case BGP_NOTIFY_FSM_ERR
:
493 return lookup_msg(bgp_notify_fsm_msg
, subcode
,
494 "Unrecognized Error Subcode");
495 case BGP_NOTIFY_CEASE
:
496 return lookup_msg(bgp_notify_cease_msg
, subcode
,
497 "Unrecognized Error Subcode");
498 case BGP_NOTIFY_ROUTE_REFRESH_ERR
:
499 return lookup_msg(bgp_notify_route_refresh_msg
, subcode
,
500 "Unrecognized Error Subcode");
505 /* extract notify admin reason if correctly present */
506 const char *bgp_notify_admin_message(char *buf
, size_t bufsz
, uint8_t *data
,
509 if (!data
|| datalen
< 1)
512 uint8_t len
= data
[0];
513 if (!len
|| len
> datalen
- 1)
516 return zlog_sanitize(buf
, bufsz
, data
+ 1, len
);
519 /* dump notify packet */
520 void bgp_notify_print(struct peer
*peer
, struct bgp_notify
*bgp_notify
,
523 const char *subcode_str
;
524 const char *code_str
;
525 const char *msg_str
= NULL
;
528 if (BGP_DEBUG(neighbor_events
, NEIGHBOR_EVENTS
)
529 || CHECK_FLAG(peer
->bgp
->flags
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
)) {
530 code_str
= bgp_notify_code_str(bgp_notify
->code
);
531 subcode_str
= bgp_notify_subcode_str(bgp_notify
->code
,
532 bgp_notify
->subcode
);
534 if (bgp_notify
->code
== BGP_NOTIFY_CEASE
535 && (bgp_notify
->subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
536 || bgp_notify
->subcode
537 == BGP_NOTIFY_CEASE_ADMIN_RESET
)) {
538 msg_str
= bgp_notify_admin_message(
539 msg_buf
, sizeof(msg_buf
), bgp_notify
->raw_data
,
545 "%%NOTIFICATION: %s neighbor %s %d/%d (%s%s) \"%s\"",
546 strcmp(direct
, "received") == 0
549 peer
->host
, bgp_notify
->code
,
550 bgp_notify
->subcode
, code_str
, subcode_str
,
553 msg_str
= bgp_notify
->data
? bgp_notify
->data
: "";
555 "%%NOTIFICATION: %s neighbor %s %d/%d (%s%s) %d bytes %s",
556 strcmp(direct
, "received") == 0
559 peer
->host
, bgp_notify
->code
,
560 bgp_notify
->subcode
, code_str
, subcode_str
,
561 bgp_notify
->length
, msg_str
);
566 static void bgp_debug_clear_updgrp_update_dbg(struct bgp
*bgp
)
569 bgp
= bgp_get_default();
570 update_group_walk(bgp
, update_group_clear_update_dbg
, NULL
);
573 static void bgp_debug_print_evpn_prefix(struct vty
*vty
, const char *desc
,
576 char evpn_desc
[PREFIX2STR_BUFFER
+ INET_ADDRSTRLEN
];
577 char buf
[PREFIX2STR_BUFFER
];
578 char buf2
[ETHER_ADDR_STRLEN
];
580 if (p
->u
.prefix_evpn
.route_type
== BGP_EVPN_MAC_IP_ROUTE
) {
581 if (is_evpn_prefix_ipaddr_none((struct prefix_evpn
*)p
)) {
583 evpn_desc
, sizeof(evpn_desc
),
584 "l2vpn evpn type macip mac %s",
585 prefix_mac2str(&p
->u
.prefix_evpn
.macip_addr
.mac
,
586 buf2
, sizeof(buf2
)));
588 uint8_t family
= is_evpn_prefix_ipaddr_v4(
589 (struct prefix_evpn
*)p
) ?
592 evpn_desc
, sizeof(evpn_desc
),
593 "l2vpn evpn type macip mac %s ip %s",
594 prefix_mac2str(&p
->u
.prefix_evpn
.macip_addr
.mac
,
598 &p
->u
.prefix_evpn
.macip_addr
.ip
.ip
.addr
,
599 buf
, PREFIX2STR_BUFFER
));
601 } else if (p
->u
.prefix_evpn
.route_type
== BGP_EVPN_IMET_ROUTE
) {
602 snprintfrr(evpn_desc
, sizeof(evpn_desc
),
603 "l2vpn evpn type multicast ip %pI4",
604 &p
->u
.prefix_evpn
.imet_addr
.ip
.ipaddr_v4
);
605 } else if (p
->u
.prefix_evpn
.route_type
== BGP_EVPN_IP_PREFIX_ROUTE
) {
606 uint8_t family
= is_evpn_prefix_ipaddr_v4(
607 (struct prefix_evpn
*)p
) ? AF_INET
609 snprintf(evpn_desc
, sizeof(evpn_desc
),
610 "l2vpn evpn type prefix ip %s/%d",
612 &p
->u
.prefix_evpn
.prefix_addr
.ip
.ip
.addr
,
613 buf
, PREFIX2STR_BUFFER
),
614 p
->u
.prefix_evpn
.prefix_addr
.ip_prefix_length
);
617 vty_out(vty
, "%s %s\n", desc
, evpn_desc
);
620 static int bgp_debug_parse_evpn_prefix(struct vty
*vty
, struct cmd_token
**argv
,
621 int argc
, struct prefix
**argv_pp
)
623 struct prefix
*argv_p
;
632 if (bgp_evpn_cli_parse_type(&evpn_type
, argv
, argc
) < 0)
635 if (evpn_type
== BGP_EVPN_MAC_IP_ROUTE
) {
636 memset(&ip
, 0, sizeof(struct ipaddr
));
638 argv_find(argv
, argc
, "mac", &mac_idx
);
639 (void)prefix_str2mac(argv
[mac_idx
+ 1]->arg
, &mac
);
641 argv_find(argv
, argc
, "ip", &ip_idx
);
642 str2ipaddr(argv
[ip_idx
+ 1]->arg
, &ip
);
644 build_evpn_type2_prefix((struct prefix_evpn
*)argv_p
,
646 } else if (evpn_type
== BGP_EVPN_IMET_ROUTE
) {
647 memset(&ip
, 0, sizeof(struct ipaddr
));
649 argv_find(argv
, argc
, "ip", &ip_idx
);
650 str2ipaddr(argv
[ip_idx
+ 1]->arg
, &ip
);
652 build_evpn_type3_prefix((struct prefix_evpn
*)argv_p
,
654 } else if (evpn_type
== BGP_EVPN_IP_PREFIX_ROUTE
) {
655 struct prefix ip_prefix
;
657 memset(&ip_prefix
, 0, sizeof(struct prefix
));
658 if (argv_find(argv
, argc
, "ip", &ip_idx
)) {
659 (void)str2prefix(argv
[ip_idx
+ 1]->arg
, &ip_prefix
);
660 apply_mask(&ip_prefix
);
662 build_type5_prefix_from_ip_prefix(
663 (struct prefix_evpn
*)argv_p
,
670 /* Debug option setting interface. */
671 unsigned long bgp_debug_option
= 0;
673 int debug(unsigned int option
)
675 return bgp_debug_option
& option
;
678 DEFUN (debug_bgp_as4
,
685 if (vty
->node
== CONFIG_NODE
)
688 TERM_DEBUG_ON(as4
, AS4
);
689 vty_out(vty
, "BGP as4 debugging is on\n");
694 DEFUN (no_debug_bgp_as4
,
695 no_debug_bgp_as4_cmd
,
702 if (vty
->node
== CONFIG_NODE
)
705 TERM_DEBUG_OFF(as4
, AS4
);
706 vty_out(vty
, "BGP as4 debugging is off\n");
711 DEFUN (debug_bgp_as4_segment
,
712 debug_bgp_as4_segment_cmd
,
713 "debug bgp as4 segment",
717 "BGP AS4 aspath segment handling\n")
719 if (vty
->node
== CONFIG_NODE
)
720 DEBUG_ON(as4
, AS4_SEGMENT
);
722 TERM_DEBUG_ON(as4
, AS4_SEGMENT
);
723 vty_out(vty
, "BGP as4 segment debugging is on\n");
728 DEFUN (no_debug_bgp_as4_segment
,
729 no_debug_bgp_as4_segment_cmd
,
730 "no debug bgp as4 segment",
735 "BGP AS4 aspath segment handling\n")
737 if (vty
->node
== CONFIG_NODE
)
738 DEBUG_OFF(as4
, AS4_SEGMENT
);
740 TERM_DEBUG_OFF(as4
, AS4_SEGMENT
);
741 vty_out(vty
, "BGP as4 segment debugging is off\n");
746 /* debug bgp neighbor_events */
747 DEFUN (debug_bgp_neighbor_events
,
748 debug_bgp_neighbor_events_cmd
,
749 "debug bgp neighbor-events",
752 "BGP Neighbor Events\n")
754 bgp_debug_list_free(bgp_debug_neighbor_events_peers
);
756 if (vty
->node
== CONFIG_NODE
)
757 DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
759 TERM_DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
760 vty_out(vty
, "BGP neighbor-events debugging is on\n");
765 DEFUN (debug_bgp_neighbor_events_peer
,
766 debug_bgp_neighbor_events_peer_cmd
,
767 "debug bgp neighbor-events <A.B.C.D|X:X::X:X|WORD>",
770 "BGP Neighbor Events\n"
771 "BGP neighbor IP address to debug\n"
772 "BGP IPv6 neighbor to debug\n"
773 "BGP neighbor on interface to debug\n")
776 const char *host
= argv
[idx_peer
]->arg
;
778 if (!bgp_debug_neighbor_events_peers
)
779 bgp_debug_neighbor_events_peers
= list_new();
781 if (bgp_debug_list_has_entry(bgp_debug_neighbor_events_peers
, host
,
784 "BGP neighbor-events debugging is already enabled for %s\n",
789 bgp_debug_list_add_entry(bgp_debug_neighbor_events_peers
, host
, NULL
);
791 if (vty
->node
== CONFIG_NODE
)
792 DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
794 TERM_DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
795 vty_out(vty
, "BGP neighbor-events debugging is on for %s\n",
801 DEFUN (no_debug_bgp_neighbor_events
,
802 no_debug_bgp_neighbor_events_cmd
,
803 "no debug bgp neighbor-events",
809 bgp_debug_list_free(bgp_debug_neighbor_events_peers
);
811 if (vty
->node
== CONFIG_NODE
)
812 DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
814 TERM_DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
815 vty_out(vty
, "BGP neighbor-events debugging is off\n");
820 DEFUN (no_debug_bgp_neighbor_events_peer
,
821 no_debug_bgp_neighbor_events_peer_cmd
,
822 "no debug bgp neighbor-events <A.B.C.D|X:X::X:X|WORD>",
827 "BGP neighbor IP address to debug\n"
828 "BGP IPv6 neighbor to debug\n"
829 "BGP neighbor on interface to debug\n")
833 const char *host
= argv
[idx_peer
]->arg
;
835 if (bgp_debug_neighbor_events_peers
836 && !list_isempty(bgp_debug_neighbor_events_peers
)) {
837 found_peer
= bgp_debug_list_remove_entry(
838 bgp_debug_neighbor_events_peers
, host
, NULL
);
840 if (list_isempty(bgp_debug_neighbor_events_peers
)) {
841 if (vty
->node
== CONFIG_NODE
)
842 DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
844 TERM_DEBUG_OFF(neighbor_events
,
850 vty_out(vty
, "BGP neighbor-events debugging is off for %s\n",
854 "BGP neighbor-events debugging was not enabled for %s\n",
861 DEFUN (debug_bgp_nht
,
866 "BGP nexthop tracking events\n")
868 if (vty
->node
== CONFIG_NODE
)
871 TERM_DEBUG_ON(nht
, NHT
);
872 vty_out(vty
, "BGP nexthop tracking debugging is on\n");
877 DEFUN (no_debug_bgp_nht
,
878 no_debug_bgp_nht_cmd
,
883 "BGP nexthop tracking events\n")
885 if (vty
->node
== CONFIG_NODE
)
888 TERM_DEBUG_OFF(nht
, NHT
);
889 vty_out(vty
, "BGP nexthop tracking debugging is off\n");
894 /* debug bgp keepalives */
895 DEFUN (debug_bgp_keepalive
,
896 debug_bgp_keepalive_cmd
,
897 "debug bgp keepalives",
902 bgp_debug_list_free(bgp_debug_keepalive_peers
);
904 if (vty
->node
== CONFIG_NODE
)
905 DEBUG_ON(keepalive
, KEEPALIVE
);
907 TERM_DEBUG_ON(keepalive
, KEEPALIVE
);
908 vty_out(vty
, "BGP keepalives debugging is on\n");
913 DEFUN (debug_bgp_keepalive_peer
,
914 debug_bgp_keepalive_peer_cmd
,
915 "debug bgp keepalives <A.B.C.D|X:X::X:X|WORD>",
919 "BGP IPv4 neighbor to debug\n"
920 "BGP IPv6 neighbor to debug\n"
921 "BGP neighbor on interface to debug\n")
924 const char *host
= argv
[idx_peer
]->arg
;
926 if (!bgp_debug_keepalive_peers
)
927 bgp_debug_keepalive_peers
= list_new();
929 if (bgp_debug_list_has_entry(bgp_debug_keepalive_peers
, host
, NULL
)) {
931 "BGP keepalive debugging is already enabled for %s\n",
936 bgp_debug_list_add_entry(bgp_debug_keepalive_peers
, host
, NULL
);
938 if (vty
->node
== CONFIG_NODE
)
939 DEBUG_ON(keepalive
, KEEPALIVE
);
941 TERM_DEBUG_ON(keepalive
, KEEPALIVE
);
942 vty_out(vty
, "BGP keepalives debugging is on for %s\n", host
);
947 DEFUN (no_debug_bgp_keepalive
,
948 no_debug_bgp_keepalive_cmd
,
949 "no debug bgp keepalives",
955 bgp_debug_list_free(bgp_debug_keepalive_peers
);
957 if (vty
->node
== CONFIG_NODE
)
958 DEBUG_OFF(keepalive
, KEEPALIVE
);
960 TERM_DEBUG_OFF(keepalive
, KEEPALIVE
);
961 vty_out(vty
, "BGP keepalives debugging is off\n");
966 DEFUN (no_debug_bgp_keepalive_peer
,
967 no_debug_bgp_keepalive_peer_cmd
,
968 "no debug bgp keepalives <A.B.C.D|X:X::X:X|WORD>",
973 "BGP neighbor IP address to debug\n"
974 "BGP IPv6 neighbor to debug\n"
975 "BGP neighbor on interface to debug\n")
979 const char *host
= argv
[idx_peer
]->arg
;
981 if (bgp_debug_keepalive_peers
982 && !list_isempty(bgp_debug_keepalive_peers
)) {
983 found_peer
= bgp_debug_list_remove_entry(
984 bgp_debug_keepalive_peers
, host
, NULL
);
986 if (list_isempty(bgp_debug_keepalive_peers
)) {
987 if (vty
->node
== CONFIG_NODE
)
988 DEBUG_OFF(keepalive
, KEEPALIVE
);
990 TERM_DEBUG_OFF(keepalive
, KEEPALIVE
);
995 vty_out(vty
, "BGP keepalives debugging is off for %s\n", host
);
998 "BGP keepalives debugging was not enabled for %s\n",
1004 /* debug bgp bestpath */
1005 DEFUN (debug_bgp_bestpath_prefix
,
1006 debug_bgp_bestpath_prefix_cmd
,
1007 "debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
1014 struct prefix
*argv_p
;
1015 int idx_ipv4_ipv6_prefixlen
= 3;
1017 argv_p
= prefix_new();
1018 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1021 if (!bgp_debug_bestpath_prefixes
)
1022 bgp_debug_bestpath_prefixes
= list_new();
1024 if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes
, NULL
,
1027 "BGP bestpath debugging is already enabled for %s\n",
1028 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1032 bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes
, NULL
, argv_p
);
1034 if (vty
->node
== CONFIG_NODE
) {
1035 DEBUG_ON(bestpath
, BESTPATH
);
1037 TERM_DEBUG_ON(bestpath
, BESTPATH
);
1038 vty_out(vty
, "BGP bestpath debugging is on for %s\n",
1039 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1045 DEFUN (no_debug_bgp_bestpath_prefix
,
1046 no_debug_bgp_bestpath_prefix_cmd
,
1047 "no debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
1055 int idx_ipv4_ipv6_prefixlen
= 4;
1056 struct prefix
*argv_p
;
1057 int found_prefix
= 0;
1059 argv_p
= prefix_new();
1060 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1063 if (bgp_debug_bestpath_prefixes
1064 && !list_isempty(bgp_debug_bestpath_prefixes
)) {
1065 found_prefix
= bgp_debug_list_remove_entry(
1066 bgp_debug_bestpath_prefixes
, NULL
, argv_p
);
1068 if (list_isempty(bgp_debug_bestpath_prefixes
)) {
1069 if (vty
->node
== CONFIG_NODE
) {
1070 DEBUG_OFF(bestpath
, BESTPATH
);
1072 TERM_DEBUG_OFF(bestpath
, BESTPATH
);
1074 "BGP bestpath debugging (per prefix) is off\n");
1080 vty_out(vty
, "BGP bestpath debugging is off for %s\n",
1081 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1083 vty_out(vty
, "BGP bestpath debugging was not enabled for %s\n",
1084 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1089 DEFUN (no_debug_bgp_bestpath
,
1090 no_debug_bgp_bestpath_cmd
,
1091 "no debug bgp bestpath",
1097 bgp_debug_list_free(bgp_debug_bestpath_prefixes
);
1099 if (vty
->node
== CONFIG_NODE
)
1100 DEBUG_OFF(bestpath
, BESTPATH
);
1102 TERM_DEBUG_OFF(bestpath
, BESTPATH
);
1103 vty_out(vty
, "BGP bestpath debugging is off\n");
1108 /* debug bgp updates */
1109 DEFUN (debug_bgp_update
,
1110 debug_bgp_update_cmd
,
1111 "debug bgp updates",
1116 bgp_debug_list_free(bgp_debug_update_in_peers
);
1117 bgp_debug_list_free(bgp_debug_update_out_peers
);
1118 bgp_debug_list_free(bgp_debug_update_prefixes
);
1120 if (vty
->node
== CONFIG_NODE
) {
1121 DEBUG_ON(update
, UPDATE_IN
);
1122 DEBUG_ON(update
, UPDATE_OUT
);
1124 TERM_DEBUG_ON(update
, UPDATE_IN
);
1125 TERM_DEBUG_ON(update
, UPDATE_OUT
);
1126 vty_out(vty
, "BGP updates debugging is on\n");
1131 DEFUN (debug_bgp_update_direct
,
1132 debug_bgp_update_direct_cmd
,
1133 "debug bgp updates <in|out>",
1138 "Outbound updates\n")
1142 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1143 bgp_debug_list_free(bgp_debug_update_in_peers
);
1145 bgp_debug_list_free(bgp_debug_update_out_peers
);
1147 if (vty
->node
== CONFIG_NODE
) {
1148 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1149 DEBUG_ON(update
, UPDATE_IN
);
1151 DEBUG_ON(update
, UPDATE_OUT
);
1153 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0) {
1154 TERM_DEBUG_ON(update
, UPDATE_IN
);
1155 vty_out(vty
, "BGP updates debugging is on (inbound)\n");
1157 TERM_DEBUG_ON(update
, UPDATE_OUT
);
1159 "BGP updates debugging is on (outbound)\n");
1165 DEFUN (debug_bgp_update_direct_peer
,
1166 debug_bgp_update_direct_peer_cmd
,
1167 "debug bgp updates <in|out> <A.B.C.D|X:X::X:X|WORD>",
1172 "Outbound updates\n"
1173 "BGP neighbor IP address to debug\n"
1174 "BGP IPv6 neighbor to debug\n"
1175 "BGP neighbor on interface to debug\n")
1179 const char *host
= argv
[idx_peer
]->arg
;
1182 if (!bgp_debug_update_in_peers
)
1183 bgp_debug_update_in_peers
= list_new();
1185 if (!bgp_debug_update_out_peers
)
1186 bgp_debug_update_out_peers
= list_new();
1188 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1194 if (bgp_debug_list_has_entry(bgp_debug_update_in_peers
, host
,
1197 "BGP inbound update debugging is already enabled for %s\n",
1204 if (bgp_debug_list_has_entry(bgp_debug_update_out_peers
, host
,
1207 "BGP outbound update debugging is already enabled for %s\n",
1214 bgp_debug_list_add_entry(bgp_debug_update_in_peers
, host
, NULL
);
1217 struct peer_af
*paf
;
1220 bgp_debug_list_add_entry(bgp_debug_update_out_peers
, host
,
1222 peer
= bgp_find_peer(vty
, host
);
1225 for (afidx
= BGP_AF_START
; afidx
< BGP_AF_MAX
;
1227 paf
= peer
->peer_af_array
[afidx
];
1229 if (PAF_SUBGRP(paf
)) {
1239 if (vty
->node
== CONFIG_NODE
) {
1241 DEBUG_ON(update
, UPDATE_IN
);
1243 DEBUG_ON(update
, UPDATE_OUT
);
1246 TERM_DEBUG_ON(update
, UPDATE_IN
);
1248 "BGP updates debugging is on (inbound) for %s\n",
1249 argv
[idx_peer
]->arg
);
1251 TERM_DEBUG_ON(update
, UPDATE_OUT
);
1253 "BGP updates debugging is on (outbound) for %s\n",
1254 argv
[idx_peer
]->arg
);
1260 DEFUN (no_debug_bgp_update_direct
,
1261 no_debug_bgp_update_direct_cmd
,
1262 "no debug bgp updates <in|out>",
1268 "Outbound updates\n")
1271 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0) {
1272 bgp_debug_list_free(bgp_debug_update_in_peers
);
1274 if (vty
->node
== CONFIG_NODE
) {
1275 DEBUG_OFF(update
, UPDATE_IN
);
1277 TERM_DEBUG_OFF(update
, UPDATE_IN
);
1279 "BGP updates debugging is off (inbound)\n");
1282 bgp_debug_list_free(bgp_debug_update_out_peers
);
1284 if (vty
->node
== CONFIG_NODE
) {
1285 DEBUG_OFF(update
, UPDATE_OUT
);
1287 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
1289 "BGP updates debugging is off (outbound)\n");
1296 DEFUN (no_debug_bgp_update_direct_peer
,
1297 no_debug_bgp_update_direct_peer_cmd
,
1298 "no debug bgp updates <in|out> <A.B.C.D|X:X::X:X|WORD>",
1304 "Outbound updates\n"
1305 "BGP neighbor IP address to debug\n"
1306 "BGP IPv6 neighbor to debug\n"
1307 "BGP neighbor on interface to debug\n")
1313 const char *host
= argv
[idx_peer
]->arg
;
1315 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1320 if (inbound
&& bgp_debug_update_in_peers
1321 && !list_isempty(bgp_debug_update_in_peers
)) {
1322 found_peer
= bgp_debug_list_remove_entry(
1323 bgp_debug_update_in_peers
, host
, NULL
);
1325 if (list_isempty(bgp_debug_update_in_peers
)) {
1326 if (vty
->node
== CONFIG_NODE
)
1327 DEBUG_OFF(update
, UPDATE_IN
);
1329 TERM_DEBUG_OFF(update
, UPDATE_IN
);
1331 "BGP updates debugging (inbound) is off\n");
1336 if (!inbound
&& bgp_debug_update_out_peers
1337 && !list_isempty(bgp_debug_update_out_peers
)) {
1338 found_peer
= bgp_debug_list_remove_entry(
1339 bgp_debug_update_out_peers
, host
, NULL
);
1341 if (list_isempty(bgp_debug_update_out_peers
)) {
1342 if (vty
->node
== CONFIG_NODE
)
1343 DEBUG_OFF(update
, UPDATE_OUT
);
1345 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
1347 "BGP updates debugging (outbound) is off\n");
1352 struct peer_af
*paf
;
1354 peer
= bgp_find_peer(vty
, host
);
1357 for (afidx
= BGP_AF_START
; afidx
< BGP_AF_MAX
;
1359 paf
= peer
->peer_af_array
[afidx
];
1361 if (PAF_SUBGRP(paf
)) {
1362 UPDGRP_PEER_DBG_DIS(
1374 "BGP updates debugging (inbound) is off for %s\n",
1378 "BGP updates debugging (outbound) is off for %s\n",
1382 "BGP updates debugging (inbound) was not enabled for %s\n",
1386 "BGP updates debugging (outbound) was not enabled for %s\n",
1392 #ifndef VTYSH_EXTRACT_PL
1393 #include "bgpd/bgp_debug_clippy.c"
1396 DEFPY (debug_bgp_update_prefix_afi_safi
,
1397 debug_bgp_update_prefix_afi_safi_cmd
,
1398 "debug bgp updates prefix l2vpn$afi evpn$safi type <<macip|2> mac <X:X:X:X:X:X|X:X:X:X:X:X/M> [ip <A.B.C.D|X:X::X:X>]|<multicast|3> ip <A.B.C.D|X:X::X:X>|<prefix|5> ip <A.B.C.D/M|X:X::X:X/M>>",
1402 "Specify a prefix to debug\n"
1406 EVPN_TYPE_2_HELP_STR
1407 EVPN_TYPE_2_HELP_STR
1408 MAC_STR MAC_STR MAC_STR
1412 EVPN_TYPE_3_HELP_STR
1413 EVPN_TYPE_3_HELP_STR
1417 EVPN_TYPE_5_HELP_STR
1418 EVPN_TYPE_5_HELP_STR
1423 struct prefix
*argv_p
;
1424 int ret
= CMD_SUCCESS
;
1426 argv_p
= prefix_new();
1428 ret
= bgp_debug_parse_evpn_prefix(vty
, argv
, argc
, &argv_p
);
1429 if (ret
!= CMD_SUCCESS
) {
1430 prefix_free(&argv_p
);
1434 if (!bgp_debug_update_prefixes
)
1435 bgp_debug_update_prefixes
= list_new();
1437 if (bgp_debug_list_has_entry(bgp_debug_update_prefixes
, NULL
, argv_p
)) {
1439 "BGP updates debugging is already enabled for %pFX\n",
1441 prefix_free(&argv_p
);
1445 bgp_debug_list_add_entry(bgp_debug_update_prefixes
, NULL
, argv_p
);
1447 if (vty
->node
== CONFIG_NODE
) {
1448 DEBUG_ON(update
, UPDATE_PREFIX
);
1450 TERM_DEBUG_ON(update
, UPDATE_PREFIX
);
1451 vty_out(vty
, "BGP updates debugging is on for %pFX\n", argv_p
);
1454 prefix_free(&argv_p
);
1459 DEFPY (no_debug_bgp_update_prefix_afi_safi
,
1460 no_debug_bgp_update_prefix_afi_safi_cmd
,
1461 "no debug bgp updates prefix l2vpn$afi evpn$safi type <<macip|2> mac <X:X:X:X:X:X|X:X:X:X:X:X/M> [ip <A.B.C.D|X:X::X:X>]|<multicast|3> ip <A.B.C.D|X:X::X:X>|<prefix|5> ip <A.B.C.D/M|X:X::X:X/M>>",
1466 "Specify a prefix to debug\n"
1470 EVPN_TYPE_2_HELP_STR
1471 EVPN_TYPE_2_HELP_STR
1472 MAC_STR MAC_STR MAC_STR
1476 EVPN_TYPE_3_HELP_STR
1477 EVPN_TYPE_3_HELP_STR
1481 EVPN_TYPE_5_HELP_STR
1482 EVPN_TYPE_5_HELP_STR
1487 struct prefix
*argv_p
;
1488 bool found_prefix
= false;
1489 int ret
= CMD_SUCCESS
;
1491 argv_p
= prefix_new();
1493 ret
= bgp_debug_parse_evpn_prefix(vty
, argv
, argc
, &argv_p
);
1494 if (ret
!= CMD_SUCCESS
) {
1495 prefix_free(&argv_p
);
1499 if (bgp_debug_update_prefixes
1500 && !list_isempty(bgp_debug_update_prefixes
)) {
1501 found_prefix
= bgp_debug_list_remove_entry(
1502 bgp_debug_update_prefixes
, NULL
, argv_p
);
1504 if (list_isempty(bgp_debug_update_prefixes
)) {
1505 if (vty
->node
== CONFIG_NODE
) {
1506 DEBUG_OFF(update
, UPDATE_PREFIX
);
1508 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
1510 "BGP updates debugging (per prefix) is off\n");
1516 vty_out(vty
, "BGP updates debugging is off for %pFX\n", argv_p
);
1518 vty_out(vty
, "BGP updates debugging was not enabled for %pFX\n",
1521 prefix_free(&argv_p
);
1527 DEFUN (debug_bgp_update_prefix
,
1528 debug_bgp_update_prefix_cmd
,
1529 "debug bgp updates prefix <A.B.C.D/M|X:X::X:X/M>",
1533 "Specify a prefix to debug\n"
1537 int idx_ipv4_ipv6_prefixlen
= 4;
1538 struct prefix
*argv_p
;
1540 argv_p
= prefix_new();
1541 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1544 if (!bgp_debug_update_prefixes
)
1545 bgp_debug_update_prefixes
= list_new();
1547 if (bgp_debug_list_has_entry(bgp_debug_update_prefixes
, NULL
, argv_p
)) {
1549 "BGP updates debugging is already enabled for %s\n",
1550 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1554 bgp_debug_list_add_entry(bgp_debug_update_prefixes
, NULL
, argv_p
);
1556 if (vty
->node
== CONFIG_NODE
) {
1557 DEBUG_ON(update
, UPDATE_PREFIX
);
1559 TERM_DEBUG_ON(update
, UPDATE_PREFIX
);
1560 vty_out(vty
, "BGP updates debugging is on for %s\n",
1561 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1567 DEFUN (no_debug_bgp_update_prefix
,
1568 no_debug_bgp_update_prefix_cmd
,
1569 "no debug bgp updates prefix <A.B.C.D/M|X:X::X:X/M>",
1574 "Specify a prefix to debug\n"
1578 int idx_ipv4_ipv6_prefixlen
= 5;
1579 struct prefix
*argv_p
;
1580 int found_prefix
= 0;
1582 argv_p
= prefix_new();
1583 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1586 if (bgp_debug_update_prefixes
1587 && !list_isempty(bgp_debug_update_prefixes
)) {
1588 found_prefix
= bgp_debug_list_remove_entry(
1589 bgp_debug_update_prefixes
, NULL
, argv_p
);
1591 if (list_isempty(bgp_debug_update_prefixes
)) {
1592 if (vty
->node
== CONFIG_NODE
) {
1593 DEBUG_OFF(update
, UPDATE_PREFIX
);
1595 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
1597 "BGP updates debugging (per prefix) is off\n");
1603 vty_out(vty
, "BGP updates debugging is off for %s\n",
1604 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1606 vty_out(vty
, "BGP updates debugging was not enabled for %s\n",
1607 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1612 DEFUN (no_debug_bgp_update
,
1613 no_debug_bgp_update_cmd
,
1614 "no debug bgp updates",
1620 struct listnode
*ln
;
1623 bgp_debug_list_free(bgp_debug_update_in_peers
);
1624 bgp_debug_list_free(bgp_debug_update_out_peers
);
1625 bgp_debug_list_free(bgp_debug_update_prefixes
);
1627 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, ln
, bgp
))
1628 bgp_debug_clear_updgrp_update_dbg(bgp
);
1630 if (vty
->node
== CONFIG_NODE
) {
1631 DEBUG_OFF(update
, UPDATE_IN
);
1632 DEBUG_OFF(update
, UPDATE_OUT
);
1633 DEBUG_OFF(update
, UPDATE_PREFIX
);
1635 TERM_DEBUG_OFF(update
, UPDATE_IN
);
1636 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
1637 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
1638 vty_out(vty
, "BGP updates debugging is off\n");
1643 /* debug bgp zebra */
1644 DEFUN (debug_bgp_zebra
,
1645 debug_bgp_zebra_cmd
,
1649 "BGP Zebra messages\n")
1651 if (vty
->node
== CONFIG_NODE
)
1652 DEBUG_ON(zebra
, ZEBRA
);
1654 TERM_DEBUG_ON(zebra
, ZEBRA
);
1655 vty_out(vty
, "BGP zebra debugging is on\n");
1660 DEFUN (debug_bgp_graceful_restart
,
1661 debug_bgp_graceful_restart_cmd
,
1662 "debug bgp graceful-restart",
1667 if (vty
->node
== CONFIG_NODE
) {
1668 DEBUG_ON(graceful_restart
, GRACEFUL_RESTART
);
1670 TERM_DEBUG_ON(graceful_restart
, GRACEFUL_RESTART
);
1671 vty_out(vty
, "BGP Graceful Restart debugging is on\n");
1677 DEFUN (debug_bgp_zebra_prefix
,
1678 debug_bgp_zebra_prefix_cmd
,
1679 "debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>",
1682 "BGP Zebra messages\n"
1683 "Specify a prefix to debug\n"
1687 int idx_ipv4_ipv6_prefixlen
= 4;
1688 struct prefix
*argv_p
;
1690 argv_p
= prefix_new();
1691 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1694 if (!bgp_debug_zebra_prefixes
)
1695 bgp_debug_zebra_prefixes
= list_new();
1697 if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes
, NULL
, argv_p
)) {
1698 vty_out(vty
, "BGP zebra debugging is already enabled for %s\n",
1699 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1703 bgp_debug_list_add_entry(bgp_debug_zebra_prefixes
, NULL
, argv_p
);
1705 if (vty
->node
== CONFIG_NODE
)
1706 DEBUG_ON(zebra
, ZEBRA
);
1708 TERM_DEBUG_ON(zebra
, ZEBRA
);
1709 vty_out(vty
, "BGP zebra debugging is on for %s\n",
1710 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1716 DEFUN (no_debug_bgp_zebra
,
1717 no_debug_bgp_zebra_cmd
,
1718 "no debug bgp zebra",
1722 "BGP Zebra messages\n")
1724 bgp_debug_list_free(bgp_debug_zebra_prefixes
);
1726 if (vty
->node
== CONFIG_NODE
)
1727 DEBUG_OFF(zebra
, ZEBRA
);
1729 TERM_DEBUG_OFF(zebra
, ZEBRA
);
1730 vty_out(vty
, "BGP zebra debugging is off\n");
1735 DEFUN (no_debug_bgp_graceful_restart
,
1736 no_debug_bgp_graceful_restart_cmd
,
1737 "no debug bgp graceful-restart",
1743 if (vty
->node
== CONFIG_NODE
) {
1744 DEBUG_OFF(graceful_restart
, GRACEFUL_RESTART
);
1746 TERM_DEBUG_OFF(graceful_restart
, GRACEFUL_RESTART
);
1747 vty_out(vty
, "BGP Graceful Restart debugging is off\n");
1752 DEFUN (no_debug_bgp_zebra_prefix
,
1753 no_debug_bgp_zebra_prefix_cmd
,
1754 "no debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>",
1758 "BGP Zebra messages\n"
1759 "Specify a prefix to debug\n"
1763 int idx_ipv4_ipv6_prefixlen
= 5;
1764 struct prefix
*argv_p
;
1765 int found_prefix
= 0;
1767 argv_p
= prefix_new();
1768 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1771 if (bgp_debug_zebra_prefixes
1772 && !list_isempty(bgp_debug_zebra_prefixes
)) {
1773 found_prefix
= bgp_debug_list_remove_entry(
1774 bgp_debug_zebra_prefixes
, NULL
, argv_p
);
1776 if (list_isempty(bgp_debug_zebra_prefixes
)) {
1777 if (vty
->node
== CONFIG_NODE
)
1778 DEBUG_OFF(zebra
, ZEBRA
);
1780 TERM_DEBUG_OFF(zebra
, ZEBRA
);
1781 vty_out(vty
, "BGP zebra debugging is off\n");
1787 vty_out(vty
, "BGP zebra debugging is off for %s\n",
1788 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1790 vty_out(vty
, "BGP zebra debugging was not enabled for %s\n",
1791 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1796 DEFUN (debug_bgp_allow_martians
,
1797 debug_bgp_allow_martians_cmd
,
1798 "debug bgp allow-martians",
1801 "BGP allow martian next hops\n")
1803 if (vty
->node
== CONFIG_NODE
)
1804 DEBUG_ON(allow_martians
, ALLOW_MARTIANS
);
1806 TERM_DEBUG_ON(allow_martians
, ALLOW_MARTIANS
);
1807 vty_out(vty
, "BGP allow_martian next hop debugging is on\n");
1812 DEFUN (no_debug_bgp_allow_martians
,
1813 no_debug_bgp_allow_martians_cmd
,
1814 "no debug bgp allow-martians",
1818 "BGP allow martian next hops\n")
1820 if (vty
->node
== CONFIG_NODE
)
1821 DEBUG_OFF(allow_martians
, ALLOW_MARTIANS
);
1823 TERM_DEBUG_OFF(allow_martians
, ALLOW_MARTIANS
);
1824 vty_out(vty
, "BGP allow martian next hop debugging is off\n");
1830 /* debug bgp update-groups */
1831 DEFUN (debug_bgp_update_groups
,
1832 debug_bgp_update_groups_cmd
,
1833 "debug bgp update-groups",
1836 "BGP update-groups\n")
1838 if (vty
->node
== CONFIG_NODE
)
1839 DEBUG_ON(update_groups
, UPDATE_GROUPS
);
1841 TERM_DEBUG_ON(update_groups
, UPDATE_GROUPS
);
1842 vty_out(vty
, "BGP update-groups debugging is on\n");
1847 DEFUN (no_debug_bgp_update_groups
,
1848 no_debug_bgp_update_groups_cmd
,
1849 "no debug bgp update-groups",
1853 "BGP update-groups\n")
1855 if (vty
->node
== CONFIG_NODE
)
1856 DEBUG_OFF(update_groups
, UPDATE_GROUPS
);
1858 TERM_DEBUG_OFF(update_groups
, UPDATE_GROUPS
);
1859 vty_out(vty
, "BGP update-groups debugging is off\n");
1864 DEFUN (debug_bgp_vpn
,
1866 "debug bgp vpn <leak-from-vrf|leak-to-vrf|rmap-event|label>",
1870 "leaked from vrf to vpn\n"
1871 "leaked to vrf from vpn\n"
1872 "route-map updates\n"
1877 if (argv_find(argv
, argc
, "leak-from-vrf", &idx
)) {
1878 if (vty
->node
== CONFIG_NODE
)
1879 DEBUG_ON(vpn
, VPN_LEAK_FROM_VRF
);
1881 TERM_DEBUG_ON(vpn
, VPN_LEAK_FROM_VRF
);
1882 } else if (argv_find(argv
, argc
, "leak-to-vrf", &idx
)) {
1883 if (vty
->node
== CONFIG_NODE
)
1884 DEBUG_ON(vpn
, VPN_LEAK_TO_VRF
);
1886 TERM_DEBUG_ON(vpn
, VPN_LEAK_TO_VRF
);
1887 } else if (argv_find(argv
, argc
, "rmap-event", &idx
)) {
1888 if (vty
->node
== CONFIG_NODE
)
1889 DEBUG_ON(vpn
, VPN_LEAK_RMAP_EVENT
);
1891 TERM_DEBUG_ON(vpn
, VPN_LEAK_RMAP_EVENT
);
1892 } else if (argv_find(argv
, argc
, "label", &idx
)) {
1893 if (vty
->node
== CONFIG_NODE
)
1894 DEBUG_ON(vpn
, VPN_LEAK_LABEL
);
1896 TERM_DEBUG_ON(vpn
, VPN_LEAK_LABEL
);
1898 vty_out(vty
, "%% unknown debug bgp vpn keyword\n");
1899 return CMD_WARNING_CONFIG_FAILED
;
1902 if (vty
->node
!= CONFIG_NODE
)
1903 vty_out(vty
, "enabled debug bgp vpn %s\n", argv
[idx
]->text
);
1908 DEFUN (no_debug_bgp_vpn
,
1909 no_debug_bgp_vpn_cmd
,
1910 "no debug bgp vpn <leak-from-vrf|leak-to-vrf|rmap-event|label>",
1915 "leaked from vrf to vpn\n"
1916 "leaked to vrf from vpn\n"
1917 "route-map updates\n"
1922 if (argv_find(argv
, argc
, "leak-from-vrf", &idx
)) {
1923 if (vty
->node
== CONFIG_NODE
)
1924 DEBUG_OFF(vpn
, VPN_LEAK_FROM_VRF
);
1926 TERM_DEBUG_OFF(vpn
, VPN_LEAK_FROM_VRF
);
1928 } else if (argv_find(argv
, argc
, "leak-to-vrf", &idx
)) {
1929 if (vty
->node
== CONFIG_NODE
)
1930 DEBUG_OFF(vpn
, VPN_LEAK_TO_VRF
);
1932 TERM_DEBUG_OFF(vpn
, VPN_LEAK_TO_VRF
);
1933 } else if (argv_find(argv
, argc
, "rmap-event", &idx
)) {
1934 if (vty
->node
== CONFIG_NODE
)
1935 DEBUG_OFF(vpn
, VPN_LEAK_RMAP_EVENT
);
1937 TERM_DEBUG_OFF(vpn
, VPN_LEAK_RMAP_EVENT
);
1938 } else if (argv_find(argv
, argc
, "label", &idx
)) {
1939 if (vty
->node
== CONFIG_NODE
)
1940 DEBUG_OFF(vpn
, VPN_LEAK_LABEL
);
1942 TERM_DEBUG_OFF(vpn
, VPN_LEAK_LABEL
);
1944 vty_out(vty
, "%% unknown debug bgp vpn keyword\n");
1945 return CMD_WARNING_CONFIG_FAILED
;
1948 if (vty
->node
!= CONFIG_NODE
)
1949 vty_out(vty
, "disabled debug bgp vpn %s\n", argv
[idx
]->text
);
1954 DEFUN (debug_bgp_pbr
,
1956 "debug bgp pbr [error]",
1959 "BGP policy based routing\n"
1964 if (argv_find(argv
, argc
, "error", &idx
)) {
1965 if (vty
->node
== CONFIG_NODE
)
1966 DEBUG_ON(pbr
, PBR_ERROR
);
1968 TERM_DEBUG_ON(pbr
, PBR_ERROR
);
1969 vty_out(vty
, "BGP policy based routing error is on\n");
1973 if (vty
->node
== CONFIG_NODE
)
1976 TERM_DEBUG_ON(pbr
, PBR
);
1977 vty_out(vty
, "BGP policy based routing is on\n");
1982 DEFUN (no_debug_bgp_pbr
,
1983 no_debug_bgp_pbr_cmd
,
1984 "no debug bgp pbr [error]",
1988 "BGP policy based routing\n"
1993 if (argv_find(argv
, argc
, "error", &idx
)) {
1994 if (vty
->node
== CONFIG_NODE
)
1995 DEBUG_OFF(pbr
, PBR_ERROR
);
1997 TERM_DEBUG_OFF(pbr
, PBR_ERROR
);
1998 vty_out(vty
, "BGP policy based routing error is off\n");
2002 if (vty
->node
== CONFIG_NODE
)
2003 DEBUG_OFF(pbr
, PBR
);
2005 TERM_DEBUG_OFF(pbr
, PBR
);
2006 vty_out(vty
, "BGP policy based routing is off\n");
2011 DEFPY (debug_bgp_evpn_mh
,
2012 debug_bgp_evpn_mh_cmd
,
2013 "[no$no] debug bgp evpn mh <es$es|route$rt>",
2019 "Ethernet Segment debugging\n"
2020 "Route debugging\n")
2023 if (vty
->node
== CONFIG_NODE
) {
2025 DEBUG_OFF(evpn_mh
, EVPN_MH_ES
);
2027 DEBUG_ON(evpn_mh
, EVPN_MH_ES
);
2030 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_ES
);
2032 "BGP EVPN-MH ES debugging is off\n");
2034 TERM_DEBUG_ON(evpn_mh
, EVPN_MH_ES
);
2036 "BGP EVPN-MH ES debugging is on\n");
2041 if (vty
->node
== CONFIG_NODE
) {
2043 DEBUG_OFF(evpn_mh
, EVPN_MH_RT
);
2045 DEBUG_ON(evpn_mh
, EVPN_MH_RT
);
2048 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_RT
);
2050 "BGP EVPN-MH route debugging is off\n");
2052 TERM_DEBUG_ON(evpn_mh
, EVPN_MH_RT
);
2054 "BGP EVPN-MH route debugging is on\n");
2062 DEFUN (debug_bgp_labelpool
,
2063 debug_bgp_labelpool_cmd
,
2064 "debug bgp labelpool",
2069 if (vty
->node
== CONFIG_NODE
)
2070 DEBUG_ON(labelpool
, LABELPOOL
);
2072 TERM_DEBUG_ON(labelpool
, LABELPOOL
);
2074 if (vty
->node
!= CONFIG_NODE
)
2075 vty_out(vty
, "enabled debug bgp labelpool\n");
2080 DEFUN (no_debug_bgp_labelpool
,
2081 no_debug_bgp_labelpool_cmd
,
2082 "no debug bgp labelpool",
2088 if (vty
->node
== CONFIG_NODE
)
2089 DEBUG_OFF(labelpool
, LABELPOOL
);
2091 TERM_DEBUG_OFF(labelpool
, LABELPOOL
);
2094 if (vty
->node
!= CONFIG_NODE
)
2095 vty_out(vty
, "disabled debug bgp labelpool\n");
2100 DEFPY(debug_bgp_bfd
, debug_bgp_bfd_cmd
,
2101 "[no] debug bgp bfd",
2105 "Bidirection Forwarding Detection\n")
2107 if (vty
->node
== CONFIG_NODE
) {
2109 DEBUG_OFF(bfd
, BFD_LIB
);
2110 bfd_protocol_integration_set_debug(false);
2112 DEBUG_ON(bfd
, BFD_LIB
);
2113 bfd_protocol_integration_set_debug(true);
2117 TERM_DEBUG_OFF(bfd
, BFD_LIB
);
2118 bfd_protocol_integration_set_debug(false);
2120 TERM_DEBUG_ON(bfd
, BFD_LIB
);
2121 bfd_protocol_integration_set_debug(true);
2128 DEFUN (no_debug_bgp
,
2136 struct listnode
*ln
;
2138 bgp_debug_list_free(bgp_debug_neighbor_events_peers
);
2139 bgp_debug_list_free(bgp_debug_keepalive_peers
);
2140 bgp_debug_list_free(bgp_debug_update_in_peers
);
2141 bgp_debug_list_free(bgp_debug_update_out_peers
);
2142 bgp_debug_list_free(bgp_debug_update_prefixes
);
2143 bgp_debug_list_free(bgp_debug_bestpath_prefixes
);
2144 bgp_debug_list_free(bgp_debug_zebra_prefixes
);
2146 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, ln
, bgp
))
2147 bgp_debug_clear_updgrp_update_dbg(bgp
);
2149 TERM_DEBUG_OFF(keepalive
, KEEPALIVE
);
2150 TERM_DEBUG_OFF(update
, UPDATE_IN
);
2151 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
2152 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
2153 TERM_DEBUG_OFF(bestpath
, BESTPATH
);
2154 TERM_DEBUG_OFF(as4
, AS4
);
2155 TERM_DEBUG_OFF(as4
, AS4_SEGMENT
);
2156 TERM_DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
2157 TERM_DEBUG_OFF(zebra
, ZEBRA
);
2158 TERM_DEBUG_OFF(allow_martians
, ALLOW_MARTIANS
);
2159 TERM_DEBUG_OFF(nht
, NHT
);
2160 TERM_DEBUG_OFF(vpn
, VPN_LEAK_FROM_VRF
);
2161 TERM_DEBUG_OFF(vpn
, VPN_LEAK_TO_VRF
);
2162 TERM_DEBUG_OFF(vpn
, VPN_LEAK_RMAP_EVENT
);
2163 TERM_DEBUG_OFF(vpn
, VPN_LEAK_LABEL
);
2164 TERM_DEBUG_OFF(flowspec
, FLOWSPEC
);
2165 TERM_DEBUG_OFF(labelpool
, LABELPOOL
);
2166 TERM_DEBUG_OFF(pbr
, PBR
);
2167 TERM_DEBUG_OFF(pbr
, PBR_ERROR
);
2168 TERM_DEBUG_OFF(graceful_restart
, GRACEFUL_RESTART
);
2169 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_ES
);
2170 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_RT
);
2171 TERM_DEBUG_OFF(bfd
, BFD_LIB
);
2173 vty_out(vty
, "All possible debugging has been turned off\n");
2178 DEFUN_NOSH (show_debugging_bgp
,
2179 show_debugging_bgp_cmd
,
2180 "show debugging [bgp]",
2185 vty_out(vty
, "BGP debugging status:\n");
2187 if (BGP_DEBUG(as4
, AS4
))
2188 vty_out(vty
, " BGP as4 debugging is on\n");
2190 if (BGP_DEBUG(as4
, AS4_SEGMENT
))
2191 vty_out(vty
, " BGP as4 aspath segment debugging is on\n");
2193 if (BGP_DEBUG(bestpath
, BESTPATH
))
2194 bgp_debug_list_print(vty
, " BGP bestpath debugging is on",
2195 bgp_debug_bestpath_prefixes
);
2197 if (BGP_DEBUG(keepalive
, KEEPALIVE
))
2198 bgp_debug_list_print(vty
, " BGP keepalives debugging is on",
2199 bgp_debug_keepalive_peers
);
2201 if (BGP_DEBUG(neighbor_events
, NEIGHBOR_EVENTS
))
2202 bgp_debug_list_print(vty
,
2203 " BGP neighbor-events debugging is on",
2204 bgp_debug_neighbor_events_peers
);
2206 if (BGP_DEBUG(nht
, NHT
))
2207 vty_out(vty
, " BGP next-hop tracking debugging is on\n");
2209 if (BGP_DEBUG(update_groups
, UPDATE_GROUPS
))
2210 vty_out(vty
, " BGP update-groups debugging is on\n");
2212 if (BGP_DEBUG(update
, UPDATE_PREFIX
))
2213 bgp_debug_list_print(vty
, " BGP updates debugging is on",
2214 bgp_debug_update_prefixes
);
2216 if (BGP_DEBUG(update
, UPDATE_IN
))
2217 bgp_debug_list_print(vty
,
2218 " BGP updates debugging is on (inbound)",
2219 bgp_debug_update_in_peers
);
2221 if (BGP_DEBUG(update
, UPDATE_OUT
))
2222 bgp_debug_list_print(vty
,
2223 " BGP updates debugging is on (outbound)",
2224 bgp_debug_update_out_peers
);
2226 if (BGP_DEBUG(zebra
, ZEBRA
))
2227 bgp_debug_list_print(vty
, " BGP zebra debugging is on",
2228 bgp_debug_zebra_prefixes
);
2230 if (BGP_DEBUG(graceful_restart
, GRACEFUL_RESTART
))
2231 vty_out(vty
, " BGP graceful-restart debugging is on\n");
2233 if (BGP_DEBUG(allow_martians
, ALLOW_MARTIANS
))
2234 vty_out(vty
, " BGP allow martian next hop debugging is on\n");
2236 if (BGP_DEBUG(vpn
, VPN_LEAK_FROM_VRF
))
2238 " BGP route leak from vrf to vpn debugging is on\n");
2239 if (BGP_DEBUG(vpn
, VPN_LEAK_TO_VRF
))
2241 " BGP route leak to vrf from vpn debugging is on\n");
2242 if (BGP_DEBUG(vpn
, VPN_LEAK_RMAP_EVENT
))
2243 vty_out(vty
, " BGP vpn route-map event debugging is on\n");
2244 if (BGP_DEBUG(vpn
, VPN_LEAK_LABEL
))
2245 vty_out(vty
, " BGP vpn label event debugging is on\n");
2246 if (BGP_DEBUG(flowspec
, FLOWSPEC
))
2247 vty_out(vty
, " BGP flowspec debugging is on\n");
2248 if (BGP_DEBUG(labelpool
, LABELPOOL
))
2249 vty_out(vty
, " BGP labelpool debugging is on\n");
2251 if (BGP_DEBUG(pbr
, PBR
))
2252 vty_out(vty
, " BGP policy based routing debugging is on\n");
2253 if (BGP_DEBUG(pbr
, PBR_ERROR
))
2254 vty_out(vty
, " BGP policy based routing error debugging is on\n");
2256 if (BGP_DEBUG(evpn_mh
, EVPN_MH_ES
))
2257 vty_out(vty
, " BGP EVPN-MH ES debugging is on\n");
2258 if (BGP_DEBUG(evpn_mh
, EVPN_MH_RT
))
2259 vty_out(vty
, " BGP EVPN-MH route debugging is on\n");
2261 if (BGP_DEBUG(bfd
, BFD_LIB
))
2262 vty_out(vty
, " BGP BFD library debugging is on\n");
2268 static int bgp_config_write_debug(struct vty
*vty
)
2272 if (CONF_BGP_DEBUG(as4
, AS4
)) {
2273 vty_out(vty
, "debug bgp as4\n");
2277 if (CONF_BGP_DEBUG(as4
, AS4_SEGMENT
)) {
2278 vty_out(vty
, "debug bgp as4 segment\n");
2282 if (CONF_BGP_DEBUG(bestpath
, BESTPATH
)) {
2283 write
+= bgp_debug_list_conf_print(vty
, "debug bgp bestpath",
2284 bgp_debug_bestpath_prefixes
);
2287 if (CONF_BGP_DEBUG(keepalive
, KEEPALIVE
)) {
2288 write
+= bgp_debug_list_conf_print(vty
, "debug bgp keepalives",
2289 bgp_debug_keepalive_peers
);
2292 if (CONF_BGP_DEBUG(neighbor_events
, NEIGHBOR_EVENTS
)) {
2293 write
+= bgp_debug_list_conf_print(
2294 vty
, "debug bgp neighbor-events",
2295 bgp_debug_neighbor_events_peers
);
2298 if (CONF_BGP_DEBUG(nht
, NHT
)) {
2299 vty_out(vty
, "debug bgp nht\n");
2303 if (CONF_BGP_DEBUG(update_groups
, UPDATE_GROUPS
)) {
2304 vty_out(vty
, "debug bgp update-groups\n");
2308 if (CONF_BGP_DEBUG(update
, UPDATE_PREFIX
)) {
2309 write
+= bgp_debug_list_conf_print(vty
,
2310 "debug bgp updates prefix",
2311 bgp_debug_update_prefixes
);
2314 if (CONF_BGP_DEBUG(update
, UPDATE_IN
)) {
2315 write
+= bgp_debug_list_conf_print(vty
, "debug bgp updates in",
2316 bgp_debug_update_in_peers
);
2319 if (CONF_BGP_DEBUG(update
, UPDATE_OUT
)) {
2320 write
+= bgp_debug_list_conf_print(vty
, "debug bgp updates out",
2321 bgp_debug_update_out_peers
);
2324 if (CONF_BGP_DEBUG(zebra
, ZEBRA
)) {
2325 if (!bgp_debug_zebra_prefixes
2326 || list_isempty(bgp_debug_zebra_prefixes
)) {
2327 vty_out(vty
, "debug bgp zebra\n");
2330 write
+= bgp_debug_list_conf_print(
2331 vty
, "debug bgp zebra prefix",
2332 bgp_debug_zebra_prefixes
);
2336 if (CONF_BGP_DEBUG(allow_martians
, ALLOW_MARTIANS
)) {
2337 vty_out(vty
, "debug bgp allow-martians\n");
2341 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_FROM_VRF
)) {
2342 vty_out(vty
, "debug bgp vpn leak-from-vrf\n");
2345 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_TO_VRF
)) {
2346 vty_out(vty
, "debug bgp vpn leak-to-vrf\n");
2349 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_RMAP_EVENT
)) {
2350 vty_out(vty
, "debug bgp vpn rmap-event\n");
2353 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_LABEL
)) {
2354 vty_out(vty
, "debug bgp vpn label\n");
2357 if (CONF_BGP_DEBUG(flowspec
, FLOWSPEC
)) {
2358 vty_out(vty
, "debug bgp flowspec\n");
2361 if (CONF_BGP_DEBUG(labelpool
, LABELPOOL
)) {
2362 vty_out(vty
, "debug bgp labelpool\n");
2366 if (CONF_BGP_DEBUG(pbr
, PBR
)) {
2367 vty_out(vty
, "debug bgp pbr\n");
2370 if (CONF_BGP_DEBUG(pbr
, PBR_ERROR
)) {
2371 vty_out(vty
, "debug bgp pbr error\n");
2375 if (CONF_BGP_DEBUG(graceful_restart
, GRACEFUL_RESTART
)) {
2376 vty_out(vty
, "debug bgp graceful-restart\n");
2380 if (CONF_BGP_DEBUG(evpn_mh
, EVPN_MH_ES
)) {
2381 vty_out(vty
, "debug bgp evpn mh es\n");
2384 if (CONF_BGP_DEBUG(evpn_mh
, EVPN_MH_RT
)) {
2385 vty_out(vty
, "debug bgp evpn mh route\n");
2389 if (CONF_BGP_DEBUG(bfd
, BFD_LIB
)) {
2390 vty_out(vty
, "debug bgp bfd\n");
2397 static int bgp_config_write_debug(struct vty
*vty
);
2398 static struct cmd_node debug_node
= {
2402 .config_write
= bgp_config_write_debug
,
2405 void bgp_debug_init(void)
2407 install_node(&debug_node
);
2409 install_element(ENABLE_NODE
, &show_debugging_bgp_cmd
);
2411 install_element(ENABLE_NODE
, &debug_bgp_as4_cmd
);
2412 install_element(CONFIG_NODE
, &debug_bgp_as4_cmd
);
2413 install_element(ENABLE_NODE
, &debug_bgp_as4_segment_cmd
);
2414 install_element(CONFIG_NODE
, &debug_bgp_as4_segment_cmd
);
2416 install_element(ENABLE_NODE
, &debug_bgp_neighbor_events_cmd
);
2417 install_element(CONFIG_NODE
, &debug_bgp_neighbor_events_cmd
);
2418 install_element(ENABLE_NODE
, &debug_bgp_nht_cmd
);
2419 install_element(CONFIG_NODE
, &debug_bgp_nht_cmd
);
2420 install_element(ENABLE_NODE
, &debug_bgp_keepalive_cmd
);
2421 install_element(CONFIG_NODE
, &debug_bgp_keepalive_cmd
);
2422 install_element(ENABLE_NODE
, &debug_bgp_update_cmd
);
2423 install_element(CONFIG_NODE
, &debug_bgp_update_cmd
);
2424 install_element(ENABLE_NODE
, &debug_bgp_zebra_cmd
);
2425 install_element(CONFIG_NODE
, &debug_bgp_zebra_cmd
);
2426 install_element(ENABLE_NODE
, &debug_bgp_allow_martians_cmd
);
2427 install_element(CONFIG_NODE
, &debug_bgp_allow_martians_cmd
);
2428 install_element(ENABLE_NODE
, &debug_bgp_update_groups_cmd
);
2429 install_element(CONFIG_NODE
, &debug_bgp_update_groups_cmd
);
2430 install_element(ENABLE_NODE
, &debug_bgp_bestpath_prefix_cmd
);
2431 install_element(CONFIG_NODE
, &debug_bgp_bestpath_prefix_cmd
);
2433 install_element(ENABLE_NODE
, &debug_bgp_graceful_restart_cmd
);
2434 install_element(CONFIG_NODE
, &debug_bgp_graceful_restart_cmd
);
2436 /* debug bgp updates (in|out) */
2437 install_element(ENABLE_NODE
, &debug_bgp_update_direct_cmd
);
2438 install_element(CONFIG_NODE
, &debug_bgp_update_direct_cmd
);
2439 install_element(ENABLE_NODE
, &no_debug_bgp_update_direct_cmd
);
2440 install_element(CONFIG_NODE
, &no_debug_bgp_update_direct_cmd
);
2442 /* debug bgp updates (in|out) A.B.C.D */
2443 install_element(ENABLE_NODE
, &debug_bgp_update_direct_peer_cmd
);
2444 install_element(CONFIG_NODE
, &debug_bgp_update_direct_peer_cmd
);
2445 install_element(ENABLE_NODE
, &no_debug_bgp_update_direct_peer_cmd
);
2446 install_element(CONFIG_NODE
, &no_debug_bgp_update_direct_peer_cmd
);
2448 /* debug bgp updates prefix A.B.C.D/M */
2449 install_element(ENABLE_NODE
, &debug_bgp_update_prefix_cmd
);
2450 install_element(CONFIG_NODE
, &debug_bgp_update_prefix_cmd
);
2451 install_element(ENABLE_NODE
, &no_debug_bgp_update_prefix_cmd
);
2452 install_element(CONFIG_NODE
, &no_debug_bgp_update_prefix_cmd
);
2453 install_element(ENABLE_NODE
, &debug_bgp_update_prefix_afi_safi_cmd
);
2454 install_element(CONFIG_NODE
, &debug_bgp_update_prefix_afi_safi_cmd
);
2455 install_element(ENABLE_NODE
, &no_debug_bgp_update_prefix_afi_safi_cmd
);
2456 install_element(CONFIG_NODE
, &no_debug_bgp_update_prefix_afi_safi_cmd
);
2458 /* debug bgp zebra prefix A.B.C.D/M */
2459 install_element(ENABLE_NODE
, &debug_bgp_zebra_prefix_cmd
);
2460 install_element(CONFIG_NODE
, &debug_bgp_zebra_prefix_cmd
);
2461 install_element(ENABLE_NODE
, &no_debug_bgp_zebra_prefix_cmd
);
2462 install_element(CONFIG_NODE
, &no_debug_bgp_zebra_prefix_cmd
);
2464 install_element(ENABLE_NODE
, &no_debug_bgp_as4_cmd
);
2465 install_element(CONFIG_NODE
, &no_debug_bgp_as4_cmd
);
2466 install_element(ENABLE_NODE
, &no_debug_bgp_as4_segment_cmd
);
2467 install_element(CONFIG_NODE
, &no_debug_bgp_as4_segment_cmd
);
2469 /* debug bgp neighbor-events A.B.C.D */
2470 install_element(ENABLE_NODE
, &debug_bgp_neighbor_events_peer_cmd
);
2471 install_element(CONFIG_NODE
, &debug_bgp_neighbor_events_peer_cmd
);
2472 install_element(ENABLE_NODE
, &no_debug_bgp_neighbor_events_peer_cmd
);
2473 install_element(CONFIG_NODE
, &no_debug_bgp_neighbor_events_peer_cmd
);
2475 /* debug bgp keepalive A.B.C.D */
2476 install_element(ENABLE_NODE
, &debug_bgp_keepalive_peer_cmd
);
2477 install_element(CONFIG_NODE
, &debug_bgp_keepalive_peer_cmd
);
2478 install_element(ENABLE_NODE
, &no_debug_bgp_keepalive_peer_cmd
);
2479 install_element(CONFIG_NODE
, &no_debug_bgp_keepalive_peer_cmd
);
2481 install_element(ENABLE_NODE
, &no_debug_bgp_neighbor_events_cmd
);
2482 install_element(CONFIG_NODE
, &no_debug_bgp_neighbor_events_cmd
);
2483 install_element(ENABLE_NODE
, &no_debug_bgp_nht_cmd
);
2484 install_element(CONFIG_NODE
, &no_debug_bgp_nht_cmd
);
2485 install_element(ENABLE_NODE
, &no_debug_bgp_keepalive_cmd
);
2486 install_element(CONFIG_NODE
, &no_debug_bgp_keepalive_cmd
);
2487 install_element(ENABLE_NODE
, &no_debug_bgp_update_cmd
);
2488 install_element(CONFIG_NODE
, &no_debug_bgp_update_cmd
);
2489 install_element(ENABLE_NODE
, &no_debug_bgp_zebra_cmd
);
2490 install_element(CONFIG_NODE
, &no_debug_bgp_zebra_cmd
);
2491 install_element(ENABLE_NODE
, &no_debug_bgp_allow_martians_cmd
);
2492 install_element(CONFIG_NODE
, &no_debug_bgp_allow_martians_cmd
);
2493 install_element(ENABLE_NODE
, &no_debug_bgp_update_groups_cmd
);
2494 install_element(CONFIG_NODE
, &no_debug_bgp_update_groups_cmd
);
2495 install_element(ENABLE_NODE
, &no_debug_bgp_cmd
);
2496 install_element(ENABLE_NODE
, &no_debug_bgp_bestpath_cmd
);
2497 install_element(CONFIG_NODE
, &no_debug_bgp_bestpath_cmd
);
2498 install_element(ENABLE_NODE
, &no_debug_bgp_bestpath_prefix_cmd
);
2499 install_element(CONFIG_NODE
, &no_debug_bgp_bestpath_prefix_cmd
);
2501 install_element(ENABLE_NODE
, &no_debug_bgp_graceful_restart_cmd
);
2502 install_element(CONFIG_NODE
, &no_debug_bgp_graceful_restart_cmd
);
2504 install_element(ENABLE_NODE
, &debug_bgp_vpn_cmd
);
2505 install_element(CONFIG_NODE
, &debug_bgp_vpn_cmd
);
2506 install_element(ENABLE_NODE
, &no_debug_bgp_vpn_cmd
);
2507 install_element(CONFIG_NODE
, &no_debug_bgp_vpn_cmd
);
2509 install_element(ENABLE_NODE
, &debug_bgp_labelpool_cmd
);
2510 install_element(CONFIG_NODE
, &debug_bgp_labelpool_cmd
);
2511 install_element(ENABLE_NODE
, &no_debug_bgp_labelpool_cmd
);
2512 install_element(CONFIG_NODE
, &no_debug_bgp_labelpool_cmd
);
2515 install_element(ENABLE_NODE
, &debug_bgp_pbr_cmd
);
2516 install_element(CONFIG_NODE
, &debug_bgp_pbr_cmd
);
2517 install_element(ENABLE_NODE
, &no_debug_bgp_pbr_cmd
);
2518 install_element(CONFIG_NODE
, &no_debug_bgp_pbr_cmd
);
2520 install_element(ENABLE_NODE
, &debug_bgp_evpn_mh_cmd
);
2521 install_element(CONFIG_NODE
, &debug_bgp_evpn_mh_cmd
);
2524 install_element(ENABLE_NODE
, &debug_bgp_bfd_cmd
);
2525 install_element(CONFIG_NODE
, &debug_bgp_bfd_cmd
);
2528 /* Return true if this prefix is on the per_prefix_list of prefixes to debug
2529 * for BGP_DEBUG_TYPE
2531 static int bgp_debug_per_prefix(const struct prefix
*p
,
2532 unsigned long term_bgp_debug_type
,
2533 unsigned int BGP_DEBUG_TYPE
,
2534 struct list
*per_prefix_list
)
2536 struct bgp_debug_filter
*filter
;
2537 struct listnode
*node
, *nnode
;
2539 if (term_bgp_debug_type
& BGP_DEBUG_TYPE
) {
2540 /* We are debugging all prefixes so return true */
2541 if (!per_prefix_list
|| list_isempty(per_prefix_list
))
2548 for (ALL_LIST_ELEMENTS(per_prefix_list
, node
, nnode
,
2550 if (filter
->p
->prefixlen
== p
->prefixlen
2551 && prefix_match(filter
->p
, p
))
2561 /* Return true if this peer is on the per_peer_list of peers to debug
2562 * for BGP_DEBUG_TYPE
2564 static int bgp_debug_per_peer(char *host
, unsigned long term_bgp_debug_type
,
2565 unsigned int BGP_DEBUG_TYPE
,
2566 struct list
*per_peer_list
)
2568 struct bgp_debug_filter
*filter
;
2569 struct listnode
*node
, *nnode
;
2571 if (term_bgp_debug_type
& BGP_DEBUG_TYPE
) {
2572 /* We are debugging all peers so return true */
2573 if (!per_peer_list
|| list_isempty(per_peer_list
))
2580 for (ALL_LIST_ELEMENTS(per_peer_list
, node
, nnode
,
2582 if (strcmp(filter
->host
, host
) == 0)
2592 int bgp_debug_neighbor_events(struct peer
*peer
)
2599 return bgp_debug_per_peer(host
, term_bgp_debug_neighbor_events
,
2600 BGP_DEBUG_NEIGHBOR_EVENTS
,
2601 bgp_debug_neighbor_events_peers
);
2604 int bgp_debug_keepalive(struct peer
*peer
)
2611 return bgp_debug_per_peer(host
, term_bgp_debug_keepalive
,
2612 BGP_DEBUG_KEEPALIVE
,
2613 bgp_debug_keepalive_peers
);
2616 bool bgp_debug_update(struct peer
*peer
, const struct prefix
*p
,
2617 struct update_group
*updgrp
, unsigned int inbound
)
2625 if (bgp_debug_per_peer(host
, term_bgp_debug_update
,
2626 BGP_DEBUG_UPDATE_IN
,
2627 bgp_debug_update_in_peers
))
2633 if (bgp_debug_per_peer(host
, term_bgp_debug_update
,
2634 BGP_DEBUG_UPDATE_OUT
,
2635 bgp_debug_update_out_peers
))
2638 /* Check if update debugging implicitly enabled for the group.
2640 if (updgrp
&& UPDGRP_DBG_ON(updgrp
))
2645 if (BGP_DEBUG(update
, UPDATE_PREFIX
)) {
2646 if (bgp_debug_per_prefix(p
, term_bgp_debug_update
,
2647 BGP_DEBUG_UPDATE_PREFIX
,
2648 bgp_debug_update_prefixes
))
2655 bool bgp_debug_bestpath(struct bgp_dest
*dest
)
2657 if (BGP_DEBUG(bestpath
, BESTPATH
)) {
2658 if (bgp_debug_per_prefix(
2659 bgp_dest_get_prefix(dest
), term_bgp_debug_bestpath
,
2660 BGP_DEBUG_BESTPATH
, bgp_debug_bestpath_prefixes
))
2667 bool bgp_debug_zebra(const struct prefix
*p
)
2669 if (BGP_DEBUG(zebra
, ZEBRA
)) {
2670 if (bgp_debug_per_prefix(p
, term_bgp_debug_zebra
,
2672 bgp_debug_zebra_prefixes
))
2679 const char *bgp_debug_rdpfxpath2str(afi_t afi
, safi_t safi
,
2680 const struct prefix_rd
*prd
,
2681 union prefixconstptr pu
,
2682 mpls_label_t
*label
, uint32_t num_labels
,
2683 int addpath_valid
, uint32_t addpath_id
,
2684 struct bgp_route_evpn
*overlay_index
,
2685 char *str
, int size
)
2687 char rd_buf
[RD_ADDRSTRLEN
];
2689 char overlay_index_buf
[INET6_ADDRSTRLEN
+ 14];
2690 const struct prefix_evpn
*evp
;
2692 /* ' with addpath ID ' 17
2693 * max strlen of uint32 + 10
2694 * +/- (just in case) + 1
2695 * null terminator + 1
2696 * ============================ 29 */
2697 char pathid_buf
[30];
2699 if (size
< BGP_PRD_PATH_STRLEN
)
2702 /* Note: Path-id is created by default, but only included in update
2704 pathid_buf
[0] = '\0';
2706 snprintf(pathid_buf
, sizeof(pathid_buf
), " with addpath ID %u",
2709 overlay_index_buf
[0] = '\0';
2710 if (overlay_index
&& overlay_index
->type
== OVERLAY_INDEX_GATEWAY_IP
) {
2711 char obuf
[INET6_ADDRSTRLEN
];
2715 if (is_evpn_prefix_ipaddr_v4(evp
))
2716 inet_ntop(AF_INET
, &overlay_index
->gw_ip
, obuf
,
2718 else if (is_evpn_prefix_ipaddr_v6(evp
))
2719 inet_ntop(AF_INET6
, &overlay_index
->gw_ip
, obuf
,
2722 snprintf(overlay_index_buf
, sizeof(overlay_index_buf
),
2723 " gateway IP %s", obuf
);
2727 if (bgp_labeled_safi(safi
) && num_labels
) {
2729 if (safi
== SAFI_EVPN
) {
2732 bgp_evpn_label2str(label
, num_labels
, tag_buf2
, 20);
2733 snprintf(tag_buf
, sizeof(tag_buf
), " label %s",
2736 uint32_t label_value
;
2738 label_value
= decode_label(label
);
2739 snprintf(tag_buf
, sizeof(tag_buf
), " label %u",
2745 snprintfrr(str
, size
, "RD %s %pFX%s%s%s %s %s",
2746 prefix_rd2str(prd
, rd_buf
, sizeof(rd_buf
)), pu
.p
,
2747 overlay_index_buf
, tag_buf
, pathid_buf
, afi2str(afi
),
2749 else if (safi
== SAFI_FLOWSPEC
) {
2750 char return_string
[BGP_FLOWSPEC_NLRI_STRING_MAX
];
2751 const struct prefix_fs
*fs
= pu
.fs
;
2753 bgp_fs_nlri_get_string((unsigned char *)fs
->prefix
.ptr
,
2754 fs
->prefix
.prefixlen
,
2756 NLRI_STRING_FORMAT_DEBUG
, NULL
,
2757 family2afi(fs
->prefix
.family
));
2758 snprintf(str
, size
, "FS %s Match{%s}", afi2str(afi
),
2761 snprintfrr(str
, size
, "%pFX%s%s %s %s", pu
.p
, tag_buf
,
2762 pathid_buf
, afi2str(afi
), safi2str(safi
));