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 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
24 #include "ripngd/ripng_debug.h"
26 /* For debug statement. */
27 unsigned long ripng_debug_event
= 0;
28 unsigned long ripng_debug_packet
= 0;
29 unsigned long ripng_debug_zebra
= 0;
31 DEFUN_NOSH (show_debugging_ripng
,
32 show_debugging_ripng_cmd
,
33 "show debugging [ripng]",
36 "RIPng configuration\n")
38 vty_out(vty
, "RIPng debugging status:\n");
40 if (IS_RIPNG_DEBUG_EVENT
)
41 vty_out(vty
, " RIPng event debugging is on\n");
43 if (IS_RIPNG_DEBUG_PACKET
) {
44 if (IS_RIPNG_DEBUG_SEND
&& IS_RIPNG_DEBUG_RECV
) {
45 vty_out(vty
, " RIPng packet debugging is on\n");
47 if (IS_RIPNG_DEBUG_SEND
)
49 " RIPng packet send debugging is on\n");
52 " RIPng packet receive debugging is on\n");
56 if (IS_RIPNG_DEBUG_ZEBRA
)
57 vty_out(vty
, " RIPng zebra debugging is on\n");
59 cmd_show_lib_debugs(vty
);
64 DEFUN (debug_ripng_events
,
65 debug_ripng_events_cmd
,
68 "RIPng configuration\n"
69 "Debug option set for ripng events\n")
71 ripng_debug_event
= RIPNG_DEBUG_EVENT
;
75 DEFUN (debug_ripng_packet
,
76 debug_ripng_packet_cmd
,
79 "RIPng configuration\n"
80 "Debug option set for ripng packet\n")
82 ripng_debug_packet
= RIPNG_DEBUG_PACKET
;
83 ripng_debug_packet
|= RIPNG_DEBUG_SEND
;
84 ripng_debug_packet
|= RIPNG_DEBUG_RECV
;
88 DEFUN (debug_ripng_packet_direct
,
89 debug_ripng_packet_direct_cmd
,
90 "debug ripng packet <recv|send>",
92 "RIPng configuration\n"
93 "Debug option set for ripng packet\n"
94 "Debug option set for receive packet\n"
95 "Debug option set for send packet\n")
97 int idx_recv_send
= 3;
98 ripng_debug_packet
|= RIPNG_DEBUG_PACKET
;
99 if (strcmp("send", argv
[idx_recv_send
]->text
) == 0)
100 ripng_debug_packet
|= RIPNG_DEBUG_SEND
;
101 if (strcmp("recv", argv
[idx_recv_send
]->text
) == 0)
102 ripng_debug_packet
|= RIPNG_DEBUG_RECV
;
107 DEFUN (debug_ripng_zebra
,
108 debug_ripng_zebra_cmd
,
111 "RIPng configuration\n"
112 "Debug option set for ripng and zebra communication\n")
114 ripng_debug_zebra
= RIPNG_DEBUG_ZEBRA
;
118 DEFUN (no_debug_ripng_events
,
119 no_debug_ripng_events_cmd
,
120 "no debug ripng events",
123 "RIPng configuration\n"
124 "Debug option set for ripng events\n")
126 ripng_debug_event
= 0;
130 DEFUN (no_debug_ripng_packet
,
131 no_debug_ripng_packet_cmd
,
132 "no debug ripng packet",
135 "RIPng configuration\n"
136 "Debug option set for ripng packet\n")
138 ripng_debug_packet
= 0;
142 DEFUN (no_debug_ripng_packet_direct
,
143 no_debug_ripng_packet_direct_cmd
,
144 "no debug ripng packet <recv|send>",
147 "RIPng configuration\n"
148 "Debug option set for ripng packet\n"
149 "Debug option set for receive packet\n"
150 "Debug option set for send packet\n")
152 int idx_recv_send
= 4;
153 if (strcmp("send", argv
[idx_recv_send
]->text
) == 0) {
154 if (IS_RIPNG_DEBUG_RECV
)
155 ripng_debug_packet
&= ~RIPNG_DEBUG_SEND
;
157 ripng_debug_packet
= 0;
158 } else if (strcmp("recv", argv
[idx_recv_send
]->text
) == 0) {
159 if (IS_RIPNG_DEBUG_SEND
)
160 ripng_debug_packet
&= ~RIPNG_DEBUG_RECV
;
162 ripng_debug_packet
= 0;
167 DEFUN (no_debug_ripng_zebra
,
168 no_debug_ripng_zebra_cmd
,
169 "no debug ripng zebra",
172 "RIPng configuration\n"
173 "Debug option set for ripng and zebra communication\n")
175 ripng_debug_zebra
= 0;
179 static int config_write_debug(struct vty
*vty
);
181 static struct cmd_node debug_node
= {
185 .config_write
= config_write_debug
,
188 static int config_write_debug(struct vty
*vty
)
192 if (IS_RIPNG_DEBUG_EVENT
) {
193 vty_out(vty
, "debug ripng events\n");
196 if (IS_RIPNG_DEBUG_PACKET
) {
197 if (IS_RIPNG_DEBUG_SEND
&& IS_RIPNG_DEBUG_RECV
) {
198 vty_out(vty
, "debug ripng packet\n");
201 if (IS_RIPNG_DEBUG_SEND
)
202 vty_out(vty
, "debug ripng packet send\n");
204 vty_out(vty
, "debug ripng packet recv\n");
208 if (IS_RIPNG_DEBUG_ZEBRA
) {
209 vty_out(vty
, "debug ripng zebra\n");
215 void ripng_debug_init(void)
217 ripng_debug_event
= 0;
218 ripng_debug_packet
= 0;
219 ripng_debug_zebra
= 0;
221 install_node(&debug_node
);
223 install_element(ENABLE_NODE
, &show_debugging_ripng_cmd
);
225 install_element(ENABLE_NODE
, &debug_ripng_events_cmd
);
226 install_element(ENABLE_NODE
, &debug_ripng_packet_cmd
);
227 install_element(ENABLE_NODE
, &debug_ripng_packet_direct_cmd
);
228 install_element(ENABLE_NODE
, &debug_ripng_zebra_cmd
);
229 install_element(ENABLE_NODE
, &no_debug_ripng_events_cmd
);
230 install_element(ENABLE_NODE
, &no_debug_ripng_packet_cmd
);
231 install_element(ENABLE_NODE
, &no_debug_ripng_packet_direct_cmd
);
232 install_element(ENABLE_NODE
, &no_debug_ripng_zebra_cmd
);
234 install_element(CONFIG_NODE
, &debug_ripng_events_cmd
);
235 install_element(CONFIG_NODE
, &debug_ripng_packet_cmd
);
236 install_element(CONFIG_NODE
, &debug_ripng_packet_direct_cmd
);
237 install_element(CONFIG_NODE
, &debug_ripng_zebra_cmd
);
238 install_element(CONFIG_NODE
, &no_debug_ripng_events_cmd
);
239 install_element(CONFIG_NODE
, &no_debug_ripng_packet_cmd
);
240 install_element(CONFIG_NODE
, &no_debug_ripng_packet_direct_cmd
);
241 install_element(CONFIG_NODE
, &no_debug_ripng_zebra_cmd
);