2 * Copyright (C) 1999 Kunihiro Ishiguro <kunihiro@zebra.org>
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 #include "ripd/rip_debug.h"
26 /* For debug statement. */
27 unsigned long rip_debug_event = 0;
28 unsigned long rip_debug_packet = 0;
29 unsigned long rip_debug_zebra = 0;
31 DEFUN (show_debugging_rip,
32 show_debugging_rip_cmd,
38 vty_out (vty, "RIP debugging status:%s", VTY_NEWLINE);
40 if (IS_RIP_DEBUG_EVENT)
41 vty_out (vty, " RIP event debugging is on%s", VTY_NEWLINE);
43 if (IS_RIP_DEBUG_PACKET)
45 if (IS_RIP_DEBUG_SEND && IS_RIP_DEBUG_RECV)
47 vty_out (vty, " RIP packet debugging is on%s",
52 if (IS_RIP_DEBUG_SEND)
53 vty_out (vty, " RIP packet send debugging is on%s",
56 vty_out (vty, " RIP packet receive debugging is on%s",
61 if (IS_RIP_DEBUG_ZEBRA)
62 vty_out (vty, " RIP zebra debugging is on%s", VTY_NEWLINE);
67 DEFUN (debug_rip_events,
74 rip_debug_event = RIP_DEBUG_EVENT;
78 DEFUN (debug_rip_packet,
85 rip_debug_packet = RIP_DEBUG_PACKET;
86 rip_debug_packet |= RIP_DEBUG_SEND;
87 rip_debug_packet |= RIP_DEBUG_RECV;
91 DEFUN (debug_rip_packet_direct,
92 debug_rip_packet_direct_cmd,
93 "debug rip packet (recv|send)",
97 "RIP receive packet\n"
100 rip_debug_packet |= RIP_DEBUG_PACKET;
101 if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
102 rip_debug_packet |= RIP_DEBUG_SEND;
103 if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
104 rip_debug_packet |= RIP_DEBUG_RECV;
108 /* N.B. the "detail" modifier is a no-op. we leave this command
109 for legacy compatibility. */
110 DEFUN_DEPRECATED (debug_rip_packet_detail,
111 debug_rip_packet_detail_cmd,
112 "debug rip packet (recv|send) detail",
116 "RIP receive packet\n"
118 "Detailed information display\n")
120 rip_debug_packet |= RIP_DEBUG_PACKET;
121 if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
122 rip_debug_packet |= RIP_DEBUG_SEND;
123 if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
124 rip_debug_packet |= RIP_DEBUG_RECV;
128 DEFUN (debug_rip_zebra,
133 "RIP and ZEBRA communication\n")
135 rip_debug_zebra = RIP_DEBUG_ZEBRA;
139 DEFUN (no_debug_rip_events,
140 no_debug_rip_events_cmd,
141 "no debug rip events",
151 DEFUN (no_debug_rip_packet,
152 no_debug_rip_packet_cmd,
153 "no debug rip packet",
159 rip_debug_packet = 0;
163 DEFUN (no_debug_rip_packet_direct,
164 no_debug_rip_packet_direct_cmd,
165 "no debug rip packet (recv|send)",
170 "RIP option set for receive packet\n"
171 "RIP option set for send packet\n")
173 if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
175 if (IS_RIP_DEBUG_RECV)
176 rip_debug_packet &= ~RIP_DEBUG_SEND;
178 rip_debug_packet = 0;
180 else if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
182 if (IS_RIP_DEBUG_SEND)
183 rip_debug_packet &= ~RIP_DEBUG_RECV;
185 rip_debug_packet = 0;
190 DEFUN (no_debug_rip_zebra,
191 no_debug_rip_zebra_cmd,
192 "no debug rip zebra",
196 "RIP and ZEBRA communication\n")
203 static struct cmd_node debug_node =
206 "", /* Debug node has no interface. */
211 config_write_debug (struct vty *vty)
215 if (IS_RIP_DEBUG_EVENT)
217 vty_out (vty, "debug rip events%s", VTY_NEWLINE);
220 if (IS_RIP_DEBUG_PACKET)
222 if (IS_RIP_DEBUG_SEND && IS_RIP_DEBUG_RECV)
224 vty_out (vty, "debug rip packet%s",
230 if (IS_RIP_DEBUG_SEND)
231 vty_out (vty, "debug rip packet send%s",
234 vty_out (vty, "debug rip packet recv%s",
239 if (IS_RIP_DEBUG_ZEBRA)
241 vty_out (vty, "debug rip zebra%s", VTY_NEWLINE);
248 rip_debug_reset (void)
251 rip_debug_packet = 0;
256 rip_debug_init (void)
259 rip_debug_packet = 0;
262 install_node (&debug_node, config_write_debug);
264 install_element (ENABLE_NODE, &show_debugging_rip_cmd);
265 install_element (ENABLE_NODE, &debug_rip_events_cmd);
266 install_element (ENABLE_NODE, &debug_rip_packet_cmd);
267 install_element (ENABLE_NODE, &debug_rip_packet_direct_cmd);
268 install_element (ENABLE_NODE, &debug_rip_packet_detail_cmd);
269 install_element (ENABLE_NODE, &debug_rip_zebra_cmd);
270 install_element (ENABLE_NODE, &no_debug_rip_events_cmd);
271 install_element (ENABLE_NODE, &no_debug_rip_packet_cmd);
272 install_element (ENABLE_NODE, &no_debug_rip_packet_direct_cmd);
273 install_element (ENABLE_NODE, &no_debug_rip_zebra_cmd);
275 install_element (CONFIG_NODE, &debug_rip_events_cmd);
276 install_element (CONFIG_NODE, &debug_rip_packet_cmd);
277 install_element (CONFIG_NODE, &debug_rip_packet_direct_cmd);
278 install_element (CONFIG_NODE, &debug_rip_packet_detail_cmd);
279 install_element (CONFIG_NODE, &debug_rip_zebra_cmd);
280 install_element (CONFIG_NODE, &no_debug_rip_events_cmd);
281 install_element (CONFIG_NODE, &no_debug_rip_packet_cmd);
282 install_element (CONFIG_NODE, &no_debug_rip_packet_direct_cmd);
283 install_element (CONFIG_NODE, &no_debug_rip_zebra_cmd);