1 /* BGP message debug header.
2 * Copyright (C) 1996, 97, 98 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
21 #ifndef _QUAGGA_BGP_DEBUG_H
22 #define _QUAGGA_BGP_DEBUG_H
25 #include "bgp_updgrp.h"
27 /* sort of packet direction */
33 #define DUMP_WITHDRAW 8
37 #define DUMP_DETAIL 32
39 /* RD + Prefix + Path-Id */
40 #define BGP_PRD_PATH_STRLEN \
41 (PREFIX_STRLEN + RD_ADDRSTRLEN + INET6_ADDRSTRLEN + 34)
44 extern int dump_update
;
45 extern int dump_keepalive
;
46 extern int dump_notify
;
48 extern int Debug_Event
;
49 extern int Debug_Keepalive
;
50 extern int Debug_Update
;
51 extern int Debug_Radix
;
61 extern void bgp_debug_init(void);
62 extern void bgp_packet_dump(struct stream
*);
64 extern int debug(unsigned int option
);
66 extern unsigned long conf_bgp_debug_as4
;
67 extern unsigned long conf_bgp_debug_neighbor_events
;
68 extern unsigned long conf_bgp_debug_packet
;
69 extern unsigned long conf_bgp_debug_keepalive
;
70 extern unsigned long conf_bgp_debug_update
;
71 extern unsigned long conf_bgp_debug_bestpath
;
72 extern unsigned long conf_bgp_debug_zebra
;
73 extern unsigned long conf_bgp_debug_allow_martians
;
74 extern unsigned long conf_bgp_debug_nht
;
75 extern unsigned long conf_bgp_debug_update_groups
;
76 extern unsigned long conf_bgp_debug_vpn
;
77 extern unsigned long conf_bgp_debug_flowspec
;
78 extern unsigned long conf_bgp_debug_labelpool
;
79 extern unsigned long conf_bgp_debug_pbr
;
80 extern unsigned long conf_bgp_debug_graceful_restart
;
81 extern unsigned long conf_bgp_debug_evpn_mh
;
82 extern unsigned long conf_bgp_debug_bfd
;
83 extern unsigned long conf_bgp_debug_cond_adv
;
84 extern unsigned long conf_bgp_debug_optimal_route_reflection
;
86 extern unsigned long term_bgp_debug_as4
;
87 extern unsigned long term_bgp_debug_neighbor_events
;
88 extern unsigned long term_bgp_debug_packet
;
89 extern unsigned long term_bgp_debug_keepalive
;
90 extern unsigned long term_bgp_debug_update
;
91 extern unsigned long term_bgp_debug_bestpath
;
92 extern unsigned long term_bgp_debug_zebra
;
93 extern unsigned long term_bgp_debug_allow_martians
;
94 extern unsigned long term_bgp_debug_nht
;
95 extern unsigned long term_bgp_debug_update_groups
;
96 extern unsigned long term_bgp_debug_vpn
;
97 extern unsigned long term_bgp_debug_flowspec
;
98 extern unsigned long term_bgp_debug_labelpool
;
99 extern unsigned long term_bgp_debug_pbr
;
100 extern unsigned long term_bgp_debug_graceful_restart
;
101 extern unsigned long term_bgp_debug_evpn_mh
;
102 extern unsigned long term_bgp_debug_bfd
;
103 extern unsigned long term_bgp_debug_cond_adv
;
104 extern unsigned long term_bgp_debug_optimal_route_reflection
;
106 extern struct list
*bgp_debug_neighbor_events_peers
;
107 extern struct list
*bgp_debug_keepalive_peers
;
108 extern struct list
*bgp_debug_update_in_peers
;
109 extern struct list
*bgp_debug_update_out_peers
;
110 extern struct list
*bgp_debug_update_prefixes
;
111 extern struct list
*bgp_debug_bestpath_prefixes
;
112 extern struct list
*bgp_debug_zebra_prefixes
;
114 struct bgp_debug_filter
{
119 #define BGP_DEBUG_AS4 0x01
120 #define BGP_DEBUG_AS4_SEGMENT 0x02
122 #define BGP_DEBUG_BESTPATH 0x01
123 #define BGP_DEBUG_NEIGHBOR_EVENTS 0x01
124 #define BGP_DEBUG_PACKET 0x01
125 #define BGP_DEBUG_KEEPALIVE 0x01
126 #define BGP_DEBUG_UPDATE_IN 0x01
127 #define BGP_DEBUG_UPDATE_OUT 0x02
128 #define BGP_DEBUG_UPDATE_PREFIX 0x04
129 #define BGP_DEBUG_ZEBRA 0x01
130 #define BGP_DEBUG_ALLOW_MARTIANS 0x01
131 #define BGP_DEBUG_NHT 0x01
132 #define BGP_DEBUG_UPDATE_GROUPS 0x01
133 #define BGP_DEBUG_VPN_LEAK_FROM_VRF 0x01
134 #define BGP_DEBUG_VPN_LEAK_TO_VRF 0x02
135 #define BGP_DEBUG_VPN_LEAK_RMAP_EVENT 0x04
136 #define BGP_DEBUG_VPN_LEAK_LABEL 0x08
137 #define BGP_DEBUG_FLOWSPEC 0x01
138 #define BGP_DEBUG_LABELPOOL 0x01
139 #define BGP_DEBUG_PBR 0x01
140 #define BGP_DEBUG_PBR_ERROR 0x02
141 #define BGP_DEBUG_EVPN_MH_ES 0x01
142 #define BGP_DEBUG_EVPN_MH_RT 0x02
143 #define BGP_DEBUG_ORR 0x01
145 #define BGP_DEBUG_PACKET_SEND 0x01
146 #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
148 #define BGP_DEBUG_GRACEFUL_RESTART 0x01
150 #define BGP_DEBUG_BFD_LIB 0x01
151 #define BGP_DEBUG_COND_ADV 0x01
153 #define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
154 #define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
156 #define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
157 #define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
159 #define DEBUG_ON(a, b) \
161 CONF_DEBUG_ON(a, b); \
162 TERM_DEBUG_ON(a, b); \
164 #define DEBUG_OFF(a, b) \
166 CONF_DEBUG_OFF(a, b); \
167 TERM_DEBUG_OFF(a, b); \
170 #define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
171 #define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
173 extern const char *const bgp_type_str
[];
175 extern bool bgp_dump_attr(struct attr
*attr
, char *buf
, size_t size
);
176 extern bool bgp_debug_peer_updout_enabled(char *host
);
177 extern const char *bgp_notify_code_str(char code
);
178 extern const char *bgp_notify_subcode_str(char code
, char subcode
);
179 extern void bgp_notify_print(struct peer
*peer
, struct bgp_notify
*bgp_notify
,
180 const char *direct
, bool hard_reset
);
182 extern const struct message bgp_status_msg
[];
183 extern bool bgp_debug_neighbor_events(const struct peer
*peer
);
184 extern bool bgp_debug_keepalive(const struct peer
*peer
);
185 extern bool bgp_debug_update(const struct peer
*peer
, const struct prefix
*p
,
186 struct update_group
*updgrp
, unsigned int inbound
);
187 extern bool bgp_debug_bestpath(struct bgp_dest
*dest
);
188 extern bool bgp_debug_zebra(const struct prefix
*p
);
190 extern const char *bgp_debug_rdpfxpath2str(
191 afi_t afi
, safi_t safi
, const struct prefix_rd
*prd
,
192 union prefixconstptr pu
, mpls_label_t
*label
, uint32_t num_labels
,
193 int addpath_valid
, uint32_t addpath_id
,
194 struct bgp_route_evpn
*overlay_index
, char *str
, int size
);
195 const char *bgp_notify_admin_message(char *buf
, size_t bufsz
, uint8_t *data
,
198 #endif /* _QUAGGA_BGP_DEBUG_H */