+ sayonara old_pid!
[jleu-quagga.git] / ospf6d / ospf6d.c
blob3c84fe658329d7442702fccd098e8216c4fc0af3
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 void
54 ospf6_debug ()
58 struct route_node *
59 route_prev (struct route_node *node)
61 struct route_node *end;
62 struct route_node *prev = NULL;
64 end = node;
65 node = node->parent;
66 if (node)
67 route_lock_node (node);
68 while (node)
70 prev = node;
71 node = route_next (node);
72 if (node == end)
74 route_unlock_node (node);
75 node = NULL;
78 route_unlock_node (end);
79 if (prev)
80 route_lock_node (prev);
82 return prev;
86 /* show database functions */
87 DEFUN (show_version_ospf6,
88 show_version_ospf6_cmd,
89 "show version ospf6",
90 SHOW_STR
91 "Displays ospf6d version\n"
94 vty_out (vty, "Zebra OSPF6d Version: %s%s",
95 ospf6_daemon_version, VNL);
97 return CMD_SUCCESS;
100 struct cmd_node debug_node =
102 DEBUG_NODE,
104 1 /* VTYSH */
108 config_write_ospf6_debug (struct vty *vty)
110 config_write_ospf6_debug_message (vty);
111 config_write_ospf6_debug_lsa (vty);
112 config_write_ospf6_debug_zebra (vty);
113 config_write_ospf6_debug_interface (vty);
114 config_write_ospf6_debug_neighbor (vty);
115 config_write_ospf6_debug_spf (vty);
116 config_write_ospf6_debug_route (vty);
117 config_write_ospf6_debug_brouter (vty);
118 config_write_ospf6_debug_asbr (vty);
119 config_write_ospf6_debug_abr (vty);
120 config_write_ospf6_debug_flood (vty);
121 vty_out (vty, "!%s", VNL);
122 return 0;
125 #define AREA_LSDB_TITLE_FORMAT \
126 "%s Area Scoped Link State Database (Area %s)%s%s"
127 #define IF_LSDB_TITLE_FORMAT \
128 "%s I/F Scoped Link State Database (I/F %s in Area %s)%s%s"
129 #define AS_LSDB_TITLE_FORMAT \
130 "%s AS Scoped Link State Database%s%s"
132 static int
133 parse_show_level (int argc, const char *argv[])
135 int level = 0;
136 if (argc)
138 if (! strncmp (argv[0], "de", 2))
139 level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;
140 else if (! strncmp (argv[0], "du", 2))
141 level = OSPF6_LSDB_SHOW_LEVEL_DUMP;
142 else if (! strncmp (argv[0], "in", 2))
143 level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL;
145 else
146 level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
147 return level;
150 static u_int16_t
151 parse_type_spec (int argc, const char *argv[])
153 u_int16_t type = 0;
154 assert (argc);
155 if (! strcmp (argv[0], "router"))
156 type = htons (OSPF6_LSTYPE_ROUTER);
157 else if (! strcmp (argv[0], "network"))
158 type = htons (OSPF6_LSTYPE_NETWORK);
159 else if (! strcmp (argv[0], "as-external"))
160 type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
161 else if (! strcmp (argv[0], "intra-prefix"))
162 type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
163 else if (! strcmp (argv[0], "inter-router"))
164 type = htons (OSPF6_LSTYPE_INTER_ROUTER);
165 else if (! strcmp (argv[0], "inter-prefix"))
166 type = htons (OSPF6_LSTYPE_INTER_PREFIX);
167 else if (! strcmp (argv[0], "link"))
168 type = htons (OSPF6_LSTYPE_LINK);
169 return type;
172 DEFUN (show_ipv6_ospf6_database,
173 show_ipv6_ospf6_database_cmd,
174 "show ipv6 ospf6 database",
175 SHOW_STR
176 IPV6_STR
177 OSPF6_STR
178 "Display Link state database\n"
181 int level;
182 struct listnode *i, *j;
183 struct ospf6 *o = ospf6;
184 struct ospf6_area *oa;
185 struct ospf6_interface *oi;
187 OSPF6_CMD_CHECK_RUNNING ();
189 level = parse_show_level (argc, argv);
191 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
193 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
194 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oa->lsdb);
197 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
199 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
201 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
202 oi->interface->name, oa->name, VNL, VNL);
203 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oi->lsdb);
207 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
208 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, o->lsdb);
210 vty_out (vty, "%s", VNL);
211 return CMD_SUCCESS;
214 ALIAS (show_ipv6_ospf6_database,
215 show_ipv6_ospf6_database_detail_cmd,
216 "show ipv6 ospf6 database (detail|dump|internal)",
217 SHOW_STR
218 IPV6_STR
219 OSPF6_STR
220 "Display Link state database\n"
221 "Display details of LSAs\n"
222 "Dump LSAs\n"
223 "Display LSA's internal information\n"
226 DEFUN (show_ipv6_ospf6_database_type,
227 show_ipv6_ospf6_database_type_cmd,
228 "show ipv6 ospf6 database "
229 "(router|network|inter-prefix|inter-router|as-external|"
230 "group-membership|type-7|link|intra-prefix)",
231 SHOW_STR
232 IPV6_STR
233 OSPF6_STR
234 "Display Link state database\n"
235 "Display Router LSAs\n"
236 "Display Network LSAs\n"
237 "Display Inter-Area-Prefix LSAs\n"
238 "Display Inter-Area-Router LSAs\n"
239 "Display As-External LSAs\n"
240 "Display Group-Membership LSAs\n"
241 "Display Type-7 LSAs\n"
242 "Display Link LSAs\n"
243 "Display Intra-Area-Prefix LSAs\n"
246 int level;
247 struct listnode *i, *j;
248 struct ospf6 *o = ospf6;
249 struct ospf6_area *oa;
250 struct ospf6_interface *oi;
251 u_int16_t type = 0;
253 OSPF6_CMD_CHECK_RUNNING ();
255 type = parse_type_spec (argc, argv);
256 argc--;
257 argv++;
258 level = parse_show_level (argc, argv);
260 switch (OSPF6_LSA_SCOPE (type))
262 case OSPF6_SCOPE_AREA:
263 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
265 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
266 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oa->lsdb);
268 break;
270 case OSPF6_SCOPE_LINKLOCAL:
271 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
273 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
275 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
276 oi->interface->name, oa->name, VNL, VNL);
277 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oi->lsdb);
280 break;
282 case OSPF6_SCOPE_AS:
283 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
284 ospf6_lsdb_show (vty, level, &type, NULL, NULL, o->lsdb);
285 break;
287 default:
288 assert (0);
289 break;
292 vty_out (vty, "%s", VNL);
293 return CMD_SUCCESS;
296 ALIAS (show_ipv6_ospf6_database_type,
297 show_ipv6_ospf6_database_type_detail_cmd,
298 "show ipv6 ospf6 database "
299 "(router|network|inter-prefix|inter-router|as-external|"
300 "group-membership|type-7|link|intra-prefix) "
301 "(detail|dump|internal)",
302 SHOW_STR
303 IPV6_STR
304 OSPF6_STR
305 "Display Link state database\n"
306 "Display Router LSAs\n"
307 "Display Network LSAs\n"
308 "Display Inter-Area-Prefix LSAs\n"
309 "Display Inter-Area-Router LSAs\n"
310 "Display As-External LSAs\n"
311 "Display Group-Membership LSAs\n"
312 "Display Type-7 LSAs\n"
313 "Display Link LSAs\n"
314 "Display Intra-Area-Prefix LSAs\n"
315 "Display details of LSAs\n"
316 "Dump LSAs\n"
317 "Display LSA's internal information\n"
320 DEFUN (show_ipv6_ospf6_database_id,
321 show_ipv6_ospf6_database_id_cmd,
322 "show ipv6 ospf6 database * A.B.C.D",
323 SHOW_STR
324 IPV6_STR
325 OSPF6_STR
326 "Display Link state database\n"
327 "Any Link state Type\n"
328 "Specify Link state ID as IPv4 address notation\n"
331 int level;
332 struct listnode *i, *j;
333 struct ospf6 *o = ospf6;
334 struct ospf6_area *oa;
335 struct ospf6_interface *oi;
336 u_int32_t id = 0;
338 OSPF6_CMD_CHECK_RUNNING ();
340 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
342 vty_out (vty, "Link State ID is not parsable: %s%s",
343 argv[0], VNL);
344 return CMD_SUCCESS;
347 argc--;
348 argv++;
349 level = parse_show_level (argc, argv);
351 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
353 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
354 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oa->lsdb);
357 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
359 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
361 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
362 oi->interface->name, oa->name, VNL, VNL);
363 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oi->lsdb);
367 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
368 ospf6_lsdb_show (vty, level, NULL, &id, NULL, o->lsdb);
370 vty_out (vty, "%s", VNL);
371 return CMD_SUCCESS;
374 ALIAS (show_ipv6_ospf6_database_id,
375 show_ipv6_ospf6_database_id_detail_cmd,
376 "show ipv6 ospf6 database * A.B.C.D "
377 "(detail|dump|internal)",
378 SHOW_STR
379 IPV6_STR
380 OSPF6_STR
381 "Display Link state database\n"
382 "Any Link state Type\n"
383 "Specify Link state ID as IPv4 address notation\n"
384 "Display details of LSAs\n"
385 "Dump LSAs\n"
386 "Display LSA's internal information\n"
389 ALIAS (show_ipv6_ospf6_database_id,
390 show_ipv6_ospf6_database_linkstate_id_cmd,
391 "show ipv6 ospf6 database linkstate-id A.B.C.D",
392 SHOW_STR
393 IPV6_STR
394 OSPF6_STR
395 "Display Link state database\n"
396 "Search by Link state ID\n"
397 "Specify Link state ID as IPv4 address notation\n"
400 ALIAS (show_ipv6_ospf6_database_id,
401 show_ipv6_ospf6_database_linkstate_id_detail_cmd,
402 "show ipv6 ospf6 database linkstate-id A.B.C.D "
403 "(detail|dump|internal)",
404 SHOW_STR
405 IPV6_STR
406 OSPF6_STR
407 "Display Link state database\n"
408 "Search by Link state ID\n"
409 "Specify Link state ID as IPv4 address notation\n"
410 "Display details of LSAs\n"
411 "Dump LSAs\n"
412 "Display LSA's internal information\n"
415 DEFUN (show_ipv6_ospf6_database_router,
416 show_ipv6_ospf6_database_router_cmd,
417 "show ipv6 ospf6 database * * A.B.C.D",
418 SHOW_STR
419 IPV6_STR
420 OSPF6_STR
421 "Display Link state database\n"
422 "Any Link state Type\n"
423 "Any Link state ID\n"
424 "Specify Advertising Router as IPv4 address notation\n"
427 int level;
428 struct listnode *i, *j;
429 struct ospf6 *o = ospf6;
430 struct ospf6_area *oa;
431 struct ospf6_interface *oi;
432 u_int32_t adv_router = 0;
434 OSPF6_CMD_CHECK_RUNNING ();
436 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
438 vty_out (vty, "Advertising Router is not parsable: %s%s",
439 argv[0], VNL);
440 return CMD_SUCCESS;
443 argc--;
444 argv++;
445 level = parse_show_level (argc, argv);
447 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
449 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
450 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
453 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
455 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
457 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
458 oi->interface->name, oa->name, VNL, VNL);
459 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
463 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
464 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
466 vty_out (vty, "%s", VNL);
467 return CMD_SUCCESS;
470 ALIAS (show_ipv6_ospf6_database_router,
471 show_ipv6_ospf6_database_router_detail_cmd,
472 "show ipv6 ospf6 database * * A.B.C.D "
473 "(detail|dump|internal)",
474 SHOW_STR
475 IPV6_STR
476 OSPF6_STR
477 "Display Link state database\n"
478 "Any Link state Type\n"
479 "Any Link state ID\n"
480 "Specify Advertising Router as IPv4 address notation\n"
481 "Display details of LSAs\n"
482 "Dump LSAs\n"
483 "Display LSA's internal information\n"
486 ALIAS (show_ipv6_ospf6_database_router,
487 show_ipv6_ospf6_database_adv_router_cmd,
488 "show ipv6 ospf6 database adv-router A.B.C.D",
489 SHOW_STR
490 IPV6_STR
491 OSPF6_STR
492 "Display Link state database\n"
493 "Search by Advertising Router\n"
494 "Specify Advertising Router as IPv4 address notation\n"
497 ALIAS (show_ipv6_ospf6_database_router,
498 show_ipv6_ospf6_database_adv_router_detail_cmd,
499 "show ipv6 ospf6 database adv-router A.B.C.D "
500 "(detail|dump|internal)",
501 SHOW_STR
502 IPV6_STR
503 OSPF6_STR
504 "Display Link state database\n"
505 "Search by Advertising Router\n"
506 "Specify Advertising Router as IPv4 address notation\n"
507 "Display details of LSAs\n"
508 "Dump LSAs\n"
509 "Display LSA's internal information\n"
512 DEFUN (show_ipv6_ospf6_database_type_id,
513 show_ipv6_ospf6_database_type_id_cmd,
514 "show ipv6 ospf6 database "
515 "(router|network|inter-prefix|inter-router|as-external|"
516 "group-membership|type-7|link|intra-prefix) A.B.C.D",
517 SHOW_STR
518 IPV6_STR
519 OSPF6_STR
520 "Display Link state database\n"
521 "Display Router LSAs\n"
522 "Display Network LSAs\n"
523 "Display Inter-Area-Prefix LSAs\n"
524 "Display Inter-Area-Router LSAs\n"
525 "Display As-External LSAs\n"
526 "Display Group-Membership LSAs\n"
527 "Display Type-7 LSAs\n"
528 "Display Link LSAs\n"
529 "Display Intra-Area-Prefix LSAs\n"
530 "Specify Link state ID as IPv4 address notation\n"
533 int level;
534 struct listnode *i, *j;
535 struct ospf6 *o = ospf6;
536 struct ospf6_area *oa;
537 struct ospf6_interface *oi;
538 u_int16_t type = 0;
539 u_int32_t id = 0;
541 OSPF6_CMD_CHECK_RUNNING ();
543 type = parse_type_spec (argc, argv);
544 argc--;
545 argv++;
547 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
549 vty_out (vty, "Link state ID is not parsable: %s%s",
550 argv[0], VNL);
551 return CMD_SUCCESS;
554 argc--;
555 argv++;
556 level = parse_show_level (argc, argv);
558 switch (OSPF6_LSA_SCOPE (type))
560 case OSPF6_SCOPE_AREA:
561 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
563 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
564 ospf6_lsdb_show (vty, level, &type, &id, NULL, oa->lsdb);
566 break;
568 case OSPF6_SCOPE_LINKLOCAL:
569 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
571 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
573 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
574 oi->interface->name, oa->name, VNL, VNL);
575 ospf6_lsdb_show (vty, level, &type, &id, NULL, oi->lsdb);
578 break;
580 case OSPF6_SCOPE_AS:
581 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
582 ospf6_lsdb_show (vty, level, &type, &id, NULL, o->lsdb);
583 break;
585 default:
586 assert (0);
587 break;
590 vty_out (vty, "%s", VNL);
591 return CMD_SUCCESS;
594 ALIAS (show_ipv6_ospf6_database_type_id,
595 show_ipv6_ospf6_database_type_id_detail_cmd,
596 "show ipv6 ospf6 database "
597 "(router|network|inter-prefix|inter-router|as-external|"
598 "group-membership|type-7|link|intra-prefix) A.B.C.D "
599 "(detail|dump|internal)",
600 SHOW_STR
601 IPV6_STR
602 OSPF6_STR
603 "Display Link state database\n"
604 "Display Router LSAs\n"
605 "Display Network LSAs\n"
606 "Display Inter-Area-Prefix LSAs\n"
607 "Display Inter-Area-Router LSAs\n"
608 "Display As-External LSAs\n"
609 "Display Group-Membership LSAs\n"
610 "Display Type-7 LSAs\n"
611 "Display Link LSAs\n"
612 "Display Intra-Area-Prefix LSAs\n"
613 "Specify Link state ID as IPv4 address notation\n"
614 "Display details of LSAs\n"
615 "Dump LSAs\n"
616 "Display LSA's internal information\n"
619 ALIAS (show_ipv6_ospf6_database_type_id,
620 show_ipv6_ospf6_database_type_linkstate_id_cmd,
621 "show ipv6 ospf6 database "
622 "(router|network|inter-prefix|inter-router|as-external|"
623 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D",
624 SHOW_STR
625 IPV6_STR
626 OSPF6_STR
627 "Display Link state database\n"
628 "Display Router LSAs\n"
629 "Display Network LSAs\n"
630 "Display Inter-Area-Prefix LSAs\n"
631 "Display Inter-Area-Router LSAs\n"
632 "Display As-External LSAs\n"
633 "Display Group-Membership LSAs\n"
634 "Display Type-7 LSAs\n"
635 "Display Link LSAs\n"
636 "Display Intra-Area-Prefix LSAs\n"
637 "Search by Link state ID\n"
638 "Specify Link state ID as IPv4 address notation\n"
641 ALIAS (show_ipv6_ospf6_database_type_id,
642 show_ipv6_ospf6_database_type_linkstate_id_detail_cmd,
643 "show ipv6 ospf6 database "
644 "(router|network|inter-prefix|inter-router|as-external|"
645 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D "
646 "(detail|dump|internal)",
647 SHOW_STR
648 IPV6_STR
649 OSPF6_STR
650 "Display Link state database\n"
651 "Display Router LSAs\n"
652 "Display Network LSAs\n"
653 "Display Inter-Area-Prefix LSAs\n"
654 "Display Inter-Area-Router LSAs\n"
655 "Display As-External LSAs\n"
656 "Display Group-Membership LSAs\n"
657 "Display Type-7 LSAs\n"
658 "Display Link LSAs\n"
659 "Display Intra-Area-Prefix LSAs\n"
660 "Search by Link state ID\n"
661 "Specify Link state ID as IPv4 address notation\n"
662 "Display details of LSAs\n"
663 "Dump LSAs\n"
664 "Display LSA's internal information\n"
667 DEFUN (show_ipv6_ospf6_database_type_router,
668 show_ipv6_ospf6_database_type_router_cmd,
669 "show ipv6 ospf6 database "
670 "(router|network|inter-prefix|inter-router|as-external|"
671 "group-membership|type-7|link|intra-prefix) * A.B.C.D",
672 SHOW_STR
673 IPV6_STR
674 OSPF6_STR
675 "Display Link state database\n"
676 "Display Router LSAs\n"
677 "Display Network LSAs\n"
678 "Display Inter-Area-Prefix LSAs\n"
679 "Display Inter-Area-Router LSAs\n"
680 "Display As-External LSAs\n"
681 "Display Group-Membership LSAs\n"
682 "Display Type-7 LSAs\n"
683 "Display Link LSAs\n"
684 "Display Intra-Area-Prefix LSAs\n"
685 "Any Link state ID\n"
686 "Specify Advertising Router as IPv4 address notation\n"
689 int level;
690 struct listnode *i, *j;
691 struct ospf6 *o = ospf6;
692 struct ospf6_area *oa;
693 struct ospf6_interface *oi;
694 u_int16_t type = 0;
695 u_int32_t adv_router = 0;
697 OSPF6_CMD_CHECK_RUNNING ();
699 type = parse_type_spec (argc, argv);
700 argc--;
701 argv++;
703 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
705 vty_out (vty, "Advertising Router is not parsable: %s%s",
706 argv[0], VNL);
707 return CMD_SUCCESS;
710 argc--;
711 argv++;
712 level = parse_show_level (argc, argv);
714 switch (OSPF6_LSA_SCOPE (type))
716 case OSPF6_SCOPE_AREA:
717 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
719 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
720 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
722 break;
724 case OSPF6_SCOPE_LINKLOCAL:
725 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
727 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
729 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
730 oi->interface->name, oa->name, VNL, VNL);
731 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
734 break;
736 case OSPF6_SCOPE_AS:
737 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
738 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
739 break;
741 default:
742 assert (0);
743 break;
746 vty_out (vty, "%s", VNL);
747 return CMD_SUCCESS;
750 ALIAS (show_ipv6_ospf6_database_type_router,
751 show_ipv6_ospf6_database_type_router_detail_cmd,
752 "show ipv6 ospf6 database "
753 "(router|network|inter-prefix|inter-router|as-external|"
754 "group-membership|type-7|link|intra-prefix) * A.B.C.D "
755 "(detail|dump|internal)",
756 SHOW_STR
757 IPV6_STR
758 OSPF6_STR
759 "Display Link state database\n"
760 "Display Router LSAs\n"
761 "Display Network LSAs\n"
762 "Display Inter-Area-Prefix LSAs\n"
763 "Display Inter-Area-Router LSAs\n"
764 "Display As-External LSAs\n"
765 "Display Group-Membership LSAs\n"
766 "Display Type-7 LSAs\n"
767 "Display Link LSAs\n"
768 "Display Intra-Area-Prefix LSAs\n"
769 "Any Link state ID\n"
770 "Specify Advertising Router as IPv4 address notation\n"
771 "Display details of LSAs\n"
772 "Dump LSAs\n"
773 "Display LSA's internal information\n"
776 ALIAS (show_ipv6_ospf6_database_type_router,
777 show_ipv6_ospf6_database_type_adv_router_cmd,
778 "show ipv6 ospf6 database "
779 "(router|network|inter-prefix|inter-router|as-external|"
780 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D",
781 SHOW_STR
782 IPV6_STR
783 OSPF6_STR
784 "Display Link state database\n"
785 "Display Router LSAs\n"
786 "Display Network LSAs\n"
787 "Display Inter-Area-Prefix LSAs\n"
788 "Display Inter-Area-Router LSAs\n"
789 "Display As-External LSAs\n"
790 "Display Group-Membership LSAs\n"
791 "Display Type-7 LSAs\n"
792 "Display Link LSAs\n"
793 "Display Intra-Area-Prefix LSAs\n"
794 "Search by Advertising Router\n"
795 "Specify Advertising Router as IPv4 address notation\n"
798 ALIAS (show_ipv6_ospf6_database_type_router,
799 show_ipv6_ospf6_database_type_adv_router_detail_cmd,
800 "show ipv6 ospf6 database "
801 "(router|network|inter-prefix|inter-router|as-external|"
802 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D "
803 "(detail|dump|internal)",
804 SHOW_STR
805 IPV6_STR
806 OSPF6_STR
807 "Display Link state database\n"
808 "Display Router LSAs\n"
809 "Display Network LSAs\n"
810 "Display Inter-Area-Prefix LSAs\n"
811 "Display Inter-Area-Router LSAs\n"
812 "Display As-External LSAs\n"
813 "Display Group-Membership LSAs\n"
814 "Display Type-7 LSAs\n"
815 "Display Link LSAs\n"
816 "Display Intra-Area-Prefix LSAs\n"
817 "Search by Advertising Router\n"
818 "Specify Advertising Router as IPv4 address notation\n"
819 "Display details of LSAs\n"
820 "Dump LSAs\n"
821 "Display LSA's internal information\n"
824 DEFUN (show_ipv6_ospf6_database_id_router,
825 show_ipv6_ospf6_database_id_router_cmd,
826 "show ipv6 ospf6 database * A.B.C.D A.B.C.D",
827 SHOW_STR
828 IPV6_STR
829 OSPF6_STR
830 "Display Link state database\n"
831 "Any Link state Type\n"
832 "Specify Link state ID as IPv4 address notation\n"
833 "Specify Advertising Router as IPv4 address notation\n"
836 int level;
837 struct listnode *i, *j;
838 struct ospf6 *o = ospf6;
839 struct ospf6_area *oa;
840 struct ospf6_interface *oi;
841 u_int32_t id = 0;
842 u_int32_t adv_router = 0;
844 OSPF6_CMD_CHECK_RUNNING ();
846 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
848 vty_out (vty, "Link state ID is not parsable: %s%s",
849 argv[0], VNL);
850 return CMD_SUCCESS;
853 argc--;
854 argv++;
856 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
858 vty_out (vty, "Advertising Router is not parsable: %s%s",
859 argv[0], VNL);
860 return CMD_SUCCESS;
863 argc--;
864 argv++;
865 level = parse_show_level (argc, argv);
867 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
869 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
870 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
873 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
875 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
877 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
878 oi->interface->name, oa->name, VNL, VNL);
879 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
883 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
884 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
886 vty_out (vty, "%s", VNL);
887 return CMD_SUCCESS;
890 ALIAS (show_ipv6_ospf6_database_id_router,
891 show_ipv6_ospf6_database_id_router_detail_cmd,
892 "show ipv6 ospf6 database * A.B.C.D A.B.C.D "
893 "(detail|dump|internal)",
894 SHOW_STR
895 IPV6_STR
896 OSPF6_STR
897 "Display Link state database\n"
898 "Any Link state Type\n"
899 "Specify Link state ID as IPv4 address notation\n"
900 "Specify Advertising Router as IPv4 address notation\n"
901 "Display details of LSAs\n"
902 "Dump LSAs\n"
903 "Display LSA's internal information\n"
906 DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
907 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd,
908 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D",
909 SHOW_STR
910 IPV6_STR
911 OSPF6_STR
912 "Display Link state database\n"
913 "Search by Advertising Router\n"
914 "Specify Advertising Router as IPv4 address notation\n"
915 "Search by Link state ID\n"
916 "Specify Link state ID as IPv4 address notation\n"
919 int level;
920 struct listnode *i, *j;
921 struct ospf6 *o = ospf6;
922 struct ospf6_area *oa;
923 struct ospf6_interface *oi;
924 u_int32_t id = 0;
925 u_int32_t adv_router = 0;
927 OSPF6_CMD_CHECK_RUNNING ();
929 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
931 vty_out (vty, "Advertising Router is not parsable: %s%s",
932 argv[0], VNL);
933 return CMD_SUCCESS;
936 argc--;
937 argv++;
939 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
941 vty_out (vty, "Link state ID is not parsable: %s%s",
942 argv[0], VNL);
943 return CMD_SUCCESS;
946 argc--;
947 argv++;
948 level = parse_show_level (argc, argv);
950 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
952 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
953 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
956 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
958 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
960 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
961 oi->interface->name, oa->name, VNL, VNL);
962 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
966 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
967 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
969 vty_out (vty, "%s", VNL);
970 return CMD_SUCCESS;
973 ALIAS (show_ipv6_ospf6_database_adv_router_linkstate_id,
974 show_ipv6_ospf6_database_adv_router_linkstate_id_detail_cmd,
975 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D "
976 "(detail|dump|internal)",
977 SHOW_STR
978 IPV6_STR
979 OSPF6_STR
980 "Display Link state database\n"
981 "Search by Advertising Router\n"
982 "Specify Advertising Router as IPv4 address notation\n"
983 "Search by Link state ID\n"
984 "Specify Link state ID as IPv4 address notation\n"
985 "Display details of LSAs\n"
986 "Dump LSAs\n"
987 "Display LSA's internal information\n"
990 DEFUN (show_ipv6_ospf6_database_type_id_router,
991 show_ipv6_ospf6_database_type_id_router_cmd,
992 "show ipv6 ospf6 database "
993 "(router|network|inter-prefix|inter-router|as-external|"
994 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D",
995 SHOW_STR
996 IPV6_STR
997 OSPF6_STR
998 "Display Link state database\n"
999 "Display Router LSAs\n"
1000 "Display Network LSAs\n"
1001 "Display Inter-Area-Prefix LSAs\n"
1002 "Display Inter-Area-Router LSAs\n"
1003 "Display As-External LSAs\n"
1004 "Display Group-Membership LSAs\n"
1005 "Display Type-7 LSAs\n"
1006 "Display Link LSAs\n"
1007 "Display Intra-Area-Prefix LSAs\n"
1008 "Specify Link state ID as IPv4 address notation\n"
1009 "Specify Advertising Router as IPv4 address notation\n"
1012 int level;
1013 struct listnode *i, *j;
1014 struct ospf6 *o = ospf6;
1015 struct ospf6_area *oa;
1016 struct ospf6_interface *oi;
1017 u_int16_t type = 0;
1018 u_int32_t id = 0;
1019 u_int32_t adv_router = 0;
1021 OSPF6_CMD_CHECK_RUNNING ();
1023 type = parse_type_spec (argc, argv);
1024 argc--;
1025 argv++;
1027 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1029 vty_out (vty, "Link state ID is not parsable: %s%s",
1030 argv[0], VNL);
1031 return CMD_SUCCESS;
1034 argc--;
1035 argv++;
1037 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1039 vty_out (vty, "Advertising Router is not parsable: %s%s",
1040 argv[0], VNL);
1041 return CMD_SUCCESS;
1044 argc--;
1045 argv++;
1046 level = parse_show_level (argc, argv);
1048 switch (OSPF6_LSA_SCOPE (type))
1050 case OSPF6_SCOPE_AREA:
1051 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1053 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1054 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1056 break;
1058 case OSPF6_SCOPE_LINKLOCAL:
1059 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1061 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1063 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1064 oi->interface->name, oa->name, VNL, VNL);
1065 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1068 break;
1070 case OSPF6_SCOPE_AS:
1071 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1072 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1073 break;
1075 default:
1076 assert (0);
1077 break;
1080 vty_out (vty, "%s", VNL);
1081 return CMD_SUCCESS;
1084 ALIAS (show_ipv6_ospf6_database_type_id_router,
1085 show_ipv6_ospf6_database_type_id_router_detail_cmd,
1086 "show ipv6 ospf6 database "
1087 "(router|network|inter-prefix|inter-router|as-external|"
1088 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D "
1089 "(dump|internal)",
1090 SHOW_STR
1091 IPV6_STR
1092 OSPF6_STR
1093 "Display Link state database\n"
1094 "Display Router LSAs\n"
1095 "Display Network LSAs\n"
1096 "Display Inter-Area-Prefix LSAs\n"
1097 "Display Inter-Area-Router LSAs\n"
1098 "Display As-External LSAs\n"
1099 "Display Group-Membership LSAs\n"
1100 "Display Type-7 LSAs\n"
1101 "Display Link LSAs\n"
1102 "Display Intra-Area-Prefix LSAs\n"
1103 "Specify Link state ID as IPv4 address notation\n"
1104 "Specify Advertising Router as IPv4 address notation\n"
1105 "Dump LSAs\n"
1106 "Display LSA's internal information\n"
1109 DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1110 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd,
1111 "show ipv6 ospf6 database "
1112 "(router|network|inter-prefix|inter-router|as-external|"
1113 "group-membership|type-7|link|intra-prefix) "
1114 "adv-router A.B.C.D linkstate-id A.B.C.D",
1115 SHOW_STR
1116 IPV6_STR
1117 OSPF6_STR
1118 "Display Link state database\n"
1119 "Display Router LSAs\n"
1120 "Display Network LSAs\n"
1121 "Display Inter-Area-Prefix LSAs\n"
1122 "Display Inter-Area-Router LSAs\n"
1123 "Display As-External LSAs\n"
1124 "Display Group-Membership LSAs\n"
1125 "Display Type-7 LSAs\n"
1126 "Display Link LSAs\n"
1127 "Display Intra-Area-Prefix LSAs\n"
1128 "Search by Advertising Router\n"
1129 "Specify Advertising Router as IPv4 address notation\n"
1130 "Search by Link state ID\n"
1131 "Specify Link state ID as IPv4 address notation\n"
1134 int level;
1135 struct listnode *i, *j;
1136 struct ospf6 *o = ospf6;
1137 struct ospf6_area *oa;
1138 struct ospf6_interface *oi;
1139 u_int16_t type = 0;
1140 u_int32_t id = 0;
1141 u_int32_t adv_router = 0;
1143 OSPF6_CMD_CHECK_RUNNING ();
1145 type = parse_type_spec (argc, argv);
1146 argc--;
1147 argv++;
1149 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1151 vty_out (vty, "Advertising Router is not parsable: %s%s",
1152 argv[0], VNL);
1153 return CMD_SUCCESS;
1156 argc--;
1157 argv++;
1159 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1161 vty_out (vty, "Link state ID is not parsable: %s%s",
1162 argv[0], VNL);
1163 return CMD_SUCCESS;
1166 argc--;
1167 argv++;
1168 level = parse_show_level (argc, argv);
1170 switch (OSPF6_LSA_SCOPE (type))
1172 case OSPF6_SCOPE_AREA:
1173 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1175 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1176 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1178 break;
1180 case OSPF6_SCOPE_LINKLOCAL:
1181 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1183 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1185 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1186 oi->interface->name, oa->name, VNL, VNL);
1187 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1190 break;
1192 case OSPF6_SCOPE_AS:
1193 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1194 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1195 break;
1197 default:
1198 assert (0);
1199 break;
1202 vty_out (vty, "%s", VNL);
1203 return CMD_SUCCESS;
1206 ALIAS (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1207 show_ipv6_ospf6_database_type_adv_router_linkstate_id_detail_cmd,
1208 "show ipv6 ospf6 database "
1209 "(router|network|inter-prefix|inter-router|as-external|"
1210 "group-membership|type-7|link|intra-prefix) "
1211 "adv-router A.B.C.D linkstate-id A.B.C.D "
1212 "(dump|internal)",
1213 SHOW_STR
1214 IPV6_STR
1215 OSPF6_STR
1216 "Display Link state database\n"
1217 "Display Router LSAs\n"
1218 "Display Network LSAs\n"
1219 "Display Inter-Area-Prefix LSAs\n"
1220 "Display Inter-Area-Router LSAs\n"
1221 "Display As-External LSAs\n"
1222 "Display Group-Membership LSAs\n"
1223 "Display Type-7 LSAs\n"
1224 "Display Link LSAs\n"
1225 "Display Intra-Area-Prefix LSAs\n"
1226 "Search by Advertising Router\n"
1227 "Specify Advertising Router as IPv4 address notation\n"
1228 "Search by Link state ID\n"
1229 "Specify Link state ID as IPv4 address notation\n"
1230 "Dump LSAs\n"
1231 "Display LSA's internal information\n"
1234 DEFUN (show_ipv6_ospf6_database_self_originated,
1235 show_ipv6_ospf6_database_self_originated_cmd,
1236 "show ipv6 ospf6 database self-originated",
1237 SHOW_STR
1238 IPV6_STR
1239 OSPF6_STR
1240 "Display Self-originated LSAs\n"
1243 int level;
1244 struct listnode *i, *j;
1245 struct ospf6 *o = ospf6;
1246 struct ospf6_area *oa;
1247 struct ospf6_interface *oi;
1248 u_int32_t adv_router = 0;
1250 OSPF6_CMD_CHECK_RUNNING ();
1252 level = parse_show_level (argc, argv);
1254 adv_router = o->router_id;
1256 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1258 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1259 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
1262 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1264 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1266 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1267 oi->interface->name, oa->name, VNL, VNL);
1268 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
1272 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1273 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
1275 vty_out (vty, "%s", VNL);
1276 return CMD_SUCCESS;
1279 ALIAS (show_ipv6_ospf6_database_self_originated,
1280 show_ipv6_ospf6_database_self_originated_detail_cmd,
1281 "show ipv6 ospf6 database self-originated "
1282 "(detail|dump|internal)",
1283 SHOW_STR
1284 IPV6_STR
1285 OSPF6_STR
1286 "Display Self-originated LSAs\n"
1287 "Display details of LSAs\n"
1288 "Dump LSAs\n"
1289 "Display LSA's internal information\n"
1292 DEFUN (show_ipv6_ospf6_database_type_self_originated,
1293 show_ipv6_ospf6_database_type_self_originated_cmd,
1294 "show ipv6 ospf6 database "
1295 "(router|network|inter-prefix|inter-router|as-external|"
1296 "group-membership|type-7|link|intra-prefix) self-originated",
1297 SHOW_STR
1298 IPV6_STR
1299 OSPF6_STR
1300 "Display Link state database\n"
1301 "Display Router LSAs\n"
1302 "Display Network LSAs\n"
1303 "Display Inter-Area-Prefix LSAs\n"
1304 "Display Inter-Area-Router LSAs\n"
1305 "Display As-External LSAs\n"
1306 "Display Group-Membership LSAs\n"
1307 "Display Type-7 LSAs\n"
1308 "Display Link LSAs\n"
1309 "Display Intra-Area-Prefix LSAs\n"
1310 "Display Self-originated LSAs\n"
1313 int level;
1314 struct listnode *i, *j;
1315 struct ospf6 *o = ospf6;
1316 struct ospf6_area *oa;
1317 struct ospf6_interface *oi;
1318 u_int16_t type = 0;
1319 u_int32_t adv_router = 0;
1321 OSPF6_CMD_CHECK_RUNNING ();
1323 type = parse_type_spec (argc, argv);
1324 argc--;
1325 argv++;
1326 level = parse_show_level (argc, argv);
1328 adv_router = o->router_id;
1330 switch (OSPF6_LSA_SCOPE (type))
1332 case OSPF6_SCOPE_AREA:
1333 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1335 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1336 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
1338 break;
1340 case OSPF6_SCOPE_LINKLOCAL:
1341 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1343 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1345 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1346 oi->interface->name, oa->name, VNL, VNL);
1347 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
1350 break;
1352 case OSPF6_SCOPE_AS:
1353 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1354 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
1355 break;
1357 default:
1358 assert (0);
1359 break;
1362 vty_out (vty, "%s", VNL);
1363 return CMD_SUCCESS;
1366 ALIAS (show_ipv6_ospf6_database_type_self_originated,
1367 show_ipv6_ospf6_database_type_self_originated_detail_cmd,
1368 "show ipv6 ospf6 database "
1369 "(router|network|inter-prefix|inter-router|as-external|"
1370 "group-membership|type-7|link|intra-prefix) self-originated "
1371 "(detail|dump|internal)",
1372 SHOW_STR
1373 IPV6_STR
1374 OSPF6_STR
1375 "Display Link state database\n"
1376 "Display Router LSAs\n"
1377 "Display Network LSAs\n"
1378 "Display Inter-Area-Prefix LSAs\n"
1379 "Display Inter-Area-Router LSAs\n"
1380 "Display As-External LSAs\n"
1381 "Display Group-Membership LSAs\n"
1382 "Display Type-7 LSAs\n"
1383 "Display Link LSAs\n"
1384 "Display Intra-Area-Prefix LSAs\n"
1385 "Display Self-originated LSAs\n"
1386 "Display details of LSAs\n"
1387 "Dump LSAs\n"
1388 "Display LSA's internal information\n"
1391 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1392 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
1393 "show ipv6 ospf6 database "
1394 "(router|network|inter-prefix|inter-router|as-external|"
1395 "group-membership|type-7|link|intra-prefix) self-originated "
1396 "linkstate-id A.B.C.D",
1397 SHOW_STR
1398 IPV6_STR
1399 OSPF6_STR
1400 "Display Link state database\n"
1401 "Display Router LSAs\n"
1402 "Display Network LSAs\n"
1403 "Display Inter-Area-Prefix LSAs\n"
1404 "Display Inter-Area-Router LSAs\n"
1405 "Display As-External LSAs\n"
1406 "Display Group-Membership LSAs\n"
1407 "Display Type-7 LSAs\n"
1408 "Display Link LSAs\n"
1409 "Display Intra-Area-Prefix LSAs\n"
1410 "Display Self-originated LSAs\n"
1411 "Search by Link state ID\n"
1412 "Specify Link state ID as IPv4 address notation\n"
1415 int level;
1416 struct listnode *i, *j;
1417 struct ospf6 *o = ospf6;
1418 struct ospf6_area *oa;
1419 struct ospf6_interface *oi;
1420 u_int16_t type = 0;
1421 u_int32_t adv_router = 0;
1422 u_int32_t id = 0;
1424 OSPF6_CMD_CHECK_RUNNING ();
1426 type = parse_type_spec (argc, argv);
1427 argc--;
1428 argv++;
1430 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1432 vty_out (vty, "Link State ID is not parsable: %s%s",
1433 argv[0], VNL);
1434 return CMD_SUCCESS;
1437 argc--;
1438 argv++;
1439 level = parse_show_level (argc, argv);
1441 adv_router = o->router_id;
1443 switch (OSPF6_LSA_SCOPE (type))
1445 case OSPF6_SCOPE_AREA:
1446 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1448 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1449 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1451 break;
1453 case OSPF6_SCOPE_LINKLOCAL:
1454 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1456 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1458 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1459 oi->interface->name, oa->name, VNL, VNL);
1460 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1463 break;
1465 case OSPF6_SCOPE_AS:
1466 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1467 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1468 break;
1470 default:
1471 assert (0);
1472 break;
1475 vty_out (vty, "%s", VNL);
1476 return CMD_SUCCESS;
1479 ALIAS (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1480 show_ipv6_ospf6_database_type_self_originated_linkstate_id_detail_cmd,
1481 "show ipv6 ospf6 database "
1482 "(router|network|inter-prefix|inter-router|as-external|"
1483 "group-membership|type-7|link|intra-prefix) self-originated "
1484 "linkstate-id A.B.C.D (detail|dump|internal)",
1485 SHOW_STR
1486 IPV6_STR
1487 OSPF6_STR
1488 "Display Link state database\n"
1489 "Display Router LSAs\n"
1490 "Display Network LSAs\n"
1491 "Display Inter-Area-Prefix LSAs\n"
1492 "Display Inter-Area-Router LSAs\n"
1493 "Display As-External LSAs\n"
1494 "Display Group-Membership LSAs\n"
1495 "Display Type-7 LSAs\n"
1496 "Display Link LSAs\n"
1497 "Display Intra-Area-Prefix LSAs\n"
1498 "Display Self-originated LSAs\n"
1499 "Search by Link state ID\n"
1500 "Specify Link state ID as IPv4 address notation\n"
1501 "Display details of LSAs\n"
1502 "Dump LSAs\n"
1503 "Display LSA's internal information\n"
1506 DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
1507 show_ipv6_ospf6_database_type_id_self_originated_cmd,
1508 "show ipv6 ospf6 database "
1509 "(router|network|inter-prefix|inter-router|as-external|"
1510 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated",
1511 SHOW_STR
1512 IPV6_STR
1513 OSPF6_STR
1514 "Display Link state database\n"
1515 "Display Router LSAs\n"
1516 "Display Network LSAs\n"
1517 "Display Inter-Area-Prefix LSAs\n"
1518 "Display Inter-Area-Router LSAs\n"
1519 "Display As-External LSAs\n"
1520 "Display Group-Membership LSAs\n"
1521 "Display Type-7 LSAs\n"
1522 "Display Link LSAs\n"
1523 "Display Intra-Area-Prefix LSAs\n"
1524 "Specify Link state ID as IPv4 address notation\n"
1525 "Display Self-originated LSAs\n"
1528 int level;
1529 struct listnode *i, *j;
1530 struct ospf6 *o = ospf6;
1531 struct ospf6_area *oa;
1532 struct ospf6_interface *oi;
1533 u_int16_t type = 0;
1534 u_int32_t adv_router = 0;
1535 u_int32_t id = 0;
1537 OSPF6_CMD_CHECK_RUNNING ();
1539 type = parse_type_spec (argc, argv);
1540 argc--;
1541 argv++;
1543 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1545 vty_out (vty, "Link State ID is not parsable: %s%s",
1546 argv[0], VNL);
1547 return CMD_SUCCESS;
1550 argc--;
1551 argv++;
1552 level = parse_show_level (argc, argv);
1554 adv_router = o->router_id;
1556 switch (OSPF6_LSA_SCOPE (type))
1558 case OSPF6_SCOPE_AREA:
1559 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1561 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1562 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1564 break;
1566 case OSPF6_SCOPE_LINKLOCAL:
1567 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1569 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1571 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1572 oi->interface->name, oa->name, VNL, VNL);
1573 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1576 break;
1578 case OSPF6_SCOPE_AS:
1579 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1580 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1581 break;
1583 default:
1584 assert (0);
1585 break;
1588 vty_out (vty, "%s", VNL);
1589 return CMD_SUCCESS;
1592 ALIAS (show_ipv6_ospf6_database_type_id_self_originated,
1593 show_ipv6_ospf6_database_type_id_self_originated_detail_cmd,
1594 "show ipv6 ospf6 database "
1595 "(router|network|inter-prefix|inter-router|as-external|"
1596 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated "
1597 "(detail|dump|internal)",
1598 SHOW_STR
1599 IPV6_STR
1600 OSPF6_STR
1601 "Display Link state database\n"
1602 "Display Router LSAs\n"
1603 "Display Network LSAs\n"
1604 "Display Inter-Area-Prefix LSAs\n"
1605 "Display Inter-Area-Router LSAs\n"
1606 "Display As-External LSAs\n"
1607 "Display Group-Membership LSAs\n"
1608 "Display Type-7 LSAs\n"
1609 "Display Link LSAs\n"
1610 "Display Intra-Area-Prefix LSAs\n"
1611 "Display Self-originated LSAs\n"
1612 "Search by Link state ID\n"
1613 "Specify Link state ID as IPv4 address notation\n"
1614 "Display details of LSAs\n"
1615 "Dump LSAs\n"
1616 "Display LSA's internal information\n"
1620 DEFUN (show_ipv6_ospf6_border_routers,
1621 show_ipv6_ospf6_border_routers_cmd,
1622 "show ipv6 ospf6 border-routers",
1623 SHOW_STR
1624 IP6_STR
1625 OSPF6_STR
1626 "Display routing table for ABR and ASBR\n"
1629 u_int32_t adv_router;
1630 void (*showfunc) (struct vty *, struct ospf6_route *);
1631 struct ospf6_route *ro;
1632 struct prefix prefix;
1634 OSPF6_CMD_CHECK_RUNNING ();
1636 if (argc && ! strcmp ("detail", argv[0]))
1638 showfunc = ospf6_route_show_detail;
1639 argc--;
1640 argv++;
1642 else
1643 showfunc = ospf6_brouter_show;
1645 if (argc)
1647 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1649 vty_out (vty, "Router ID is not parsable: %s%s", argv[0], VNL);
1650 return CMD_SUCCESS;
1653 ospf6_linkstate_prefix (adv_router, 0, &prefix);
1654 ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
1655 ospf6_route_show_detail (vty, ro);
1656 return CMD_SUCCESS;
1659 if (showfunc == ospf6_brouter_show)
1660 ospf6_brouter_show_header (vty);
1662 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1663 ro = ospf6_route_next (ro))
1664 (*showfunc) (vty, ro);
1666 return CMD_SUCCESS;
1669 ALIAS (show_ipv6_ospf6_border_routers,
1670 show_ipv6_ospf6_border_routers_detail_cmd,
1671 "show ipv6 ospf6 border-routers (A.B.C.D|detail)",
1672 SHOW_STR
1673 IP6_STR
1674 OSPF6_STR
1675 "Display routing table for ABR and ASBR\n"
1676 "Specify Router-ID\n"
1677 "Display Detail\n"
1680 DEFUN (show_ipv6_ospf6_linkstate,
1681 show_ipv6_ospf6_linkstate_cmd,
1682 "show ipv6 ospf6 linkstate",
1683 SHOW_STR
1684 IP6_STR
1685 OSPF6_STR
1686 "Display linkstate routing table\n"
1689 struct listnode *node;
1690 struct ospf6_area *oa;
1692 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
1694 vty_out (vty, "%s SPF Result in Area %s%s%s",
1695 VNL, oa->name, VNL, VNL);
1696 ospf6_linkstate_table_show (vty, argc, argv, oa->spf_table);
1699 vty_out (vty, "%s", VNL);
1700 return CMD_SUCCESS;
1703 ALIAS (show_ipv6_ospf6_linkstate,
1704 show_ipv6_ospf6_linkstate_router_cmd,
1705 "show ipv6 ospf6 linkstate router A.B.C.D",
1706 SHOW_STR
1707 IP6_STR
1708 OSPF6_STR
1709 "Display linkstate routing table\n"
1710 "Display Router Entry\n"
1711 "Specify Router ID as IPv4 address notation\n"
1714 ALIAS (show_ipv6_ospf6_linkstate,
1715 show_ipv6_ospf6_linkstate_network_cmd,
1716 "show ipv6 ospf6 linkstate network A.B.C.D A.B.C.D",
1717 SHOW_STR
1718 IP6_STR
1719 OSPF6_STR
1720 "Display linkstate routing table\n"
1721 "Display Network Entry\n"
1722 "Specify Router ID as IPv4 address notation\n"
1723 "Specify Link state ID as IPv4 address notation\n"
1726 DEFUN (show_ipv6_ospf6_linkstate_detail,
1727 show_ipv6_ospf6_linkstate_detail_cmd,
1728 "show ipv6 ospf6 linkstate detail",
1729 SHOW_STR
1730 IP6_STR
1731 OSPF6_STR
1732 "Display linkstate routing table\n"
1735 const char *sargv[CMD_ARGC_MAX];
1736 int i, sargc;
1737 struct listnode *node;
1738 struct ospf6_area *oa;
1740 /* copy argv to sargv and then append "detail" */
1741 for (i = 0; i < argc; i++)
1742 sargv[i] = argv[i];
1743 sargc = argc;
1744 sargv[sargc++] = "detail";
1745 sargv[sargc] = NULL;
1747 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
1749 vty_out (vty, "%s SPF Result in Area %s%s%s",
1750 VNL, oa->name, VNL, VNL);
1751 ospf6_linkstate_table_show (vty, sargc, sargv, oa->spf_table);
1754 vty_out (vty, "%s", VNL);
1755 return CMD_SUCCESS;
1758 /* Install ospf related commands. */
1759 void
1760 ospf6_init ()
1762 ospf6_top_init ();
1763 ospf6_area_init ();
1764 ospf6_interface_init ();
1765 ospf6_neighbor_init ();
1766 ospf6_zebra_init ();
1768 ospf6_lsa_init ();
1769 ospf6_spf_init ();
1770 ospf6_intra_init ();
1771 ospf6_asbr_init ();
1772 ospf6_abr_init ();
1774 #ifdef HAVE_SNMP
1775 ospf6_snmp_init (master);
1776 #endif /*HAVE_SNMP*/
1778 install_node (&debug_node, config_write_ospf6_debug);
1780 install_element_ospf6_debug_message ();
1781 install_element_ospf6_debug_lsa ();
1782 install_element_ospf6_debug_interface ();
1783 install_element_ospf6_debug_neighbor ();
1784 install_element_ospf6_debug_zebra ();
1785 install_element_ospf6_debug_spf ();
1786 install_element_ospf6_debug_route ();
1787 install_element_ospf6_debug_brouter ();
1788 install_element_ospf6_debug_asbr ();
1789 install_element_ospf6_debug_abr ();
1790 install_element_ospf6_debug_flood ();
1792 install_element (VIEW_NODE, &show_version_ospf6_cmd);
1793 install_element (ENABLE_NODE, &show_version_ospf6_cmd);
1795 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
1796 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1797 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_cmd);
1798 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1800 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd);
1801 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_router_cmd);
1802 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_network_cmd);
1803 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
1804 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_cmd);
1805 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_router_cmd);
1806 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_network_cmd);
1807 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
1809 #define INSTALL(n,c) \
1810 install_element (n ## _NODE, &show_ipv6_ospf6_ ## c)
1812 INSTALL (VIEW, database_cmd);
1813 INSTALL (VIEW, database_detail_cmd);
1814 INSTALL (VIEW, database_type_cmd);
1815 INSTALL (VIEW, database_type_detail_cmd);
1816 INSTALL (VIEW, database_id_cmd);
1817 INSTALL (VIEW, database_id_detail_cmd);
1818 INSTALL (VIEW, database_linkstate_id_cmd);
1819 INSTALL (VIEW, database_linkstate_id_detail_cmd);
1820 INSTALL (VIEW, database_router_cmd);
1821 INSTALL (VIEW, database_router_detail_cmd);
1822 INSTALL (VIEW, database_adv_router_cmd);
1823 INSTALL (VIEW, database_adv_router_detail_cmd);
1824 INSTALL (VIEW, database_type_id_cmd);
1825 INSTALL (VIEW, database_type_id_detail_cmd);
1826 INSTALL (VIEW, database_type_linkstate_id_cmd);
1827 INSTALL (VIEW, database_type_linkstate_id_detail_cmd);
1828 INSTALL (VIEW, database_type_router_cmd);
1829 INSTALL (VIEW, database_type_router_detail_cmd);
1830 INSTALL (VIEW, database_type_adv_router_cmd);
1831 INSTALL (VIEW, database_type_adv_router_detail_cmd);
1832 INSTALL (VIEW, database_adv_router_linkstate_id_cmd);
1833 INSTALL (VIEW, database_adv_router_linkstate_id_detail_cmd);
1834 INSTALL (VIEW, database_id_router_cmd);
1835 INSTALL (VIEW, database_id_router_detail_cmd);
1836 INSTALL (VIEW, database_type_id_router_cmd);
1837 INSTALL (VIEW, database_type_id_router_detail_cmd);
1838 INSTALL (VIEW, database_type_adv_router_linkstate_id_cmd);
1839 INSTALL (VIEW, database_type_adv_router_linkstate_id_detail_cmd);
1840 INSTALL (VIEW, database_self_originated_cmd);
1841 INSTALL (VIEW, database_self_originated_detail_cmd);
1842 INSTALL (VIEW, database_type_self_originated_cmd);
1843 INSTALL (VIEW, database_type_self_originated_detail_cmd);
1844 INSTALL (VIEW, database_type_id_self_originated_cmd);
1845 INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
1846 INSTALL (VIEW, database_type_self_originated_linkstate_id_cmd);
1847 INSTALL (VIEW, database_type_self_originated_linkstate_id_detail_cmd);
1849 INSTALL (ENABLE, database_cmd);
1850 INSTALL (ENABLE, database_detail_cmd);
1851 INSTALL (ENABLE, database_type_cmd);
1852 INSTALL (ENABLE, database_type_detail_cmd);
1853 INSTALL (ENABLE, database_id_cmd);
1854 INSTALL (ENABLE, database_id_detail_cmd);
1855 INSTALL (ENABLE, database_linkstate_id_cmd);
1856 INSTALL (ENABLE, database_linkstate_id_detail_cmd);
1857 INSTALL (ENABLE, database_router_cmd);
1858 INSTALL (ENABLE, database_router_detail_cmd);
1859 INSTALL (ENABLE, database_adv_router_cmd);
1860 INSTALL (ENABLE, database_adv_router_detail_cmd);
1861 INSTALL (ENABLE, database_type_id_cmd);
1862 INSTALL (ENABLE, database_type_id_detail_cmd);
1863 INSTALL (ENABLE, database_type_linkstate_id_cmd);
1864 INSTALL (ENABLE, database_type_linkstate_id_detail_cmd);
1865 INSTALL (ENABLE, database_type_router_cmd);
1866 INSTALL (ENABLE, database_type_router_detail_cmd);
1867 INSTALL (ENABLE, database_type_adv_router_cmd);
1868 INSTALL (ENABLE, database_type_adv_router_detail_cmd);
1869 INSTALL (ENABLE, database_adv_router_linkstate_id_cmd);
1870 INSTALL (ENABLE, database_adv_router_linkstate_id_detail_cmd);
1871 INSTALL (ENABLE, database_id_router_cmd);
1872 INSTALL (ENABLE, database_id_router_detail_cmd);
1873 INSTALL (ENABLE, database_type_id_router_cmd);
1874 INSTALL (ENABLE, database_type_id_router_detail_cmd);
1875 INSTALL (ENABLE, database_type_adv_router_linkstate_id_cmd);
1876 INSTALL (ENABLE, database_type_adv_router_linkstate_id_detail_cmd);
1877 INSTALL (ENABLE, database_self_originated_cmd);
1878 INSTALL (ENABLE, database_self_originated_detail_cmd);
1879 INSTALL (ENABLE, database_type_self_originated_cmd);
1880 INSTALL (ENABLE, database_type_self_originated_detail_cmd);
1881 INSTALL (ENABLE, database_type_id_self_originated_cmd);
1882 INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
1883 INSTALL (ENABLE, database_type_self_originated_linkstate_id_cmd);
1884 INSTALL (ENABLE, database_type_self_originated_linkstate_id_detail_cmd);
1886 /* Make ospf protocol socket. */
1887 ospf6_serv_sock ();
1888 thread_add_read (master, ospf6_receive, NULL, ospf6_sock);