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