]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP message debug header. |
896014f4 DL |
2 | * Copyright (C) 1996, 97, 98 Kunihiro Ishiguro |
3 | * | |
4 | * This file is part of GNU Zebra. | |
5 | * | |
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 | |
9 | * later version. | |
10 | * | |
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. | |
15 | * | |
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 | |
19 | */ | |
718e3744 | 20 | |
00d252cb | 21 | #ifndef _QUAGGA_BGP_DEBUG_H |
22 | #define _QUAGGA_BGP_DEBUG_H | |
23 | ||
0b2aa3a0 | 24 | #include "bgp_attr.h" |
3f9c7369 | 25 | #include "bgp_updgrp.h" |
0b2aa3a0 | 26 | |
718e3744 | 27 | /* sort of packet direction */ |
28 | #define DUMP_ON 1 | |
29 | #define DUMP_SEND 2 | |
30 | #define DUMP_RECV 4 | |
31 | ||
32 | /* for dump_update */ | |
33 | #define DUMP_WITHDRAW 8 | |
34 | #define DUMP_NLRI 16 | |
35 | ||
36 | /* dump detail */ | |
37 | #define DUMP_DETAIL 32 | |
38 | ||
906ad49b | 39 | /* RD + Prefix + Path-Id */ |
6c995628 AD |
40 | #define BGP_PRD_PATH_STRLEN \ |
41 | (PREFIX_STRLEN + RD_ADDRSTRLEN + INET6_ADDRSTRLEN + 34) | |
906ad49b | 42 | |
718e3744 | 43 | extern int dump_open; |
44 | extern int dump_update; | |
45 | extern int dump_keepalive; | |
46 | extern int dump_notify; | |
47 | ||
48 | extern int Debug_Event; | |
49 | extern int Debug_Keepalive; | |
50 | extern int Debug_Update; | |
51 | extern int Debug_Radix; | |
52 | ||
53 | #define NLRI 1 | |
54 | #define WITHDRAW 2 | |
55 | #define NO_OPT 3 | |
56 | #define SEND 4 | |
57 | #define RECV 5 | |
58 | #define DETAIL 6 | |
59 | ||
60 | /* Prototypes. */ | |
d62a17ae | 61 | extern void bgp_debug_init(void); |
62 | extern void bgp_packet_dump(struct stream *); | |
718e3744 | 63 | |
d62a17ae | 64 | extern int debug(unsigned int option); |
718e3744 | 65 | |
0b2aa3a0 | 66 | extern unsigned long conf_bgp_debug_as4; |
16286195 | 67 | extern unsigned long conf_bgp_debug_neighbor_events; |
718e3744 | 68 | extern unsigned long conf_bgp_debug_packet; |
718e3744 | 69 | extern unsigned long conf_bgp_debug_keepalive; |
70 | extern unsigned long conf_bgp_debug_update; | |
9fbdd100 | 71 | extern unsigned long conf_bgp_debug_bestpath; |
a39275d7 | 72 | extern unsigned long conf_bgp_debug_zebra; |
cebb7440 | 73 | extern unsigned long conf_bgp_debug_allow_martians; |
fb018d25 | 74 | extern unsigned long conf_bgp_debug_nht; |
3f9c7369 | 75 | extern unsigned long conf_bgp_debug_update_groups; |
ddb5b488 | 76 | extern unsigned long conf_bgp_debug_vpn; |
268e1b9b | 77 | extern unsigned long conf_bgp_debug_flowspec; |
955bfd98 | 78 | extern unsigned long conf_bgp_debug_labelpool; |
1a80fc0f | 79 | extern unsigned long conf_bgp_debug_pbr; |
b0965c44 | 80 | extern unsigned long conf_bgp_debug_graceful_restart; |
52653398 | 81 | extern unsigned long conf_bgp_debug_evpn_mh; |
259f4236 | 82 | extern unsigned long conf_bgp_debug_bfd; |
718e3744 | 83 | |
0b2aa3a0 | 84 | extern unsigned long term_bgp_debug_as4; |
16286195 | 85 | extern unsigned long term_bgp_debug_neighbor_events; |
718e3744 | 86 | extern unsigned long term_bgp_debug_packet; |
718e3744 | 87 | extern unsigned long term_bgp_debug_keepalive; |
88 | extern unsigned long term_bgp_debug_update; | |
9fbdd100 | 89 | extern unsigned long term_bgp_debug_bestpath; |
a39275d7 | 90 | extern unsigned long term_bgp_debug_zebra; |
cebb7440 | 91 | extern unsigned long term_bgp_debug_allow_martians; |
fb018d25 | 92 | extern unsigned long term_bgp_debug_nht; |
3f9c7369 | 93 | extern unsigned long term_bgp_debug_update_groups; |
ddb5b488 | 94 | extern unsigned long term_bgp_debug_vpn; |
268e1b9b | 95 | extern unsigned long term_bgp_debug_flowspec; |
955bfd98 | 96 | extern unsigned long term_bgp_debug_labelpool; |
1a80fc0f | 97 | extern unsigned long term_bgp_debug_pbr; |
b0965c44 | 98 | extern unsigned long term_bgp_debug_graceful_restart; |
52653398 | 99 | extern unsigned long term_bgp_debug_evpn_mh; |
259f4236 | 100 | extern unsigned long term_bgp_debug_bfd; |
b0965c44 | 101 | |
16286195 DS |
102 | extern struct list *bgp_debug_neighbor_events_peers; |
103 | extern struct list *bgp_debug_keepalive_peers; | |
104 | extern struct list *bgp_debug_update_in_peers; | |
105 | extern struct list *bgp_debug_update_out_peers; | |
106 | extern struct list *bgp_debug_update_prefixes; | |
9fbdd100 | 107 | extern struct list *bgp_debug_bestpath_prefixes; |
16286195 DS |
108 | extern struct list *bgp_debug_zebra_prefixes; |
109 | ||
d62a17ae | 110 | struct bgp_debug_filter { |
111 | char *host; | |
112 | struct prefix *p; | |
16286195 DS |
113 | }; |
114 | ||
0b2aa3a0 PJ |
115 | #define BGP_DEBUG_AS4 0x01 |
116 | #define BGP_DEBUG_AS4_SEGMENT 0x02 | |
117 | ||
9fbdd100 | 118 | #define BGP_DEBUG_BESTPATH 0x01 |
16286195 | 119 | #define BGP_DEBUG_NEIGHBOR_EVENTS 0x01 |
718e3744 | 120 | #define BGP_DEBUG_PACKET 0x01 |
718e3744 | 121 | #define BGP_DEBUG_KEEPALIVE 0x01 |
122 | #define BGP_DEBUG_UPDATE_IN 0x01 | |
123 | #define BGP_DEBUG_UPDATE_OUT 0x02 | |
16286195 | 124 | #define BGP_DEBUG_UPDATE_PREFIX 0x04 |
a39275d7 | 125 | #define BGP_DEBUG_ZEBRA 0x01 |
cebb7440 | 126 | #define BGP_DEBUG_ALLOW_MARTIANS 0x01 |
fb018d25 | 127 | #define BGP_DEBUG_NHT 0x01 |
3f9c7369 | 128 | #define BGP_DEBUG_UPDATE_GROUPS 0x01 |
ddb5b488 PZ |
129 | #define BGP_DEBUG_VPN_LEAK_FROM_VRF 0x01 |
130 | #define BGP_DEBUG_VPN_LEAK_TO_VRF 0x02 | |
131 | #define BGP_DEBUG_VPN_LEAK_RMAP_EVENT 0x04 | |
132 | #define BGP_DEBUG_VPN_LEAK_LABEL 0x08 | |
268e1b9b | 133 | #define BGP_DEBUG_FLOWSPEC 0x01 |
955bfd98 | 134 | #define BGP_DEBUG_LABELPOOL 0x01 |
1a80fc0f | 135 | #define BGP_DEBUG_PBR 0x01 |
f146bb54 | 136 | #define BGP_DEBUG_PBR_ERROR 0x02 |
52653398 AK |
137 | #define BGP_DEBUG_EVPN_MH_ES 0x01 |
138 | #define BGP_DEBUG_EVPN_MH_RT 0x02 | |
718e3744 | 139 | |
140 | #define BGP_DEBUG_PACKET_SEND 0x01 | |
141 | #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02 | |
142 | ||
b0965c44 | 143 | #define BGP_DEBUG_GRACEFUL_RESTART 0x01 |
144 | ||
259f4236 RZ |
145 | #define BGP_DEBUG_BFD_LIB 0x01 |
146 | ||
718e3744 | 147 | #define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b)) |
148 | #define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b)) | |
149 | ||
150 | #define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b)) | |
151 | #define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b)) | |
152 | ||
d62a17ae | 153 | #define DEBUG_ON(a, b) \ |
154 | do { \ | |
155 | CONF_DEBUG_ON(a, b); \ | |
156 | TERM_DEBUG_ON(a, b); \ | |
157 | } while (0) | |
158 | #define DEBUG_OFF(a, b) \ | |
159 | do { \ | |
160 | CONF_DEBUG_OFF(a, b); \ | |
161 | TERM_DEBUG_OFF(a, b); \ | |
162 | } while (0) | |
718e3744 | 163 | |
164 | #define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b) | |
165 | #define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b) | |
166 | ||
2b64873d | 167 | extern const char *const bgp_type_str[]; |
718e3744 | 168 | |
3dc339cd DA |
169 | extern bool bgp_dump_attr(struct attr *, char *, size_t); |
170 | extern bool bgp_debug_peer_updout_enabled(char *host); | |
3a8c7ba1 DW |
171 | extern const char *bgp_notify_code_str(char); |
172 | extern const char *bgp_notify_subcode_str(char, char); | |
d62a17ae | 173 | extern void bgp_notify_print(struct peer *, struct bgp_notify *, const char *); |
718e3744 | 174 | |
b2d933f8 | 175 | extern const struct message bgp_status_msg[]; |
16286195 DS |
176 | extern int bgp_debug_neighbor_events(struct peer *peer); |
177 | extern int bgp_debug_keepalive(struct peer *peer); | |
b8685f9b | 178 | extern bool bgp_debug_update(struct peer *peer, const struct prefix *p, |
3dc339cd | 179 | struct update_group *updgrp, unsigned int inbound); |
9bcb3eef | 180 | extern bool bgp_debug_bestpath(struct bgp_dest *dest); |
b8685f9b | 181 | extern bool bgp_debug_zebra(const struct prefix *p); |
00d252cb | 182 | |
6c995628 AD |
183 | extern const char *bgp_debug_rdpfxpath2str( |
184 | afi_t afi, safi_t safi, const struct prefix_rd *prd, | |
185 | union prefixconstptr pu, mpls_label_t *label, uint32_t num_labels, | |
186 | int addpath_valid, uint32_t addpath_id, | |
187 | struct bgp_route_evpn *overlay_index, char *str, int size); | |
d7c0a89a | 188 | const char *bgp_notify_admin_message(char *buf, size_t bufsz, uint8_t *data, |
d62a17ae | 189 | size_t datalen); |
38de8d02 | 190 | |
00d252cb | 191 | #endif /* _QUAGGA_BGP_DEBUG_H */ |