]> git.proxmox.com Git - mirror_frr.git/blob - zebra/debug.c
Merge pull request #9383 from idryzhov/ospf-no-vrf-init
[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 DEFPY (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 #if defined(HAVE_NETLINK)
248 DEFUN (debug_zebra_kernel_msgdump,
249 debug_zebra_kernel_msgdump_cmd,
250 "debug zebra kernel msgdump [<recv|send>]",
251 DEBUG_STR
252 "Zebra configuration\n"
253 "Debug option set for zebra between kernel interface\n"
254 "Dump raw netlink messages, sent and received\n"
255 "Dump raw netlink messages received\n"
256 "Dump raw netlink messages sent\n")
257 {
258 int idx = 0;
259
260 if (argv_find(argv, argc, "recv", &idx))
261 SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
262 else if (argv_find(argv, argc, "send", &idx))
263 SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
264 else {
265 SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
266 SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
267 }
268
269 return CMD_SUCCESS;
270 }
271 #endif
272
273 DEFUN (debug_zebra_rib,
274 debug_zebra_rib_cmd,
275 "debug zebra rib [detailed]",
276 DEBUG_STR
277 "Zebra configuration\n"
278 "Debug RIB events\n"
279 "Detailed debugs\n")
280 {
281 int idx = 0;
282 SET_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB);
283
284 if (argv_find(argv, argc, "detailed", &idx))
285 SET_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED);
286
287 return CMD_SUCCESS;
288 }
289
290 DEFUN (debug_zebra_fpm,
291 debug_zebra_fpm_cmd,
292 "debug zebra fpm",
293 DEBUG_STR
294 "Zebra configuration\n"
295 "Debug zebra FPM events\n")
296 {
297 SET_FLAG(zebra_debug_fpm, ZEBRA_DEBUG_FPM);
298 return CMD_SUCCESS;
299 }
300
301 DEFUN (debug_zebra_dplane,
302 debug_zebra_dplane_cmd,
303 "debug zebra dplane [detailed]",
304 DEBUG_STR
305 "Zebra configuration\n"
306 "Debug zebra dataplane events\n"
307 "Detailed debug information\n")
308 {
309 int idx = 0;
310
311 SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE);
312
313 if (argv_find(argv, argc, "detailed", &idx))
314 SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED);
315
316 return CMD_SUCCESS;
317 }
318
319 DEFUN (debug_zebra_pbr,
320 debug_zebra_pbr_cmd,
321 "debug zebra pbr",
322 DEBUG_STR
323 "Zebra configuration\n"
324 "Debug zebra pbr events\n")
325 {
326 SET_FLAG(zebra_debug_pbr, ZEBRA_DEBUG_PBR);
327 return CMD_SUCCESS;
328 }
329
330 DEFPY (debug_zebra_mlag,
331 debug_zebra_mlag_cmd,
332 "[no$no] debug zebra mlag",
333 NO_STR
334 DEBUG_STR
335 "Zebra configuration\n"
336 "Debug option set for mlag events\n")
337 {
338 if (no)
339 UNSET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG);
340 else
341 SET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG);
342 return CMD_SUCCESS;
343 }
344
345 DEFPY (debug_zebra_evpn_mh,
346 debug_zebra_evpn_mh_cmd,
347 "[no$no] debug zebra evpn mh <es$es|mac$mac|neigh$neigh|nh$nh>",
348 NO_STR
349 DEBUG_STR
350 "Zebra configuration\n"
351 "EVPN\n"
352 "Multihoming\n"
353 "Ethernet Segment Debugging\n"
354 "MAC Debugging\n"
355 "Neigh Debugging\n"
356 "Nexthop Debugging\n")
357 {
358 if (es) {
359 if (no)
360 UNSET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_ES);
361 else
362 SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_ES);
363 }
364
365 if (mac) {
366 if (no)
367 UNSET_FLAG(zebra_debug_evpn_mh,
368 ZEBRA_DEBUG_EVPN_MH_MAC);
369 else
370 SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_MAC);
371 }
372
373 if (neigh) {
374 if (no)
375 UNSET_FLAG(zebra_debug_evpn_mh,
376 ZEBRA_DEBUG_EVPN_MH_NEIGH);
377 else
378 SET_FLAG(zebra_debug_evpn_mh,
379 ZEBRA_DEBUG_EVPN_MH_NEIGH);
380 }
381
382 if (nh) {
383 if (no)
384 UNSET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_NH);
385 else
386 SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_NH);
387 }
388
389 return CMD_SUCCESS;
390 }
391
392 DEFUN (no_debug_zebra_events,
393 no_debug_zebra_events_cmd,
394 "no debug zebra events",
395 NO_STR
396 DEBUG_STR
397 "Zebra configuration\n"
398 "Debug option set for zebra events\n")
399 {
400 zebra_debug_event = 0;
401 return CMD_SUCCESS;
402 }
403
404 DEFUN (no_debug_zebra_nht,
405 no_debug_zebra_nht_cmd,
406 "no debug zebra nht [detailed]",
407 NO_STR
408 DEBUG_STR
409 "Zebra configuration\n"
410 "Debug option set for zebra next hop tracking\n"
411 "Debug option set for detailed info\n")
412 {
413 zebra_debug_nht = 0;
414 return CMD_SUCCESS;
415 }
416
417 DEFUN (no_debug_zebra_mpls,
418 no_debug_zebra_mpls_cmd,
419 "no debug zebra mpls [detailed]",
420 NO_STR
421 DEBUG_STR
422 "Zebra configuration\n"
423 "Debug option set for zebra MPLS LSPs\n"
424 "Debug option for zebra detailed info\n")
425 {
426 zebra_debug_mpls = 0;
427 return CMD_SUCCESS;
428 }
429
430 DEFUN (no_debug_zebra_vxlan,
431 no_debug_zebra_vxlan_cmd,
432 "no debug zebra vxlan",
433 NO_STR
434 DEBUG_STR
435 "Zebra configuration\n"
436 "Debug option set for zebra VxLAN (EVPN)\n")
437 {
438 zebra_debug_vxlan = 0;
439 return CMD_SUCCESS;
440 }
441
442 DEFUN (no_debug_zebra_packet,
443 no_debug_zebra_packet_cmd,
444 "no debug zebra packet [<recv|send>] [detail]",
445 NO_STR
446 DEBUG_STR
447 "Zebra configuration\n"
448 "Debug option set for zebra packet\n"
449 "Debug option set for receive packet\n"
450 "Debug option set for send packet\n"
451 "Debug option set for detailed info\n")
452 {
453 zebra_debug_packet = 0;
454 return CMD_SUCCESS;
455 }
456
457 DEFUN (no_debug_zebra_kernel,
458 no_debug_zebra_kernel_cmd,
459 "no debug zebra kernel",
460 NO_STR
461 DEBUG_STR
462 "Zebra configuration\n"
463 "Debug option set for zebra between kernel interface\n")
464 {
465 UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL);
466
467 return CMD_SUCCESS;
468 }
469
470 #if defined(HAVE_NETLINK)
471 DEFUN (no_debug_zebra_kernel_msgdump,
472 no_debug_zebra_kernel_msgdump_cmd,
473 "no debug zebra kernel msgdump [<recv|send>]",
474 NO_STR
475 DEBUG_STR
476 "Zebra configuration\n"
477 "Debug option set for zebra between kernel interface\n"
478 "Dump raw netlink messages, sent and received\n"
479 "Dump raw netlink messages received\n"
480 "Dump raw netlink messages sent\n")
481 {
482 int idx = 0;
483
484 if (argv_find(argv, argc, "recv", &idx))
485 UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
486 else if (argv_find(argv, argc, "send", &idx))
487 UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
488 else {
489 UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
490 UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
491 }
492
493 return CMD_SUCCESS;
494 }
495 #endif
496
497 DEFUN (no_debug_zebra_rib,
498 no_debug_zebra_rib_cmd,
499 "no debug zebra rib [detailed]",
500 NO_STR
501 DEBUG_STR
502 "Zebra configuration\n"
503 "Debug zebra RIB\n"
504 "Detailed debugs\n")
505 {
506 zebra_debug_rib = 0;
507 return CMD_SUCCESS;
508 }
509
510 DEFUN (no_debug_zebra_fpm,
511 no_debug_zebra_fpm_cmd,
512 "no debug zebra fpm",
513 NO_STR
514 DEBUG_STR
515 "Zebra configuration\n"
516 "Debug zebra FPM events\n")
517 {
518 zebra_debug_fpm = 0;
519 return CMD_SUCCESS;
520 }
521
522 DEFUN (no_debug_zebra_dplane,
523 no_debug_zebra_dplane_cmd,
524 "no debug zebra dplane",
525 NO_STR
526 DEBUG_STR
527 "Zebra configuration\n"
528 "Debug zebra dataplane events\n")
529 {
530 zebra_debug_dplane = 0;
531 return CMD_SUCCESS;
532 }
533
534 DEFUN (no_debug_zebra_pbr,
535 no_debug_zebra_pbr_cmd,
536 "no debug zebra pbr",
537 NO_STR
538 DEBUG_STR
539 "Zebra configuration\n"
540 "Debug zebra pbr events\n")
541 {
542 zebra_debug_pbr = 0;
543 return CMD_SUCCESS;
544 }
545
546 DEFPY (debug_zebra_nexthop,
547 debug_zebra_nexthop_cmd,
548 "[no$no] debug zebra nexthop [detail$detail]",
549 NO_STR
550 DEBUG_STR
551 "Zebra configuration\n"
552 "Debug zebra nexthop events\n"
553 "Detailed information\n")
554 {
555 if (no)
556 zebra_debug_nexthop = 0;
557 else {
558 SET_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG);
559
560 if (detail)
561 SET_FLAG(zebra_debug_nexthop,
562 ZEBRA_DEBUG_NHG_DETAILED);
563 }
564
565 return CMD_SUCCESS;
566 }
567
568 /* Debug node. */
569 static int config_write_debug(struct vty *vty);
570 struct cmd_node debug_node = {
571 .name = "debug",
572 .node = DEBUG_NODE,
573 .prompt = "",
574 .config_write = config_write_debug,
575 };
576
577 static int config_write_debug(struct vty *vty)
578 {
579 int write = 0;
580
581 if (IS_ZEBRA_DEBUG_EVENT) {
582 vty_out(vty, "debug zebra events\n");
583 write++;
584 }
585 if (IS_ZEBRA_DEBUG_PACKET) {
586 if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV) {
587 vty_out(vty, "debug zebra packet%s\n",
588 IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
589 write++;
590 } else {
591 if (IS_ZEBRA_DEBUG_SEND)
592 vty_out(vty, "debug zebra packet send%s\n",
593 IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
594 else
595 vty_out(vty, "debug zebra packet recv%s\n",
596 IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
597 write++;
598 }
599 }
600
601 if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND
602 && IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) {
603 vty_out(vty, "debug zebra kernel msgdump\n");
604 write++;
605 } else if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) {
606 vty_out(vty, "debug zebra kernel msgdump recv\n");
607 write++;
608 } else if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) {
609 vty_out(vty, "debug zebra kernel msgdump send\n");
610 write++;
611 }
612
613 if (IS_ZEBRA_DEBUG_KERNEL) {
614 vty_out(vty, "debug zebra kernel\n");
615 write++;
616 }
617
618 if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED)) {
619 vty_out(vty, "debug zebra rib detailed\n");
620 write++;
621 } else if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB)) {
622 vty_out(vty, "debug zebra rib\n");
623 write++;
624 }
625
626 if (IS_ZEBRA_DEBUG_FPM) {
627 vty_out(vty, "debug zebra fpm\n");
628 write++;
629 }
630
631 if (IS_ZEBRA_DEBUG_NHT_DETAILED) {
632 vty_out(vty, "debug zebra nht detailed\n");
633 write++;
634 } else if (IS_ZEBRA_DEBUG_NHT) {
635 vty_out(vty, "debug zebra nht\n");
636 write++;
637 }
638
639 if (IS_ZEBRA_DEBUG_MPLS_DETAIL) {
640 vty_out(vty, "debug zebra mpls detailed\n");
641 write++;
642 } else if (IS_ZEBRA_DEBUG_MPLS) {
643 vty_out(vty, "debug zebra mpls\n");
644 write++;
645 }
646
647 if (IS_ZEBRA_DEBUG_VXLAN) {
648 vty_out(vty, "debug zebra vxlan\n");
649 write++;
650 }
651 if (IS_ZEBRA_DEBUG_MLAG) {
652 vty_out(vty, "debug zebra mlag\n");
653 write++;
654 }
655 if (IS_ZEBRA_DEBUG_EVPN_MH_ES) {
656 vty_out(vty, "debug zebra evpn mh es\n");
657 write++;
658 }
659 if (IS_ZEBRA_DEBUG_EVPN_MH_NH) {
660 vty_out(vty, "debug zebra evpn mh nh\n");
661 write++;
662 }
663 if (IS_ZEBRA_DEBUG_EVPN_MH_MAC) {
664 vty_out(vty, "debug zebra evpn mh mac\n");
665 write++;
666 }
667 if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) {
668 vty_out(vty, "debug zebra evpn mh neigh\n");
669 write++;
670 }
671 if (IS_ZEBRA_DEBUG_PW) {
672 vty_out(vty, "debug zebra pseudowires\n");
673 write++;
674 }
675
676 if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED)) {
677 vty_out(vty, "debug zebra dplane detailed\n");
678 write++;
679 } else if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE)) {
680 vty_out(vty, "debug zebra dplane\n");
681 write++;
682 }
683
684 if (CHECK_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG_DETAILED)) {
685 vty_out(vty, "debug zebra nexthop detail\n");
686 write++;
687 } else if (CHECK_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG)) {
688 vty_out(vty, "debug zebra nexthop\n");
689 write++;
690 }
691
692 if (IS_ZEBRA_DEBUG_PBR) {
693 vty_out(vty, "debug zebra pbr\n");
694 write++;
695 }
696
697 return write;
698 }
699
700 void zebra_debug_init(void)
701 {
702 zebra_debug_event = 0;
703 zebra_debug_packet = 0;
704 zebra_debug_kernel = 0;
705 zebra_debug_rib = 0;
706 zebra_debug_fpm = 0;
707 zebra_debug_mpls = 0;
708 zebra_debug_vxlan = 0;
709 zebra_debug_pw = 0;
710 zebra_debug_dplane = 0;
711 zebra_debug_mlag = 0;
712 zebra_debug_evpn_mh = 0;
713 zebra_debug_nht = 0;
714 zebra_debug_nexthop = 0;
715 zebra_debug_pbr = 0;
716
717 install_node(&debug_node);
718
719 install_element(ENABLE_NODE, &show_debugging_zebra_cmd);
720
721 install_element(ENABLE_NODE, &debug_zebra_events_cmd);
722 install_element(ENABLE_NODE, &debug_zebra_nht_cmd);
723 install_element(ENABLE_NODE, &debug_zebra_mpls_cmd);
724 install_element(ENABLE_NODE, &debug_zebra_vxlan_cmd);
725 install_element(ENABLE_NODE, &debug_zebra_pw_cmd);
726 install_element(ENABLE_NODE, &debug_zebra_packet_cmd);
727 install_element(ENABLE_NODE, &debug_zebra_kernel_cmd);
728 #if defined(HAVE_NETLINK)
729 install_element(ENABLE_NODE, &debug_zebra_kernel_msgdump_cmd);
730 #endif
731 install_element(ENABLE_NODE, &debug_zebra_rib_cmd);
732 install_element(ENABLE_NODE, &debug_zebra_fpm_cmd);
733 install_element(ENABLE_NODE, &debug_zebra_dplane_cmd);
734 install_element(ENABLE_NODE, &debug_zebra_mlag_cmd);
735 install_element(ENABLE_NODE, &debug_zebra_nexthop_cmd);
736 install_element(ENABLE_NODE, &debug_zebra_pbr_cmd);
737 install_element(ENABLE_NODE, &no_debug_zebra_events_cmd);
738 install_element(ENABLE_NODE, &no_debug_zebra_nht_cmd);
739 install_element(ENABLE_NODE, &no_debug_zebra_mpls_cmd);
740 install_element(ENABLE_NODE, &no_debug_zebra_vxlan_cmd);
741 install_element(ENABLE_NODE, &no_debug_zebra_packet_cmd);
742 install_element(ENABLE_NODE, &no_debug_zebra_kernel_cmd);
743 #if defined(HAVE_NETLINK)
744 install_element(ENABLE_NODE, &no_debug_zebra_kernel_msgdump_cmd);
745 #endif
746 install_element(ENABLE_NODE, &no_debug_zebra_rib_cmd);
747 install_element(ENABLE_NODE, &no_debug_zebra_fpm_cmd);
748 install_element(ENABLE_NODE, &no_debug_zebra_dplane_cmd);
749 install_element(ENABLE_NODE, &no_debug_zebra_pbr_cmd);
750 install_element(ENABLE_NODE, &debug_zebra_evpn_mh_cmd);
751
752 install_element(CONFIG_NODE, &debug_zebra_events_cmd);
753 install_element(CONFIG_NODE, &debug_zebra_nht_cmd);
754 install_element(CONFIG_NODE, &debug_zebra_mpls_cmd);
755 install_element(CONFIG_NODE, &debug_zebra_vxlan_cmd);
756 install_element(CONFIG_NODE, &debug_zebra_pw_cmd);
757 install_element(CONFIG_NODE, &debug_zebra_packet_cmd);
758 install_element(CONFIG_NODE, &debug_zebra_kernel_cmd);
759 #if defined(HAVE_NETLINK)
760 install_element(CONFIG_NODE, &debug_zebra_kernel_msgdump_cmd);
761 #endif
762 install_element(CONFIG_NODE, &debug_zebra_rib_cmd);
763 install_element(CONFIG_NODE, &debug_zebra_fpm_cmd);
764 install_element(CONFIG_NODE, &debug_zebra_dplane_cmd);
765 install_element(CONFIG_NODE, &debug_zebra_nexthop_cmd);
766 install_element(CONFIG_NODE, &debug_zebra_pbr_cmd);
767
768 install_element(CONFIG_NODE, &no_debug_zebra_events_cmd);
769 install_element(CONFIG_NODE, &no_debug_zebra_nht_cmd);
770 install_element(CONFIG_NODE, &no_debug_zebra_mpls_cmd);
771 install_element(CONFIG_NODE, &no_debug_zebra_vxlan_cmd);
772 install_element(CONFIG_NODE, &no_debug_zebra_packet_cmd);
773 install_element(CONFIG_NODE, &no_debug_zebra_kernel_cmd);
774 #if defined(HAVE_NETLINK)
775 install_element(CONFIG_NODE, &no_debug_zebra_kernel_msgdump_cmd);
776 #endif
777 install_element(CONFIG_NODE, &no_debug_zebra_rib_cmd);
778 install_element(CONFIG_NODE, &no_debug_zebra_fpm_cmd);
779 install_element(CONFIG_NODE, &no_debug_zebra_dplane_cmd);
780 install_element(CONFIG_NODE, &no_debug_zebra_pbr_cmd);
781 install_element(CONFIG_NODE, &debug_zebra_mlag_cmd);
782 install_element(CONFIG_NODE, &debug_zebra_evpn_mh_cmd);
783 }