]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_debug.h
bgpd: partially revert e23b9ef6d271223d29c7f91a10d98aa6dcd252b3
[mirror_frr.git] / bgpd / bgp_debug.h
CommitLineData
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 */
40#define BGP_PRD_PATH_STRLEN (PREFIX_STRLEN + RD_ADDRSTRLEN + 20)
41
718e3744 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. */
d62a17ae 60extern void bgp_debug_init(void);
61extern void bgp_packet_dump(struct stream *);
718e3744 62
d62a17ae 63extern int debug(unsigned int option);
718e3744 64
0b2aa3a0 65extern unsigned long conf_bgp_debug_as4;
16286195 66extern unsigned long conf_bgp_debug_neighbor_events;
718e3744 67extern unsigned long conf_bgp_debug_packet;
718e3744 68extern unsigned long conf_bgp_debug_keepalive;
69extern unsigned long conf_bgp_debug_update;
9fbdd100 70extern unsigned long conf_bgp_debug_bestpath;
a39275d7 71extern unsigned long conf_bgp_debug_zebra;
cebb7440 72extern unsigned long conf_bgp_debug_allow_martians;
fb018d25 73extern unsigned long conf_bgp_debug_nht;
3f9c7369 74extern unsigned long conf_bgp_debug_update_groups;
ddb5b488 75extern unsigned long conf_bgp_debug_vpn;
268e1b9b 76extern unsigned long conf_bgp_debug_flowspec;
955bfd98 77extern unsigned long conf_bgp_debug_labelpool;
1a80fc0f 78extern unsigned long conf_bgp_debug_pbr;
718e3744 79
0b2aa3a0 80extern unsigned long term_bgp_debug_as4;
16286195 81extern unsigned long term_bgp_debug_neighbor_events;
718e3744 82extern unsigned long term_bgp_debug_packet;
718e3744 83extern unsigned long term_bgp_debug_keepalive;
84extern unsigned long term_bgp_debug_update;
9fbdd100 85extern unsigned long term_bgp_debug_bestpath;
a39275d7 86extern unsigned long term_bgp_debug_zebra;
cebb7440 87extern unsigned long term_bgp_debug_allow_martians;
fb018d25 88extern unsigned long term_bgp_debug_nht;
3f9c7369 89extern unsigned long term_bgp_debug_update_groups;
ddb5b488 90extern unsigned long term_bgp_debug_vpn;
268e1b9b 91extern unsigned long term_bgp_debug_flowspec;
955bfd98 92extern unsigned long term_bgp_debug_labelpool;
1a80fc0f 93extern unsigned long term_bgp_debug_pbr;
718e3744 94
16286195
DS
95extern struct list *bgp_debug_neighbor_events_peers;
96extern struct list *bgp_debug_keepalive_peers;
97extern struct list *bgp_debug_update_in_peers;
98extern struct list *bgp_debug_update_out_peers;
99extern struct list *bgp_debug_update_prefixes;
9fbdd100 100extern struct list *bgp_debug_bestpath_prefixes;
16286195
DS
101extern struct list *bgp_debug_zebra_prefixes;
102
d62a17ae 103struct bgp_debug_filter {
104 char *host;
105 struct prefix *p;
16286195
DS
106};
107
0b2aa3a0
PJ
108#define BGP_DEBUG_AS4 0x01
109#define BGP_DEBUG_AS4_SEGMENT 0x02
110
9fbdd100 111#define BGP_DEBUG_BESTPATH 0x01
16286195 112#define BGP_DEBUG_NEIGHBOR_EVENTS 0x01
718e3744 113#define BGP_DEBUG_PACKET 0x01
718e3744 114#define BGP_DEBUG_KEEPALIVE 0x01
115#define BGP_DEBUG_UPDATE_IN 0x01
116#define BGP_DEBUG_UPDATE_OUT 0x02
16286195 117#define BGP_DEBUG_UPDATE_PREFIX 0x04
a39275d7 118#define BGP_DEBUG_ZEBRA 0x01
cebb7440 119#define BGP_DEBUG_ALLOW_MARTIANS 0x01
fb018d25 120#define BGP_DEBUG_NHT 0x01
3f9c7369 121#define BGP_DEBUG_UPDATE_GROUPS 0x01
ddb5b488
PZ
122#define BGP_DEBUG_VPN_LEAK_FROM_VRF 0x01
123#define BGP_DEBUG_VPN_LEAK_TO_VRF 0x02
124#define BGP_DEBUG_VPN_LEAK_RMAP_EVENT 0x04
125#define BGP_DEBUG_VPN_LEAK_LABEL 0x08
268e1b9b 126#define BGP_DEBUG_FLOWSPEC 0x01
955bfd98 127#define BGP_DEBUG_LABELPOOL 0x01
1a80fc0f 128#define BGP_DEBUG_PBR 0x01
f146bb54 129#define BGP_DEBUG_PBR_ERROR 0x02
718e3744 130
131#define BGP_DEBUG_PACKET_SEND 0x01
132#define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
133
718e3744 134#define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
135#define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
136
137#define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
138#define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
139
d62a17ae 140#define DEBUG_ON(a, b) \
141 do { \
142 CONF_DEBUG_ON(a, b); \
143 TERM_DEBUG_ON(a, b); \
144 } while (0)
145#define DEBUG_OFF(a, b) \
146 do { \
147 CONF_DEBUG_OFF(a, b); \
148 TERM_DEBUG_OFF(a, b); \
149 } while (0)
718e3744 150
151#define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
152#define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
153
6d58272b 154extern const char *bgp_type_str[];
052ea98b 155extern const char *pmsi_tnltype_str[];
718e3744 156
d62a17ae 157extern int bgp_dump_attr(struct attr *, char *, size_t);
167d390a 158extern int bgp_debug_peer_updout_enabled(char *host);
3a8c7ba1
DW
159extern const char *bgp_notify_code_str(char);
160extern const char *bgp_notify_subcode_str(char, char);
d62a17ae 161extern void bgp_notify_print(struct peer *, struct bgp_notify *, const char *);
718e3744 162
b2d933f8 163extern const struct message bgp_status_msg[];
16286195
DS
164extern int bgp_debug_neighbor_events(struct peer *peer);
165extern int bgp_debug_keepalive(struct peer *peer);
3f9c7369 166extern int bgp_debug_update(struct peer *peer, struct prefix *p,
d62a17ae 167 struct update_group *updgrp, unsigned int inbound);
9fbdd100 168extern int bgp_debug_bestpath(struct prefix *p);
16286195 169extern int bgp_debug_zebra(struct prefix *p);
00d252cb 170
90dcf2d7 171extern int bgp_debug_count(void);
d62a17ae 172extern const char *bgp_debug_rdpfxpath2str(afi_t, safi_t, struct prefix_rd *,
a4d82a8a 173 union prefixconstptr, mpls_label_t *,
d7c0a89a 174 uint32_t, int, uint32_t, char *,
a4d82a8a 175 int);
d7c0a89a 176const char *bgp_notify_admin_message(char *buf, size_t bufsz, uint8_t *data,
d62a17ae 177 size_t datalen);
38de8d02 178
00d252cb 179#endif /* _QUAGGA_BGP_DEBUG_H */