ripd: fix compiler warnings
[jleu-quagga.git] / ospf6d / ospf6d.c
blobbb091d4f3c39f151cd3de6bfd8cfed4da236e876
1 /*
2 * Copyright (C) 2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include <zebra.h>
24 #include "thread.h"
25 #include "linklist.h"
26 #include "vty.h"
27 #include "command.h"
29 #include "ospf6_proto.h"
30 #include "ospf6_network.h"
31 #include "ospf6_lsa.h"
32 #include "ospf6_lsdb.h"
33 #include "ospf6_message.h"
34 #include "ospf6_route.h"
35 #include "ospf6_zebra.h"
36 #include "ospf6_spf.h"
37 #include "ospf6_top.h"
38 #include "ospf6_area.h"
39 #include "ospf6_interface.h"
40 #include "ospf6_neighbor.h"
41 #include "ospf6_intra.h"
42 #include "ospf6_asbr.h"
43 #include "ospf6_abr.h"
44 #include "ospf6_flood.h"
45 #include "ospf6d.h"
47 #ifdef HAVE_SNMP
48 #include "ospf6_snmp.h"
49 #endif /*HAVE_SNMP*/
51 char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION;
53 struct route_node *
54 route_prev (struct route_node *node)
56 struct route_node *end;
57 struct route_node *prev = NULL;
59 end = node;
60 node = node->parent;
61 if (node)
62 route_lock_node (node);
63 while (node)
65 prev = node;
66 node = route_next (node);
67 if (node == end)
69 route_unlock_node (node);
70 node = NULL;
73 route_unlock_node (end);
74 if (prev)
75 route_lock_node (prev);
77 return prev;
81 /* show database functions */
82 DEFUN (show_version_ospf6,
83 show_version_ospf6_cmd,
84 "show version ospf6",
85 SHOW_STR
86 "Displays ospf6d version\n"
89 vty_out (vty, "Zebra OSPF6d Version: %s%s",
90 ospf6_daemon_version, VNL);
92 return CMD_SUCCESS;
95 static struct cmd_node debug_node =
97 DEBUG_NODE,
98 "",
99 1 /* VTYSH */
102 static int
103 config_write_ospf6_debug (struct vty *vty)
105 config_write_ospf6_debug_message (vty);
106 config_write_ospf6_debug_lsa (vty);
107 config_write_ospf6_debug_zebra (vty);
108 config_write_ospf6_debug_interface (vty);
109 config_write_ospf6_debug_neighbor (vty);
110 config_write_ospf6_debug_spf (vty);
111 config_write_ospf6_debug_route (vty);
112 config_write_ospf6_debug_brouter (vty);
113 config_write_ospf6_debug_asbr (vty);
114 config_write_ospf6_debug_abr (vty);
115 config_write_ospf6_debug_flood (vty);
116 vty_out (vty, "!%s", VNL);
117 return 0;
120 #define AREA_LSDB_TITLE_FORMAT \
121 "%s Area Scoped Link State Database (Area %s)%s%s"
122 #define IF_LSDB_TITLE_FORMAT \
123 "%s I/F Scoped Link State Database (I/F %s in Area %s)%s%s"
124 #define AS_LSDB_TITLE_FORMAT \
125 "%s AS Scoped Link State Database%s%s"
127 static int
128 parse_show_level (int argc, const char *argv[])
130 int level = 0;
131 if (argc)
133 if (! strncmp (argv[0], "de", 2))
134 level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;
135 else if (! strncmp (argv[0], "du", 2))
136 level = OSPF6_LSDB_SHOW_LEVEL_DUMP;
137 else if (! strncmp (argv[0], "in", 2))
138 level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL;
140 else
141 level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
142 return level;
145 static u_int16_t
146 parse_type_spec (int argc, const char *argv[])
148 u_int16_t type = 0;
149 assert (argc);
150 if (! strcmp (argv[0], "router"))
151 type = htons (OSPF6_LSTYPE_ROUTER);
152 else if (! strcmp (argv[0], "network"))
153 type = htons (OSPF6_LSTYPE_NETWORK);
154 else if (! strcmp (argv[0], "as-external"))
155 type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
156 else if (! strcmp (argv[0], "intra-prefix"))
157 type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
158 else if (! strcmp (argv[0], "inter-router"))
159 type = htons (OSPF6_LSTYPE_INTER_ROUTER);
160 else if (! strcmp (argv[0], "inter-prefix"))
161 type = htons (OSPF6_LSTYPE_INTER_PREFIX);
162 else if (! strcmp (argv[0], "link"))
163 type = htons (OSPF6_LSTYPE_LINK);
164 return type;
167 DEFUN (show_ipv6_ospf6_database,
168 show_ipv6_ospf6_database_cmd,
169 "show ipv6 ospf6 database",
170 SHOW_STR
171 IPV6_STR
172 OSPF6_STR
173 "Display Link state database\n"
176 int level;
177 struct listnode *i, *j;
178 struct ospf6 *o = ospf6;
179 struct ospf6_area *oa;
180 struct ospf6_interface *oi;
182 OSPF6_CMD_CHECK_RUNNING ();
184 level = parse_show_level (argc, argv);
186 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
188 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
189 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oa->lsdb);
192 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
194 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
196 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
197 oi->interface->name, oa->name, VNL, VNL);
198 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oi->lsdb);
202 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
203 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, o->lsdb);
205 vty_out (vty, "%s", VNL);
206 return CMD_SUCCESS;
209 ALIAS (show_ipv6_ospf6_database,
210 show_ipv6_ospf6_database_detail_cmd,
211 "show ipv6 ospf6 database (detail|dump|internal)",
212 SHOW_STR
213 IPV6_STR
214 OSPF6_STR
215 "Display Link state database\n"
216 "Display details of LSAs\n"
217 "Dump LSAs\n"
218 "Display LSA's internal information\n"
221 DEFUN (show_ipv6_ospf6_database_type,
222 show_ipv6_ospf6_database_type_cmd,
223 "show ipv6 ospf6 database "
224 "(router|network|inter-prefix|inter-router|as-external|"
225 "group-membership|type-7|link|intra-prefix)",
226 SHOW_STR
227 IPV6_STR
228 OSPF6_STR
229 "Display Link state database\n"
230 "Display Router LSAs\n"
231 "Display Network LSAs\n"
232 "Display Inter-Area-Prefix LSAs\n"
233 "Display Inter-Area-Router LSAs\n"
234 "Display As-External LSAs\n"
235 "Display Group-Membership LSAs\n"
236 "Display Type-7 LSAs\n"
237 "Display Link LSAs\n"
238 "Display Intra-Area-Prefix LSAs\n"
241 int level;
242 struct listnode *i, *j;
243 struct ospf6 *o = ospf6;
244 struct ospf6_area *oa;
245 struct ospf6_interface *oi;
246 u_int16_t type = 0;
248 OSPF6_CMD_CHECK_RUNNING ();
250 type = parse_type_spec (argc, argv);
251 argc--;
252 argv++;
253 level = parse_show_level (argc, argv);
255 switch (OSPF6_LSA_SCOPE (type))
257 case OSPF6_SCOPE_AREA:
258 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
260 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
261 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oa->lsdb);
263 break;
265 case OSPF6_SCOPE_LINKLOCAL:
266 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
268 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
270 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
271 oi->interface->name, oa->name, VNL, VNL);
272 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oi->lsdb);
275 break;
277 case OSPF6_SCOPE_AS:
278 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
279 ospf6_lsdb_show (vty, level, &type, NULL, NULL, o->lsdb);
280 break;
282 default:
283 assert (0);
284 break;
287 vty_out (vty, "%s", VNL);
288 return CMD_SUCCESS;
291 ALIAS (show_ipv6_ospf6_database_type,
292 show_ipv6_ospf6_database_type_detail_cmd,
293 "show ipv6 ospf6 database "
294 "(router|network|inter-prefix|inter-router|as-external|"
295 "group-membership|type-7|link|intra-prefix) "
296 "(detail|dump|internal)",
297 SHOW_STR
298 IPV6_STR
299 OSPF6_STR
300 "Display Link state database\n"
301 "Display Router LSAs\n"
302 "Display Network LSAs\n"
303 "Display Inter-Area-Prefix LSAs\n"
304 "Display Inter-Area-Router LSAs\n"
305 "Display As-External LSAs\n"
306 "Display Group-Membership LSAs\n"
307 "Display Type-7 LSAs\n"
308 "Display Link LSAs\n"
309 "Display Intra-Area-Prefix LSAs\n"
310 "Display details of LSAs\n"
311 "Dump LSAs\n"
312 "Display LSA's internal information\n"
315 DEFUN (show_ipv6_ospf6_database_id,
316 show_ipv6_ospf6_database_id_cmd,
317 "show ipv6 ospf6 database * A.B.C.D",
318 SHOW_STR
319 IPV6_STR
320 OSPF6_STR
321 "Display Link state database\n"
322 "Any Link state Type\n"
323 "Specify Link state ID as IPv4 address notation\n"
326 int level;
327 struct listnode *i, *j;
328 struct ospf6 *o = ospf6;
329 struct ospf6_area *oa;
330 struct ospf6_interface *oi;
331 u_int32_t id = 0;
333 OSPF6_CMD_CHECK_RUNNING ();
335 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
337 vty_out (vty, "Link State ID is not parsable: %s%s",
338 argv[0], VNL);
339 return CMD_SUCCESS;
342 argc--;
343 argv++;
344 level = parse_show_level (argc, argv);
346 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
348 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
349 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oa->lsdb);
352 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
354 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
356 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
357 oi->interface->name, oa->name, VNL, VNL);
358 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oi->lsdb);
362 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
363 ospf6_lsdb_show (vty, level, NULL, &id, NULL, o->lsdb);
365 vty_out (vty, "%s", VNL);
366 return CMD_SUCCESS;
369 ALIAS (show_ipv6_ospf6_database_id,
370 show_ipv6_ospf6_database_id_detail_cmd,
371 "show ipv6 ospf6 database * A.B.C.D "
372 "(detail|dump|internal)",
373 SHOW_STR
374 IPV6_STR
375 OSPF6_STR
376 "Display Link state database\n"
377 "Any Link state Type\n"
378 "Specify Link state ID as IPv4 address notation\n"
379 "Display details of LSAs\n"
380 "Dump LSAs\n"
381 "Display LSA's internal information\n"
384 ALIAS (show_ipv6_ospf6_database_id,
385 show_ipv6_ospf6_database_linkstate_id_cmd,
386 "show ipv6 ospf6 database linkstate-id A.B.C.D",
387 SHOW_STR
388 IPV6_STR
389 OSPF6_STR
390 "Display Link state database\n"
391 "Search by Link state ID\n"
392 "Specify Link state ID as IPv4 address notation\n"
395 ALIAS (show_ipv6_ospf6_database_id,
396 show_ipv6_ospf6_database_linkstate_id_detail_cmd,
397 "show ipv6 ospf6 database linkstate-id A.B.C.D "
398 "(detail|dump|internal)",
399 SHOW_STR
400 IPV6_STR
401 OSPF6_STR
402 "Display Link state database\n"
403 "Search by Link state ID\n"
404 "Specify Link state ID as IPv4 address notation\n"
405 "Display details of LSAs\n"
406 "Dump LSAs\n"
407 "Display LSA's internal information\n"
410 DEFUN (show_ipv6_ospf6_database_router,
411 show_ipv6_ospf6_database_router_cmd,
412 "show ipv6 ospf6 database * * A.B.C.D",
413 SHOW_STR
414 IPV6_STR
415 OSPF6_STR
416 "Display Link state database\n"
417 "Any Link state Type\n"
418 "Any Link state ID\n"
419 "Specify Advertising Router as IPv4 address notation\n"
422 int level;
423 struct listnode *i, *j;
424 struct ospf6 *o = ospf6;
425 struct ospf6_area *oa;
426 struct ospf6_interface *oi;
427 u_int32_t adv_router = 0;
429 OSPF6_CMD_CHECK_RUNNING ();
431 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
433 vty_out (vty, "Advertising Router is not parsable: %s%s",
434 argv[0], VNL);
435 return CMD_SUCCESS;
438 argc--;
439 argv++;
440 level = parse_show_level (argc, argv);
442 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
444 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
445 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
448 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
450 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
452 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
453 oi->interface->name, oa->name, VNL, VNL);
454 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
458 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
459 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
461 vty_out (vty, "%s", VNL);
462 return CMD_SUCCESS;
465 ALIAS (show_ipv6_ospf6_database_router,
466 show_ipv6_ospf6_database_router_detail_cmd,
467 "show ipv6 ospf6 database * * A.B.C.D "
468 "(detail|dump|internal)",
469 SHOW_STR
470 IPV6_STR
471 OSPF6_STR
472 "Display Link state database\n"
473 "Any Link state Type\n"
474 "Any Link state ID\n"
475 "Specify Advertising Router as IPv4 address notation\n"
476 "Display details of LSAs\n"
477 "Dump LSAs\n"
478 "Display LSA's internal information\n"
481 ALIAS (show_ipv6_ospf6_database_router,
482 show_ipv6_ospf6_database_adv_router_cmd,
483 "show ipv6 ospf6 database adv-router A.B.C.D",
484 SHOW_STR
485 IPV6_STR
486 OSPF6_STR
487 "Display Link state database\n"
488 "Search by Advertising Router\n"
489 "Specify Advertising Router as IPv4 address notation\n"
492 ALIAS (show_ipv6_ospf6_database_router,
493 show_ipv6_ospf6_database_adv_router_detail_cmd,
494 "show ipv6 ospf6 database adv-router A.B.C.D "
495 "(detail|dump|internal)",
496 SHOW_STR
497 IPV6_STR
498 OSPF6_STR
499 "Display Link state database\n"
500 "Search by Advertising Router\n"
501 "Specify Advertising Router as IPv4 address notation\n"
502 "Display details of LSAs\n"
503 "Dump LSAs\n"
504 "Display LSA's internal information\n"
507 DEFUN (show_ipv6_ospf6_database_type_id,
508 show_ipv6_ospf6_database_type_id_cmd,
509 "show ipv6 ospf6 database "
510 "(router|network|inter-prefix|inter-router|as-external|"
511 "group-membership|type-7|link|intra-prefix) A.B.C.D",
512 SHOW_STR
513 IPV6_STR
514 OSPF6_STR
515 "Display Link state database\n"
516 "Display Router LSAs\n"
517 "Display Network LSAs\n"
518 "Display Inter-Area-Prefix LSAs\n"
519 "Display Inter-Area-Router LSAs\n"
520 "Display As-External LSAs\n"
521 "Display Group-Membership LSAs\n"
522 "Display Type-7 LSAs\n"
523 "Display Link LSAs\n"
524 "Display Intra-Area-Prefix LSAs\n"
525 "Specify Link state ID as IPv4 address notation\n"
528 int level;
529 struct listnode *i, *j;
530 struct ospf6 *o = ospf6;
531 struct ospf6_area *oa;
532 struct ospf6_interface *oi;
533 u_int16_t type = 0;
534 u_int32_t id = 0;
536 OSPF6_CMD_CHECK_RUNNING ();
538 type = parse_type_spec (argc, argv);
539 argc--;
540 argv++;
542 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
544 vty_out (vty, "Link state ID is not parsable: %s%s",
545 argv[0], VNL);
546 return CMD_SUCCESS;
549 argc--;
550 argv++;
551 level = parse_show_level (argc, argv);
553 switch (OSPF6_LSA_SCOPE (type))
555 case OSPF6_SCOPE_AREA:
556 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
558 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
559 ospf6_lsdb_show (vty, level, &type, &id, NULL, oa->lsdb);
561 break;
563 case OSPF6_SCOPE_LINKLOCAL:
564 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
566 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
568 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
569 oi->interface->name, oa->name, VNL, VNL);
570 ospf6_lsdb_show (vty, level, &type, &id, NULL, oi->lsdb);
573 break;
575 case OSPF6_SCOPE_AS:
576 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
577 ospf6_lsdb_show (vty, level, &type, &id, NULL, o->lsdb);
578 break;
580 default:
581 assert (0);
582 break;
585 vty_out (vty, "%s", VNL);
586 return CMD_SUCCESS;
589 ALIAS (show_ipv6_ospf6_database_type_id,
590 show_ipv6_ospf6_database_type_id_detail_cmd,
591 "show ipv6 ospf6 database "
592 "(router|network|inter-prefix|inter-router|as-external|"
593 "group-membership|type-7|link|intra-prefix) A.B.C.D "
594 "(detail|dump|internal)",
595 SHOW_STR
596 IPV6_STR
597 OSPF6_STR
598 "Display Link state database\n"
599 "Display Router LSAs\n"
600 "Display Network LSAs\n"
601 "Display Inter-Area-Prefix LSAs\n"
602 "Display Inter-Area-Router LSAs\n"
603 "Display As-External LSAs\n"
604 "Display Group-Membership LSAs\n"
605 "Display Type-7 LSAs\n"
606 "Display Link LSAs\n"
607 "Display Intra-Area-Prefix LSAs\n"
608 "Specify Link state ID as IPv4 address notation\n"
609 "Display details of LSAs\n"
610 "Dump LSAs\n"
611 "Display LSA's internal information\n"
614 ALIAS (show_ipv6_ospf6_database_type_id,
615 show_ipv6_ospf6_database_type_linkstate_id_cmd,
616 "show ipv6 ospf6 database "
617 "(router|network|inter-prefix|inter-router|as-external|"
618 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D",
619 SHOW_STR
620 IPV6_STR
621 OSPF6_STR
622 "Display Link state database\n"
623 "Display Router LSAs\n"
624 "Display Network LSAs\n"
625 "Display Inter-Area-Prefix LSAs\n"
626 "Display Inter-Area-Router LSAs\n"
627 "Display As-External LSAs\n"
628 "Display Group-Membership LSAs\n"
629 "Display Type-7 LSAs\n"
630 "Display Link LSAs\n"
631 "Display Intra-Area-Prefix LSAs\n"
632 "Search by Link state ID\n"
633 "Specify Link state ID as IPv4 address notation\n"
636 ALIAS (show_ipv6_ospf6_database_type_id,
637 show_ipv6_ospf6_database_type_linkstate_id_detail_cmd,
638 "show ipv6 ospf6 database "
639 "(router|network|inter-prefix|inter-router|as-external|"
640 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D "
641 "(detail|dump|internal)",
642 SHOW_STR
643 IPV6_STR
644 OSPF6_STR
645 "Display Link state database\n"
646 "Display Router LSAs\n"
647 "Display Network LSAs\n"
648 "Display Inter-Area-Prefix LSAs\n"
649 "Display Inter-Area-Router LSAs\n"
650 "Display As-External LSAs\n"
651 "Display Group-Membership LSAs\n"
652 "Display Type-7 LSAs\n"
653 "Display Link LSAs\n"
654 "Display Intra-Area-Prefix LSAs\n"
655 "Search by Link state ID\n"
656 "Specify Link state ID as IPv4 address notation\n"
657 "Display details of LSAs\n"
658 "Dump LSAs\n"
659 "Display LSA's internal information\n"
662 DEFUN (show_ipv6_ospf6_database_type_router,
663 show_ipv6_ospf6_database_type_router_cmd,
664 "show ipv6 ospf6 database "
665 "(router|network|inter-prefix|inter-router|as-external|"
666 "group-membership|type-7|link|intra-prefix) * A.B.C.D",
667 SHOW_STR
668 IPV6_STR
669 OSPF6_STR
670 "Display Link state database\n"
671 "Display Router LSAs\n"
672 "Display Network LSAs\n"
673 "Display Inter-Area-Prefix LSAs\n"
674 "Display Inter-Area-Router LSAs\n"
675 "Display As-External LSAs\n"
676 "Display Group-Membership LSAs\n"
677 "Display Type-7 LSAs\n"
678 "Display Link LSAs\n"
679 "Display Intra-Area-Prefix LSAs\n"
680 "Any Link state ID\n"
681 "Specify Advertising Router as IPv4 address notation\n"
684 int level;
685 struct listnode *i, *j;
686 struct ospf6 *o = ospf6;
687 struct ospf6_area *oa;
688 struct ospf6_interface *oi;
689 u_int16_t type = 0;
690 u_int32_t adv_router = 0;
692 OSPF6_CMD_CHECK_RUNNING ();
694 type = parse_type_spec (argc, argv);
695 argc--;
696 argv++;
698 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
700 vty_out (vty, "Advertising Router is not parsable: %s%s",
701 argv[0], VNL);
702 return CMD_SUCCESS;
705 argc--;
706 argv++;
707 level = parse_show_level (argc, argv);
709 switch (OSPF6_LSA_SCOPE (type))
711 case OSPF6_SCOPE_AREA:
712 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
714 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
715 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
717 break;
719 case OSPF6_SCOPE_LINKLOCAL:
720 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
722 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
724 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
725 oi->interface->name, oa->name, VNL, VNL);
726 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
729 break;
731 case OSPF6_SCOPE_AS:
732 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
733 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
734 break;
736 default:
737 assert (0);
738 break;
741 vty_out (vty, "%s", VNL);
742 return CMD_SUCCESS;
745 ALIAS (show_ipv6_ospf6_database_type_router,
746 show_ipv6_ospf6_database_type_router_detail_cmd,
747 "show ipv6 ospf6 database "
748 "(router|network|inter-prefix|inter-router|as-external|"
749 "group-membership|type-7|link|intra-prefix) * A.B.C.D "
750 "(detail|dump|internal)",
751 SHOW_STR
752 IPV6_STR
753 OSPF6_STR
754 "Display Link state database\n"
755 "Display Router LSAs\n"
756 "Display Network LSAs\n"
757 "Display Inter-Area-Prefix LSAs\n"
758 "Display Inter-Area-Router LSAs\n"
759 "Display As-External LSAs\n"
760 "Display Group-Membership LSAs\n"
761 "Display Type-7 LSAs\n"
762 "Display Link LSAs\n"
763 "Display Intra-Area-Prefix LSAs\n"
764 "Any Link state ID\n"
765 "Specify Advertising Router as IPv4 address notation\n"
766 "Display details of LSAs\n"
767 "Dump LSAs\n"
768 "Display LSA's internal information\n"
771 ALIAS (show_ipv6_ospf6_database_type_router,
772 show_ipv6_ospf6_database_type_adv_router_cmd,
773 "show ipv6 ospf6 database "
774 "(router|network|inter-prefix|inter-router|as-external|"
775 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D",
776 SHOW_STR
777 IPV6_STR
778 OSPF6_STR
779 "Display Link state database\n"
780 "Display Router LSAs\n"
781 "Display Network LSAs\n"
782 "Display Inter-Area-Prefix LSAs\n"
783 "Display Inter-Area-Router LSAs\n"
784 "Display As-External LSAs\n"
785 "Display Group-Membership LSAs\n"
786 "Display Type-7 LSAs\n"
787 "Display Link LSAs\n"
788 "Display Intra-Area-Prefix LSAs\n"
789 "Search by Advertising Router\n"
790 "Specify Advertising Router as IPv4 address notation\n"
793 ALIAS (show_ipv6_ospf6_database_type_router,
794 show_ipv6_ospf6_database_type_adv_router_detail_cmd,
795 "show ipv6 ospf6 database "
796 "(router|network|inter-prefix|inter-router|as-external|"
797 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D "
798 "(detail|dump|internal)",
799 SHOW_STR
800 IPV6_STR
801 OSPF6_STR
802 "Display Link state database\n"
803 "Display Router LSAs\n"
804 "Display Network LSAs\n"
805 "Display Inter-Area-Prefix LSAs\n"
806 "Display Inter-Area-Router LSAs\n"
807 "Display As-External LSAs\n"
808 "Display Group-Membership LSAs\n"
809 "Display Type-7 LSAs\n"
810 "Display Link LSAs\n"
811 "Display Intra-Area-Prefix LSAs\n"
812 "Search by Advertising Router\n"
813 "Specify Advertising Router as IPv4 address notation\n"
814 "Display details of LSAs\n"
815 "Dump LSAs\n"
816 "Display LSA's internal information\n"
819 DEFUN (show_ipv6_ospf6_database_id_router,
820 show_ipv6_ospf6_database_id_router_cmd,
821 "show ipv6 ospf6 database * A.B.C.D A.B.C.D",
822 SHOW_STR
823 IPV6_STR
824 OSPF6_STR
825 "Display Link state database\n"
826 "Any Link state Type\n"
827 "Specify Link state ID as IPv4 address notation\n"
828 "Specify Advertising Router as IPv4 address notation\n"
831 int level;
832 struct listnode *i, *j;
833 struct ospf6 *o = ospf6;
834 struct ospf6_area *oa;
835 struct ospf6_interface *oi;
836 u_int32_t id = 0;
837 u_int32_t adv_router = 0;
839 OSPF6_CMD_CHECK_RUNNING ();
841 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
843 vty_out (vty, "Link state ID is not parsable: %s%s",
844 argv[0], VNL);
845 return CMD_SUCCESS;
848 argc--;
849 argv++;
851 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
853 vty_out (vty, "Advertising Router is not parsable: %s%s",
854 argv[0], VNL);
855 return CMD_SUCCESS;
858 argc--;
859 argv++;
860 level = parse_show_level (argc, argv);
862 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
864 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
865 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
868 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
870 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
872 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
873 oi->interface->name, oa->name, VNL, VNL);
874 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
878 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
879 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
881 vty_out (vty, "%s", VNL);
882 return CMD_SUCCESS;
885 ALIAS (show_ipv6_ospf6_database_id_router,
886 show_ipv6_ospf6_database_id_router_detail_cmd,
887 "show ipv6 ospf6 database * A.B.C.D A.B.C.D "
888 "(detail|dump|internal)",
889 SHOW_STR
890 IPV6_STR
891 OSPF6_STR
892 "Display Link state database\n"
893 "Any Link state Type\n"
894 "Specify Link state ID as IPv4 address notation\n"
895 "Specify Advertising Router as IPv4 address notation\n"
896 "Display details of LSAs\n"
897 "Dump LSAs\n"
898 "Display LSA's internal information\n"
901 DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
902 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd,
903 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D",
904 SHOW_STR
905 IPV6_STR
906 OSPF6_STR
907 "Display Link state database\n"
908 "Search by Advertising Router\n"
909 "Specify Advertising Router as IPv4 address notation\n"
910 "Search by Link state ID\n"
911 "Specify Link state ID as IPv4 address notation\n"
914 int level;
915 struct listnode *i, *j;
916 struct ospf6 *o = ospf6;
917 struct ospf6_area *oa;
918 struct ospf6_interface *oi;
919 u_int32_t id = 0;
920 u_int32_t adv_router = 0;
922 OSPF6_CMD_CHECK_RUNNING ();
924 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
926 vty_out (vty, "Advertising Router is not parsable: %s%s",
927 argv[0], VNL);
928 return CMD_SUCCESS;
931 argc--;
932 argv++;
934 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
936 vty_out (vty, "Link state ID is not parsable: %s%s",
937 argv[0], VNL);
938 return CMD_SUCCESS;
941 argc--;
942 argv++;
943 level = parse_show_level (argc, argv);
945 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
947 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
948 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
951 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
953 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
955 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
956 oi->interface->name, oa->name, VNL, VNL);
957 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
961 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
962 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
964 vty_out (vty, "%s", VNL);
965 return CMD_SUCCESS;
968 ALIAS (show_ipv6_ospf6_database_adv_router_linkstate_id,
969 show_ipv6_ospf6_database_adv_router_linkstate_id_detail_cmd,
970 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D "
971 "(detail|dump|internal)",
972 SHOW_STR
973 IPV6_STR
974 OSPF6_STR
975 "Display Link state database\n"
976 "Search by Advertising Router\n"
977 "Specify Advertising Router as IPv4 address notation\n"
978 "Search by Link state ID\n"
979 "Specify Link state ID as IPv4 address notation\n"
980 "Display details of LSAs\n"
981 "Dump LSAs\n"
982 "Display LSA's internal information\n"
985 DEFUN (show_ipv6_ospf6_database_type_id_router,
986 show_ipv6_ospf6_database_type_id_router_cmd,
987 "show ipv6 ospf6 database "
988 "(router|network|inter-prefix|inter-router|as-external|"
989 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D",
990 SHOW_STR
991 IPV6_STR
992 OSPF6_STR
993 "Display Link state database\n"
994 "Display Router LSAs\n"
995 "Display Network LSAs\n"
996 "Display Inter-Area-Prefix LSAs\n"
997 "Display Inter-Area-Router LSAs\n"
998 "Display As-External LSAs\n"
999 "Display Group-Membership LSAs\n"
1000 "Display Type-7 LSAs\n"
1001 "Display Link LSAs\n"
1002 "Display Intra-Area-Prefix LSAs\n"
1003 "Specify Link state ID as IPv4 address notation\n"
1004 "Specify Advertising Router as IPv4 address notation\n"
1007 int level;
1008 struct listnode *i, *j;
1009 struct ospf6 *o = ospf6;
1010 struct ospf6_area *oa;
1011 struct ospf6_interface *oi;
1012 u_int16_t type = 0;
1013 u_int32_t id = 0;
1014 u_int32_t adv_router = 0;
1016 OSPF6_CMD_CHECK_RUNNING ();
1018 type = parse_type_spec (argc, argv);
1019 argc--;
1020 argv++;
1022 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1024 vty_out (vty, "Link state ID is not parsable: %s%s",
1025 argv[0], VNL);
1026 return CMD_SUCCESS;
1029 argc--;
1030 argv++;
1032 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1034 vty_out (vty, "Advertising Router is not parsable: %s%s",
1035 argv[0], VNL);
1036 return CMD_SUCCESS;
1039 argc--;
1040 argv++;
1041 level = parse_show_level (argc, argv);
1043 switch (OSPF6_LSA_SCOPE (type))
1045 case OSPF6_SCOPE_AREA:
1046 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1048 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1049 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1051 break;
1053 case OSPF6_SCOPE_LINKLOCAL:
1054 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1056 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1058 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1059 oi->interface->name, oa->name, VNL, VNL);
1060 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1063 break;
1065 case OSPF6_SCOPE_AS:
1066 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1067 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1068 break;
1070 default:
1071 assert (0);
1072 break;
1075 vty_out (vty, "%s", VNL);
1076 return CMD_SUCCESS;
1079 ALIAS (show_ipv6_ospf6_database_type_id_router,
1080 show_ipv6_ospf6_database_type_id_router_detail_cmd,
1081 "show ipv6 ospf6 database "
1082 "(router|network|inter-prefix|inter-router|as-external|"
1083 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D "
1084 "(dump|internal)",
1085 SHOW_STR
1086 IPV6_STR
1087 OSPF6_STR
1088 "Display Link state database\n"
1089 "Display Router LSAs\n"
1090 "Display Network LSAs\n"
1091 "Display Inter-Area-Prefix LSAs\n"
1092 "Display Inter-Area-Router LSAs\n"
1093 "Display As-External LSAs\n"
1094 "Display Group-Membership LSAs\n"
1095 "Display Type-7 LSAs\n"
1096 "Display Link LSAs\n"
1097 "Display Intra-Area-Prefix LSAs\n"
1098 "Specify Link state ID as IPv4 address notation\n"
1099 "Specify Advertising Router as IPv4 address notation\n"
1100 "Dump LSAs\n"
1101 "Display LSA's internal information\n"
1104 DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1105 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd,
1106 "show ipv6 ospf6 database "
1107 "(router|network|inter-prefix|inter-router|as-external|"
1108 "group-membership|type-7|link|intra-prefix) "
1109 "adv-router A.B.C.D linkstate-id A.B.C.D",
1110 SHOW_STR
1111 IPV6_STR
1112 OSPF6_STR
1113 "Display Link state database\n"
1114 "Display Router LSAs\n"
1115 "Display Network LSAs\n"
1116 "Display Inter-Area-Prefix LSAs\n"
1117 "Display Inter-Area-Router LSAs\n"
1118 "Display As-External LSAs\n"
1119 "Display Group-Membership LSAs\n"
1120 "Display Type-7 LSAs\n"
1121 "Display Link LSAs\n"
1122 "Display Intra-Area-Prefix LSAs\n"
1123 "Search by Advertising Router\n"
1124 "Specify Advertising Router as IPv4 address notation\n"
1125 "Search by Link state ID\n"
1126 "Specify Link state ID as IPv4 address notation\n"
1129 int level;
1130 struct listnode *i, *j;
1131 struct ospf6 *o = ospf6;
1132 struct ospf6_area *oa;
1133 struct ospf6_interface *oi;
1134 u_int16_t type = 0;
1135 u_int32_t id = 0;
1136 u_int32_t adv_router = 0;
1138 OSPF6_CMD_CHECK_RUNNING ();
1140 type = parse_type_spec (argc, argv);
1141 argc--;
1142 argv++;
1144 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1146 vty_out (vty, "Advertising Router is not parsable: %s%s",
1147 argv[0], VNL);
1148 return CMD_SUCCESS;
1151 argc--;
1152 argv++;
1154 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1156 vty_out (vty, "Link state ID is not parsable: %s%s",
1157 argv[0], VNL);
1158 return CMD_SUCCESS;
1161 argc--;
1162 argv++;
1163 level = parse_show_level (argc, argv);
1165 switch (OSPF6_LSA_SCOPE (type))
1167 case OSPF6_SCOPE_AREA:
1168 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1170 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1171 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1173 break;
1175 case OSPF6_SCOPE_LINKLOCAL:
1176 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1178 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1180 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1181 oi->interface->name, oa->name, VNL, VNL);
1182 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1185 break;
1187 case OSPF6_SCOPE_AS:
1188 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1189 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1190 break;
1192 default:
1193 assert (0);
1194 break;
1197 vty_out (vty, "%s", VNL);
1198 return CMD_SUCCESS;
1201 ALIAS (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1202 show_ipv6_ospf6_database_type_adv_router_linkstate_id_detail_cmd,
1203 "show ipv6 ospf6 database "
1204 "(router|network|inter-prefix|inter-router|as-external|"
1205 "group-membership|type-7|link|intra-prefix) "
1206 "adv-router A.B.C.D linkstate-id A.B.C.D "
1207 "(dump|internal)",
1208 SHOW_STR
1209 IPV6_STR
1210 OSPF6_STR
1211 "Display Link state database\n"
1212 "Display Router LSAs\n"
1213 "Display Network LSAs\n"
1214 "Display Inter-Area-Prefix LSAs\n"
1215 "Display Inter-Area-Router LSAs\n"
1216 "Display As-External LSAs\n"
1217 "Display Group-Membership LSAs\n"
1218 "Display Type-7 LSAs\n"
1219 "Display Link LSAs\n"
1220 "Display Intra-Area-Prefix LSAs\n"
1221 "Search by Advertising Router\n"
1222 "Specify Advertising Router as IPv4 address notation\n"
1223 "Search by Link state ID\n"
1224 "Specify Link state ID as IPv4 address notation\n"
1225 "Dump LSAs\n"
1226 "Display LSA's internal information\n"
1229 DEFUN (show_ipv6_ospf6_database_self_originated,
1230 show_ipv6_ospf6_database_self_originated_cmd,
1231 "show ipv6 ospf6 database self-originated",
1232 SHOW_STR
1233 IPV6_STR
1234 OSPF6_STR
1235 "Display Self-originated LSAs\n"
1238 int level;
1239 struct listnode *i, *j;
1240 struct ospf6 *o = ospf6;
1241 struct ospf6_area *oa;
1242 struct ospf6_interface *oi;
1243 u_int32_t adv_router = 0;
1245 OSPF6_CMD_CHECK_RUNNING ();
1247 level = parse_show_level (argc, argv);
1249 adv_router = o->router_id;
1251 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1253 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1254 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
1257 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1259 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1261 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1262 oi->interface->name, oa->name, VNL, VNL);
1263 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
1267 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1268 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
1270 vty_out (vty, "%s", VNL);
1271 return CMD_SUCCESS;
1274 ALIAS (show_ipv6_ospf6_database_self_originated,
1275 show_ipv6_ospf6_database_self_originated_detail_cmd,
1276 "show ipv6 ospf6 database self-originated "
1277 "(detail|dump|internal)",
1278 SHOW_STR
1279 IPV6_STR
1280 OSPF6_STR
1281 "Display Self-originated LSAs\n"
1282 "Display details of LSAs\n"
1283 "Dump LSAs\n"
1284 "Display LSA's internal information\n"
1287 DEFUN (show_ipv6_ospf6_database_type_self_originated,
1288 show_ipv6_ospf6_database_type_self_originated_cmd,
1289 "show ipv6 ospf6 database "
1290 "(router|network|inter-prefix|inter-router|as-external|"
1291 "group-membership|type-7|link|intra-prefix) self-originated",
1292 SHOW_STR
1293 IPV6_STR
1294 OSPF6_STR
1295 "Display Link state database\n"
1296 "Display Router LSAs\n"
1297 "Display Network LSAs\n"
1298 "Display Inter-Area-Prefix LSAs\n"
1299 "Display Inter-Area-Router LSAs\n"
1300 "Display As-External LSAs\n"
1301 "Display Group-Membership LSAs\n"
1302 "Display Type-7 LSAs\n"
1303 "Display Link LSAs\n"
1304 "Display Intra-Area-Prefix LSAs\n"
1305 "Display Self-originated LSAs\n"
1308 int level;
1309 struct listnode *i, *j;
1310 struct ospf6 *o = ospf6;
1311 struct ospf6_area *oa;
1312 struct ospf6_interface *oi;
1313 u_int16_t type = 0;
1314 u_int32_t adv_router = 0;
1316 OSPF6_CMD_CHECK_RUNNING ();
1318 type = parse_type_spec (argc, argv);
1319 argc--;
1320 argv++;
1321 level = parse_show_level (argc, argv);
1323 adv_router = o->router_id;
1325 switch (OSPF6_LSA_SCOPE (type))
1327 case OSPF6_SCOPE_AREA:
1328 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1330 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1331 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
1333 break;
1335 case OSPF6_SCOPE_LINKLOCAL:
1336 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1338 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1340 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1341 oi->interface->name, oa->name, VNL, VNL);
1342 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
1345 break;
1347 case OSPF6_SCOPE_AS:
1348 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1349 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
1350 break;
1352 default:
1353 assert (0);
1354 break;
1357 vty_out (vty, "%s", VNL);
1358 return CMD_SUCCESS;
1361 ALIAS (show_ipv6_ospf6_database_type_self_originated,
1362 show_ipv6_ospf6_database_type_self_originated_detail_cmd,
1363 "show ipv6 ospf6 database "
1364 "(router|network|inter-prefix|inter-router|as-external|"
1365 "group-membership|type-7|link|intra-prefix) self-originated "
1366 "(detail|dump|internal)",
1367 SHOW_STR
1368 IPV6_STR
1369 OSPF6_STR
1370 "Display Link state database\n"
1371 "Display Router LSAs\n"
1372 "Display Network LSAs\n"
1373 "Display Inter-Area-Prefix LSAs\n"
1374 "Display Inter-Area-Router LSAs\n"
1375 "Display As-External LSAs\n"
1376 "Display Group-Membership LSAs\n"
1377 "Display Type-7 LSAs\n"
1378 "Display Link LSAs\n"
1379 "Display Intra-Area-Prefix LSAs\n"
1380 "Display Self-originated LSAs\n"
1381 "Display details of LSAs\n"
1382 "Dump LSAs\n"
1383 "Display LSA's internal information\n"
1386 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1387 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
1388 "show ipv6 ospf6 database "
1389 "(router|network|inter-prefix|inter-router|as-external|"
1390 "group-membership|type-7|link|intra-prefix) self-originated "
1391 "linkstate-id A.B.C.D",
1392 SHOW_STR
1393 IPV6_STR
1394 OSPF6_STR
1395 "Display Link state database\n"
1396 "Display Router LSAs\n"
1397 "Display Network LSAs\n"
1398 "Display Inter-Area-Prefix LSAs\n"
1399 "Display Inter-Area-Router LSAs\n"
1400 "Display As-External LSAs\n"
1401 "Display Group-Membership LSAs\n"
1402 "Display Type-7 LSAs\n"
1403 "Display Link LSAs\n"
1404 "Display Intra-Area-Prefix LSAs\n"
1405 "Display Self-originated LSAs\n"
1406 "Search by Link state ID\n"
1407 "Specify Link state ID as IPv4 address notation\n"
1410 int level;
1411 struct listnode *i, *j;
1412 struct ospf6 *o = ospf6;
1413 struct ospf6_area *oa;
1414 struct ospf6_interface *oi;
1415 u_int16_t type = 0;
1416 u_int32_t adv_router = 0;
1417 u_int32_t id = 0;
1419 OSPF6_CMD_CHECK_RUNNING ();
1421 type = parse_type_spec (argc, argv);
1422 argc--;
1423 argv++;
1425 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1427 vty_out (vty, "Link State ID is not parsable: %s%s",
1428 argv[0], VNL);
1429 return CMD_SUCCESS;
1432 argc--;
1433 argv++;
1434 level = parse_show_level (argc, argv);
1436 adv_router = o->router_id;
1438 switch (OSPF6_LSA_SCOPE (type))
1440 case OSPF6_SCOPE_AREA:
1441 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1443 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1444 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1446 break;
1448 case OSPF6_SCOPE_LINKLOCAL:
1449 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1451 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1453 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1454 oi->interface->name, oa->name, VNL, VNL);
1455 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1458 break;
1460 case OSPF6_SCOPE_AS:
1461 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1462 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1463 break;
1465 default:
1466 assert (0);
1467 break;
1470 vty_out (vty, "%s", VNL);
1471 return CMD_SUCCESS;
1474 ALIAS (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1475 show_ipv6_ospf6_database_type_self_originated_linkstate_id_detail_cmd,
1476 "show ipv6 ospf6 database "
1477 "(router|network|inter-prefix|inter-router|as-external|"
1478 "group-membership|type-7|link|intra-prefix) self-originated "
1479 "linkstate-id A.B.C.D (detail|dump|internal)",
1480 SHOW_STR
1481 IPV6_STR
1482 OSPF6_STR
1483 "Display Link state database\n"
1484 "Display Router LSAs\n"
1485 "Display Network LSAs\n"
1486 "Display Inter-Area-Prefix LSAs\n"
1487 "Display Inter-Area-Router LSAs\n"
1488 "Display As-External LSAs\n"
1489 "Display Group-Membership LSAs\n"
1490 "Display Type-7 LSAs\n"
1491 "Display Link LSAs\n"
1492 "Display Intra-Area-Prefix LSAs\n"
1493 "Display Self-originated LSAs\n"
1494 "Search by Link state ID\n"
1495 "Specify Link state ID as IPv4 address notation\n"
1496 "Display details of LSAs\n"
1497 "Dump LSAs\n"
1498 "Display LSA's internal information\n"
1501 DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
1502 show_ipv6_ospf6_database_type_id_self_originated_cmd,
1503 "show ipv6 ospf6 database "
1504 "(router|network|inter-prefix|inter-router|as-external|"
1505 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated",
1506 SHOW_STR
1507 IPV6_STR
1508 OSPF6_STR
1509 "Display Link state database\n"
1510 "Display Router LSAs\n"
1511 "Display Network LSAs\n"
1512 "Display Inter-Area-Prefix LSAs\n"
1513 "Display Inter-Area-Router LSAs\n"
1514 "Display As-External LSAs\n"
1515 "Display Group-Membership LSAs\n"
1516 "Display Type-7 LSAs\n"
1517 "Display Link LSAs\n"
1518 "Display Intra-Area-Prefix LSAs\n"
1519 "Specify Link state ID as IPv4 address notation\n"
1520 "Display Self-originated LSAs\n"
1523 int level;
1524 struct listnode *i, *j;
1525 struct ospf6 *o = ospf6;
1526 struct ospf6_area *oa;
1527 struct ospf6_interface *oi;
1528 u_int16_t type = 0;
1529 u_int32_t adv_router = 0;
1530 u_int32_t id = 0;
1532 OSPF6_CMD_CHECK_RUNNING ();
1534 type = parse_type_spec (argc, argv);
1535 argc--;
1536 argv++;
1538 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1540 vty_out (vty, "Link State ID is not parsable: %s%s",
1541 argv[0], VNL);
1542 return CMD_SUCCESS;
1545 argc--;
1546 argv++;
1547 level = parse_show_level (argc, argv);
1549 adv_router = o->router_id;
1551 switch (OSPF6_LSA_SCOPE (type))
1553 case OSPF6_SCOPE_AREA:
1554 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1556 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1557 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1559 break;
1561 case OSPF6_SCOPE_LINKLOCAL:
1562 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1564 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1566 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1567 oi->interface->name, oa->name, VNL, VNL);
1568 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1571 break;
1573 case OSPF6_SCOPE_AS:
1574 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1575 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1576 break;
1578 default:
1579 assert (0);
1580 break;
1583 vty_out (vty, "%s", VNL);
1584 return CMD_SUCCESS;
1587 ALIAS (show_ipv6_ospf6_database_type_id_self_originated,
1588 show_ipv6_ospf6_database_type_id_self_originated_detail_cmd,
1589 "show ipv6 ospf6 database "
1590 "(router|network|inter-prefix|inter-router|as-external|"
1591 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated "
1592 "(detail|dump|internal)",
1593 SHOW_STR
1594 IPV6_STR
1595 OSPF6_STR
1596 "Display Link state database\n"
1597 "Display Router LSAs\n"
1598 "Display Network LSAs\n"
1599 "Display Inter-Area-Prefix LSAs\n"
1600 "Display Inter-Area-Router LSAs\n"
1601 "Display As-External LSAs\n"
1602 "Display Group-Membership LSAs\n"
1603 "Display Type-7 LSAs\n"
1604 "Display Link LSAs\n"
1605 "Display Intra-Area-Prefix LSAs\n"
1606 "Display Self-originated LSAs\n"
1607 "Search by Link state ID\n"
1608 "Specify Link state ID as IPv4 address notation\n"
1609 "Display details of LSAs\n"
1610 "Dump LSAs\n"
1611 "Display LSA's internal information\n"
1615 DEFUN (show_ipv6_ospf6_border_routers,
1616 show_ipv6_ospf6_border_routers_cmd,
1617 "show ipv6 ospf6 border-routers",
1618 SHOW_STR
1619 IP6_STR
1620 OSPF6_STR
1621 "Display routing table for ABR and ASBR\n"
1624 u_int32_t adv_router;
1625 void (*showfunc) (struct vty *, struct ospf6_route *);
1626 struct ospf6_route *ro;
1627 struct prefix prefix;
1629 OSPF6_CMD_CHECK_RUNNING ();
1631 if (argc && ! strcmp ("detail", argv[0]))
1633 showfunc = ospf6_route_show_detail;
1634 argc--;
1635 argv++;
1637 else
1638 showfunc = ospf6_brouter_show;
1640 if (argc)
1642 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1644 vty_out (vty, "Router ID is not parsable: %s%s", argv[0], VNL);
1645 return CMD_SUCCESS;
1648 ospf6_linkstate_prefix (adv_router, 0, &prefix);
1649 ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
1650 if (!ro)
1652 vty_out (vty, "No Route found for Router ID: %s%s", argv[0], VNL);
1653 return CMD_SUCCESS;
1656 ospf6_route_show_detail (vty, ro);
1657 return CMD_SUCCESS;
1660 if (showfunc == ospf6_brouter_show)
1661 ospf6_brouter_show_header (vty);
1663 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1664 ro = ospf6_route_next (ro))
1665 (*showfunc) (vty, ro);
1667 return CMD_SUCCESS;
1670 ALIAS (show_ipv6_ospf6_border_routers,
1671 show_ipv6_ospf6_border_routers_detail_cmd,
1672 "show ipv6 ospf6 border-routers (A.B.C.D|detail)",
1673 SHOW_STR
1674 IP6_STR
1675 OSPF6_STR
1676 "Display routing table for ABR and ASBR\n"
1677 "Specify Router-ID\n"
1678 "Display Detail\n"
1681 DEFUN (show_ipv6_ospf6_linkstate,
1682 show_ipv6_ospf6_linkstate_cmd,
1683 "show ipv6 ospf6 linkstate",
1684 SHOW_STR
1685 IP6_STR
1686 OSPF6_STR
1687 "Display linkstate routing table\n"
1690 struct listnode *node;
1691 struct ospf6_area *oa;
1693 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
1695 vty_out (vty, "%s SPF Result in Area %s%s%s",
1696 VNL, oa->name, VNL, VNL);
1697 ospf6_linkstate_table_show (vty, argc, argv, oa->spf_table);
1700 vty_out (vty, "%s", VNL);
1701 return CMD_SUCCESS;
1704 ALIAS (show_ipv6_ospf6_linkstate,
1705 show_ipv6_ospf6_linkstate_router_cmd,
1706 "show ipv6 ospf6 linkstate router A.B.C.D",
1707 SHOW_STR
1708 IP6_STR
1709 OSPF6_STR
1710 "Display linkstate routing table\n"
1711 "Display Router Entry\n"
1712 "Specify Router ID as IPv4 address notation\n"
1715 ALIAS (show_ipv6_ospf6_linkstate,
1716 show_ipv6_ospf6_linkstate_network_cmd,
1717 "show ipv6 ospf6 linkstate network A.B.C.D A.B.C.D",
1718 SHOW_STR
1719 IP6_STR
1720 OSPF6_STR
1721 "Display linkstate routing table\n"
1722 "Display Network Entry\n"
1723 "Specify Router ID as IPv4 address notation\n"
1724 "Specify Link state ID as IPv4 address notation\n"
1727 DEFUN (show_ipv6_ospf6_linkstate_detail,
1728 show_ipv6_ospf6_linkstate_detail_cmd,
1729 "show ipv6 ospf6 linkstate detail",
1730 SHOW_STR
1731 IP6_STR
1732 OSPF6_STR
1733 "Display linkstate routing table\n"
1736 const char *sargv[CMD_ARGC_MAX];
1737 int i, sargc;
1738 struct listnode *node;
1739 struct ospf6_area *oa;
1741 /* copy argv to sargv and then append "detail" */
1742 for (i = 0; i < argc; i++)
1743 sargv[i] = argv[i];
1744 sargc = argc;
1745 sargv[sargc++] = "detail";
1746 sargv[sargc] = NULL;
1748 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
1750 vty_out (vty, "%s SPF Result in Area %s%s%s",
1751 VNL, oa->name, VNL, VNL);
1752 ospf6_linkstate_table_show (vty, sargc, sargv, oa->spf_table);
1755 vty_out (vty, "%s", VNL);
1756 return CMD_SUCCESS;
1759 /* Install ospf related commands. */
1760 void
1761 ospf6_init (void)
1763 ospf6_top_init ();
1764 ospf6_area_init ();
1765 ospf6_interface_init ();
1766 ospf6_neighbor_init ();
1767 ospf6_zebra_init ();
1769 ospf6_lsa_init ();
1770 ospf6_spf_init ();
1771 ospf6_intra_init ();
1772 ospf6_asbr_init ();
1773 ospf6_abr_init ();
1775 #ifdef HAVE_SNMP
1776 ospf6_snmp_init (master);
1777 #endif /*HAVE_SNMP*/
1779 install_node (&debug_node, config_write_ospf6_debug);
1781 install_element_ospf6_debug_message ();
1782 install_element_ospf6_debug_lsa ();
1783 install_element_ospf6_debug_interface ();
1784 install_element_ospf6_debug_neighbor ();
1785 install_element_ospf6_debug_zebra ();
1786 install_element_ospf6_debug_spf ();
1787 install_element_ospf6_debug_route ();
1788 install_element_ospf6_debug_brouter ();
1789 install_element_ospf6_debug_asbr ();
1790 install_element_ospf6_debug_abr ();
1791 install_element_ospf6_debug_flood ();
1793 install_element (VIEW_NODE, &show_version_ospf6_cmd);
1794 install_element (ENABLE_NODE, &show_version_ospf6_cmd);
1796 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
1797 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1798 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_cmd);
1799 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1801 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd);
1802 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_router_cmd);
1803 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_network_cmd);
1804 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
1805 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_cmd);
1806 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_router_cmd);
1807 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_network_cmd);
1808 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
1810 #define INSTALL(n,c) \
1811 install_element (n ## _NODE, &show_ipv6_ospf6_ ## c)
1813 INSTALL (VIEW, database_cmd);
1814 INSTALL (VIEW, database_detail_cmd);
1815 INSTALL (VIEW, database_type_cmd);
1816 INSTALL (VIEW, database_type_detail_cmd);
1817 INSTALL (VIEW, database_id_cmd);
1818 INSTALL (VIEW, database_id_detail_cmd);
1819 INSTALL (VIEW, database_linkstate_id_cmd);
1820 INSTALL (VIEW, database_linkstate_id_detail_cmd);
1821 INSTALL (VIEW, database_router_cmd);
1822 INSTALL (VIEW, database_router_detail_cmd);
1823 INSTALL (VIEW, database_adv_router_cmd);
1824 INSTALL (VIEW, database_adv_router_detail_cmd);
1825 INSTALL (VIEW, database_type_id_cmd);
1826 INSTALL (VIEW, database_type_id_detail_cmd);
1827 INSTALL (VIEW, database_type_linkstate_id_cmd);
1828 INSTALL (VIEW, database_type_linkstate_id_detail_cmd);
1829 INSTALL (VIEW, database_type_router_cmd);
1830 INSTALL (VIEW, database_type_router_detail_cmd);
1831 INSTALL (VIEW, database_type_adv_router_cmd);
1832 INSTALL (VIEW, database_type_adv_router_detail_cmd);
1833 INSTALL (VIEW, database_adv_router_linkstate_id_cmd);
1834 INSTALL (VIEW, database_adv_router_linkstate_id_detail_cmd);
1835 INSTALL (VIEW, database_id_router_cmd);
1836 INSTALL (VIEW, database_id_router_detail_cmd);
1837 INSTALL (VIEW, database_type_id_router_cmd);
1838 INSTALL (VIEW, database_type_id_router_detail_cmd);
1839 INSTALL (VIEW, database_type_adv_router_linkstate_id_cmd);
1840 INSTALL (VIEW, database_type_adv_router_linkstate_id_detail_cmd);
1841 INSTALL (VIEW, database_self_originated_cmd);
1842 INSTALL (VIEW, database_self_originated_detail_cmd);
1843 INSTALL (VIEW, database_type_self_originated_cmd);
1844 INSTALL (VIEW, database_type_self_originated_detail_cmd);
1845 INSTALL (VIEW, database_type_id_self_originated_cmd);
1846 INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
1847 INSTALL (VIEW, database_type_self_originated_linkstate_id_cmd);
1848 INSTALL (VIEW, database_type_self_originated_linkstate_id_detail_cmd);
1850 INSTALL (ENABLE, database_cmd);
1851 INSTALL (ENABLE, database_detail_cmd);
1852 INSTALL (ENABLE, database_type_cmd);
1853 INSTALL (ENABLE, database_type_detail_cmd);
1854 INSTALL (ENABLE, database_id_cmd);
1855 INSTALL (ENABLE, database_id_detail_cmd);
1856 INSTALL (ENABLE, database_linkstate_id_cmd);
1857 INSTALL (ENABLE, database_linkstate_id_detail_cmd);
1858 INSTALL (ENABLE, database_router_cmd);
1859 INSTALL (ENABLE, database_router_detail_cmd);
1860 INSTALL (ENABLE, database_adv_router_cmd);
1861 INSTALL (ENABLE, database_adv_router_detail_cmd);
1862 INSTALL (ENABLE, database_type_id_cmd);
1863 INSTALL (ENABLE, database_type_id_detail_cmd);
1864 INSTALL (ENABLE, database_type_linkstate_id_cmd);
1865 INSTALL (ENABLE, database_type_linkstate_id_detail_cmd);
1866 INSTALL (ENABLE, database_type_router_cmd);
1867 INSTALL (ENABLE, database_type_router_detail_cmd);
1868 INSTALL (ENABLE, database_type_adv_router_cmd);
1869 INSTALL (ENABLE, database_type_adv_router_detail_cmd);
1870 INSTALL (ENABLE, database_adv_router_linkstate_id_cmd);
1871 INSTALL (ENABLE, database_adv_router_linkstate_id_detail_cmd);
1872 INSTALL (ENABLE, database_id_router_cmd);
1873 INSTALL (ENABLE, database_id_router_detail_cmd);
1874 INSTALL (ENABLE, database_type_id_router_cmd);
1875 INSTALL (ENABLE, database_type_id_router_detail_cmd);
1876 INSTALL (ENABLE, database_type_adv_router_linkstate_id_cmd);
1877 INSTALL (ENABLE, database_type_adv_router_linkstate_id_detail_cmd);
1878 INSTALL (ENABLE, database_self_originated_cmd);
1879 INSTALL (ENABLE, database_self_originated_detail_cmd);
1880 INSTALL (ENABLE, database_type_self_originated_cmd);
1881 INSTALL (ENABLE, database_type_self_originated_detail_cmd);
1882 INSTALL (ENABLE, database_type_id_self_originated_cmd);
1883 INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
1884 INSTALL (ENABLE, database_type_self_originated_linkstate_id_cmd);
1885 INSTALL (ENABLE, database_type_self_originated_linkstate_id_detail_cmd);
1887 /* Make ospf protocol socket. */
1888 ospf6_serv_sock ();
1889 thread_add_read (master, ospf6_receive, NULL, ospf6_sock);