]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
2 | * OSPFd dump routine. | |
3 | * Copyright (C) 1999, 2000 Toshiaki Takada | |
4 | * | |
5 | * This file is part of GNU Zebra. | |
6 | * | |
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 | |
10 | * later version. | |
11 | * | |
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. | |
16 | * | |
896014f4 DL |
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 | |
718e3744 | 20 | */ |
21 | ||
22 | #include <zebra.h> | |
23 | ||
cbf3e3eb | 24 | #include "monotime.h" |
718e3744 | 25 | #include "linklist.h" |
26 | #include "thread.h" | |
27 | #include "prefix.h" | |
28 | #include "command.h" | |
29 | #include "stream.h" | |
30 | #include "log.h" | |
aa20c6f1 | 31 | #include "sockopt.h" |
718e3744 | 32 | |
33 | #include "ospfd/ospfd.h" | |
34 | #include "ospfd/ospf_interface.h" | |
35 | #include "ospfd/ospf_ism.h" | |
36 | #include "ospfd/ospf_asbr.h" | |
37 | #include "ospfd/ospf_lsa.h" | |
38 | #include "ospfd/ospf_lsdb.h" | |
39 | #include "ospfd/ospf_neighbor.h" | |
40 | #include "ospfd/ospf_nsm.h" | |
41 | #include "ospfd/ospf_dump.h" | |
42 | #include "ospfd/ospf_packet.h" | |
43 | #include "ospfd/ospf_network.h" | |
44 | ||
718e3744 | 45 | /* Configuration debug option variables. */ |
46 | unsigned long conf_debug_ospf_packet[5] = {0, 0, 0, 0, 0}; | |
47 | unsigned long conf_debug_ospf_event = 0; | |
48 | unsigned long conf_debug_ospf_ism = 0; | |
49 | unsigned long conf_debug_ospf_nsm = 0; | |
50 | unsigned long conf_debug_ospf_lsa = 0; | |
51 | unsigned long conf_debug_ospf_zebra = 0; | |
52 | unsigned long conf_debug_ospf_nssa = 0; | |
16f1b9ee | 53 | unsigned long conf_debug_ospf_te = 0; |
cf9b9f77 OD |
54 | unsigned long conf_debug_ospf_ext = 0; |
55 | unsigned long conf_debug_ospf_sr = 0; | |
718e3744 | 56 | |
57 | /* Enable debug option variables -- valid only session. */ | |
58 | unsigned long term_debug_ospf_packet[5] = {0, 0, 0, 0, 0}; | |
59 | unsigned long term_debug_ospf_event = 0; | |
60 | unsigned long term_debug_ospf_ism = 0; | |
61 | unsigned long term_debug_ospf_nsm = 0; | |
62 | unsigned long term_debug_ospf_lsa = 0; | |
63 | unsigned long term_debug_ospf_zebra = 0; | |
64 | unsigned long term_debug_ospf_nssa = 0; | |
16f1b9ee | 65 | unsigned long term_debug_ospf_te = 0; |
cf9b9f77 OD |
66 | unsigned long term_debug_ospf_ext = 0; |
67 | unsigned long term_debug_ospf_sr = 0; | |
f52d13cb | 68 | |
d7c0a89a | 69 | const char *ospf_redist_string(unsigned int route_type) |
f52d13cb | 70 | { |
d62a17ae | 71 | return (route_type == ZEBRA_ROUTE_MAX) ? "Default" |
72 | : zebra_route_string(route_type); | |
f52d13cb | 73 | } |
74 | ||
718e3744 | 75 | #define OSPF_AREA_STRING_MAXLEN 16 |
d62a17ae | 76 | const char *ospf_area_name_string(struct ospf_area *area) |
718e3744 | 77 | { |
d62a17ae | 78 | static char buf[OSPF_AREA_STRING_MAXLEN] = ""; |
d7c0a89a | 79 | uint32_t area_id; |
718e3744 | 80 | |
d62a17ae | 81 | if (!area) |
82 | return "-"; | |
718e3744 | 83 | |
d62a17ae | 84 | area_id = ntohl(area->area_id.s_addr); |
85 | snprintf(buf, OSPF_AREA_STRING_MAXLEN, "%d.%d.%d.%d", | |
86 | (area_id >> 24) & 0xff, (area_id >> 16) & 0xff, | |
87 | (area_id >> 8) & 0xff, area_id & 0xff); | |
88 | return buf; | |
718e3744 | 89 | } |
90 | ||
91 | #define OSPF_AREA_DESC_STRING_MAXLEN 23 | |
d62a17ae | 92 | const char *ospf_area_desc_string(struct ospf_area *area) |
718e3744 | 93 | { |
d62a17ae | 94 | static char buf[OSPF_AREA_DESC_STRING_MAXLEN] = ""; |
d7c0a89a | 95 | uint8_t type; |
d62a17ae | 96 | |
97 | if (!area) | |
98 | return "(incomplete)"; | |
99 | ||
100 | type = area->external_routing; | |
101 | switch (type) { | |
102 | case OSPF_AREA_NSSA: | |
103 | snprintf(buf, OSPF_AREA_DESC_STRING_MAXLEN, "%s [NSSA]", | |
104 | ospf_area_name_string(area)); | |
105 | break; | |
106 | case OSPF_AREA_STUB: | |
107 | snprintf(buf, OSPF_AREA_DESC_STRING_MAXLEN, "%s [Stub]", | |
108 | ospf_area_name_string(area)); | |
109 | break; | |
110 | default: | |
111 | return ospf_area_name_string(area); | |
112 | } | |
113 | ||
114 | return buf; | |
718e3744 | 115 | } |
116 | ||
117 | #define OSPF_IF_STRING_MAXLEN 40 | |
d62a17ae | 118 | const char *ospf_if_name_string(struct ospf_interface *oi) |
718e3744 | 119 | { |
d62a17ae | 120 | static char buf[OSPF_IF_STRING_MAXLEN] = ""; |
d7c0a89a | 121 | uint32_t ifaddr; |
718e3744 | 122 | |
d62a17ae | 123 | if (!oi || !oi->address) |
124 | return "inactive"; | |
718e3744 | 125 | |
d62a17ae | 126 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK) |
127 | return oi->ifp->name; | |
718e3744 | 128 | |
d62a17ae | 129 | ifaddr = ntohl(oi->address->u.prefix4.s_addr); |
130 | snprintf(buf, OSPF_IF_STRING_MAXLEN, "%s:%d.%d.%d.%d", oi->ifp->name, | |
131 | (ifaddr >> 24) & 0xff, (ifaddr >> 16) & 0xff, | |
132 | (ifaddr >> 8) & 0xff, ifaddr & 0xff); | |
133 | return buf; | |
718e3744 | 134 | } |
135 | ||
6b0655a2 | 136 | |
d62a17ae | 137 | void ospf_nbr_state_message(struct ospf_neighbor *nbr, char *buf, size_t size) |
718e3744 | 138 | { |
d62a17ae | 139 | int state; |
140 | struct ospf_interface *oi = nbr->oi; | |
718e3744 | 141 | |
d62a17ae | 142 | if (IPV4_ADDR_SAME(&DR(oi), &nbr->address.u.prefix4)) |
143 | state = ISM_DR; | |
144 | else if (IPV4_ADDR_SAME(&BDR(oi), &nbr->address.u.prefix4)) | |
145 | state = ISM_Backup; | |
146 | else | |
147 | state = ISM_DROther; | |
718e3744 | 148 | |
d62a17ae | 149 | snprintf(buf, size, "%s/%s", |
150 | lookup_msg(ospf_nsm_state_msg, nbr->state, NULL), | |
151 | lookup_msg(ospf_ism_state_msg, state, NULL)); | |
718e3744 | 152 | } |
153 | ||
d62a17ae | 154 | const char *ospf_timeval_dump(struct timeval *t, char *buf, size_t size) |
718e3744 | 155 | { |
d62a17ae | 156 | /* Making formatted timer strings. */ |
d24f6e2a | 157 | #define MINUTE_IN_SECONDS 60 |
158 | #define HOUR_IN_SECONDS (60*MINUTE_IN_SECONDS) | |
159 | #define DAY_IN_SECONDS (24*HOUR_IN_SECONDS) | |
160 | #define WEEK_IN_SECONDS (7*DAY_IN_SECONDS) | |
d62a17ae | 161 | unsigned long w, d, h, m, s, ms, us; |
162 | ||
163 | if (!t) | |
164 | return "inactive"; | |
165 | ||
166 | w = d = h = m = s = ms = us = 0; | |
167 | memset(buf, 0, size); | |
168 | ||
169 | us = t->tv_usec; | |
170 | if (us >= 1000) { | |
171 | ms = us / 1000; | |
172 | us %= 1000; | |
f38b7f6d | 173 | (void)us; /* unused */ |
d62a17ae | 174 | } |
175 | ||
176 | if (ms >= 1000) { | |
177 | t->tv_sec += ms / 1000; | |
178 | ms %= 1000; | |
179 | } | |
180 | ||
181 | if (t->tv_sec > WEEK_IN_SECONDS) { | |
182 | w = t->tv_sec / WEEK_IN_SECONDS; | |
183 | t->tv_sec -= w * WEEK_IN_SECONDS; | |
184 | } | |
185 | ||
186 | if (t->tv_sec > DAY_IN_SECONDS) { | |
187 | d = t->tv_sec / DAY_IN_SECONDS; | |
188 | t->tv_sec -= d * DAY_IN_SECONDS; | |
189 | } | |
190 | ||
191 | if (t->tv_sec >= HOUR_IN_SECONDS) { | |
192 | h = t->tv_sec / HOUR_IN_SECONDS; | |
193 | t->tv_sec -= h * HOUR_IN_SECONDS; | |
194 | } | |
195 | ||
196 | if (t->tv_sec >= MINUTE_IN_SECONDS) { | |
197 | m = t->tv_sec / MINUTE_IN_SECONDS; | |
198 | t->tv_sec -= m * MINUTE_IN_SECONDS; | |
199 | } | |
200 | ||
201 | if (w > 99) | |
2ec42b85 | 202 | snprintf(buf, size, "%luw%1lud", w, d); |
d62a17ae | 203 | else if (w) |
2ec42b85 | 204 | snprintf(buf, size, "%luw%1lud%02luh", w, d, h); |
d62a17ae | 205 | else if (d) |
2ec42b85 | 206 | snprintf(buf, size, "%1lud%02luh%02lum", d, h, m); |
d62a17ae | 207 | else if (h) |
2ec42b85 | 208 | snprintf(buf, size, "%luh%02lum%02lds", h, m, (long)t->tv_sec); |
d62a17ae | 209 | else if (m) |
2ec42b85 | 210 | snprintf(buf, size, "%lum%02lds", m, (long)t->tv_sec); |
d62a17ae | 211 | else if (ms) |
2ec42b85 | 212 | snprintf(buf, size, "%ld.%03lus", (long)t->tv_sec, ms); |
d62a17ae | 213 | else |
214 | snprintf(buf, size, "%ld usecs", (long)t->tv_usec); | |
215 | ||
216 | return buf; | |
718e3744 | 217 | } |
218 | ||
d62a17ae | 219 | const char *ospf_timer_dump(struct thread *t, char *buf, size_t size) |
d24f6e2a | 220 | { |
d62a17ae | 221 | struct timeval result; |
222 | if (!t) | |
223 | return "inactive"; | |
cbf3e3eb | 224 | |
d62a17ae | 225 | monotime_until(&t->u.sands, &result); |
226 | return ospf_timeval_dump(&result, buf, size); | |
d24f6e2a | 227 | } |
228 | ||
d7c0a89a | 229 | static void ospf_packet_hello_dump(struct stream *s, uint16_t length) |
718e3744 | 230 | { |
d62a17ae | 231 | struct ospf_hello *hello; |
232 | int i; | |
233 | ||
2d34fb80 | 234 | hello = (struct ospf_hello *)stream_pnt(s); |
d62a17ae | 235 | |
236 | zlog_debug("Hello"); | |
237 | zlog_debug(" NetworkMask %s", inet_ntoa(hello->network_mask)); | |
238 | zlog_debug(" HelloInterval %d", ntohs(hello->hello_interval)); | |
239 | zlog_debug(" Options %d (%s)", hello->options, | |
240 | ospf_options_dump(hello->options)); | |
241 | zlog_debug(" RtrPriority %d", hello->priority); | |
242 | zlog_debug(" RtrDeadInterval %ld", | |
d7c0a89a | 243 | (unsigned long)ntohl(hello->dead_interval)); |
d62a17ae | 244 | zlog_debug(" DRouter %s", inet_ntoa(hello->d_router)); |
245 | zlog_debug(" BDRouter %s", inet_ntoa(hello->bd_router)); | |
246 | ||
247 | length -= OSPF_HEADER_SIZE + OSPF_HELLO_MIN_SIZE; | |
248 | zlog_debug(" # Neighbors %d", length / 4); | |
249 | for (i = 0; length > 0; i++, length -= sizeof(struct in_addr)) | |
250 | zlog_debug(" Neighbor %s", inet_ntoa(hello->neighbors[i])); | |
718e3744 | 251 | } |
252 | ||
d7c0a89a | 253 | static char *ospf_dd_flags_dump(uint8_t flags, char *buf, size_t size) |
718e3744 | 254 | { |
d62a17ae | 255 | snprintf(buf, size, "%s|%s|%s", (flags & OSPF_DD_FLAG_I) ? "I" : "-", |
256 | (flags & OSPF_DD_FLAG_M) ? "M" : "-", | |
257 | (flags & OSPF_DD_FLAG_MS) ? "MS" : "-"); | |
718e3744 | 258 | |
d62a17ae | 259 | return buf; |
718e3744 | 260 | } |
261 | ||
d7c0a89a | 262 | static char *ospf_router_lsa_flags_dump(uint8_t flags, char *buf, size_t size) |
718e3744 | 263 | { |
d62a17ae | 264 | snprintf(buf, size, "%s|%s|%s", |
265 | (flags & ROUTER_LSA_VIRTUAL) ? "V" : "-", | |
266 | (flags & ROUTER_LSA_EXTERNAL) ? "E" : "-", | |
267 | (flags & ROUTER_LSA_BORDER) ? "B" : "-"); | |
718e3744 | 268 | |
d62a17ae | 269 | return buf; |
718e3744 | 270 | } |
271 | ||
d7c0a89a | 272 | static void ospf_router_lsa_dump(struct stream *s, uint16_t length) |
718e3744 | 273 | { |
d62a17ae | 274 | char buf[BUFSIZ]; |
275 | struct router_lsa *rl; | |
276 | int i, len; | |
277 | ||
2d34fb80 | 278 | rl = (struct router_lsa *)stream_pnt(s); |
d62a17ae | 279 | |
280 | zlog_debug(" Router-LSA"); | |
281 | zlog_debug(" flags %s", | |
282 | ospf_router_lsa_flags_dump(rl->flags, buf, BUFSIZ)); | |
283 | zlog_debug(" # links %d", ntohs(rl->links)); | |
284 | ||
285 | len = ntohs(rl->header.length) - OSPF_LSA_HEADER_SIZE - 4; | |
286 | for (i = 0; len > 0; i++) { | |
287 | zlog_debug(" Link ID %s", inet_ntoa(rl->link[i].link_id)); | |
288 | zlog_debug(" Link Data %s", | |
289 | inet_ntoa(rl->link[i].link_data)); | |
d7c0a89a QY |
290 | zlog_debug(" Type %d", (uint8_t)rl->link[i].type); |
291 | zlog_debug(" TOS %d", (uint8_t)rl->link[i].tos); | |
d62a17ae | 292 | zlog_debug(" metric %d", ntohs(rl->link[i].metric)); |
293 | ||
294 | len -= 12; | |
295 | } | |
718e3744 | 296 | } |
297 | ||
d7c0a89a | 298 | static void ospf_network_lsa_dump(struct stream *s, uint16_t length) |
718e3744 | 299 | { |
d62a17ae | 300 | struct network_lsa *nl; |
301 | int i, cnt; | |
302 | ||
2d34fb80 | 303 | nl = (struct network_lsa *)stream_pnt(s); |
d62a17ae | 304 | cnt = (ntohs(nl->header.length) - (OSPF_LSA_HEADER_SIZE + 4)) / 4; |
305 | ||
306 | zlog_debug(" Network-LSA"); | |
307 | /* | |
308 | zlog_debug ("LSA total size %d", ntohs (nl->header.length)); | |
309 | zlog_debug ("Network-LSA size %d", | |
310 | ntohs (nl->header.length) - OSPF_LSA_HEADER_SIZE); | |
311 | */ | |
312 | zlog_debug(" Network Mask %s", inet_ntoa(nl->mask)); | |
313 | zlog_debug(" # Attached Routers %d", cnt); | |
314 | for (i = 0; i < cnt; i++) | |
315 | zlog_debug(" Attached Router %s", | |
316 | inet_ntoa(nl->routers[i])); | |
718e3744 | 317 | } |
318 | ||
d7c0a89a | 319 | static void ospf_summary_lsa_dump(struct stream *s, uint16_t length) |
718e3744 | 320 | { |
d62a17ae | 321 | struct summary_lsa *sl; |
322 | int size; | |
323 | int i; | |
718e3744 | 324 | |
2d34fb80 | 325 | sl = (struct summary_lsa *)stream_pnt(s); |
718e3744 | 326 | |
d62a17ae | 327 | zlog_debug(" Summary-LSA"); |
328 | zlog_debug(" Network Mask %s", inet_ntoa(sl->mask)); | |
718e3744 | 329 | |
d62a17ae | 330 | size = ntohs(sl->header.length) - OSPF_LSA_HEADER_SIZE - 4; |
331 | for (i = 0; size > 0; size -= 4, i++) | |
332 | zlog_debug(" TOS=%d metric %d", sl->tos, | |
333 | GET_METRIC(sl->metric)); | |
718e3744 | 334 | } |
335 | ||
d7c0a89a | 336 | static void ospf_as_external_lsa_dump(struct stream *s, uint16_t length) |
718e3744 | 337 | { |
d62a17ae | 338 | struct as_external_lsa *al; |
339 | int size; | |
340 | int i; | |
341 | ||
2d34fb80 | 342 | al = (struct as_external_lsa *)stream_pnt(s); |
d62a17ae | 343 | zlog_debug(" %s", ospf_lsa_type_msg[al->header.type].str); |
344 | zlog_debug(" Network Mask %s", inet_ntoa(al->mask)); | |
345 | ||
346 | size = ntohs(al->header.length) - OSPF_LSA_HEADER_SIZE - 4; | |
347 | for (i = 0; size > 0; size -= 12, i++) { | |
348 | zlog_debug(" bit %s TOS=%d metric %d", | |
349 | IS_EXTERNAL_METRIC(al->e[i].tos) ? "E" : "-", | |
350 | al->e[i].tos & 0x7f, GET_METRIC(al->e[i].metric)); | |
351 | zlog_debug(" Forwarding address %s", | |
352 | inet_ntoa(al->e[i].fwd_addr)); | |
353 | zlog_debug(" External Route Tag %" ROUTE_TAG_PRI, | |
354 | al->e[i].route_tag); | |
355 | } | |
718e3744 | 356 | } |
357 | ||
d7c0a89a | 358 | static void ospf_lsa_header_list_dump(struct stream *s, uint16_t length) |
718e3744 | 359 | { |
d62a17ae | 360 | struct lsa_header *lsa; |
718e3744 | 361 | |
d62a17ae | 362 | zlog_debug(" # LSA Headers %d", length / OSPF_LSA_HEADER_SIZE); |
718e3744 | 363 | |
d62a17ae | 364 | /* LSA Headers. */ |
365 | while (length > 0) { | |
2d34fb80 | 366 | lsa = (struct lsa_header *)stream_pnt(s); |
d62a17ae | 367 | ospf_lsa_header_dump(lsa); |
718e3744 | 368 | |
d62a17ae | 369 | stream_forward_getp(s, OSPF_LSA_HEADER_SIZE); |
370 | length -= OSPF_LSA_HEADER_SIZE; | |
371 | } | |
718e3744 | 372 | } |
373 | ||
d7c0a89a | 374 | static void ospf_packet_db_desc_dump(struct stream *s, uint16_t length) |
718e3744 | 375 | { |
d62a17ae | 376 | struct ospf_db_desc *dd; |
377 | char dd_flags[8]; | |
718e3744 | 378 | |
d7c0a89a | 379 | uint32_t gp; |
718e3744 | 380 | |
d62a17ae | 381 | gp = stream_get_getp(s); |
2d34fb80 | 382 | dd = (struct ospf_db_desc *)stream_pnt(s); |
718e3744 | 383 | |
d62a17ae | 384 | zlog_debug("Database Description"); |
385 | zlog_debug(" Interface MTU %d", ntohs(dd->mtu)); | |
386 | zlog_debug(" Options %d (%s)", dd->options, | |
387 | ospf_options_dump(dd->options)); | |
388 | zlog_debug(" Flags %d (%s)", dd->flags, | |
389 | ospf_dd_flags_dump(dd->flags, dd_flags, sizeof dd_flags)); | |
d7c0a89a QY |
390 | zlog_debug(" Sequence Number 0x%08lx", |
391 | (unsigned long)ntohl(dd->dd_seqnum)); | |
718e3744 | 392 | |
d62a17ae | 393 | length -= OSPF_HEADER_SIZE + OSPF_DB_DESC_MIN_SIZE; |
718e3744 | 394 | |
d62a17ae | 395 | stream_forward_getp(s, OSPF_DB_DESC_MIN_SIZE); |
718e3744 | 396 | |
d62a17ae | 397 | ospf_lsa_header_list_dump(s, length); |
718e3744 | 398 | |
d62a17ae | 399 | stream_set_getp(s, gp); |
718e3744 | 400 | } |
401 | ||
d7c0a89a | 402 | static void ospf_packet_ls_req_dump(struct stream *s, uint16_t length) |
718e3744 | 403 | { |
d7c0a89a QY |
404 | uint32_t sp; |
405 | uint32_t ls_type; | |
d62a17ae | 406 | struct in_addr ls_id; |
407 | struct in_addr adv_router; | |
718e3744 | 408 | |
d62a17ae | 409 | sp = stream_get_getp(s); |
718e3744 | 410 | |
d62a17ae | 411 | length -= OSPF_HEADER_SIZE; |
718e3744 | 412 | |
d62a17ae | 413 | zlog_debug("Link State Request"); |
414 | zlog_debug(" # Requests %d", length / 12); | |
718e3744 | 415 | |
d62a17ae | 416 | for (; length > 0; length -= 12) { |
417 | ls_type = stream_getl(s); | |
418 | ls_id.s_addr = stream_get_ipv4(s); | |
419 | adv_router.s_addr = stream_get_ipv4(s); | |
718e3744 | 420 | |
d62a17ae | 421 | zlog_debug(" LS type %d", ls_type); |
422 | zlog_debug(" Link State ID %s", inet_ntoa(ls_id)); | |
423 | zlog_debug(" Advertising Router %s", inet_ntoa(adv_router)); | |
424 | } | |
718e3744 | 425 | |
d62a17ae | 426 | stream_set_getp(s, sp); |
718e3744 | 427 | } |
428 | ||
d7c0a89a | 429 | static void ospf_packet_ls_upd_dump(struct stream *s, uint16_t length) |
718e3744 | 430 | { |
d7c0a89a | 431 | uint32_t sp; |
d62a17ae | 432 | struct lsa_header *lsa; |
433 | int lsa_len; | |
d7c0a89a | 434 | uint32_t count; |
d62a17ae | 435 | |
436 | length -= OSPF_HEADER_SIZE; | |
437 | ||
438 | sp = stream_get_getp(s); | |
439 | ||
440 | count = stream_getl(s); | |
441 | length -= 4; | |
442 | ||
443 | zlog_debug("Link State Update"); | |
444 | zlog_debug(" # LSAs %d", count); | |
445 | ||
446 | while (length > 0 && count > 0) { | |
447 | if (length < OSPF_HEADER_SIZE || length % 4 != 0) { | |
448 | zlog_debug(" Remaining %d bytes; Incorrect length.", | |
449 | length); | |
450 | break; | |
451 | } | |
452 | ||
2d34fb80 | 453 | lsa = (struct lsa_header *)stream_pnt(s); |
d62a17ae | 454 | lsa_len = ntohs(lsa->length); |
455 | ospf_lsa_header_dump(lsa); | |
456 | ||
457 | switch (lsa->type) { | |
458 | case OSPF_ROUTER_LSA: | |
459 | ospf_router_lsa_dump(s, length); | |
460 | break; | |
461 | case OSPF_NETWORK_LSA: | |
462 | ospf_network_lsa_dump(s, length); | |
463 | break; | |
464 | case OSPF_SUMMARY_LSA: | |
465 | case OSPF_ASBR_SUMMARY_LSA: | |
466 | ospf_summary_lsa_dump(s, length); | |
467 | break; | |
468 | case OSPF_AS_EXTERNAL_LSA: | |
469 | ospf_as_external_lsa_dump(s, length); | |
470 | break; | |
471 | case OSPF_AS_NSSA_LSA: | |
472 | ospf_as_external_lsa_dump(s, length); | |
473 | break; | |
474 | case OSPF_OPAQUE_LINK_LSA: | |
475 | case OSPF_OPAQUE_AREA_LSA: | |
476 | case OSPF_OPAQUE_AS_LSA: | |
477 | ospf_opaque_lsa_dump(s, length); | |
478 | break; | |
479 | default: | |
480 | break; | |
481 | } | |
482 | ||
483 | stream_forward_getp(s, lsa_len); | |
484 | length -= lsa_len; | |
485 | count--; | |
718e3744 | 486 | } |
487 | ||
d62a17ae | 488 | stream_set_getp(s, sp); |
718e3744 | 489 | } |
490 | ||
d7c0a89a | 491 | static void ospf_packet_ls_ack_dump(struct stream *s, uint16_t length) |
718e3744 | 492 | { |
d7c0a89a | 493 | uint32_t sp; |
718e3744 | 494 | |
d62a17ae | 495 | length -= OSPF_HEADER_SIZE; |
496 | sp = stream_get_getp(s); | |
718e3744 | 497 | |
d62a17ae | 498 | zlog_debug("Link State Acknowledgment"); |
499 | ospf_lsa_header_list_dump(s, length); | |
718e3744 | 500 | |
d62a17ae | 501 | stream_set_getp(s, sp); |
718e3744 | 502 | } |
503 | ||
6b333611 | 504 | /* Expects header to be in host order */ |
d62a17ae | 505 | void ospf_ip_header_dump(struct ip *iph) |
718e3744 | 506 | { |
d62a17ae | 507 | /* IP Header dump. */ |
508 | zlog_debug("ip_v %d", iph->ip_v); | |
509 | zlog_debug("ip_hl %d", iph->ip_hl); | |
510 | zlog_debug("ip_tos %d", iph->ip_tos); | |
511 | zlog_debug("ip_len %d", iph->ip_len); | |
d7c0a89a QY |
512 | zlog_debug("ip_id %u", (uint32_t)iph->ip_id); |
513 | zlog_debug("ip_off %u", (uint32_t)iph->ip_off); | |
d62a17ae | 514 | zlog_debug("ip_ttl %d", iph->ip_ttl); |
515 | zlog_debug("ip_p %d", iph->ip_p); | |
d7c0a89a | 516 | zlog_debug("ip_sum 0x%x", (uint32_t)iph->ip_sum); |
d62a17ae | 517 | zlog_debug("ip_src %s", inet_ntoa(iph->ip_src)); |
518 | zlog_debug("ip_dst %s", inet_ntoa(iph->ip_dst)); | |
718e3744 | 519 | } |
520 | ||
d62a17ae | 521 | static void ospf_header_dump(struct ospf_header *ospfh) |
718e3744 | 522 | { |
d62a17ae | 523 | char buf[9]; |
d7c0a89a | 524 | uint16_t auth_type = ntohs(ospfh->auth_type); |
d62a17ae | 525 | |
526 | zlog_debug("Header"); | |
527 | zlog_debug(" Version %d", ospfh->version); | |
528 | zlog_debug(" Type %d (%s)", ospfh->type, | |
529 | lookup_msg(ospf_packet_type_str, ospfh->type, NULL)); | |
530 | zlog_debug(" Packet Len %d", ntohs(ospfh->length)); | |
531 | zlog_debug(" Router ID %s", inet_ntoa(ospfh->router_id)); | |
532 | zlog_debug(" Area ID %s", inet_ntoa(ospfh->area_id)); | |
533 | zlog_debug(" Checksum 0x%x", ntohs(ospfh->checksum)); | |
534 | zlog_debug(" AuType %s", | |
535 | lookup_msg(ospf_auth_type_str, auth_type, NULL)); | |
536 | ||
537 | switch (auth_type) { | |
538 | case OSPF_AUTH_NULL: | |
539 | break; | |
540 | case OSPF_AUTH_SIMPLE: | |
4d65d927 | 541 | strlcpy(buf, (char *)ospfh->u.auth_data, sizeof(buf)); |
d62a17ae | 542 | zlog_debug(" Simple Password %s", buf); |
543 | break; | |
544 | case OSPF_AUTH_CRYPTOGRAPHIC: | |
545 | zlog_debug(" Cryptographic Authentication"); | |
546 | zlog_debug(" Key ID %d", ospfh->u.crypt.key_id); | |
547 | zlog_debug(" Auth Data Len %d", ospfh->u.crypt.auth_data_len); | |
548 | zlog_debug(" Sequence number %ld", | |
d7c0a89a | 549 | (unsigned long)ntohl(ospfh->u.crypt.crypt_seqnum)); |
d62a17ae | 550 | break; |
551 | default: | |
552 | zlog_debug("* This is not supported authentication type"); | |
553 | break; | |
554 | } | |
718e3744 | 555 | } |
556 | ||
d62a17ae | 557 | void ospf_packet_dump(struct stream *s) |
718e3744 | 558 | { |
d62a17ae | 559 | struct ospf_header *ospfh; |
560 | unsigned long gp; | |
561 | ||
562 | /* Preserve pointer. */ | |
563 | gp = stream_get_getp(s); | |
564 | ||
565 | /* OSPF Header dump. */ | |
2d34fb80 | 566 | ospfh = (struct ospf_header *)stream_pnt(s); |
d62a17ae | 567 | |
568 | /* Until detail flag is set, return. */ | |
569 | if (!(term_debug_ospf_packet[ospfh->type - 1] & OSPF_DEBUG_DETAIL)) | |
570 | return; | |
571 | ||
572 | /* Show OSPF header detail. */ | |
573 | ospf_header_dump(ospfh); | |
574 | stream_forward_getp(s, OSPF_HEADER_SIZE); | |
575 | ||
576 | switch (ospfh->type) { | |
577 | case OSPF_MSG_HELLO: | |
578 | ospf_packet_hello_dump(s, ntohs(ospfh->length)); | |
579 | break; | |
580 | case OSPF_MSG_DB_DESC: | |
581 | ospf_packet_db_desc_dump(s, ntohs(ospfh->length)); | |
582 | break; | |
583 | case OSPF_MSG_LS_REQ: | |
584 | ospf_packet_ls_req_dump(s, ntohs(ospfh->length)); | |
585 | break; | |
586 | case OSPF_MSG_LS_UPD: | |
587 | ospf_packet_ls_upd_dump(s, ntohs(ospfh->length)); | |
588 | break; | |
589 | case OSPF_MSG_LS_ACK: | |
590 | ospf_packet_ls_ack_dump(s, ntohs(ospfh->length)); | |
591 | break; | |
592 | default: | |
593 | break; | |
594 | } | |
595 | ||
596 | stream_set_getp(s, gp); | |
718e3744 | 597 | } |
598 | ||
692b4c65 QY |
599 | DEFUN (debug_ospf_packet, |
600 | debug_ospf_packet_cmd, | |
601 | "debug ospf [(1-65535)] packet <hello|dd|ls-request|ls-update|ls-ack|all> [<send [detail]|recv [detail]|detail>]", | |
602 | DEBUG_STR | |
603 | OSPF_STR | |
604 | "Instance ID\n" | |
605 | "OSPF packets\n" | |
606 | "OSPF Hello\n" | |
607 | "OSPF Database Description\n" | |
608 | "OSPF Link State Request\n" | |
609 | "OSPF Link State Update\n" | |
610 | "OSPF Link State Acknowledgment\n" | |
611 | "OSPF all packets\n" | |
612 | "Packet sent\n" | |
613 | "Detail Information\n" | |
614 | "Packet received\n" | |
615 | "Detail Information\n" | |
616 | "Detail Information\n") | |
617 | { | |
d62a17ae | 618 | int inst = (argv[2]->type == RANGE_TKN) ? 1 : 0; |
619 | int detail = strmatch(argv[argc - 1]->text, "detail"); | |
620 | int send = strmatch(argv[argc - (1 + detail)]->text, "send"); | |
621 | int recv = strmatch(argv[argc - (1 + detail)]->text, "recv"); | |
622 | char *packet = argv[3 + inst]->text; | |
718e3744 | 623 | |
d62a17ae | 624 | if (inst) // user passed instance ID |
625 | { | |
626 | if (!ospf_lookup_instance(strtoul(argv[2]->arg, NULL, 10))) | |
ac28e4ec | 627 | return CMD_NOT_MY_INSTANCE; |
d62a17ae | 628 | } |
629 | ||
630 | int type = 0; | |
631 | int flag = 0; | |
632 | int i; | |
633 | ||
634 | /* Check packet type. */ | |
635 | if (strmatch(packet, "hello")) | |
636 | type = OSPF_DEBUG_HELLO; | |
637 | else if (strmatch(packet, "dd")) | |
638 | type = OSPF_DEBUG_DB_DESC; | |
639 | else if (strmatch(packet, "ls-request")) | |
640 | type = OSPF_DEBUG_LS_REQ; | |
641 | else if (strmatch(packet, "ls-update")) | |
642 | type = OSPF_DEBUG_LS_UPD; | |
643 | else if (strmatch(packet, "ls-ack")) | |
644 | type = OSPF_DEBUG_LS_ACK; | |
645 | else if (strmatch(packet, "all")) | |
646 | type = OSPF_DEBUG_ALL; | |
647 | ||
648 | /* Cases: | |
649 | * (none) = send + recv | |
650 | * detail = send + recv + detail | |
651 | * recv = recv | |
652 | * send = send | |
653 | * recv detail = recv + detail | |
654 | * send detail = send + detail | |
655 | */ | |
656 | if (!send && !recv) | |
657 | send = recv = 1; | |
658 | ||
659 | flag |= (send) ? OSPF_DEBUG_SEND : 0; | |
660 | flag |= (recv) ? OSPF_DEBUG_RECV : 0; | |
661 | flag |= (detail) ? OSPF_DEBUG_DETAIL : 0; | |
662 | ||
663 | for (i = 0; i < 5; i++) | |
664 | if (type & (0x01 << i)) { | |
665 | if (vty->node == CONFIG_NODE) | |
666 | DEBUG_PACKET_ON(i, flag); | |
667 | else | |
668 | TERM_DEBUG_PACKET_ON(i, flag); | |
669 | } | |
670 | ||
671 | return CMD_SUCCESS; | |
718e3744 | 672 | } |
673 | ||
692b4c65 QY |
674 | DEFUN (no_debug_ospf_packet, |
675 | no_debug_ospf_packet_cmd, | |
676 | "no debug ospf [(1-65535)] packet <hello|dd|ls-request|ls-update|ls-ack|all> [<send [detail]|recv [detail]|detail>]", | |
677 | NO_STR | |
718e3744 | 678 | DEBUG_STR |
679 | OSPF_STR | |
7c8ff89e | 680 | "Instance ID\n" |
718e3744 | 681 | "OSPF packets\n" |
682 | "OSPF Hello\n" | |
683 | "OSPF Database Description\n" | |
684 | "OSPF Link State Request\n" | |
685 | "OSPF Link State Update\n" | |
686 | "OSPF Link State Acknowledgment\n" | |
692b4c65 QY |
687 | "OSPF all packets\n" |
688 | "Packet sent\n" | |
689 | "Detail Information\n" | |
690 | "Packet received\n" | |
691 | "Detail Information\n" | |
692 | "Detail Information\n") | |
693 | { | |
d62a17ae | 694 | int inst = (argv[3]->type == RANGE_TKN) ? 1 : 0; |
695 | int detail = strmatch(argv[argc - 1]->text, "detail"); | |
696 | int send = strmatch(argv[argc - (1 + detail)]->text, "send"); | |
697 | int recv = strmatch(argv[argc - (1 + detail)]->text, "recv"); | |
698 | char *packet = argv[4 + inst]->text; | |
699 | ||
700 | if (inst) // user passed instance ID | |
701 | { | |
702 | if (!ospf_lookup_instance(strtoul(argv[3]->arg, NULL, 10))) | |
ac28e4ec | 703 | return CMD_NOT_MY_INSTANCE; |
d62a17ae | 704 | } |
705 | ||
706 | int type = 0; | |
707 | int flag = 0; | |
708 | int i; | |
709 | ||
710 | /* Check packet type. */ | |
711 | if (strmatch(packet, "hello")) | |
712 | type = OSPF_DEBUG_HELLO; | |
713 | else if (strmatch(packet, "dd")) | |
714 | type = OSPF_DEBUG_DB_DESC; | |
715 | else if (strmatch(packet, "ls-request")) | |
716 | type = OSPF_DEBUG_LS_REQ; | |
717 | else if (strmatch(packet, "ls-update")) | |
718 | type = OSPF_DEBUG_LS_UPD; | |
719 | else if (strmatch(packet, "ls-ack")) | |
720 | type = OSPF_DEBUG_LS_ACK; | |
721 | else if (strmatch(packet, "all")) | |
722 | type = OSPF_DEBUG_ALL; | |
723 | ||
724 | /* Cases: | |
725 | * (none) = send + recv | |
726 | * detail = send + recv + detail | |
727 | * recv = recv | |
728 | * send = send | |
729 | * recv detail = recv + detail | |
730 | * send detail = send + detail | |
731 | */ | |
732 | if (!send && !recv) | |
733 | send = recv = 1; | |
734 | ||
735 | flag |= (send) ? OSPF_DEBUG_SEND : 0; | |
736 | flag |= (recv) ? OSPF_DEBUG_RECV : 0; | |
737 | flag |= (detail) ? OSPF_DEBUG_DETAIL : 0; | |
738 | ||
739 | for (i = 0; i < 5; i++) | |
740 | if (type & (0x01 << i)) { | |
741 | if (vty->node == CONFIG_NODE) | |
742 | DEBUG_PACKET_OFF(i, flag); | |
743 | else | |
744 | TERM_DEBUG_PACKET_OFF(i, flag); | |
745 | } | |
718e3744 | 746 | |
747 | #ifdef DEBUG | |
d62a17ae | 748 | /* |
749 | for (i = 0; i < 5; i++) | |
750 | zlog_debug ("flag[%d] = %d", i, ospf_debug_packet[i]); | |
751 | */ | |
718e3744 | 752 | #endif /* DEBUG */ |
753 | ||
d62a17ae | 754 | return CMD_SUCCESS; |
718e3744 | 755 | } |
756 | ||
692b4c65 QY |
757 | DEFUN (debug_ospf_ism, |
758 | debug_ospf_ism_cmd, | |
759 | "debug ospf [(1-65535)] ism [<status|events|timers>]", | |
718e3744 | 760 | DEBUG_STR |
761 | OSPF_STR | |
7c8ff89e | 762 | "Instance ID\n" |
692b4c65 QY |
763 | "OSPF Interface State Machine\n" |
764 | "ISM Status Information\n" | |
765 | "ISM Event Information\n" | |
766 | "ISM TImer Information\n") | |
7c8ff89e | 767 | { |
d62a17ae | 768 | int inst = (argv[2]->type == RANGE_TKN); |
769 | char *dbgparam = (argc == 4 + inst) ? argv[argc - 1]->text : NULL; | |
770 | ||
771 | if (inst) // user passed instance ID | |
718e3744 | 772 | { |
d62a17ae | 773 | if (!ospf_lookup_instance(strtoul(argv[2]->arg, NULL, 10))) |
ac28e4ec | 774 | return CMD_NOT_MY_INSTANCE; |
718e3744 | 775 | } |
776 | ||
d62a17ae | 777 | if (vty->node == CONFIG_NODE) { |
778 | if (!dbgparam) | |
779 | DEBUG_ON(ism, ISM); | |
780 | else { | |
781 | if (strmatch(dbgparam, "status")) | |
782 | DEBUG_ON(ism, ISM_STATUS); | |
783 | else if (strmatch(dbgparam, "events")) | |
784 | DEBUG_ON(ism, ISM_EVENTS); | |
785 | else if (strmatch(dbgparam, "timers")) | |
786 | DEBUG_ON(ism, ISM_TIMERS); | |
787 | } | |
788 | ||
789 | return CMD_SUCCESS; | |
790 | } | |
791 | ||
792 | /* ENABLE_NODE. */ | |
793 | if (!dbgparam) | |
794 | TERM_DEBUG_ON(ism, ISM); | |
795 | else { | |
796 | if (strmatch(dbgparam, "status")) | |
797 | TERM_DEBUG_ON(ism, ISM_STATUS); | |
798 | else if (strmatch(dbgparam, "events")) | |
799 | TERM_DEBUG_ON(ism, ISM_EVENTS); | |
800 | else if (strmatch(dbgparam, "timers")) | |
801 | TERM_DEBUG_ON(ism, ISM_TIMERS); | |
802 | } | |
803 | ||
804 | return CMD_SUCCESS; | |
718e3744 | 805 | } |
806 | ||
692b4c65 QY |
807 | DEFUN (no_debug_ospf_ism, |
808 | no_debug_ospf_ism_cmd, | |
809 | "no debug ospf [(1-65535)] ism [<status|events|timers>]", | |
16cedbb0 | 810 | NO_STR |
718e3744 | 811 | DEBUG_STR |
812 | OSPF_STR | |
7c8ff89e | 813 | "Instance ID\n" |
692b4c65 QY |
814 | "OSPF Interface State Machine\n" |
815 | "ISM Status Information\n" | |
816 | "ISM Event Information\n" | |
817 | "ISM TImer Information\n") | |
7c8ff89e | 818 | { |
d62a17ae | 819 | int inst = (argv[3]->type == RANGE_TKN); |
820 | char *dbgparam = (argc == 5 + inst) ? argv[argc - 1]->text : NULL; | |
821 | ||
822 | if (inst) // user passed instance ID | |
718e3744 | 823 | { |
d62a17ae | 824 | if (!ospf_lookup_instance(strtoul(argv[3]->arg, NULL, 10))) |
ac28e4ec | 825 | return CMD_NOT_MY_INSTANCE; |
d62a17ae | 826 | } |
827 | ||
828 | if (vty->node == CONFIG_NODE) { | |
829 | if (!dbgparam) | |
830 | DEBUG_OFF(ism, ISM); | |
831 | else { | |
832 | if (strmatch(dbgparam, "status")) | |
833 | DEBUG_OFF(ism, ISM_STATUS); | |
834 | else if (strmatch(dbgparam, "events")) | |
835 | DEBUG_OFF(ism, ISM_EVENTS); | |
836 | else if (strmatch(dbgparam, "timers")) | |
837 | DEBUG_OFF(ism, ISM_TIMERS); | |
838 | } | |
839 | ||
840 | return CMD_SUCCESS; | |
841 | } | |
842 | ||
843 | /* ENABLE_NODE. */ | |
844 | if (!dbgparam) | |
845 | TERM_DEBUG_OFF(ism, ISM); | |
846 | else { | |
847 | if (strmatch(dbgparam, "status")) | |
848 | TERM_DEBUG_OFF(ism, ISM_STATUS); | |
849 | else if (strmatch(dbgparam, "events")) | |
850 | TERM_DEBUG_OFF(ism, ISM_EVENTS); | |
851 | else if (strmatch(dbgparam, "timers")) | |
852 | TERM_DEBUG_OFF(ism, ISM_TIMERS); | |
718e3744 | 853 | } |
692b4c65 | 854 | |
d62a17ae | 855 | return CMD_SUCCESS; |
718e3744 | 856 | } |
857 | ||
d62a17ae | 858 | static int debug_ospf_nsm_common(struct vty *vty, int arg_base, int argc, |
859 | struct cmd_token **argv) | |
718e3744 | 860 | { |
d62a17ae | 861 | if (vty->node == CONFIG_NODE) { |
862 | if (argc == arg_base + 0) | |
863 | DEBUG_ON(nsm, NSM); | |
864 | else if (argc == arg_base + 1) { | |
865 | if (strmatch(argv[arg_base]->text, "status")) | |
866 | DEBUG_ON(nsm, NSM_STATUS); | |
867 | else if (strmatch(argv[arg_base]->text, "events")) | |
868 | DEBUG_ON(nsm, NSM_EVENTS); | |
869 | else if (strmatch(argv[arg_base]->text, "timers")) | |
870 | DEBUG_ON(nsm, NSM_TIMERS); | |
871 | } | |
872 | ||
873 | return CMD_SUCCESS; | |
874 | } | |
875 | ||
876 | /* ENABLE_NODE. */ | |
877 | if (argc == arg_base + 0) | |
878 | TERM_DEBUG_ON(nsm, NSM); | |
879 | else if (argc == arg_base + 1) { | |
880 | if (strmatch(argv[arg_base]->text, "status")) | |
881 | TERM_DEBUG_ON(nsm, NSM_STATUS); | |
882 | else if (strmatch(argv[arg_base]->text, "events")) | |
883 | TERM_DEBUG_ON(nsm, NSM_EVENTS); | |
884 | else if (strmatch(argv[arg_base]->text, "timers")) | |
885 | TERM_DEBUG_ON(nsm, NSM_TIMERS); | |
718e3744 | 886 | } |
887 | ||
d62a17ae | 888 | return CMD_SUCCESS; |
718e3744 | 889 | } |
890 | ||
7c8ff89e DS |
891 | DEFUN (debug_ospf_nsm, |
892 | debug_ospf_nsm_cmd, | |
6de69f83 | 893 | "debug ospf nsm [<status|events|timers>]", |
7c8ff89e DS |
894 | DEBUG_STR |
895 | OSPF_STR | |
1d68dbfe DW |
896 | "OSPF Neighbor State Machine\n" |
897 | "NSM Status Information\n" | |
898 | "NSM Event Information\n" | |
899 | "NSM Timer Information\n") | |
7c8ff89e | 900 | { |
d62a17ae | 901 | return debug_ospf_nsm_common(vty, 3, argc, argv); |
7c8ff89e DS |
902 | } |
903 | ||
7c8ff89e DS |
904 | DEFUN (debug_ospf_instance_nsm, |
905 | debug_ospf_instance_nsm_cmd, | |
6de69f83 | 906 | "debug ospf (1-65535) nsm [<status|events|timers>]", |
718e3744 | 907 | DEBUG_STR |
908 | OSPF_STR | |
7c8ff89e | 909 | "Instance ID\n" |
1d68dbfe DW |
910 | "OSPF Neighbor State Machine\n" |
911 | "NSM Status Information\n" | |
912 | "NSM Event Information\n" | |
913 | "NSM Timer Information\n") | |
7c8ff89e | 914 | { |
d62a17ae | 915 | int idx_number = 2; |
d7c0a89a | 916 | unsigned short instance = 0; |
7c8ff89e | 917 | |
d62a17ae | 918 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
919 | if (!ospf_lookup_instance(instance)) | |
920 | return CMD_SUCCESS; | |
7c8ff89e | 921 | |
d62a17ae | 922 | return debug_ospf_nsm_common(vty, 4, argc, argv); |
7c8ff89e DS |
923 | } |
924 | ||
7c8ff89e | 925 | |
d62a17ae | 926 | static int no_debug_ospf_nsm_common(struct vty *vty, int arg_base, int argc, |
927 | struct cmd_token **argv) | |
718e3744 | 928 | { |
d62a17ae | 929 | /* XXX qlyoung */ |
930 | if (vty->node == CONFIG_NODE) { | |
931 | if (argc == arg_base + 0) | |
932 | DEBUG_OFF(nsm, NSM); | |
933 | else if (argc == arg_base + 1) { | |
934 | if (strmatch(argv[arg_base]->text, "status")) | |
935 | DEBUG_OFF(nsm, NSM_STATUS); | |
936 | else if (strmatch(argv[arg_base]->text, "events")) | |
937 | DEBUG_OFF(nsm, NSM_EVENTS); | |
938 | else if (strmatch(argv[arg_base]->text, "timers")) | |
939 | DEBUG_OFF(nsm, NSM_TIMERS); | |
940 | } | |
941 | ||
942 | return CMD_SUCCESS; | |
943 | } | |
944 | ||
945 | /* ENABLE_NODE. */ | |
946 | if (argc == arg_base + 0) | |
947 | TERM_DEBUG_OFF(nsm, NSM); | |
948 | else if (argc == arg_base + 1) { | |
949 | if (strmatch(argv[arg_base]->text, "status")) | |
950 | TERM_DEBUG_OFF(nsm, NSM_STATUS); | |
951 | else if (strmatch(argv[arg_base]->text, "events")) | |
952 | TERM_DEBUG_OFF(nsm, NSM_EVENTS); | |
953 | else if (strmatch(argv[arg_base]->text, "timers")) | |
954 | TERM_DEBUG_OFF(nsm, NSM_TIMERS); | |
718e3744 | 955 | } |
956 | ||
d62a17ae | 957 | return CMD_SUCCESS; |
718e3744 | 958 | } |
959 | ||
7c8ff89e DS |
960 | DEFUN (no_debug_ospf_nsm, |
961 | no_debug_ospf_nsm_cmd, | |
6de69f83 | 962 | "no debug ospf nsm [<status|events|timers>]", |
7c8ff89e DS |
963 | NO_STR |
964 | DEBUG_STR | |
965 | OSPF_STR | |
16cedbb0 | 966 | "OSPF Neighbor State Machine\n" |
1d68dbfe DW |
967 | "NSM Status Information\n" |
968 | "NSM Event Information\n" | |
969 | "NSM Timer Information\n") | |
7c8ff89e | 970 | { |
d62a17ae | 971 | return no_debug_ospf_nsm_common(vty, 4, argc, argv); |
7c8ff89e DS |
972 | } |
973 | ||
718e3744 | 974 | |
7c8ff89e DS |
975 | DEFUN (no_debug_ospf_instance_nsm, |
976 | no_debug_ospf_instance_nsm_cmd, | |
6de69f83 | 977 | "no debug ospf (1-65535) nsm [<status|events|timers>]", |
7c8ff89e | 978 | NO_STR |
718e3744 | 979 | DEBUG_STR |
980 | OSPF_STR | |
7c8ff89e | 981 | "Instance ID\n" |
16cedbb0 | 982 | "OSPF Neighbor State Machine\n" |
1d68dbfe DW |
983 | "NSM Status Information\n" |
984 | "NSM Event Information\n" | |
985 | "NSM Timer Information\n") | |
7c8ff89e | 986 | { |
d62a17ae | 987 | int idx_number = 3; |
d7c0a89a | 988 | unsigned short instance = 0; |
7c8ff89e | 989 | |
d62a17ae | 990 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
991 | if (!ospf_lookup_instance(instance)) | |
ac28e4ec | 992 | return CMD_NOT_MY_INSTANCE; |
7c8ff89e | 993 | |
d62a17ae | 994 | return no_debug_ospf_nsm_common(vty, 5, argc, argv); |
7c8ff89e DS |
995 | } |
996 | ||
7c8ff89e | 997 | |
d62a17ae | 998 | static int debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc, |
999 | struct cmd_token **argv) | |
718e3744 | 1000 | { |
d62a17ae | 1001 | if (vty->node == CONFIG_NODE) { |
1002 | if (argc == arg_base + 0) | |
1003 | DEBUG_ON(lsa, LSA); | |
1004 | else if (argc == arg_base + 1) { | |
1005 | if (strmatch(argv[arg_base]->text, "generate")) | |
1006 | DEBUG_ON(lsa, LSA_GENERATE); | |
1007 | else if (strmatch(argv[arg_base]->text, "flooding")) | |
1008 | DEBUG_ON(lsa, LSA_FLOODING); | |
1009 | else if (strmatch(argv[arg_base]->text, "install")) | |
1010 | DEBUG_ON(lsa, LSA_INSTALL); | |
1011 | else if (strmatch(argv[arg_base]->text, "refresh")) | |
1012 | DEBUG_ON(lsa, LSA_REFRESH); | |
1013 | } | |
1014 | ||
1015 | return CMD_SUCCESS; | |
718e3744 | 1016 | } |
1017 | ||
d62a17ae | 1018 | /* ENABLE_NODE. */ |
1019 | if (argc == arg_base + 0) | |
1020 | TERM_DEBUG_ON(lsa, LSA); | |
1021 | else if (argc == arg_base + 1) { | |
1022 | if (strmatch(argv[arg_base]->text, "generate")) | |
1023 | TERM_DEBUG_ON(lsa, LSA_GENERATE); | |
1024 | else if (strmatch(argv[arg_base]->text, "flooding")) | |
1025 | TERM_DEBUG_ON(lsa, LSA_FLOODING); | |
1026 | else if (strmatch(argv[arg_base]->text, "install")) | |
1027 | TERM_DEBUG_ON(lsa, LSA_INSTALL); | |
1028 | else if (strmatch(argv[arg_base]->text, "refresh")) | |
1029 | TERM_DEBUG_ON(lsa, LSA_REFRESH); | |
1030 | } | |
1031 | ||
1032 | return CMD_SUCCESS; | |
718e3744 | 1033 | } |
1034 | ||
7c8ff89e DS |
1035 | DEFUN (debug_ospf_lsa, |
1036 | debug_ospf_lsa_cmd, | |
6de69f83 | 1037 | "debug ospf lsa [<generate|flooding|install|refresh>]", |
7c8ff89e DS |
1038 | DEBUG_STR |
1039 | OSPF_STR | |
1d68dbfe DW |
1040 | "OSPF Link State Advertisement\n" |
1041 | "LSA Generation\n" | |
1042 | "LSA Flooding\n" | |
1043 | "LSA Install/Delete\n" | |
1044 | "LSA Refresh\n") | |
7c8ff89e | 1045 | { |
d62a17ae | 1046 | return debug_ospf_lsa_common(vty, 3, argc, argv); |
7c8ff89e DS |
1047 | } |
1048 | ||
7c8ff89e DS |
1049 | DEFUN (debug_ospf_instance_lsa, |
1050 | debug_ospf_instance_lsa_cmd, | |
6de69f83 | 1051 | "debug ospf (1-65535) lsa [<generate|flooding|install|refresh>]", |
718e3744 | 1052 | DEBUG_STR |
1053 | OSPF_STR | |
7c8ff89e | 1054 | "Instance ID\n" |
1d68dbfe DW |
1055 | "OSPF Link State Advertisement\n" |
1056 | "LSA Generation\n" | |
1057 | "LSA Flooding\n" | |
1058 | "LSA Install/Delete\n" | |
1059 | "LSA Refresh\n") | |
7c8ff89e | 1060 | { |
d62a17ae | 1061 | int idx_number = 2; |
d7c0a89a | 1062 | unsigned short instance = 0; |
7c8ff89e | 1063 | |
d62a17ae | 1064 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
1065 | if (!ospf_lookup_instance(instance)) | |
ac28e4ec | 1066 | return CMD_NOT_MY_INSTANCE; |
7c8ff89e | 1067 | |
d62a17ae | 1068 | return debug_ospf_lsa_common(vty, 4, argc, argv); |
7c8ff89e DS |
1069 | } |
1070 | ||
7c8ff89e | 1071 | |
d62a17ae | 1072 | static int no_debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc, |
1073 | struct cmd_token **argv) | |
718e3744 | 1074 | { |
d62a17ae | 1075 | if (vty->node == CONFIG_NODE) { |
1076 | if (argc == arg_base + 0) | |
1077 | DEBUG_OFF(lsa, LSA); | |
1078 | else if (argc == arg_base + 1) { | |
1079 | if (strmatch(argv[arg_base]->text, "generate")) | |
1080 | DEBUG_OFF(lsa, LSA_GENERATE); | |
1081 | else if (strmatch(argv[arg_base]->text, "flooding")) | |
1082 | DEBUG_OFF(lsa, LSA_FLOODING); | |
1083 | else if (strmatch(argv[arg_base]->text, "install")) | |
1084 | DEBUG_OFF(lsa, LSA_INSTALL); | |
1085 | else if (strmatch(argv[arg_base]->text, "refresh")) | |
1086 | DEBUG_OFF(lsa, LSA_REFRESH); | |
1087 | } | |
1088 | ||
1089 | return CMD_SUCCESS; | |
1090 | } | |
1091 | ||
1092 | /* ENABLE_NODE. */ | |
1093 | if (argc == arg_base + 0) | |
1094 | TERM_DEBUG_OFF(lsa, LSA); | |
1095 | else if (argc == arg_base + 1) { | |
1096 | if (strmatch(argv[arg_base]->text, "generate")) | |
1097 | TERM_DEBUG_OFF(lsa, LSA_GENERATE); | |
1098 | else if (strmatch(argv[arg_base]->text, "flooding")) | |
1099 | TERM_DEBUG_OFF(lsa, LSA_FLOODING); | |
1100 | else if (strmatch(argv[arg_base]->text, "install")) | |
1101 | TERM_DEBUG_OFF(lsa, LSA_INSTALL); | |
1102 | else if (strmatch(argv[arg_base]->text, "refresh")) | |
1103 | TERM_DEBUG_OFF(lsa, LSA_REFRESH); | |
718e3744 | 1104 | } |
1105 | ||
d62a17ae | 1106 | return CMD_SUCCESS; |
718e3744 | 1107 | } |
1108 | ||
7c8ff89e DS |
1109 | DEFUN (no_debug_ospf_lsa, |
1110 | no_debug_ospf_lsa_cmd, | |
6de69f83 | 1111 | "no debug ospf lsa [<generate|flooding|install|refresh>]", |
7c8ff89e DS |
1112 | NO_STR |
1113 | DEBUG_STR | |
1114 | OSPF_STR | |
1d68dbfe DW |
1115 | "OSPF Link State Advertisement\n" |
1116 | "LSA Generation\n" | |
1117 | "LSA Flooding\n" | |
1118 | "LSA Install/Delete\n" | |
1119 | "LSA Refres\n") | |
7c8ff89e | 1120 | { |
d62a17ae | 1121 | return no_debug_ospf_lsa_common(vty, 4, argc, argv); |
7c8ff89e DS |
1122 | } |
1123 | ||
7c8ff89e DS |
1124 | DEFUN (no_debug_ospf_instance_lsa, |
1125 | no_debug_ospf_instance_lsa_cmd, | |
6de69f83 | 1126 | "no debug ospf (1-65535) lsa [<generate|flooding|install|refresh>]", |
7c8ff89e DS |
1127 | NO_STR |
1128 | DEBUG_STR | |
1129 | OSPF_STR | |
1130 | "Instance ID\n" | |
1d68dbfe DW |
1131 | "OSPF Link State Advertisement\n" |
1132 | "LSA Generation\n" | |
1133 | "LSA Flooding\n" | |
1134 | "LSA Install/Delete\n" | |
1135 | "LSA Refres\n") | |
7c8ff89e | 1136 | { |
d62a17ae | 1137 | int idx_number = 3; |
d7c0a89a | 1138 | unsigned short instance = 0; |
7c8ff89e | 1139 | |
d62a17ae | 1140 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
1141 | if (!ospf_lookup_instance(instance)) | |
ac28e4ec | 1142 | return CMD_NOT_MY_INSTANCE; |
6b0655a2 | 1143 | |
d62a17ae | 1144 | return no_debug_ospf_lsa_common(vty, 5, argc, argv); |
7c8ff89e DS |
1145 | } |
1146 | ||
7c8ff89e | 1147 | |
d62a17ae | 1148 | static int debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, |
1149 | struct cmd_token **argv) | |
718e3744 | 1150 | { |
d62a17ae | 1151 | if (vty->node == CONFIG_NODE) { |
1152 | if (argc == arg_base + 0) | |
1153 | DEBUG_ON(zebra, ZEBRA); | |
1154 | else if (argc == arg_base + 1) { | |
1155 | if (strmatch(argv[arg_base]->text, "interface")) | |
1156 | DEBUG_ON(zebra, ZEBRA_INTERFACE); | |
1157 | else if (strmatch(argv[arg_base]->text, "redistribute")) | |
1158 | DEBUG_ON(zebra, ZEBRA_REDISTRIBUTE); | |
1159 | } | |
1160 | ||
1161 | return CMD_SUCCESS; | |
1162 | } | |
1163 | ||
1164 | /* ENABLE_NODE. */ | |
1165 | if (argc == arg_base + 0) | |
1166 | TERM_DEBUG_ON(zebra, ZEBRA); | |
1167 | else if (argc == arg_base + 1) { | |
1168 | if (strmatch(argv[arg_base]->text, "interface")) | |
1169 | TERM_DEBUG_ON(zebra, ZEBRA_INTERFACE); | |
1170 | else if (strmatch(argv[arg_base]->text, "redistribute")) | |
1171 | TERM_DEBUG_ON(zebra, ZEBRA_REDISTRIBUTE); | |
718e3744 | 1172 | } |
1173 | ||
d62a17ae | 1174 | return CMD_SUCCESS; |
718e3744 | 1175 | } |
1176 | ||
7c8ff89e DS |
1177 | DEFUN (debug_ospf_zebra, |
1178 | debug_ospf_zebra_cmd, | |
6de69f83 | 1179 | "debug ospf zebra [<interface|redistribute>]", |
7c8ff89e DS |
1180 | DEBUG_STR |
1181 | OSPF_STR | |
41e7fb80 | 1182 | ZEBRA_STR |
1d68dbfe DW |
1183 | "Zebra interface\n" |
1184 | "Zebra redistribute\n") | |
7c8ff89e | 1185 | { |
d62a17ae | 1186 | return debug_ospf_zebra_common(vty, 3, argc, argv); |
7c8ff89e DS |
1187 | } |
1188 | ||
7c8ff89e DS |
1189 | DEFUN (debug_ospf_instance_zebra, |
1190 | debug_ospf_instance_zebra_cmd, | |
6de69f83 | 1191 | "debug ospf (1-65535) zebra [<interface|redistribute>]", |
718e3744 | 1192 | DEBUG_STR |
1193 | OSPF_STR | |
7c8ff89e | 1194 | "Instance ID\n" |
41e7fb80 | 1195 | ZEBRA_STR |
1d68dbfe DW |
1196 | "Zebra interface\n" |
1197 | "Zebra redistribute\n") | |
7c8ff89e | 1198 | { |
d62a17ae | 1199 | int idx_number = 2; |
d7c0a89a | 1200 | unsigned short instance = 0; |
7c8ff89e | 1201 | |
d62a17ae | 1202 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
1203 | if (!ospf_lookup_instance(instance)) | |
ac28e4ec | 1204 | return CMD_NOT_MY_INSTANCE; |
7c8ff89e | 1205 | |
d62a17ae | 1206 | return debug_ospf_zebra_common(vty, 4, argc, argv); |
7c8ff89e DS |
1207 | } |
1208 | ||
7c8ff89e | 1209 | |
d62a17ae | 1210 | static int no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, |
1211 | struct cmd_token **argv) | |
718e3744 | 1212 | { |
d62a17ae | 1213 | if (vty->node == CONFIG_NODE) { |
1214 | if (argc == arg_base + 0) | |
1215 | DEBUG_OFF(zebra, ZEBRA); | |
1216 | else if (argc == arg_base + 1) { | |
1217 | if (strmatch(argv[arg_base]->text, "interface")) | |
1218 | DEBUG_OFF(zebra, ZEBRA_INTERFACE); | |
1219 | else if (strmatch(argv[arg_base]->text, "redistribute")) | |
1220 | DEBUG_OFF(zebra, ZEBRA_REDISTRIBUTE); | |
1221 | } | |
1222 | ||
1223 | return CMD_SUCCESS; | |
1224 | } | |
1225 | ||
1226 | /* ENABLE_NODE. */ | |
1227 | if (argc == arg_base + 0) | |
1228 | TERM_DEBUG_OFF(zebra, ZEBRA); | |
1229 | else if (argc == arg_base + 1) { | |
1230 | if (strmatch(argv[arg_base]->text, "interface")) | |
1231 | TERM_DEBUG_OFF(zebra, ZEBRA_INTERFACE); | |
1232 | else if (strmatch(argv[arg_base]->text, "redistribute")) | |
1233 | TERM_DEBUG_OFF(zebra, ZEBRA_REDISTRIBUTE); | |
718e3744 | 1234 | } |
1235 | ||
d62a17ae | 1236 | return CMD_SUCCESS; |
718e3744 | 1237 | } |
1238 | ||
7c8ff89e DS |
1239 | DEFUN (no_debug_ospf_zebra, |
1240 | no_debug_ospf_zebra_cmd, | |
6de69f83 | 1241 | "no debug ospf zebra [<interface|redistribute>]", |
7c8ff89e DS |
1242 | NO_STR |
1243 | DEBUG_STR | |
1244 | OSPF_STR | |
41e7fb80 | 1245 | ZEBRA_STR |
1d68dbfe DW |
1246 | "Zebra interface\n" |
1247 | "Zebra redistribute\n") | |
7c8ff89e | 1248 | { |
d62a17ae | 1249 | return no_debug_ospf_zebra_common(vty, 4, argc, argv); |
7c8ff89e DS |
1250 | } |
1251 | ||
7c8ff89e DS |
1252 | DEFUN (no_debug_ospf_instance_zebra, |
1253 | no_debug_ospf_instance_zebra_cmd, | |
6de69f83 | 1254 | "no debug ospf (1-65535) zebra [<interface|redistribute>]", |
7c8ff89e DS |
1255 | NO_STR |
1256 | DEBUG_STR | |
1257 | OSPF_STR | |
1258 | "Instance ID\n" | |
41e7fb80 | 1259 | ZEBRA_STR |
1d68dbfe DW |
1260 | "Zebra interface\n" |
1261 | "Zebra redistribute\n") | |
7c8ff89e | 1262 | { |
d62a17ae | 1263 | int idx_number = 3; |
d7c0a89a | 1264 | unsigned short instance = 0; |
7c8ff89e | 1265 | |
d62a17ae | 1266 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
1267 | if (!ospf_lookup_instance(instance)) | |
1268 | return CMD_SUCCESS; | |
7c8ff89e | 1269 | |
d62a17ae | 1270 | return no_debug_ospf_zebra_common(vty, 5, argc, argv); |
7c8ff89e DS |
1271 | } |
1272 | ||
7c8ff89e | 1273 | |
718e3744 | 1274 | DEFUN (debug_ospf_event, |
1275 | debug_ospf_event_cmd, | |
1276 | "debug ospf event", | |
1277 | DEBUG_STR | |
1278 | OSPF_STR | |
1279 | "OSPF event information\n") | |
1280 | { | |
d62a17ae | 1281 | if (vty->node == CONFIG_NODE) |
1282 | CONF_DEBUG_ON(event, EVENT); | |
1283 | TERM_DEBUG_ON(event, EVENT); | |
1284 | return CMD_SUCCESS; | |
718e3744 | 1285 | } |
1286 | ||
1287 | DEFUN (no_debug_ospf_event, | |
1288 | no_debug_ospf_event_cmd, | |
1289 | "no debug ospf event", | |
1290 | NO_STR | |
1291 | DEBUG_STR | |
1292 | OSPF_STR | |
1293 | "OSPF event information\n") | |
1294 | { | |
d62a17ae | 1295 | if (vty->node == CONFIG_NODE) |
1296 | CONF_DEBUG_OFF(event, EVENT); | |
1297 | TERM_DEBUG_OFF(event, EVENT); | |
1298 | return CMD_SUCCESS; | |
718e3744 | 1299 | } |
1300 | ||
7c8ff89e DS |
1301 | DEFUN (debug_ospf_instance_event, |
1302 | debug_ospf_instance_event_cmd, | |
6147e2c6 | 1303 | "debug ospf (1-65535) event", |
7c8ff89e DS |
1304 | DEBUG_STR |
1305 | OSPF_STR | |
1306 | "Instance ID\n" | |
1307 | "OSPF event information\n") | |
1308 | { | |
d62a17ae | 1309 | int idx_number = 2; |
d7c0a89a | 1310 | unsigned short instance = 0; |
7c8ff89e | 1311 | |
d62a17ae | 1312 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
1313 | if (!ospf_lookup_instance(instance)) | |
1314 | return CMD_SUCCESS; | |
7c8ff89e | 1315 | |
d62a17ae | 1316 | if (vty->node == CONFIG_NODE) |
1317 | CONF_DEBUG_ON(event, EVENT); | |
1318 | TERM_DEBUG_ON(event, EVENT); | |
1319 | return CMD_SUCCESS; | |
7c8ff89e DS |
1320 | } |
1321 | ||
1322 | DEFUN (no_debug_ospf_instance_event, | |
1323 | no_debug_ospf_instance_event_cmd, | |
6147e2c6 | 1324 | "no debug ospf (1-65535) event", |
7c8ff89e DS |
1325 | NO_STR |
1326 | DEBUG_STR | |
1327 | OSPF_STR | |
1328 | "Instance ID\n" | |
1329 | "OSPF event information\n") | |
1330 | { | |
d62a17ae | 1331 | int idx_number = 3; |
d7c0a89a | 1332 | unsigned short instance = 0; |
7c8ff89e | 1333 | |
d62a17ae | 1334 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
1335 | if (!ospf_lookup_instance(instance)) | |
1336 | return CMD_SUCCESS; | |
7c8ff89e | 1337 | |
d62a17ae | 1338 | if (vty->node == CONFIG_NODE) |
1339 | CONF_DEBUG_OFF(event, EVENT); | |
1340 | TERM_DEBUG_OFF(event, EVENT); | |
1341 | return CMD_SUCCESS; | |
7c8ff89e DS |
1342 | } |
1343 | ||
718e3744 | 1344 | DEFUN (debug_ospf_nssa, |
1345 | debug_ospf_nssa_cmd, | |
1346 | "debug ospf nssa", | |
1347 | DEBUG_STR | |
1348 | OSPF_STR | |
1349 | "OSPF nssa information\n") | |
1350 | { | |
d62a17ae | 1351 | if (vty->node == CONFIG_NODE) |
1352 | CONF_DEBUG_ON(nssa, NSSA); | |
1353 | TERM_DEBUG_ON(nssa, NSSA); | |
1354 | return CMD_SUCCESS; | |
718e3744 | 1355 | } |
1356 | ||
1357 | DEFUN (no_debug_ospf_nssa, | |
1358 | no_debug_ospf_nssa_cmd, | |
1359 | "no debug ospf nssa", | |
1360 | NO_STR | |
1361 | DEBUG_STR | |
1362 | OSPF_STR | |
1363 | "OSPF nssa information\n") | |
1364 | { | |
d62a17ae | 1365 | if (vty->node == CONFIG_NODE) |
1366 | CONF_DEBUG_OFF(nssa, NSSA); | |
1367 | TERM_DEBUG_OFF(nssa, NSSA); | |
1368 | return CMD_SUCCESS; | |
718e3744 | 1369 | } |
1370 | ||
7c8ff89e DS |
1371 | DEFUN (debug_ospf_instance_nssa, |
1372 | debug_ospf_instance_nssa_cmd, | |
6147e2c6 | 1373 | "debug ospf (1-65535) nssa", |
7c8ff89e DS |
1374 | DEBUG_STR |
1375 | OSPF_STR | |
1376 | "Instance ID\n" | |
1377 | "OSPF nssa information\n") | |
1378 | { | |
d62a17ae | 1379 | int idx_number = 2; |
d7c0a89a | 1380 | unsigned short instance = 0; |
7c8ff89e | 1381 | |
d62a17ae | 1382 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
1383 | if (!ospf_lookup_instance(instance)) | |
1384 | return CMD_SUCCESS; | |
6b0655a2 | 1385 | |
d62a17ae | 1386 | if (vty->node == CONFIG_NODE) |
1387 | CONF_DEBUG_ON(nssa, NSSA); | |
1388 | TERM_DEBUG_ON(nssa, NSSA); | |
1389 | return CMD_SUCCESS; | |
7c8ff89e DS |
1390 | } |
1391 | ||
1392 | DEFUN (no_debug_ospf_instance_nssa, | |
1393 | no_debug_ospf_instance_nssa_cmd, | |
6147e2c6 | 1394 | "no debug ospf (1-65535) nssa", |
7c8ff89e | 1395 | NO_STR |
718e3744 | 1396 | DEBUG_STR |
7c8ff89e DS |
1397 | OSPF_STR |
1398 | "Instance ID\n" | |
1399 | "OSPF nssa information\n") | |
1400 | { | |
d62a17ae | 1401 | int idx_number = 3; |
d7c0a89a | 1402 | unsigned short instance = 0; |
7c8ff89e | 1403 | |
d62a17ae | 1404 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
1405 | if (!ospf_lookup_instance(instance)) | |
1406 | return CMD_SUCCESS; | |
7c8ff89e | 1407 | |
d62a17ae | 1408 | if (vty->node == CONFIG_NODE) |
1409 | CONF_DEBUG_OFF(nssa, NSSA); | |
1410 | TERM_DEBUG_OFF(nssa, NSSA); | |
1411 | return CMD_SUCCESS; | |
7c8ff89e DS |
1412 | } |
1413 | ||
16f1b9ee OD |
1414 | DEFUN (debug_ospf_te, |
1415 | debug_ospf_te_cmd, | |
1416 | "debug ospf te", | |
1417 | DEBUG_STR | |
1418 | OSPF_STR | |
1419 | "OSPF-TE information\n") | |
1420 | { | |
d62a17ae | 1421 | if (vty->node == CONFIG_NODE) |
1422 | CONF_DEBUG_ON(te, TE); | |
1423 | TERM_DEBUG_ON(te, TE); | |
1424 | return CMD_SUCCESS; | |
16f1b9ee OD |
1425 | } |
1426 | ||
1427 | DEFUN (no_debug_ospf_te, | |
1428 | no_debug_ospf_te_cmd, | |
1429 | "no debug ospf te", | |
1430 | NO_STR | |
1431 | DEBUG_STR | |
1432 | OSPF_STR | |
1433 | "OSPF-TE information\n") | |
1434 | { | |
d62a17ae | 1435 | if (vty->node == CONFIG_NODE) |
1436 | CONF_DEBUG_OFF(te, TE); | |
1437 | TERM_DEBUG_OFF(te, TE); | |
1438 | return CMD_SUCCESS; | |
16f1b9ee OD |
1439 | } |
1440 | ||
cf9b9f77 OD |
1441 | DEFUN (debug_ospf_sr, |
1442 | debug_ospf_sr_cmd, | |
1443 | "debug ospf sr", | |
1444 | DEBUG_STR | |
1445 | OSPF_STR | |
1446 | "OSPF-SR information\n") | |
1447 | { | |
1448 | if (vty->node == CONFIG_NODE) | |
1449 | CONF_DEBUG_ON(sr, SR); | |
1450 | TERM_DEBUG_ON(sr, SR); | |
1451 | return CMD_SUCCESS; | |
1452 | } | |
1453 | ||
1454 | DEFUN (no_debug_ospf_sr, | |
1455 | no_debug_ospf_sr_cmd, | |
1456 | "no debug ospf sr", | |
1457 | NO_STR | |
1458 | DEBUG_STR | |
1459 | OSPF_STR | |
1460 | "OSPF-SR information\n") | |
1461 | { | |
1462 | if (vty->node == CONFIG_NODE) | |
1463 | CONF_DEBUG_OFF(sr, SR); | |
1464 | TERM_DEBUG_OFF(sr, SR); | |
1465 | return CMD_SUCCESS; | |
1466 | } | |
1467 | ||
4dfd8aff DW |
1468 | DEFUN (no_debug_ospf, |
1469 | no_debug_ospf_cmd, | |
1470 | "no debug ospf", | |
1471 | NO_STR | |
1472 | DEBUG_STR | |
1473 | OSPF_STR) | |
1474 | { | |
d62a17ae | 1475 | int flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL; |
1476 | int i; | |
1477 | ||
1478 | if (vty->node == CONFIG_NODE) { | |
1479 | CONF_DEBUG_OFF(event, EVENT); | |
1480 | CONF_DEBUG_OFF(nssa, NSSA); | |
1481 | DEBUG_OFF(ism, ISM_EVENTS); | |
1482 | DEBUG_OFF(ism, ISM_STATUS); | |
1483 | DEBUG_OFF(ism, ISM_TIMERS); | |
1484 | DEBUG_OFF(lsa, LSA); | |
1485 | DEBUG_OFF(lsa, LSA_FLOODING); | |
1486 | DEBUG_OFF(lsa, LSA_GENERATE); | |
1487 | DEBUG_OFF(lsa, LSA_INSTALL); | |
1488 | DEBUG_OFF(lsa, LSA_REFRESH); | |
1489 | DEBUG_OFF(nsm, NSM); | |
1490 | DEBUG_OFF(nsm, NSM_EVENTS); | |
1491 | DEBUG_OFF(nsm, NSM_STATUS); | |
1492 | DEBUG_OFF(nsm, NSM_TIMERS); | |
1493 | DEBUG_OFF(zebra, ZEBRA); | |
1494 | DEBUG_OFF(zebra, ZEBRA_INTERFACE); | |
1495 | DEBUG_OFF(zebra, ZEBRA_REDISTRIBUTE); | |
1496 | ||
1497 | for (i = 0; i < 5; i++) | |
1498 | DEBUG_PACKET_OFF(i, flag); | |
1499 | } | |
1500 | ||
1501 | for (i = 0; i < 5; i++) | |
1502 | TERM_DEBUG_PACKET_OFF(i, flag); | |
1503 | ||
1504 | TERM_DEBUG_OFF(event, EVENT); | |
1505 | TERM_DEBUG_OFF(ism, ISM); | |
1506 | TERM_DEBUG_OFF(ism, ISM_EVENTS); | |
1507 | TERM_DEBUG_OFF(ism, ISM_STATUS); | |
1508 | TERM_DEBUG_OFF(ism, ISM_TIMERS); | |
1509 | TERM_DEBUG_OFF(lsa, LSA); | |
1510 | TERM_DEBUG_OFF(lsa, LSA_FLOODING); | |
1511 | TERM_DEBUG_OFF(lsa, LSA_GENERATE); | |
1512 | TERM_DEBUG_OFF(lsa, LSA_INSTALL); | |
1513 | TERM_DEBUG_OFF(lsa, LSA_REFRESH); | |
1514 | TERM_DEBUG_OFF(nsm, NSM); | |
1515 | TERM_DEBUG_OFF(nsm, NSM_EVENTS); | |
1516 | TERM_DEBUG_OFF(nsm, NSM_STATUS); | |
1517 | TERM_DEBUG_OFF(nsm, NSM_TIMERS); | |
1518 | TERM_DEBUG_OFF(nssa, NSSA); | |
1519 | TERM_DEBUG_OFF(zebra, ZEBRA); | |
1520 | TERM_DEBUG_OFF(zebra, ZEBRA_INTERFACE); | |
1521 | TERM_DEBUG_OFF(zebra, ZEBRA_REDISTRIBUTE); | |
1522 | ||
1523 | return CMD_SUCCESS; | |
4dfd8aff | 1524 | } |
7c8ff89e | 1525 | |
d62a17ae | 1526 | static int show_debugging_ospf_common(struct vty *vty, struct ospf *ospf) |
718e3744 | 1527 | { |
d62a17ae | 1528 | int i; |
1529 | ||
1530 | if (ospf->instance) | |
1531 | vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); | |
1532 | ||
1533 | vty_out(vty, "OSPF debugging status:\n"); | |
1534 | ||
1535 | /* Show debug status for events. */ | |
1536 | if (IS_DEBUG_OSPF(event, EVENT)) | |
1537 | vty_out(vty, " OSPF event debugging is on\n"); | |
1538 | ||
1539 | /* Show debug status for ISM. */ | |
1540 | if (IS_DEBUG_OSPF(ism, ISM) == OSPF_DEBUG_ISM) | |
1541 | vty_out(vty, " OSPF ISM debugging is on\n"); | |
1542 | else { | |
1543 | if (IS_DEBUG_OSPF(ism, ISM_STATUS)) | |
1544 | vty_out(vty, " OSPF ISM status debugging is on\n"); | |
1545 | if (IS_DEBUG_OSPF(ism, ISM_EVENTS)) | |
1546 | vty_out(vty, " OSPF ISM event debugging is on\n"); | |
1547 | if (IS_DEBUG_OSPF(ism, ISM_TIMERS)) | |
1548 | vty_out(vty, " OSPF ISM timer debugging is on\n"); | |
1549 | } | |
1550 | ||
1551 | /* Show debug status for NSM. */ | |
1552 | if (IS_DEBUG_OSPF(nsm, NSM) == OSPF_DEBUG_NSM) | |
1553 | vty_out(vty, " OSPF NSM debugging is on\n"); | |
1554 | else { | |
1555 | if (IS_DEBUG_OSPF(nsm, NSM_STATUS)) | |
1556 | vty_out(vty, " OSPF NSM status debugging is on\n"); | |
1557 | if (IS_DEBUG_OSPF(nsm, NSM_EVENTS)) | |
1558 | vty_out(vty, " OSPF NSM event debugging is on\n"); | |
1559 | if (IS_DEBUG_OSPF(nsm, NSM_TIMERS)) | |
1560 | vty_out(vty, " OSPF NSM timer debugging is on\n"); | |
1561 | } | |
1562 | ||
1563 | /* Show debug status for OSPF Packets. */ | |
1564 | for (i = 0; i < 5; i++) | |
1565 | if (IS_DEBUG_OSPF_PACKET(i, SEND) | |
1566 | && IS_DEBUG_OSPF_PACKET(i, RECV)) { | |
1567 | vty_out(vty, " OSPF packet %s%s debugging is on\n", | |
1568 | lookup_msg(ospf_packet_type_str, i + 1, NULL), | |
1569 | IS_DEBUG_OSPF_PACKET(i, DETAIL) ? " detail" | |
1570 | : ""); | |
1571 | } else { | |
1572 | if (IS_DEBUG_OSPF_PACKET(i, SEND)) | |
1573 | vty_out(vty, | |
1574 | " OSPF packet %s send%s debugging is on\n", | |
1575 | lookup_msg(ospf_packet_type_str, i + 1, | |
1576 | NULL), | |
1577 | IS_DEBUG_OSPF_PACKET(i, DETAIL) | |
1578 | ? " detail" | |
1579 | : ""); | |
1580 | if (IS_DEBUG_OSPF_PACKET(i, RECV)) | |
1581 | vty_out(vty, | |
1582 | " OSPF packet %s receive%s debugging is on\n", | |
1583 | lookup_msg(ospf_packet_type_str, i + 1, | |
1584 | NULL), | |
1585 | IS_DEBUG_OSPF_PACKET(i, DETAIL) | |
1586 | ? " detail" | |
1587 | : ""); | |
1588 | } | |
1589 | ||
1590 | /* Show debug status for OSPF LSAs. */ | |
1591 | if (IS_DEBUG_OSPF(lsa, LSA) == OSPF_DEBUG_LSA) | |
1592 | vty_out(vty, " OSPF LSA debugging is on\n"); | |
1593 | else { | |
1594 | if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) | |
1595 | vty_out(vty, " OSPF LSA generation debugging is on\n"); | |
1596 | if (IS_DEBUG_OSPF(lsa, LSA_FLOODING)) | |
1597 | vty_out(vty, " OSPF LSA flooding debugging is on\n"); | |
1598 | if (IS_DEBUG_OSPF(lsa, LSA_INSTALL)) | |
1599 | vty_out(vty, " OSPF LSA install debugging is on\n"); | |
1600 | if (IS_DEBUG_OSPF(lsa, LSA_REFRESH)) | |
1601 | vty_out(vty, " OSPF LSA refresh debugging is on\n"); | |
1602 | } | |
1603 | ||
1604 | /* Show debug status for Zebra. */ | |
1605 | if (IS_DEBUG_OSPF(zebra, ZEBRA) == OSPF_DEBUG_ZEBRA) | |
1606 | vty_out(vty, " OSPF Zebra debugging is on\n"); | |
1607 | else { | |
1608 | if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) | |
1609 | vty_out(vty, | |
1610 | " OSPF Zebra interface debugging is on\n"); | |
1611 | if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) | |
1612 | vty_out(vty, | |
1613 | " OSPF Zebra redistribute debugging is on\n"); | |
1614 | } | |
1615 | ||
1616 | /* Show debug status for NSSA. */ | |
1617 | if (IS_DEBUG_OSPF(nssa, NSSA) == OSPF_DEBUG_NSSA) | |
1618 | vty_out(vty, " OSPF NSSA debugging is on\n"); | |
1619 | ||
1620 | vty_out(vty, "\n"); | |
1621 | ||
1622 | return CMD_SUCCESS; | |
718e3744 | 1623 | } |
1624 | ||
87f6dc50 DS |
1625 | DEFUN_NOSH (show_debugging_ospf, |
1626 | show_debugging_ospf_cmd, | |
1627 | "show debugging [ospf]", | |
1628 | SHOW_STR | |
1629 | DEBUG_STR | |
1630 | OSPF_STR) | |
7c8ff89e | 1631 | { |
b5a8894d | 1632 | struct ospf *ospf = NULL; |
7c8ff89e | 1633 | |
b5a8894d CS |
1634 | ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); |
1635 | if (ospf == NULL) | |
d62a17ae | 1636 | return CMD_SUCCESS; |
7c8ff89e | 1637 | |
d62a17ae | 1638 | return show_debugging_ospf_common(vty, ospf); |
7c8ff89e DS |
1639 | } |
1640 | ||
87f6dc50 DS |
1641 | DEFUN_NOSH (show_debugging_ospf_instance, |
1642 | show_debugging_ospf_instance_cmd, | |
1643 | "show debugging ospf (1-65535)", | |
1644 | SHOW_STR | |
1645 | DEBUG_STR | |
1646 | OSPF_STR | |
1647 | "Instance ID\n") | |
7c8ff89e | 1648 | { |
d62a17ae | 1649 | int idx_number = 3; |
1650 | struct ospf *ospf; | |
d7c0a89a | 1651 | unsigned short instance = 0; |
7c8ff89e | 1652 | |
d62a17ae | 1653 | instance = strtoul(argv[idx_number]->arg, NULL, 10); |
1654 | if ((ospf = ospf_lookup_instance(instance)) == NULL) | |
1655 | return CMD_SUCCESS; | |
7c8ff89e | 1656 | |
d62a17ae | 1657 | return show_debugging_ospf_common(vty, ospf); |
7c8ff89e DS |
1658 | } |
1659 | ||
718e3744 | 1660 | /* Debug node. */ |
d62a17ae | 1661 | static struct cmd_node debug_node = { |
1662 | DEBUG_NODE, "", 1 /* VTYSH */ | |
718e3744 | 1663 | }; |
1664 | ||
d62a17ae | 1665 | static int config_write_debug(struct vty *vty) |
718e3744 | 1666 | { |
d62a17ae | 1667 | int write = 0; |
1668 | int i, r; | |
1669 | ||
1670 | const char *type_str[] = {"hello", "dd", "ls-request", "ls-update", | |
1671 | "ls-ack"}; | |
1672 | const char *detail_str[] = { | |
1673 | "", " send", " recv", "", | |
1674 | " detail", " send detail", " recv detail", " detail"}; | |
1675 | ||
1676 | struct ospf *ospf; | |
1677 | char str[16]; | |
1678 | memset(str, 0, 16); | |
1679 | ||
b5a8894d CS |
1680 | ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); |
1681 | if (ospf == NULL) | |
d62a17ae | 1682 | return CMD_SUCCESS; |
1683 | ||
1684 | if (ospf->instance) | |
2ec42b85 | 1685 | sprintf(str, " %u", ospf->instance); |
d62a17ae | 1686 | |
1687 | /* debug ospf ism (status|events|timers). */ | |
1688 | if (IS_CONF_DEBUG_OSPF(ism, ISM) == OSPF_DEBUG_ISM) | |
1689 | vty_out(vty, "debug ospf%s ism\n", str); | |
1690 | else { | |
1691 | if (IS_CONF_DEBUG_OSPF(ism, ISM_STATUS)) | |
1692 | vty_out(vty, "debug ospf%s ism status\n", str); | |
1693 | if (IS_CONF_DEBUG_OSPF(ism, ISM_EVENTS)) | |
1694 | vty_out(vty, "debug ospf%s ism event\n", str); | |
1695 | if (IS_CONF_DEBUG_OSPF(ism, ISM_TIMERS)) | |
1696 | vty_out(vty, "debug ospf%s ism timer\n", str); | |
1697 | } | |
1698 | ||
1699 | /* debug ospf nsm (status|events|timers). */ | |
1700 | if (IS_CONF_DEBUG_OSPF(nsm, NSM) == OSPF_DEBUG_NSM) | |
1701 | vty_out(vty, "debug ospf%s nsm\n", str); | |
1702 | else { | |
1703 | if (IS_CONF_DEBUG_OSPF(nsm, NSM_STATUS)) | |
1704 | vty_out(vty, "debug ospf%s nsm status\n", str); | |
1705 | if (IS_CONF_DEBUG_OSPF(nsm, NSM_EVENTS)) | |
1706 | vty_out(vty, "debug ospf%s nsm event\n", str); | |
1707 | if (IS_CONF_DEBUG_OSPF(nsm, NSM_TIMERS)) | |
1708 | vty_out(vty, "debug ospf%s nsm timer\n", str); | |
1709 | } | |
1710 | ||
1711 | /* debug ospf lsa (generate|flooding|install|refresh). */ | |
1712 | if (IS_CONF_DEBUG_OSPF(lsa, LSA) == OSPF_DEBUG_LSA) | |
1713 | vty_out(vty, "debug ospf%s lsa\n", str); | |
1714 | else { | |
1715 | if (IS_CONF_DEBUG_OSPF(lsa, LSA_GENERATE)) | |
1716 | vty_out(vty, "debug ospf%s lsa generate\n", str); | |
1717 | if (IS_CONF_DEBUG_OSPF(lsa, LSA_FLOODING)) | |
1718 | vty_out(vty, "debug ospf%s lsa flooding\n", str); | |
1719 | if (IS_CONF_DEBUG_OSPF(lsa, LSA_INSTALL)) | |
1720 | vty_out(vty, "debug ospf%s lsa install\n", str); | |
1721 | if (IS_CONF_DEBUG_OSPF(lsa, LSA_REFRESH)) | |
1722 | vty_out(vty, "debug ospf%s lsa refresh\n", str); | |
1723 | ||
1724 | write = 1; | |
1725 | } | |
1726 | ||
1727 | /* debug ospf zebra (interface|redistribute). */ | |
1728 | if (IS_CONF_DEBUG_OSPF(zebra, ZEBRA) == OSPF_DEBUG_ZEBRA) | |
1729 | vty_out(vty, "debug ospf%s zebra\n", str); | |
1730 | else { | |
1731 | if (IS_CONF_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) | |
1732 | vty_out(vty, "debug ospf%s zebra interface\n", str); | |
1733 | if (IS_CONF_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) | |
1734 | vty_out(vty, "debug ospf%s zebra redistribute\n", str); | |
1735 | ||
1736 | write = 1; | |
1737 | } | |
1738 | ||
1739 | /* debug ospf event. */ | |
1740 | if (IS_CONF_DEBUG_OSPF(event, EVENT) == OSPF_DEBUG_EVENT) { | |
1741 | vty_out(vty, "debug ospf%s event\n", str); | |
1742 | write = 1; | |
1743 | } | |
1744 | ||
1745 | /* debug ospf nssa. */ | |
1746 | if (IS_CONF_DEBUG_OSPF(nssa, NSSA) == OSPF_DEBUG_NSSA) { | |
1747 | vty_out(vty, "debug ospf%s nssa\n", str); | |
1748 | write = 1; | |
1749 | } | |
1750 | ||
1751 | /* debug ospf packet all detail. */ | |
1752 | r = OSPF_DEBUG_SEND_RECV | OSPF_DEBUG_DETAIL; | |
1753 | for (i = 0; i < 5; i++) | |
1754 | r &= conf_debug_ospf_packet[i] | |
1755 | & (OSPF_DEBUG_SEND_RECV | OSPF_DEBUG_DETAIL); | |
1756 | if (r == (OSPF_DEBUG_SEND_RECV | OSPF_DEBUG_DETAIL)) { | |
1757 | vty_out(vty, "debug ospf%s packet all detail\n", str); | |
1758 | return 1; | |
1759 | } | |
1760 | ||
1761 | /* debug ospf packet all. */ | |
1762 | r = OSPF_DEBUG_SEND_RECV; | |
1763 | for (i = 0; i < 5; i++) | |
1764 | r &= conf_debug_ospf_packet[i] & OSPF_DEBUG_SEND_RECV; | |
1765 | if (r == OSPF_DEBUG_SEND_RECV) { | |
1766 | vty_out(vty, "debug ospf%s packet all\n", str); | |
1767 | for (i = 0; i < 5; i++) | |
1768 | if (conf_debug_ospf_packet[i] & OSPF_DEBUG_DETAIL) | |
1769 | vty_out(vty, "debug ospf%s packet %s detail\n", | |
1770 | str, type_str[i]); | |
1771 | return 1; | |
1772 | } | |
1773 | ||
1774 | /* debug ospf packet (hello|dd|ls-request|ls-update|ls-ack) | |
1775 | (send|recv) (detail). */ | |
1776 | for (i = 0; i < 5; i++) { | |
1777 | if (conf_debug_ospf_packet[i] == 0) | |
1778 | continue; | |
1779 | ||
1780 | vty_out(vty, "debug ospf%s packet %s%s\n", str, type_str[i], | |
1781 | detail_str[conf_debug_ospf_packet[i]]); | |
1782 | write = 1; | |
1783 | } | |
1784 | ||
7743f2f8 OD |
1785 | /* debug ospf te */ |
1786 | if (IS_CONF_DEBUG_OSPF(te, TE) == OSPF_DEBUG_TE) { | |
1787 | vty_out(vty, "debug ospf%s te\n", str); | |
1788 | write = 1; | |
1789 | } | |
1790 | ||
1791 | /* debug ospf sr */ | |
1792 | if (IS_CONF_DEBUG_OSPF(sr, SR) == OSPF_DEBUG_SR) { | |
1793 | vty_out(vty, "debug ospf%s sr\n", str); | |
1794 | write = 1; | |
1795 | } | |
1796 | ||
d62a17ae | 1797 | return write; |
718e3744 | 1798 | } |
1799 | ||
1800 | /* Initialize debug commands. */ | |
6243a7b5 | 1801 | void ospf_debug_init(void) |
718e3744 | 1802 | { |
d62a17ae | 1803 | install_node(&debug_node, config_write_debug); |
1804 | ||
1805 | install_element(ENABLE_NODE, &show_debugging_ospf_cmd); | |
1806 | install_element(ENABLE_NODE, &debug_ospf_ism_cmd); | |
1807 | install_element(ENABLE_NODE, &debug_ospf_nsm_cmd); | |
1808 | install_element(ENABLE_NODE, &debug_ospf_lsa_cmd); | |
1809 | install_element(ENABLE_NODE, &debug_ospf_zebra_cmd); | |
1810 | install_element(ENABLE_NODE, &debug_ospf_event_cmd); | |
1811 | install_element(ENABLE_NODE, &debug_ospf_nssa_cmd); | |
1812 | install_element(ENABLE_NODE, &debug_ospf_te_cmd); | |
cf9b9f77 | 1813 | install_element(ENABLE_NODE, &debug_ospf_sr_cmd); |
d62a17ae | 1814 | install_element(ENABLE_NODE, &no_debug_ospf_ism_cmd); |
1815 | install_element(ENABLE_NODE, &no_debug_ospf_nsm_cmd); | |
1816 | install_element(ENABLE_NODE, &no_debug_ospf_lsa_cmd); | |
1817 | install_element(ENABLE_NODE, &no_debug_ospf_zebra_cmd); | |
1818 | install_element(ENABLE_NODE, &no_debug_ospf_event_cmd); | |
1819 | install_element(ENABLE_NODE, &no_debug_ospf_nssa_cmd); | |
1820 | install_element(ENABLE_NODE, &no_debug_ospf_te_cmd); | |
cf9b9f77 | 1821 | install_element(ENABLE_NODE, &no_debug_ospf_sr_cmd); |
d62a17ae | 1822 | |
1823 | install_element(ENABLE_NODE, &show_debugging_ospf_instance_cmd); | |
1824 | install_element(ENABLE_NODE, &debug_ospf_packet_cmd); | |
1825 | install_element(ENABLE_NODE, &no_debug_ospf_packet_cmd); | |
1826 | ||
1827 | install_element(ENABLE_NODE, &debug_ospf_instance_nsm_cmd); | |
1828 | install_element(ENABLE_NODE, &debug_ospf_instance_lsa_cmd); | |
1829 | install_element(ENABLE_NODE, &debug_ospf_instance_zebra_cmd); | |
1830 | install_element(ENABLE_NODE, &debug_ospf_instance_event_cmd); | |
1831 | install_element(ENABLE_NODE, &debug_ospf_instance_nssa_cmd); | |
1832 | install_element(ENABLE_NODE, &no_debug_ospf_instance_nsm_cmd); | |
1833 | install_element(ENABLE_NODE, &no_debug_ospf_instance_lsa_cmd); | |
1834 | install_element(ENABLE_NODE, &no_debug_ospf_instance_zebra_cmd); | |
1835 | install_element(ENABLE_NODE, &no_debug_ospf_instance_event_cmd); | |
1836 | install_element(ENABLE_NODE, &no_debug_ospf_instance_nssa_cmd); | |
1837 | install_element(ENABLE_NODE, &no_debug_ospf_cmd); | |
1838 | ||
1839 | install_element(CONFIG_NODE, &debug_ospf_packet_cmd); | |
1840 | install_element(CONFIG_NODE, &no_debug_ospf_packet_cmd); | |
1841 | install_element(CONFIG_NODE, &debug_ospf_ism_cmd); | |
1842 | install_element(CONFIG_NODE, &no_debug_ospf_ism_cmd); | |
1843 | ||
1844 | install_element(CONFIG_NODE, &debug_ospf_nsm_cmd); | |
1845 | install_element(CONFIG_NODE, &debug_ospf_lsa_cmd); | |
1846 | install_element(CONFIG_NODE, &debug_ospf_zebra_cmd); | |
1847 | install_element(CONFIG_NODE, &debug_ospf_event_cmd); | |
1848 | install_element(CONFIG_NODE, &debug_ospf_nssa_cmd); | |
1849 | install_element(CONFIG_NODE, &debug_ospf_te_cmd); | |
cf9b9f77 | 1850 | install_element(CONFIG_NODE, &debug_ospf_sr_cmd); |
d62a17ae | 1851 | install_element(CONFIG_NODE, &no_debug_ospf_nsm_cmd); |
1852 | install_element(CONFIG_NODE, &no_debug_ospf_lsa_cmd); | |
1853 | install_element(CONFIG_NODE, &no_debug_ospf_zebra_cmd); | |
1854 | install_element(CONFIG_NODE, &no_debug_ospf_event_cmd); | |
1855 | install_element(CONFIG_NODE, &no_debug_ospf_nssa_cmd); | |
1856 | install_element(CONFIG_NODE, &no_debug_ospf_te_cmd); | |
cf9b9f77 | 1857 | install_element(CONFIG_NODE, &no_debug_ospf_sr_cmd); |
d62a17ae | 1858 | |
1859 | install_element(CONFIG_NODE, &debug_ospf_instance_nsm_cmd); | |
1860 | install_element(CONFIG_NODE, &debug_ospf_instance_lsa_cmd); | |
1861 | install_element(CONFIG_NODE, &debug_ospf_instance_zebra_cmd); | |
1862 | install_element(CONFIG_NODE, &debug_ospf_instance_event_cmd); | |
1863 | install_element(CONFIG_NODE, &debug_ospf_instance_nssa_cmd); | |
1864 | install_element(CONFIG_NODE, &no_debug_ospf_instance_nsm_cmd); | |
1865 | install_element(CONFIG_NODE, &no_debug_ospf_instance_lsa_cmd); | |
1866 | install_element(CONFIG_NODE, &no_debug_ospf_instance_zebra_cmd); | |
1867 | install_element(CONFIG_NODE, &no_debug_ospf_instance_event_cmd); | |
1868 | install_element(CONFIG_NODE, &no_debug_ospf_instance_nssa_cmd); | |
1869 | install_element(CONFIG_NODE, &no_debug_ospf_cmd); | |
718e3744 | 1870 | } |