1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* BGP message debug header.
3 * Copyright (C) 1996, 97, 98 Kunihiro Ishiguro
6 #ifndef _QUAGGA_BGP_DEBUG_H
7 #define _QUAGGA_BGP_DEBUG_H
10 #include "bgp_updgrp.h"
12 /* sort of packet direction */
18 #define DUMP_WITHDRAW 8
22 #define DUMP_DETAIL 32
24 /* RD + Prefix + Path-Id */
25 #define BGP_PRD_PATH_STRLEN \
26 (PREFIX_STRLEN + RD_ADDRSTRLEN + INET6_ADDRSTRLEN + 34)
29 extern int dump_update
;
30 extern int dump_keepalive
;
31 extern int dump_notify
;
33 extern int Debug_Event
;
34 extern int Debug_Keepalive
;
35 extern int Debug_Update
;
36 extern int Debug_Radix
;
46 extern void bgp_debug_init(void);
47 extern void bgp_packet_dump(struct stream
*);
49 extern int debug(unsigned int option
);
51 extern unsigned long conf_bgp_debug_as4
;
52 extern unsigned long conf_bgp_debug_neighbor_events
;
53 extern unsigned long conf_bgp_debug_packet
;
54 extern unsigned long conf_bgp_debug_keepalive
;
55 extern unsigned long conf_bgp_debug_update
;
56 extern unsigned long conf_bgp_debug_bestpath
;
57 extern unsigned long conf_bgp_debug_zebra
;
58 extern unsigned long conf_bgp_debug_allow_martians
;
59 extern unsigned long conf_bgp_debug_nht
;
60 extern unsigned long conf_bgp_debug_update_groups
;
61 extern unsigned long conf_bgp_debug_vpn
;
62 extern unsigned long conf_bgp_debug_flowspec
;
63 extern unsigned long conf_bgp_debug_labelpool
;
64 extern unsigned long conf_bgp_debug_pbr
;
65 extern unsigned long conf_bgp_debug_graceful_restart
;
66 extern unsigned long conf_bgp_debug_evpn_mh
;
67 extern unsigned long conf_bgp_debug_bfd
;
68 extern unsigned long conf_bgp_debug_cond_adv
;
70 extern unsigned long term_bgp_debug_as4
;
71 extern unsigned long term_bgp_debug_neighbor_events
;
72 extern unsigned long term_bgp_debug_packet
;
73 extern unsigned long term_bgp_debug_keepalive
;
74 extern unsigned long term_bgp_debug_update
;
75 extern unsigned long term_bgp_debug_bestpath
;
76 extern unsigned long term_bgp_debug_zebra
;
77 extern unsigned long term_bgp_debug_allow_martians
;
78 extern unsigned long term_bgp_debug_nht
;
79 extern unsigned long term_bgp_debug_update_groups
;
80 extern unsigned long term_bgp_debug_vpn
;
81 extern unsigned long term_bgp_debug_flowspec
;
82 extern unsigned long term_bgp_debug_labelpool
;
83 extern unsigned long term_bgp_debug_pbr
;
84 extern unsigned long term_bgp_debug_graceful_restart
;
85 extern unsigned long term_bgp_debug_evpn_mh
;
86 extern unsigned long term_bgp_debug_bfd
;
87 extern unsigned long term_bgp_debug_cond_adv
;
89 extern struct list
*bgp_debug_neighbor_events_peers
;
90 extern struct list
*bgp_debug_keepalive_peers
;
91 extern struct list
*bgp_debug_update_in_peers
;
92 extern struct list
*bgp_debug_update_out_peers
;
93 extern struct list
*bgp_debug_update_prefixes
;
94 extern struct list
*bgp_debug_bestpath_prefixes
;
95 extern struct list
*bgp_debug_zebra_prefixes
;
97 struct bgp_debug_filter
{
102 #define BGP_DEBUG_AS4 0x01
103 #define BGP_DEBUG_AS4_SEGMENT 0x02
105 #define BGP_DEBUG_BESTPATH 0x01
106 #define BGP_DEBUG_NEIGHBOR_EVENTS 0x01
107 #define BGP_DEBUG_PACKET 0x01
108 #define BGP_DEBUG_KEEPALIVE 0x01
109 #define BGP_DEBUG_UPDATE_IN 0x01
110 #define BGP_DEBUG_UPDATE_OUT 0x02
111 #define BGP_DEBUG_UPDATE_PREFIX 0x04
112 #define BGP_DEBUG_ZEBRA 0x01
113 #define BGP_DEBUG_ALLOW_MARTIANS 0x01
114 #define BGP_DEBUG_NHT 0x01
115 #define BGP_DEBUG_UPDATE_GROUPS 0x01
116 #define BGP_DEBUG_VPN_LEAK_FROM_VRF 0x01
117 #define BGP_DEBUG_VPN_LEAK_TO_VRF 0x02
118 #define BGP_DEBUG_VPN_LEAK_RMAP_EVENT 0x04
119 #define BGP_DEBUG_VPN_LEAK_LABEL 0x08
120 #define BGP_DEBUG_FLOWSPEC 0x01
121 #define BGP_DEBUG_LABELPOOL 0x01
122 #define BGP_DEBUG_PBR 0x01
123 #define BGP_DEBUG_PBR_ERROR 0x02
124 #define BGP_DEBUG_EVPN_MH_ES 0x01
125 #define BGP_DEBUG_EVPN_MH_RT 0x02
127 #define BGP_DEBUG_PACKET_SEND 0x01
128 #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
130 #define BGP_DEBUG_GRACEFUL_RESTART 0x01
132 #define BGP_DEBUG_BFD_LIB 0x01
133 #define BGP_DEBUG_COND_ADV 0x01
135 #define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
136 #define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
138 #define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
139 #define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
141 #define DEBUG_ON(a, b) \
143 CONF_DEBUG_ON(a, b); \
144 TERM_DEBUG_ON(a, b); \
146 #define DEBUG_OFF(a, b) \
148 CONF_DEBUG_OFF(a, b); \
149 TERM_DEBUG_OFF(a, b); \
152 #define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
153 #define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
155 extern const char *const bgp_type_str
[];
157 extern bool bgp_dump_attr(struct attr
*attr
, char *buf
, size_t size
);
158 extern bool bgp_debug_peer_updout_enabled(char *host
);
159 extern const char *bgp_notify_code_str(char code
);
160 extern const char *bgp_notify_subcode_str(char code
, char subcode
);
161 extern void bgp_notify_print(struct peer
*peer
, struct bgp_notify
*bgp_notify
,
162 const char *direct
, bool hard_reset
);
164 extern const struct message bgp_status_msg
[];
165 extern bool bgp_debug_neighbor_events(const struct peer
*peer
);
166 extern bool bgp_debug_keepalive(const struct peer
*peer
);
167 extern bool bgp_debug_update(const struct peer
*peer
, const struct prefix
*p
,
168 struct update_group
*updgrp
, unsigned int inbound
);
169 extern bool bgp_debug_bestpath(struct bgp_dest
*dest
);
170 extern bool bgp_debug_zebra(const struct prefix
*p
);
172 extern const char *bgp_debug_rdpfxpath2str(
173 afi_t afi
, safi_t safi
, const struct prefix_rd
*prd
,
174 union prefixconstptr pu
, mpls_label_t
*label
, uint32_t num_labels
,
175 int addpath_valid
, uint32_t addpath_id
,
176 struct bgp_route_evpn
*overlay_index
, char *str
, int size
);
177 const char *bgp_notify_admin_message(char *buf
, size_t bufsz
, uint8_t *data
,
180 #endif /* _QUAGGA_BGP_DEBUG_H */