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