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