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