]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
2 | * Zebra debug related function | |
3 | * Copyright (C) 1999 Kunihiro Ishiguro | |
4 | * | |
5 | * This file is part of GNU Zebra. | |
6 | * | |
7 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License as published by the | |
9 | * Free Software Foundation; either version 2, or (at your option) any | |
10 | * later version. | |
11 | * | |
12 | * GNU Zebra is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
896014f4 DL |
17 | * You should have received a copy of the GNU General Public License along |
18 | * with this program; see the file COPYING; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
718e3744 | 20 | */ |
21 | ||
22 | #include <zebra.h> | |
23 | #include "command.h" | |
24 | #include "debug.h" | |
25 | ||
23666725 DS |
26 | #ifndef VTYSH_EXTRACT_PL |
27 | #include "zebra/debug_clippy.c" | |
28 | #endif | |
29 | ||
718e3744 | 30 | /* For debug statement. */ |
31 | unsigned long zebra_debug_event; | |
32 | unsigned long zebra_debug_packet; | |
33 | unsigned long zebra_debug_kernel; | |
b0498dc6 | 34 | unsigned long zebra_debug_rib; |
5adc2528 | 35 | unsigned long zebra_debug_fpm; |
fb018d25 | 36 | unsigned long zebra_debug_nht; |
7758e3f3 | 37 | unsigned long zebra_debug_mpls; |
13d60d35 | 38 | unsigned long zebra_debug_vxlan; |
6833ae01 | 39 | unsigned long zebra_debug_pw; |
6582b002 | 40 | unsigned long zebra_debug_dplane; |
23666725 | 41 | unsigned long zebra_debug_mlag; |
718e3744 | 42 | |
77151b6f PG |
43 | DEFINE_HOOK(zebra_debug_show_debugging, (struct vty *vty), (vty)); |
44 | ||
87f6dc50 DS |
45 | DEFUN_NOSH (show_debugging_zebra, |
46 | show_debugging_zebra_cmd, | |
47 | "show debugging [zebra]", | |
48 | SHOW_STR | |
49 | "Debugging information\n" | |
50 | "Zebra configuration\n") | |
718e3744 | 51 | { |
d62a17ae | 52 | vty_out(vty, "Zebra debugging status:\n"); |
53 | ||
54 | if (IS_ZEBRA_DEBUG_EVENT) | |
55 | vty_out(vty, " Zebra event debugging is on\n"); | |
56 | ||
57 | if (IS_ZEBRA_DEBUG_PACKET) { | |
58 | if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV) { | |
59 | vty_out(vty, " Zebra packet%s debugging is on\n", | |
60 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
61 | } else { | |
62 | if (IS_ZEBRA_DEBUG_SEND) | |
63 | vty_out(vty, | |
64 | " Zebra packet send%s debugging is on\n", | |
65 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
66 | else | |
67 | vty_out(vty, | |
68 | " Zebra packet receive%s debugging is on\n", | |
69 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
70 | } | |
718e3744 | 71 | } |
d62a17ae | 72 | |
73 | if (IS_ZEBRA_DEBUG_KERNEL) | |
74 | vty_out(vty, " Zebra kernel debugging is on\n"); | |
75 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) | |
76 | vty_out(vty, | |
77 | " Zebra kernel netlink message dumps (send) are on\n"); | |
78 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) | |
79 | vty_out(vty, | |
80 | " Zebra kernel netlink message dumps (recv) are on\n"); | |
81 | ||
82 | /* Check here using flags as the 'macro' does an OR */ | |
d62a17ae | 83 | if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED)) |
84 | vty_out(vty, " Zebra RIB detailed debugging is on\n"); | |
ba9d46ff DW |
85 | else if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB)) |
86 | vty_out(vty, " Zebra RIB debugging is on\n"); | |
d62a17ae | 87 | |
88 | if (IS_ZEBRA_DEBUG_FPM) | |
89 | vty_out(vty, " Zebra FPM debugging is on\n"); | |
50872b08 DS |
90 | if (IS_ZEBRA_DEBUG_NHT_DETAILED) |
91 | vty_out(vty, " Zebra detailed next-hop tracking debugging is on\n"); | |
92 | else if (IS_ZEBRA_DEBUG_NHT) | |
d62a17ae | 93 | vty_out(vty, " Zebra next-hop tracking debugging is on\n"); |
94 | if (IS_ZEBRA_DEBUG_MPLS) | |
95 | vty_out(vty, " Zebra MPLS debugging is on\n"); | |
95744ad8 DS |
96 | if (IS_ZEBRA_DEBUG_VXLAN) |
97 | vty_out(vty, " Zebra VXLAN debugging is on\n"); | |
6833ae01 | 98 | if (IS_ZEBRA_DEBUG_PW) |
99 | vty_out(vty, " Zebra pseudowire debugging is on\n"); | |
6582b002 MS |
100 | if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) |
101 | vty_out(vty, " Zebra detailed dataplane debugging is on\n"); | |
102 | else if (IS_ZEBRA_DEBUG_DPLANE) | |
103 | vty_out(vty, " Zebra dataplane debugging is on\n"); | |
23666725 DS |
104 | if (IS_ZEBRA_DEBUG_MLAG) |
105 | vty_out(vty, " Zebra mlag debugging is on\n"); | |
d62a17ae | 106 | |
77151b6f | 107 | hook_call(zebra_debug_show_debugging, vty); |
d62a17ae | 108 | return CMD_SUCCESS; |
718e3744 | 109 | } |
110 | ||
111 | DEFUN (debug_zebra_events, | |
112 | debug_zebra_events_cmd, | |
113 | "debug zebra events", | |
114 | DEBUG_STR | |
115 | "Zebra configuration\n" | |
116 | "Debug option set for zebra events\n") | |
117 | { | |
d62a17ae | 118 | zebra_debug_event = ZEBRA_DEBUG_EVENT; |
8527ce3a | 119 | return CMD_SUCCESS; |
718e3744 | 120 | } |
121 | ||
fb018d25 DS |
122 | DEFUN (debug_zebra_nht, |
123 | debug_zebra_nht_cmd, | |
50872b08 | 124 | "debug zebra nht [detailed]", |
fb018d25 DS |
125 | DEBUG_STR |
126 | "Zebra configuration\n" | |
50872b08 DS |
127 | "Debug option set for zebra next hop tracking\n" |
128 | "Debug option set for detailed info\n") | |
fb018d25 | 129 | { |
50872b08 DS |
130 | int idx = 0; |
131 | ||
d62a17ae | 132 | zebra_debug_nht = ZEBRA_DEBUG_NHT; |
50872b08 DS |
133 | |
134 | if (argv_find(argv, argc, "detailed", &idx)) | |
135 | zebra_debug_nht |= ZEBRA_DEBUG_NHT_DETAILED; | |
136 | ||
8527ce3a | 137 | return CMD_SUCCESS; |
fb018d25 DS |
138 | } |
139 | ||
7758e3f3 | 140 | DEFUN (debug_zebra_mpls, |
141 | debug_zebra_mpls_cmd, | |
142 | "debug zebra mpls", | |
143 | DEBUG_STR | |
144 | "Zebra configuration\n" | |
145 | "Debug option set for zebra MPLS LSPs\n") | |
146 | { | |
d62a17ae | 147 | zebra_debug_mpls = ZEBRA_DEBUG_MPLS; |
8527ce3a | 148 | return CMD_SUCCESS; |
7758e3f3 | 149 | } |
150 | ||
13d60d35 | 151 | DEFUN (debug_zebra_vxlan, |
152 | debug_zebra_vxlan_cmd, | |
153 | "debug zebra vxlan", | |
154 | DEBUG_STR | |
155 | "Zebra configuration\n" | |
156 | "Debug option set for zebra VxLAN (EVPN)\n") | |
157 | { | |
d62a17ae | 158 | zebra_debug_vxlan = ZEBRA_DEBUG_VXLAN; |
8527ce3a | 159 | return CMD_SUCCESS; |
13d60d35 | 160 | } |
161 | ||
6833ae01 | 162 | DEFUN (debug_zebra_pw, |
163 | debug_zebra_pw_cmd, | |
164 | "[no] debug zebra pseudowires", | |
efd7904e | 165 | NO_STR |
6833ae01 | 166 | DEBUG_STR |
167 | "Zebra configuration\n" | |
168 | "Debug option set for zebra pseudowires\n") | |
169 | { | |
170 | if (strmatch(argv[0]->text, "no")) | |
171 | UNSET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW); | |
172 | else | |
173 | SET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW); | |
8527ce3a | 174 | return CMD_SUCCESS; |
6833ae01 | 175 | } |
176 | ||
718e3744 | 177 | DEFUN (debug_zebra_packet, |
178 | debug_zebra_packet_cmd, | |
16cedbb0 | 179 | "debug zebra packet [<recv|send>] [detail]", |
718e3744 | 180 | DEBUG_STR |
181 | "Zebra configuration\n" | |
182 | "Debug option set for zebra packet\n" | |
183 | "Debug option set for receive packet\n" | |
16cedbb0 QY |
184 | "Debug option set for send packet\n" |
185 | "Debug option set for detailed info\n") | |
718e3744 | 186 | { |
d62a17ae | 187 | int idx = 0; |
188 | zebra_debug_packet = ZEBRA_DEBUG_PACKET; | |
189 | ||
190 | if (argv_find(argv, argc, "send", &idx)) | |
191 | SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); | |
ba9d46ff | 192 | else if (argv_find(argv, argc, "recv", &idx)) |
d62a17ae | 193 | SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); |
ba9d46ff | 194 | else { |
d62a17ae | 195 | SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); |
196 | SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); | |
197 | } | |
ba9d46ff DW |
198 | |
199 | if (argv_find(argv, argc, "detail", &idx)) | |
200 | SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); | |
201 | ||
d62a17ae | 202 | return CMD_SUCCESS; |
718e3744 | 203 | } |
204 | ||
205 | DEFUN (debug_zebra_kernel, | |
206 | debug_zebra_kernel_cmd, | |
207 | "debug zebra kernel", | |
208 | DEBUG_STR | |
209 | "Zebra configuration\n" | |
210 | "Debug option set for zebra between kernel interface\n") | |
211 | { | |
d62a17ae | 212 | SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL); |
ba9d46ff DW |
213 | |
214 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) | |
215 | UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); | |
216 | ||
217 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) | |
218 | UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); | |
219 | ||
d62a17ae | 220 | return CMD_SUCCESS; |
556b904e QY |
221 | } |
222 | ||
223 | DEFUN (debug_zebra_kernel_msgdump, | |
224 | debug_zebra_kernel_msgdump_cmd, | |
6de69f83 | 225 | "debug zebra kernel msgdump [<recv|send>]", |
556b904e QY |
226 | DEBUG_STR |
227 | "Zebra configuration\n" | |
228 | "Debug option set for zebra between kernel interface\n" | |
229 | "Dump raw netlink messages, sent and received\n" | |
230 | "Dump raw netlink messages received\n" | |
231 | "Dump raw netlink messages sent\n") | |
232 | { | |
d62a17ae | 233 | int idx = 0; |
ba9d46ff DW |
234 | |
235 | if (argv_find(argv, argc, "recv", &idx)) { | |
d62a17ae | 236 | SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); |
ba9d46ff DW |
237 | |
238 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) | |
996c9314 LB |
239 | UNSET_FLAG(zebra_debug_kernel, |
240 | ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); | |
ba9d46ff DW |
241 | |
242 | } else if (argv_find(argv, argc, "send", &idx)) { | |
d62a17ae | 243 | SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); |
313605cb | 244 | |
ba9d46ff | 245 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) |
996c9314 LB |
246 | UNSET_FLAG(zebra_debug_kernel, |
247 | ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); | |
ba9d46ff DW |
248 | |
249 | } else { | |
250 | SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); | |
251 | SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); | |
252 | } | |
253 | ||
d62a17ae | 254 | return CMD_SUCCESS; |
718e3744 | 255 | } |
256 | ||
b0498dc6 PJ |
257 | DEFUN (debug_zebra_rib, |
258 | debug_zebra_rib_cmd, | |
ba9d46ff | 259 | "debug zebra rib [detailed]", |
b0498dc6 PJ |
260 | DEBUG_STR |
261 | "Zebra configuration\n" | |
262 | "Debug RIB events\n" | |
41ec9222 | 263 | "Detailed debugs\n") |
b0498dc6 | 264 | { |
ba9d46ff DW |
265 | int idx = 0; |
266 | SET_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB); | |
267 | ||
268 | if (argv_find(argv, argc, "detailed", &idx)) | |
269 | SET_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED); | |
270 | ||
d62a17ae | 271 | return CMD_SUCCESS; |
b0498dc6 PJ |
272 | } |
273 | ||
5adc2528 AS |
274 | DEFUN (debug_zebra_fpm, |
275 | debug_zebra_fpm_cmd, | |
276 | "debug zebra fpm", | |
277 | DEBUG_STR | |
278 | "Zebra configuration\n" | |
279 | "Debug zebra FPM events\n") | |
280 | { | |
d62a17ae | 281 | SET_FLAG(zebra_debug_fpm, ZEBRA_DEBUG_FPM); |
282 | return CMD_SUCCESS; | |
5adc2528 AS |
283 | } |
284 | ||
6582b002 MS |
285 | DEFUN (debug_zebra_dplane, |
286 | debug_zebra_dplane_cmd, | |
5be41a1c | 287 | "debug zebra dplane [detailed]", |
6582b002 MS |
288 | DEBUG_STR |
289 | "Zebra configuration\n" | |
5be41a1c MS |
290 | "Debug zebra dataplane events\n" |
291 | "Detailed debug information\n") | |
6582b002 MS |
292 | { |
293 | int idx = 0; | |
5709131c | 294 | |
6582b002 MS |
295 | SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE); |
296 | ||
297 | if (argv_find(argv, argc, "detailed", &idx)) | |
298 | SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED); | |
299 | ||
300 | return CMD_SUCCESS; | |
301 | } | |
302 | ||
23666725 DS |
303 | DEFPY (debug_zebra_mlag, |
304 | debug_zebra_mlag_cmd, | |
305 | "[no$no] debug zebra mlag", | |
306 | NO_STR | |
307 | DEBUG_STR | |
308 | "Zebra configuration\n" | |
309 | "Debug option set for mlag events\n") | |
310 | { | |
311 | if (no) | |
312 | UNSET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG); | |
313 | else | |
314 | SET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG); | |
315 | return CMD_SUCCESS; | |
316 | } | |
317 | ||
718e3744 | 318 | DEFUN (no_debug_zebra_events, |
319 | no_debug_zebra_events_cmd, | |
320 | "no debug zebra events", | |
321 | NO_STR | |
322 | DEBUG_STR | |
323 | "Zebra configuration\n" | |
324 | "Debug option set for zebra events\n") | |
325 | { | |
d62a17ae | 326 | zebra_debug_event = 0; |
327 | return CMD_SUCCESS; | |
718e3744 | 328 | } |
329 | ||
fb018d25 DS |
330 | DEFUN (no_debug_zebra_nht, |
331 | no_debug_zebra_nht_cmd, | |
50872b08 | 332 | "no debug zebra nht [detailed]", |
fb018d25 DS |
333 | NO_STR |
334 | DEBUG_STR | |
335 | "Zebra configuration\n" | |
50872b08 DS |
336 | "Debug option set for zebra next hop tracking\n" |
337 | "Debug option set for detailed info\n") | |
fb018d25 | 338 | { |
d62a17ae | 339 | zebra_debug_nht = 0; |
340 | return CMD_SUCCESS; | |
fb018d25 DS |
341 | } |
342 | ||
7758e3f3 | 343 | DEFUN (no_debug_zebra_mpls, |
344 | no_debug_zebra_mpls_cmd, | |
345 | "no debug zebra mpls", | |
346 | NO_STR | |
347 | DEBUG_STR | |
348 | "Zebra configuration\n" | |
349 | "Debug option set for zebra MPLS LSPs\n") | |
350 | { | |
d62a17ae | 351 | zebra_debug_mpls = 0; |
352 | return CMD_SUCCESS; | |
7758e3f3 | 353 | } |
354 | ||
13d60d35 | 355 | DEFUN (no_debug_zebra_vxlan, |
356 | no_debug_zebra_vxlan_cmd, | |
357 | "no debug zebra vxlan", | |
358 | NO_STR | |
359 | DEBUG_STR | |
360 | "Zebra configuration\n" | |
361 | "Debug option set for zebra VxLAN (EVPN)\n") | |
362 | { | |
d62a17ae | 363 | zebra_debug_vxlan = 0; |
364 | return CMD_SUCCESS; | |
13d60d35 | 365 | } |
366 | ||
718e3744 | 367 | DEFUN (no_debug_zebra_packet, |
368 | no_debug_zebra_packet_cmd, | |
ba9d46ff | 369 | "no debug zebra packet [<recv|send>] [detail]", |
718e3744 | 370 | NO_STR |
371 | DEBUG_STR | |
372 | "Zebra configuration\n" | |
373 | "Debug option set for zebra packet\n" | |
374 | "Debug option set for receive packet\n" | |
ba9d46ff DW |
375 | "Debug option set for send packet\n" |
376 | "Debug option set for detailed info\n") | |
718e3744 | 377 | { |
ba9d46ff | 378 | zebra_debug_packet = 0; |
d62a17ae | 379 | return CMD_SUCCESS; |
718e3744 | 380 | } |
381 | ||
382 | DEFUN (no_debug_zebra_kernel, | |
383 | no_debug_zebra_kernel_cmd, | |
384 | "no debug zebra kernel", | |
385 | NO_STR | |
386 | DEBUG_STR | |
387 | "Zebra configuration\n" | |
388 | "Debug option set for zebra between kernel interface\n") | |
389 | { | |
ba9d46ff | 390 | zebra_debug_kernel = 0; |
d62a17ae | 391 | return CMD_SUCCESS; |
556b904e QY |
392 | } |
393 | ||
394 | DEFUN (no_debug_zebra_kernel_msgdump, | |
395 | no_debug_zebra_kernel_msgdump_cmd, | |
6de69f83 | 396 | "no debug zebra kernel msgdump [<recv|send>]", |
16cedbb0 | 397 | NO_STR |
556b904e QY |
398 | DEBUG_STR |
399 | "Zebra configuration\n" | |
400 | "Debug option set for zebra between kernel interface\n" | |
401 | "Dump raw netlink messages, sent and received\n" | |
402 | "Dump raw netlink messages received\n" | |
403 | "Dump raw netlink messages sent\n") | |
404 | { | |
ba9d46ff | 405 | zebra_debug_kernel = 0; |
d62a17ae | 406 | return CMD_SUCCESS; |
718e3744 | 407 | } |
408 | ||
b0498dc6 PJ |
409 | DEFUN (no_debug_zebra_rib, |
410 | no_debug_zebra_rib_cmd, | |
ba9d46ff | 411 | "no debug zebra rib [detailed]", |
b0498dc6 PJ |
412 | NO_STR |
413 | DEBUG_STR | |
414 | "Zebra configuration\n" | |
415 | "Debug zebra RIB\n" | |
41ec9222 | 416 | "Detailed debugs\n") |
b0498dc6 | 417 | { |
ba9d46ff | 418 | zebra_debug_rib = 0; |
d62a17ae | 419 | return CMD_SUCCESS; |
b0498dc6 PJ |
420 | } |
421 | ||
5adc2528 AS |
422 | DEFUN (no_debug_zebra_fpm, |
423 | no_debug_zebra_fpm_cmd, | |
424 | "no debug zebra fpm", | |
425 | NO_STR | |
426 | DEBUG_STR | |
427 | "Zebra configuration\n" | |
428 | "Debug zebra FPM events\n") | |
429 | { | |
d62a17ae | 430 | zebra_debug_fpm = 0; |
431 | return CMD_SUCCESS; | |
5adc2528 AS |
432 | } |
433 | ||
6582b002 MS |
434 | DEFUN (no_debug_zebra_dplane, |
435 | no_debug_zebra_dplane_cmd, | |
436 | "no debug zebra dplane", | |
437 | NO_STR | |
438 | DEBUG_STR | |
439 | "Zebra configuration\n" | |
440 | "Debug zebra dataplane events\n") | |
441 | { | |
442 | zebra_debug_dplane = 0; | |
443 | return CMD_SUCCESS; | |
444 | } | |
445 | ||
718e3744 | 446 | /* Debug node. */ |
d62a17ae | 447 | struct cmd_node debug_node = {DEBUG_NODE, "", /* Debug node has no interface. */ |
448 | 1}; | |
718e3744 | 449 | |
d62a17ae | 450 | static int config_write_debug(struct vty *vty) |
718e3744 | 451 | { |
d62a17ae | 452 | int write = 0; |
453 | ||
454 | if (IS_ZEBRA_DEBUG_EVENT) { | |
455 | vty_out(vty, "debug zebra events\n"); | |
456 | write++; | |
457 | } | |
458 | if (IS_ZEBRA_DEBUG_PACKET) { | |
459 | if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV) { | |
460 | vty_out(vty, "debug zebra packet%s\n", | |
461 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
462 | write++; | |
463 | } else { | |
464 | if (IS_ZEBRA_DEBUG_SEND) | |
465 | vty_out(vty, "debug zebra packet send%s\n", | |
466 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
467 | else | |
468 | vty_out(vty, "debug zebra packet recv%s\n", | |
469 | IS_ZEBRA_DEBUG_DETAIL ? " detail" : ""); | |
470 | write++; | |
471 | } | |
472 | } | |
ba9d46ff | 473 | |
d62a17ae | 474 | if (IS_ZEBRA_DEBUG_KERNEL) { |
996c9314 LB |
475 | if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND |
476 | && IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) { | |
ba9d46ff DW |
477 | vty_out(vty, "debug zebra kernel msgdump\n"); |
478 | write++; | |
479 | } else if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) { | |
480 | vty_out(vty, "debug zebra kernel msgdump recv\n"); | |
481 | write++; | |
482 | } else if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) { | |
483 | vty_out(vty, "debug zebra kernel msgdump send\n"); | |
484 | write++; | |
485 | } else { | |
486 | vty_out(vty, "debug zebra kernel\n"); | |
487 | write++; | |
488 | } | |
d62a17ae | 489 | } |
ba9d46ff | 490 | |
d62a17ae | 491 | if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED)) { |
492 | vty_out(vty, "debug zebra rib detailed\n"); | |
493 | write++; | |
ba9d46ff DW |
494 | } else if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB)) { |
495 | vty_out(vty, "debug zebra rib\n"); | |
496 | write++; | |
d62a17ae | 497 | } |
ba9d46ff | 498 | |
d62a17ae | 499 | if (IS_ZEBRA_DEBUG_FPM) { |
500 | vty_out(vty, "debug zebra fpm\n"); | |
501 | write++; | |
502 | } | |
50872b08 DS |
503 | |
504 | if (IS_ZEBRA_DEBUG_NHT_DETAILED) { | |
505 | vty_out(vty, "debug zebra nht detailed\n"); | |
506 | write++; | |
507 | } else if (IS_ZEBRA_DEBUG_NHT) { | |
d62a17ae | 508 | vty_out(vty, "debug zebra nht\n"); |
509 | write++; | |
510 | } | |
50872b08 | 511 | |
d62a17ae | 512 | if (IS_ZEBRA_DEBUG_MPLS) { |
513 | vty_out(vty, "debug zebra mpls\n"); | |
514 | write++; | |
718e3744 | 515 | } |
d62a17ae | 516 | if (IS_ZEBRA_DEBUG_VXLAN) { |
517 | vty_out(vty, "debug zebra vxlan\n"); | |
518 | write++; | |
718e3744 | 519 | } |
6833ae01 | 520 | if (IS_ZEBRA_DEBUG_PW) { |
69965f53 | 521 | vty_out(vty, "debug zebra pseudowires\n"); |
6833ae01 | 522 | write++; |
523 | } | |
6582b002 MS |
524 | |
525 | if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED)) { | |
526 | vty_out(vty, "debug zebra dplane detailed\n"); | |
527 | write++; | |
528 | } else if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE)) { | |
529 | vty_out(vty, "debug zebra dplane\n"); | |
530 | write++; | |
531 | } | |
532 | ||
d62a17ae | 533 | return write; |
718e3744 | 534 | } |
535 | ||
d62a17ae | 536 | void zebra_debug_init(void) |
718e3744 | 537 | { |
d62a17ae | 538 | zebra_debug_event = 0; |
539 | zebra_debug_packet = 0; | |
540 | zebra_debug_kernel = 0; | |
541 | zebra_debug_rib = 0; | |
542 | zebra_debug_fpm = 0; | |
543 | zebra_debug_mpls = 0; | |
544 | zebra_debug_vxlan = 0; | |
6833ae01 | 545 | zebra_debug_pw = 0; |
6582b002 | 546 | zebra_debug_dplane = 0; |
23666725 | 547 | zebra_debug_mlag = 0; |
50872b08 | 548 | zebra_debug_nht = 0; |
d62a17ae | 549 | |
550 | install_node(&debug_node, config_write_debug); | |
551 | ||
552 | install_element(VIEW_NODE, &show_debugging_zebra_cmd); | |
553 | ||
554 | install_element(ENABLE_NODE, &debug_zebra_events_cmd); | |
555 | install_element(ENABLE_NODE, &debug_zebra_nht_cmd); | |
556 | install_element(ENABLE_NODE, &debug_zebra_mpls_cmd); | |
557 | install_element(ENABLE_NODE, &debug_zebra_vxlan_cmd); | |
6833ae01 | 558 | install_element(ENABLE_NODE, &debug_zebra_pw_cmd); |
d62a17ae | 559 | install_element(ENABLE_NODE, &debug_zebra_packet_cmd); |
560 | install_element(ENABLE_NODE, &debug_zebra_kernel_cmd); | |
561 | install_element(ENABLE_NODE, &debug_zebra_kernel_msgdump_cmd); | |
562 | install_element(ENABLE_NODE, &debug_zebra_rib_cmd); | |
d62a17ae | 563 | install_element(ENABLE_NODE, &debug_zebra_fpm_cmd); |
6582b002 | 564 | install_element(ENABLE_NODE, &debug_zebra_dplane_cmd); |
23666725 | 565 | install_element(ENABLE_NODE, &debug_zebra_mlag_cmd); |
d62a17ae | 566 | install_element(ENABLE_NODE, &no_debug_zebra_events_cmd); |
567 | install_element(ENABLE_NODE, &no_debug_zebra_nht_cmd); | |
568 | install_element(ENABLE_NODE, &no_debug_zebra_mpls_cmd); | |
569 | install_element(ENABLE_NODE, &no_debug_zebra_vxlan_cmd); | |
570 | install_element(ENABLE_NODE, &no_debug_zebra_packet_cmd); | |
571 | install_element(ENABLE_NODE, &no_debug_zebra_kernel_cmd); | |
572 | install_element(ENABLE_NODE, &no_debug_zebra_kernel_msgdump_cmd); | |
573 | install_element(ENABLE_NODE, &no_debug_zebra_rib_cmd); | |
d62a17ae | 574 | install_element(ENABLE_NODE, &no_debug_zebra_fpm_cmd); |
6582b002 | 575 | install_element(ENABLE_NODE, &no_debug_zebra_dplane_cmd); |
d62a17ae | 576 | |
577 | install_element(CONFIG_NODE, &debug_zebra_events_cmd); | |
578 | install_element(CONFIG_NODE, &debug_zebra_nht_cmd); | |
579 | install_element(CONFIG_NODE, &debug_zebra_mpls_cmd); | |
580 | install_element(CONFIG_NODE, &debug_zebra_vxlan_cmd); | |
6833ae01 | 581 | install_element(CONFIG_NODE, &debug_zebra_pw_cmd); |
d62a17ae | 582 | install_element(CONFIG_NODE, &debug_zebra_packet_cmd); |
583 | install_element(CONFIG_NODE, &debug_zebra_kernel_cmd); | |
584 | install_element(CONFIG_NODE, &debug_zebra_kernel_msgdump_cmd); | |
585 | install_element(CONFIG_NODE, &debug_zebra_rib_cmd); | |
d62a17ae | 586 | install_element(CONFIG_NODE, &debug_zebra_fpm_cmd); |
6582b002 | 587 | install_element(CONFIG_NODE, &debug_zebra_dplane_cmd); |
d62a17ae | 588 | install_element(CONFIG_NODE, &no_debug_zebra_events_cmd); |
589 | install_element(CONFIG_NODE, &no_debug_zebra_nht_cmd); | |
590 | install_element(CONFIG_NODE, &no_debug_zebra_mpls_cmd); | |
591 | install_element(CONFIG_NODE, &no_debug_zebra_vxlan_cmd); | |
592 | install_element(CONFIG_NODE, &no_debug_zebra_packet_cmd); | |
593 | install_element(CONFIG_NODE, &no_debug_zebra_kernel_cmd); | |
594 | install_element(CONFIG_NODE, &no_debug_zebra_kernel_msgdump_cmd); | |
595 | install_element(CONFIG_NODE, &no_debug_zebra_rib_cmd); | |
d62a17ae | 596 | install_element(CONFIG_NODE, &no_debug_zebra_fpm_cmd); |
6582b002 | 597 | install_element(CONFIG_NODE, &no_debug_zebra_dplane_cmd); |
718e3744 | 598 | } |