]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
718e3744 | 2 | /* BGP message debug header. |
896014f4 | 3 | * Copyright (C) 1996, 97, 98 Kunihiro Ishiguro |
896014f4 | 4 | */ |
718e3744 | 5 | |
00d252cb | 6 | #ifndef _QUAGGA_BGP_DEBUG_H |
7 | #define _QUAGGA_BGP_DEBUG_H | |
8 | ||
0b2aa3a0 | 9 | #include "bgp_attr.h" |
3f9c7369 | 10 | #include "bgp_updgrp.h" |
0b2aa3a0 | 11 | |
718e3744 | 12 | /* sort of packet direction */ |
13 | #define DUMP_ON 1 | |
14 | #define DUMP_SEND 2 | |
15 | #define DUMP_RECV 4 | |
16 | ||
17 | /* for dump_update */ | |
18 | #define DUMP_WITHDRAW 8 | |
19 | #define DUMP_NLRI 16 | |
20 | ||
21 | /* dump detail */ | |
22 | #define DUMP_DETAIL 32 | |
23 | ||
906ad49b | 24 | /* RD + Prefix + Path-Id */ |
6c995628 AD |
25 | #define BGP_PRD_PATH_STRLEN \ |
26 | (PREFIX_STRLEN + RD_ADDRSTRLEN + INET6_ADDRSTRLEN + 34) | |
906ad49b | 27 | |
718e3744 | 28 | extern int dump_open; |
29 | extern int dump_update; | |
30 | extern int dump_keepalive; | |
31 | extern int dump_notify; | |
32 | ||
33 | extern int Debug_Event; | |
34 | extern int Debug_Keepalive; | |
35 | extern int Debug_Update; | |
36 | extern int Debug_Radix; | |
37 | ||
38 | #define NLRI 1 | |
39 | #define WITHDRAW 2 | |
40 | #define NO_OPT 3 | |
41 | #define SEND 4 | |
42 | #define RECV 5 | |
43 | #define DETAIL 6 | |
44 | ||
45 | /* Prototypes. */ | |
d62a17ae | 46 | extern void bgp_debug_init(void); |
47 | extern void bgp_packet_dump(struct stream *); | |
718e3744 | 48 | |
d62a17ae | 49 | extern int debug(unsigned int option); |
718e3744 | 50 | |
0b2aa3a0 | 51 | extern unsigned long conf_bgp_debug_as4; |
16286195 | 52 | extern unsigned long conf_bgp_debug_neighbor_events; |
718e3744 | 53 | extern unsigned long conf_bgp_debug_packet; |
718e3744 | 54 | extern unsigned long conf_bgp_debug_keepalive; |
55 | extern unsigned long conf_bgp_debug_update; | |
9fbdd100 | 56 | extern unsigned long conf_bgp_debug_bestpath; |
a39275d7 | 57 | extern unsigned long conf_bgp_debug_zebra; |
cebb7440 | 58 | extern unsigned long conf_bgp_debug_allow_martians; |
fb018d25 | 59 | extern unsigned long conf_bgp_debug_nht; |
3f9c7369 | 60 | extern unsigned long conf_bgp_debug_update_groups; |
ddb5b488 | 61 | extern unsigned long conf_bgp_debug_vpn; |
268e1b9b | 62 | extern unsigned long conf_bgp_debug_flowspec; |
955bfd98 | 63 | extern unsigned long conf_bgp_debug_labelpool; |
1a80fc0f | 64 | extern unsigned long conf_bgp_debug_pbr; |
b0965c44 | 65 | extern unsigned long conf_bgp_debug_graceful_restart; |
52653398 | 66 | extern unsigned long conf_bgp_debug_evpn_mh; |
259f4236 | 67 | extern unsigned long conf_bgp_debug_bfd; |
8093d799 | 68 | extern unsigned long conf_bgp_debug_cond_adv; |
718e3744 | 69 | |
0b2aa3a0 | 70 | extern unsigned long term_bgp_debug_as4; |
16286195 | 71 | extern unsigned long term_bgp_debug_neighbor_events; |
718e3744 | 72 | extern unsigned long term_bgp_debug_packet; |
718e3744 | 73 | extern unsigned long term_bgp_debug_keepalive; |
74 | extern unsigned long term_bgp_debug_update; | |
9fbdd100 | 75 | extern unsigned long term_bgp_debug_bestpath; |
a39275d7 | 76 | extern unsigned long term_bgp_debug_zebra; |
cebb7440 | 77 | extern unsigned long term_bgp_debug_allow_martians; |
fb018d25 | 78 | extern unsigned long term_bgp_debug_nht; |
3f9c7369 | 79 | extern unsigned long term_bgp_debug_update_groups; |
ddb5b488 | 80 | extern unsigned long term_bgp_debug_vpn; |
268e1b9b | 81 | extern unsigned long term_bgp_debug_flowspec; |
955bfd98 | 82 | extern unsigned long term_bgp_debug_labelpool; |
1a80fc0f | 83 | extern unsigned long term_bgp_debug_pbr; |
b0965c44 | 84 | extern unsigned long term_bgp_debug_graceful_restart; |
52653398 | 85 | extern unsigned long term_bgp_debug_evpn_mh; |
259f4236 | 86 | extern unsigned long term_bgp_debug_bfd; |
8093d799 | 87 | extern unsigned long term_bgp_debug_cond_adv; |
b0965c44 | 88 | |
16286195 DS |
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; | |
9fbdd100 | 94 | extern struct list *bgp_debug_bestpath_prefixes; |
16286195 DS |
95 | extern struct list *bgp_debug_zebra_prefixes; |
96 | ||
d62a17ae | 97 | struct bgp_debug_filter { |
98 | char *host; | |
99 | struct prefix *p; | |
16286195 DS |
100 | }; |
101 | ||
0b2aa3a0 PJ |
102 | #define BGP_DEBUG_AS4 0x01 |
103 | #define BGP_DEBUG_AS4_SEGMENT 0x02 | |
104 | ||
9fbdd100 | 105 | #define BGP_DEBUG_BESTPATH 0x01 |
16286195 | 106 | #define BGP_DEBUG_NEIGHBOR_EVENTS 0x01 |
718e3744 | 107 | #define BGP_DEBUG_PACKET 0x01 |
718e3744 | 108 | #define BGP_DEBUG_KEEPALIVE 0x01 |
109 | #define BGP_DEBUG_UPDATE_IN 0x01 | |
110 | #define BGP_DEBUG_UPDATE_OUT 0x02 | |
16286195 | 111 | #define BGP_DEBUG_UPDATE_PREFIX 0x04 |
a39275d7 | 112 | #define BGP_DEBUG_ZEBRA 0x01 |
cebb7440 | 113 | #define BGP_DEBUG_ALLOW_MARTIANS 0x01 |
fb018d25 | 114 | #define BGP_DEBUG_NHT 0x01 |
3f9c7369 | 115 | #define BGP_DEBUG_UPDATE_GROUPS 0x01 |
ddb5b488 PZ |
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 | |
268e1b9b | 120 | #define BGP_DEBUG_FLOWSPEC 0x01 |
955bfd98 | 121 | #define BGP_DEBUG_LABELPOOL 0x01 |
1a80fc0f | 122 | #define BGP_DEBUG_PBR 0x01 |
f146bb54 | 123 | #define BGP_DEBUG_PBR_ERROR 0x02 |
52653398 AK |
124 | #define BGP_DEBUG_EVPN_MH_ES 0x01 |
125 | #define BGP_DEBUG_EVPN_MH_RT 0x02 | |
718e3744 | 126 | |
127 | #define BGP_DEBUG_PACKET_SEND 0x01 | |
128 | #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02 | |
129 | ||
b0965c44 | 130 | #define BGP_DEBUG_GRACEFUL_RESTART 0x01 |
131 | ||
259f4236 | 132 | #define BGP_DEBUG_BFD_LIB 0x01 |
8093d799 | 133 | #define BGP_DEBUG_COND_ADV 0x01 |
259f4236 | 134 | |
718e3744 | 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)) | |
137 | ||
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)) | |
140 | ||
d62a17ae | 141 | #define DEBUG_ON(a, b) \ |
142 | do { \ | |
143 | CONF_DEBUG_ON(a, b); \ | |
144 | TERM_DEBUG_ON(a, b); \ | |
145 | } while (0) | |
146 | #define DEBUG_OFF(a, b) \ | |
147 | do { \ | |
148 | CONF_DEBUG_OFF(a, b); \ | |
149 | TERM_DEBUG_OFF(a, b); \ | |
150 | } while (0) | |
718e3744 | 151 | |
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) | |
154 | ||
2b64873d | 155 | extern const char *const bgp_type_str[]; |
718e3744 | 156 | |
c4071e95 | 157 | extern bool bgp_dump_attr(struct attr *attr, char *buf, size_t size); |
3dc339cd | 158 | extern bool bgp_debug_peer_updout_enabled(char *host); |
c4071e95 DS |
159 | extern const char *bgp_notify_code_str(char code); |
160 | extern const char *bgp_notify_subcode_str(char code, char subcode); | |
eea685b6 DA |
161 | extern void bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify, |
162 | const char *direct, bool hard_reset); | |
718e3744 | 163 | |
b2d933f8 | 164 | extern const struct message bgp_status_msg[]; |
d032ddce DS |
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, | |
3dc339cd | 168 | struct update_group *updgrp, unsigned int inbound); |
9bcb3eef | 169 | extern bool bgp_debug_bestpath(struct bgp_dest *dest); |
b8685f9b | 170 | extern bool bgp_debug_zebra(const struct prefix *p); |
00d252cb | 171 | |
6c995628 AD |
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); | |
d7c0a89a | 177 | const char *bgp_notify_admin_message(char *buf, size_t bufsz, uint8_t *data, |
d62a17ae | 178 | size_t datalen); |
38de8d02 | 179 | |
00d252cb | 180 | #endif /* _QUAGGA_BGP_DEBUG_H */ |