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