Line data Source code
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 0 : DEFINE_HOOK(zebra_debug_show_debugging, (struct vty *vty), (vty));
33 :
34 0 : 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 0 : vty_out(vty, "Zebra debugging status:\n");
42 :
43 0 : if (IS_ZEBRA_DEBUG_EVENT)
44 0 : vty_out(vty, " Zebra event debugging is on\n");
45 :
46 0 : if (IS_ZEBRA_DEBUG_PACKET) {
47 0 : if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV) {
48 0 : vty_out(vty, " Zebra packet%s debugging is on\n",
49 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
50 : } else {
51 0 : if (IS_ZEBRA_DEBUG_SEND)
52 0 : vty_out(vty,
53 : " Zebra packet send%s debugging is on\n",
54 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
55 : else
56 0 : vty_out(vty,
57 : " Zebra packet receive%s debugging is on\n",
58 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
59 : }
60 : }
61 :
62 0 : if (IS_ZEBRA_DEBUG_KERNEL)
63 0 : vty_out(vty, " Zebra kernel debugging is on\n");
64 0 : if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND)
65 0 : vty_out(vty,
66 : " Zebra kernel netlink message dumps (send) are on\n");
67 0 : if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV)
68 0 : 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 0 : if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED))
73 0 : vty_out(vty, " Zebra RIB detailed debugging is on\n");
74 0 : else if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB))
75 0 : vty_out(vty, " Zebra RIB debugging is on\n");
76 :
77 0 : if (IS_ZEBRA_DEBUG_FPM)
78 0 : vty_out(vty, " Zebra FPM debugging is on\n");
79 0 : if (IS_ZEBRA_DEBUG_NHT_DETAILED)
80 0 : vty_out(vty, " Zebra detailed next-hop tracking debugging is on\n");
81 0 : else if (IS_ZEBRA_DEBUG_NHT)
82 0 : vty_out(vty, " Zebra next-hop tracking debugging is on\n");
83 0 : if (IS_ZEBRA_DEBUG_MPLS_DETAIL)
84 0 : vty_out(vty, " Zebra detailed MPLS debugging is on\n");
85 0 : else if (IS_ZEBRA_DEBUG_MPLS)
86 0 : vty_out(vty, " Zebra MPLS debugging is on\n");
87 :
88 0 : if (IS_ZEBRA_DEBUG_VXLAN)
89 0 : vty_out(vty, " Zebra VXLAN debugging is on\n");
90 0 : if (IS_ZEBRA_DEBUG_PW)
91 0 : vty_out(vty, " Zebra pseudowire debugging is on\n");
92 0 : if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
93 0 : vty_out(vty, " Zebra detailed dataplane debugging is on\n");
94 0 : else if (IS_ZEBRA_DEBUG_DPLANE)
95 0 : vty_out(vty, " Zebra dataplane debugging is on\n");
96 0 : if (IS_ZEBRA_DEBUG_DPLANE_DPDK_DETAIL)
97 0 : vty_out(vty,
98 : " Zebra detailed dpdk dataplane debugging is on\n");
99 0 : else if (IS_ZEBRA_DEBUG_DPLANE_DPDK)
100 0 : vty_out(vty, " Zebra dataplane dpdk debugging is on\n");
101 0 : if (IS_ZEBRA_DEBUG_MLAG)
102 0 : vty_out(vty, " Zebra mlag debugging is on\n");
103 0 : if (IS_ZEBRA_DEBUG_NHG_DETAIL)
104 0 : vty_out(vty, " Zebra detailed nexthop debugging is on\n");
105 0 : else if (IS_ZEBRA_DEBUG_NHG)
106 0 : vty_out(vty, " Zebra nexthop debugging is on\n");
107 :
108 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_ES)
109 0 : vty_out(vty, " Zebra EVPN-MH ethernet segment debugging is on\n");
110 :
111 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_NH)
112 0 : vty_out(vty, " Zebra EVPN-MH nexthop debugging is on\n");
113 :
114 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_MAC)
115 0 : vty_out(vty, " Zebra EVPN-MH MAC debugging is on\n");
116 :
117 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH)
118 0 : vty_out(vty, " Zebra EVPN-MH Neigh debugging is on\n");
119 :
120 0 : if (IS_ZEBRA_DEBUG_PBR)
121 0 : vty_out(vty, " Zebra PBR debugging is on\n");
122 :
123 0 : hook_call(zebra_debug_show_debugging, vty);
124 :
125 0 : cmd_show_lib_debugs(vty);
126 :
127 0 : return CMD_SUCCESS;
128 : }
129 :
130 0 : 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 0 : zebra_debug_event = ZEBRA_DEBUG_EVENT;
138 0 : return CMD_SUCCESS;
139 : }
140 :
141 0 : 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 0 : int idx = 0;
150 :
151 0 : zebra_debug_nht = ZEBRA_DEBUG_NHT;
152 :
153 0 : if (argv_find(argv, argc, "detailed", &idx))
154 0 : zebra_debug_nht |= ZEBRA_DEBUG_NHT_DETAILED;
155 :
156 0 : return CMD_SUCCESS;
157 : }
158 :
159 0 : 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 0 : zebra_debug_mpls = ZEBRA_DEBUG_MPLS;
168 :
169 0 : if (detail)
170 0 : zebra_debug_mpls |= ZEBRA_DEBUG_MPLS_DETAILED;
171 :
172 0 : return CMD_SUCCESS;
173 : }
174 :
175 0 : 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 0 : zebra_debug_vxlan = ZEBRA_DEBUG_VXLAN;
183 0 : return CMD_SUCCESS;
184 : }
185 :
186 0 : 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 0 : if (strmatch(argv[0]->text, "no"))
195 0 : UNSET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW);
196 : else
197 0 : SET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW);
198 0 : return CMD_SUCCESS;
199 : }
200 :
201 0 : 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 0 : int idx = 0;
212 0 : zebra_debug_packet = ZEBRA_DEBUG_PACKET;
213 :
214 0 : if (argv_find(argv, argc, "send", &idx))
215 0 : SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND);
216 0 : else if (argv_find(argv, argc, "recv", &idx))
217 0 : SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV);
218 : else {
219 0 : SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND);
220 0 : SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV);
221 : }
222 :
223 0 : if (argv_find(argv, argc, "detail", &idx))
224 0 : SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL);
225 :
226 0 : return CMD_SUCCESS;
227 : }
228 :
229 0 : 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 0 : SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL);
237 :
238 0 : return CMD_SUCCESS;
239 : }
240 :
241 : #if defined(HAVE_NETLINK)
242 0 : 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 0 : int idx = 0;
253 :
254 0 : if (argv_find(argv, argc, "recv", &idx))
255 0 : SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
256 0 : else if (argv_find(argv, argc, "send", &idx))
257 0 : SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
258 : else {
259 0 : SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
260 0 : SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
261 : }
262 :
263 0 : return CMD_SUCCESS;
264 : }
265 : #endif
266 :
267 2 : 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 2 : int idx = 0;
276 2 : SET_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB);
277 :
278 2 : if (argv_find(argv, argc, "detailed", &idx))
279 0 : SET_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED);
280 :
281 2 : return CMD_SUCCESS;
282 : }
283 :
284 0 : 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 0 : SET_FLAG(zebra_debug_fpm, ZEBRA_DEBUG_FPM);
292 0 : return CMD_SUCCESS;
293 : }
294 :
295 0 : 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 0 : int idx = 0;
304 :
305 0 : SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE);
306 :
307 0 : if (argv_find(argv, argc, "detailed", &idx))
308 0 : SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED);
309 :
310 0 : return CMD_SUCCESS;
311 : }
312 :
313 0 : 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 0 : if (no) {
322 0 : UNSET_FLAG(zebra_debug_dplane_dpdk, ZEBRA_DEBUG_DPLANE_DPDK);
323 0 : UNSET_FLAG(zebra_debug_dplane_dpdk,
324 : ZEBRA_DEBUG_DPLANE_DPDK_DETAIL);
325 : } else {
326 0 : SET_FLAG(zebra_debug_dplane_dpdk, ZEBRA_DEBUG_DPLANE_DPDK);
327 :
328 0 : if (detail)
329 0 : SET_FLAG(zebra_debug_dplane_dpdk,
330 : ZEBRA_DEBUG_DPLANE_DPDK_DETAIL);
331 : }
332 :
333 0 : return CMD_SUCCESS;
334 : }
335 :
336 0 : 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 0 : SET_FLAG(zebra_debug_pbr, ZEBRA_DEBUG_PBR);
344 0 : return CMD_SUCCESS;
345 : }
346 :
347 0 : 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 0 : if (no)
356 0 : UNSET_FLAG(zebra_debug_neigh, ZEBRA_DEBUG_NEIGH);
357 : else
358 0 : SET_FLAG(zebra_debug_neigh, ZEBRA_DEBUG_NEIGH);
359 :
360 0 : return CMD_SUCCESS;
361 : }
362 :
363 0 : 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 0 : SET_FLAG(zebra_debug_tc, ZEBRA_DEBUG_TC);
371 0 : return CMD_SUCCESS;
372 : }
373 :
374 0 : 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 0 : if (no)
383 0 : UNSET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG);
384 : else
385 0 : SET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG);
386 0 : return CMD_SUCCESS;
387 : }
388 :
389 0 : 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 0 : if (es) {
403 0 : if (no)
404 0 : UNSET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_ES);
405 : else
406 0 : SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_ES);
407 : }
408 :
409 0 : if (mac) {
410 0 : if (no)
411 0 : UNSET_FLAG(zebra_debug_evpn_mh,
412 : ZEBRA_DEBUG_EVPN_MH_MAC);
413 : else
414 0 : SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_MAC);
415 : }
416 :
417 0 : if (neigh) {
418 0 : if (no)
419 0 : UNSET_FLAG(zebra_debug_evpn_mh,
420 : ZEBRA_DEBUG_EVPN_MH_NEIGH);
421 : else
422 0 : SET_FLAG(zebra_debug_evpn_mh,
423 : ZEBRA_DEBUG_EVPN_MH_NEIGH);
424 : }
425 :
426 0 : if (nh) {
427 0 : if (no)
428 0 : UNSET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_NH);
429 : else
430 0 : SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_NH);
431 : }
432 :
433 0 : return CMD_SUCCESS;
434 : }
435 :
436 0 : 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 0 : zebra_debug_event = 0;
445 0 : return CMD_SUCCESS;
446 : }
447 :
448 0 : 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 0 : zebra_debug_nht = 0;
458 0 : return CMD_SUCCESS;
459 : }
460 :
461 0 : 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 0 : zebra_debug_mpls = 0;
471 0 : return CMD_SUCCESS;
472 : }
473 :
474 0 : 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 0 : zebra_debug_vxlan = 0;
483 0 : return CMD_SUCCESS;
484 : }
485 :
486 0 : 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 0 : zebra_debug_packet = 0;
498 0 : return CMD_SUCCESS;
499 : }
500 :
501 0 : 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 0 : UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL);
510 :
511 0 : return CMD_SUCCESS;
512 : }
513 :
514 : #if defined(HAVE_NETLINK)
515 0 : 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 0 : int idx = 0;
527 :
528 0 : if (argv_find(argv, argc, "recv", &idx))
529 0 : UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
530 0 : else if (argv_find(argv, argc, "send", &idx))
531 0 : UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
532 : else {
533 0 : UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV);
534 0 : UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND);
535 : }
536 :
537 0 : return CMD_SUCCESS;
538 : }
539 : #endif
540 :
541 0 : 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 0 : zebra_debug_rib = 0;
551 0 : return CMD_SUCCESS;
552 : }
553 :
554 0 : 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 0 : zebra_debug_fpm = 0;
563 0 : return CMD_SUCCESS;
564 : }
565 :
566 0 : 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 0 : zebra_debug_dplane = 0;
575 0 : return CMD_SUCCESS;
576 : }
577 :
578 0 : 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 0 : zebra_debug_pbr = 0;
587 0 : return CMD_SUCCESS;
588 : }
589 :
590 0 : 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 0 : if (no)
600 0 : zebra_debug_nexthop = 0;
601 : else {
602 0 : SET_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG);
603 :
604 0 : if (detail)
605 0 : SET_FLAG(zebra_debug_nexthop,
606 : ZEBRA_DEBUG_NHG_DETAILED);
607 : }
608 :
609 0 : 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 0 : static int config_write_debug(struct vty *vty)
622 : {
623 0 : int write = 0;
624 :
625 0 : if (IS_ZEBRA_DEBUG_EVENT) {
626 0 : vty_out(vty, "debug zebra events\n");
627 0 : write++;
628 : }
629 0 : if (IS_ZEBRA_DEBUG_PACKET) {
630 0 : if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV) {
631 0 : vty_out(vty, "debug zebra packet%s\n",
632 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
633 0 : write++;
634 : } else {
635 0 : if (IS_ZEBRA_DEBUG_SEND)
636 0 : vty_out(vty, "debug zebra packet send%s\n",
637 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
638 : else
639 0 : vty_out(vty, "debug zebra packet recv%s\n",
640 0 : IS_ZEBRA_DEBUG_DETAIL ? " detail" : "");
641 0 : write++;
642 : }
643 : }
644 :
645 0 : if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND
646 0 : && IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) {
647 0 : vty_out(vty, "debug zebra kernel msgdump\n");
648 0 : write++;
649 0 : } else if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV) {
650 0 : vty_out(vty, "debug zebra kernel msgdump recv\n");
651 0 : write++;
652 0 : } else if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) {
653 0 : vty_out(vty, "debug zebra kernel msgdump send\n");
654 0 : write++;
655 : }
656 :
657 0 : if (IS_ZEBRA_DEBUG_KERNEL) {
658 0 : vty_out(vty, "debug zebra kernel\n");
659 0 : write++;
660 : }
661 :
662 0 : if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED)) {
663 0 : vty_out(vty, "debug zebra rib detailed\n");
664 0 : write++;
665 0 : } else if (CHECK_FLAG(zebra_debug_rib, ZEBRA_DEBUG_RIB)) {
666 0 : vty_out(vty, "debug zebra rib\n");
667 0 : write++;
668 : }
669 :
670 0 : if (IS_ZEBRA_DEBUG_FPM) {
671 0 : vty_out(vty, "debug zebra fpm\n");
672 0 : write++;
673 : }
674 :
675 0 : if (IS_ZEBRA_DEBUG_NHT_DETAILED) {
676 0 : vty_out(vty, "debug zebra nht detailed\n");
677 0 : write++;
678 0 : } else if (IS_ZEBRA_DEBUG_NHT) {
679 0 : vty_out(vty, "debug zebra nht\n");
680 0 : write++;
681 : }
682 :
683 0 : if (IS_ZEBRA_DEBUG_MPLS_DETAIL) {
684 0 : vty_out(vty, "debug zebra mpls detailed\n");
685 0 : write++;
686 0 : } else if (IS_ZEBRA_DEBUG_MPLS) {
687 0 : vty_out(vty, "debug zebra mpls\n");
688 0 : write++;
689 : }
690 :
691 0 : if (IS_ZEBRA_DEBUG_VXLAN) {
692 0 : vty_out(vty, "debug zebra vxlan\n");
693 0 : write++;
694 : }
695 0 : if (IS_ZEBRA_DEBUG_MLAG) {
696 0 : vty_out(vty, "debug zebra mlag\n");
697 0 : write++;
698 : }
699 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_ES) {
700 0 : vty_out(vty, "debug zebra evpn mh es\n");
701 0 : write++;
702 : }
703 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_NH) {
704 0 : vty_out(vty, "debug zebra evpn mh nh\n");
705 0 : write++;
706 : }
707 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_MAC) {
708 0 : vty_out(vty, "debug zebra evpn mh mac\n");
709 0 : write++;
710 : }
711 0 : if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) {
712 0 : vty_out(vty, "debug zebra evpn mh neigh\n");
713 0 : write++;
714 : }
715 0 : if (IS_ZEBRA_DEBUG_PW) {
716 0 : vty_out(vty, "debug zebra pseudowires\n");
717 0 : write++;
718 : }
719 :
720 0 : if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED)) {
721 0 : vty_out(vty, "debug zebra dplane detailed\n");
722 0 : write++;
723 0 : } else if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE)) {
724 0 : vty_out(vty, "debug zebra dplane\n");
725 0 : write++;
726 : }
727 :
728 0 : if (CHECK_FLAG(zebra_debug_dplane_dpdk,
729 : ZEBRA_DEBUG_DPLANE_DPDK_DETAIL)) {
730 0 : vty_out(vty, "debug zebra dplane dpdk detailed\n");
731 0 : write++;
732 0 : } else if (CHECK_FLAG(zebra_debug_dplane_dpdk,
733 : ZEBRA_DEBUG_DPLANE_DPDK)) {
734 0 : vty_out(vty, "debug zebra dplane dpdk\n");
735 0 : write++;
736 : }
737 :
738 0 : if (CHECK_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG_DETAILED)) {
739 0 : vty_out(vty, "debug zebra nexthop detail\n");
740 0 : write++;
741 0 : } else if (CHECK_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG)) {
742 0 : vty_out(vty, "debug zebra nexthop\n");
743 0 : write++;
744 : }
745 :
746 0 : if (IS_ZEBRA_DEBUG_PBR) {
747 0 : vty_out(vty, "debug zebra pbr\n");
748 0 : write++;
749 : }
750 :
751 0 : if (IS_ZEBRA_DEBUG_NEIGH) {
752 0 : vty_out(vty, "debug zebra neigh\n");
753 0 : write++;
754 : }
755 :
756 0 : return write;
757 : }
758 :
759 2 : void zebra_debug_init(void)
760 : {
761 2 : zebra_debug_event = 0;
762 2 : zebra_debug_packet = 0;
763 2 : zebra_debug_kernel = 0;
764 2 : zebra_debug_rib = 0;
765 2 : zebra_debug_fpm = 0;
766 2 : zebra_debug_mpls = 0;
767 2 : zebra_debug_vxlan = 0;
768 2 : zebra_debug_pw = 0;
769 2 : zebra_debug_dplane = 0;
770 2 : zebra_debug_dplane_dpdk = 0;
771 2 : zebra_debug_mlag = 0;
772 2 : zebra_debug_evpn_mh = 0;
773 2 : zebra_debug_nht = 0;
774 2 : zebra_debug_nexthop = 0;
775 2 : zebra_debug_pbr = 0;
776 2 : zebra_debug_neigh = 0;
777 :
778 2 : install_node(&debug_node);
779 :
780 2 : install_element(ENABLE_NODE, &show_debugging_zebra_cmd);
781 :
782 2 : install_element(ENABLE_NODE, &debug_zebra_events_cmd);
783 2 : install_element(ENABLE_NODE, &debug_zebra_nht_cmd);
784 2 : install_element(ENABLE_NODE, &debug_zebra_mpls_cmd);
785 2 : install_element(ENABLE_NODE, &debug_zebra_vxlan_cmd);
786 2 : install_element(ENABLE_NODE, &debug_zebra_pw_cmd);
787 2 : install_element(ENABLE_NODE, &debug_zebra_packet_cmd);
788 2 : install_element(ENABLE_NODE, &debug_zebra_kernel_cmd);
789 : #if defined(HAVE_NETLINK)
790 2 : install_element(ENABLE_NODE, &debug_zebra_kernel_msgdump_cmd);
791 : #endif
792 2 : install_element(ENABLE_NODE, &debug_zebra_rib_cmd);
793 2 : install_element(ENABLE_NODE, &debug_zebra_fpm_cmd);
794 2 : install_element(ENABLE_NODE, &debug_zebra_dplane_cmd);
795 2 : install_element(ENABLE_NODE, &debug_zebra_mlag_cmd);
796 2 : install_element(ENABLE_NODE, &debug_zebra_nexthop_cmd);
797 2 : install_element(ENABLE_NODE, &debug_zebra_pbr_cmd);
798 2 : install_element(ENABLE_NODE, &debug_zebra_neigh_cmd);
799 2 : install_element(ENABLE_NODE, &debug_zebra_tc_cmd);
800 2 : install_element(ENABLE_NODE, &debug_zebra_dplane_dpdk_cmd);
801 2 : install_element(ENABLE_NODE, &no_debug_zebra_events_cmd);
802 2 : install_element(ENABLE_NODE, &no_debug_zebra_nht_cmd);
803 2 : install_element(ENABLE_NODE, &no_debug_zebra_mpls_cmd);
804 2 : install_element(ENABLE_NODE, &no_debug_zebra_vxlan_cmd);
805 2 : install_element(ENABLE_NODE, &no_debug_zebra_packet_cmd);
806 2 : install_element(ENABLE_NODE, &no_debug_zebra_kernel_cmd);
807 : #if defined(HAVE_NETLINK)
808 2 : install_element(ENABLE_NODE, &no_debug_zebra_kernel_msgdump_cmd);
809 : #endif
810 2 : install_element(ENABLE_NODE, &no_debug_zebra_rib_cmd);
811 2 : install_element(ENABLE_NODE, &no_debug_zebra_fpm_cmd);
812 2 : install_element(ENABLE_NODE, &no_debug_zebra_dplane_cmd);
813 2 : install_element(ENABLE_NODE, &no_debug_zebra_pbr_cmd);
814 2 : install_element(ENABLE_NODE, &debug_zebra_evpn_mh_cmd);
815 :
816 2 : install_element(CONFIG_NODE, &debug_zebra_events_cmd);
817 2 : install_element(CONFIG_NODE, &debug_zebra_nht_cmd);
818 2 : install_element(CONFIG_NODE, &debug_zebra_mpls_cmd);
819 2 : install_element(CONFIG_NODE, &debug_zebra_vxlan_cmd);
820 2 : install_element(CONFIG_NODE, &debug_zebra_pw_cmd);
821 2 : install_element(CONFIG_NODE, &debug_zebra_packet_cmd);
822 2 : install_element(CONFIG_NODE, &debug_zebra_kernel_cmd);
823 : #if defined(HAVE_NETLINK)
824 2 : install_element(CONFIG_NODE, &debug_zebra_kernel_msgdump_cmd);
825 : #endif
826 2 : install_element(CONFIG_NODE, &debug_zebra_rib_cmd);
827 2 : install_element(CONFIG_NODE, &debug_zebra_fpm_cmd);
828 2 : install_element(CONFIG_NODE, &debug_zebra_dplane_cmd);
829 2 : install_element(CONFIG_NODE, &debug_zebra_dplane_dpdk_cmd);
830 2 : install_element(CONFIG_NODE, &debug_zebra_nexthop_cmd);
831 2 : install_element(CONFIG_NODE, &debug_zebra_pbr_cmd);
832 2 : install_element(CONFIG_NODE, &debug_zebra_neigh_cmd);
833 :
834 2 : install_element(CONFIG_NODE, &no_debug_zebra_events_cmd);
835 2 : install_element(CONFIG_NODE, &no_debug_zebra_nht_cmd);
836 2 : install_element(CONFIG_NODE, &no_debug_zebra_mpls_cmd);
837 2 : install_element(CONFIG_NODE, &no_debug_zebra_vxlan_cmd);
838 2 : install_element(CONFIG_NODE, &no_debug_zebra_packet_cmd);
839 2 : install_element(CONFIG_NODE, &no_debug_zebra_kernel_cmd);
840 : #if defined(HAVE_NETLINK)
841 2 : install_element(CONFIG_NODE, &no_debug_zebra_kernel_msgdump_cmd);
842 : #endif
843 2 : install_element(CONFIG_NODE, &no_debug_zebra_rib_cmd);
844 2 : install_element(CONFIG_NODE, &no_debug_zebra_fpm_cmd);
845 2 : install_element(CONFIG_NODE, &no_debug_zebra_dplane_cmd);
846 2 : install_element(CONFIG_NODE, &no_debug_zebra_pbr_cmd);
847 2 : install_element(CONFIG_NODE, &debug_zebra_mlag_cmd);
848 2 : install_element(CONFIG_NODE, &debug_zebra_evpn_mh_cmd);
849 2 : }
|