]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_debug.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / bgpd / bgp_debug.h
CommitLineData
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 28extern int dump_open;
29extern int dump_update;
30extern int dump_keepalive;
31extern int dump_notify;
32
33extern int Debug_Event;
34extern int Debug_Keepalive;
35extern int Debug_Update;
36extern 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 46extern void bgp_debug_init(void);
47extern void bgp_packet_dump(struct stream *);
718e3744 48
d62a17ae 49extern int debug(unsigned int option);
718e3744 50
0b2aa3a0 51extern unsigned long conf_bgp_debug_as4;
16286195 52extern unsigned long conf_bgp_debug_neighbor_events;
718e3744 53extern unsigned long conf_bgp_debug_packet;
718e3744 54extern unsigned long conf_bgp_debug_keepalive;
55extern unsigned long conf_bgp_debug_update;
9fbdd100 56extern unsigned long conf_bgp_debug_bestpath;
a39275d7 57extern unsigned long conf_bgp_debug_zebra;
cebb7440 58extern unsigned long conf_bgp_debug_allow_martians;
fb018d25 59extern unsigned long conf_bgp_debug_nht;
3f9c7369 60extern unsigned long conf_bgp_debug_update_groups;
ddb5b488 61extern unsigned long conf_bgp_debug_vpn;
268e1b9b 62extern unsigned long conf_bgp_debug_flowspec;
955bfd98 63extern unsigned long conf_bgp_debug_labelpool;
1a80fc0f 64extern unsigned long conf_bgp_debug_pbr;
b0965c44 65extern unsigned long conf_bgp_debug_graceful_restart;
52653398 66extern unsigned long conf_bgp_debug_evpn_mh;
259f4236 67extern unsigned long conf_bgp_debug_bfd;
8093d799 68extern unsigned long conf_bgp_debug_cond_adv;
718e3744 69
0b2aa3a0 70extern unsigned long term_bgp_debug_as4;
16286195 71extern unsigned long term_bgp_debug_neighbor_events;
718e3744 72extern unsigned long term_bgp_debug_packet;
718e3744 73extern unsigned long term_bgp_debug_keepalive;
74extern unsigned long term_bgp_debug_update;
9fbdd100 75extern unsigned long term_bgp_debug_bestpath;
a39275d7 76extern unsigned long term_bgp_debug_zebra;
cebb7440 77extern unsigned long term_bgp_debug_allow_martians;
fb018d25 78extern unsigned long term_bgp_debug_nht;
3f9c7369 79extern unsigned long term_bgp_debug_update_groups;
ddb5b488 80extern unsigned long term_bgp_debug_vpn;
268e1b9b 81extern unsigned long term_bgp_debug_flowspec;
955bfd98 82extern unsigned long term_bgp_debug_labelpool;
1a80fc0f 83extern unsigned long term_bgp_debug_pbr;
b0965c44 84extern unsigned long term_bgp_debug_graceful_restart;
52653398 85extern unsigned long term_bgp_debug_evpn_mh;
259f4236 86extern unsigned long term_bgp_debug_bfd;
8093d799 87extern unsigned long term_bgp_debug_cond_adv;
b0965c44 88
16286195
DS
89extern struct list *bgp_debug_neighbor_events_peers;
90extern struct list *bgp_debug_keepalive_peers;
91extern struct list *bgp_debug_update_in_peers;
92extern struct list *bgp_debug_update_out_peers;
93extern struct list *bgp_debug_update_prefixes;
9fbdd100 94extern struct list *bgp_debug_bestpath_prefixes;
16286195
DS
95extern struct list *bgp_debug_zebra_prefixes;
96
d62a17ae 97struct 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 155extern const char *const bgp_type_str[];
718e3744 156
c4071e95 157extern bool bgp_dump_attr(struct attr *attr, char *buf, size_t size);
3dc339cd 158extern bool bgp_debug_peer_updout_enabled(char *host);
c4071e95
DS
159extern const char *bgp_notify_code_str(char code);
160extern const char *bgp_notify_subcode_str(char code, char subcode);
eea685b6
DA
161extern void bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify,
162 const char *direct, bool hard_reset);
718e3744 163
b2d933f8 164extern const struct message bgp_status_msg[];
d032ddce
DS
165extern bool bgp_debug_neighbor_events(const struct peer *peer);
166extern bool bgp_debug_keepalive(const struct peer *peer);
167extern bool bgp_debug_update(const struct peer *peer, const struct prefix *p,
3dc339cd 168 struct update_group *updgrp, unsigned int inbound);
9bcb3eef 169extern bool bgp_debug_bestpath(struct bgp_dest *dest);
b8685f9b 170extern bool bgp_debug_zebra(const struct prefix *p);
00d252cb 171
6c995628
AD
172extern 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 177const 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 */