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