]> git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_dump.c
Merge pull request #1921 from donaldsharp/pim_stuff
[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(unsigned 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 uint32_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 uint8_t 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 uint32_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, uint16_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 (unsigned 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(uint8_t 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(uint8_t 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, uint16_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", (uint8_t)rl->link[i].type);
297 zlog_debug(" TOS %d", (uint8_t)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, uint16_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, uint16_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, uint16_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, uint16_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, uint16_t length)
381 {
382 struct ospf_db_desc *dd;
383 char dd_flags[8];
384
385 uint32_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",
397 (unsigned long)ntohl(dd->dd_seqnum));
398
399 length -= OSPF_HEADER_SIZE + OSPF_DB_DESC_MIN_SIZE;
400
401 stream_forward_getp(s, OSPF_DB_DESC_MIN_SIZE);
402
403 ospf_lsa_header_list_dump(s, length);
404
405 stream_set_getp(s, gp);
406 }
407
408 static void ospf_packet_ls_req_dump(struct stream *s, uint16_t length)
409 {
410 uint32_t sp;
411 uint32_t ls_type;
412 struct in_addr ls_id;
413 struct in_addr adv_router;
414
415 sp = stream_get_getp(s);
416
417 length -= OSPF_HEADER_SIZE;
418
419 zlog_debug("Link State Request");
420 zlog_debug(" # Requests %d", length / 12);
421
422 for (; length > 0; length -= 12) {
423 ls_type = stream_getl(s);
424 ls_id.s_addr = stream_get_ipv4(s);
425 adv_router.s_addr = stream_get_ipv4(s);
426
427 zlog_debug(" LS type %d", ls_type);
428 zlog_debug(" Link State ID %s", inet_ntoa(ls_id));
429 zlog_debug(" Advertising Router %s", inet_ntoa(adv_router));
430 }
431
432 stream_set_getp(s, sp);
433 }
434
435 static void ospf_packet_ls_upd_dump(struct stream *s, uint16_t length)
436 {
437 uint32_t sp;
438 struct lsa_header *lsa;
439 int lsa_len;
440 uint32_t count;
441
442 length -= OSPF_HEADER_SIZE;
443
444 sp = stream_get_getp(s);
445
446 count = stream_getl(s);
447 length -= 4;
448
449 zlog_debug("Link State Update");
450 zlog_debug(" # LSAs %d", count);
451
452 while (length > 0 && count > 0) {
453 if (length < OSPF_HEADER_SIZE || length % 4 != 0) {
454 zlog_debug(" Remaining %d bytes; Incorrect length.",
455 length);
456 break;
457 }
458
459 lsa = (struct lsa_header *)stream_pnt(s);
460 lsa_len = ntohs(lsa->length);
461 ospf_lsa_header_dump(lsa);
462
463 switch (lsa->type) {
464 case OSPF_ROUTER_LSA:
465 ospf_router_lsa_dump(s, length);
466 break;
467 case OSPF_NETWORK_LSA:
468 ospf_network_lsa_dump(s, length);
469 break;
470 case OSPF_SUMMARY_LSA:
471 case OSPF_ASBR_SUMMARY_LSA:
472 ospf_summary_lsa_dump(s, length);
473 break;
474 case OSPF_AS_EXTERNAL_LSA:
475 ospf_as_external_lsa_dump(s, length);
476 break;
477 case OSPF_AS_NSSA_LSA:
478 ospf_as_external_lsa_dump(s, length);
479 break;
480 case OSPF_OPAQUE_LINK_LSA:
481 case OSPF_OPAQUE_AREA_LSA:
482 case OSPF_OPAQUE_AS_LSA:
483 ospf_opaque_lsa_dump(s, length);
484 break;
485 default:
486 break;
487 }
488
489 stream_forward_getp(s, lsa_len);
490 length -= lsa_len;
491 count--;
492 }
493
494 stream_set_getp(s, sp);
495 }
496
497 static void ospf_packet_ls_ack_dump(struct stream *s, uint16_t length)
498 {
499 uint32_t sp;
500
501 length -= OSPF_HEADER_SIZE;
502 sp = stream_get_getp(s);
503
504 zlog_debug("Link State Acknowledgment");
505 ospf_lsa_header_list_dump(s, length);
506
507 stream_set_getp(s, sp);
508 }
509
510 /* Expects header to be in host order */
511 void ospf_ip_header_dump(struct ip *iph)
512 {
513 /* IP Header dump. */
514 zlog_debug("ip_v %d", iph->ip_v);
515 zlog_debug("ip_hl %d", iph->ip_hl);
516 zlog_debug("ip_tos %d", iph->ip_tos);
517 zlog_debug("ip_len %d", iph->ip_len);
518 zlog_debug("ip_id %u", (uint32_t)iph->ip_id);
519 zlog_debug("ip_off %u", (uint32_t)iph->ip_off);
520 zlog_debug("ip_ttl %d", iph->ip_ttl);
521 zlog_debug("ip_p %d", iph->ip_p);
522 zlog_debug("ip_sum 0x%x", (uint32_t)iph->ip_sum);
523 zlog_debug("ip_src %s", inet_ntoa(iph->ip_src));
524 zlog_debug("ip_dst %s", inet_ntoa(iph->ip_dst));
525 }
526
527 static void ospf_header_dump(struct ospf_header *ospfh)
528 {
529 char buf[9];
530 uint16_t auth_type = ntohs(ospfh->auth_type);
531
532 zlog_debug("Header");
533 zlog_debug(" Version %d", ospfh->version);
534 zlog_debug(" Type %d (%s)", ospfh->type,
535 lookup_msg(ospf_packet_type_str, ospfh->type, NULL));
536 zlog_debug(" Packet Len %d", ntohs(ospfh->length));
537 zlog_debug(" Router ID %s", inet_ntoa(ospfh->router_id));
538 zlog_debug(" Area ID %s", inet_ntoa(ospfh->area_id));
539 zlog_debug(" Checksum 0x%x", ntohs(ospfh->checksum));
540 zlog_debug(" AuType %s",
541 lookup_msg(ospf_auth_type_str, auth_type, NULL));
542
543 switch (auth_type) {
544 case OSPF_AUTH_NULL:
545 break;
546 case OSPF_AUTH_SIMPLE:
547 memset(buf, 0, 9);
548 strncpy(buf, (char *)ospfh->u.auth_data, 8);
549 zlog_debug(" Simple Password %s", buf);
550 break;
551 case OSPF_AUTH_CRYPTOGRAPHIC:
552 zlog_debug(" Cryptographic Authentication");
553 zlog_debug(" Key ID %d", ospfh->u.crypt.key_id);
554 zlog_debug(" Auth Data Len %d", ospfh->u.crypt.auth_data_len);
555 zlog_debug(" Sequence number %ld",
556 (unsigned long)ntohl(ospfh->u.crypt.crypt_seqnum));
557 break;
558 default:
559 zlog_debug("* This is not supported authentication type");
560 break;
561 }
562 }
563
564 void ospf_packet_dump(struct stream *s)
565 {
566 struct ospf_header *ospfh;
567 unsigned long gp;
568
569 /* Preserve pointer. */
570 gp = stream_get_getp(s);
571
572 /* OSPF Header dump. */
573 ospfh = (struct ospf_header *)stream_pnt(s);
574
575 /* Until detail flag is set, return. */
576 if (!(term_debug_ospf_packet[ospfh->type - 1] & OSPF_DEBUG_DETAIL))
577 return;
578
579 /* Show OSPF header detail. */
580 ospf_header_dump(ospfh);
581 stream_forward_getp(s, OSPF_HEADER_SIZE);
582
583 switch (ospfh->type) {
584 case OSPF_MSG_HELLO:
585 ospf_packet_hello_dump(s, ntohs(ospfh->length));
586 break;
587 case OSPF_MSG_DB_DESC:
588 ospf_packet_db_desc_dump(s, ntohs(ospfh->length));
589 break;
590 case OSPF_MSG_LS_REQ:
591 ospf_packet_ls_req_dump(s, ntohs(ospfh->length));
592 break;
593 case OSPF_MSG_LS_UPD:
594 ospf_packet_ls_upd_dump(s, ntohs(ospfh->length));
595 break;
596 case OSPF_MSG_LS_ACK:
597 ospf_packet_ls_ack_dump(s, ntohs(ospfh->length));
598 break;
599 default:
600 break;
601 }
602
603 stream_set_getp(s, gp);
604 }
605
606 DEFUN (debug_ospf_packet,
607 debug_ospf_packet_cmd,
608 "debug ospf [(1-65535)] packet <hello|dd|ls-request|ls-update|ls-ack|all> [<send [detail]|recv [detail]|detail>]",
609 DEBUG_STR
610 OSPF_STR
611 "Instance ID\n"
612 "OSPF packets\n"
613 "OSPF Hello\n"
614 "OSPF Database Description\n"
615 "OSPF Link State Request\n"
616 "OSPF Link State Update\n"
617 "OSPF Link State Acknowledgment\n"
618 "OSPF all packets\n"
619 "Packet sent\n"
620 "Detail Information\n"
621 "Packet received\n"
622 "Detail Information\n"
623 "Detail Information\n")
624 {
625 int inst = (argv[2]->type == RANGE_TKN) ? 1 : 0;
626 int detail = strmatch(argv[argc - 1]->text, "detail");
627 int send = strmatch(argv[argc - (1 + detail)]->text, "send");
628 int recv = strmatch(argv[argc - (1 + detail)]->text, "recv");
629 char *packet = argv[3 + inst]->text;
630
631 if (inst) // user passed instance ID
632 {
633 if (!ospf_lookup_instance(strtoul(argv[2]->arg, NULL, 10)))
634 return CMD_NOT_MY_INSTANCE;
635 }
636
637 int type = 0;
638 int flag = 0;
639 int i;
640
641 /* Check packet type. */
642 if (strmatch(packet, "hello"))
643 type = OSPF_DEBUG_HELLO;
644 else if (strmatch(packet, "dd"))
645 type = OSPF_DEBUG_DB_DESC;
646 else if (strmatch(packet, "ls-request"))
647 type = OSPF_DEBUG_LS_REQ;
648 else if (strmatch(packet, "ls-update"))
649 type = OSPF_DEBUG_LS_UPD;
650 else if (strmatch(packet, "ls-ack"))
651 type = OSPF_DEBUG_LS_ACK;
652 else if (strmatch(packet, "all"))
653 type = OSPF_DEBUG_ALL;
654
655 /* Cases:
656 * (none) = send + recv
657 * detail = send + recv + detail
658 * recv = recv
659 * send = send
660 * recv detail = recv + detail
661 * send detail = send + detail
662 */
663 if (!send && !recv)
664 send = recv = 1;
665
666 flag |= (send) ? OSPF_DEBUG_SEND : 0;
667 flag |= (recv) ? OSPF_DEBUG_RECV : 0;
668 flag |= (detail) ? OSPF_DEBUG_DETAIL : 0;
669
670 for (i = 0; i < 5; i++)
671 if (type & (0x01 << i)) {
672 if (vty->node == CONFIG_NODE)
673 DEBUG_PACKET_ON(i, flag);
674 else
675 TERM_DEBUG_PACKET_ON(i, flag);
676 }
677
678 return CMD_SUCCESS;
679 }
680
681 DEFUN (no_debug_ospf_packet,
682 no_debug_ospf_packet_cmd,
683 "no debug ospf [(1-65535)] packet <hello|dd|ls-request|ls-update|ls-ack|all> [<send [detail]|recv [detail]|detail>]",
684 NO_STR
685 DEBUG_STR
686 OSPF_STR
687 "Instance ID\n"
688 "OSPF packets\n"
689 "OSPF Hello\n"
690 "OSPF Database Description\n"
691 "OSPF Link State Request\n"
692 "OSPF Link State Update\n"
693 "OSPF Link State Acknowledgment\n"
694 "OSPF all packets\n"
695 "Packet sent\n"
696 "Detail Information\n"
697 "Packet received\n"
698 "Detail Information\n"
699 "Detail Information\n")
700 {
701 int inst = (argv[3]->type == RANGE_TKN) ? 1 : 0;
702 int detail = strmatch(argv[argc - 1]->text, "detail");
703 int send = strmatch(argv[argc - (1 + detail)]->text, "send");
704 int recv = strmatch(argv[argc - (1 + detail)]->text, "recv");
705 char *packet = argv[4 + inst]->text;
706
707 if (inst) // user passed instance ID
708 {
709 if (!ospf_lookup_instance(strtoul(argv[3]->arg, NULL, 10)))
710 return CMD_NOT_MY_INSTANCE;
711 }
712
713 int type = 0;
714 int flag = 0;
715 int i;
716
717 /* Check packet type. */
718 if (strmatch(packet, "hello"))
719 type = OSPF_DEBUG_HELLO;
720 else if (strmatch(packet, "dd"))
721 type = OSPF_DEBUG_DB_DESC;
722 else if (strmatch(packet, "ls-request"))
723 type = OSPF_DEBUG_LS_REQ;
724 else if (strmatch(packet, "ls-update"))
725 type = OSPF_DEBUG_LS_UPD;
726 else if (strmatch(packet, "ls-ack"))
727 type = OSPF_DEBUG_LS_ACK;
728 else if (strmatch(packet, "all"))
729 type = OSPF_DEBUG_ALL;
730
731 /* Cases:
732 * (none) = send + recv
733 * detail = send + recv + detail
734 * recv = recv
735 * send = send
736 * recv detail = recv + detail
737 * send detail = send + detail
738 */
739 if (!send && !recv)
740 send = recv = 1;
741
742 flag |= (send) ? OSPF_DEBUG_SEND : 0;
743 flag |= (recv) ? OSPF_DEBUG_RECV : 0;
744 flag |= (detail) ? OSPF_DEBUG_DETAIL : 0;
745
746 for (i = 0; i < 5; i++)
747 if (type & (0x01 << i)) {
748 if (vty->node == CONFIG_NODE)
749 DEBUG_PACKET_OFF(i, flag);
750 else
751 TERM_DEBUG_PACKET_OFF(i, flag);
752 }
753
754 #ifdef DEBUG
755 /*
756 for (i = 0; i < 5; i++)
757 zlog_debug ("flag[%d] = %d", i, ospf_debug_packet[i]);
758 */
759 #endif /* DEBUG */
760
761 return CMD_SUCCESS;
762 }
763
764 DEFUN (debug_ospf_ism,
765 debug_ospf_ism_cmd,
766 "debug ospf [(1-65535)] ism [<status|events|timers>]",
767 DEBUG_STR
768 OSPF_STR
769 "Instance ID\n"
770 "OSPF Interface State Machine\n"
771 "ISM Status Information\n"
772 "ISM Event Information\n"
773 "ISM TImer Information\n")
774 {
775 int inst = (argv[2]->type == RANGE_TKN);
776 char *dbgparam = (argc == 4 + inst) ? argv[argc - 1]->text : NULL;
777
778 if (inst) // user passed instance ID
779 {
780 if (!ospf_lookup_instance(strtoul(argv[2]->arg, NULL, 10)))
781 return CMD_NOT_MY_INSTANCE;
782 }
783
784 if (vty->node == CONFIG_NODE) {
785 if (!dbgparam)
786 DEBUG_ON(ism, ISM);
787 else {
788 if (strmatch(dbgparam, "status"))
789 DEBUG_ON(ism, ISM_STATUS);
790 else if (strmatch(dbgparam, "events"))
791 DEBUG_ON(ism, ISM_EVENTS);
792 else if (strmatch(dbgparam, "timers"))
793 DEBUG_ON(ism, ISM_TIMERS);
794 }
795
796 return CMD_SUCCESS;
797 }
798
799 /* ENABLE_NODE. */
800 if (!dbgparam)
801 TERM_DEBUG_ON(ism, ISM);
802 else {
803 if (strmatch(dbgparam, "status"))
804 TERM_DEBUG_ON(ism, ISM_STATUS);
805 else if (strmatch(dbgparam, "events"))
806 TERM_DEBUG_ON(ism, ISM_EVENTS);
807 else if (strmatch(dbgparam, "timers"))
808 TERM_DEBUG_ON(ism, ISM_TIMERS);
809 }
810
811 return CMD_SUCCESS;
812 }
813
814 DEFUN (no_debug_ospf_ism,
815 no_debug_ospf_ism_cmd,
816 "no debug ospf [(1-65535)] ism [<status|events|timers>]",
817 NO_STR
818 DEBUG_STR
819 OSPF_STR
820 "Instance ID\n"
821 "OSPF Interface State Machine\n"
822 "ISM Status Information\n"
823 "ISM Event Information\n"
824 "ISM TImer Information\n")
825 {
826 int inst = (argv[3]->type == RANGE_TKN);
827 char *dbgparam = (argc == 5 + inst) ? argv[argc - 1]->text : NULL;
828
829 if (inst) // user passed instance ID
830 {
831 if (!ospf_lookup_instance(strtoul(argv[3]->arg, NULL, 10)))
832 return CMD_NOT_MY_INSTANCE;
833 }
834
835 if (vty->node == CONFIG_NODE) {
836 if (!dbgparam)
837 DEBUG_OFF(ism, ISM);
838 else {
839 if (strmatch(dbgparam, "status"))
840 DEBUG_OFF(ism, ISM_STATUS);
841 else if (strmatch(dbgparam, "events"))
842 DEBUG_OFF(ism, ISM_EVENTS);
843 else if (strmatch(dbgparam, "timers"))
844 DEBUG_OFF(ism, ISM_TIMERS);
845 }
846
847 return CMD_SUCCESS;
848 }
849
850 /* ENABLE_NODE. */
851 if (!dbgparam)
852 TERM_DEBUG_OFF(ism, ISM);
853 else {
854 if (strmatch(dbgparam, "status"))
855 TERM_DEBUG_OFF(ism, ISM_STATUS);
856 else if (strmatch(dbgparam, "events"))
857 TERM_DEBUG_OFF(ism, ISM_EVENTS);
858 else if (strmatch(dbgparam, "timers"))
859 TERM_DEBUG_OFF(ism, ISM_TIMERS);
860 }
861
862 return CMD_SUCCESS;
863 }
864
865 static int debug_ospf_nsm_common(struct vty *vty, int arg_base, int argc,
866 struct cmd_token **argv)
867 {
868 if (vty->node == CONFIG_NODE) {
869 if (argc == arg_base + 0)
870 DEBUG_ON(nsm, NSM);
871 else if (argc == arg_base + 1) {
872 if (strmatch(argv[arg_base]->text, "status"))
873 DEBUG_ON(nsm, NSM_STATUS);
874 else if (strmatch(argv[arg_base]->text, "events"))
875 DEBUG_ON(nsm, NSM_EVENTS);
876 else if (strmatch(argv[arg_base]->text, "timers"))
877 DEBUG_ON(nsm, NSM_TIMERS);
878 }
879
880 return CMD_SUCCESS;
881 }
882
883 /* ENABLE_NODE. */
884 if (argc == arg_base + 0)
885 TERM_DEBUG_ON(nsm, NSM);
886 else if (argc == arg_base + 1) {
887 if (strmatch(argv[arg_base]->text, "status"))
888 TERM_DEBUG_ON(nsm, NSM_STATUS);
889 else if (strmatch(argv[arg_base]->text, "events"))
890 TERM_DEBUG_ON(nsm, NSM_EVENTS);
891 else if (strmatch(argv[arg_base]->text, "timers"))
892 TERM_DEBUG_ON(nsm, NSM_TIMERS);
893 }
894
895 return CMD_SUCCESS;
896 }
897
898 DEFUN (debug_ospf_nsm,
899 debug_ospf_nsm_cmd,
900 "debug ospf nsm [<status|events|timers>]",
901 DEBUG_STR
902 OSPF_STR
903 "OSPF Neighbor State Machine\n"
904 "NSM Status Information\n"
905 "NSM Event Information\n"
906 "NSM Timer Information\n")
907 {
908 return debug_ospf_nsm_common(vty, 3, argc, argv);
909 }
910
911 DEFUN (debug_ospf_instance_nsm,
912 debug_ospf_instance_nsm_cmd,
913 "debug ospf (1-65535) nsm [<status|events|timers>]",
914 DEBUG_STR
915 OSPF_STR
916 "Instance ID\n"
917 "OSPF Neighbor State Machine\n"
918 "NSM Status Information\n"
919 "NSM Event Information\n"
920 "NSM Timer Information\n")
921 {
922 int idx_number = 2;
923 unsigned short instance = 0;
924
925 instance = strtoul(argv[idx_number]->arg, NULL, 10);
926 if (!ospf_lookup_instance(instance))
927 return CMD_SUCCESS;
928
929 return debug_ospf_nsm_common(vty, 4, argc, argv);
930 }
931
932
933 static int no_debug_ospf_nsm_common(struct vty *vty, int arg_base, int argc,
934 struct cmd_token **argv)
935 {
936 /* XXX qlyoung */
937 if (vty->node == CONFIG_NODE) {
938 if (argc == arg_base + 0)
939 DEBUG_OFF(nsm, NSM);
940 else if (argc == arg_base + 1) {
941 if (strmatch(argv[arg_base]->text, "status"))
942 DEBUG_OFF(nsm, NSM_STATUS);
943 else if (strmatch(argv[arg_base]->text, "events"))
944 DEBUG_OFF(nsm, NSM_EVENTS);
945 else if (strmatch(argv[arg_base]->text, "timers"))
946 DEBUG_OFF(nsm, NSM_TIMERS);
947 }
948
949 return CMD_SUCCESS;
950 }
951
952 /* ENABLE_NODE. */
953 if (argc == arg_base + 0)
954 TERM_DEBUG_OFF(nsm, NSM);
955 else if (argc == arg_base + 1) {
956 if (strmatch(argv[arg_base]->text, "status"))
957 TERM_DEBUG_OFF(nsm, NSM_STATUS);
958 else if (strmatch(argv[arg_base]->text, "events"))
959 TERM_DEBUG_OFF(nsm, NSM_EVENTS);
960 else if (strmatch(argv[arg_base]->text, "timers"))
961 TERM_DEBUG_OFF(nsm, NSM_TIMERS);
962 }
963
964 return CMD_SUCCESS;
965 }
966
967 DEFUN (no_debug_ospf_nsm,
968 no_debug_ospf_nsm_cmd,
969 "no debug ospf nsm [<status|events|timers>]",
970 NO_STR
971 DEBUG_STR
972 OSPF_STR
973 "OSPF Neighbor State Machine\n"
974 "NSM Status Information\n"
975 "NSM Event Information\n"
976 "NSM Timer Information\n")
977 {
978 return no_debug_ospf_nsm_common(vty, 4, argc, argv);
979 }
980
981
982 DEFUN (no_debug_ospf_instance_nsm,
983 no_debug_ospf_instance_nsm_cmd,
984 "no debug ospf (1-65535) nsm [<status|events|timers>]",
985 NO_STR
986 DEBUG_STR
987 OSPF_STR
988 "Instance ID\n"
989 "OSPF Neighbor State Machine\n"
990 "NSM Status Information\n"
991 "NSM Event Information\n"
992 "NSM Timer Information\n")
993 {
994 int idx_number = 3;
995 unsigned short instance = 0;
996
997 instance = strtoul(argv[idx_number]->arg, NULL, 10);
998 if (!ospf_lookup_instance(instance))
999 return CMD_NOT_MY_INSTANCE;
1000
1001 return no_debug_ospf_nsm_common(vty, 5, argc, argv);
1002 }
1003
1004
1005 static int debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc,
1006 struct cmd_token **argv)
1007 {
1008 if (vty->node == CONFIG_NODE) {
1009 if (argc == arg_base + 0)
1010 DEBUG_ON(lsa, LSA);
1011 else if (argc == arg_base + 1) {
1012 if (strmatch(argv[arg_base]->text, "generate"))
1013 DEBUG_ON(lsa, LSA_GENERATE);
1014 else if (strmatch(argv[arg_base]->text, "flooding"))
1015 DEBUG_ON(lsa, LSA_FLOODING);
1016 else if (strmatch(argv[arg_base]->text, "install"))
1017 DEBUG_ON(lsa, LSA_INSTALL);
1018 else if (strmatch(argv[arg_base]->text, "refresh"))
1019 DEBUG_ON(lsa, LSA_REFRESH);
1020 }
1021
1022 return CMD_SUCCESS;
1023 }
1024
1025 /* ENABLE_NODE. */
1026 if (argc == arg_base + 0)
1027 TERM_DEBUG_ON(lsa, LSA);
1028 else if (argc == arg_base + 1) {
1029 if (strmatch(argv[arg_base]->text, "generate"))
1030 TERM_DEBUG_ON(lsa, LSA_GENERATE);
1031 else if (strmatch(argv[arg_base]->text, "flooding"))
1032 TERM_DEBUG_ON(lsa, LSA_FLOODING);
1033 else if (strmatch(argv[arg_base]->text, "install"))
1034 TERM_DEBUG_ON(lsa, LSA_INSTALL);
1035 else if (strmatch(argv[arg_base]->text, "refresh"))
1036 TERM_DEBUG_ON(lsa, LSA_REFRESH);
1037 }
1038
1039 return CMD_SUCCESS;
1040 }
1041
1042 DEFUN (debug_ospf_lsa,
1043 debug_ospf_lsa_cmd,
1044 "debug ospf lsa [<generate|flooding|install|refresh>]",
1045 DEBUG_STR
1046 OSPF_STR
1047 "OSPF Link State Advertisement\n"
1048 "LSA Generation\n"
1049 "LSA Flooding\n"
1050 "LSA Install/Delete\n"
1051 "LSA Refresh\n")
1052 {
1053 return debug_ospf_lsa_common(vty, 3, argc, argv);
1054 }
1055
1056 DEFUN (debug_ospf_instance_lsa,
1057 debug_ospf_instance_lsa_cmd,
1058 "debug ospf (1-65535) lsa [<generate|flooding|install|refresh>]",
1059 DEBUG_STR
1060 OSPF_STR
1061 "Instance ID\n"
1062 "OSPF Link State Advertisement\n"
1063 "LSA Generation\n"
1064 "LSA Flooding\n"
1065 "LSA Install/Delete\n"
1066 "LSA Refresh\n")
1067 {
1068 int idx_number = 2;
1069 unsigned short instance = 0;
1070
1071 instance = strtoul(argv[idx_number]->arg, NULL, 10);
1072 if (!ospf_lookup_instance(instance))
1073 return CMD_NOT_MY_INSTANCE;
1074
1075 return debug_ospf_lsa_common(vty, 4, argc, argv);
1076 }
1077
1078
1079 static int no_debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc,
1080 struct cmd_token **argv)
1081 {
1082 if (vty->node == CONFIG_NODE) {
1083 if (argc == arg_base + 0)
1084 DEBUG_OFF(lsa, LSA);
1085 else if (argc == arg_base + 1) {
1086 if (strmatch(argv[arg_base]->text, "generate"))
1087 DEBUG_OFF(lsa, LSA_GENERATE);
1088 else if (strmatch(argv[arg_base]->text, "flooding"))
1089 DEBUG_OFF(lsa, LSA_FLOODING);
1090 else if (strmatch(argv[arg_base]->text, "install"))
1091 DEBUG_OFF(lsa, LSA_INSTALL);
1092 else if (strmatch(argv[arg_base]->text, "refresh"))
1093 DEBUG_OFF(lsa, LSA_REFRESH);
1094 }
1095
1096 return CMD_SUCCESS;
1097 }
1098
1099 /* ENABLE_NODE. */
1100 if (argc == arg_base + 0)
1101 TERM_DEBUG_OFF(lsa, LSA);
1102 else if (argc == arg_base + 1) {
1103 if (strmatch(argv[arg_base]->text, "generate"))
1104 TERM_DEBUG_OFF(lsa, LSA_GENERATE);
1105 else if (strmatch(argv[arg_base]->text, "flooding"))
1106 TERM_DEBUG_OFF(lsa, LSA_FLOODING);
1107 else if (strmatch(argv[arg_base]->text, "install"))
1108 TERM_DEBUG_OFF(lsa, LSA_INSTALL);
1109 else if (strmatch(argv[arg_base]->text, "refresh"))
1110 TERM_DEBUG_OFF(lsa, LSA_REFRESH);
1111 }
1112
1113 return CMD_SUCCESS;
1114 }
1115
1116 DEFUN (no_debug_ospf_lsa,
1117 no_debug_ospf_lsa_cmd,
1118 "no debug ospf lsa [<generate|flooding|install|refresh>]",
1119 NO_STR
1120 DEBUG_STR
1121 OSPF_STR
1122 "OSPF Link State Advertisement\n"
1123 "LSA Generation\n"
1124 "LSA Flooding\n"
1125 "LSA Install/Delete\n"
1126 "LSA Refres\n")
1127 {
1128 return no_debug_ospf_lsa_common(vty, 4, argc, argv);
1129 }
1130
1131 DEFUN (no_debug_ospf_instance_lsa,
1132 no_debug_ospf_instance_lsa_cmd,
1133 "no debug ospf (1-65535) lsa [<generate|flooding|install|refresh>]",
1134 NO_STR
1135 DEBUG_STR
1136 OSPF_STR
1137 "Instance ID\n"
1138 "OSPF Link State Advertisement\n"
1139 "LSA Generation\n"
1140 "LSA Flooding\n"
1141 "LSA Install/Delete\n"
1142 "LSA Refres\n")
1143 {
1144 int idx_number = 3;
1145 unsigned short instance = 0;
1146
1147 instance = strtoul(argv[idx_number]->arg, NULL, 10);
1148 if (!ospf_lookup_instance(instance))
1149 return CMD_NOT_MY_INSTANCE;
1150
1151 return no_debug_ospf_lsa_common(vty, 5, argc, argv);
1152 }
1153
1154
1155 static int debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc,
1156 struct cmd_token **argv)
1157 {
1158 if (vty->node == CONFIG_NODE) {
1159 if (argc == arg_base + 0)
1160 DEBUG_ON(zebra, ZEBRA);
1161 else if (argc == arg_base + 1) {
1162 if (strmatch(argv[arg_base]->text, "interface"))
1163 DEBUG_ON(zebra, ZEBRA_INTERFACE);
1164 else if (strmatch(argv[arg_base]->text, "redistribute"))
1165 DEBUG_ON(zebra, ZEBRA_REDISTRIBUTE);
1166 }
1167
1168 return CMD_SUCCESS;
1169 }
1170
1171 /* ENABLE_NODE. */
1172 if (argc == arg_base + 0)
1173 TERM_DEBUG_ON(zebra, ZEBRA);
1174 else if (argc == arg_base + 1) {
1175 if (strmatch(argv[arg_base]->text, "interface"))
1176 TERM_DEBUG_ON(zebra, ZEBRA_INTERFACE);
1177 else if (strmatch(argv[arg_base]->text, "redistribute"))
1178 TERM_DEBUG_ON(zebra, ZEBRA_REDISTRIBUTE);
1179 }
1180
1181 return CMD_SUCCESS;
1182 }
1183
1184 DEFUN (debug_ospf_zebra,
1185 debug_ospf_zebra_cmd,
1186 "debug ospf zebra [<interface|redistribute>]",
1187 DEBUG_STR
1188 OSPF_STR
1189 ZEBRA_STR
1190 "Zebra interface\n"
1191 "Zebra redistribute\n")
1192 {
1193 return debug_ospf_zebra_common(vty, 3, argc, argv);
1194 }
1195
1196 DEFUN (debug_ospf_instance_zebra,
1197 debug_ospf_instance_zebra_cmd,
1198 "debug ospf (1-65535) zebra [<interface|redistribute>]",
1199 DEBUG_STR
1200 OSPF_STR
1201 "Instance ID\n"
1202 ZEBRA_STR
1203 "Zebra interface\n"
1204 "Zebra redistribute\n")
1205 {
1206 int idx_number = 2;
1207 unsigned short instance = 0;
1208
1209 instance = strtoul(argv[idx_number]->arg, NULL, 10);
1210 if (!ospf_lookup_instance(instance))
1211 return CMD_NOT_MY_INSTANCE;
1212
1213 return debug_ospf_zebra_common(vty, 4, argc, argv);
1214 }
1215
1216
1217 static int no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc,
1218 struct cmd_token **argv)
1219 {
1220 if (vty->node == CONFIG_NODE) {
1221 if (argc == arg_base + 0)
1222 DEBUG_OFF(zebra, ZEBRA);
1223 else if (argc == arg_base + 1) {
1224 if (strmatch(argv[arg_base]->text, "interface"))
1225 DEBUG_OFF(zebra, ZEBRA_INTERFACE);
1226 else if (strmatch(argv[arg_base]->text, "redistribute"))
1227 DEBUG_OFF(zebra, ZEBRA_REDISTRIBUTE);
1228 }
1229
1230 return CMD_SUCCESS;
1231 }
1232
1233 /* ENABLE_NODE. */
1234 if (argc == arg_base + 0)
1235 TERM_DEBUG_OFF(zebra, ZEBRA);
1236 else if (argc == arg_base + 1) {
1237 if (strmatch(argv[arg_base]->text, "interface"))
1238 TERM_DEBUG_OFF(zebra, ZEBRA_INTERFACE);
1239 else if (strmatch(argv[arg_base]->text, "redistribute"))
1240 TERM_DEBUG_OFF(zebra, ZEBRA_REDISTRIBUTE);
1241 }
1242
1243 return CMD_SUCCESS;
1244 }
1245
1246 DEFUN (no_debug_ospf_zebra,
1247 no_debug_ospf_zebra_cmd,
1248 "no debug ospf zebra [<interface|redistribute>]",
1249 NO_STR
1250 DEBUG_STR
1251 OSPF_STR
1252 ZEBRA_STR
1253 "Zebra interface\n"
1254 "Zebra redistribute\n")
1255 {
1256 return no_debug_ospf_zebra_common(vty, 4, argc, argv);
1257 }
1258
1259 DEFUN (no_debug_ospf_instance_zebra,
1260 no_debug_ospf_instance_zebra_cmd,
1261 "no debug ospf (1-65535) zebra [<interface|redistribute>]",
1262 NO_STR
1263 DEBUG_STR
1264 OSPF_STR
1265 "Instance ID\n"
1266 ZEBRA_STR
1267 "Zebra interface\n"
1268 "Zebra redistribute\n")
1269 {
1270 int idx_number = 3;
1271 unsigned short instance = 0;
1272
1273 instance = strtoul(argv[idx_number]->arg, NULL, 10);
1274 if (!ospf_lookup_instance(instance))
1275 return CMD_SUCCESS;
1276
1277 return no_debug_ospf_zebra_common(vty, 5, argc, argv);
1278 }
1279
1280
1281 DEFUN (debug_ospf_event,
1282 debug_ospf_event_cmd,
1283 "debug ospf event",
1284 DEBUG_STR
1285 OSPF_STR
1286 "OSPF event information\n")
1287 {
1288 if (vty->node == CONFIG_NODE)
1289 CONF_DEBUG_ON(event, EVENT);
1290 TERM_DEBUG_ON(event, EVENT);
1291 return CMD_SUCCESS;
1292 }
1293
1294 DEFUN (no_debug_ospf_event,
1295 no_debug_ospf_event_cmd,
1296 "no debug ospf event",
1297 NO_STR
1298 DEBUG_STR
1299 OSPF_STR
1300 "OSPF event information\n")
1301 {
1302 if (vty->node == CONFIG_NODE)
1303 CONF_DEBUG_OFF(event, EVENT);
1304 TERM_DEBUG_OFF(event, EVENT);
1305 return CMD_SUCCESS;
1306 }
1307
1308 DEFUN (debug_ospf_instance_event,
1309 debug_ospf_instance_event_cmd,
1310 "debug ospf (1-65535) event",
1311 DEBUG_STR
1312 OSPF_STR
1313 "Instance ID\n"
1314 "OSPF event information\n")
1315 {
1316 int idx_number = 2;
1317 unsigned short instance = 0;
1318
1319 instance = strtoul(argv[idx_number]->arg, NULL, 10);
1320 if (!ospf_lookup_instance(instance))
1321 return CMD_SUCCESS;
1322
1323 if (vty->node == CONFIG_NODE)
1324 CONF_DEBUG_ON(event, EVENT);
1325 TERM_DEBUG_ON(event, EVENT);
1326 return CMD_SUCCESS;
1327 }
1328
1329 DEFUN (no_debug_ospf_instance_event,
1330 no_debug_ospf_instance_event_cmd,
1331 "no debug ospf (1-65535) event",
1332 NO_STR
1333 DEBUG_STR
1334 OSPF_STR
1335 "Instance ID\n"
1336 "OSPF event information\n")
1337 {
1338 int idx_number = 3;
1339 unsigned short instance = 0;
1340
1341 instance = strtoul(argv[idx_number]->arg, NULL, 10);
1342 if (!ospf_lookup_instance(instance))
1343 return CMD_SUCCESS;
1344
1345 if (vty->node == CONFIG_NODE)
1346 CONF_DEBUG_OFF(event, EVENT);
1347 TERM_DEBUG_OFF(event, EVENT);
1348 return CMD_SUCCESS;
1349 }
1350
1351 DEFUN (debug_ospf_nssa,
1352 debug_ospf_nssa_cmd,
1353 "debug ospf nssa",
1354 DEBUG_STR
1355 OSPF_STR
1356 "OSPF nssa information\n")
1357 {
1358 if (vty->node == CONFIG_NODE)
1359 CONF_DEBUG_ON(nssa, NSSA);
1360 TERM_DEBUG_ON(nssa, NSSA);
1361 return CMD_SUCCESS;
1362 }
1363
1364 DEFUN (no_debug_ospf_nssa,
1365 no_debug_ospf_nssa_cmd,
1366 "no debug ospf nssa",
1367 NO_STR
1368 DEBUG_STR
1369 OSPF_STR
1370 "OSPF nssa information\n")
1371 {
1372 if (vty->node == CONFIG_NODE)
1373 CONF_DEBUG_OFF(nssa, NSSA);
1374 TERM_DEBUG_OFF(nssa, NSSA);
1375 return CMD_SUCCESS;
1376 }
1377
1378 DEFUN (debug_ospf_instance_nssa,
1379 debug_ospf_instance_nssa_cmd,
1380 "debug ospf (1-65535) nssa",
1381 DEBUG_STR
1382 OSPF_STR
1383 "Instance ID\n"
1384 "OSPF nssa information\n")
1385 {
1386 int idx_number = 2;
1387 unsigned short instance = 0;
1388
1389 instance = strtoul(argv[idx_number]->arg, NULL, 10);
1390 if (!ospf_lookup_instance(instance))
1391 return CMD_SUCCESS;
1392
1393 if (vty->node == CONFIG_NODE)
1394 CONF_DEBUG_ON(nssa, NSSA);
1395 TERM_DEBUG_ON(nssa, NSSA);
1396 return CMD_SUCCESS;
1397 }
1398
1399 DEFUN (no_debug_ospf_instance_nssa,
1400 no_debug_ospf_instance_nssa_cmd,
1401 "no debug ospf (1-65535) nssa",
1402 NO_STR
1403 DEBUG_STR
1404 OSPF_STR
1405 "Instance ID\n"
1406 "OSPF nssa information\n")
1407 {
1408 int idx_number = 3;
1409 unsigned short instance = 0;
1410
1411 instance = strtoul(argv[idx_number]->arg, NULL, 10);
1412 if (!ospf_lookup_instance(instance))
1413 return CMD_SUCCESS;
1414
1415 if (vty->node == CONFIG_NODE)
1416 CONF_DEBUG_OFF(nssa, NSSA);
1417 TERM_DEBUG_OFF(nssa, NSSA);
1418 return CMD_SUCCESS;
1419 }
1420
1421 DEFUN (debug_ospf_te,
1422 debug_ospf_te_cmd,
1423 "debug ospf te",
1424 DEBUG_STR
1425 OSPF_STR
1426 "OSPF-TE information\n")
1427 {
1428 if (vty->node == CONFIG_NODE)
1429 CONF_DEBUG_ON(te, TE);
1430 TERM_DEBUG_ON(te, TE);
1431 return CMD_SUCCESS;
1432 }
1433
1434 DEFUN (no_debug_ospf_te,
1435 no_debug_ospf_te_cmd,
1436 "no debug ospf te",
1437 NO_STR
1438 DEBUG_STR
1439 OSPF_STR
1440 "OSPF-TE information\n")
1441 {
1442 if (vty->node == CONFIG_NODE)
1443 CONF_DEBUG_OFF(te, TE);
1444 TERM_DEBUG_OFF(te, TE);
1445 return CMD_SUCCESS;
1446 }
1447
1448 DEFUN (debug_ospf_sr,
1449 debug_ospf_sr_cmd,
1450 "debug ospf sr",
1451 DEBUG_STR
1452 OSPF_STR
1453 "OSPF-SR information\n")
1454 {
1455 if (vty->node == CONFIG_NODE)
1456 CONF_DEBUG_ON(sr, SR);
1457 TERM_DEBUG_ON(sr, SR);
1458 return CMD_SUCCESS;
1459 }
1460
1461 DEFUN (no_debug_ospf_sr,
1462 no_debug_ospf_sr_cmd,
1463 "no debug ospf sr",
1464 NO_STR
1465 DEBUG_STR
1466 OSPF_STR
1467 "OSPF-SR information\n")
1468 {
1469 if (vty->node == CONFIG_NODE)
1470 CONF_DEBUG_OFF(sr, SR);
1471 TERM_DEBUG_OFF(sr, SR);
1472 return CMD_SUCCESS;
1473 }
1474
1475 DEFUN (no_debug_ospf,
1476 no_debug_ospf_cmd,
1477 "no debug ospf",
1478 NO_STR
1479 DEBUG_STR
1480 OSPF_STR)
1481 {
1482 int flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
1483 int i;
1484
1485 if (vty->node == CONFIG_NODE) {
1486 CONF_DEBUG_OFF(event, EVENT);
1487 CONF_DEBUG_OFF(nssa, NSSA);
1488 DEBUG_OFF(ism, ISM_EVENTS);
1489 DEBUG_OFF(ism, ISM_STATUS);
1490 DEBUG_OFF(ism, ISM_TIMERS);
1491 DEBUG_OFF(lsa, LSA);
1492 DEBUG_OFF(lsa, LSA_FLOODING);
1493 DEBUG_OFF(lsa, LSA_GENERATE);
1494 DEBUG_OFF(lsa, LSA_INSTALL);
1495 DEBUG_OFF(lsa, LSA_REFRESH);
1496 DEBUG_OFF(nsm, NSM);
1497 DEBUG_OFF(nsm, NSM_EVENTS);
1498 DEBUG_OFF(nsm, NSM_STATUS);
1499 DEBUG_OFF(nsm, NSM_TIMERS);
1500 DEBUG_OFF(zebra, ZEBRA);
1501 DEBUG_OFF(zebra, ZEBRA_INTERFACE);
1502 DEBUG_OFF(zebra, ZEBRA_REDISTRIBUTE);
1503
1504 for (i = 0; i < 5; i++)
1505 DEBUG_PACKET_OFF(i, flag);
1506 }
1507
1508 for (i = 0; i < 5; i++)
1509 TERM_DEBUG_PACKET_OFF(i, flag);
1510
1511 TERM_DEBUG_OFF(event, EVENT);
1512 TERM_DEBUG_OFF(ism, ISM);
1513 TERM_DEBUG_OFF(ism, ISM_EVENTS);
1514 TERM_DEBUG_OFF(ism, ISM_STATUS);
1515 TERM_DEBUG_OFF(ism, ISM_TIMERS);
1516 TERM_DEBUG_OFF(lsa, LSA);
1517 TERM_DEBUG_OFF(lsa, LSA_FLOODING);
1518 TERM_DEBUG_OFF(lsa, LSA_GENERATE);
1519 TERM_DEBUG_OFF(lsa, LSA_INSTALL);
1520 TERM_DEBUG_OFF(lsa, LSA_REFRESH);
1521 TERM_DEBUG_OFF(nsm, NSM);
1522 TERM_DEBUG_OFF(nsm, NSM_EVENTS);
1523 TERM_DEBUG_OFF(nsm, NSM_STATUS);
1524 TERM_DEBUG_OFF(nsm, NSM_TIMERS);
1525 TERM_DEBUG_OFF(nssa, NSSA);
1526 TERM_DEBUG_OFF(zebra, ZEBRA);
1527 TERM_DEBUG_OFF(zebra, ZEBRA_INTERFACE);
1528 TERM_DEBUG_OFF(zebra, ZEBRA_REDISTRIBUTE);
1529
1530 return CMD_SUCCESS;
1531 }
1532
1533 static int show_debugging_ospf_common(struct vty *vty, struct ospf *ospf)
1534 {
1535 int i;
1536
1537 if (ospf->instance)
1538 vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
1539
1540 vty_out(vty, "OSPF debugging status:\n");
1541
1542 /* Show debug status for events. */
1543 if (IS_DEBUG_OSPF(event, EVENT))
1544 vty_out(vty, " OSPF event debugging is on\n");
1545
1546 /* Show debug status for ISM. */
1547 if (IS_DEBUG_OSPF(ism, ISM) == OSPF_DEBUG_ISM)
1548 vty_out(vty, " OSPF ISM debugging is on\n");
1549 else {
1550 if (IS_DEBUG_OSPF(ism, ISM_STATUS))
1551 vty_out(vty, " OSPF ISM status debugging is on\n");
1552 if (IS_DEBUG_OSPF(ism, ISM_EVENTS))
1553 vty_out(vty, " OSPF ISM event debugging is on\n");
1554 if (IS_DEBUG_OSPF(ism, ISM_TIMERS))
1555 vty_out(vty, " OSPF ISM timer debugging is on\n");
1556 }
1557
1558 /* Show debug status for NSM. */
1559 if (IS_DEBUG_OSPF(nsm, NSM) == OSPF_DEBUG_NSM)
1560 vty_out(vty, " OSPF NSM debugging is on\n");
1561 else {
1562 if (IS_DEBUG_OSPF(nsm, NSM_STATUS))
1563 vty_out(vty, " OSPF NSM status debugging is on\n");
1564 if (IS_DEBUG_OSPF(nsm, NSM_EVENTS))
1565 vty_out(vty, " OSPF NSM event debugging is on\n");
1566 if (IS_DEBUG_OSPF(nsm, NSM_TIMERS))
1567 vty_out(vty, " OSPF NSM timer debugging is on\n");
1568 }
1569
1570 /* Show debug status for OSPF Packets. */
1571 for (i = 0; i < 5; i++)
1572 if (IS_DEBUG_OSPF_PACKET(i, SEND)
1573 && IS_DEBUG_OSPF_PACKET(i, RECV)) {
1574 vty_out(vty, " OSPF packet %s%s debugging is on\n",
1575 lookup_msg(ospf_packet_type_str, i + 1, NULL),
1576 IS_DEBUG_OSPF_PACKET(i, DETAIL) ? " detail"
1577 : "");
1578 } else {
1579 if (IS_DEBUG_OSPF_PACKET(i, SEND))
1580 vty_out(vty,
1581 " OSPF packet %s send%s debugging is on\n",
1582 lookup_msg(ospf_packet_type_str, i + 1,
1583 NULL),
1584 IS_DEBUG_OSPF_PACKET(i, DETAIL)
1585 ? " detail"
1586 : "");
1587 if (IS_DEBUG_OSPF_PACKET(i, RECV))
1588 vty_out(vty,
1589 " OSPF packet %s receive%s debugging is on\n",
1590 lookup_msg(ospf_packet_type_str, i + 1,
1591 NULL),
1592 IS_DEBUG_OSPF_PACKET(i, DETAIL)
1593 ? " detail"
1594 : "");
1595 }
1596
1597 /* Show debug status for OSPF LSAs. */
1598 if (IS_DEBUG_OSPF(lsa, LSA) == OSPF_DEBUG_LSA)
1599 vty_out(vty, " OSPF LSA debugging is on\n");
1600 else {
1601 if (IS_DEBUG_OSPF(lsa, LSA_GENERATE))
1602 vty_out(vty, " OSPF LSA generation debugging is on\n");
1603 if (IS_DEBUG_OSPF(lsa, LSA_FLOODING))
1604 vty_out(vty, " OSPF LSA flooding debugging is on\n");
1605 if (IS_DEBUG_OSPF(lsa, LSA_INSTALL))
1606 vty_out(vty, " OSPF LSA install debugging is on\n");
1607 if (IS_DEBUG_OSPF(lsa, LSA_REFRESH))
1608 vty_out(vty, " OSPF LSA refresh debugging is on\n");
1609 }
1610
1611 /* Show debug status for Zebra. */
1612 if (IS_DEBUG_OSPF(zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
1613 vty_out(vty, " OSPF Zebra debugging is on\n");
1614 else {
1615 if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
1616 vty_out(vty,
1617 " OSPF Zebra interface debugging is on\n");
1618 if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
1619 vty_out(vty,
1620 " OSPF Zebra redistribute debugging is on\n");
1621 }
1622
1623 /* Show debug status for NSSA. */
1624 if (IS_DEBUG_OSPF(nssa, NSSA) == OSPF_DEBUG_NSSA)
1625 vty_out(vty, " OSPF NSSA debugging is on\n");
1626
1627 vty_out(vty, "\n");
1628
1629 return CMD_SUCCESS;
1630 }
1631
1632 DEFUN_NOSH (show_debugging_ospf,
1633 show_debugging_ospf_cmd,
1634 "show debugging [ospf]",
1635 SHOW_STR
1636 DEBUG_STR
1637 OSPF_STR)
1638 {
1639 struct ospf *ospf = NULL;
1640
1641 ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
1642 if (ospf == NULL)
1643 return CMD_SUCCESS;
1644
1645 return show_debugging_ospf_common(vty, ospf);
1646 }
1647
1648 DEFUN_NOSH (show_debugging_ospf_instance,
1649 show_debugging_ospf_instance_cmd,
1650 "show debugging ospf (1-65535)",
1651 SHOW_STR
1652 DEBUG_STR
1653 OSPF_STR
1654 "Instance ID\n")
1655 {
1656 int idx_number = 3;
1657 struct ospf *ospf;
1658 unsigned short instance = 0;
1659
1660 instance = strtoul(argv[idx_number]->arg, NULL, 10);
1661 if ((ospf = ospf_lookup_instance(instance)) == NULL)
1662 return CMD_SUCCESS;
1663
1664 return show_debugging_ospf_common(vty, ospf);
1665 }
1666
1667 /* Debug node. */
1668 static struct cmd_node debug_node = {
1669 DEBUG_NODE, "", 1 /* VTYSH */
1670 };
1671
1672 static int config_write_debug(struct vty *vty)
1673 {
1674 int write = 0;
1675 int i, r;
1676
1677 const char *type_str[] = {"hello", "dd", "ls-request", "ls-update",
1678 "ls-ack"};
1679 const char *detail_str[] = {
1680 "", " send", " recv", "",
1681 " detail", " send detail", " recv detail", " detail"};
1682
1683 struct ospf *ospf;
1684 char str[16];
1685 memset(str, 0, 16);
1686
1687 ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
1688 if (ospf == NULL)
1689 return CMD_SUCCESS;
1690
1691 if (ospf->instance)
1692 sprintf(str, " %d", ospf->instance);
1693
1694 /* debug ospf ism (status|events|timers). */
1695 if (IS_CONF_DEBUG_OSPF(ism, ISM) == OSPF_DEBUG_ISM)
1696 vty_out(vty, "debug ospf%s ism\n", str);
1697 else {
1698 if (IS_CONF_DEBUG_OSPF(ism, ISM_STATUS))
1699 vty_out(vty, "debug ospf%s ism status\n", str);
1700 if (IS_CONF_DEBUG_OSPF(ism, ISM_EVENTS))
1701 vty_out(vty, "debug ospf%s ism event\n", str);
1702 if (IS_CONF_DEBUG_OSPF(ism, ISM_TIMERS))
1703 vty_out(vty, "debug ospf%s ism timer\n", str);
1704 }
1705
1706 /* debug ospf nsm (status|events|timers). */
1707 if (IS_CONF_DEBUG_OSPF(nsm, NSM) == OSPF_DEBUG_NSM)
1708 vty_out(vty, "debug ospf%s nsm\n", str);
1709 else {
1710 if (IS_CONF_DEBUG_OSPF(nsm, NSM_STATUS))
1711 vty_out(vty, "debug ospf%s nsm status\n", str);
1712 if (IS_CONF_DEBUG_OSPF(nsm, NSM_EVENTS))
1713 vty_out(vty, "debug ospf%s nsm event\n", str);
1714 if (IS_CONF_DEBUG_OSPF(nsm, NSM_TIMERS))
1715 vty_out(vty, "debug ospf%s nsm timer\n", str);
1716 }
1717
1718 /* debug ospf lsa (generate|flooding|install|refresh). */
1719 if (IS_CONF_DEBUG_OSPF(lsa, LSA) == OSPF_DEBUG_LSA)
1720 vty_out(vty, "debug ospf%s lsa\n", str);
1721 else {
1722 if (IS_CONF_DEBUG_OSPF(lsa, LSA_GENERATE))
1723 vty_out(vty, "debug ospf%s lsa generate\n", str);
1724 if (IS_CONF_DEBUG_OSPF(lsa, LSA_FLOODING))
1725 vty_out(vty, "debug ospf%s lsa flooding\n", str);
1726 if (IS_CONF_DEBUG_OSPF(lsa, LSA_INSTALL))
1727 vty_out(vty, "debug ospf%s lsa install\n", str);
1728 if (IS_CONF_DEBUG_OSPF(lsa, LSA_REFRESH))
1729 vty_out(vty, "debug ospf%s lsa refresh\n", str);
1730
1731 write = 1;
1732 }
1733
1734 /* debug ospf zebra (interface|redistribute). */
1735 if (IS_CONF_DEBUG_OSPF(zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
1736 vty_out(vty, "debug ospf%s zebra\n", str);
1737 else {
1738 if (IS_CONF_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
1739 vty_out(vty, "debug ospf%s zebra interface\n", str);
1740 if (IS_CONF_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
1741 vty_out(vty, "debug ospf%s zebra redistribute\n", str);
1742
1743 write = 1;
1744 }
1745
1746 /* debug ospf event. */
1747 if (IS_CONF_DEBUG_OSPF(event, EVENT) == OSPF_DEBUG_EVENT) {
1748 vty_out(vty, "debug ospf%s event\n", str);
1749 write = 1;
1750 }
1751
1752 /* debug ospf nssa. */
1753 if (IS_CONF_DEBUG_OSPF(nssa, NSSA) == OSPF_DEBUG_NSSA) {
1754 vty_out(vty, "debug ospf%s nssa\n", str);
1755 write = 1;
1756 }
1757
1758 /* debug ospf packet all detail. */
1759 r = OSPF_DEBUG_SEND_RECV | OSPF_DEBUG_DETAIL;
1760 for (i = 0; i < 5; i++)
1761 r &= conf_debug_ospf_packet[i]
1762 & (OSPF_DEBUG_SEND_RECV | OSPF_DEBUG_DETAIL);
1763 if (r == (OSPF_DEBUG_SEND_RECV | OSPF_DEBUG_DETAIL)) {
1764 vty_out(vty, "debug ospf%s packet all detail\n", str);
1765 return 1;
1766 }
1767
1768 /* debug ospf packet all. */
1769 r = OSPF_DEBUG_SEND_RECV;
1770 for (i = 0; i < 5; i++)
1771 r &= conf_debug_ospf_packet[i] & OSPF_DEBUG_SEND_RECV;
1772 if (r == OSPF_DEBUG_SEND_RECV) {
1773 vty_out(vty, "debug ospf%s packet all\n", str);
1774 for (i = 0; i < 5; i++)
1775 if (conf_debug_ospf_packet[i] & OSPF_DEBUG_DETAIL)
1776 vty_out(vty, "debug ospf%s packet %s detail\n",
1777 str, type_str[i]);
1778 return 1;
1779 }
1780
1781 /* debug ospf packet (hello|dd|ls-request|ls-update|ls-ack)
1782 (send|recv) (detail). */
1783 for (i = 0; i < 5; i++) {
1784 if (conf_debug_ospf_packet[i] == 0)
1785 continue;
1786
1787 vty_out(vty, "debug ospf%s packet %s%s\n", str, type_str[i],
1788 detail_str[conf_debug_ospf_packet[i]]);
1789 write = 1;
1790 }
1791
1792 /* debug ospf te */
1793 if (IS_CONF_DEBUG_OSPF(te, TE) == OSPF_DEBUG_TE) {
1794 vty_out(vty, "debug ospf%s te\n", str);
1795 write = 1;
1796 }
1797
1798 /* debug ospf sr */
1799 if (IS_CONF_DEBUG_OSPF(sr, SR) == OSPF_DEBUG_SR) {
1800 vty_out(vty, "debug ospf%s sr\n", str);
1801 write = 1;
1802 }
1803
1804 return write;
1805 }
1806
1807 /* Initialize debug commands. */
1808 void debug_init()
1809 {
1810 install_node(&debug_node, config_write_debug);
1811
1812 install_element(ENABLE_NODE, &show_debugging_ospf_cmd);
1813 install_element(ENABLE_NODE, &debug_ospf_ism_cmd);
1814 install_element(ENABLE_NODE, &debug_ospf_nsm_cmd);
1815 install_element(ENABLE_NODE, &debug_ospf_lsa_cmd);
1816 install_element(ENABLE_NODE, &debug_ospf_zebra_cmd);
1817 install_element(ENABLE_NODE, &debug_ospf_event_cmd);
1818 install_element(ENABLE_NODE, &debug_ospf_nssa_cmd);
1819 install_element(ENABLE_NODE, &debug_ospf_te_cmd);
1820 install_element(ENABLE_NODE, &debug_ospf_sr_cmd);
1821 install_element(ENABLE_NODE, &no_debug_ospf_ism_cmd);
1822 install_element(ENABLE_NODE, &no_debug_ospf_nsm_cmd);
1823 install_element(ENABLE_NODE, &no_debug_ospf_lsa_cmd);
1824 install_element(ENABLE_NODE, &no_debug_ospf_zebra_cmd);
1825 install_element(ENABLE_NODE, &no_debug_ospf_event_cmd);
1826 install_element(ENABLE_NODE, &no_debug_ospf_nssa_cmd);
1827 install_element(ENABLE_NODE, &no_debug_ospf_te_cmd);
1828 install_element(ENABLE_NODE, &no_debug_ospf_sr_cmd);
1829
1830 install_element(ENABLE_NODE, &show_debugging_ospf_instance_cmd);
1831 install_element(ENABLE_NODE, &debug_ospf_packet_cmd);
1832 install_element(ENABLE_NODE, &no_debug_ospf_packet_cmd);
1833
1834 install_element(ENABLE_NODE, &debug_ospf_instance_nsm_cmd);
1835 install_element(ENABLE_NODE, &debug_ospf_instance_lsa_cmd);
1836 install_element(ENABLE_NODE, &debug_ospf_instance_zebra_cmd);
1837 install_element(ENABLE_NODE, &debug_ospf_instance_event_cmd);
1838 install_element(ENABLE_NODE, &debug_ospf_instance_nssa_cmd);
1839 install_element(ENABLE_NODE, &no_debug_ospf_instance_nsm_cmd);
1840 install_element(ENABLE_NODE, &no_debug_ospf_instance_lsa_cmd);
1841 install_element(ENABLE_NODE, &no_debug_ospf_instance_zebra_cmd);
1842 install_element(ENABLE_NODE, &no_debug_ospf_instance_event_cmd);
1843 install_element(ENABLE_NODE, &no_debug_ospf_instance_nssa_cmd);
1844 install_element(ENABLE_NODE, &no_debug_ospf_cmd);
1845
1846 install_element(CONFIG_NODE, &debug_ospf_packet_cmd);
1847 install_element(CONFIG_NODE, &no_debug_ospf_packet_cmd);
1848 install_element(CONFIG_NODE, &debug_ospf_ism_cmd);
1849 install_element(CONFIG_NODE, &no_debug_ospf_ism_cmd);
1850
1851 install_element(CONFIG_NODE, &debug_ospf_nsm_cmd);
1852 install_element(CONFIG_NODE, &debug_ospf_lsa_cmd);
1853 install_element(CONFIG_NODE, &debug_ospf_zebra_cmd);
1854 install_element(CONFIG_NODE, &debug_ospf_event_cmd);
1855 install_element(CONFIG_NODE, &debug_ospf_nssa_cmd);
1856 install_element(CONFIG_NODE, &debug_ospf_te_cmd);
1857 install_element(CONFIG_NODE, &debug_ospf_sr_cmd);
1858 install_element(CONFIG_NODE, &no_debug_ospf_nsm_cmd);
1859 install_element(CONFIG_NODE, &no_debug_ospf_lsa_cmd);
1860 install_element(CONFIG_NODE, &no_debug_ospf_zebra_cmd);
1861 install_element(CONFIG_NODE, &no_debug_ospf_event_cmd);
1862 install_element(CONFIG_NODE, &no_debug_ospf_nssa_cmd);
1863 install_element(CONFIG_NODE, &no_debug_ospf_te_cmd);
1864 install_element(CONFIG_NODE, &no_debug_ospf_sr_cmd);
1865
1866 install_element(CONFIG_NODE, &debug_ospf_instance_nsm_cmd);
1867 install_element(CONFIG_NODE, &debug_ospf_instance_lsa_cmd);
1868 install_element(CONFIG_NODE, &debug_ospf_instance_zebra_cmd);
1869 install_element(CONFIG_NODE, &debug_ospf_instance_event_cmd);
1870 install_element(CONFIG_NODE, &debug_ospf_instance_nssa_cmd);
1871 install_element(CONFIG_NODE, &no_debug_ospf_instance_nsm_cmd);
1872 install_element(CONFIG_NODE, &no_debug_ospf_instance_lsa_cmd);
1873 install_element(CONFIG_NODE, &no_debug_ospf_instance_zebra_cmd);
1874 install_element(CONFIG_NODE, &no_debug_ospf_instance_event_cmd);
1875 install_element(CONFIG_NODE, &no_debug_ospf_instance_nssa_cmd);
1876 install_element(CONFIG_NODE, &no_debug_ospf_cmd);
1877 }