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