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"},
175 static const struct message bgp_notify_route_refresh_msg
[] = {
176 {BGP_NOTIFY_SUBCODE_UNSPECIFIC
, "/Unspecific"},
177 {BGP_NOTIFY_ROUTE_REFRESH_INVALID_MSG_LEN
, "/Invalid Message Length"},
180 static const struct message bgp_notify_fsm_msg
[] = {
181 {BGP_NOTIFY_FSM_ERR_SUBCODE_UNSPECIFIC
, "/Unspecific"},
182 {BGP_NOTIFY_FSM_ERR_SUBCODE_OPENSENT
,
183 "/Receive Unexpected Message in OpenSent State"},
184 {BGP_NOTIFY_FSM_ERR_SUBCODE_OPENCONFIRM
,
185 "/Receive Unexpected Message in OpenConfirm State"},
186 {BGP_NOTIFY_FSM_ERR_SUBCODE_ESTABLISHED
,
187 "/Receive Unexpected Message in Established State"},
190 /* Origin strings. */
191 const char *const bgp_origin_str
[] = {"i", "e", "?"};
192 const char *const bgp_origin_long_str
[] = {"IGP", "EGP", "incomplete"};
194 static void bgp_debug_print_evpn_prefix(struct vty
*vty
, const char *desc
,
196 /* Given a string return a pointer the corresponding peer structure */
197 static struct peer
*bgp_find_peer(struct vty
*vty
, const char *peer_str
)
199 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
207 ret
= str2sockunion(peer_str
, &su
);
211 peer
= peer_lookup_by_conf_if(bgp
, peer_str
);
214 peer
= peer_lookup_by_hostname(bgp
, peer_str
);
218 return peer_lookup(bgp
, &su
);
221 static void bgp_debug_list_free(struct list
*list
)
223 struct bgp_debug_filter
*filter
;
224 struct listnode
*node
, *nnode
;
227 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
228 listnode_delete(list
, filter
);
229 prefix_free(&filter
->p
);
230 XFREE(MTYPE_BGP_DEBUG_STR
, filter
->host
);
231 XFREE(MTYPE_BGP_DEBUG_FILTER
, filter
);
236 * Print the desc along with a list of peers/prefixes this debug is
239 static void bgp_debug_list_print(struct vty
*vty
, const char *desc
,
242 struct bgp_debug_filter
*filter
;
243 struct listnode
*node
, *nnode
;
245 vty_out(vty
, "%s", desc
);
247 if (list
&& !list_isempty(list
)) {
248 vty_out(vty
, " for");
249 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
251 vty_out(vty
, " %s", filter
->host
);
253 if (filter
->p
&& filter
->p
->family
== AF_EVPN
)
254 bgp_debug_print_evpn_prefix(vty
, "", filter
->p
);
256 vty_out(vty
, " %pFX", filter
->p
);
264 * Print the command to enable the debug for each peer/prefix this debug is
267 static int bgp_debug_list_conf_print(struct vty
*vty
, const char *desc
,
270 struct bgp_debug_filter
*filter
;
271 struct listnode
*node
, *nnode
;
274 if (list
&& !list_isempty(list
)) {
275 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
277 vty_out(vty
, "%s %s\n", desc
, filter
->host
);
281 if (filter
->p
&& filter
->p
->family
== AF_EVPN
) {
282 bgp_debug_print_evpn_prefix(vty
, desc
,
285 } else if (filter
->p
) {
286 vty_out(vty
, "%s %pFX\n", desc
, filter
->p
);
293 vty_out(vty
, "%s\n", desc
);
300 static void bgp_debug_list_add_entry(struct list
*list
, const char *host
,
301 const struct prefix
*p
)
303 struct bgp_debug_filter
*filter
;
305 filter
= XCALLOC(MTYPE_BGP_DEBUG_FILTER
,
306 sizeof(struct bgp_debug_filter
));
309 filter
->host
= XSTRDUP(MTYPE_BGP_DEBUG_STR
, host
);
313 filter
->p
= prefix_new();
314 prefix_copy(filter
->p
, p
);
317 listnode_add(list
, filter
);
320 static bool bgp_debug_list_remove_entry(struct list
*list
, const char *host
,
323 struct bgp_debug_filter
*filter
;
324 struct listnode
*node
, *nnode
;
326 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
327 if (host
&& strcmp(filter
->host
, host
) == 0) {
328 listnode_delete(list
, filter
);
329 XFREE(MTYPE_BGP_DEBUG_STR
, filter
->host
);
330 XFREE(MTYPE_BGP_DEBUG_FILTER
, filter
);
332 } else if (p
&& filter
->p
->prefixlen
== p
->prefixlen
333 && prefix_match(filter
->p
, p
)) {
334 listnode_delete(list
, filter
);
335 prefix_free(&filter
->p
);
336 XFREE(MTYPE_BGP_DEBUG_FILTER
, filter
);
344 static bool bgp_debug_list_has_entry(struct list
*list
, const char *host
,
345 const struct prefix
*p
)
347 struct bgp_debug_filter
*filter
;
348 struct listnode
*node
, *nnode
;
350 for (ALL_LIST_ELEMENTS(list
, node
, nnode
, filter
)) {
352 if (strcmp(filter
->host
, host
) == 0) {
356 if (filter
->p
->prefixlen
== p
->prefixlen
357 && prefix_match(filter
->p
, p
)) {
366 bool bgp_debug_peer_updout_enabled(char *host
)
368 return (bgp_debug_list_has_entry(bgp_debug_update_out_peers
, host
,
372 /* Dump attribute. */
373 bool bgp_dump_attr(struct attr
*attr
, char *buf
, size_t size
)
375 char addrbuf
[BUFSIZ
];
382 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP
)))
383 snprintfrr(buf
, size
, "nexthop %pI4", &attr
->nexthop
);
385 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_ORIGIN
)))
386 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), ", origin %s",
387 bgp_origin_str
[attr
->origin
]);
390 if (attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL
391 || attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL
)
392 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
394 inet_ntop(AF_INET6
, &attr
->mp_nexthop_global
, addrbuf
,
397 if (attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL
)
398 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), "(%s)",
399 inet_ntop(AF_INET6
, &attr
->mp_nexthop_local
, addrbuf
,
402 if (attr
->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV4
)
403 snprintfrr(buf
, size
, "nexthop %pI4", &attr
->nexthop
);
405 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF
)))
406 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
407 ", localpref %u", attr
->local_pref
);
409 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC
)))
410 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), ", metric %u",
413 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES
)))
414 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
416 community_str(bgp_attr_get_community(attr
), false,
419 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES
)))
420 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
421 ", large-community %s",
422 lcommunity_str(bgp_attr_get_lcommunity(attr
), false,
425 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES
)))
426 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
428 ecommunity_str(bgp_attr_get_ecommunity(attr
)));
430 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE
)))
431 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
432 ", atomic-aggregate");
434 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR
)))
435 snprintfrr(buf
+ strlen(buf
), size
- strlen(buf
),
436 ", aggregated by %u %pI4", attr
->aggregator_as
,
437 &attr
->aggregator_addr
);
439 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID
)))
440 snprintfrr(buf
+ strlen(buf
), size
- strlen(buf
),
441 ", originator %pI4", &attr
->originator_id
);
443 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST
))) {
444 struct cluster_list
*cluster
;
447 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
450 cluster
= bgp_attr_get_cluster(attr
);
451 for (i
= 0; i
< cluster
->length
/ 4; i
++)
452 snprintfrr(buf
+ strlen(buf
), size
- strlen(buf
),
453 " %pI4", &cluster
->list
[i
]);
456 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL
)))
457 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
458 ", pmsi tnltype %u", bgp_attr_get_pmsi_tnl_type(attr
));
460 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_AS_PATH
)))
461 snprintf(buf
+ strlen(buf
), size
- strlen(buf
), ", path %s",
462 aspath_print(attr
->aspath
));
464 if (CHECK_FLAG(attr
->flag
, ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID
))) {
465 if (attr
->label_index
!= BGP_INVALID_LABEL_INDEX
)
466 snprintf(buf
+ strlen(buf
), size
- strlen(buf
),
467 ", label-index %u", attr
->label_index
);
476 const char *bgp_notify_code_str(char code
)
478 return lookup_msg(bgp_notify_msg
, code
, "Unrecognized Error Code");
481 const char *bgp_notify_subcode_str(char code
, char subcode
)
485 case BGP_NOTIFY_HEADER_ERR
:
486 return lookup_msg(bgp_notify_head_msg
, subcode
,
487 "Unrecognized Error Subcode");
488 case BGP_NOTIFY_OPEN_ERR
:
489 return lookup_msg(bgp_notify_open_msg
, subcode
,
490 "Unrecognized Error Subcode");
491 case BGP_NOTIFY_UPDATE_ERR
:
492 return lookup_msg(bgp_notify_update_msg
, subcode
,
493 "Unrecognized Error Subcode");
494 case BGP_NOTIFY_HOLD_ERR
:
496 case BGP_NOTIFY_FSM_ERR
:
497 return lookup_msg(bgp_notify_fsm_msg
, subcode
,
498 "Unrecognized Error Subcode");
499 case BGP_NOTIFY_CEASE
:
500 return lookup_msg(bgp_notify_cease_msg
, subcode
,
501 "Unrecognized Error Subcode");
502 case BGP_NOTIFY_ROUTE_REFRESH_ERR
:
503 return lookup_msg(bgp_notify_route_refresh_msg
, subcode
,
504 "Unrecognized Error Subcode");
509 /* extract notify admin reason if correctly present */
510 const char *bgp_notify_admin_message(char *buf
, size_t bufsz
, uint8_t *data
,
513 if (!data
|| datalen
< 1)
516 uint8_t len
= data
[0];
517 if (!len
|| len
> datalen
- 1)
520 return zlog_sanitize(buf
, bufsz
, data
+ 1, len
);
523 /* dump notify packet */
524 void bgp_notify_print(struct peer
*peer
, struct bgp_notify
*bgp_notify
,
525 const char *direct
, bool hard_reset
)
527 const char *subcode_str
;
528 const char *code_str
;
529 const char *msg_str
= NULL
;
532 if (BGP_DEBUG(neighbor_events
, NEIGHBOR_EVENTS
)
533 || CHECK_FLAG(peer
->bgp
->flags
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
)) {
534 code_str
= bgp_notify_code_str(bgp_notify
->code
);
535 subcode_str
= bgp_notify_subcode_str(bgp_notify
->code
,
536 bgp_notify
->subcode
);
538 if (bgp_notify
->code
== BGP_NOTIFY_CEASE
539 && (bgp_notify
->subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
540 || bgp_notify
->subcode
541 == BGP_NOTIFY_CEASE_ADMIN_RESET
)) {
542 msg_str
= bgp_notify_admin_message(
543 msg_buf
, sizeof(msg_buf
), bgp_notify
->raw_data
,
549 "%%NOTIFICATION%s: %s neighbor %s %d/%d (%s%s) \"%s\"",
550 hard_reset
? "(Hard Reset)" : "",
551 strcmp(direct
, "received") == 0
554 peer
->host
, bgp_notify
->code
,
555 bgp_notify
->subcode
, code_str
, subcode_str
,
558 msg_str
= bgp_notify
->data
? bgp_notify
->data
: "";
560 "%%NOTIFICATION%s: %s neighbor %s %d/%d (%s%s) %d bytes %s",
561 hard_reset
? "(Hard Reset)" : "",
562 strcmp(direct
, "received") == 0
565 peer
->host
, bgp_notify
->code
,
566 bgp_notify
->subcode
, code_str
, subcode_str
,
567 bgp_notify
->length
, msg_str
);
572 static void bgp_debug_clear_updgrp_update_dbg(struct bgp
*bgp
)
575 bgp
= bgp_get_default();
576 update_group_walk(bgp
, update_group_clear_update_dbg
, NULL
);
579 static void bgp_debug_print_evpn_prefix(struct vty
*vty
, const char *desc
,
582 char evpn_desc
[PREFIX2STR_BUFFER
+ INET_ADDRSTRLEN
];
583 char buf
[PREFIX2STR_BUFFER
];
584 char buf2
[ETHER_ADDR_STRLEN
];
586 if (p
->u
.prefix_evpn
.route_type
== BGP_EVPN_MAC_IP_ROUTE
) {
587 if (is_evpn_prefix_ipaddr_none((struct prefix_evpn
*)p
)) {
589 evpn_desc
, sizeof(evpn_desc
),
590 "l2vpn evpn type macip mac %s",
591 prefix_mac2str(&p
->u
.prefix_evpn
.macip_addr
.mac
,
592 buf2
, sizeof(buf2
)));
594 uint8_t family
= is_evpn_prefix_ipaddr_v4(
595 (struct prefix_evpn
*)p
) ?
598 evpn_desc
, sizeof(evpn_desc
),
599 "l2vpn evpn type macip mac %s ip %s",
600 prefix_mac2str(&p
->u
.prefix_evpn
.macip_addr
.mac
,
604 &p
->u
.prefix_evpn
.macip_addr
.ip
.ip
.addr
,
605 buf
, PREFIX2STR_BUFFER
));
607 } else if (p
->u
.prefix_evpn
.route_type
== BGP_EVPN_IMET_ROUTE
) {
608 snprintfrr(evpn_desc
, sizeof(evpn_desc
),
609 "l2vpn evpn type multicast ip %pI4",
610 &p
->u
.prefix_evpn
.imet_addr
.ip
.ipaddr_v4
);
611 } else if (p
->u
.prefix_evpn
.route_type
== BGP_EVPN_IP_PREFIX_ROUTE
) {
612 uint8_t family
= is_evpn_prefix_ipaddr_v4(
613 (struct prefix_evpn
*)p
) ? AF_INET
615 snprintf(evpn_desc
, sizeof(evpn_desc
),
616 "l2vpn evpn type prefix ip %s/%d",
618 &p
->u
.prefix_evpn
.prefix_addr
.ip
.ip
.addr
,
619 buf
, PREFIX2STR_BUFFER
),
620 p
->u
.prefix_evpn
.prefix_addr
.ip_prefix_length
);
623 vty_out(vty
, "%s %s\n", desc
, evpn_desc
);
626 static int bgp_debug_parse_evpn_prefix(struct vty
*vty
, struct cmd_token
**argv
,
627 int argc
, struct prefix
**argv_pp
)
629 struct prefix
*argv_p
;
638 if (bgp_evpn_cli_parse_type(&evpn_type
, argv
, argc
) < 0)
641 if (evpn_type
== BGP_EVPN_MAC_IP_ROUTE
) {
642 memset(&ip
, 0, sizeof(ip
));
644 argv_find(argv
, argc
, "mac", &mac_idx
);
645 (void)prefix_str2mac(argv
[mac_idx
+ 1]->arg
, &mac
);
647 argv_find(argv
, argc
, "ip", &ip_idx
);
648 str2ipaddr(argv
[ip_idx
+ 1]->arg
, &ip
);
650 build_evpn_type2_prefix((struct prefix_evpn
*)argv_p
,
652 } else if (evpn_type
== BGP_EVPN_IMET_ROUTE
) {
653 memset(&ip
, 0, sizeof(ip
));
655 argv_find(argv
, argc
, "ip", &ip_idx
);
656 str2ipaddr(argv
[ip_idx
+ 1]->arg
, &ip
);
658 build_evpn_type3_prefix((struct prefix_evpn
*)argv_p
,
660 } else if (evpn_type
== BGP_EVPN_IP_PREFIX_ROUTE
) {
661 struct prefix ip_prefix
;
663 memset(&ip_prefix
, 0, sizeof(ip_prefix
));
664 if (argv_find(argv
, argc
, "ip", &ip_idx
)) {
665 (void)str2prefix(argv
[ip_idx
+ 1]->arg
, &ip_prefix
);
666 apply_mask(&ip_prefix
);
668 build_type5_prefix_from_ip_prefix(
669 (struct prefix_evpn
*)argv_p
,
676 /* Debug option setting interface. */
677 unsigned long bgp_debug_option
= 0;
679 int debug(unsigned int option
)
681 return bgp_debug_option
& option
;
684 DEFUN (debug_bgp_as4
,
691 if (vty
->node
== CONFIG_NODE
)
694 TERM_DEBUG_ON(as4
, AS4
);
695 vty_out(vty
, "BGP as4 debugging is on\n");
700 DEFUN (no_debug_bgp_as4
,
701 no_debug_bgp_as4_cmd
,
708 if (vty
->node
== CONFIG_NODE
)
711 TERM_DEBUG_OFF(as4
, AS4
);
712 vty_out(vty
, "BGP as4 debugging is off\n");
717 DEFUN (debug_bgp_as4_segment
,
718 debug_bgp_as4_segment_cmd
,
719 "debug bgp as4 segment",
723 "BGP AS4 aspath segment handling\n")
725 if (vty
->node
== CONFIG_NODE
)
726 DEBUG_ON(as4
, AS4_SEGMENT
);
728 TERM_DEBUG_ON(as4
, AS4_SEGMENT
);
729 vty_out(vty
, "BGP as4 segment debugging is on\n");
734 DEFUN (no_debug_bgp_as4_segment
,
735 no_debug_bgp_as4_segment_cmd
,
736 "no debug bgp as4 segment",
741 "BGP AS4 aspath segment handling\n")
743 if (vty
->node
== CONFIG_NODE
)
744 DEBUG_OFF(as4
, AS4_SEGMENT
);
746 TERM_DEBUG_OFF(as4
, AS4_SEGMENT
);
747 vty_out(vty
, "BGP as4 segment debugging is off\n");
752 /* debug bgp neighbor_events */
753 DEFUN (debug_bgp_neighbor_events
,
754 debug_bgp_neighbor_events_cmd
,
755 "debug bgp neighbor-events",
758 "BGP Neighbor Events\n")
760 bgp_debug_list_free(bgp_debug_neighbor_events_peers
);
762 if (vty
->node
== CONFIG_NODE
)
763 DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
765 TERM_DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
766 vty_out(vty
, "BGP neighbor-events debugging is on\n");
771 DEFUN (debug_bgp_neighbor_events_peer
,
772 debug_bgp_neighbor_events_peer_cmd
,
773 "debug bgp neighbor-events <A.B.C.D|X:X::X:X|WORD>",
776 "BGP Neighbor Events\n"
777 "BGP neighbor IP address to debug\n"
778 "BGP IPv6 neighbor to debug\n"
779 "BGP neighbor on interface to debug\n")
782 const char *host
= argv
[idx_peer
]->arg
;
784 if (!bgp_debug_neighbor_events_peers
)
785 bgp_debug_neighbor_events_peers
= list_new();
787 if (bgp_debug_list_has_entry(bgp_debug_neighbor_events_peers
, host
,
790 "BGP neighbor-events debugging is already enabled for %s\n",
795 bgp_debug_list_add_entry(bgp_debug_neighbor_events_peers
, host
, NULL
);
797 if (vty
->node
== CONFIG_NODE
)
798 DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
800 TERM_DEBUG_ON(neighbor_events
, NEIGHBOR_EVENTS
);
801 vty_out(vty
, "BGP neighbor-events debugging is on for %s\n",
807 DEFUN (no_debug_bgp_neighbor_events
,
808 no_debug_bgp_neighbor_events_cmd
,
809 "no debug bgp neighbor-events",
815 bgp_debug_list_free(bgp_debug_neighbor_events_peers
);
817 if (vty
->node
== CONFIG_NODE
)
818 DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
820 TERM_DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
821 vty_out(vty
, "BGP neighbor-events debugging is off\n");
826 DEFUN (no_debug_bgp_neighbor_events_peer
,
827 no_debug_bgp_neighbor_events_peer_cmd
,
828 "no debug bgp neighbor-events <A.B.C.D|X:X::X:X|WORD>",
833 "BGP neighbor IP address to debug\n"
834 "BGP IPv6 neighbor to debug\n"
835 "BGP neighbor on interface to debug\n")
839 const char *host
= argv
[idx_peer
]->arg
;
841 if (bgp_debug_neighbor_events_peers
842 && !list_isempty(bgp_debug_neighbor_events_peers
)) {
843 found_peer
= bgp_debug_list_remove_entry(
844 bgp_debug_neighbor_events_peers
, host
, NULL
);
846 if (list_isempty(bgp_debug_neighbor_events_peers
)) {
847 if (vty
->node
== CONFIG_NODE
)
848 DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
850 TERM_DEBUG_OFF(neighbor_events
,
856 vty_out(vty
, "BGP neighbor-events debugging is off for %s\n",
860 "BGP neighbor-events debugging was not enabled for %s\n",
867 DEFUN (debug_bgp_nht
,
872 "BGP nexthop tracking events\n")
874 if (vty
->node
== CONFIG_NODE
)
877 TERM_DEBUG_ON(nht
, NHT
);
878 vty_out(vty
, "BGP nexthop tracking debugging is on\n");
883 DEFUN (no_debug_bgp_nht
,
884 no_debug_bgp_nht_cmd
,
889 "BGP nexthop tracking events\n")
891 if (vty
->node
== CONFIG_NODE
)
894 TERM_DEBUG_OFF(nht
, NHT
);
895 vty_out(vty
, "BGP nexthop tracking debugging is off\n");
900 /* debug bgp keepalives */
901 DEFUN (debug_bgp_keepalive
,
902 debug_bgp_keepalive_cmd
,
903 "debug bgp keepalives",
908 bgp_debug_list_free(bgp_debug_keepalive_peers
);
910 if (vty
->node
== CONFIG_NODE
)
911 DEBUG_ON(keepalive
, KEEPALIVE
);
913 TERM_DEBUG_ON(keepalive
, KEEPALIVE
);
914 vty_out(vty
, "BGP keepalives debugging is on\n");
919 DEFUN (debug_bgp_keepalive_peer
,
920 debug_bgp_keepalive_peer_cmd
,
921 "debug bgp keepalives <A.B.C.D|X:X::X:X|WORD>",
925 "BGP IPv4 neighbor to debug\n"
926 "BGP IPv6 neighbor to debug\n"
927 "BGP neighbor on interface to debug\n")
930 const char *host
= argv
[idx_peer
]->arg
;
932 if (!bgp_debug_keepalive_peers
)
933 bgp_debug_keepalive_peers
= list_new();
935 if (bgp_debug_list_has_entry(bgp_debug_keepalive_peers
, host
, NULL
)) {
937 "BGP keepalive debugging is already enabled for %s\n",
942 bgp_debug_list_add_entry(bgp_debug_keepalive_peers
, host
, NULL
);
944 if (vty
->node
== CONFIG_NODE
)
945 DEBUG_ON(keepalive
, KEEPALIVE
);
947 TERM_DEBUG_ON(keepalive
, KEEPALIVE
);
948 vty_out(vty
, "BGP keepalives debugging is on for %s\n", host
);
953 DEFUN (no_debug_bgp_keepalive
,
954 no_debug_bgp_keepalive_cmd
,
955 "no debug bgp keepalives",
961 bgp_debug_list_free(bgp_debug_keepalive_peers
);
963 if (vty
->node
== CONFIG_NODE
)
964 DEBUG_OFF(keepalive
, KEEPALIVE
);
966 TERM_DEBUG_OFF(keepalive
, KEEPALIVE
);
967 vty_out(vty
, "BGP keepalives debugging is off\n");
972 DEFUN (no_debug_bgp_keepalive_peer
,
973 no_debug_bgp_keepalive_peer_cmd
,
974 "no debug bgp keepalives <A.B.C.D|X:X::X:X|WORD>",
979 "BGP neighbor IP address to debug\n"
980 "BGP IPv6 neighbor to debug\n"
981 "BGP neighbor on interface to debug\n")
985 const char *host
= argv
[idx_peer
]->arg
;
987 if (bgp_debug_keepalive_peers
988 && !list_isempty(bgp_debug_keepalive_peers
)) {
989 found_peer
= bgp_debug_list_remove_entry(
990 bgp_debug_keepalive_peers
, host
, NULL
);
992 if (list_isempty(bgp_debug_keepalive_peers
)) {
993 if (vty
->node
== CONFIG_NODE
)
994 DEBUG_OFF(keepalive
, KEEPALIVE
);
996 TERM_DEBUG_OFF(keepalive
, KEEPALIVE
);
1001 vty_out(vty
, "BGP keepalives debugging is off for %s\n", host
);
1004 "BGP keepalives debugging was not enabled for %s\n",
1010 /* debug bgp bestpath */
1011 DEFUN (debug_bgp_bestpath_prefix
,
1012 debug_bgp_bestpath_prefix_cmd
,
1013 "debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
1020 struct prefix
*argv_p
;
1021 int idx_ipv4_ipv6_prefixlen
= 3;
1023 argv_p
= prefix_new();
1024 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1027 if (!bgp_debug_bestpath_prefixes
)
1028 bgp_debug_bestpath_prefixes
= list_new();
1030 if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes
, NULL
,
1033 "BGP bestpath debugging is already enabled for %s\n",
1034 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1038 bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes
, NULL
, argv_p
);
1040 if (vty
->node
== CONFIG_NODE
) {
1041 DEBUG_ON(bestpath
, BESTPATH
);
1043 TERM_DEBUG_ON(bestpath
, BESTPATH
);
1044 vty_out(vty
, "BGP bestpath debugging is on for %s\n",
1045 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1051 DEFUN (no_debug_bgp_bestpath_prefix
,
1052 no_debug_bgp_bestpath_prefix_cmd
,
1053 "no debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
1061 int idx_ipv4_ipv6_prefixlen
= 4;
1062 struct prefix
*argv_p
;
1063 int found_prefix
= 0;
1065 argv_p
= prefix_new();
1066 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1069 if (bgp_debug_bestpath_prefixes
1070 && !list_isempty(bgp_debug_bestpath_prefixes
)) {
1071 found_prefix
= bgp_debug_list_remove_entry(
1072 bgp_debug_bestpath_prefixes
, NULL
, argv_p
);
1074 if (list_isempty(bgp_debug_bestpath_prefixes
)) {
1075 if (vty
->node
== CONFIG_NODE
) {
1076 DEBUG_OFF(bestpath
, BESTPATH
);
1078 TERM_DEBUG_OFF(bestpath
, BESTPATH
);
1080 "BGP bestpath debugging (per prefix) is off\n");
1086 vty_out(vty
, "BGP bestpath debugging is off for %s\n",
1087 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1089 vty_out(vty
, "BGP bestpath debugging was not enabled for %s\n",
1090 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1095 DEFUN (no_debug_bgp_bestpath
,
1096 no_debug_bgp_bestpath_cmd
,
1097 "no debug bgp bestpath",
1103 bgp_debug_list_free(bgp_debug_bestpath_prefixes
);
1105 if (vty
->node
== CONFIG_NODE
)
1106 DEBUG_OFF(bestpath
, BESTPATH
);
1108 TERM_DEBUG_OFF(bestpath
, BESTPATH
);
1109 vty_out(vty
, "BGP bestpath debugging is off\n");
1114 /* debug bgp updates */
1115 DEFUN (debug_bgp_update
,
1116 debug_bgp_update_cmd
,
1117 "debug bgp updates",
1122 bgp_debug_list_free(bgp_debug_update_in_peers
);
1123 bgp_debug_list_free(bgp_debug_update_out_peers
);
1124 bgp_debug_list_free(bgp_debug_update_prefixes
);
1126 if (vty
->node
== CONFIG_NODE
) {
1127 DEBUG_ON(update
, UPDATE_IN
);
1128 DEBUG_ON(update
, UPDATE_OUT
);
1130 TERM_DEBUG_ON(update
, UPDATE_IN
);
1131 TERM_DEBUG_ON(update
, UPDATE_OUT
);
1132 vty_out(vty
, "BGP updates debugging is on\n");
1137 DEFUN (debug_bgp_update_direct
,
1138 debug_bgp_update_direct_cmd
,
1139 "debug bgp updates <in|out>",
1144 "Outbound updates\n")
1148 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1149 bgp_debug_list_free(bgp_debug_update_in_peers
);
1151 bgp_debug_list_free(bgp_debug_update_out_peers
);
1153 if (vty
->node
== CONFIG_NODE
) {
1154 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1155 DEBUG_ON(update
, UPDATE_IN
);
1157 DEBUG_ON(update
, UPDATE_OUT
);
1159 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0) {
1160 TERM_DEBUG_ON(update
, UPDATE_IN
);
1161 vty_out(vty
, "BGP updates debugging is on (inbound)\n");
1163 TERM_DEBUG_ON(update
, UPDATE_OUT
);
1165 "BGP updates debugging is on (outbound)\n");
1171 DEFUN (debug_bgp_update_direct_peer
,
1172 debug_bgp_update_direct_peer_cmd
,
1173 "debug bgp updates <in|out> <A.B.C.D|X:X::X:X|WORD>",
1178 "Outbound updates\n"
1179 "BGP neighbor IP address to debug\n"
1180 "BGP IPv6 neighbor to debug\n"
1181 "BGP neighbor on interface to debug\n")
1185 const char *host
= argv
[idx_peer
]->arg
;
1188 if (!bgp_debug_update_in_peers
)
1189 bgp_debug_update_in_peers
= list_new();
1191 if (!bgp_debug_update_out_peers
)
1192 bgp_debug_update_out_peers
= list_new();
1194 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1200 if (bgp_debug_list_has_entry(bgp_debug_update_in_peers
, host
,
1203 "BGP inbound update debugging is already enabled for %s\n",
1210 if (bgp_debug_list_has_entry(bgp_debug_update_out_peers
, host
,
1213 "BGP outbound update debugging is already enabled for %s\n",
1220 bgp_debug_list_add_entry(bgp_debug_update_in_peers
, host
, NULL
);
1223 struct peer_af
*paf
;
1226 bgp_debug_list_add_entry(bgp_debug_update_out_peers
, host
,
1228 peer
= bgp_find_peer(vty
, host
);
1231 for (afidx
= BGP_AF_START
; afidx
< BGP_AF_MAX
;
1233 paf
= peer
->peer_af_array
[afidx
];
1235 if (PAF_SUBGRP(paf
)) {
1245 if (vty
->node
== CONFIG_NODE
) {
1247 DEBUG_ON(update
, UPDATE_IN
);
1249 DEBUG_ON(update
, UPDATE_OUT
);
1252 TERM_DEBUG_ON(update
, UPDATE_IN
);
1254 "BGP updates debugging is on (inbound) for %s\n",
1255 argv
[idx_peer
]->arg
);
1257 TERM_DEBUG_ON(update
, UPDATE_OUT
);
1259 "BGP updates debugging is on (outbound) for %s\n",
1260 argv
[idx_peer
]->arg
);
1266 DEFUN (no_debug_bgp_update_direct
,
1267 no_debug_bgp_update_direct_cmd
,
1268 "no debug bgp updates <in|out>",
1274 "Outbound updates\n")
1277 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0) {
1278 bgp_debug_list_free(bgp_debug_update_in_peers
);
1280 if (vty
->node
== CONFIG_NODE
) {
1281 DEBUG_OFF(update
, UPDATE_IN
);
1283 TERM_DEBUG_OFF(update
, UPDATE_IN
);
1285 "BGP updates debugging is off (inbound)\n");
1288 bgp_debug_list_free(bgp_debug_update_out_peers
);
1290 if (vty
->node
== CONFIG_NODE
) {
1291 DEBUG_OFF(update
, UPDATE_OUT
);
1293 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
1295 "BGP updates debugging is off (outbound)\n");
1302 DEFUN (no_debug_bgp_update_direct_peer
,
1303 no_debug_bgp_update_direct_peer_cmd
,
1304 "no debug bgp updates <in|out> <A.B.C.D|X:X::X:X|WORD>",
1310 "Outbound updates\n"
1311 "BGP neighbor IP address to debug\n"
1312 "BGP IPv6 neighbor to debug\n"
1313 "BGP neighbor on interface to debug\n")
1319 const char *host
= argv
[idx_peer
]->arg
;
1321 if (strncmp("i", argv
[idx_in_out
]->arg
, 1) == 0)
1326 if (inbound
&& bgp_debug_update_in_peers
1327 && !list_isempty(bgp_debug_update_in_peers
)) {
1328 found_peer
= bgp_debug_list_remove_entry(
1329 bgp_debug_update_in_peers
, host
, NULL
);
1331 if (list_isempty(bgp_debug_update_in_peers
)) {
1332 if (vty
->node
== CONFIG_NODE
)
1333 DEBUG_OFF(update
, UPDATE_IN
);
1335 TERM_DEBUG_OFF(update
, UPDATE_IN
);
1337 "BGP updates debugging (inbound) is off\n");
1342 if (!inbound
&& bgp_debug_update_out_peers
1343 && !list_isempty(bgp_debug_update_out_peers
)) {
1344 found_peer
= bgp_debug_list_remove_entry(
1345 bgp_debug_update_out_peers
, host
, NULL
);
1347 if (list_isempty(bgp_debug_update_out_peers
)) {
1348 if (vty
->node
== CONFIG_NODE
)
1349 DEBUG_OFF(update
, UPDATE_OUT
);
1351 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
1353 "BGP updates debugging (outbound) is off\n");
1358 struct peer_af
*paf
;
1360 peer
= bgp_find_peer(vty
, host
);
1363 for (afidx
= BGP_AF_START
; afidx
< BGP_AF_MAX
;
1365 paf
= peer
->peer_af_array
[afidx
];
1367 if (PAF_SUBGRP(paf
)) {
1368 UPDGRP_PEER_DBG_DIS(
1380 "BGP updates debugging (inbound) is off for %s\n",
1384 "BGP updates debugging (outbound) is off for %s\n",
1388 "BGP updates debugging (inbound) was not enabled for %s\n",
1392 "BGP updates debugging (outbound) was not enabled for %s\n",
1398 #ifndef VTYSH_EXTRACT_PL
1399 #include "bgpd/bgp_debug_clippy.c"
1402 DEFPY (debug_bgp_update_prefix_afi_safi
,
1403 debug_bgp_update_prefix_afi_safi_cmd
,
1404 "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>>",
1408 "Specify a prefix to debug\n"
1412 EVPN_TYPE_2_HELP_STR
1413 EVPN_TYPE_2_HELP_STR
1414 MAC_STR MAC_STR MAC_STR
1418 EVPN_TYPE_3_HELP_STR
1419 EVPN_TYPE_3_HELP_STR
1423 EVPN_TYPE_5_HELP_STR
1424 EVPN_TYPE_5_HELP_STR
1429 struct prefix
*argv_p
;
1430 int ret
= CMD_SUCCESS
;
1432 argv_p
= prefix_new();
1434 ret
= bgp_debug_parse_evpn_prefix(vty
, argv
, argc
, &argv_p
);
1435 if (ret
!= CMD_SUCCESS
) {
1436 prefix_free(&argv_p
);
1440 if (!bgp_debug_update_prefixes
)
1441 bgp_debug_update_prefixes
= list_new();
1443 if (bgp_debug_list_has_entry(bgp_debug_update_prefixes
, NULL
, argv_p
)) {
1445 "BGP updates debugging is already enabled for %pFX\n",
1447 prefix_free(&argv_p
);
1451 bgp_debug_list_add_entry(bgp_debug_update_prefixes
, NULL
, argv_p
);
1453 if (vty
->node
== CONFIG_NODE
) {
1454 DEBUG_ON(update
, UPDATE_PREFIX
);
1456 TERM_DEBUG_ON(update
, UPDATE_PREFIX
);
1457 vty_out(vty
, "BGP updates debugging is on for %pFX\n", argv_p
);
1460 prefix_free(&argv_p
);
1465 DEFPY (no_debug_bgp_update_prefix_afi_safi
,
1466 no_debug_bgp_update_prefix_afi_safi_cmd
,
1467 "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>>",
1472 "Specify a prefix to debug\n"
1476 EVPN_TYPE_2_HELP_STR
1477 EVPN_TYPE_2_HELP_STR
1478 MAC_STR MAC_STR MAC_STR
1482 EVPN_TYPE_3_HELP_STR
1483 EVPN_TYPE_3_HELP_STR
1487 EVPN_TYPE_5_HELP_STR
1488 EVPN_TYPE_5_HELP_STR
1493 struct prefix
*argv_p
;
1494 bool found_prefix
= false;
1495 int ret
= CMD_SUCCESS
;
1497 argv_p
= prefix_new();
1499 ret
= bgp_debug_parse_evpn_prefix(vty
, argv
, argc
, &argv_p
);
1500 if (ret
!= CMD_SUCCESS
) {
1501 prefix_free(&argv_p
);
1505 if (bgp_debug_update_prefixes
1506 && !list_isempty(bgp_debug_update_prefixes
)) {
1507 found_prefix
= bgp_debug_list_remove_entry(
1508 bgp_debug_update_prefixes
, NULL
, argv_p
);
1510 if (list_isempty(bgp_debug_update_prefixes
)) {
1511 if (vty
->node
== CONFIG_NODE
) {
1512 DEBUG_OFF(update
, UPDATE_PREFIX
);
1514 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
1516 "BGP updates debugging (per prefix) is off\n");
1522 vty_out(vty
, "BGP updates debugging is off for %pFX\n", argv_p
);
1524 vty_out(vty
, "BGP updates debugging was not enabled for %pFX\n",
1527 prefix_free(&argv_p
);
1533 DEFUN (debug_bgp_update_prefix
,
1534 debug_bgp_update_prefix_cmd
,
1535 "debug bgp updates prefix <A.B.C.D/M|X:X::X:X/M>",
1539 "Specify a prefix to debug\n"
1543 int idx_ipv4_ipv6_prefixlen
= 4;
1544 struct prefix
*argv_p
;
1546 argv_p
= prefix_new();
1547 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1550 if (!bgp_debug_update_prefixes
)
1551 bgp_debug_update_prefixes
= list_new();
1553 if (bgp_debug_list_has_entry(bgp_debug_update_prefixes
, NULL
, argv_p
)) {
1555 "BGP updates debugging is already enabled for %s\n",
1556 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1560 bgp_debug_list_add_entry(bgp_debug_update_prefixes
, NULL
, argv_p
);
1562 if (vty
->node
== CONFIG_NODE
) {
1563 DEBUG_ON(update
, UPDATE_PREFIX
);
1565 TERM_DEBUG_ON(update
, UPDATE_PREFIX
);
1566 vty_out(vty
, "BGP updates debugging is on for %s\n",
1567 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1573 DEFUN (no_debug_bgp_update_prefix
,
1574 no_debug_bgp_update_prefix_cmd
,
1575 "no debug bgp updates prefix <A.B.C.D/M|X:X::X:X/M>",
1580 "Specify a prefix to debug\n"
1584 int idx_ipv4_ipv6_prefixlen
= 5;
1585 struct prefix
*argv_p
;
1586 int found_prefix
= 0;
1588 argv_p
= prefix_new();
1589 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1592 if (bgp_debug_update_prefixes
1593 && !list_isempty(bgp_debug_update_prefixes
)) {
1594 found_prefix
= bgp_debug_list_remove_entry(
1595 bgp_debug_update_prefixes
, NULL
, argv_p
);
1597 if (list_isempty(bgp_debug_update_prefixes
)) {
1598 if (vty
->node
== CONFIG_NODE
) {
1599 DEBUG_OFF(update
, UPDATE_PREFIX
);
1601 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
1603 "BGP updates debugging (per prefix) is off\n");
1609 vty_out(vty
, "BGP updates debugging is off for %s\n",
1610 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1612 vty_out(vty
, "BGP updates debugging was not enabled for %s\n",
1613 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1618 DEFUN (no_debug_bgp_update
,
1619 no_debug_bgp_update_cmd
,
1620 "no debug bgp updates",
1626 struct listnode
*ln
;
1629 bgp_debug_list_free(bgp_debug_update_in_peers
);
1630 bgp_debug_list_free(bgp_debug_update_out_peers
);
1631 bgp_debug_list_free(bgp_debug_update_prefixes
);
1633 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, ln
, bgp
))
1634 bgp_debug_clear_updgrp_update_dbg(bgp
);
1636 if (vty
->node
== CONFIG_NODE
) {
1637 DEBUG_OFF(update
, UPDATE_IN
);
1638 DEBUG_OFF(update
, UPDATE_OUT
);
1639 DEBUG_OFF(update
, UPDATE_PREFIX
);
1641 TERM_DEBUG_OFF(update
, UPDATE_IN
);
1642 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
1643 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
1644 vty_out(vty
, "BGP updates debugging is off\n");
1649 /* debug bgp zebra */
1650 DEFUN (debug_bgp_zebra
,
1651 debug_bgp_zebra_cmd
,
1655 "BGP Zebra messages\n")
1657 if (vty
->node
== CONFIG_NODE
)
1658 DEBUG_ON(zebra
, ZEBRA
);
1660 TERM_DEBUG_ON(zebra
, ZEBRA
);
1661 vty_out(vty
, "BGP zebra debugging is on\n");
1666 DEFUN (debug_bgp_graceful_restart
,
1667 debug_bgp_graceful_restart_cmd
,
1668 "debug bgp graceful-restart",
1673 if (vty
->node
== CONFIG_NODE
) {
1674 DEBUG_ON(graceful_restart
, GRACEFUL_RESTART
);
1676 TERM_DEBUG_ON(graceful_restart
, GRACEFUL_RESTART
);
1677 vty_out(vty
, "BGP Graceful Restart debugging is on\n");
1683 DEFUN (debug_bgp_zebra_prefix
,
1684 debug_bgp_zebra_prefix_cmd
,
1685 "debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>",
1688 "BGP Zebra messages\n"
1689 "Specify a prefix to debug\n"
1693 int idx_ipv4_ipv6_prefixlen
= 4;
1694 struct prefix
*argv_p
;
1696 argv_p
= prefix_new();
1697 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1700 if (!bgp_debug_zebra_prefixes
)
1701 bgp_debug_zebra_prefixes
= list_new();
1703 if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes
, NULL
, argv_p
)) {
1704 vty_out(vty
, "BGP zebra debugging is already enabled for %s\n",
1705 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1709 bgp_debug_list_add_entry(bgp_debug_zebra_prefixes
, NULL
, argv_p
);
1711 if (vty
->node
== CONFIG_NODE
)
1712 DEBUG_ON(zebra
, ZEBRA
);
1714 TERM_DEBUG_ON(zebra
, ZEBRA
);
1715 vty_out(vty
, "BGP zebra debugging is on for %s\n",
1716 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1722 DEFUN (no_debug_bgp_zebra
,
1723 no_debug_bgp_zebra_cmd
,
1724 "no debug bgp zebra",
1728 "BGP Zebra messages\n")
1730 bgp_debug_list_free(bgp_debug_zebra_prefixes
);
1732 if (vty
->node
== CONFIG_NODE
)
1733 DEBUG_OFF(zebra
, ZEBRA
);
1735 TERM_DEBUG_OFF(zebra
, ZEBRA
);
1736 vty_out(vty
, "BGP zebra debugging is off\n");
1741 DEFUN (no_debug_bgp_graceful_restart
,
1742 no_debug_bgp_graceful_restart_cmd
,
1743 "no debug bgp graceful-restart",
1749 if (vty
->node
== CONFIG_NODE
) {
1750 DEBUG_OFF(graceful_restart
, GRACEFUL_RESTART
);
1752 TERM_DEBUG_OFF(graceful_restart
, GRACEFUL_RESTART
);
1753 vty_out(vty
, "BGP Graceful Restart debugging is off\n");
1758 DEFUN (no_debug_bgp_zebra_prefix
,
1759 no_debug_bgp_zebra_prefix_cmd
,
1760 "no debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>",
1764 "BGP Zebra messages\n"
1765 "Specify a prefix to debug\n"
1769 int idx_ipv4_ipv6_prefixlen
= 5;
1770 struct prefix
*argv_p
;
1771 int found_prefix
= 0;
1773 argv_p
= prefix_new();
1774 (void)str2prefix(argv
[idx_ipv4_ipv6_prefixlen
]->arg
, argv_p
);
1777 if (bgp_debug_zebra_prefixes
1778 && !list_isempty(bgp_debug_zebra_prefixes
)) {
1779 found_prefix
= bgp_debug_list_remove_entry(
1780 bgp_debug_zebra_prefixes
, NULL
, argv_p
);
1782 if (list_isempty(bgp_debug_zebra_prefixes
)) {
1783 if (vty
->node
== CONFIG_NODE
)
1784 DEBUG_OFF(zebra
, ZEBRA
);
1786 TERM_DEBUG_OFF(zebra
, ZEBRA
);
1787 vty_out(vty
, "BGP zebra debugging is off\n");
1793 vty_out(vty
, "BGP zebra debugging is off for %s\n",
1794 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1796 vty_out(vty
, "BGP zebra debugging was not enabled for %s\n",
1797 argv
[idx_ipv4_ipv6_prefixlen
]->arg
);
1802 DEFUN (debug_bgp_allow_martians
,
1803 debug_bgp_allow_martians_cmd
,
1804 "debug bgp allow-martians",
1807 "BGP allow martian next hops\n")
1809 if (vty
->node
== CONFIG_NODE
)
1810 DEBUG_ON(allow_martians
, ALLOW_MARTIANS
);
1812 TERM_DEBUG_ON(allow_martians
, ALLOW_MARTIANS
);
1813 vty_out(vty
, "BGP allow_martian next hop debugging is on\n");
1818 DEFUN (no_debug_bgp_allow_martians
,
1819 no_debug_bgp_allow_martians_cmd
,
1820 "no debug bgp allow-martians",
1824 "BGP allow martian next hops\n")
1826 if (vty
->node
== CONFIG_NODE
)
1827 DEBUG_OFF(allow_martians
, ALLOW_MARTIANS
);
1829 TERM_DEBUG_OFF(allow_martians
, ALLOW_MARTIANS
);
1830 vty_out(vty
, "BGP allow martian next hop debugging is off\n");
1836 /* debug bgp update-groups */
1837 DEFUN (debug_bgp_update_groups
,
1838 debug_bgp_update_groups_cmd
,
1839 "debug bgp update-groups",
1842 "BGP update-groups\n")
1844 if (vty
->node
== CONFIG_NODE
)
1845 DEBUG_ON(update_groups
, UPDATE_GROUPS
);
1847 TERM_DEBUG_ON(update_groups
, UPDATE_GROUPS
);
1848 vty_out(vty
, "BGP update-groups debugging is on\n");
1853 DEFUN (no_debug_bgp_update_groups
,
1854 no_debug_bgp_update_groups_cmd
,
1855 "no debug bgp update-groups",
1859 "BGP update-groups\n")
1861 if (vty
->node
== CONFIG_NODE
)
1862 DEBUG_OFF(update_groups
, UPDATE_GROUPS
);
1864 TERM_DEBUG_OFF(update_groups
, UPDATE_GROUPS
);
1865 vty_out(vty
, "BGP update-groups debugging is off\n");
1870 DEFUN (debug_bgp_vpn
,
1872 "debug bgp vpn <leak-from-vrf|leak-to-vrf|rmap-event|label>",
1876 "leaked from vrf to vpn\n"
1877 "leaked to vrf from vpn\n"
1878 "route-map updates\n"
1883 if (argv_find(argv
, argc
, "leak-from-vrf", &idx
)) {
1884 if (vty
->node
== CONFIG_NODE
)
1885 DEBUG_ON(vpn
, VPN_LEAK_FROM_VRF
);
1887 TERM_DEBUG_ON(vpn
, VPN_LEAK_FROM_VRF
);
1888 } else if (argv_find(argv
, argc
, "leak-to-vrf", &idx
)) {
1889 if (vty
->node
== CONFIG_NODE
)
1890 DEBUG_ON(vpn
, VPN_LEAK_TO_VRF
);
1892 TERM_DEBUG_ON(vpn
, VPN_LEAK_TO_VRF
);
1893 } else if (argv_find(argv
, argc
, "rmap-event", &idx
)) {
1894 if (vty
->node
== CONFIG_NODE
)
1895 DEBUG_ON(vpn
, VPN_LEAK_RMAP_EVENT
);
1897 TERM_DEBUG_ON(vpn
, VPN_LEAK_RMAP_EVENT
);
1898 } else if (argv_find(argv
, argc
, "label", &idx
)) {
1899 if (vty
->node
== CONFIG_NODE
)
1900 DEBUG_ON(vpn
, VPN_LEAK_LABEL
);
1902 TERM_DEBUG_ON(vpn
, VPN_LEAK_LABEL
);
1904 vty_out(vty
, "%% unknown debug bgp vpn keyword\n");
1905 return CMD_WARNING_CONFIG_FAILED
;
1908 if (vty
->node
!= CONFIG_NODE
)
1909 vty_out(vty
, "enabled debug bgp vpn %s\n", argv
[idx
]->text
);
1914 DEFUN (no_debug_bgp_vpn
,
1915 no_debug_bgp_vpn_cmd
,
1916 "no debug bgp vpn <leak-from-vrf|leak-to-vrf|rmap-event|label>",
1921 "leaked from vrf to vpn\n"
1922 "leaked to vrf from vpn\n"
1923 "route-map updates\n"
1928 if (argv_find(argv
, argc
, "leak-from-vrf", &idx
)) {
1929 if (vty
->node
== CONFIG_NODE
)
1930 DEBUG_OFF(vpn
, VPN_LEAK_FROM_VRF
);
1932 TERM_DEBUG_OFF(vpn
, VPN_LEAK_FROM_VRF
);
1934 } else if (argv_find(argv
, argc
, "leak-to-vrf", &idx
)) {
1935 if (vty
->node
== CONFIG_NODE
)
1936 DEBUG_OFF(vpn
, VPN_LEAK_TO_VRF
);
1938 TERM_DEBUG_OFF(vpn
, VPN_LEAK_TO_VRF
);
1939 } else if (argv_find(argv
, argc
, "rmap-event", &idx
)) {
1940 if (vty
->node
== CONFIG_NODE
)
1941 DEBUG_OFF(vpn
, VPN_LEAK_RMAP_EVENT
);
1943 TERM_DEBUG_OFF(vpn
, VPN_LEAK_RMAP_EVENT
);
1944 } else if (argv_find(argv
, argc
, "label", &idx
)) {
1945 if (vty
->node
== CONFIG_NODE
)
1946 DEBUG_OFF(vpn
, VPN_LEAK_LABEL
);
1948 TERM_DEBUG_OFF(vpn
, VPN_LEAK_LABEL
);
1950 vty_out(vty
, "%% unknown debug bgp vpn keyword\n");
1951 return CMD_WARNING_CONFIG_FAILED
;
1954 if (vty
->node
!= CONFIG_NODE
)
1955 vty_out(vty
, "disabled debug bgp vpn %s\n", argv
[idx
]->text
);
1960 DEFUN (debug_bgp_pbr
,
1962 "debug bgp pbr [error]",
1965 "BGP policy based routing\n"
1970 if (argv_find(argv
, argc
, "error", &idx
)) {
1971 if (vty
->node
== CONFIG_NODE
)
1972 DEBUG_ON(pbr
, PBR_ERROR
);
1974 TERM_DEBUG_ON(pbr
, PBR_ERROR
);
1975 vty_out(vty
, "BGP policy based routing error is on\n");
1979 if (vty
->node
== CONFIG_NODE
)
1982 TERM_DEBUG_ON(pbr
, PBR
);
1983 vty_out(vty
, "BGP policy based routing is on\n");
1988 DEFUN (no_debug_bgp_pbr
,
1989 no_debug_bgp_pbr_cmd
,
1990 "no debug bgp pbr [error]",
1994 "BGP policy based routing\n"
1999 if (argv_find(argv
, argc
, "error", &idx
)) {
2000 if (vty
->node
== CONFIG_NODE
)
2001 DEBUG_OFF(pbr
, PBR_ERROR
);
2003 TERM_DEBUG_OFF(pbr
, PBR_ERROR
);
2004 vty_out(vty
, "BGP policy based routing error is off\n");
2008 if (vty
->node
== CONFIG_NODE
)
2009 DEBUG_OFF(pbr
, PBR
);
2011 TERM_DEBUG_OFF(pbr
, PBR
);
2012 vty_out(vty
, "BGP policy based routing is off\n");
2017 DEFPY (debug_bgp_evpn_mh
,
2018 debug_bgp_evpn_mh_cmd
,
2019 "[no$no] debug bgp evpn mh <es$es|route$rt>",
2025 "Ethernet Segment debugging\n"
2026 "Route debugging\n")
2029 if (vty
->node
== CONFIG_NODE
) {
2031 DEBUG_OFF(evpn_mh
, EVPN_MH_ES
);
2033 DEBUG_ON(evpn_mh
, EVPN_MH_ES
);
2036 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_ES
);
2038 "BGP EVPN-MH ES debugging is off\n");
2040 TERM_DEBUG_ON(evpn_mh
, EVPN_MH_ES
);
2042 "BGP EVPN-MH ES debugging is on\n");
2047 if (vty
->node
== CONFIG_NODE
) {
2049 DEBUG_OFF(evpn_mh
, EVPN_MH_RT
);
2051 DEBUG_ON(evpn_mh
, EVPN_MH_RT
);
2054 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_RT
);
2056 "BGP EVPN-MH route debugging is off\n");
2058 TERM_DEBUG_ON(evpn_mh
, EVPN_MH_RT
);
2060 "BGP EVPN-MH route debugging is on\n");
2068 DEFUN (debug_bgp_labelpool
,
2069 debug_bgp_labelpool_cmd
,
2070 "debug bgp labelpool",
2075 if (vty
->node
== CONFIG_NODE
)
2076 DEBUG_ON(labelpool
, LABELPOOL
);
2078 TERM_DEBUG_ON(labelpool
, LABELPOOL
);
2080 if (vty
->node
!= CONFIG_NODE
)
2081 vty_out(vty
, "enabled debug bgp labelpool\n");
2086 DEFUN (no_debug_bgp_labelpool
,
2087 no_debug_bgp_labelpool_cmd
,
2088 "no debug bgp labelpool",
2094 if (vty
->node
== CONFIG_NODE
)
2095 DEBUG_OFF(labelpool
, LABELPOOL
);
2097 TERM_DEBUG_OFF(labelpool
, LABELPOOL
);
2100 if (vty
->node
!= CONFIG_NODE
)
2101 vty_out(vty
, "disabled debug bgp labelpool\n");
2106 DEFPY(debug_bgp_bfd
, debug_bgp_bfd_cmd
,
2107 "[no] debug bgp bfd",
2111 "Bidirection Forwarding Detection\n")
2113 if (vty
->node
== CONFIG_NODE
) {
2115 DEBUG_OFF(bfd
, BFD_LIB
);
2116 bfd_protocol_integration_set_debug(false);
2118 DEBUG_ON(bfd
, BFD_LIB
);
2119 bfd_protocol_integration_set_debug(true);
2123 TERM_DEBUG_OFF(bfd
, BFD_LIB
);
2124 bfd_protocol_integration_set_debug(false);
2126 TERM_DEBUG_ON(bfd
, BFD_LIB
);
2127 bfd_protocol_integration_set_debug(true);
2134 DEFUN (no_debug_bgp
,
2142 struct listnode
*ln
;
2144 bgp_debug_list_free(bgp_debug_neighbor_events_peers
);
2145 bgp_debug_list_free(bgp_debug_keepalive_peers
);
2146 bgp_debug_list_free(bgp_debug_update_in_peers
);
2147 bgp_debug_list_free(bgp_debug_update_out_peers
);
2148 bgp_debug_list_free(bgp_debug_update_prefixes
);
2149 bgp_debug_list_free(bgp_debug_bestpath_prefixes
);
2150 bgp_debug_list_free(bgp_debug_zebra_prefixes
);
2152 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, ln
, bgp
))
2153 bgp_debug_clear_updgrp_update_dbg(bgp
);
2155 TERM_DEBUG_OFF(keepalive
, KEEPALIVE
);
2156 TERM_DEBUG_OFF(update
, UPDATE_IN
);
2157 TERM_DEBUG_OFF(update
, UPDATE_OUT
);
2158 TERM_DEBUG_OFF(update
, UPDATE_PREFIX
);
2159 TERM_DEBUG_OFF(bestpath
, BESTPATH
);
2160 TERM_DEBUG_OFF(as4
, AS4
);
2161 TERM_DEBUG_OFF(as4
, AS4_SEGMENT
);
2162 TERM_DEBUG_OFF(neighbor_events
, NEIGHBOR_EVENTS
);
2163 TERM_DEBUG_OFF(zebra
, ZEBRA
);
2164 TERM_DEBUG_OFF(allow_martians
, ALLOW_MARTIANS
);
2165 TERM_DEBUG_OFF(nht
, NHT
);
2166 TERM_DEBUG_OFF(vpn
, VPN_LEAK_FROM_VRF
);
2167 TERM_DEBUG_OFF(vpn
, VPN_LEAK_TO_VRF
);
2168 TERM_DEBUG_OFF(vpn
, VPN_LEAK_RMAP_EVENT
);
2169 TERM_DEBUG_OFF(vpn
, VPN_LEAK_LABEL
);
2170 TERM_DEBUG_OFF(flowspec
, FLOWSPEC
);
2171 TERM_DEBUG_OFF(labelpool
, LABELPOOL
);
2172 TERM_DEBUG_OFF(pbr
, PBR
);
2173 TERM_DEBUG_OFF(pbr
, PBR_ERROR
);
2174 TERM_DEBUG_OFF(graceful_restart
, GRACEFUL_RESTART
);
2175 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_ES
);
2176 TERM_DEBUG_OFF(evpn_mh
, EVPN_MH_RT
);
2177 TERM_DEBUG_OFF(bfd
, BFD_LIB
);
2179 vty_out(vty
, "All possible debugging has been turned off\n");
2184 DEFUN_NOSH (show_debugging_bgp
,
2185 show_debugging_bgp_cmd
,
2186 "show debugging [bgp]",
2191 vty_out(vty
, "BGP debugging status:\n");
2193 if (BGP_DEBUG(as4
, AS4
))
2194 vty_out(vty
, " BGP as4 debugging is on\n");
2196 if (BGP_DEBUG(as4
, AS4_SEGMENT
))
2197 vty_out(vty
, " BGP as4 aspath segment debugging is on\n");
2199 if (BGP_DEBUG(bestpath
, BESTPATH
))
2200 bgp_debug_list_print(vty
, " BGP bestpath debugging is on",
2201 bgp_debug_bestpath_prefixes
);
2203 if (BGP_DEBUG(keepalive
, KEEPALIVE
))
2204 bgp_debug_list_print(vty
, " BGP keepalives debugging is on",
2205 bgp_debug_keepalive_peers
);
2207 if (BGP_DEBUG(neighbor_events
, NEIGHBOR_EVENTS
))
2208 bgp_debug_list_print(vty
,
2209 " BGP neighbor-events debugging is on",
2210 bgp_debug_neighbor_events_peers
);
2212 if (BGP_DEBUG(nht
, NHT
))
2213 vty_out(vty
, " BGP next-hop tracking debugging is on\n");
2215 if (BGP_DEBUG(update_groups
, UPDATE_GROUPS
))
2216 vty_out(vty
, " BGP update-groups debugging is on\n");
2218 if (BGP_DEBUG(update
, UPDATE_PREFIX
))
2219 bgp_debug_list_print(vty
, " BGP updates debugging is on",
2220 bgp_debug_update_prefixes
);
2222 if (BGP_DEBUG(update
, UPDATE_IN
))
2223 bgp_debug_list_print(vty
,
2224 " BGP updates debugging is on (inbound)",
2225 bgp_debug_update_in_peers
);
2227 if (BGP_DEBUG(update
, UPDATE_OUT
))
2228 bgp_debug_list_print(vty
,
2229 " BGP updates debugging is on (outbound)",
2230 bgp_debug_update_out_peers
);
2232 if (BGP_DEBUG(zebra
, ZEBRA
))
2233 bgp_debug_list_print(vty
, " BGP zebra debugging is on",
2234 bgp_debug_zebra_prefixes
);
2236 if (BGP_DEBUG(graceful_restart
, GRACEFUL_RESTART
))
2237 vty_out(vty
, " BGP graceful-restart debugging is on\n");
2239 if (BGP_DEBUG(allow_martians
, ALLOW_MARTIANS
))
2240 vty_out(vty
, " BGP allow martian next hop debugging is on\n");
2242 if (BGP_DEBUG(vpn
, VPN_LEAK_FROM_VRF
))
2244 " BGP route leak from vrf to vpn debugging is on\n");
2245 if (BGP_DEBUG(vpn
, VPN_LEAK_TO_VRF
))
2247 " BGP route leak to vrf from vpn debugging is on\n");
2248 if (BGP_DEBUG(vpn
, VPN_LEAK_RMAP_EVENT
))
2249 vty_out(vty
, " BGP vpn route-map event debugging is on\n");
2250 if (BGP_DEBUG(vpn
, VPN_LEAK_LABEL
))
2251 vty_out(vty
, " BGP vpn label event debugging is on\n");
2252 if (BGP_DEBUG(flowspec
, FLOWSPEC
))
2253 vty_out(vty
, " BGP flowspec debugging is on\n");
2254 if (BGP_DEBUG(labelpool
, LABELPOOL
))
2255 vty_out(vty
, " BGP labelpool debugging is on\n");
2257 if (BGP_DEBUG(pbr
, PBR
))
2258 vty_out(vty
, " BGP policy based routing debugging is on\n");
2259 if (BGP_DEBUG(pbr
, PBR_ERROR
))
2260 vty_out(vty
, " BGP policy based routing error debugging is on\n");
2262 if (BGP_DEBUG(evpn_mh
, EVPN_MH_ES
))
2263 vty_out(vty
, " BGP EVPN-MH ES debugging is on\n");
2264 if (BGP_DEBUG(evpn_mh
, EVPN_MH_RT
))
2265 vty_out(vty
, " BGP EVPN-MH route debugging is on\n");
2267 if (BGP_DEBUG(bfd
, BFD_LIB
))
2268 vty_out(vty
, " BGP BFD library debugging is on\n");
2274 static int bgp_config_write_debug(struct vty
*vty
)
2278 if (CONF_BGP_DEBUG(as4
, AS4
)) {
2279 vty_out(vty
, "debug bgp as4\n");
2283 if (CONF_BGP_DEBUG(as4
, AS4_SEGMENT
)) {
2284 vty_out(vty
, "debug bgp as4 segment\n");
2288 if (CONF_BGP_DEBUG(bestpath
, BESTPATH
)) {
2289 write
+= bgp_debug_list_conf_print(vty
, "debug bgp bestpath",
2290 bgp_debug_bestpath_prefixes
);
2293 if (CONF_BGP_DEBUG(keepalive
, KEEPALIVE
)) {
2294 write
+= bgp_debug_list_conf_print(vty
, "debug bgp keepalives",
2295 bgp_debug_keepalive_peers
);
2298 if (CONF_BGP_DEBUG(neighbor_events
, NEIGHBOR_EVENTS
)) {
2299 write
+= bgp_debug_list_conf_print(
2300 vty
, "debug bgp neighbor-events",
2301 bgp_debug_neighbor_events_peers
);
2304 if (CONF_BGP_DEBUG(nht
, NHT
)) {
2305 vty_out(vty
, "debug bgp nht\n");
2309 if (CONF_BGP_DEBUG(update_groups
, UPDATE_GROUPS
)) {
2310 vty_out(vty
, "debug bgp update-groups\n");
2314 if (CONF_BGP_DEBUG(update
, UPDATE_PREFIX
)) {
2315 write
+= bgp_debug_list_conf_print(vty
,
2316 "debug bgp updates prefix",
2317 bgp_debug_update_prefixes
);
2320 if (CONF_BGP_DEBUG(update
, UPDATE_IN
)) {
2321 write
+= bgp_debug_list_conf_print(vty
, "debug bgp updates in",
2322 bgp_debug_update_in_peers
);
2325 if (CONF_BGP_DEBUG(update
, UPDATE_OUT
)) {
2326 write
+= bgp_debug_list_conf_print(vty
, "debug bgp updates out",
2327 bgp_debug_update_out_peers
);
2330 if (CONF_BGP_DEBUG(zebra
, ZEBRA
)) {
2331 if (!bgp_debug_zebra_prefixes
2332 || list_isempty(bgp_debug_zebra_prefixes
)) {
2333 vty_out(vty
, "debug bgp zebra\n");
2336 write
+= bgp_debug_list_conf_print(
2337 vty
, "debug bgp zebra prefix",
2338 bgp_debug_zebra_prefixes
);
2342 if (CONF_BGP_DEBUG(allow_martians
, ALLOW_MARTIANS
)) {
2343 vty_out(vty
, "debug bgp allow-martians\n");
2347 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_FROM_VRF
)) {
2348 vty_out(vty
, "debug bgp vpn leak-from-vrf\n");
2351 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_TO_VRF
)) {
2352 vty_out(vty
, "debug bgp vpn leak-to-vrf\n");
2355 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_RMAP_EVENT
)) {
2356 vty_out(vty
, "debug bgp vpn rmap-event\n");
2359 if (CONF_BGP_DEBUG(vpn
, VPN_LEAK_LABEL
)) {
2360 vty_out(vty
, "debug bgp vpn label\n");
2363 if (CONF_BGP_DEBUG(flowspec
, FLOWSPEC
)) {
2364 vty_out(vty
, "debug bgp flowspec\n");
2367 if (CONF_BGP_DEBUG(labelpool
, LABELPOOL
)) {
2368 vty_out(vty
, "debug bgp labelpool\n");
2372 if (CONF_BGP_DEBUG(pbr
, PBR
)) {
2373 vty_out(vty
, "debug bgp pbr\n");
2376 if (CONF_BGP_DEBUG(pbr
, PBR_ERROR
)) {
2377 vty_out(vty
, "debug bgp pbr error\n");
2381 if (CONF_BGP_DEBUG(graceful_restart
, GRACEFUL_RESTART
)) {
2382 vty_out(vty
, "debug bgp graceful-restart\n");
2386 if (CONF_BGP_DEBUG(evpn_mh
, EVPN_MH_ES
)) {
2387 vty_out(vty
, "debug bgp evpn mh es\n");
2390 if (CONF_BGP_DEBUG(evpn_mh
, EVPN_MH_RT
)) {
2391 vty_out(vty
, "debug bgp evpn mh route\n");
2395 if (CONF_BGP_DEBUG(bfd
, BFD_LIB
)) {
2396 vty_out(vty
, "debug bgp bfd\n");
2403 static int bgp_config_write_debug(struct vty
*vty
);
2404 static struct cmd_node debug_node
= {
2408 .config_write
= bgp_config_write_debug
,
2411 void bgp_debug_init(void)
2413 install_node(&debug_node
);
2415 install_element(ENABLE_NODE
, &show_debugging_bgp_cmd
);
2417 install_element(ENABLE_NODE
, &debug_bgp_as4_cmd
);
2418 install_element(CONFIG_NODE
, &debug_bgp_as4_cmd
);
2419 install_element(ENABLE_NODE
, &debug_bgp_as4_segment_cmd
);
2420 install_element(CONFIG_NODE
, &debug_bgp_as4_segment_cmd
);
2422 install_element(ENABLE_NODE
, &debug_bgp_neighbor_events_cmd
);
2423 install_element(CONFIG_NODE
, &debug_bgp_neighbor_events_cmd
);
2424 install_element(ENABLE_NODE
, &debug_bgp_nht_cmd
);
2425 install_element(CONFIG_NODE
, &debug_bgp_nht_cmd
);
2426 install_element(ENABLE_NODE
, &debug_bgp_keepalive_cmd
);
2427 install_element(CONFIG_NODE
, &debug_bgp_keepalive_cmd
);
2428 install_element(ENABLE_NODE
, &debug_bgp_update_cmd
);
2429 install_element(CONFIG_NODE
, &debug_bgp_update_cmd
);
2430 install_element(ENABLE_NODE
, &debug_bgp_zebra_cmd
);
2431 install_element(CONFIG_NODE
, &debug_bgp_zebra_cmd
);
2432 install_element(ENABLE_NODE
, &debug_bgp_allow_martians_cmd
);
2433 install_element(CONFIG_NODE
, &debug_bgp_allow_martians_cmd
);
2434 install_element(ENABLE_NODE
, &debug_bgp_update_groups_cmd
);
2435 install_element(CONFIG_NODE
, &debug_bgp_update_groups_cmd
);
2436 install_element(ENABLE_NODE
, &debug_bgp_bestpath_prefix_cmd
);
2437 install_element(CONFIG_NODE
, &debug_bgp_bestpath_prefix_cmd
);
2439 install_element(ENABLE_NODE
, &debug_bgp_graceful_restart_cmd
);
2440 install_element(CONFIG_NODE
, &debug_bgp_graceful_restart_cmd
);
2442 /* debug bgp updates (in|out) */
2443 install_element(ENABLE_NODE
, &debug_bgp_update_direct_cmd
);
2444 install_element(CONFIG_NODE
, &debug_bgp_update_direct_cmd
);
2445 install_element(ENABLE_NODE
, &no_debug_bgp_update_direct_cmd
);
2446 install_element(CONFIG_NODE
, &no_debug_bgp_update_direct_cmd
);
2448 /* debug bgp updates (in|out) A.B.C.D */
2449 install_element(ENABLE_NODE
, &debug_bgp_update_direct_peer_cmd
);
2450 install_element(CONFIG_NODE
, &debug_bgp_update_direct_peer_cmd
);
2451 install_element(ENABLE_NODE
, &no_debug_bgp_update_direct_peer_cmd
);
2452 install_element(CONFIG_NODE
, &no_debug_bgp_update_direct_peer_cmd
);
2454 /* debug bgp updates prefix A.B.C.D/M */
2455 install_element(ENABLE_NODE
, &debug_bgp_update_prefix_cmd
);
2456 install_element(CONFIG_NODE
, &debug_bgp_update_prefix_cmd
);
2457 install_element(ENABLE_NODE
, &no_debug_bgp_update_prefix_cmd
);
2458 install_element(CONFIG_NODE
, &no_debug_bgp_update_prefix_cmd
);
2459 install_element(ENABLE_NODE
, &debug_bgp_update_prefix_afi_safi_cmd
);
2460 install_element(CONFIG_NODE
, &debug_bgp_update_prefix_afi_safi_cmd
);
2461 install_element(ENABLE_NODE
, &no_debug_bgp_update_prefix_afi_safi_cmd
);
2462 install_element(CONFIG_NODE
, &no_debug_bgp_update_prefix_afi_safi_cmd
);
2464 /* debug bgp zebra prefix A.B.C.D/M */
2465 install_element(ENABLE_NODE
, &debug_bgp_zebra_prefix_cmd
);
2466 install_element(CONFIG_NODE
, &debug_bgp_zebra_prefix_cmd
);
2467 install_element(ENABLE_NODE
, &no_debug_bgp_zebra_prefix_cmd
);
2468 install_element(CONFIG_NODE
, &no_debug_bgp_zebra_prefix_cmd
);
2470 install_element(ENABLE_NODE
, &no_debug_bgp_as4_cmd
);
2471 install_element(CONFIG_NODE
, &no_debug_bgp_as4_cmd
);
2472 install_element(ENABLE_NODE
, &no_debug_bgp_as4_segment_cmd
);
2473 install_element(CONFIG_NODE
, &no_debug_bgp_as4_segment_cmd
);
2475 /* debug bgp neighbor-events A.B.C.D */
2476 install_element(ENABLE_NODE
, &debug_bgp_neighbor_events_peer_cmd
);
2477 install_element(CONFIG_NODE
, &debug_bgp_neighbor_events_peer_cmd
);
2478 install_element(ENABLE_NODE
, &no_debug_bgp_neighbor_events_peer_cmd
);
2479 install_element(CONFIG_NODE
, &no_debug_bgp_neighbor_events_peer_cmd
);
2481 /* debug bgp keepalive A.B.C.D */
2482 install_element(ENABLE_NODE
, &debug_bgp_keepalive_peer_cmd
);
2483 install_element(CONFIG_NODE
, &debug_bgp_keepalive_peer_cmd
);
2484 install_element(ENABLE_NODE
, &no_debug_bgp_keepalive_peer_cmd
);
2485 install_element(CONFIG_NODE
, &no_debug_bgp_keepalive_peer_cmd
);
2487 install_element(ENABLE_NODE
, &no_debug_bgp_neighbor_events_cmd
);
2488 install_element(CONFIG_NODE
, &no_debug_bgp_neighbor_events_cmd
);
2489 install_element(ENABLE_NODE
, &no_debug_bgp_nht_cmd
);
2490 install_element(CONFIG_NODE
, &no_debug_bgp_nht_cmd
);
2491 install_element(ENABLE_NODE
, &no_debug_bgp_keepalive_cmd
);
2492 install_element(CONFIG_NODE
, &no_debug_bgp_keepalive_cmd
);
2493 install_element(ENABLE_NODE
, &no_debug_bgp_update_cmd
);
2494 install_element(CONFIG_NODE
, &no_debug_bgp_update_cmd
);
2495 install_element(ENABLE_NODE
, &no_debug_bgp_zebra_cmd
);
2496 install_element(CONFIG_NODE
, &no_debug_bgp_zebra_cmd
);
2497 install_element(ENABLE_NODE
, &no_debug_bgp_allow_martians_cmd
);
2498 install_element(CONFIG_NODE
, &no_debug_bgp_allow_martians_cmd
);
2499 install_element(ENABLE_NODE
, &no_debug_bgp_update_groups_cmd
);
2500 install_element(CONFIG_NODE
, &no_debug_bgp_update_groups_cmd
);
2501 install_element(ENABLE_NODE
, &no_debug_bgp_cmd
);
2502 install_element(ENABLE_NODE
, &no_debug_bgp_bestpath_cmd
);
2503 install_element(CONFIG_NODE
, &no_debug_bgp_bestpath_cmd
);
2504 install_element(ENABLE_NODE
, &no_debug_bgp_bestpath_prefix_cmd
);
2505 install_element(CONFIG_NODE
, &no_debug_bgp_bestpath_prefix_cmd
);
2507 install_element(ENABLE_NODE
, &no_debug_bgp_graceful_restart_cmd
);
2508 install_element(CONFIG_NODE
, &no_debug_bgp_graceful_restart_cmd
);
2510 install_element(ENABLE_NODE
, &debug_bgp_vpn_cmd
);
2511 install_element(CONFIG_NODE
, &debug_bgp_vpn_cmd
);
2512 install_element(ENABLE_NODE
, &no_debug_bgp_vpn_cmd
);
2513 install_element(CONFIG_NODE
, &no_debug_bgp_vpn_cmd
);
2515 install_element(ENABLE_NODE
, &debug_bgp_labelpool_cmd
);
2516 install_element(CONFIG_NODE
, &debug_bgp_labelpool_cmd
);
2517 install_element(ENABLE_NODE
, &no_debug_bgp_labelpool_cmd
);
2518 install_element(CONFIG_NODE
, &no_debug_bgp_labelpool_cmd
);
2521 install_element(ENABLE_NODE
, &debug_bgp_pbr_cmd
);
2522 install_element(CONFIG_NODE
, &debug_bgp_pbr_cmd
);
2523 install_element(ENABLE_NODE
, &no_debug_bgp_pbr_cmd
);
2524 install_element(CONFIG_NODE
, &no_debug_bgp_pbr_cmd
);
2526 install_element(ENABLE_NODE
, &debug_bgp_evpn_mh_cmd
);
2527 install_element(CONFIG_NODE
, &debug_bgp_evpn_mh_cmd
);
2530 install_element(ENABLE_NODE
, &debug_bgp_bfd_cmd
);
2531 install_element(CONFIG_NODE
, &debug_bgp_bfd_cmd
);
2534 /* Return true if this prefix is on the per_prefix_list of prefixes to debug
2535 * for BGP_DEBUG_TYPE
2537 static int bgp_debug_per_prefix(const struct prefix
*p
,
2538 unsigned long term_bgp_debug_type
,
2539 unsigned int BGP_DEBUG_TYPE
,
2540 struct list
*per_prefix_list
)
2542 struct bgp_debug_filter
*filter
;
2543 struct listnode
*node
, *nnode
;
2545 if (term_bgp_debug_type
& BGP_DEBUG_TYPE
) {
2546 /* We are debugging all prefixes so return true */
2547 if (!per_prefix_list
|| list_isempty(per_prefix_list
))
2554 for (ALL_LIST_ELEMENTS(per_prefix_list
, node
, nnode
,
2556 if (filter
->p
->prefixlen
== p
->prefixlen
2557 && prefix_match(filter
->p
, p
))
2567 /* Return true if this peer is on the per_peer_list of peers to debug
2568 * for BGP_DEBUG_TYPE
2570 static int bgp_debug_per_peer(char *host
, unsigned long term_bgp_debug_type
,
2571 unsigned int BGP_DEBUG_TYPE
,
2572 struct list
*per_peer_list
)
2574 struct bgp_debug_filter
*filter
;
2575 struct listnode
*node
, *nnode
;
2577 if (term_bgp_debug_type
& BGP_DEBUG_TYPE
) {
2578 /* We are debugging all peers so return true */
2579 if (!per_peer_list
|| list_isempty(per_peer_list
))
2586 for (ALL_LIST_ELEMENTS(per_peer_list
, node
, nnode
,
2588 if (strcmp(filter
->host
, host
) == 0)
2598 int bgp_debug_neighbor_events(struct peer
*peer
)
2605 return bgp_debug_per_peer(host
, term_bgp_debug_neighbor_events
,
2606 BGP_DEBUG_NEIGHBOR_EVENTS
,
2607 bgp_debug_neighbor_events_peers
);
2610 int bgp_debug_keepalive(struct peer
*peer
)
2617 return bgp_debug_per_peer(host
, term_bgp_debug_keepalive
,
2618 BGP_DEBUG_KEEPALIVE
,
2619 bgp_debug_keepalive_peers
);
2622 bool bgp_debug_update(struct peer
*peer
, const struct prefix
*p
,
2623 struct update_group
*updgrp
, unsigned int inbound
)
2631 if (bgp_debug_per_peer(host
, term_bgp_debug_update
,
2632 BGP_DEBUG_UPDATE_IN
,
2633 bgp_debug_update_in_peers
))
2639 if (bgp_debug_per_peer(host
, term_bgp_debug_update
,
2640 BGP_DEBUG_UPDATE_OUT
,
2641 bgp_debug_update_out_peers
))
2644 /* Check if update debugging implicitly enabled for the group.
2646 if (updgrp
&& UPDGRP_DBG_ON(updgrp
))
2651 if (BGP_DEBUG(update
, UPDATE_PREFIX
)) {
2652 if (bgp_debug_per_prefix(p
, term_bgp_debug_update
,
2653 BGP_DEBUG_UPDATE_PREFIX
,
2654 bgp_debug_update_prefixes
))
2661 bool bgp_debug_bestpath(struct bgp_dest
*dest
)
2663 if (BGP_DEBUG(bestpath
, BESTPATH
)) {
2664 if (bgp_debug_per_prefix(
2665 bgp_dest_get_prefix(dest
), term_bgp_debug_bestpath
,
2666 BGP_DEBUG_BESTPATH
, bgp_debug_bestpath_prefixes
))
2673 bool bgp_debug_zebra(const struct prefix
*p
)
2675 if (BGP_DEBUG(zebra
, ZEBRA
)) {
2676 if (bgp_debug_per_prefix(p
, term_bgp_debug_zebra
,
2678 bgp_debug_zebra_prefixes
))
2685 const char *bgp_debug_rdpfxpath2str(afi_t afi
, safi_t safi
,
2686 const struct prefix_rd
*prd
,
2687 union prefixconstptr pu
,
2688 mpls_label_t
*label
, uint32_t num_labels
,
2689 int addpath_valid
, uint32_t addpath_id
,
2690 struct bgp_route_evpn
*overlay_index
,
2691 char *str
, int size
)
2693 char rd_buf
[RD_ADDRSTRLEN
];
2695 char overlay_index_buf
[INET6_ADDRSTRLEN
+ 14];
2696 const struct prefix_evpn
*evp
;
2698 /* ' with addpath ID ' 17
2699 * max strlen of uint32 + 10
2700 * +/- (just in case) + 1
2701 * null terminator + 1
2702 * ============================ 29 */
2703 char pathid_buf
[30];
2705 if (size
< BGP_PRD_PATH_STRLEN
)
2708 /* Note: Path-id is created by default, but only included in update
2710 pathid_buf
[0] = '\0';
2712 snprintf(pathid_buf
, sizeof(pathid_buf
), " with addpath ID %u",
2715 overlay_index_buf
[0] = '\0';
2716 if (overlay_index
&& overlay_index
->type
== OVERLAY_INDEX_GATEWAY_IP
) {
2717 char obuf
[INET6_ADDRSTRLEN
];
2721 if (is_evpn_prefix_ipaddr_v4(evp
))
2722 inet_ntop(AF_INET
, &overlay_index
->gw_ip
, obuf
,
2724 else if (is_evpn_prefix_ipaddr_v6(evp
))
2725 inet_ntop(AF_INET6
, &overlay_index
->gw_ip
, obuf
,
2728 snprintf(overlay_index_buf
, sizeof(overlay_index_buf
),
2729 " gateway IP %s", obuf
);
2733 if (bgp_labeled_safi(safi
) && num_labels
) {
2735 if (safi
== SAFI_EVPN
) {
2738 bgp_evpn_label2str(label
, num_labels
, tag_buf2
, 20);
2739 snprintf(tag_buf
, sizeof(tag_buf
), " label %s",
2742 uint32_t label_value
;
2744 label_value
= decode_label(label
);
2745 snprintf(tag_buf
, sizeof(tag_buf
), " label %u",
2751 snprintfrr(str
, size
, "RD %s %pFX%s%s%s %s %s",
2752 prefix_rd2str(prd
, rd_buf
, sizeof(rd_buf
)), pu
.p
,
2753 overlay_index_buf
, tag_buf
, pathid_buf
, afi2str(afi
),
2755 else if (safi
== SAFI_FLOWSPEC
) {
2756 char return_string
[BGP_FLOWSPEC_NLRI_STRING_MAX
];
2757 const struct prefix_fs
*fs
= pu
.fs
;
2759 bgp_fs_nlri_get_string((unsigned char *)fs
->prefix
.ptr
,
2760 fs
->prefix
.prefixlen
,
2762 NLRI_STRING_FORMAT_DEBUG
, NULL
,
2763 family2afi(fs
->prefix
.family
));
2764 snprintf(str
, size
, "FS %s Match{%s}", afi2str(afi
),
2767 snprintfrr(str
, size
, "%pFX%s%s %s %s", pu
.p
, tag_buf
,
2768 pathid_buf
, afi2str(afi
), safi2str(safi
));