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