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