2 * RIPng debug output routines
3 * Copyright (C) 1998 Kunihiro Ishiguro
5 * This file is part of GNU Zebra.
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
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.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Zebra; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 #include "ripngd/ripng_debug.h"
27 /* For debug statement. */
28 unsigned long ripng_debug_event = 0;
29 unsigned long ripng_debug_packet = 0;
30 unsigned long ripng_debug_zebra = 0;
32 DEFUN (show_debugging_ripng,
33 show_debugging_ripng_cmd,
34 "show debugging ripng",
37 "RIPng configuration\n")
39 vty_out (vty, "RIPng debugging status:%s", VTY_NEWLINE);
41 if (IS_RIPNG_DEBUG_EVENT)
42 vty_out (vty, " RIPng event debugging is on%s", VTY_NEWLINE);
44 if (IS_RIPNG_DEBUG_PACKET)
46 if (IS_RIPNG_DEBUG_SEND && IS_RIPNG_DEBUG_RECV)
48 vty_out (vty, " RIPng packet debugging is on%s",
53 if (IS_RIPNG_DEBUG_SEND)
54 vty_out (vty, " RIPng packet send debugging is on%s",
57 vty_out (vty, " RIPng packet receive debugging is on%s",
62 if (IS_RIPNG_DEBUG_ZEBRA)
63 vty_out (vty, " RIPng zebra debugging is on%s", VTY_NEWLINE);
68 DEFUN (debug_ripng_events,
69 debug_ripng_events_cmd,
72 "RIPng configuration\n"
73 "Debug option set for ripng events\n")
75 ripng_debug_event = RIPNG_DEBUG_EVENT;
79 DEFUN (debug_ripng_packet,
80 debug_ripng_packet_cmd,
83 "RIPng configuration\n"
84 "Debug option set for ripng packet\n")
86 ripng_debug_packet = RIPNG_DEBUG_PACKET;
87 ripng_debug_packet |= RIPNG_DEBUG_SEND;
88 ripng_debug_packet |= RIPNG_DEBUG_RECV;
92 DEFUN (debug_ripng_packet_direct,
93 debug_ripng_packet_direct_cmd,
94 "debug ripng packet (recv|send)",
96 "RIPng configuration\n"
97 "Debug option set for ripng packet\n"
98 "Debug option set for receive packet\n"
99 "Debug option set for send packet\n")
101 ripng_debug_packet |= RIPNG_DEBUG_PACKET;
102 if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
103 ripng_debug_packet |= RIPNG_DEBUG_SEND;
104 if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
105 ripng_debug_packet |= RIPNG_DEBUG_RECV;
110 /* N.B. the "detail" modifier is a no-op. we leave this command
111 for legacy compatibility. */
112 DEFUN_DEPRECATED (debug_ripng_packet_detail,
113 debug_ripng_packet_detail_cmd,
114 "debug ripng packet (recv|send) detail",
116 "RIPng configuration\n"
117 "Debug option set for ripng packet\n"
118 "Debug option set for receive packet\n"
119 "Debug option set for send packet\n"
120 "Debug option set detaied information\n")
122 ripng_debug_packet |= RIPNG_DEBUG_PACKET;
123 if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
124 ripng_debug_packet |= RIPNG_DEBUG_SEND;
125 if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
126 ripng_debug_packet |= RIPNG_DEBUG_RECV;
131 DEFUN (debug_ripng_zebra,
132 debug_ripng_zebra_cmd,
135 "RIPng configuration\n"
136 "Debug option set for ripng and zebra communication\n")
138 ripng_debug_zebra = RIPNG_DEBUG_ZEBRA;
142 DEFUN (no_debug_ripng_events,
143 no_debug_ripng_events_cmd,
144 "no debug ripng events",
147 "RIPng configuration\n"
148 "Debug option set for ripng events\n")
150 ripng_debug_event = 0;
154 DEFUN (no_debug_ripng_packet,
155 no_debug_ripng_packet_cmd,
156 "no debug ripng packet",
159 "RIPng configuration\n"
160 "Debug option set for ripng packet\n")
162 ripng_debug_packet = 0;
166 DEFUN (no_debug_ripng_packet_direct,
167 no_debug_ripng_packet_direct_cmd,
168 "no debug ripng packet (recv|send)",
171 "RIPng configuration\n"
172 "Debug option set for ripng packet\n"
173 "Debug option set for receive packet\n"
174 "Debug option set for send packet\n")
176 if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
178 if (IS_RIPNG_DEBUG_RECV)
179 ripng_debug_packet &= ~RIPNG_DEBUG_SEND;
181 ripng_debug_packet = 0;
183 else if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
185 if (IS_RIPNG_DEBUG_SEND)
186 ripng_debug_packet &= ~RIPNG_DEBUG_RECV;
188 ripng_debug_packet = 0;
193 DEFUN (no_debug_ripng_zebra,
194 no_debug_ripng_zebra_cmd,
195 "no debug ripng zebra",
198 "RIPng configuration\n"
199 "Debug option set for ripng and zebra communication\n")
201 ripng_debug_zebra = 0;
206 static struct cmd_node debug_node =
209 "", /* Debug node has no interface. */
214 config_write_debug (struct vty *vty)
218 if (IS_RIPNG_DEBUG_EVENT)
220 vty_out (vty, "debug ripng events%s", VTY_NEWLINE);
223 if (IS_RIPNG_DEBUG_PACKET)
225 if (IS_RIPNG_DEBUG_SEND && IS_RIPNG_DEBUG_RECV)
227 vty_out (vty, "debug ripng packet%s",
233 if (IS_RIPNG_DEBUG_SEND)
234 vty_out (vty, "debug ripng packet send%s",
237 vty_out (vty, "debug ripng packet recv%s",
242 if (IS_RIPNG_DEBUG_ZEBRA)
244 vty_out (vty, "debug ripng zebra%s", VTY_NEWLINE);
253 ripng_debug_event = 0;
254 ripng_debug_packet = 0;
255 ripng_debug_zebra = 0;
261 ripng_debug_event = 0;
262 ripng_debug_packet = 0;
263 ripng_debug_zebra = 0;
265 install_node (&debug_node, config_write_debug);
267 install_element (VIEW_NODE, &show_debugging_ripng_cmd);
269 install_element (ENABLE_NODE, &debug_ripng_events_cmd);
270 install_element (ENABLE_NODE, &debug_ripng_packet_cmd);
271 install_element (ENABLE_NODE, &debug_ripng_packet_direct_cmd);
272 install_element (ENABLE_NODE, &debug_ripng_packet_detail_cmd);
273 install_element (ENABLE_NODE, &debug_ripng_zebra_cmd);
274 install_element (ENABLE_NODE, &no_debug_ripng_events_cmd);
275 install_element (ENABLE_NODE, &no_debug_ripng_packet_cmd);
276 install_element (ENABLE_NODE, &no_debug_ripng_packet_direct_cmd);
277 install_element (ENABLE_NODE, &no_debug_ripng_zebra_cmd);
279 install_element (CONFIG_NODE, &debug_ripng_events_cmd);
280 install_element (CONFIG_NODE, &debug_ripng_packet_cmd);
281 install_element (CONFIG_NODE, &debug_ripng_packet_direct_cmd);
282 install_element (CONFIG_NODE, &debug_ripng_packet_detail_cmd);
283 install_element (CONFIG_NODE, &debug_ripng_zebra_cmd);
284 install_element (CONFIG_NODE, &no_debug_ripng_events_cmd);
285 install_element (CONFIG_NODE, &no_debug_ripng_packet_cmd);
286 install_element (CONFIG_NODE, &no_debug_ripng_packet_direct_cmd);
287 install_element (CONFIG_NODE, &no_debug_ripng_zebra_cmd);