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"
52 #include "bgpd/bgp_packet.h"
54 unsigned long conf_bgp_debug_as4
;
55 unsigned long conf_bgp_debug_neighbor_events
;
56 unsigned long conf_bgp_debug_events
;
57 unsigned long conf_bgp_debug_packet
;
58 unsigned long conf_bgp_debug_filter
;
59 unsigned long conf_bgp_debug_keepalive
;
60 unsigned long conf_bgp_debug_update
;
61 unsigned long conf_bgp_debug_bestpath
;
62 unsigned long conf_bgp_debug_zebra
;
63 unsigned long conf_bgp_debug_allow_martians
;
64 unsigned long conf_bgp_debug_nht
;
65 unsigned long conf_bgp_debug_update_groups
;
66 unsigned long conf_bgp_debug_vpn
;
67 unsigned long conf_bgp_debug_flowspec
;
68 unsigned long conf_bgp_debug_labelpool
;
69 unsigned long conf_bgp_debug_pbr
;
70 unsigned long conf_bgp_debug_graceful_restart
;
71 unsigned long conf_bgp_debug_evpn_mh
;
72 unsigned long conf_bgp_debug_bfd
;
74 unsigned long term_bgp_debug_as4
;
75 unsigned long term_bgp_debug_neighbor_events
;
76 unsigned long term_bgp_debug_events
;
77 unsigned long term_bgp_debug_packet
;
78 unsigned long term_bgp_debug_filter
;
79 unsigned long term_bgp_debug_keepalive
;
80 unsigned long term_bgp_debug_update
;
81 unsigned long term_bgp_debug_bestpath
;
82 unsigned long term_bgp_debug_zebra
;
83 unsigned long term_bgp_debug_allow_martians
;
84 unsigned long term_bgp_debug_nht
;
85 unsigned long term_bgp_debug_update_groups
;
86 unsigned long term_bgp_debug_vpn
;
87 unsigned long term_bgp_debug_flowspec
;
88 unsigned long term_bgp_debug_labelpool
;
89 unsigned long term_bgp_debug_pbr
;
90 unsigned long term_bgp_debug_graceful_restart
;
91 unsigned long term_bgp_debug_evpn_mh
;
92 unsigned long term_bgp_debug_bfd
;
94 struct list
*bgp_debug_neighbor_events_peers
= NULL
;
95 struct list
*bgp_debug_keepalive_peers
= NULL
;
96 struct list
*bgp_debug_update_out_peers
= NULL
;
97 struct list
*bgp_debug_update_in_peers
= NULL
;
98 struct list
*bgp_debug_update_prefixes
= NULL
;
99 struct list
*bgp_debug_bestpath_prefixes
= NULL
;
100 struct list
*bgp_debug_zebra_prefixes
= NULL
;
102 /* messages for BGP-4 status */
103 const struct message bgp_status_msg
[] = {{Idle
, "Idle"},
104 {Connect
, "Connect"},
106 {OpenSent
, "OpenSent"},
107 {OpenConfirm
, "OpenConfirm"},
108 {Established
, "Established"},
109 {Clearing
, "Clearing"},
110 {Deleted
, "Deleted"},
113 /* BGP message type string. */
114 const char *const bgp_type_str
[] = {NULL
, "OPEN", "UPDATE",
115 "NOTIFICATION", "KEEPALIVE", "ROUTE-REFRESH",
118 /* message for BGP-4 Notify */
119 static const struct message bgp_notify_msg
[] = {
120 {BGP_NOTIFY_HEADER_ERR
, "Message Header Error"},
121 {BGP_NOTIFY_OPEN_ERR
, "OPEN Message Error"},
122 {BGP_NOTIFY_UPDATE_ERR
, "UPDATE Message Error"},
123 {BGP_NOTIFY_HOLD_ERR
, "Hold Timer Expired"},
124 {BGP_NOTIFY_FSM_ERR
, "Neighbor Events Error"},
125 {BGP_NOTIFY_CEASE
, "Cease"},
126 {BGP_NOTIFY_ROUTE_REFRESH_ERR
, "ROUTE-REFRESH Message Error"},
129 static const struct message bgp_notify_head_msg
[] = {
130 {BGP_NOTIFY_HEADER_NOT_SYNC
, "/Connection Not Synchronized"},
131 {BGP_NOTIFY_HEADER_BAD_MESLEN
, "/Bad Message Length"},
132 {BGP_NOTIFY_HEADER_BAD_MESTYPE
, "/Bad Message Type"},
135 static const struct message bgp_notify_open_msg
[] = {
136 {BGP_NOTIFY_SUBCODE_UNSPECIFIC
, "/Unspecific"},
137 {BGP_NOTIFY_OPEN_UNSUP_VERSION
, "/Unsupported Version Number"},
138 {BGP_NOTIFY_OPEN_BAD_PEER_AS
, "/Bad Peer AS"},
139 {BGP_NOTIFY_OPEN_BAD_BGP_IDENT
, "/Bad BGP Identifier"},
140 {BGP_NOTIFY_OPEN_UNSUP_PARAM
, "/Unsupported Optional Parameter"},
141 {BGP_NOTIFY_OPEN_AUTH_FAILURE
, "/Authentication Failure"},
142 {BGP_NOTIFY_OPEN_UNACEP_HOLDTIME
, "/Unacceptable Hold Time"},
143 {BGP_NOTIFY_OPEN_UNSUP_CAPBL
, "/Unsupported Capability"},
146 static const struct message bgp_notify_update_msg
[] = {
147 {BGP_NOTIFY_SUBCODE_UNSPECIFIC
, "/Unspecific"},
148 {BGP_NOTIFY_UPDATE_MAL_ATTR
, "/Malformed Attribute List"},
149 {BGP_NOTIFY_UPDATE_UNREC_ATTR
, "/Unrecognized Well-known Attribute"},
150 {BGP_NOTIFY_UPDATE_MISS_ATTR
, "/Missing Well-known Attribute"},
151 {BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR
, "/Attribute Flags Error"},
152 {BGP_NOTIFY_UPDATE_ATTR_LENG_ERR
, "/Attribute Length Error"},
153 {BGP_NOTIFY_UPDATE_INVAL_ORIGIN
, "/Invalid ORIGIN Attribute"},
154 {BGP_NOTIFY_UPDATE_AS_ROUTE_LOOP
, "/AS Routing Loop"},
155 {BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP
, "/Invalid NEXT_HOP Attribute"},
156 {BGP_NOTIFY_UPDATE_OPT_ATTR_ERR
, "/Optional Attribute Error"},
157 {BGP_NOTIFY_UPDATE_INVAL_NETWORK
, "/Invalid Network Field"},
158 {BGP_NOTIFY_UPDATE_MAL_AS_PATH
, "/Malformed AS_PATH"},
161 static const struct message bgp_notify_cease_msg
[] = {
162 {BGP_NOTIFY_SUBCODE_UNSPECIFIC
, "/Unspecific"},
163 {BGP_NOTIFY_CEASE_MAX_PREFIX
, "/Maximum Number of Prefixes Reached"},
164 {BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
, "/Administrative Shutdown"},
165 {BGP_NOTIFY_CEASE_PEER_UNCONFIG
, "/Peer De-configured"},
166 {BGP_NOTIFY_CEASE_ADMIN_RESET
, "/Administrative Reset"},
167 {BGP_NOTIFY_CEASE_CONNECT_REJECT
, "/Connection Rejected"},
168 {BGP_NOTIFY_CEASE_CONFIG_CHANGE
, "/Other Configuration Change"},
169 {BGP_NOTIFY_CEASE_COLLISION_RESOLUTION
,
170 "/Connection Collision Resolution"},
171 {BGP_NOTIFY_CEASE_OUT_OF_RESOURCE
, "/Out of Resources"},
172 {BGP_NOTIFY_CEASE_HARD_RESET
, "/Hard Reset"},
173 {BGP_NOTIFY_CEASE_BFD_DOWN
, "/BFD Down"},
176 static const struct message bgp_notify_route_refresh_msg
[] = {
177 {BGP_NOTIFY_SUBCODE_UNSPECIFIC
, "/Unspecific"},
178 {BGP_NOTIFY_ROUTE_REFRESH_INVALID_MSG_LEN
, "/Invalid Message Length"},
181 static const struct message bgp_notify_fsm_msg
[] = {
182 {BGP_NOTIFY_FSM_ERR_SUBCODE_UNSPECIFIC
, "/Unspecific"},
183 {BGP_NOTIFY_FSM_ERR_SUBCODE_OPENSENT
,
184 "/Receive Unexpected Message in OpenSent State"},
185 {BGP_NOTIFY_FSM_ERR_SUBCODE_OPENCONFIRM
,
186 "/Receive Unexpected Message in OpenConfirm State"},
187 {BGP_NOTIFY_FSM_ERR_SUBCODE_ESTABLISHED
,
188 "/Receive Unexpected Message in Established State"},
191 /* Origin strings. */
192 const char *const bgp_origin_str
[] = {"i", "e", "?"};
193 const char *const bgp_origin_long_str
[] = {"IGP", "EGP", "incomplete"};
195 static void bgp_debug_print_evpn_prefix(struct vty
*vty
, const char *desc
,
197 /* Given a string return a pointer the corresponding peer structure */
198 static struct peer
*bgp_find_peer(struct vty
*vty
, const char *peer_str
)
200 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
208 ret
= str2sockunion(peer_str
, &su
);
212 peer
= peer_lookup_by_conf_if(bgp
, peer_str
);
215 peer
= peer_lookup_by_hostname(bgp
, peer_str
);
219 return peer_lookup(bgp
, &su
);
222 static void bgp_debug_list_free(struct list
*list
)
224 struct bgp_debug_filter
*filter
;
225 struct listnode
*node
, *nnode
;
228 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
229 listnode_delete(list
, filter
);
230 prefix_free(&filter
->p
);
231 XFREE(MTYPE_BGP_DEBUG_STR
, filter
->host
);
232 XFREE(MTYPE_BGP_DEBUG_FILTER
, filter
);
237 * Print the desc along with a list of peers/prefixes this debug is
240 static void bgp_debug_list_print(struct vty
*vty
, const char *desc
,
243 struct bgp_debug_filter
*filter
;
244 struct listnode
*node
, *nnode
;
246 vty_out(vty
, "%s", desc
);
248 if (list
&& !list_isempty(list
)) {
249 vty_out(vty
, " for");
250 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
252 vty_out(vty
, " %s", filter
->host
);
254 if (filter
->p
&& filter
->p
->family
== AF_EVPN
)
255 bgp_debug_print_evpn_prefix(vty
, "", filter
->p
);
257 vty_out(vty
, " %pFX", filter
->p
);
265 * Print the command to enable the debug for each peer/prefix this debug is
268 static int bgp_debug_list_conf_print(struct vty
*vty
, const char *desc
,
271 struct bgp_debug_filter
*filter
;
272 struct listnode
*node
, *nnode
;
275 if (list
&& !list_isempty(list
)) {
276 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
278 vty_out(vty
, "%s %s\n", desc
, filter
->host
);
282 if (filter
->p
&& filter
->p
->family
== AF_EVPN
) {
283 bgp_debug_print_evpn_prefix(vty
, desc
,
286 } else if (filter
->p
) {
287 vty_out(vty
, "%s %pFX\n", desc
, filter
->p
);
294 vty_out(vty
, "%s\n", desc
);
301 static void bgp_debug_list_add_entry(struct list
*list
, const char *host
,
302 const struct prefix
*p
)
304 struct bgp_debug_filter
*filter
;
306 filter
= XCALLOC(MTYPE_BGP_DEBUG_FILTER
,
307 sizeof(struct bgp_debug_filter
));
310 filter
->host
= XSTRDUP(MTYPE_BGP_DEBUG_STR
, host
);
314 filter
->p
= prefix_new();
315 prefix_copy(filter
->p
, p
);
318 listnode_add(list
, filter
);
321 static bool bgp_debug_list_remove_entry(struct list
*list
, const char *host
,
324 struct bgp_debug_filter
*filter
;
325 struct listnode
*node
, *nnode
;
327 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
328 if (host
&& strcmp(filter
->host
, host
) == 0) {
329 listnode_delete(list
, filter
);
330 XFREE(MTYPE_BGP_DEBUG_STR
, filter
->host
);
331 XFREE(MTYPE_BGP_DEBUG_FILTER
, filter
);
333 } else if (p
&& filter
->p
->prefixlen
== p
->prefixlen
334 && prefix_match(filter
->p
, p
)) {
335 listnode_delete(list
, filter
);
336 prefix_free(&filter
->p
);
337 XFREE(MTYPE_BGP_DEBUG_FILTER
, filter
);
345 static bool bgp_debug_list_has_entry(struct list
*list
, const char *host
,
346 const struct prefix
*p
)
348 struct bgp_debug_filter
*filter
;
349 struct listnode
*node
, *nnode
;
351 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
353 if (strcmp(filter
->host
, host
) == 0) {
357 if (filter
->p
->prefixlen
== p
->prefixlen
358 && prefix_match(filter
->p
, p
)) {
367 bool bgp_debug_peer_updout_enabled(char *host
)
369 return (bgp_debug_list_has_entry(bgp_debug_update_out_peers
, host
,
373 /* Dump attribute. */
374 bool bgp_dump_attr(struct attr
*attr
, char *buf
, size_t size
)
376 char addrbuf
[BUFSIZ
];
383 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP
)))
384 snprintfrr(buf
, size
, "nexthop %pI4", &attr
->nexthop
);
386 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_ORIGIN
)))
387 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), ", origin %s",
388 bgp_origin_str
[attr
->origin
]);
391 if (attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL
392 || attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL
)
393 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
395 inet_ntop(AF_INET6
, &attr
->mp_nexthop_global
, addrbuf
,
398 if (attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL
)
399 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), "(%s)",
400 inet_ntop(AF_INET6
, &attr
->mp_nexthop_local
, addrbuf
,
403 if (attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV4
)
404 snprintfrr(buf
, size
, "nexthop %pI4", &attr
->nexthop
);
406 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
)))
407 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
408 ", localpref %u", attr
->local_pref
);
410 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
)))
411 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), ", metric %u",
414 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES
)))
415 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
417 community_str(bgp_attr_get_community(attr
), false,
420 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES
)))
421 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
422 ", large-community %s",
423 lcommunity_str(bgp_attr_get_lcommunity(attr
), false,
426 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
)))
427 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
429 ecommunity_str(bgp_attr_get_ecommunity(attr
)));
431 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
)))
432 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
433 ", atomic-aggregate");
435 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR
)))
436 snprintfrr(buf
+ strlen(buf
), size
- strlen(buf
),
437 ", aggregated by %u %pI4", attr
->aggregator_as
,
438 &attr
->aggregator_addr
);
440 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)))
441 snprintfrr(buf
+ strlen(buf
), size
- strlen(buf
),
442 ", originator %pI4", &attr
->originator_id
);
444 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))) {
445 struct cluster_list
*cluster
;
448 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
451 cluster
= bgp_attr_get_cluster(attr
);
452 for (i
= 0; i
< cluster
->length
/ 4; i
++)
453 snprintfrr(buf
+ strlen(buf
), size
- strlen(buf
),
454 " %pI4", &cluster
->list
[i
]);
457 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL
)))
458 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
459 ", pmsi tnltype %u", bgp_attr_get_pmsi_tnl_type(attr
));
461 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_AS_PATH
)))
462 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), ", path %s",
463 aspath_print(attr
->aspath
));
465 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID
))) {
466 if (attr
->label_index
!= BGP_INVALID_LABEL_INDEX
)
467 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
468 ", label-index %u", attr
->label_index
);
477 const char *bgp_notify_code_str(char code
)
479 return lookup_msg(bgp_notify_msg
, code
, "Unrecognized Error Code");
482 const char *bgp_notify_subcode_str(char code
, char subcode
)
486 case BGP_NOTIFY_HEADER_ERR
:
487 return lookup_msg(bgp_notify_head_msg
, subcode
,
488 "Unrecognized Error Subcode");
489 case BGP_NOTIFY_OPEN_ERR
:
490 return lookup_msg(bgp_notify_open_msg
, subcode
,
491 "Unrecognized Error Subcode");
492 case BGP_NOTIFY_UPDATE_ERR
:
493 return lookup_msg(bgp_notify_update_msg
, subcode
,
494 "Unrecognized Error Subcode");
495 case BGP_NOTIFY_HOLD_ERR
:
497 case BGP_NOTIFY_FSM_ERR
:
498 return lookup_msg(bgp_notify_fsm_msg
, subcode
,
499 "Unrecognized Error Subcode");
500 case BGP_NOTIFY_CEASE
:
501 return lookup_msg(bgp_notify_cease_msg
, subcode
,
502 "Unrecognized Error Subcode");
503 case BGP_NOTIFY_ROUTE_REFRESH_ERR
:
504 return lookup_msg(bgp_notify_route_refresh_msg
, subcode
,
505 "Unrecognized Error Subcode");
510 /* extract notify admin reason if correctly present */
511 const char *bgp_notify_admin_message(char *buf
, size_t bufsz
, uint8_t *data
,
514 if (!data
|| datalen
< 1)
517 uint8_t len
= data
[0];
518 if (!len
|| len
> datalen
- 1)
521 return zlog_sanitize(buf
, bufsz
, data
+ 1, len
);
524 /* dump notify packet */
525 void bgp_notify_print(struct peer
*peer
, struct bgp_notify
*bgp_notify
,
526 const char *direct
, bool hard_reset
)
528 const char *subcode_str
;
529 const char *code_str
;
530 const char *msg_str
= NULL
;
533 if (BGP_DEBUG(neighbor_events
, NEIGHBOR_EVENTS
)
534 || CHECK_FLAG(peer
->bgp
->flags
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
)) {
535 code_str
= bgp_notify_code_str(bgp_notify
->code
);
536 subcode_str
= bgp_notify_subcode_str(bgp_notify
->code
,
537 bgp_notify
->subcode
);
539 if (bgp_notify
->code
== BGP_NOTIFY_CEASE
540 && (bgp_notify
->subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
541 || bgp_notify
->subcode
542 == BGP_NOTIFY_CEASE_ADMIN_RESET
)) {
543 msg_str
= bgp_notify_admin_message(
544 msg_buf
, sizeof(msg_buf
), bgp_notify
->raw_data
,
550 "%%NOTIFICATION%s: %s neighbor %s %d/%d (%s%s) \"%s\"",
551 hard_reset
? "(Hard Reset)" : "",
552 strcmp(direct
, "received") == 0
555 peer
->host
, bgp_notify
->code
,
556 bgp_notify
->subcode
, code_str
, subcode_str
,
559 msg_str
= bgp_notify
->data
? bgp_notify
->data
: "";
561 "%%NOTIFICATION%s: %s neighbor %s %d/%d (%s%s) %d bytes %s",
562 hard_reset
? "(Hard Reset)" : "",
563 strcmp(direct
, "received") == 0
566 peer
->host
, bgp_notify
->code
,
567 bgp_notify
->subcode
, code_str
, subcode_str
,
568 bgp_notify
->length
, msg_str
);
573 static void bgp_debug_clear_updgrp_update_dbg(struct bgp
*bgp
)
576 bgp
= bgp_get_default();
577 update_group_walk(bgp
, update_group_clear_update_dbg
, NULL
);
580 static void bgp_debug_print_evpn_prefix(struct vty
*vty
, const char *desc
,
583 char evpn_desc
[PREFIX2STR_BUFFER
+ INET_ADDRSTRLEN
];
584 char buf
[PREFIX2STR_BUFFER
];
585 char buf2
[ETHER_ADDR_STRLEN
];
587 if (p
->u
.prefix_evpn
.route_type
== BGP_EVPN_MAC_IP_ROUTE
) {
588 if (is_evpn_prefix_ipaddr_none((struct prefix_evpn
*)p
)) {
590 evpn_desc
, sizeof(evpn_desc
),
591 "l2vpn evpn type macip mac %s",
592 prefix_mac2str(&p
->u
.prefix_evpn
.macip_addr
.mac
,
593 buf2
, sizeof(buf2
)));
595 uint8_t family
= is_evpn_prefix_ipaddr_v4(
596 (struct prefix_evpn
*)p
) ?
599 evpn_desc
, sizeof(evpn_desc
),
600 "l2vpn evpn type macip mac %s ip %s",
601 prefix_mac2str(&p
->u
.prefix_evpn
.macip_addr
.mac
,
605 &p
->u
.prefix_evpn
.macip_addr
.ip
.ip
.addr
,
606 buf
, PREFIX2STR_BUFFER
));
608 } else if (p
->u
.prefix_evpn
.route_type
== BGP_EVPN_IMET_ROUTE
) {
609 snprintfrr(evpn_desc
, sizeof(evpn_desc
),
610 "l2vpn evpn type multicast ip %pI4",
611 &p
->u
.prefix_evpn
.imet_addr
.ip
.ipaddr_v4
);
612 } else if (p
->u
.prefix_evpn
.route_type
== BGP_EVPN_IP_PREFIX_ROUTE
) {
613 uint8_t family
= is_evpn_prefix_ipaddr_v4(
614 (struct prefix_evpn
*)p
) ? AF_INET
616 snprintf(evpn_desc
, sizeof(evpn_desc
),
617 "l2vpn evpn type prefix ip %s/%d",
619 &p
->u
.prefix_evpn
.prefix_addr
.ip
.ip
.addr
,
620 buf
, PREFIX2STR_BUFFER
),
621 p
->u
.prefix_evpn
.prefix_addr
.ip_prefix_length
);
624 vty_out(vty
, "%s %s\n", desc
, evpn_desc
);
627 static int bgp_debug_parse_evpn_prefix(struct vty
*vty
, struct cmd_token
**argv
,
628 int argc
, struct prefix
**argv_pp
)
630 struct prefix
*argv_p
;
631 struct ethaddr mac
= {};
632 struct ipaddr ip
= {};
639 if (bgp_evpn_cli_parse_type(&evpn_type
, argv
, argc
) < 0)
642 if (evpn_type
== BGP_EVPN_MAC_IP_ROUTE
) {
643 memset(&ip
, 0, sizeof(ip
));
645 if (argv_find(argv
, argc
, "mac", &mac_idx
))
646 if (!prefix_str2mac(argv
[mac_idx
+ 1]->arg
, &mac
)) {
647 vty_out(vty
, "%% Malformed MAC address\n");
651 if (argv_find(argv
, argc
, "ip", &ip_idx
))
652 if (str2ipaddr(argv
[ip_idx
+ 1]->arg
, &ip
) != 0) {
653 vty_out(vty
, "%% Malformed IP address\n");
657 build_evpn_type2_prefix((struct prefix_evpn
*)argv_p
,
659 } else if (evpn_type
== BGP_EVPN_IMET_ROUTE
) {
660 memset(&ip
, 0, sizeof(ip
));
662 if (argv_find(argv
, argc
, "ip", &ip_idx
))
663 if (str2ipaddr(argv
[ip_idx
+ 1]->arg
, &ip
) != 0) {
664 vty_out(vty
, "%% Malformed IP address\n");
668 build_evpn_type3_prefix((struct prefix_evpn
*)argv_p
,
670 } else if (evpn_type
== BGP_EVPN_IP_PREFIX_ROUTE
) {
671 struct prefix ip_prefix
;
673 memset(&ip_prefix
, 0, sizeof(ip_prefix
));
674 if (argv_find(argv
, argc
, "ip", &ip_idx
)) {
675 (void)str2prefix(argv
[ip_idx
+ 1]->arg
, &ip_prefix
);
676 apply_mask(&ip_prefix
);
678 build_type5_prefix_from_ip_prefix(
679 (struct prefix_evpn
*)argv_p
,
686 /* Debug option setting interface. */
687 unsigned long bgp_debug_option
= 0;
689 int debug(unsigned int option
)
691 return bgp_debug_option
& option
;
694 DEFUN (debug_bgp_as4
,
701 if (vty
->node
== CONFIG_NODE
)
704 TERM_DEBUG_ON(as4
, AS4
);
705 vty_out(vty
, "BGP as4 debugging is on\n");
710 DEFUN (no_debug_bgp_as4
,
711 no_debug_bgp_as4_cmd
,
718 if (vty
->node
== CONFIG_NODE
)
721 TERM_DEBUG_OFF(as4
, AS4
);
722 vty_out(vty
, "BGP as4 debugging is off\n");
727 DEFUN (debug_bgp_as4_segment
,
728 debug_bgp_as4_segment_cmd
,
729 "debug bgp as4 segment",
733 "BGP AS4 aspath segment handling\n")
735 if (vty
->node
== CONFIG_NODE
)
736 DEBUG_ON(as4
, AS4_SEGMENT
);
738 TERM_DEBUG_ON(as4
, AS4_SEGMENT
);
739 vty_out(vty
, "BGP as4 segment debugging is on\n");
744 DEFUN (no_debug_bgp_as4_segment
,
745 no_debug_bgp_as4_segment_cmd
,
746 "no debug bgp as4 segment",
751 "BGP AS4 aspath segment handling\n")
753 if (vty
->node
== CONFIG_NODE
)
754 DEBUG_OFF(as4
, AS4_SEGMENT
);
756 TERM_DEBUG_OFF(as4
, AS4_SEGMENT
);
757 vty_out(vty
, "BGP as4 segment debugging is off\n");
762 /* debug bgp neighbor_events */
763 DEFUN (debug_bgp_neighbor_events
,
764 debug_bgp_neighbor_events_cmd
,
765 "debug bgp neighbor-events",
768 "BGP Neighbor Events\n")
770 bgp_debug_list_free(bgp_debug_neighbor_events_peers
);
772 if (vty
->node
== CONFIG_NODE
)
773 DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
775 TERM_DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
776 vty_out(vty
, "BGP neighbor-events debugging is on\n");
781 DEFUN (debug_bgp_neighbor_events_peer
,
782 debug_bgp_neighbor_events_peer_cmd
,
783 "debug bgp neighbor-events <A.B.C.D|X:X::X:X|WORD>",
786 "BGP Neighbor Events\n"
787 "BGP neighbor IP address to debug\n"
788 "BGP IPv6 neighbor to debug\n"
789 "BGP neighbor on interface to debug\n")
792 const char *host
= argv
[idx_peer
]->arg
;
794 if (!bgp_debug_neighbor_events_peers
)
795 bgp_debug_neighbor_events_peers
= list_new();
797 if (bgp_debug_list_has_entry(bgp_debug_neighbor_events_peers
, host
,
800 "BGP neighbor-events debugging is already enabled for %s\n",
805 bgp_debug_list_add_entry(bgp_debug_neighbor_events_peers
, host
, NULL
);
807 if (vty
->node
== CONFIG_NODE
)
808 DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
810 TERM_DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
811 vty_out(vty
, "BGP neighbor-events debugging is on for %s\n",
817 DEFUN (no_debug_bgp_neighbor_events
,
818 no_debug_bgp_neighbor_events_cmd
,
819 "no debug bgp neighbor-events",
825 bgp_debug_list_free(bgp_debug_neighbor_events_peers
);
827 if (vty
->node
== CONFIG_NODE
)
828 DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
830 TERM_DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
831 vty_out(vty
, "BGP neighbor-events debugging is off\n");
836 DEFUN (no_debug_bgp_neighbor_events_peer
,
837 no_debug_bgp_neighbor_events_peer_cmd
,
838 "no debug bgp neighbor-events <A.B.C.D|X:X::X:X|WORD>",
843 "BGP neighbor IP address to debug\n"
844 "BGP IPv6 neighbor to debug\n"
845 "BGP neighbor on interface to debug\n")
849 const char *host
= argv
[idx_peer
]->arg
;
851 if (bgp_debug_neighbor_events_peers
852 && !list_isempty(bgp_debug_neighbor_events_peers
)) {
853 found_peer
= bgp_debug_list_remove_entry(
854 bgp_debug_neighbor_events_peers
, host
, NULL
);
856 if (list_isempty(bgp_debug_neighbor_events_peers
)) {
857 if (vty
->node
== CONFIG_NODE
)
858 DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
860 TERM_DEBUG_OFF(neighbor_events
,
866 vty_out(vty
, "BGP neighbor-events debugging is off for %s\n",
870 "BGP neighbor-events debugging was not enabled for %s\n",
877 DEFUN (debug_bgp_nht
,
882 "BGP nexthop tracking events\n")
884 if (vty
->node
== CONFIG_NODE
)
887 TERM_DEBUG_ON(nht
, NHT
);
888 vty_out(vty
, "BGP nexthop tracking debugging is on\n");
893 DEFUN (no_debug_bgp_nht
,
894 no_debug_bgp_nht_cmd
,
899 "BGP nexthop tracking events\n")
901 if (vty
->node
== CONFIG_NODE
)
904 TERM_DEBUG_OFF(nht
, NHT
);
905 vty_out(vty
, "BGP nexthop tracking debugging is off\n");
910 /* debug bgp keepalives */
911 DEFUN (debug_bgp_keepalive
,
912 debug_bgp_keepalive_cmd
,
913 "debug bgp keepalives",
918 bgp_debug_list_free(bgp_debug_keepalive_peers
);
920 if (vty
->node
== CONFIG_NODE
)
921 DEBUG_ON(keepalive
, KEEPALIVE
);
923 TERM_DEBUG_ON(keepalive
, KEEPALIVE
);
924 vty_out(vty
, "BGP keepalives debugging is on\n");
929 DEFUN (debug_bgp_keepalive_peer
,
930 debug_bgp_keepalive_peer_cmd
,
931 "debug bgp keepalives <A.B.C.D|X:X::X:X|WORD>",
935 "BGP IPv4 neighbor to debug\n"
936 "BGP IPv6 neighbor to debug\n"
937 "BGP neighbor on interface to debug\n")
940 const char *host
= argv
[idx_peer
]->arg
;
942 if (!bgp_debug_keepalive_peers
)
943 bgp_debug_keepalive_peers
= list_new();
945 if (bgp_debug_list_has_entry(bgp_debug_keepalive_peers
, host
, NULL
)) {
947 "BGP keepalive debugging is already enabled for %s\n",
952 bgp_debug_list_add_entry(bgp_debug_keepalive_peers
, host
, NULL
);
954 if (vty
->node
== CONFIG_NODE
)
955 DEBUG_ON(keepalive
, KEEPALIVE
);
957 TERM_DEBUG_ON(keepalive
, KEEPALIVE
);
958 vty_out(vty
, "BGP keepalives debugging is on for %s\n", host
);
963 DEFUN (no_debug_bgp_keepalive
,
964 no_debug_bgp_keepalive_cmd
,
965 "no debug bgp keepalives",
971 bgp_debug_list_free(bgp_debug_keepalive_peers
);
973 if (vty
->node
== CONFIG_NODE
)
974 DEBUG_OFF(keepalive
, KEEPALIVE
);
976 TERM_DEBUG_OFF(keepalive
, KEEPALIVE
);
977 vty_out(vty
, "BGP keepalives debugging is off\n");
982 DEFUN (no_debug_bgp_keepalive_peer
,
983 no_debug_bgp_keepalive_peer_cmd
,
984 "no debug bgp keepalives <A.B.C.D|X:X::X:X|WORD>",
989 "BGP neighbor IP address to debug\n"
990 "BGP IPv6 neighbor to debug\n"
991 "BGP neighbor on interface to debug\n")
995 const char *host
= argv
[idx_peer
]->arg
;
997 if (bgp_debug_keepalive_peers
998 && !list_isempty(bgp_debug_keepalive_peers
)) {
999 found_peer
= bgp_debug_list_remove_entry(
1000 bgp_debug_keepalive_peers
, host
, NULL
);
1002 if (list_isempty(bgp_debug_keepalive_peers
)) {
1003 if (vty
->node
== CONFIG_NODE
)
1004 DEBUG_OFF(keepalive
, KEEPALIVE
);
1006 TERM_DEBUG_OFF(keepalive
, KEEPALIVE
);
1011 vty_out(vty
, "BGP keepalives debugging is off for %s\n", host
);
1014 "BGP keepalives debugging was not enabled for %s\n",
1020 /* debug bgp bestpath */
1021 DEFUN (debug_bgp_bestpath_prefix
,
1022 debug_bgp_bestpath_prefix_cmd
,
1023 "debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
1030 struct prefix
*argv_p
;
1031 int idx_ipv4_ipv6_prefixlen
= 3;
1033 argv_p
= prefix_new();
1034 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1037 if (!bgp_debug_bestpath_prefixes
)
1038 bgp_debug_bestpath_prefixes
= list_new();
1040 if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes
, NULL
,
1043 "BGP bestpath debugging is already enabled for %s\n",
1044 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1048 bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes
, NULL
, argv_p
);
1050 if (vty
->node
== CONFIG_NODE
) {
1051 DEBUG_ON(bestpath
, BESTPATH
);
1053 TERM_DEBUG_ON(bestpath
, BESTPATH
);
1054 vty_out(vty
, "BGP bestpath debugging is on for %s\n",
1055 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1061 DEFUN (no_debug_bgp_bestpath_prefix
,
1062 no_debug_bgp_bestpath_prefix_cmd
,
1063 "no debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
1071 int idx_ipv4_ipv6_prefixlen
= 4;
1072 struct prefix
*argv_p
;
1073 int found_prefix
= 0;
1075 argv_p
= prefix_new();
1076 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1079 if (bgp_debug_bestpath_prefixes
1080 && !list_isempty(bgp_debug_bestpath_prefixes
)) {
1081 found_prefix
= bgp_debug_list_remove_entry(
1082 bgp_debug_bestpath_prefixes
, NULL
, argv_p
);
1084 if (list_isempty(bgp_debug_bestpath_prefixes
)) {
1085 if (vty
->node
== CONFIG_NODE
) {
1086 DEBUG_OFF(bestpath
, BESTPATH
);
1088 TERM_DEBUG_OFF(bestpath
, BESTPATH
);
1090 "BGP bestpath debugging (per prefix) is off\n");
1096 vty_out(vty
, "BGP bestpath debugging is off for %s\n",
1097 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1099 vty_out(vty
, "BGP bestpath debugging was not enabled for %s\n",
1100 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1105 DEFUN (no_debug_bgp_bestpath
,
1106 no_debug_bgp_bestpath_cmd
,
1107 "no debug bgp bestpath",
1113 bgp_debug_list_free(bgp_debug_bestpath_prefixes
);
1115 if (vty
->node
== CONFIG_NODE
)
1116 DEBUG_OFF(bestpath
, BESTPATH
);
1118 TERM_DEBUG_OFF(bestpath
, BESTPATH
);
1119 vty_out(vty
, "BGP bestpath debugging is off\n");
1124 /* debug bgp updates */
1125 DEFUN (debug_bgp_update
,
1126 debug_bgp_update_cmd
,
1127 "debug bgp updates",
1132 bgp_debug_list_free(bgp_debug_update_in_peers
);
1133 bgp_debug_list_free(bgp_debug_update_out_peers
);
1134 bgp_debug_list_free(bgp_debug_update_prefixes
);
1136 if (vty
->node
== CONFIG_NODE
) {
1137 DEBUG_ON(update
, UPDATE_IN
);
1138 DEBUG_ON(update
, UPDATE_OUT
);
1140 TERM_DEBUG_ON(update
, UPDATE_IN
);
1141 TERM_DEBUG_ON(update
, UPDATE_OUT
);
1142 vty_out(vty
, "BGP updates debugging is on\n");
1147 DEFUN (debug_bgp_update_direct
,
1148 debug_bgp_update_direct_cmd
,
1149 "debug bgp updates <in|out>",
1154 "Outbound updates\n")
1158 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1159 bgp_debug_list_free(bgp_debug_update_in_peers
);
1161 bgp_debug_list_free(bgp_debug_update_out_peers
);
1163 if (vty
->node
== CONFIG_NODE
) {
1164 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1165 DEBUG_ON(update
, UPDATE_IN
);
1167 DEBUG_ON(update
, UPDATE_OUT
);
1169 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0) {
1170 TERM_DEBUG_ON(update
, UPDATE_IN
);
1171 vty_out(vty
, "BGP updates debugging is on (inbound)\n");
1173 TERM_DEBUG_ON(update
, UPDATE_OUT
);
1175 "BGP updates debugging is on (outbound)\n");
1181 DEFUN (debug_bgp_update_direct_peer
,
1182 debug_bgp_update_direct_peer_cmd
,
1183 "debug bgp updates <in|out> <A.B.C.D|X:X::X:X|WORD>",
1188 "Outbound updates\n"
1189 "BGP neighbor IP address to debug\n"
1190 "BGP IPv6 neighbor to debug\n"
1191 "BGP neighbor on interface to debug\n")
1195 const char *host
= argv
[idx_peer
]->arg
;
1198 if (!bgp_debug_update_in_peers
)
1199 bgp_debug_update_in_peers
= list_new();
1201 if (!bgp_debug_update_out_peers
)
1202 bgp_debug_update_out_peers
= list_new();
1204 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1210 if (bgp_debug_list_has_entry(bgp_debug_update_in_peers
, host
,
1213 "BGP inbound update debugging is already enabled for %s\n",
1220 if (bgp_debug_list_has_entry(bgp_debug_update_out_peers
, host
,
1223 "BGP outbound update debugging is already enabled for %s\n",
1230 bgp_debug_list_add_entry(bgp_debug_update_in_peers
, host
, NULL
);
1233 struct peer_af
*paf
;
1236 bgp_debug_list_add_entry(bgp_debug_update_out_peers
, host
,
1238 peer
= bgp_find_peer(vty
, host
);
1241 for (afidx
= BGP_AF_START
; afidx
< BGP_AF_MAX
;
1243 paf
= peer
->peer_af_array
[afidx
];
1245 if (PAF_SUBGRP(paf
)) {
1255 if (vty
->node
== CONFIG_NODE
) {
1257 DEBUG_ON(update
, UPDATE_IN
);
1259 DEBUG_ON(update
, UPDATE_OUT
);
1262 TERM_DEBUG_ON(update
, UPDATE_IN
);
1264 "BGP updates debugging is on (inbound) for %s\n",
1265 argv
[idx_peer
]->arg
);
1267 TERM_DEBUG_ON(update
, UPDATE_OUT
);
1269 "BGP updates debugging is on (outbound) for %s\n",
1270 argv
[idx_peer
]->arg
);
1276 DEFUN (no_debug_bgp_update_direct
,
1277 no_debug_bgp_update_direct_cmd
,
1278 "no debug bgp updates <in|out>",
1284 "Outbound updates\n")
1287 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0) {
1288 bgp_debug_list_free(bgp_debug_update_in_peers
);
1290 if (vty
->node
== CONFIG_NODE
) {
1291 DEBUG_OFF(update
, UPDATE_IN
);
1293 TERM_DEBUG_OFF(update
, UPDATE_IN
);
1295 "BGP updates debugging is off (inbound)\n");
1298 bgp_debug_list_free(bgp_debug_update_out_peers
);
1300 if (vty
->node
== CONFIG_NODE
) {
1301 DEBUG_OFF(update
, UPDATE_OUT
);
1303 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
1305 "BGP updates debugging is off (outbound)\n");
1312 DEFUN (no_debug_bgp_update_direct_peer
,
1313 no_debug_bgp_update_direct_peer_cmd
,
1314 "no debug bgp updates <in|out> <A.B.C.D|X:X::X:X|WORD>",
1320 "Outbound updates\n"
1321 "BGP neighbor IP address to debug\n"
1322 "BGP IPv6 neighbor to debug\n"
1323 "BGP neighbor on interface to debug\n")
1329 const char *host
= argv
[idx_peer
]->arg
;
1331 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1336 if (inbound
&& bgp_debug_update_in_peers
1337 && !list_isempty(bgp_debug_update_in_peers
)) {
1338 found_peer
= bgp_debug_list_remove_entry(
1339 bgp_debug_update_in_peers
, host
, NULL
);
1341 if (list_isempty(bgp_debug_update_in_peers
)) {
1342 if (vty
->node
== CONFIG_NODE
)
1343 DEBUG_OFF(update
, UPDATE_IN
);
1345 TERM_DEBUG_OFF(update
, UPDATE_IN
);
1347 "BGP updates debugging (inbound) is off\n");
1352 if (!inbound
&& bgp_debug_update_out_peers
1353 && !list_isempty(bgp_debug_update_out_peers
)) {
1354 found_peer
= bgp_debug_list_remove_entry(
1355 bgp_debug_update_out_peers
, host
, NULL
);
1357 if (list_isempty(bgp_debug_update_out_peers
)) {
1358 if (vty
->node
== CONFIG_NODE
)
1359 DEBUG_OFF(update
, UPDATE_OUT
);
1361 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
1363 "BGP updates debugging (outbound) is off\n");
1368 struct peer_af
*paf
;
1370 peer
= bgp_find_peer(vty
, host
);
1373 for (afidx
= BGP_AF_START
; afidx
< BGP_AF_MAX
;
1375 paf
= peer
->peer_af_array
[afidx
];
1377 if (PAF_SUBGRP(paf
)) {
1378 UPDGRP_PEER_DBG_DIS(
1390 "BGP updates debugging (inbound) is off for %s\n",
1394 "BGP updates debugging (outbound) is off for %s\n",
1398 "BGP updates debugging (inbound) was not enabled for %s\n",
1402 "BGP updates debugging (outbound) was not enabled for %s\n",
1408 #ifndef VTYSH_EXTRACT_PL
1409 #include "bgpd/bgp_debug_clippy.c"
1412 DEFPY (debug_bgp_update_prefix_afi_safi
,
1413 debug_bgp_update_prefix_afi_safi_cmd
,
1414 "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>>",
1418 "Specify a prefix to debug\n"
1422 EVPN_TYPE_2_HELP_STR
1423 EVPN_TYPE_2_HELP_STR
1424 MAC_STR MAC_STR MAC_STR
1428 EVPN_TYPE_3_HELP_STR
1429 EVPN_TYPE_3_HELP_STR
1433 EVPN_TYPE_5_HELP_STR
1434 EVPN_TYPE_5_HELP_STR
1439 struct prefix
*argv_p
;
1440 int ret
= CMD_SUCCESS
;
1442 argv_p
= prefix_new();
1444 ret
= bgp_debug_parse_evpn_prefix(vty
, argv
, argc
, &argv_p
);
1445 if (ret
!= CMD_SUCCESS
) {
1446 prefix_free(&argv_p
);
1450 if (!bgp_debug_update_prefixes
)
1451 bgp_debug_update_prefixes
= list_new();
1453 if (bgp_debug_list_has_entry(bgp_debug_update_prefixes
, NULL
, argv_p
)) {
1455 "BGP updates debugging is already enabled for %pFX\n",
1457 prefix_free(&argv_p
);
1461 bgp_debug_list_add_entry(bgp_debug_update_prefixes
, NULL
, argv_p
);
1463 if (vty
->node
== CONFIG_NODE
) {
1464 DEBUG_ON(update
, UPDATE_PREFIX
);
1466 TERM_DEBUG_ON(update
, UPDATE_PREFIX
);
1467 vty_out(vty
, "BGP updates debugging is on for %pFX\n", argv_p
);
1470 prefix_free(&argv_p
);
1475 DEFPY (no_debug_bgp_update_prefix_afi_safi
,
1476 no_debug_bgp_update_prefix_afi_safi_cmd
,
1477 "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>>",
1482 "Specify a prefix to debug\n"
1486 EVPN_TYPE_2_HELP_STR
1487 EVPN_TYPE_2_HELP_STR
1488 MAC_STR MAC_STR MAC_STR
1492 EVPN_TYPE_3_HELP_STR
1493 EVPN_TYPE_3_HELP_STR
1497 EVPN_TYPE_5_HELP_STR
1498 EVPN_TYPE_5_HELP_STR
1503 struct prefix
*argv_p
;
1504 bool found_prefix
= false;
1505 int ret
= CMD_SUCCESS
;
1507 argv_p
= prefix_new();
1509 ret
= bgp_debug_parse_evpn_prefix(vty
, argv
, argc
, &argv_p
);
1510 if (ret
!= CMD_SUCCESS
) {
1511 prefix_free(&argv_p
);
1515 if (bgp_debug_update_prefixes
1516 && !list_isempty(bgp_debug_update_prefixes
)) {
1517 found_prefix
= bgp_debug_list_remove_entry(
1518 bgp_debug_update_prefixes
, NULL
, argv_p
);
1520 if (list_isempty(bgp_debug_update_prefixes
)) {
1521 if (vty
->node
== CONFIG_NODE
) {
1522 DEBUG_OFF(update
, UPDATE_PREFIX
);
1524 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
1526 "BGP updates debugging (per prefix) is off\n");
1532 vty_out(vty
, "BGP updates debugging is off for %pFX\n", argv_p
);
1534 vty_out(vty
, "BGP updates debugging was not enabled for %pFX\n",
1537 prefix_free(&argv_p
);
1543 DEFUN (debug_bgp_update_prefix
,
1544 debug_bgp_update_prefix_cmd
,
1545 "debug bgp updates prefix <A.B.C.D/M|X:X::X:X/M>",
1549 "Specify a prefix to debug\n"
1553 int idx_ipv4_ipv6_prefixlen
= 4;
1554 struct prefix
*argv_p
;
1556 argv_p
= prefix_new();
1557 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1560 if (!bgp_debug_update_prefixes
)
1561 bgp_debug_update_prefixes
= list_new();
1563 if (bgp_debug_list_has_entry(bgp_debug_update_prefixes
, NULL
, argv_p
)) {
1565 "BGP updates debugging is already enabled for %s\n",
1566 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1570 bgp_debug_list_add_entry(bgp_debug_update_prefixes
, NULL
, argv_p
);
1572 if (vty
->node
== CONFIG_NODE
) {
1573 DEBUG_ON(update
, UPDATE_PREFIX
);
1575 TERM_DEBUG_ON(update
, UPDATE_PREFIX
);
1576 vty_out(vty
, "BGP updates debugging is on for %s\n",
1577 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1583 DEFUN (no_debug_bgp_update_prefix
,
1584 no_debug_bgp_update_prefix_cmd
,
1585 "no debug bgp updates prefix <A.B.C.D/M|X:X::X:X/M>",
1590 "Specify a prefix to debug\n"
1594 int idx_ipv4_ipv6_prefixlen
= 5;
1595 struct prefix
*argv_p
;
1596 int found_prefix
= 0;
1598 argv_p
= prefix_new();
1599 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1602 if (bgp_debug_update_prefixes
1603 && !list_isempty(bgp_debug_update_prefixes
)) {
1604 found_prefix
= bgp_debug_list_remove_entry(
1605 bgp_debug_update_prefixes
, NULL
, argv_p
);
1607 if (list_isempty(bgp_debug_update_prefixes
)) {
1608 if (vty
->node
== CONFIG_NODE
) {
1609 DEBUG_OFF(update
, UPDATE_PREFIX
);
1611 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
1613 "BGP updates debugging (per prefix) is off\n");
1619 vty_out(vty
, "BGP updates debugging is off for %s\n",
1620 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1622 vty_out(vty
, "BGP updates debugging was not enabled for %s\n",
1623 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1628 DEFUN (no_debug_bgp_update
,
1629 no_debug_bgp_update_cmd
,
1630 "no debug bgp updates",
1636 struct listnode
*ln
;
1639 bgp_debug_list_free(bgp_debug_update_in_peers
);
1640 bgp_debug_list_free(bgp_debug_update_out_peers
);
1641 bgp_debug_list_free(bgp_debug_update_prefixes
);
1643 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, ln
, bgp
))
1644 bgp_debug_clear_updgrp_update_dbg(bgp
);
1646 if (vty
->node
== CONFIG_NODE
) {
1647 DEBUG_OFF(update
, UPDATE_IN
);
1648 DEBUG_OFF(update
, UPDATE_OUT
);
1649 DEBUG_OFF(update
, UPDATE_PREFIX
);
1651 TERM_DEBUG_OFF(update
, UPDATE_IN
);
1652 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
1653 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
1654 vty_out(vty
, "BGP updates debugging is off\n");
1659 /* debug bgp zebra */
1660 DEFUN (debug_bgp_zebra
,
1661 debug_bgp_zebra_cmd
,
1665 "BGP Zebra messages\n")
1667 if (vty
->node
== CONFIG_NODE
)
1668 DEBUG_ON(zebra
, ZEBRA
);
1670 TERM_DEBUG_ON(zebra
, ZEBRA
);
1671 vty_out(vty
, "BGP zebra debugging is on\n");
1676 DEFUN (debug_bgp_graceful_restart
,
1677 debug_bgp_graceful_restart_cmd
,
1678 "debug bgp graceful-restart",
1683 if (vty
->node
== CONFIG_NODE
) {
1684 DEBUG_ON(graceful_restart
, GRACEFUL_RESTART
);
1686 TERM_DEBUG_ON(graceful_restart
, GRACEFUL_RESTART
);
1687 vty_out(vty
, "BGP Graceful Restart debugging is on\n");
1693 DEFUN (debug_bgp_zebra_prefix
,
1694 debug_bgp_zebra_prefix_cmd
,
1695 "debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>",
1698 "BGP Zebra messages\n"
1699 "Specify a prefix to debug\n"
1703 int idx_ipv4_ipv6_prefixlen
= 4;
1704 struct prefix
*argv_p
;
1706 argv_p
= prefix_new();
1707 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1710 if (!bgp_debug_zebra_prefixes
)
1711 bgp_debug_zebra_prefixes
= list_new();
1713 if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes
, NULL
, argv_p
)) {
1714 vty_out(vty
, "BGP zebra debugging is already enabled for %s\n",
1715 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1719 bgp_debug_list_add_entry(bgp_debug_zebra_prefixes
, NULL
, argv_p
);
1721 if (vty
->node
== CONFIG_NODE
)
1722 DEBUG_ON(zebra
, ZEBRA
);
1724 TERM_DEBUG_ON(zebra
, ZEBRA
);
1725 vty_out(vty
, "BGP zebra debugging is on for %s\n",
1726 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1732 DEFUN (no_debug_bgp_zebra
,
1733 no_debug_bgp_zebra_cmd
,
1734 "no debug bgp zebra",
1738 "BGP Zebra messages\n")
1740 bgp_debug_list_free(bgp_debug_zebra_prefixes
);
1742 if (vty
->node
== CONFIG_NODE
)
1743 DEBUG_OFF(zebra
, ZEBRA
);
1745 TERM_DEBUG_OFF(zebra
, ZEBRA
);
1746 vty_out(vty
, "BGP zebra debugging is off\n");
1751 DEFUN (no_debug_bgp_graceful_restart
,
1752 no_debug_bgp_graceful_restart_cmd
,
1753 "no debug bgp graceful-restart",
1759 if (vty
->node
== CONFIG_NODE
) {
1760 DEBUG_OFF(graceful_restart
, GRACEFUL_RESTART
);
1762 TERM_DEBUG_OFF(graceful_restart
, GRACEFUL_RESTART
);
1763 vty_out(vty
, "BGP Graceful Restart debugging is off\n");
1768 DEFUN (no_debug_bgp_zebra_prefix
,
1769 no_debug_bgp_zebra_prefix_cmd
,
1770 "no debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>",
1774 "BGP Zebra messages\n"
1775 "Specify a prefix to debug\n"
1779 int idx_ipv4_ipv6_prefixlen
= 5;
1780 struct prefix
*argv_p
;
1781 int found_prefix
= 0;
1783 argv_p
= prefix_new();
1784 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1787 if (bgp_debug_zebra_prefixes
1788 && !list_isempty(bgp_debug_zebra_prefixes
)) {
1789 found_prefix
= bgp_debug_list_remove_entry(
1790 bgp_debug_zebra_prefixes
, NULL
, argv_p
);
1792 if (list_isempty(bgp_debug_zebra_prefixes
)) {
1793 if (vty
->node
== CONFIG_NODE
)
1794 DEBUG_OFF(zebra
, ZEBRA
);
1796 TERM_DEBUG_OFF(zebra
, ZEBRA
);
1797 vty_out(vty
, "BGP zebra debugging is off\n");
1803 vty_out(vty
, "BGP zebra debugging is off for %s\n",
1804 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1806 vty_out(vty
, "BGP zebra debugging was not enabled for %s\n",
1807 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1812 DEFUN (debug_bgp_allow_martians
,
1813 debug_bgp_allow_martians_cmd
,
1814 "debug bgp allow-martians",
1817 "BGP allow martian next hops\n")
1819 if (vty
->node
== CONFIG_NODE
)
1820 DEBUG_ON(allow_martians
, ALLOW_MARTIANS
);
1822 TERM_DEBUG_ON(allow_martians
, ALLOW_MARTIANS
);
1823 vty_out(vty
, "BGP allow_martian next hop debugging is on\n");
1828 DEFUN (no_debug_bgp_allow_martians
,
1829 no_debug_bgp_allow_martians_cmd
,
1830 "no debug bgp allow-martians",
1834 "BGP allow martian next hops\n")
1836 if (vty
->node
== CONFIG_NODE
)
1837 DEBUG_OFF(allow_martians
, ALLOW_MARTIANS
);
1839 TERM_DEBUG_OFF(allow_martians
, ALLOW_MARTIANS
);
1840 vty_out(vty
, "BGP allow martian next hop debugging is off\n");
1846 /* debug bgp update-groups */
1847 DEFUN (debug_bgp_update_groups
,
1848 debug_bgp_update_groups_cmd
,
1849 "debug bgp update-groups",
1852 "BGP update-groups\n")
1854 if (vty
->node
== CONFIG_NODE
)
1855 DEBUG_ON(update_groups
, UPDATE_GROUPS
);
1857 TERM_DEBUG_ON(update_groups
, UPDATE_GROUPS
);
1858 vty_out(vty
, "BGP update-groups debugging is on\n");
1863 DEFUN (no_debug_bgp_update_groups
,
1864 no_debug_bgp_update_groups_cmd
,
1865 "no debug bgp update-groups",
1869 "BGP update-groups\n")
1871 if (vty
->node
== CONFIG_NODE
)
1872 DEBUG_OFF(update_groups
, UPDATE_GROUPS
);
1874 TERM_DEBUG_OFF(update_groups
, UPDATE_GROUPS
);
1875 vty_out(vty
, "BGP update-groups debugging is off\n");
1880 DEFUN (debug_bgp_vpn
,
1882 "debug bgp vpn <leak-from-vrf|leak-to-vrf|rmap-event|label>",
1886 "leaked from vrf to vpn\n"
1887 "leaked to vrf from vpn\n"
1888 "route-map updates\n"
1893 if (argv_find(argv
, argc
, "leak-from-vrf", &idx
)) {
1894 if (vty
->node
== CONFIG_NODE
)
1895 DEBUG_ON(vpn
, VPN_LEAK_FROM_VRF
);
1897 TERM_DEBUG_ON(vpn
, VPN_LEAK_FROM_VRF
);
1898 } else if (argv_find(argv
, argc
, "leak-to-vrf", &idx
)) {
1899 if (vty
->node
== CONFIG_NODE
)
1900 DEBUG_ON(vpn
, VPN_LEAK_TO_VRF
);
1902 TERM_DEBUG_ON(vpn
, VPN_LEAK_TO_VRF
);
1903 } else if (argv_find(argv
, argc
, "rmap-event", &idx
)) {
1904 if (vty
->node
== CONFIG_NODE
)
1905 DEBUG_ON(vpn
, VPN_LEAK_RMAP_EVENT
);
1907 TERM_DEBUG_ON(vpn
, VPN_LEAK_RMAP_EVENT
);
1908 } else if (argv_find(argv
, argc
, "label", &idx
)) {
1909 if (vty
->node
== CONFIG_NODE
)
1910 DEBUG_ON(vpn
, VPN_LEAK_LABEL
);
1912 TERM_DEBUG_ON(vpn
, VPN_LEAK_LABEL
);
1914 vty_out(vty
, "%% unknown debug bgp vpn keyword\n");
1915 return CMD_WARNING_CONFIG_FAILED
;
1918 if (vty
->node
!= CONFIG_NODE
)
1919 vty_out(vty
, "enabled debug bgp vpn %s\n", argv
[idx
]->text
);
1924 DEFUN (no_debug_bgp_vpn
,
1925 no_debug_bgp_vpn_cmd
,
1926 "no debug bgp vpn <leak-from-vrf|leak-to-vrf|rmap-event|label>",
1931 "leaked from vrf to vpn\n"
1932 "leaked to vrf from vpn\n"
1933 "route-map updates\n"
1938 if (argv_find(argv
, argc
, "leak-from-vrf", &idx
)) {
1939 if (vty
->node
== CONFIG_NODE
)
1940 DEBUG_OFF(vpn
, VPN_LEAK_FROM_VRF
);
1942 TERM_DEBUG_OFF(vpn
, VPN_LEAK_FROM_VRF
);
1944 } else if (argv_find(argv
, argc
, "leak-to-vrf", &idx
)) {
1945 if (vty
->node
== CONFIG_NODE
)
1946 DEBUG_OFF(vpn
, VPN_LEAK_TO_VRF
);
1948 TERM_DEBUG_OFF(vpn
, VPN_LEAK_TO_VRF
);
1949 } else if (argv_find(argv
, argc
, "rmap-event", &idx
)) {
1950 if (vty
->node
== CONFIG_NODE
)
1951 DEBUG_OFF(vpn
, VPN_LEAK_RMAP_EVENT
);
1953 TERM_DEBUG_OFF(vpn
, VPN_LEAK_RMAP_EVENT
);
1954 } else if (argv_find(argv
, argc
, "label", &idx
)) {
1955 if (vty
->node
== CONFIG_NODE
)
1956 DEBUG_OFF(vpn
, VPN_LEAK_LABEL
);
1958 TERM_DEBUG_OFF(vpn
, VPN_LEAK_LABEL
);
1960 vty_out(vty
, "%% unknown debug bgp vpn keyword\n");
1961 return CMD_WARNING_CONFIG_FAILED
;
1964 if (vty
->node
!= CONFIG_NODE
)
1965 vty_out(vty
, "disabled debug bgp vpn %s\n", argv
[idx
]->text
);
1970 DEFUN (debug_bgp_pbr
,
1972 "debug bgp pbr [error]",
1975 "BGP policy based routing\n"
1980 if (argv_find(argv
, argc
, "error", &idx
)) {
1981 if (vty
->node
== CONFIG_NODE
)
1982 DEBUG_ON(pbr
, PBR_ERROR
);
1984 TERM_DEBUG_ON(pbr
, PBR_ERROR
);
1985 vty_out(vty
, "BGP policy based routing error is on\n");
1989 if (vty
->node
== CONFIG_NODE
)
1992 TERM_DEBUG_ON(pbr
, PBR
);
1993 vty_out(vty
, "BGP policy based routing is on\n");
1998 DEFUN (no_debug_bgp_pbr
,
1999 no_debug_bgp_pbr_cmd
,
2000 "no debug bgp pbr [error]",
2004 "BGP policy based routing\n"
2009 if (argv_find(argv
, argc
, "error", &idx
)) {
2010 if (vty
->node
== CONFIG_NODE
)
2011 DEBUG_OFF(pbr
, PBR_ERROR
);
2013 TERM_DEBUG_OFF(pbr
, PBR_ERROR
);
2014 vty_out(vty
, "BGP policy based routing error is off\n");
2018 if (vty
->node
== CONFIG_NODE
)
2019 DEBUG_OFF(pbr
, PBR
);
2021 TERM_DEBUG_OFF(pbr
, PBR
);
2022 vty_out(vty
, "BGP policy based routing is off\n");
2027 DEFPY (debug_bgp_evpn_mh
,
2028 debug_bgp_evpn_mh_cmd
,
2029 "[no$no] debug bgp evpn mh <es$es|route$rt>",
2035 "Ethernet Segment debugging\n"
2036 "Route debugging\n")
2039 if (vty
->node
== CONFIG_NODE
) {
2041 DEBUG_OFF(evpn_mh
, EVPN_MH_ES
);
2043 DEBUG_ON(evpn_mh
, EVPN_MH_ES
);
2046 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_ES
);
2048 "BGP EVPN-MH ES debugging is off\n");
2050 TERM_DEBUG_ON(evpn_mh
, EVPN_MH_ES
);
2052 "BGP EVPN-MH ES debugging is on\n");
2057 if (vty
->node
== CONFIG_NODE
) {
2059 DEBUG_OFF(evpn_mh
, EVPN_MH_RT
);
2061 DEBUG_ON(evpn_mh
, EVPN_MH_RT
);
2064 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_RT
);
2066 "BGP EVPN-MH route debugging is off\n");
2068 TERM_DEBUG_ON(evpn_mh
, EVPN_MH_RT
);
2070 "BGP EVPN-MH route debugging is on\n");
2078 DEFUN (debug_bgp_labelpool
,
2079 debug_bgp_labelpool_cmd
,
2080 "debug bgp labelpool",
2085 if (vty
->node
== CONFIG_NODE
)
2086 DEBUG_ON(labelpool
, LABELPOOL
);
2088 TERM_DEBUG_ON(labelpool
, LABELPOOL
);
2090 if (vty
->node
!= CONFIG_NODE
)
2091 vty_out(vty
, "enabled debug bgp labelpool\n");
2096 DEFUN (no_debug_bgp_labelpool
,
2097 no_debug_bgp_labelpool_cmd
,
2098 "no debug bgp labelpool",
2104 if (vty
->node
== CONFIG_NODE
)
2105 DEBUG_OFF(labelpool
, LABELPOOL
);
2107 TERM_DEBUG_OFF(labelpool
, LABELPOOL
);
2110 if (vty
->node
!= CONFIG_NODE
)
2111 vty_out(vty
, "disabled debug bgp labelpool\n");
2116 DEFPY(debug_bgp_bfd
, debug_bgp_bfd_cmd
,
2117 "[no] debug bgp bfd",
2121 "Bidirection Forwarding Detection\n")
2123 if (vty
->node
== CONFIG_NODE
) {
2125 DEBUG_OFF(bfd
, BFD_LIB
);
2126 bfd_protocol_integration_set_debug(false);
2128 DEBUG_ON(bfd
, BFD_LIB
);
2129 bfd_protocol_integration_set_debug(true);
2133 TERM_DEBUG_OFF(bfd
, BFD_LIB
);
2134 bfd_protocol_integration_set_debug(false);
2136 TERM_DEBUG_ON(bfd
, BFD_LIB
);
2137 bfd_protocol_integration_set_debug(true);
2144 DEFUN (no_debug_bgp
,
2152 struct listnode
*ln
;
2154 bgp_debug_list_free(bgp_debug_neighbor_events_peers
);
2155 bgp_debug_list_free(bgp_debug_keepalive_peers
);
2156 bgp_debug_list_free(bgp_debug_update_in_peers
);
2157 bgp_debug_list_free(bgp_debug_update_out_peers
);
2158 bgp_debug_list_free(bgp_debug_update_prefixes
);
2159 bgp_debug_list_free(bgp_debug_bestpath_prefixes
);
2160 bgp_debug_list_free(bgp_debug_zebra_prefixes
);
2162 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, ln
, bgp
))
2163 bgp_debug_clear_updgrp_update_dbg(bgp
);
2165 TERM_DEBUG_OFF(keepalive
, KEEPALIVE
);
2166 TERM_DEBUG_OFF(update
, UPDATE_IN
);
2167 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
2168 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
2169 TERM_DEBUG_OFF(bestpath
, BESTPATH
);
2170 TERM_DEBUG_OFF(as4
, AS4
);
2171 TERM_DEBUG_OFF(as4
, AS4_SEGMENT
);
2172 TERM_DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
2173 TERM_DEBUG_OFF(zebra
, ZEBRA
);
2174 TERM_DEBUG_OFF(allow_martians
, ALLOW_MARTIANS
);
2175 TERM_DEBUG_OFF(nht
, NHT
);
2176 TERM_DEBUG_OFF(vpn
, VPN_LEAK_FROM_VRF
);
2177 TERM_DEBUG_OFF(vpn
, VPN_LEAK_TO_VRF
);
2178 TERM_DEBUG_OFF(vpn
, VPN_LEAK_RMAP_EVENT
);
2179 TERM_DEBUG_OFF(vpn
, VPN_LEAK_LABEL
);
2180 TERM_DEBUG_OFF(flowspec
, FLOWSPEC
);
2181 TERM_DEBUG_OFF(labelpool
, LABELPOOL
);
2182 TERM_DEBUG_OFF(pbr
, PBR
);
2183 TERM_DEBUG_OFF(pbr
, PBR_ERROR
);
2184 TERM_DEBUG_OFF(graceful_restart
, GRACEFUL_RESTART
);
2185 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_ES
);
2186 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_RT
);
2187 TERM_DEBUG_OFF(bfd
, BFD_LIB
);
2189 vty_out(vty
, "All possible debugging has been turned off\n");
2194 DEFUN_NOSH (show_debugging_bgp
,
2195 show_debugging_bgp_cmd
,
2196 "show debugging [bgp]",
2201 vty_out(vty
, "BGP debugging status:\n");
2203 if (BGP_DEBUG(as4
, AS4
))
2204 vty_out(vty
, " BGP as4 debugging is on\n");
2206 if (BGP_DEBUG(as4
, AS4_SEGMENT
))
2207 vty_out(vty
, " BGP as4 aspath segment debugging is on\n");
2209 if (BGP_DEBUG(bestpath
, BESTPATH
))
2210 bgp_debug_list_print(vty
, " BGP bestpath debugging is on",
2211 bgp_debug_bestpath_prefixes
);
2213 if (BGP_DEBUG(keepalive
, KEEPALIVE
))
2214 bgp_debug_list_print(vty
, " BGP keepalives debugging is on",
2215 bgp_debug_keepalive_peers
);
2217 if (BGP_DEBUG(neighbor_events
, NEIGHBOR_EVENTS
))
2218 bgp_debug_list_print(vty
,
2219 " BGP neighbor-events debugging is on",
2220 bgp_debug_neighbor_events_peers
);
2222 if (BGP_DEBUG(nht
, NHT
))
2223 vty_out(vty
, " BGP next-hop tracking debugging is on\n");
2225 if (BGP_DEBUG(update_groups
, UPDATE_GROUPS
))
2226 vty_out(vty
, " BGP update-groups debugging is on\n");
2228 if (BGP_DEBUG(update
, UPDATE_PREFIX
))
2229 bgp_debug_list_print(vty
, " BGP updates debugging is on",
2230 bgp_debug_update_prefixes
);
2232 if (BGP_DEBUG(update
, UPDATE_IN
))
2233 bgp_debug_list_print(vty
,
2234 " BGP updates debugging is on (inbound)",
2235 bgp_debug_update_in_peers
);
2237 if (BGP_DEBUG(update
, UPDATE_OUT
))
2238 bgp_debug_list_print(vty
,
2239 " BGP updates debugging is on (outbound)",
2240 bgp_debug_update_out_peers
);
2242 if (BGP_DEBUG(zebra
, ZEBRA
))
2243 bgp_debug_list_print(vty
, " BGP zebra debugging is on",
2244 bgp_debug_zebra_prefixes
);
2246 if (BGP_DEBUG(graceful_restart
, GRACEFUL_RESTART
))
2247 vty_out(vty
, " BGP graceful-restart debugging is on\n");
2249 if (BGP_DEBUG(allow_martians
, ALLOW_MARTIANS
))
2250 vty_out(vty
, " BGP allow martian next hop debugging is on\n");
2252 if (BGP_DEBUG(vpn
, VPN_LEAK_FROM_VRF
))
2254 " BGP route leak from vrf to vpn debugging is on\n");
2255 if (BGP_DEBUG(vpn
, VPN_LEAK_TO_VRF
))
2257 " BGP route leak to vrf from vpn debugging is on\n");
2258 if (BGP_DEBUG(vpn
, VPN_LEAK_RMAP_EVENT
))
2259 vty_out(vty
, " BGP vpn route-map event debugging is on\n");
2260 if (BGP_DEBUG(vpn
, VPN_LEAK_LABEL
))
2261 vty_out(vty
, " BGP vpn label event debugging is on\n");
2262 if (BGP_DEBUG(flowspec
, FLOWSPEC
))
2263 vty_out(vty
, " BGP flowspec debugging is on\n");
2264 if (BGP_DEBUG(labelpool
, LABELPOOL
))
2265 vty_out(vty
, " BGP labelpool debugging is on\n");
2267 if (BGP_DEBUG(pbr
, PBR
))
2268 vty_out(vty
, " BGP policy based routing debugging is on\n");
2269 if (BGP_DEBUG(pbr
, PBR_ERROR
))
2270 vty_out(vty
, " BGP policy based routing error debugging is on\n");
2272 if (BGP_DEBUG(evpn_mh
, EVPN_MH_ES
))
2273 vty_out(vty
, " BGP EVPN-MH ES debugging is on\n");
2274 if (BGP_DEBUG(evpn_mh
, EVPN_MH_RT
))
2275 vty_out(vty
, " BGP EVPN-MH route debugging is on\n");
2277 if (BGP_DEBUG(bfd
, BFD_LIB
))
2278 vty_out(vty
, " BGP BFD library debugging is on\n");
2283 static int bgp_config_write_debug(struct vty
*vty
)
2287 if (CONF_BGP_DEBUG(as4
, AS4
)) {
2288 vty_out(vty
, "debug bgp as4\n");
2292 if (CONF_BGP_DEBUG(as4
, AS4_SEGMENT
)) {
2293 vty_out(vty
, "debug bgp as4 segment\n");
2297 if (CONF_BGP_DEBUG(bestpath
, BESTPATH
)) {
2298 write
+= bgp_debug_list_conf_print(vty
, "debug bgp bestpath",
2299 bgp_debug_bestpath_prefixes
);
2302 if (CONF_BGP_DEBUG(keepalive
, KEEPALIVE
)) {
2303 write
+= bgp_debug_list_conf_print(vty
, "debug bgp keepalives",
2304 bgp_debug_keepalive_peers
);
2307 if (CONF_BGP_DEBUG(neighbor_events
, NEIGHBOR_EVENTS
)) {
2308 write
+= bgp_debug_list_conf_print(
2309 vty
, "debug bgp neighbor-events",
2310 bgp_debug_neighbor_events_peers
);
2313 if (CONF_BGP_DEBUG(nht
, NHT
)) {
2314 vty_out(vty
, "debug bgp nht\n");
2318 if (CONF_BGP_DEBUG(update_groups
, UPDATE_GROUPS
)) {
2319 vty_out(vty
, "debug bgp update-groups\n");
2323 if (CONF_BGP_DEBUG(update
, UPDATE_PREFIX
)) {
2324 write
+= bgp_debug_list_conf_print(vty
,
2325 "debug bgp updates prefix",
2326 bgp_debug_update_prefixes
);
2329 if (CONF_BGP_DEBUG(update
, UPDATE_IN
)) {
2330 write
+= bgp_debug_list_conf_print(vty
, "debug bgp updates in",
2331 bgp_debug_update_in_peers
);
2334 if (CONF_BGP_DEBUG(update
, UPDATE_OUT
)) {
2335 write
+= bgp_debug_list_conf_print(vty
, "debug bgp updates out",
2336 bgp_debug_update_out_peers
);
2339 if (CONF_BGP_DEBUG(zebra
, ZEBRA
)) {
2340 if (!bgp_debug_zebra_prefixes
2341 || list_isempty(bgp_debug_zebra_prefixes
)) {
2342 vty_out(vty
, "debug bgp zebra\n");
2345 write
+= bgp_debug_list_conf_print(
2346 vty
, "debug bgp zebra prefix",
2347 bgp_debug_zebra_prefixes
);
2351 if (CONF_BGP_DEBUG(allow_martians
, ALLOW_MARTIANS
)) {
2352 vty_out(vty
, "debug bgp allow-martians\n");
2356 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_FROM_VRF
)) {
2357 vty_out(vty
, "debug bgp vpn leak-from-vrf\n");
2360 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_TO_VRF
)) {
2361 vty_out(vty
, "debug bgp vpn leak-to-vrf\n");
2364 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_RMAP_EVENT
)) {
2365 vty_out(vty
, "debug bgp vpn rmap-event\n");
2368 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_LABEL
)) {
2369 vty_out(vty
, "debug bgp vpn label\n");
2372 if (CONF_BGP_DEBUG(flowspec
, FLOWSPEC
)) {
2373 vty_out(vty
, "debug bgp flowspec\n");
2376 if (CONF_BGP_DEBUG(labelpool
, LABELPOOL
)) {
2377 vty_out(vty
, "debug bgp labelpool\n");
2381 if (CONF_BGP_DEBUG(pbr
, PBR
)) {
2382 vty_out(vty
, "debug bgp pbr\n");
2385 if (CONF_BGP_DEBUG(pbr
, PBR_ERROR
)) {
2386 vty_out(vty
, "debug bgp pbr error\n");
2390 if (CONF_BGP_DEBUG(graceful_restart
, GRACEFUL_RESTART
)) {
2391 vty_out(vty
, "debug bgp graceful-restart\n");
2395 if (CONF_BGP_DEBUG(evpn_mh
, EVPN_MH_ES
)) {
2396 vty_out(vty
, "debug bgp evpn mh es\n");
2399 if (CONF_BGP_DEBUG(evpn_mh
, EVPN_MH_RT
)) {
2400 vty_out(vty
, "debug bgp evpn mh route\n");
2404 if (CONF_BGP_DEBUG(bfd
, BFD_LIB
)) {
2405 vty_out(vty
, "debug bgp bfd\n");
2412 static int bgp_config_write_debug(struct vty
*vty
);
2413 static struct cmd_node debug_node
= {
2417 .config_write
= bgp_config_write_debug
,
2420 void bgp_debug_init(void)
2422 install_node(&debug_node
);
2424 install_element(ENABLE_NODE
, &show_debugging_bgp_cmd
);
2426 install_element(ENABLE_NODE
, &debug_bgp_as4_cmd
);
2427 install_element(CONFIG_NODE
, &debug_bgp_as4_cmd
);
2428 install_element(ENABLE_NODE
, &debug_bgp_as4_segment_cmd
);
2429 install_element(CONFIG_NODE
, &debug_bgp_as4_segment_cmd
);
2431 install_element(ENABLE_NODE
, &debug_bgp_neighbor_events_cmd
);
2432 install_element(CONFIG_NODE
, &debug_bgp_neighbor_events_cmd
);
2433 install_element(ENABLE_NODE
, &debug_bgp_nht_cmd
);
2434 install_element(CONFIG_NODE
, &debug_bgp_nht_cmd
);
2435 install_element(ENABLE_NODE
, &debug_bgp_keepalive_cmd
);
2436 install_element(CONFIG_NODE
, &debug_bgp_keepalive_cmd
);
2437 install_element(ENABLE_NODE
, &debug_bgp_update_cmd
);
2438 install_element(CONFIG_NODE
, &debug_bgp_update_cmd
);
2439 install_element(ENABLE_NODE
, &debug_bgp_zebra_cmd
);
2440 install_element(CONFIG_NODE
, &debug_bgp_zebra_cmd
);
2441 install_element(ENABLE_NODE
, &debug_bgp_allow_martians_cmd
);
2442 install_element(CONFIG_NODE
, &debug_bgp_allow_martians_cmd
);
2443 install_element(ENABLE_NODE
, &debug_bgp_update_groups_cmd
);
2444 install_element(CONFIG_NODE
, &debug_bgp_update_groups_cmd
);
2445 install_element(ENABLE_NODE
, &debug_bgp_bestpath_prefix_cmd
);
2446 install_element(CONFIG_NODE
, &debug_bgp_bestpath_prefix_cmd
);
2448 install_element(ENABLE_NODE
, &debug_bgp_graceful_restart_cmd
);
2449 install_element(CONFIG_NODE
, &debug_bgp_graceful_restart_cmd
);
2451 /* debug bgp updates (in|out) */
2452 install_element(ENABLE_NODE
, &debug_bgp_update_direct_cmd
);
2453 install_element(CONFIG_NODE
, &debug_bgp_update_direct_cmd
);
2454 install_element(ENABLE_NODE
, &no_debug_bgp_update_direct_cmd
);
2455 install_element(CONFIG_NODE
, &no_debug_bgp_update_direct_cmd
);
2457 /* debug bgp updates (in|out) A.B.C.D */
2458 install_element(ENABLE_NODE
, &debug_bgp_update_direct_peer_cmd
);
2459 install_element(CONFIG_NODE
, &debug_bgp_update_direct_peer_cmd
);
2460 install_element(ENABLE_NODE
, &no_debug_bgp_update_direct_peer_cmd
);
2461 install_element(CONFIG_NODE
, &no_debug_bgp_update_direct_peer_cmd
);
2463 /* debug bgp updates prefix A.B.C.D/M */
2464 install_element(ENABLE_NODE
, &debug_bgp_update_prefix_cmd
);
2465 install_element(CONFIG_NODE
, &debug_bgp_update_prefix_cmd
);
2466 install_element(ENABLE_NODE
, &no_debug_bgp_update_prefix_cmd
);
2467 install_element(CONFIG_NODE
, &no_debug_bgp_update_prefix_cmd
);
2468 install_element(ENABLE_NODE
, &debug_bgp_update_prefix_afi_safi_cmd
);
2469 install_element(CONFIG_NODE
, &debug_bgp_update_prefix_afi_safi_cmd
);
2470 install_element(ENABLE_NODE
, &no_debug_bgp_update_prefix_afi_safi_cmd
);
2471 install_element(CONFIG_NODE
, &no_debug_bgp_update_prefix_afi_safi_cmd
);
2473 /* debug bgp zebra prefix A.B.C.D/M */
2474 install_element(ENABLE_NODE
, &debug_bgp_zebra_prefix_cmd
);
2475 install_element(CONFIG_NODE
, &debug_bgp_zebra_prefix_cmd
);
2476 install_element(ENABLE_NODE
, &no_debug_bgp_zebra_prefix_cmd
);
2477 install_element(CONFIG_NODE
, &no_debug_bgp_zebra_prefix_cmd
);
2479 install_element(ENABLE_NODE
, &no_debug_bgp_as4_cmd
);
2480 install_element(CONFIG_NODE
, &no_debug_bgp_as4_cmd
);
2481 install_element(ENABLE_NODE
, &no_debug_bgp_as4_segment_cmd
);
2482 install_element(CONFIG_NODE
, &no_debug_bgp_as4_segment_cmd
);
2484 /* debug bgp neighbor-events A.B.C.D */
2485 install_element(ENABLE_NODE
, &debug_bgp_neighbor_events_peer_cmd
);
2486 install_element(CONFIG_NODE
, &debug_bgp_neighbor_events_peer_cmd
);
2487 install_element(ENABLE_NODE
, &no_debug_bgp_neighbor_events_peer_cmd
);
2488 install_element(CONFIG_NODE
, &no_debug_bgp_neighbor_events_peer_cmd
);
2490 /* debug bgp keepalive A.B.C.D */
2491 install_element(ENABLE_NODE
, &debug_bgp_keepalive_peer_cmd
);
2492 install_element(CONFIG_NODE
, &debug_bgp_keepalive_peer_cmd
);
2493 install_element(ENABLE_NODE
, &no_debug_bgp_keepalive_peer_cmd
);
2494 install_element(CONFIG_NODE
, &no_debug_bgp_keepalive_peer_cmd
);
2496 install_element(ENABLE_NODE
, &no_debug_bgp_neighbor_events_cmd
);
2497 install_element(CONFIG_NODE
, &no_debug_bgp_neighbor_events_cmd
);
2498 install_element(ENABLE_NODE
, &no_debug_bgp_nht_cmd
);
2499 install_element(CONFIG_NODE
, &no_debug_bgp_nht_cmd
);
2500 install_element(ENABLE_NODE
, &no_debug_bgp_keepalive_cmd
);
2501 install_element(CONFIG_NODE
, &no_debug_bgp_keepalive_cmd
);
2502 install_element(ENABLE_NODE
, &no_debug_bgp_update_cmd
);
2503 install_element(CONFIG_NODE
, &no_debug_bgp_update_cmd
);
2504 install_element(ENABLE_NODE
, &no_debug_bgp_zebra_cmd
);
2505 install_element(CONFIG_NODE
, &no_debug_bgp_zebra_cmd
);
2506 install_element(ENABLE_NODE
, &no_debug_bgp_allow_martians_cmd
);
2507 install_element(CONFIG_NODE
, &no_debug_bgp_allow_martians_cmd
);
2508 install_element(ENABLE_NODE
, &no_debug_bgp_update_groups_cmd
);
2509 install_element(CONFIG_NODE
, &no_debug_bgp_update_groups_cmd
);
2510 install_element(ENABLE_NODE
, &no_debug_bgp_cmd
);
2511 install_element(ENABLE_NODE
, &no_debug_bgp_bestpath_cmd
);
2512 install_element(CONFIG_NODE
, &no_debug_bgp_bestpath_cmd
);
2513 install_element(ENABLE_NODE
, &no_debug_bgp_bestpath_prefix_cmd
);
2514 install_element(CONFIG_NODE
, &no_debug_bgp_bestpath_prefix_cmd
);
2516 install_element(ENABLE_NODE
, &no_debug_bgp_graceful_restart_cmd
);
2517 install_element(CONFIG_NODE
, &no_debug_bgp_graceful_restart_cmd
);
2519 install_element(ENABLE_NODE
, &debug_bgp_vpn_cmd
);
2520 install_element(CONFIG_NODE
, &debug_bgp_vpn_cmd
);
2521 install_element(ENABLE_NODE
, &no_debug_bgp_vpn_cmd
);
2522 install_element(CONFIG_NODE
, &no_debug_bgp_vpn_cmd
);
2524 install_element(ENABLE_NODE
, &debug_bgp_labelpool_cmd
);
2525 install_element(CONFIG_NODE
, &debug_bgp_labelpool_cmd
);
2526 install_element(ENABLE_NODE
, &no_debug_bgp_labelpool_cmd
);
2527 install_element(CONFIG_NODE
, &no_debug_bgp_labelpool_cmd
);
2530 install_element(ENABLE_NODE
, &debug_bgp_pbr_cmd
);
2531 install_element(CONFIG_NODE
, &debug_bgp_pbr_cmd
);
2532 install_element(ENABLE_NODE
, &no_debug_bgp_pbr_cmd
);
2533 install_element(CONFIG_NODE
, &no_debug_bgp_pbr_cmd
);
2535 install_element(ENABLE_NODE
, &debug_bgp_evpn_mh_cmd
);
2536 install_element(CONFIG_NODE
, &debug_bgp_evpn_mh_cmd
);
2539 install_element(ENABLE_NODE
, &debug_bgp_bfd_cmd
);
2540 install_element(CONFIG_NODE
, &debug_bgp_bfd_cmd
);
2543 /* Return true if this prefix is on the per_prefix_list of prefixes to debug
2544 * for BGP_DEBUG_TYPE
2546 static int bgp_debug_per_prefix(const struct prefix
*p
,
2547 unsigned long term_bgp_debug_type
,
2548 unsigned int BGP_DEBUG_TYPE
,
2549 struct list
*per_prefix_list
)
2551 struct bgp_debug_filter
*filter
;
2552 struct listnode
*node
, *nnode
;
2554 if (term_bgp_debug_type
& BGP_DEBUG_TYPE
) {
2555 /* We are debugging all prefixes so return true */
2556 if (!per_prefix_list
|| list_isempty(per_prefix_list
))
2563 for (ALL_LIST_ELEMENTS(per_prefix_list
, node
, nnode
,
2565 if (filter
->p
->prefixlen
== p
->prefixlen
2566 && prefix_match(filter
->p
, p
))
2576 /* Return true if this peer is on the per_peer_list of peers to debug
2577 * for BGP_DEBUG_TYPE
2579 static bool bgp_debug_per_peer(char *host
, unsigned long term_bgp_debug_type
,
2580 unsigned int BGP_DEBUG_TYPE
,
2581 struct list
*per_peer_list
)
2583 struct bgp_debug_filter
*filter
;
2584 struct listnode
*node
, *nnode
;
2586 if (term_bgp_debug_type
& BGP_DEBUG_TYPE
) {
2587 /* We are debugging all peers so return true */
2588 if (!per_peer_list
|| list_isempty(per_peer_list
))
2595 for (ALL_LIST_ELEMENTS(per_peer_list
, node
, nnode
,
2597 if (strcmp(filter
->host
, host
) == 0)
2607 bool bgp_debug_neighbor_events(const struct peer
*peer
)
2614 return bgp_debug_per_peer(host
, term_bgp_debug_neighbor_events
,
2615 BGP_DEBUG_NEIGHBOR_EVENTS
,
2616 bgp_debug_neighbor_events_peers
);
2619 bool bgp_debug_keepalive(const struct peer
*peer
)
2626 return bgp_debug_per_peer(host
, term_bgp_debug_keepalive
,
2627 BGP_DEBUG_KEEPALIVE
,
2628 bgp_debug_keepalive_peers
);
2631 bool bgp_debug_update(const struct peer
*peer
, const struct prefix
*p
,
2632 struct update_group
*updgrp
, unsigned int inbound
)
2640 if (bgp_debug_per_peer(host
, term_bgp_debug_update
,
2641 BGP_DEBUG_UPDATE_IN
,
2642 bgp_debug_update_in_peers
))
2648 if (bgp_debug_per_peer(host
, term_bgp_debug_update
,
2649 BGP_DEBUG_UPDATE_OUT
,
2650 bgp_debug_update_out_peers
))
2653 /* Check if update debugging implicitly enabled for the group.
2655 if (updgrp
&& UPDGRP_DBG_ON(updgrp
))
2660 if (BGP_DEBUG(update
, UPDATE_PREFIX
)) {
2661 if (bgp_debug_per_prefix(p
, term_bgp_debug_update
,
2662 BGP_DEBUG_UPDATE_PREFIX
,
2663 bgp_debug_update_prefixes
))
2670 bool bgp_debug_bestpath(struct bgp_dest
*dest
)
2672 if (BGP_DEBUG(bestpath
, BESTPATH
)) {
2673 if (bgp_debug_per_prefix(
2674 bgp_dest_get_prefix(dest
), term_bgp_debug_bestpath
,
2675 BGP_DEBUG_BESTPATH
, bgp_debug_bestpath_prefixes
))
2682 bool bgp_debug_zebra(const struct prefix
*p
)
2684 if (BGP_DEBUG(zebra
, ZEBRA
)) {
2685 if (bgp_debug_per_prefix(p
, term_bgp_debug_zebra
,
2687 bgp_debug_zebra_prefixes
))
2694 const char *bgp_debug_rdpfxpath2str(afi_t afi
, safi_t safi
,
2695 const struct prefix_rd
*prd
,
2696 union prefixconstptr pu
,
2697 mpls_label_t
*label
, uint32_t num_labels
,
2698 int addpath_valid
, uint32_t addpath_id
,
2699 struct bgp_route_evpn
*overlay_index
,
2700 char *str
, int size
)
2702 char rd_buf
[RD_ADDRSTRLEN
];
2704 char overlay_index_buf
[INET6_ADDRSTRLEN
+ 14];
2705 const struct prefix_evpn
*evp
;
2707 /* ' with addpath ID ' 17
2708 * max strlen of uint32 + 10
2709 * +/- (just in case) + 1
2710 * null terminator + 1
2711 * ============================ 29 */
2712 char pathid_buf
[30];
2714 if (size
< BGP_PRD_PATH_STRLEN
)
2717 /* Note: Path-id is created by default, but only included in update
2719 pathid_buf
[0] = '\0';
2721 snprintf(pathid_buf
, sizeof(pathid_buf
), " with addpath ID %u",
2724 overlay_index_buf
[0] = '\0';
2725 if (overlay_index
&& overlay_index
->type
== OVERLAY_INDEX_GATEWAY_IP
) {
2726 char obuf
[INET6_ADDRSTRLEN
];
2730 if (is_evpn_prefix_ipaddr_v4(evp
))
2731 inet_ntop(AF_INET
, &overlay_index
->gw_ip
, obuf
,
2733 else if (is_evpn_prefix_ipaddr_v6(evp
))
2734 inet_ntop(AF_INET6
, &overlay_index
->gw_ip
, obuf
,
2737 snprintf(overlay_index_buf
, sizeof(overlay_index_buf
),
2738 " gateway IP %s", obuf
);
2742 if (bgp_labeled_safi(safi
) && num_labels
) {
2744 if (safi
== SAFI_EVPN
) {
2747 bgp_evpn_label2str(label
, num_labels
, tag_buf2
, 20);
2748 snprintf(tag_buf
, sizeof(tag_buf
), " label %s",
2751 uint32_t label_value
;
2753 label_value
= decode_label(label
);
2754 snprintf(tag_buf
, sizeof(tag_buf
), " label %u",
2760 snprintfrr(str
, size
, "RD %s %pFX%s%s%s %s %s",
2761 prefix_rd2str(prd
, rd_buf
, sizeof(rd_buf
)), pu
.p
,
2762 overlay_index_buf
, tag_buf
, pathid_buf
, afi2str(afi
),
2764 else if (safi
== SAFI_FLOWSPEC
) {
2765 char return_string
[BGP_FLOWSPEC_NLRI_STRING_MAX
];
2766 const struct prefix_fs
*fs
= pu
.fs
;
2768 bgp_fs_nlri_get_string((unsigned char *)fs
->prefix
.ptr
,
2769 fs
->prefix
.prefixlen
,
2771 NLRI_STRING_FORMAT_DEBUG
, NULL
,
2772 family2afi(fs
->prefix
.family
));
2773 snprintf(str
, size
, "FS %s Match{%s}", afi2str(afi
),
2776 snprintfrr(str
, size
, "%pFX%s%s %s %s", pu
.p
, tag_buf
,
2777 pathid_buf
, afi2str(afi
), safi2str(safi
));