]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_debug.h
Merge pull request #12818 from imzyxwvu/fix/other-table-inactive
[mirror_frr.git] / bgpd / bgp_debug.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* BGP message debug header.
3 * Copyright (C) 1996, 97, 98 Kunihiro Ishiguro
4 */
5
6 #ifndef _QUAGGA_BGP_DEBUG_H
7 #define _QUAGGA_BGP_DEBUG_H
8
9 #include "bgp_attr.h"
10 #include "bgp_updgrp.h"
11
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
24 /* RD + Prefix + Path-Id */
25 #define BGP_PRD_PATH_STRLEN \
26 (PREFIX_STRLEN + RD_ADDRSTRLEN + INET6_ADDRSTRLEN + 34)
27
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. */
46 extern void bgp_debug_init(void);
47 extern void bgp_packet_dump(struct stream *);
48
49 extern int debug(unsigned int option);
50
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;
69
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;
88
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;
96
97 struct bgp_debug_filter {
98 char *host;
99 struct prefix *p;
100 };
101
102 #define BGP_DEBUG_AS4 0x01
103 #define BGP_DEBUG_AS4_SEGMENT 0x02
104
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
126
127 #define BGP_DEBUG_PACKET_SEND 0x01
128 #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
129
130 #define BGP_DEBUG_GRACEFUL_RESTART 0x01
131
132 #define BGP_DEBUG_BFD_LIB 0x01
133 #define BGP_DEBUG_COND_ADV 0x01
134
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
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)
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
155 extern const char *const bgp_type_str[];
156
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);
163
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);
171
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,
178 size_t datalen);
179
180 #endif /* _QUAGGA_BGP_DEBUG_H */