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