]> git.proxmox.com Git - mirror_frr.git/blame_incremental - bgpd/bgp_debug.h
Merge pull request #8320 from idryzhov/prefix-list-seqnum
[mirror_frr.git] / bgpd / bgp_debug.h
... / ...
CommitLineData
1/* BGP message debug header.
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 */
20
21#ifndef _QUAGGA_BGP_DEBUG_H
22#define _QUAGGA_BGP_DEBUG_H
23
24#include "bgp_attr.h"
25#include "bgp_updgrp.h"
26
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
39/* RD + Prefix + Path-Id */
40#define BGP_PRD_PATH_STRLEN (PREFIX_STRLEN + RD_ADDRSTRLEN + 20)
41
42extern int dump_open;
43extern int dump_update;
44extern int dump_keepalive;
45extern int dump_notify;
46
47extern int Debug_Event;
48extern int Debug_Keepalive;
49extern int Debug_Update;
50extern int Debug_Radix;
51
52#define NLRI 1
53#define WITHDRAW 2
54#define NO_OPT 3
55#define SEND 4
56#define RECV 5
57#define DETAIL 6
58
59/* Prototypes. */
60extern void bgp_debug_init(void);
61extern void bgp_packet_dump(struct stream *);
62
63extern int debug(unsigned int option);
64
65extern unsigned long conf_bgp_debug_as4;
66extern unsigned long conf_bgp_debug_neighbor_events;
67extern unsigned long conf_bgp_debug_packet;
68extern unsigned long conf_bgp_debug_keepalive;
69extern unsigned long conf_bgp_debug_update;
70extern unsigned long conf_bgp_debug_bestpath;
71extern unsigned long conf_bgp_debug_zebra;
72extern unsigned long conf_bgp_debug_allow_martians;
73extern unsigned long conf_bgp_debug_nht;
74extern unsigned long conf_bgp_debug_update_groups;
75extern unsigned long conf_bgp_debug_vpn;
76extern unsigned long conf_bgp_debug_flowspec;
77extern unsigned long conf_bgp_debug_labelpool;
78extern unsigned long conf_bgp_debug_pbr;
79extern unsigned long conf_bgp_debug_graceful_restart;
80extern unsigned long conf_bgp_debug_evpn_mh;
81extern unsigned long conf_bgp_debug_bfd;
82
83extern unsigned long term_bgp_debug_as4;
84extern unsigned long term_bgp_debug_neighbor_events;
85extern unsigned long term_bgp_debug_packet;
86extern unsigned long term_bgp_debug_keepalive;
87extern unsigned long term_bgp_debug_update;
88extern unsigned long term_bgp_debug_bestpath;
89extern unsigned long term_bgp_debug_zebra;
90extern unsigned long term_bgp_debug_allow_martians;
91extern unsigned long term_bgp_debug_nht;
92extern unsigned long term_bgp_debug_update_groups;
93extern unsigned long term_bgp_debug_vpn;
94extern unsigned long term_bgp_debug_flowspec;
95extern unsigned long term_bgp_debug_labelpool;
96extern unsigned long term_bgp_debug_pbr;
97extern unsigned long term_bgp_debug_graceful_restart;
98extern unsigned long term_bgp_debug_evpn_mh;
99extern unsigned long term_bgp_debug_bfd;
100
101extern struct list *bgp_debug_neighbor_events_peers;
102extern struct list *bgp_debug_keepalive_peers;
103extern struct list *bgp_debug_update_in_peers;
104extern struct list *bgp_debug_update_out_peers;
105extern struct list *bgp_debug_update_prefixes;
106extern struct list *bgp_debug_bestpath_prefixes;
107extern struct list *bgp_debug_zebra_prefixes;
108
109struct bgp_debug_filter {
110 char *host;
111 struct prefix *p;
112};
113
114#define BGP_DEBUG_AS4 0x01
115#define BGP_DEBUG_AS4_SEGMENT 0x02
116
117#define BGP_DEBUG_BESTPATH 0x01
118#define BGP_DEBUG_NEIGHBOR_EVENTS 0x01
119#define BGP_DEBUG_PACKET 0x01
120#define BGP_DEBUG_KEEPALIVE 0x01
121#define BGP_DEBUG_UPDATE_IN 0x01
122#define BGP_DEBUG_UPDATE_OUT 0x02
123#define BGP_DEBUG_UPDATE_PREFIX 0x04
124#define BGP_DEBUG_ZEBRA 0x01
125#define BGP_DEBUG_ALLOW_MARTIANS 0x01
126#define BGP_DEBUG_NHT 0x01
127#define BGP_DEBUG_UPDATE_GROUPS 0x01
128#define BGP_DEBUG_VPN_LEAK_FROM_VRF 0x01
129#define BGP_DEBUG_VPN_LEAK_TO_VRF 0x02
130#define BGP_DEBUG_VPN_LEAK_RMAP_EVENT 0x04
131#define BGP_DEBUG_VPN_LEAK_LABEL 0x08
132#define BGP_DEBUG_FLOWSPEC 0x01
133#define BGP_DEBUG_LABELPOOL 0x01
134#define BGP_DEBUG_PBR 0x01
135#define BGP_DEBUG_PBR_ERROR 0x02
136#define BGP_DEBUG_EVPN_MH_ES 0x01
137#define BGP_DEBUG_EVPN_MH_RT 0x02
138
139#define BGP_DEBUG_PACKET_SEND 0x01
140#define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
141
142#define BGP_DEBUG_GRACEFUL_RESTART 0x01
143
144#define BGP_DEBUG_BFD_LIB 0x01
145
146#define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
147#define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
148
149#define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
150#define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
151
152#define DEBUG_ON(a, b) \
153 do { \
154 CONF_DEBUG_ON(a, b); \
155 TERM_DEBUG_ON(a, b); \
156 } while (0)
157#define DEBUG_OFF(a, b) \
158 do { \
159 CONF_DEBUG_OFF(a, b); \
160 TERM_DEBUG_OFF(a, b); \
161 } while (0)
162
163#define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
164#define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
165
166extern const char *const bgp_type_str[];
167
168extern bool bgp_dump_attr(struct attr *, char *, size_t);
169extern bool bgp_debug_peer_updout_enabled(char *host);
170extern const char *bgp_notify_code_str(char);
171extern const char *bgp_notify_subcode_str(char, char);
172extern void bgp_notify_print(struct peer *, struct bgp_notify *, const char *);
173
174extern const struct message bgp_status_msg[];
175extern int bgp_debug_neighbor_events(struct peer *peer);
176extern int bgp_debug_keepalive(struct peer *peer);
177extern bool bgp_debug_update(struct peer *peer, const struct prefix *p,
178 struct update_group *updgrp, unsigned int inbound);
179extern bool bgp_debug_bestpath(struct bgp_dest *dest);
180extern bool bgp_debug_zebra(const struct prefix *p);
181
182extern const char *
183bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi, const struct prefix_rd *prd,
184 union prefixconstptr pu, mpls_label_t *label,
185 uint32_t num_labels, int addpath_valid,
186 uint32_t addpath_id, char *str, int size);
187const char *bgp_notify_admin_message(char *buf, size_t bufsz, uint8_t *data,
188 size_t datalen);
189
190#endif /* _QUAGGA_BGP_DEBUG_H */