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 int idx_recv_send
= 3;
101 rip_debug_packet
|= RIP_DEBUG_PACKET
;
102 if (strncmp ("send", argv
[idx_recv_send
]->arg
, strlen (argv
[idx_recv_send
]->arg
)) == 0)
103 rip_debug_packet
|= RIP_DEBUG_SEND
;
104 if (strncmp ("recv", argv
[idx_recv_send
]->arg
, strlen (argv
[idx_recv_send
]->arg
)) == 0)
105 rip_debug_packet
|= RIP_DEBUG_RECV
;
109 DEFUN (debug_rip_zebra
,
114 "RIP and ZEBRA communication\n")
116 rip_debug_zebra
= RIP_DEBUG_ZEBRA
;
120 DEFUN (no_debug_rip_events
,
121 no_debug_rip_events_cmd
,
122 "no debug rip events",
132 DEFUN (no_debug_rip_packet
,
133 no_debug_rip_packet_cmd
,
134 "no debug rip packet",
140 rip_debug_packet
= 0;
144 DEFUN (no_debug_rip_packet_direct
,
145 no_debug_rip_packet_direct_cmd
,
146 "no debug rip packet <recv|send>",
151 "RIP option set for receive packet\n"
152 "RIP option set for send packet\n")
154 int idx_recv_send
= 4;
155 if (strncmp ("send", argv
[idx_recv_send
]->arg
, strlen (argv
[idx_recv_send
]->arg
)) == 0)
157 if (IS_RIP_DEBUG_RECV
)
158 rip_debug_packet
&= ~RIP_DEBUG_SEND
;
160 rip_debug_packet
= 0;
162 else if (strncmp ("recv", argv
[idx_recv_send
]->arg
, strlen (argv
[idx_recv_send
]->arg
)) == 0)
164 if (IS_RIP_DEBUG_SEND
)
165 rip_debug_packet
&= ~RIP_DEBUG_RECV
;
167 rip_debug_packet
= 0;
172 DEFUN (no_debug_rip_zebra
,
173 no_debug_rip_zebra_cmd
,
174 "no debug rip zebra",
178 "RIP and ZEBRA communication\n")
185 static struct cmd_node debug_node
=
188 "", /* Debug node has no interface. */
193 config_write_debug (struct vty
*vty
)
197 if (IS_RIP_DEBUG_EVENT
)
199 vty_out (vty
, "debug rip events%s", VTY_NEWLINE
);
202 if (IS_RIP_DEBUG_PACKET
)
204 if (IS_RIP_DEBUG_SEND
&& IS_RIP_DEBUG_RECV
)
206 vty_out (vty
, "debug rip packet%s",
212 if (IS_RIP_DEBUG_SEND
)
213 vty_out (vty
, "debug rip packet send%s",
216 vty_out (vty
, "debug rip packet recv%s",
221 if (IS_RIP_DEBUG_ZEBRA
)
223 vty_out (vty
, "debug rip zebra%s", VTY_NEWLINE
);
230 rip_debug_reset (void)
233 rip_debug_packet
= 0;
238 rip_debug_init (void)
241 rip_debug_packet
= 0;
244 install_node (&debug_node
, config_write_debug
);
246 install_element (ENABLE_NODE
, &show_debugging_rip_cmd
);
247 install_element (ENABLE_NODE
, &debug_rip_events_cmd
);
248 install_element (ENABLE_NODE
, &debug_rip_packet_cmd
);
249 install_element (ENABLE_NODE
, &debug_rip_packet_direct_cmd
);
250 install_element (ENABLE_NODE
, &debug_rip_zebra_cmd
);
251 install_element (ENABLE_NODE
, &no_debug_rip_events_cmd
);
252 install_element (ENABLE_NODE
, &no_debug_rip_packet_cmd
);
253 install_element (ENABLE_NODE
, &no_debug_rip_packet_direct_cmd
);
254 install_element (ENABLE_NODE
, &no_debug_rip_zebra_cmd
);
256 install_element (CONFIG_NODE
, &debug_rip_events_cmd
);
257 install_element (CONFIG_NODE
, &debug_rip_packet_cmd
);
258 install_element (CONFIG_NODE
, &debug_rip_packet_direct_cmd
);
259 install_element (CONFIG_NODE
, &debug_rip_zebra_cmd
);
260 install_element (CONFIG_NODE
, &no_debug_rip_events_cmd
);
261 install_element (CONFIG_NODE
, &no_debug_rip_packet_cmd
);
262 install_element (CONFIG_NODE
, &no_debug_rip_packet_direct_cmd
);
263 install_element (CONFIG_NODE
, &no_debug_rip_zebra_cmd
);