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