1 /* BGP message debug header.
2 * Copyright (C) 1996, 97, 98 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
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
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.
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
21 #ifndef _QUAGGA_BGP_DEBUG_H
22 #define _QUAGGA_BGP_DEBUG_H
25 #include "bgp_updgrp.h"
27 /* sort of packet direction */
33 #define DUMP_WITHDRAW 8
37 #define DUMP_DETAIL 32
39 /* RD + Prefix + Path-Id */
40 #define BGP_PRD_PATH_STRLEN (PREFIX_STRLEN + RD_ADDRSTRLEN + 20)
43 extern int dump_update
;
44 extern int dump_keepalive
;
45 extern int dump_notify
;
47 extern int Debug_Event
;
48 extern int Debug_Keepalive
;
49 extern int Debug_Update
;
50 extern int Debug_Radix
;
60 extern void bgp_debug_init(void);
61 extern void bgp_packet_dump(struct stream
*);
63 extern int debug(unsigned int option
);
65 extern unsigned long conf_bgp_debug_as4
;
66 extern unsigned long conf_bgp_debug_neighbor_events
;
67 extern unsigned long conf_bgp_debug_packet
;
68 extern unsigned long conf_bgp_debug_keepalive
;
69 extern unsigned long conf_bgp_debug_update
;
70 extern unsigned long conf_bgp_debug_bestpath
;
71 extern unsigned long conf_bgp_debug_zebra
;
72 extern unsigned long conf_bgp_debug_allow_martians
;
73 extern unsigned long conf_bgp_debug_nht
;
74 extern unsigned long conf_bgp_debug_update_groups
;
75 extern unsigned long conf_bgp_debug_vpn
;
76 extern unsigned long conf_bgp_debug_flowspec
;
77 extern unsigned long conf_bgp_debug_labelpool
;
78 extern unsigned long conf_bgp_debug_pbr
;
79 extern unsigned long conf_bgp_debug_graceful_restart
;
81 extern unsigned long term_bgp_debug_as4
;
82 extern unsigned long term_bgp_debug_neighbor_events
;
83 extern unsigned long term_bgp_debug_packet
;
84 extern unsigned long term_bgp_debug_keepalive
;
85 extern unsigned long term_bgp_debug_update
;
86 extern unsigned long term_bgp_debug_bestpath
;
87 extern unsigned long term_bgp_debug_zebra
;
88 extern unsigned long term_bgp_debug_allow_martians
;
89 extern unsigned long term_bgp_debug_nht
;
90 extern unsigned long term_bgp_debug_update_groups
;
91 extern unsigned long term_bgp_debug_vpn
;
92 extern unsigned long term_bgp_debug_flowspec
;
93 extern unsigned long term_bgp_debug_labelpool
;
94 extern unsigned long term_bgp_debug_pbr
;
95 extern unsigned long term_bgp_debug_graceful_restart
;
97 extern struct list
*bgp_debug_neighbor_events_peers
;
98 extern struct list
*bgp_debug_keepalive_peers
;
99 extern struct list
*bgp_debug_update_in_peers
;
100 extern struct list
*bgp_debug_update_out_peers
;
101 extern struct list
*bgp_debug_update_prefixes
;
102 extern struct list
*bgp_debug_bestpath_prefixes
;
103 extern struct list
*bgp_debug_zebra_prefixes
;
105 struct bgp_debug_filter
{
110 #define BGP_DEBUG_AS4 0x01
111 #define BGP_DEBUG_AS4_SEGMENT 0x02
113 #define BGP_DEBUG_BESTPATH 0x01
114 #define BGP_DEBUG_NEIGHBOR_EVENTS 0x01
115 #define BGP_DEBUG_PACKET 0x01
116 #define BGP_DEBUG_KEEPALIVE 0x01
117 #define BGP_DEBUG_UPDATE_IN 0x01
118 #define BGP_DEBUG_UPDATE_OUT 0x02
119 #define BGP_DEBUG_UPDATE_PREFIX 0x04
120 #define BGP_DEBUG_ZEBRA 0x01
121 #define BGP_DEBUG_ALLOW_MARTIANS 0x01
122 #define BGP_DEBUG_NHT 0x01
123 #define BGP_DEBUG_UPDATE_GROUPS 0x01
124 #define BGP_DEBUG_VPN_LEAK_FROM_VRF 0x01
125 #define BGP_DEBUG_VPN_LEAK_TO_VRF 0x02
126 #define BGP_DEBUG_VPN_LEAK_RMAP_EVENT 0x04
127 #define BGP_DEBUG_VPN_LEAK_LABEL 0x08
128 #define BGP_DEBUG_FLOWSPEC 0x01
129 #define BGP_DEBUG_LABELPOOL 0x01
130 #define BGP_DEBUG_PBR 0x01
131 #define BGP_DEBUG_PBR_ERROR 0x02
133 #define BGP_DEBUG_PACKET_SEND 0x01
134 #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
136 #define BGP_DEBUG_GRACEFUL_RESTART 0x01
138 #define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
139 #define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
141 #define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
142 #define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
144 #define DEBUG_ON(a, b) \
146 CONF_DEBUG_ON(a, b); \
147 TERM_DEBUG_ON(a, b); \
149 #define DEBUG_OFF(a, b) \
151 CONF_DEBUG_OFF(a, b); \
152 TERM_DEBUG_OFF(a, b); \
155 #define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
156 #define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
158 extern const char *const bgp_type_str
[];
160 extern int bgp_dump_attr(struct attr
*, char *, size_t);
161 extern int bgp_debug_peer_updout_enabled(char *host
);
162 extern const char *bgp_notify_code_str(char);
163 extern const char *bgp_notify_subcode_str(char, char);
164 extern void bgp_notify_print(struct peer
*, struct bgp_notify
*, const char *);
166 extern const struct message bgp_status_msg
[];
167 extern int bgp_debug_neighbor_events(struct peer
*peer
);
168 extern int bgp_debug_keepalive(struct peer
*peer
);
169 extern int bgp_debug_update(struct peer
*peer
, struct prefix
*p
,
170 struct update_group
*updgrp
, unsigned int inbound
);
171 extern int bgp_debug_bestpath(struct prefix
*p
);
172 extern int bgp_debug_zebra(struct prefix
*p
);
174 extern const char *bgp_debug_rdpfxpath2str(afi_t
, safi_t
, struct prefix_rd
*,
175 union prefixconstptr
, mpls_label_t
*,
176 uint32_t, int, uint32_t, char *,
178 const char *bgp_notify_admin_message(char *buf
, size_t bufsz
, uint8_t *data
,
181 #endif /* _QUAGGA_BGP_DEBUG_H */