Extended MOTD with GUI
[tomato.git] / release / src / router / zebra / ospf6d / ospf6d.c
blob450774eba0252a172666d4ff4ede389d7d87e4e7
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_asbr (vty);
118 config_write_ospf6_debug_abr (vty);
119 config_write_ospf6_debug_flood (vty);
120 vty_out (vty, "!%s", VNL);
121 return 0;
124 #define AREA_LSDB_TITLE_FORMAT \
125 "%s Area Scoped Link State Database (Area %s)%s%s"
126 #define IF_LSDB_TITLE_FORMAT \
127 "%s I/F Scoped Link State Database (I/F %s in Area %s)%s%s"
128 #define AS_LSDB_TITLE_FORMAT \
129 "%s AS Scoped Link State Database%s%s"
131 static int
132 parse_show_level (int argc, char **argv)
134 int level = 0;
135 if (argc)
137 if (! strncmp (argv[0], "de", 2))
138 level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;
139 else if (! strncmp (argv[0], "du", 2))
140 level = OSPF6_LSDB_SHOW_LEVEL_DUMP;
141 else if (! strncmp (argv[0], "in", 2))
142 level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL;
144 else
145 level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
146 return level;
149 static u_int16_t
150 parse_type_spec (int argc, char **argv)
152 u_int16_t type = 0;
153 assert (argc);
154 if (! strcmp (argv[0], "router"))
155 type = htons (OSPF6_LSTYPE_ROUTER);
156 else if (! strcmp (argv[0], "network"))
157 type = htons (OSPF6_LSTYPE_NETWORK);
158 else if (! strcmp (argv[0], "as-external"))
159 type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
160 else if (! strcmp (argv[0], "intra-prefix"))
161 type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
162 else if (! strcmp (argv[0], "inter-router"))
163 type = htons (OSPF6_LSTYPE_INTER_ROUTER);
164 else if (! strcmp (argv[0], "inter-prefix"))
165 type = htons (OSPF6_LSTYPE_INTER_PREFIX);
166 else if (! strcmp (argv[0], "link"))
167 type = htons (OSPF6_LSTYPE_LINK);
168 return type;
171 DEFUN (show_ipv6_ospf6_database,
172 show_ipv6_ospf6_database_cmd,
173 "show ipv6 ospf6 database",
174 SHOW_STR
175 IPV6_STR
176 OSPF6_STR
177 "Display Link state database\n"
180 int level;
181 listnode i, j;
182 struct ospf6 *o = ospf6;
183 struct ospf6_area *oa;
184 struct ospf6_interface *oi;
186 OSPF6_CMD_CHECK_RUNNING ();
188 level = parse_show_level (argc, argv);
190 for (i = listhead (o->area_list); i; nextnode (i))
192 oa = (struct ospf6_area *) getdata (i);
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 (i = listhead (o->area_list); i; nextnode (i))
199 oa = (struct ospf6_area *) getdata (i);
200 for (j = listhead (oa->if_list); j; nextnode (j))
202 oi = (struct ospf6_interface *) getdata (j);
203 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
204 oi->interface->name, oa->name, VNL, VNL);
205 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oi->lsdb);
209 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
210 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, o->lsdb);
212 vty_out (vty, "%s", VNL);
213 return CMD_SUCCESS;
216 ALIAS (show_ipv6_ospf6_database,
217 show_ipv6_ospf6_database_detail_cmd,
218 "show ipv6 ospf6 database (detail|dump|internal)",
219 SHOW_STR
220 IPV6_STR
221 OSPF6_STR
222 "Display Link state database\n"
223 "Display details of LSAs\n"
224 "Dump LSAs\n"
225 "Display LSA's internal information\n"
228 DEFUN (show_ipv6_ospf6_database_type,
229 show_ipv6_ospf6_database_type_cmd,
230 "show ipv6 ospf6 database "
231 "(router|network|inter-prefix|inter-router|as-external|"
232 "group-membership|type-7|link|intra-prefix)",
233 SHOW_STR
234 IPV6_STR
235 OSPF6_STR
236 "Display Link state database\n"
237 "Display Router LSAs\n"
238 "Display Network LSAs\n"
239 "Display Inter-Area-Prefix LSAs\n"
240 "Display Inter-Area-Router LSAs\n"
241 "Display As-External LSAs\n"
242 "Display Group-Membership LSAs\n"
243 "Display Type-7 LSAs\n"
244 "Display Link LSAs\n"
245 "Display Intra-Area-Prefix LSAs\n"
248 int level;
249 listnode i, j;
250 struct ospf6 *o = ospf6;
251 struct ospf6_area *oa;
252 struct ospf6_interface *oi;
253 u_int16_t type = 0;
255 OSPF6_CMD_CHECK_RUNNING ();
257 type = parse_type_spec (argc, argv);
258 argc--;
259 argv++;
260 level = parse_show_level (argc, argv);
262 switch (OSPF6_LSA_SCOPE (type))
264 case OSPF6_SCOPE_AREA:
265 for (i = listhead (o->area_list); i; nextnode (i))
267 oa = (struct ospf6_area *) getdata (i);
268 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
269 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oa->lsdb);
271 break;
273 case OSPF6_SCOPE_LINKLOCAL:
274 for (i = listhead (o->area_list); i; nextnode (i))
276 oa = (struct ospf6_area *) getdata (i);
277 for (j = listhead (oa->if_list); j; nextnode (j))
279 oi = (struct ospf6_interface *) getdata (j);
280 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
281 oi->interface->name, oa->name, VNL, VNL);
282 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oi->lsdb);
285 break;
287 case OSPF6_SCOPE_AS:
288 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
289 ospf6_lsdb_show (vty, level, &type, NULL, NULL, o->lsdb);
290 break;
292 default:
293 assert (0);
294 break;
297 vty_out (vty, "%s", VNL);
298 return CMD_SUCCESS;
301 ALIAS (show_ipv6_ospf6_database_type,
302 show_ipv6_ospf6_database_type_detail_cmd,
303 "show ipv6 ospf6 database "
304 "(router|network|inter-prefix|inter-router|as-external|"
305 "group-membership|type-7|link|intra-prefix) "
306 "(detail|dump|internal)",
307 SHOW_STR
308 IPV6_STR
309 OSPF6_STR
310 "Display Link state database\n"
311 "Display Router LSAs\n"
312 "Display Network LSAs\n"
313 "Display Inter-Area-Prefix LSAs\n"
314 "Display Inter-Area-Router LSAs\n"
315 "Display As-External LSAs\n"
316 "Display Group-Membership LSAs\n"
317 "Display Type-7 LSAs\n"
318 "Display Link LSAs\n"
319 "Display Intra-Area-Prefix LSAs\n"
320 "Display details of LSAs\n"
321 "Dump LSAs\n"
322 "Display LSA's internal information\n"
325 DEFUN (show_ipv6_ospf6_database_id,
326 show_ipv6_ospf6_database_id_cmd,
327 "show ipv6 ospf6 database * A.B.C.D",
328 SHOW_STR
329 IPV6_STR
330 OSPF6_STR
331 "Display Link state database\n"
332 "Any Link state Type\n"
333 "Specify Link state ID as IPv4 address notation\n"
336 int level;
337 listnode i, j;
338 struct ospf6 *o = ospf6;
339 struct ospf6_area *oa;
340 struct ospf6_interface *oi;
341 u_int32_t id = 0;
343 OSPF6_CMD_CHECK_RUNNING ();
345 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
347 vty_out (vty, "Link State ID is not parsable: %s%s",
348 argv[0], VNL);
349 return CMD_SUCCESS;
352 argc--;
353 argv++;
354 level = parse_show_level (argc, argv);
356 for (i = listhead (o->area_list); i; nextnode (i))
358 oa = (struct ospf6_area *) getdata (i);
359 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
360 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oa->lsdb);
363 for (i = listhead (o->area_list); i; nextnode (i))
365 oa = (struct ospf6_area *) getdata (i);
366 for (j = listhead (oa->if_list); j; nextnode (j))
368 oi = (struct ospf6_interface *) getdata (j);
369 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
370 oi->interface->name, oa->name, VNL, VNL);
371 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oi->lsdb);
375 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
376 ospf6_lsdb_show (vty, level, NULL, &id, NULL, o->lsdb);
378 vty_out (vty, "%s", VNL);
379 return CMD_SUCCESS;
382 ALIAS (show_ipv6_ospf6_database_id,
383 show_ipv6_ospf6_database_id_detail_cmd,
384 "show ipv6 ospf6 database * A.B.C.D "
385 "(detail|dump|internal)",
386 SHOW_STR
387 IPV6_STR
388 OSPF6_STR
389 "Display Link state database\n"
390 "Any Link state Type\n"
391 "Specify Link state ID as IPv4 address notation\n"
392 "Display details of LSAs\n"
393 "Dump LSAs\n"
394 "Display LSA's internal information\n"
397 ALIAS (show_ipv6_ospf6_database_id,
398 show_ipv6_ospf6_database_linkstate_id_cmd,
399 "show ipv6 ospf6 database linkstate-id A.B.C.D",
400 SHOW_STR
401 IPV6_STR
402 OSPF6_STR
403 "Display Link state database\n"
404 "Search by Link state ID\n"
405 "Specify Link state ID as IPv4 address notation\n"
408 ALIAS (show_ipv6_ospf6_database_id,
409 show_ipv6_ospf6_database_linkstate_id_detail_cmd,
410 "show ipv6 ospf6 database linkstate-id A.B.C.D "
411 "(detail|dump|internal)",
412 SHOW_STR
413 IPV6_STR
414 OSPF6_STR
415 "Display Link state database\n"
416 "Search by Link state ID\n"
417 "Specify Link state ID as IPv4 address notation\n"
418 "Display details of LSAs\n"
419 "Dump LSAs\n"
420 "Display LSA's internal information\n"
423 DEFUN (show_ipv6_ospf6_database_router,
424 show_ipv6_ospf6_database_router_cmd,
425 "show ipv6 ospf6 database * * A.B.C.D",
426 SHOW_STR
427 IPV6_STR
428 OSPF6_STR
429 "Display Link state database\n"
430 "Any Link state Type\n"
431 "Any Link state ID\n"
432 "Specify Advertising Router as IPv4 address notation\n"
435 int level;
436 listnode i, j;
437 struct ospf6 *o = ospf6;
438 struct ospf6_area *oa;
439 struct ospf6_interface *oi;
440 u_int32_t adv_router = 0;
442 OSPF6_CMD_CHECK_RUNNING ();
444 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
446 vty_out (vty, "Advertising Router is not parsable: %s%s",
447 argv[0], VNL);
448 return CMD_SUCCESS;
451 argc--;
452 argv++;
453 level = parse_show_level (argc, argv);
455 for (i = listhead (o->area_list); i; nextnode (i))
457 oa = (struct ospf6_area *) getdata (i);
458 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
459 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
462 for (i = listhead (o->area_list); i; nextnode (i))
464 oa = (struct ospf6_area *) getdata (i);
465 for (j = listhead (oa->if_list); j; nextnode (j))
467 oi = (struct ospf6_interface *) getdata (j);
468 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
469 oi->interface->name, oa->name, VNL, VNL);
470 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
474 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
475 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
477 vty_out (vty, "%s", VNL);
478 return CMD_SUCCESS;
481 ALIAS (show_ipv6_ospf6_database_router,
482 show_ipv6_ospf6_database_router_detail_cmd,
483 "show ipv6 ospf6 database * * A.B.C.D "
484 "(detail|dump|internal)",
485 SHOW_STR
486 IPV6_STR
487 OSPF6_STR
488 "Display Link state database\n"
489 "Any Link state Type\n"
490 "Any Link state ID\n"
491 "Specify Advertising Router as IPv4 address notation\n"
492 "Display details of LSAs\n"
493 "Dump LSAs\n"
494 "Display LSA's internal information\n"
497 ALIAS (show_ipv6_ospf6_database_router,
498 show_ipv6_ospf6_database_adv_router_cmd,
499 "show ipv6 ospf6 database adv-router A.B.C.D",
500 SHOW_STR
501 IPV6_STR
502 OSPF6_STR
503 "Display Link state database\n"
504 "Search by Advertising Router\n"
505 "Specify Advertising Router as IPv4 address notation\n"
508 ALIAS (show_ipv6_ospf6_database_router,
509 show_ipv6_ospf6_database_adv_router_detail_cmd,
510 "show ipv6 ospf6 database adv-router A.B.C.D "
511 "(detail|dump|internal)",
512 SHOW_STR
513 IPV6_STR
514 OSPF6_STR
515 "Display Link state database\n"
516 "Search by Advertising Router\n"
517 "Specify Advertising Router as IPv4 address notation\n"
518 "Display details of LSAs\n"
519 "Dump LSAs\n"
520 "Display LSA's internal information\n"
523 DEFUN (show_ipv6_ospf6_database_type_id,
524 show_ipv6_ospf6_database_type_id_cmd,
525 "show ipv6 ospf6 database "
526 "(router|network|inter-prefix|inter-router|as-external|"
527 "group-membership|type-7|link|intra-prefix) A.B.C.D",
528 SHOW_STR
529 IPV6_STR
530 OSPF6_STR
531 "Display Link state database\n"
532 "Display Router LSAs\n"
533 "Display Network LSAs\n"
534 "Display Inter-Area-Prefix LSAs\n"
535 "Display Inter-Area-Router LSAs\n"
536 "Display As-External LSAs\n"
537 "Display Group-Membership LSAs\n"
538 "Display Type-7 LSAs\n"
539 "Display Link LSAs\n"
540 "Display Intra-Area-Prefix LSAs\n"
541 "Specify Link state ID as IPv4 address notation\n"
544 int level;
545 listnode i, j;
546 struct ospf6 *o = ospf6;
547 struct ospf6_area *oa;
548 struct ospf6_interface *oi;
549 u_int16_t type = 0;
550 u_int32_t id = 0;
552 OSPF6_CMD_CHECK_RUNNING ();
554 type = parse_type_spec (argc, argv);
555 argc--;
556 argv++;
558 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
560 vty_out (vty, "Link state ID is not parsable: %s%s",
561 argv[0], VNL);
562 return CMD_SUCCESS;
565 argc--;
566 argv++;
567 level = parse_show_level (argc, argv);
569 switch (OSPF6_LSA_SCOPE (type))
571 case OSPF6_SCOPE_AREA:
572 for (i = listhead (o->area_list); i; nextnode (i))
574 oa = (struct ospf6_area *) getdata (i);
575 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
576 ospf6_lsdb_show (vty, level, &type, &id, NULL, oa->lsdb);
578 break;
580 case OSPF6_SCOPE_LINKLOCAL:
581 for (i = listhead (o->area_list); i; nextnode (i))
583 oa = (struct ospf6_area *) getdata (i);
584 for (j = listhead (oa->if_list); j; nextnode (j))
586 oi = (struct ospf6_interface *) getdata (j);
587 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
588 oi->interface->name, oa->name, VNL, VNL);
589 ospf6_lsdb_show (vty, level, &type, &id, NULL, oi->lsdb);
592 break;
594 case OSPF6_SCOPE_AS:
595 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
596 ospf6_lsdb_show (vty, level, &type, &id, NULL, o->lsdb);
597 break;
599 default:
600 assert (0);
601 break;
604 vty_out (vty, "%s", VNL);
605 return CMD_SUCCESS;
608 ALIAS (show_ipv6_ospf6_database_type_id,
609 show_ipv6_ospf6_database_type_id_detail_cmd,
610 "show ipv6 ospf6 database "
611 "(router|network|inter-prefix|inter-router|as-external|"
612 "group-membership|type-7|link|intra-prefix) A.B.C.D "
613 "(detail|dump|internal)",
614 SHOW_STR
615 IPV6_STR
616 OSPF6_STR
617 "Display Link state database\n"
618 "Display Router LSAs\n"
619 "Display Network LSAs\n"
620 "Display Inter-Area-Prefix LSAs\n"
621 "Display Inter-Area-Router LSAs\n"
622 "Display As-External LSAs\n"
623 "Display Group-Membership LSAs\n"
624 "Display Type-7 LSAs\n"
625 "Display Link LSAs\n"
626 "Display Intra-Area-Prefix LSAs\n"
627 "Specify Link state ID as IPv4 address notation\n"
628 "Display details of LSAs\n"
629 "Dump LSAs\n"
630 "Display LSA's internal information\n"
633 ALIAS (show_ipv6_ospf6_database_type_id,
634 show_ipv6_ospf6_database_type_linkstate_id_cmd,
635 "show ipv6 ospf6 database "
636 "(router|network|inter-prefix|inter-router|as-external|"
637 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D",
638 SHOW_STR
639 IPV6_STR
640 OSPF6_STR
641 "Display Link state database\n"
642 "Display Router LSAs\n"
643 "Display Network LSAs\n"
644 "Display Inter-Area-Prefix LSAs\n"
645 "Display Inter-Area-Router LSAs\n"
646 "Display As-External LSAs\n"
647 "Display Group-Membership LSAs\n"
648 "Display Type-7 LSAs\n"
649 "Display Link LSAs\n"
650 "Display Intra-Area-Prefix LSAs\n"
651 "Search by Link state ID\n"
652 "Specify Link state ID as IPv4 address notation\n"
655 ALIAS (show_ipv6_ospf6_database_type_id,
656 show_ipv6_ospf6_database_type_linkstate_id_detail_cmd,
657 "show ipv6 ospf6 database "
658 "(router|network|inter-prefix|inter-router|as-external|"
659 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D "
660 "(detail|dump|internal)",
661 SHOW_STR
662 IPV6_STR
663 OSPF6_STR
664 "Display Link state database\n"
665 "Display Router LSAs\n"
666 "Display Network LSAs\n"
667 "Display Inter-Area-Prefix LSAs\n"
668 "Display Inter-Area-Router LSAs\n"
669 "Display As-External LSAs\n"
670 "Display Group-Membership LSAs\n"
671 "Display Type-7 LSAs\n"
672 "Display Link LSAs\n"
673 "Display Intra-Area-Prefix LSAs\n"
674 "Search by Link state ID\n"
675 "Specify Link state ID as IPv4 address notation\n"
676 "Display details of LSAs\n"
677 "Dump LSAs\n"
678 "Display LSA's internal information\n"
681 DEFUN (show_ipv6_ospf6_database_type_router,
682 show_ipv6_ospf6_database_type_router_cmd,
683 "show ipv6 ospf6 database "
684 "(router|network|inter-prefix|inter-router|as-external|"
685 "group-membership|type-7|link|intra-prefix) * A.B.C.D",
686 SHOW_STR
687 IPV6_STR
688 OSPF6_STR
689 "Display Link state database\n"
690 "Display Router LSAs\n"
691 "Display Network LSAs\n"
692 "Display Inter-Area-Prefix LSAs\n"
693 "Display Inter-Area-Router LSAs\n"
694 "Display As-External LSAs\n"
695 "Display Group-Membership LSAs\n"
696 "Display Type-7 LSAs\n"
697 "Display Link LSAs\n"
698 "Display Intra-Area-Prefix LSAs\n"
699 "Any Link state ID\n"
700 "Specify Advertising Router as IPv4 address notation\n"
703 int level;
704 listnode i, j;
705 struct ospf6 *o = ospf6;
706 struct ospf6_area *oa;
707 struct ospf6_interface *oi;
708 u_int16_t type = 0;
709 u_int32_t adv_router = 0;
711 OSPF6_CMD_CHECK_RUNNING ();
713 type = parse_type_spec (argc, argv);
714 argc--;
715 argv++;
717 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
719 vty_out (vty, "Advertising Router is not parsable: %s%s",
720 argv[0], VNL);
721 return CMD_SUCCESS;
724 argc--;
725 argv++;
726 level = parse_show_level (argc, argv);
728 switch (OSPF6_LSA_SCOPE (type))
730 case OSPF6_SCOPE_AREA:
731 for (i = listhead (o->area_list); i; nextnode (i))
733 oa = (struct ospf6_area *) getdata (i);
734 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
735 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
737 break;
739 case OSPF6_SCOPE_LINKLOCAL:
740 for (i = listhead (o->area_list); i; nextnode (i))
742 oa = (struct ospf6_area *) getdata (i);
743 for (j = listhead (oa->if_list); j; nextnode (j))
745 oi = (struct ospf6_interface *) getdata (j);
746 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
747 oi->interface->name, oa->name, VNL, VNL);
748 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
751 break;
753 case OSPF6_SCOPE_AS:
754 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
755 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
756 break;
758 default:
759 assert (0);
760 break;
763 vty_out (vty, "%s", VNL);
764 return CMD_SUCCESS;
767 ALIAS (show_ipv6_ospf6_database_type_router,
768 show_ipv6_ospf6_database_type_router_detail_cmd,
769 "show ipv6 ospf6 database "
770 "(router|network|inter-prefix|inter-router|as-external|"
771 "group-membership|type-7|link|intra-prefix) * A.B.C.D "
772 "(detail|dump|internal)",
773 SHOW_STR
774 IPV6_STR
775 OSPF6_STR
776 "Display Link state database\n"
777 "Display Router LSAs\n"
778 "Display Network LSAs\n"
779 "Display Inter-Area-Prefix LSAs\n"
780 "Display Inter-Area-Router LSAs\n"
781 "Display As-External LSAs\n"
782 "Display Group-Membership LSAs\n"
783 "Display Type-7 LSAs\n"
784 "Display Link LSAs\n"
785 "Display Intra-Area-Prefix LSAs\n"
786 "Any Link state ID\n"
787 "Specify Advertising Router as IPv4 address notation\n"
788 "Display details of LSAs\n"
789 "Dump LSAs\n"
790 "Display LSA's internal information\n"
793 ALIAS (show_ipv6_ospf6_database_type_router,
794 show_ipv6_ospf6_database_type_adv_router_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 SHOW_STR
799 IPV6_STR
800 OSPF6_STR
801 "Display Link state database\n"
802 "Display Router LSAs\n"
803 "Display Network LSAs\n"
804 "Display Inter-Area-Prefix LSAs\n"
805 "Display Inter-Area-Router LSAs\n"
806 "Display As-External LSAs\n"
807 "Display Group-Membership LSAs\n"
808 "Display Type-7 LSAs\n"
809 "Display Link LSAs\n"
810 "Display Intra-Area-Prefix LSAs\n"
811 "Search by Advertising Router\n"
812 "Specify Advertising Router as IPv4 address notation\n"
815 ALIAS (show_ipv6_ospf6_database_type_router,
816 show_ipv6_ospf6_database_type_adv_router_detail_cmd,
817 "show ipv6 ospf6 database "
818 "(router|network|inter-prefix|inter-router|as-external|"
819 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D "
820 "(detail|dump|internal)",
821 SHOW_STR
822 IPV6_STR
823 OSPF6_STR
824 "Display Link state database\n"
825 "Display Router LSAs\n"
826 "Display Network LSAs\n"
827 "Display Inter-Area-Prefix LSAs\n"
828 "Display Inter-Area-Router LSAs\n"
829 "Display As-External LSAs\n"
830 "Display Group-Membership LSAs\n"
831 "Display Type-7 LSAs\n"
832 "Display Link LSAs\n"
833 "Display Intra-Area-Prefix LSAs\n"
834 "Search by Advertising Router\n"
835 "Specify Advertising Router as IPv4 address notation\n"
836 "Display details of LSAs\n"
837 "Dump LSAs\n"
838 "Display LSA's internal information\n"
841 DEFUN (show_ipv6_ospf6_database_id_router,
842 show_ipv6_ospf6_database_id_router_cmd,
843 "show ipv6 ospf6 database * A.B.C.D A.B.C.D",
844 SHOW_STR
845 IPV6_STR
846 OSPF6_STR
847 "Display Link state database\n"
848 "Any Link state Type\n"
849 "Specify Link state ID as IPv4 address notation\n"
850 "Specify Advertising Router as IPv4 address notation\n"
853 int level;
854 listnode i, j;
855 struct ospf6 *o = ospf6;
856 struct ospf6_area *oa;
857 struct ospf6_interface *oi;
858 u_int32_t id = 0;
859 u_int32_t adv_router = 0;
861 OSPF6_CMD_CHECK_RUNNING ();
863 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
865 vty_out (vty, "Link state ID is not parsable: %s%s",
866 argv[0], VNL);
867 return CMD_SUCCESS;
870 argc--;
871 argv++;
873 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
875 vty_out (vty, "Advertising Router is not parsable: %s%s",
876 argv[0], VNL);
877 return CMD_SUCCESS;
880 argc--;
881 argv++;
882 level = parse_show_level (argc, argv);
884 for (i = listhead (o->area_list); i; nextnode (i))
886 oa = (struct ospf6_area *) getdata (i);
887 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
888 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
891 for (i = listhead (o->area_list); i; nextnode (i))
893 oa = (struct ospf6_area *) getdata (i);
894 for (j = listhead (oa->if_list); j; nextnode (j))
896 oi = (struct ospf6_interface *) getdata (j);
897 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
898 oi->interface->name, oa->name, VNL, VNL);
899 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
903 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
904 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
906 vty_out (vty, "%s", VNL);
907 return CMD_SUCCESS;
910 ALIAS (show_ipv6_ospf6_database_id_router,
911 show_ipv6_ospf6_database_id_router_detail_cmd,
912 "show ipv6 ospf6 database * A.B.C.D A.B.C.D "
913 "(detail|dump|internal)",
914 SHOW_STR
915 IPV6_STR
916 OSPF6_STR
917 "Display Link state database\n"
918 "Any Link state Type\n"
919 "Specify Link state ID as IPv4 address notation\n"
920 "Specify Advertising Router as IPv4 address notation\n"
921 "Display details of LSAs\n"
922 "Dump LSAs\n"
923 "Display LSA's internal information\n"
926 DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
927 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd,
928 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D",
929 SHOW_STR
930 IPV6_STR
931 OSPF6_STR
932 "Display Link state database\n"
933 "Search by Advertising Router\n"
934 "Specify Advertising Router as IPv4 address notation\n"
935 "Search by Link state ID\n"
936 "Specify Link state ID as IPv4 address notation\n"
939 int level;
940 listnode i, j;
941 struct ospf6 *o = ospf6;
942 struct ospf6_area *oa;
943 struct ospf6_interface *oi;
944 u_int32_t id = 0;
945 u_int32_t adv_router = 0;
947 OSPF6_CMD_CHECK_RUNNING ();
949 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
951 vty_out (vty, "Advertising Router is not parsable: %s%s",
952 argv[0], VNL);
953 return CMD_SUCCESS;
956 argc--;
957 argv++;
959 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
961 vty_out (vty, "Link state ID is not parsable: %s%s",
962 argv[0], VNL);
963 return CMD_SUCCESS;
966 argc--;
967 argv++;
968 level = parse_show_level (argc, argv);
970 for (i = listhead (o->area_list); i; nextnode (i))
972 oa = (struct ospf6_area *) getdata (i);
973 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
974 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
977 for (i = listhead (o->area_list); i; nextnode (i))
979 oa = (struct ospf6_area *) getdata (i);
980 for (j = listhead (oa->if_list); j; nextnode (j))
982 oi = (struct ospf6_interface *) getdata (j);
983 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
984 oi->interface->name, oa->name, VNL, VNL);
985 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
989 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
990 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
992 vty_out (vty, "%s", VNL);
993 return CMD_SUCCESS;
996 ALIAS (show_ipv6_ospf6_database_adv_router_linkstate_id,
997 show_ipv6_ospf6_database_adv_router_linkstate_id_detail_cmd,
998 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D "
999 "(detail|dump|internal)",
1000 SHOW_STR
1001 IPV6_STR
1002 OSPF6_STR
1003 "Display Link state database\n"
1004 "Search by Advertising Router\n"
1005 "Specify Advertising Router as IPv4 address notation\n"
1006 "Search by Link state ID\n"
1007 "Specify Link state ID as IPv4 address notation\n"
1008 "Display details of LSAs\n"
1009 "Dump LSAs\n"
1010 "Display LSA's internal information\n"
1013 DEFUN (show_ipv6_ospf6_database_type_id_router,
1014 show_ipv6_ospf6_database_type_id_router_cmd,
1015 "show ipv6 ospf6 database "
1016 "(router|network|inter-prefix|inter-router|as-external|"
1017 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D",
1018 SHOW_STR
1019 IPV6_STR
1020 OSPF6_STR
1021 "Display Link state database\n"
1022 "Display Router LSAs\n"
1023 "Display Network LSAs\n"
1024 "Display Inter-Area-Prefix LSAs\n"
1025 "Display Inter-Area-Router LSAs\n"
1026 "Display As-External LSAs\n"
1027 "Display Group-Membership LSAs\n"
1028 "Display Type-7 LSAs\n"
1029 "Display Link LSAs\n"
1030 "Display Intra-Area-Prefix LSAs\n"
1031 "Specify Link state ID as IPv4 address notation\n"
1032 "Specify Advertising Router as IPv4 address notation\n"
1035 int level;
1036 listnode i, j;
1037 struct ospf6 *o = ospf6;
1038 struct ospf6_area *oa;
1039 struct ospf6_interface *oi;
1040 u_int16_t type = 0;
1041 u_int32_t id = 0;
1042 u_int32_t adv_router = 0;
1044 OSPF6_CMD_CHECK_RUNNING ();
1046 type = parse_type_spec (argc, argv);
1047 argc--;
1048 argv++;
1050 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1052 vty_out (vty, "Link state ID is not parsable: %s%s",
1053 argv[0], VNL);
1054 return CMD_SUCCESS;
1057 argc--;
1058 argv++;
1060 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1062 vty_out (vty, "Advertising Router is not parsable: %s%s",
1063 argv[0], VNL);
1064 return CMD_SUCCESS;
1067 argc--;
1068 argv++;
1069 level = parse_show_level (argc, argv);
1071 switch (OSPF6_LSA_SCOPE (type))
1073 case OSPF6_SCOPE_AREA:
1074 for (i = listhead (o->area_list); i; nextnode (i))
1076 oa = (struct ospf6_area *) getdata (i);
1077 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1078 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1080 break;
1082 case OSPF6_SCOPE_LINKLOCAL:
1083 for (i = listhead (o->area_list); i; nextnode (i))
1085 oa = (struct ospf6_area *) getdata (i);
1086 for (j = listhead (oa->if_list); j; nextnode (j))
1088 oi = (struct ospf6_interface *) getdata (j);
1089 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1090 oi->interface->name, oa->name, VNL, VNL);
1091 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1094 break;
1096 case OSPF6_SCOPE_AS:
1097 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1098 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1099 break;
1101 default:
1102 assert (0);
1103 break;
1106 vty_out (vty, "%s", VNL);
1107 return CMD_SUCCESS;
1110 ALIAS (show_ipv6_ospf6_database_type_id_router,
1111 show_ipv6_ospf6_database_type_id_router_detail_cmd,
1112 "show ipv6 ospf6 database "
1113 "(router|network|inter-prefix|inter-router|as-external|"
1114 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D "
1115 "(dump|internal)",
1116 SHOW_STR
1117 IPV6_STR
1118 OSPF6_STR
1119 "Display Link state database\n"
1120 "Display Router LSAs\n"
1121 "Display Network LSAs\n"
1122 "Display Inter-Area-Prefix LSAs\n"
1123 "Display Inter-Area-Router LSAs\n"
1124 "Display As-External LSAs\n"
1125 "Display Group-Membership LSAs\n"
1126 "Display Type-7 LSAs\n"
1127 "Display Link LSAs\n"
1128 "Display Intra-Area-Prefix LSAs\n"
1129 "Specify Link state ID as IPv4 address notation\n"
1130 "Specify Advertising Router as IPv4 address notation\n"
1131 "Dump LSAs\n"
1132 "Display LSA's internal information\n"
1135 DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1136 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd,
1137 "show ipv6 ospf6 database "
1138 "(router|network|inter-prefix|inter-router|as-external|"
1139 "group-membership|type-7|link|intra-prefix) "
1140 "adv-router A.B.C.D linkstate-id A.B.C.D",
1141 SHOW_STR
1142 IPV6_STR
1143 OSPF6_STR
1144 "Display Link state database\n"
1145 "Display Router LSAs\n"
1146 "Display Network LSAs\n"
1147 "Display Inter-Area-Prefix LSAs\n"
1148 "Display Inter-Area-Router LSAs\n"
1149 "Display As-External LSAs\n"
1150 "Display Group-Membership LSAs\n"
1151 "Display Type-7 LSAs\n"
1152 "Display Link LSAs\n"
1153 "Display Intra-Area-Prefix LSAs\n"
1154 "Search by Advertising Router\n"
1155 "Specify Advertising Router as IPv4 address notation\n"
1156 "Search by Link state ID\n"
1157 "Specify Link state ID as IPv4 address notation\n"
1160 int level;
1161 listnode i, j;
1162 struct ospf6 *o = ospf6;
1163 struct ospf6_area *oa;
1164 struct ospf6_interface *oi;
1165 u_int16_t type = 0;
1166 u_int32_t id = 0;
1167 u_int32_t adv_router = 0;
1169 OSPF6_CMD_CHECK_RUNNING ();
1171 type = parse_type_spec (argc, argv);
1172 argc--;
1173 argv++;
1175 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1177 vty_out (vty, "Advertising Router is not parsable: %s%s",
1178 argv[0], VNL);
1179 return CMD_SUCCESS;
1182 argc--;
1183 argv++;
1185 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1187 vty_out (vty, "Link state ID is not parsable: %s%s",
1188 argv[0], VNL);
1189 return CMD_SUCCESS;
1192 argc--;
1193 argv++;
1194 level = parse_show_level (argc, argv);
1196 switch (OSPF6_LSA_SCOPE (type))
1198 case OSPF6_SCOPE_AREA:
1199 for (i = listhead (o->area_list); i; nextnode (i))
1201 oa = (struct ospf6_area *) getdata (i);
1202 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1203 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1205 break;
1207 case OSPF6_SCOPE_LINKLOCAL:
1208 for (i = listhead (o->area_list); i; nextnode (i))
1210 oa = (struct ospf6_area *) getdata (i);
1211 for (j = listhead (oa->if_list); j; nextnode (j))
1213 oi = (struct ospf6_interface *) getdata (j);
1214 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1215 oi->interface->name, oa->name, VNL, VNL);
1216 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1219 break;
1221 case OSPF6_SCOPE_AS:
1222 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1223 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1224 break;
1226 default:
1227 assert (0);
1228 break;
1231 vty_out (vty, "%s", VNL);
1232 return CMD_SUCCESS;
1235 ALIAS (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1236 show_ipv6_ospf6_database_type_adv_router_linkstate_id_detail_cmd,
1237 "show ipv6 ospf6 database "
1238 "(router|network|inter-prefix|inter-router|as-external|"
1239 "group-membership|type-7|link|intra-prefix) "
1240 "adv-router A.B.C.D linkstate-id A.B.C.D "
1241 "(dump|internal)",
1242 SHOW_STR
1243 IPV6_STR
1244 OSPF6_STR
1245 "Display Link state database\n"
1246 "Display Router LSAs\n"
1247 "Display Network LSAs\n"
1248 "Display Inter-Area-Prefix LSAs\n"
1249 "Display Inter-Area-Router LSAs\n"
1250 "Display As-External LSAs\n"
1251 "Display Group-Membership LSAs\n"
1252 "Display Type-7 LSAs\n"
1253 "Display Link LSAs\n"
1254 "Display Intra-Area-Prefix LSAs\n"
1255 "Search by Advertising Router\n"
1256 "Specify Advertising Router as IPv4 address notation\n"
1257 "Search by Link state ID\n"
1258 "Specify Link state ID as IPv4 address notation\n"
1259 "Dump LSAs\n"
1260 "Display LSA's internal information\n"
1263 DEFUN (show_ipv6_ospf6_database_self_originated,
1264 show_ipv6_ospf6_database_self_originated_cmd,
1265 "show ipv6 ospf6 database self-originated",
1266 SHOW_STR
1267 IPV6_STR
1268 OSPF6_STR
1269 "Display Self-originated LSAs\n"
1272 int level;
1273 listnode i, j;
1274 struct ospf6 *o = ospf6;
1275 struct ospf6_area *oa;
1276 struct ospf6_interface *oi;
1277 u_int32_t adv_router = 0;
1279 OSPF6_CMD_CHECK_RUNNING ();
1281 level = parse_show_level (argc, argv);
1283 adv_router = o->router_id;
1285 for (i = listhead (o->area_list); i; nextnode (i))
1287 oa = (struct ospf6_area *) getdata (i);
1288 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1289 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
1292 for (i = listhead (o->area_list); i; nextnode (i))
1294 oa = (struct ospf6_area *) getdata (i);
1295 for (j = listhead (oa->if_list); j; nextnode (j))
1297 oi = (struct ospf6_interface *) getdata (j);
1298 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1299 oi->interface->name, oa->name, VNL, VNL);
1300 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
1304 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1305 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
1307 vty_out (vty, "%s", VNL);
1308 return CMD_SUCCESS;
1311 ALIAS (show_ipv6_ospf6_database_self_originated,
1312 show_ipv6_ospf6_database_self_originated_detail_cmd,
1313 "show ipv6 ospf6 database self-originated "
1314 "(detail|dump|internal)",
1315 SHOW_STR
1316 IPV6_STR
1317 OSPF6_STR
1318 "Display Self-originated LSAs\n"
1319 "Display details of LSAs\n"
1320 "Dump LSAs\n"
1321 "Display LSA's internal information\n"
1324 DEFUN (show_ipv6_ospf6_database_type_self_originated,
1325 show_ipv6_ospf6_database_type_self_originated_cmd,
1326 "show ipv6 ospf6 database "
1327 "(router|network|inter-prefix|inter-router|as-external|"
1328 "group-membership|type-7|link|intra-prefix) self-originated",
1329 SHOW_STR
1330 IPV6_STR
1331 OSPF6_STR
1332 "Display Link state database\n"
1333 "Display Router LSAs\n"
1334 "Display Network LSAs\n"
1335 "Display Inter-Area-Prefix LSAs\n"
1336 "Display Inter-Area-Router LSAs\n"
1337 "Display As-External LSAs\n"
1338 "Display Group-Membership LSAs\n"
1339 "Display Type-7 LSAs\n"
1340 "Display Link LSAs\n"
1341 "Display Intra-Area-Prefix LSAs\n"
1342 "Display Self-originated LSAs\n"
1345 int level;
1346 listnode i, j;
1347 struct ospf6 *o = ospf6;
1348 struct ospf6_area *oa;
1349 struct ospf6_interface *oi;
1350 u_int16_t type = 0;
1351 u_int32_t adv_router = 0;
1353 OSPF6_CMD_CHECK_RUNNING ();
1355 type = parse_type_spec (argc, argv);
1356 argc--;
1357 argv++;
1358 level = parse_show_level (argc, argv);
1360 adv_router = o->router_id;
1362 switch (OSPF6_LSA_SCOPE (type))
1364 case OSPF6_SCOPE_AREA:
1365 for (i = listhead (o->area_list); i; nextnode (i))
1367 oa = (struct ospf6_area *) getdata (i);
1368 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1369 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
1371 break;
1373 case OSPF6_SCOPE_LINKLOCAL:
1374 for (i = listhead (o->area_list); i; nextnode (i))
1376 oa = (struct ospf6_area *) getdata (i);
1377 for (j = listhead (oa->if_list); j; nextnode (j))
1379 oi = (struct ospf6_interface *) getdata (j);
1380 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1381 oi->interface->name, oa->name, VNL, VNL);
1382 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
1385 break;
1387 case OSPF6_SCOPE_AS:
1388 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1389 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
1390 break;
1392 default:
1393 assert (0);
1394 break;
1397 vty_out (vty, "%s", VNL);
1398 return CMD_SUCCESS;
1401 ALIAS (show_ipv6_ospf6_database_type_self_originated,
1402 show_ipv6_ospf6_database_type_self_originated_detail_cmd,
1403 "show ipv6 ospf6 database "
1404 "(router|network|inter-prefix|inter-router|as-external|"
1405 "group-membership|type-7|link|intra-prefix) self-originated "
1406 "(detail|dump|internal)",
1407 SHOW_STR
1408 IPV6_STR
1409 OSPF6_STR
1410 "Display Link state database\n"
1411 "Display Router LSAs\n"
1412 "Display Network LSAs\n"
1413 "Display Inter-Area-Prefix LSAs\n"
1414 "Display Inter-Area-Router LSAs\n"
1415 "Display As-External LSAs\n"
1416 "Display Group-Membership LSAs\n"
1417 "Display Type-7 LSAs\n"
1418 "Display Link LSAs\n"
1419 "Display Intra-Area-Prefix LSAs\n"
1420 "Display Self-originated LSAs\n"
1421 "Display details of LSAs\n"
1422 "Dump LSAs\n"
1423 "Display LSA's internal information\n"
1426 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1427 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
1428 "show ipv6 ospf6 database "
1429 "(router|network|inter-prefix|inter-router|as-external|"
1430 "group-membership|type-7|link|intra-prefix) self-originated "
1431 "linkstate-id A.B.C.D",
1432 SHOW_STR
1433 IPV6_STR
1434 OSPF6_STR
1435 "Display Link state database\n"
1436 "Display Router LSAs\n"
1437 "Display Network LSAs\n"
1438 "Display Inter-Area-Prefix LSAs\n"
1439 "Display Inter-Area-Router LSAs\n"
1440 "Display As-External LSAs\n"
1441 "Display Group-Membership LSAs\n"
1442 "Display Type-7 LSAs\n"
1443 "Display Link LSAs\n"
1444 "Display Intra-Area-Prefix LSAs\n"
1445 "Display Self-originated LSAs\n"
1446 "Search by Link state ID\n"
1447 "Specify Link state ID as IPv4 address notation\n"
1450 int level;
1451 listnode i, j;
1452 struct ospf6 *o = ospf6;
1453 struct ospf6_area *oa;
1454 struct ospf6_interface *oi;
1455 u_int16_t type = 0;
1456 u_int32_t adv_router = 0;
1457 u_int32_t id = 0;
1459 OSPF6_CMD_CHECK_RUNNING ();
1461 type = parse_type_spec (argc, argv);
1462 argc--;
1463 argv++;
1465 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1467 vty_out (vty, "Link State ID is not parsable: %s%s",
1468 argv[0], VNL);
1469 return CMD_SUCCESS;
1472 argc--;
1473 argv++;
1474 level = parse_show_level (argc, argv);
1476 adv_router = o->router_id;
1478 switch (OSPF6_LSA_SCOPE (type))
1480 case OSPF6_SCOPE_AREA:
1481 for (i = listhead (o->area_list); i; nextnode (i))
1483 oa = (struct ospf6_area *) getdata (i);
1484 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1485 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1487 break;
1489 case OSPF6_SCOPE_LINKLOCAL:
1490 for (i = listhead (o->area_list); i; nextnode (i))
1492 oa = (struct ospf6_area *) getdata (i);
1493 for (j = listhead (oa->if_list); j; nextnode (j))
1495 oi = (struct ospf6_interface *) getdata (j);
1496 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1497 oi->interface->name, oa->name, VNL, VNL);
1498 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1501 break;
1503 case OSPF6_SCOPE_AS:
1504 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1505 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1506 break;
1508 default:
1509 assert (0);
1510 break;
1513 vty_out (vty, "%s", VNL);
1514 return CMD_SUCCESS;
1517 ALIAS (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1518 show_ipv6_ospf6_database_type_self_originated_linkstate_id_detail_cmd,
1519 "show ipv6 ospf6 database "
1520 "(router|network|inter-prefix|inter-router|as-external|"
1521 "group-membership|type-7|link|intra-prefix) self-originated "
1522 "linkstate-id A.B.C.D (detail|dump|internal)",
1523 SHOW_STR
1524 IPV6_STR
1525 OSPF6_STR
1526 "Display Link state database\n"
1527 "Display Router LSAs\n"
1528 "Display Network LSAs\n"
1529 "Display Inter-Area-Prefix LSAs\n"
1530 "Display Inter-Area-Router LSAs\n"
1531 "Display As-External LSAs\n"
1532 "Display Group-Membership LSAs\n"
1533 "Display Type-7 LSAs\n"
1534 "Display Link LSAs\n"
1535 "Display Intra-Area-Prefix LSAs\n"
1536 "Display Self-originated LSAs\n"
1537 "Search by Link state ID\n"
1538 "Specify Link state ID as IPv4 address notation\n"
1539 "Display details of LSAs\n"
1540 "Dump LSAs\n"
1541 "Display LSA's internal information\n"
1544 DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
1545 show_ipv6_ospf6_database_type_id_self_originated_cmd,
1546 "show ipv6 ospf6 database "
1547 "(router|network|inter-prefix|inter-router|as-external|"
1548 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated",
1549 SHOW_STR
1550 IPV6_STR
1551 OSPF6_STR
1552 "Display Link state database\n"
1553 "Display Router LSAs\n"
1554 "Display Network LSAs\n"
1555 "Display Inter-Area-Prefix LSAs\n"
1556 "Display Inter-Area-Router LSAs\n"
1557 "Display As-External LSAs\n"
1558 "Display Group-Membership LSAs\n"
1559 "Display Type-7 LSAs\n"
1560 "Display Link LSAs\n"
1561 "Display Intra-Area-Prefix LSAs\n"
1562 "Specify Link state ID as IPv4 address notation\n"
1563 "Display Self-originated LSAs\n"
1566 int level;
1567 listnode i, j;
1568 struct ospf6 *o = ospf6;
1569 struct ospf6_area *oa;
1570 struct ospf6_interface *oi;
1571 u_int16_t type = 0;
1572 u_int32_t adv_router = 0;
1573 u_int32_t id = 0;
1575 OSPF6_CMD_CHECK_RUNNING ();
1577 type = parse_type_spec (argc, argv);
1578 argc--;
1579 argv++;
1581 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1583 vty_out (vty, "Link State ID is not parsable: %s%s",
1584 argv[0], VNL);
1585 return CMD_SUCCESS;
1588 argc--;
1589 argv++;
1590 level = parse_show_level (argc, argv);
1592 adv_router = o->router_id;
1594 switch (OSPF6_LSA_SCOPE (type))
1596 case OSPF6_SCOPE_AREA:
1597 for (i = listhead (o->area_list); i; nextnode (i))
1599 oa = (struct ospf6_area *) getdata (i);
1600 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1601 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1603 break;
1605 case OSPF6_SCOPE_LINKLOCAL:
1606 for (i = listhead (o->area_list); i; nextnode (i))
1608 oa = (struct ospf6_area *) getdata (i);
1609 for (j = listhead (oa->if_list); j; nextnode (j))
1611 oi = (struct ospf6_interface *) getdata (j);
1612 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1613 oi->interface->name, oa->name, VNL, VNL);
1614 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1617 break;
1619 case OSPF6_SCOPE_AS:
1620 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1621 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1622 break;
1624 default:
1625 assert (0);
1626 break;
1629 vty_out (vty, "%s", VNL);
1630 return CMD_SUCCESS;
1633 ALIAS (show_ipv6_ospf6_database_type_id_self_originated,
1634 show_ipv6_ospf6_database_type_id_self_originated_detail_cmd,
1635 "show ipv6 ospf6 database "
1636 "(router|network|inter-prefix|inter-router|as-external|"
1637 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated "
1638 "(detail|dump|internal)",
1639 SHOW_STR
1640 IPV6_STR
1641 OSPF6_STR
1642 "Display Link state database\n"
1643 "Display Router LSAs\n"
1644 "Display Network LSAs\n"
1645 "Display Inter-Area-Prefix LSAs\n"
1646 "Display Inter-Area-Router LSAs\n"
1647 "Display As-External LSAs\n"
1648 "Display Group-Membership LSAs\n"
1649 "Display Type-7 LSAs\n"
1650 "Display Link LSAs\n"
1651 "Display Intra-Area-Prefix LSAs\n"
1652 "Display Self-originated LSAs\n"
1653 "Search by Link state ID\n"
1654 "Specify Link state ID as IPv4 address notation\n"
1655 "Display details of LSAs\n"
1656 "Dump LSAs\n"
1657 "Display LSA's internal information\n"
1661 DEFUN (show_ipv6_ospf6_border_routers,
1662 show_ipv6_ospf6_border_routers_cmd,
1663 "show ipv6 ospf6 border-routers",
1664 SHOW_STR
1665 IP6_STR
1666 OSPF6_STR
1667 "Display routing table for ABR and ASBR\n"
1670 u_int32_t adv_router;
1671 void (*showfunc) (struct vty *, struct ospf6_route *);
1672 struct ospf6_route *ro;
1673 struct prefix prefix;
1675 OSPF6_CMD_CHECK_RUNNING ();
1677 if (argc && ! strcmp ("detail", argv[0]))
1679 showfunc = ospf6_route_show_detail;
1680 argc--;
1681 argv++;
1683 else
1684 showfunc = ospf6_brouter_show;
1686 if (argc)
1688 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1690 vty_out (vty, "Router ID is not parsable: %s%s", argv[0], VNL);
1691 return CMD_SUCCESS;
1694 ospf6_linkstate_prefix (adv_router, 0, &prefix);
1695 ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
1696 ospf6_route_show_detail (vty, ro);
1697 return CMD_SUCCESS;
1700 if (showfunc == ospf6_brouter_show)
1701 ospf6_brouter_show_header (vty);
1703 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1704 ro = ospf6_route_next (ro))
1705 (*showfunc) (vty, ro);
1707 return CMD_SUCCESS;
1710 ALIAS (show_ipv6_ospf6_border_routers,
1711 show_ipv6_ospf6_border_routers_detail_cmd,
1712 "show ipv6 ospf6 border-routers (A.B.C.D|detail)",
1713 SHOW_STR
1714 IP6_STR
1715 OSPF6_STR
1716 "Display routing table for ABR and ASBR\n"
1717 "Specify Router-ID\n"
1718 "Display Detail\n"
1721 DEFUN (show_ipv6_ospf6_linkstate,
1722 show_ipv6_ospf6_linkstate_cmd,
1723 "show ipv6 ospf6 linkstate",
1724 SHOW_STR
1725 IP6_STR
1726 OSPF6_STR
1727 "Display linkstate routing table\n"
1730 listnode node;
1731 struct ospf6_area *oa;
1733 for (node = listhead (ospf6->area_list); node; nextnode (node))
1735 oa = OSPF6_AREA (getdata (node));
1737 vty_out (vty, "%s SPF Result in Area %s%s%s",
1738 VNL, oa->name, VNL, VNL);
1739 ospf6_linkstate_table_show (vty, argc, argv, oa->spf_table);
1742 vty_out (vty, "%s", VNL);
1743 return CMD_SUCCESS;
1746 ALIAS (show_ipv6_ospf6_linkstate,
1747 show_ipv6_ospf6_linkstate_router_cmd,
1748 "show ipv6 ospf6 linkstate router A.B.C.D",
1749 SHOW_STR
1750 IP6_STR
1751 OSPF6_STR
1752 "Display linkstate routing table\n"
1753 "Display Router Entry\n"
1754 "Specify Router ID as IPv4 address notation\n"
1757 ALIAS (show_ipv6_ospf6_linkstate,
1758 show_ipv6_ospf6_linkstate_network_cmd,
1759 "show ipv6 ospf6 linkstate network A.B.C.D A.B.C.D",
1760 SHOW_STR
1761 IP6_STR
1762 OSPF6_STR
1763 "Display linkstate routing table\n"
1764 "Display Network Entry\n"
1765 "Specify Router ID as IPv4 address notation\n"
1766 "Specify Link state ID as IPv4 address notation\n"
1769 DEFUN (show_ipv6_ospf6_linkstate_detail,
1770 show_ipv6_ospf6_linkstate_detail_cmd,
1771 "show ipv6 ospf6 linkstate detail",
1772 SHOW_STR
1773 IP6_STR
1774 OSPF6_STR
1775 "Display linkstate routing table\n"
1778 char *sargv[CMD_ARGC_MAX];
1779 int i, sargc;
1780 listnode node;
1781 struct ospf6_area *oa;
1783 /* copy argv to sargv and then append "detail" */
1784 for (i = 0; i < argc; i++)
1785 sargv[i] = argv[i];
1786 sargc = argc;
1787 sargv[sargc++] = "detail";
1788 sargv[sargc] = NULL;
1790 for (node = listhead (ospf6->area_list); node; nextnode (node))
1792 oa = OSPF6_AREA (getdata (node));
1794 vty_out (vty, "%s SPF Result in Area %s%s%s",
1795 VNL, oa->name, VNL, VNL);
1796 ospf6_linkstate_table_show (vty, sargc, sargv, oa->spf_table);
1799 vty_out (vty, "%s", VNL);
1800 return CMD_SUCCESS;
1803 /* Install ospf related commands. */
1804 void
1805 ospf6_init ()
1807 ospf6_top_init ();
1808 ospf6_area_init ();
1809 ospf6_interface_init ();
1810 ospf6_neighbor_init ();
1811 ospf6_zebra_init ();
1813 ospf6_lsa_init ();
1814 ospf6_spf_init ();
1815 ospf6_intra_init ();
1816 ospf6_asbr_init ();
1817 ospf6_abr_init ();
1819 #ifdef HAVE_SNMP
1820 ospf6_snmp_init ();
1821 #endif /*HAVE_SNMP*/
1823 install_node (&debug_node, config_write_ospf6_debug);
1825 install_element_ospf6_debug_message ();
1826 install_element_ospf6_debug_lsa ();
1827 install_element_ospf6_debug_interface ();
1828 install_element_ospf6_debug_neighbor ();
1829 install_element_ospf6_debug_zebra ();
1830 install_element_ospf6_debug_spf ();
1831 install_element_ospf6_debug_route ();
1832 install_element_ospf6_debug_asbr ();
1833 install_element_ospf6_debug_abr ();
1834 install_element_ospf6_debug_flood ();
1836 install_element (VIEW_NODE, &show_version_ospf6_cmd);
1837 install_element (ENABLE_NODE, &show_version_ospf6_cmd);
1839 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
1840 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1841 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_cmd);
1842 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1844 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd);
1845 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_router_cmd);
1846 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_network_cmd);
1847 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
1848 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_cmd);
1849 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_router_cmd);
1850 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_network_cmd);
1851 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
1853 #define INSTALL(n,c) \
1854 install_element (n ## _NODE, &show_ipv6_ospf6_ ## c);
1856 INSTALL (VIEW, database_cmd);
1857 INSTALL (VIEW, database_detail_cmd);
1858 INSTALL (VIEW, database_type_cmd);
1859 INSTALL (VIEW, database_type_detail_cmd);
1860 INSTALL (VIEW, database_id_cmd);
1861 INSTALL (VIEW, database_id_detail_cmd);
1862 INSTALL (VIEW, database_linkstate_id_cmd);
1863 INSTALL (VIEW, database_linkstate_id_detail_cmd);
1864 INSTALL (VIEW, database_router_cmd);
1865 INSTALL (VIEW, database_router_detail_cmd);
1866 INSTALL (VIEW, database_adv_router_cmd);
1867 INSTALL (VIEW, database_adv_router_detail_cmd);
1868 INSTALL (VIEW, database_type_id_cmd);
1869 INSTALL (VIEW, database_type_id_detail_cmd);
1870 INSTALL (VIEW, database_type_linkstate_id_cmd);
1871 INSTALL (VIEW, database_type_linkstate_id_detail_cmd);
1872 INSTALL (VIEW, database_type_router_cmd);
1873 INSTALL (VIEW, database_type_router_detail_cmd);
1874 INSTALL (VIEW, database_type_adv_router_cmd);
1875 INSTALL (VIEW, database_type_adv_router_detail_cmd);
1876 INSTALL (VIEW, database_adv_router_linkstate_id_cmd);
1877 INSTALL (VIEW, database_adv_router_linkstate_id_detail_cmd);
1878 INSTALL (VIEW, database_id_router_cmd);
1879 INSTALL (VIEW, database_id_router_detail_cmd);
1880 INSTALL (VIEW, database_type_id_router_cmd);
1881 INSTALL (VIEW, database_type_id_router_detail_cmd);
1882 INSTALL (VIEW, database_type_adv_router_linkstate_id_cmd);
1883 INSTALL (VIEW, database_type_adv_router_linkstate_id_detail_cmd);
1884 INSTALL (VIEW, database_self_originated_cmd);
1885 INSTALL (VIEW, database_self_originated_detail_cmd);
1886 INSTALL (VIEW, database_type_self_originated_cmd);
1887 INSTALL (VIEW, database_type_self_originated_detail_cmd);
1888 INSTALL (VIEW, database_type_id_self_originated_cmd);
1889 INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
1890 INSTALL (VIEW, database_type_self_originated_linkstate_id_cmd);
1891 INSTALL (VIEW, database_type_self_originated_linkstate_id_detail_cmd);
1892 INSTALL (VIEW, database_type_id_self_originated_cmd);
1893 INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
1895 INSTALL (ENABLE, database_cmd);
1896 INSTALL (ENABLE, database_detail_cmd);
1897 INSTALL (ENABLE, database_type_cmd);
1898 INSTALL (ENABLE, database_type_detail_cmd);
1899 INSTALL (ENABLE, database_id_cmd);
1900 INSTALL (ENABLE, database_id_detail_cmd);
1901 INSTALL (ENABLE, database_linkstate_id_cmd);
1902 INSTALL (ENABLE, database_linkstate_id_detail_cmd);
1903 INSTALL (ENABLE, database_router_cmd);
1904 INSTALL (ENABLE, database_router_detail_cmd);
1905 INSTALL (ENABLE, database_adv_router_cmd);
1906 INSTALL (ENABLE, database_adv_router_detail_cmd);
1907 INSTALL (ENABLE, database_type_id_cmd);
1908 INSTALL (ENABLE, database_type_id_detail_cmd);
1909 INSTALL (ENABLE, database_type_linkstate_id_cmd);
1910 INSTALL (ENABLE, database_type_linkstate_id_detail_cmd);
1911 INSTALL (ENABLE, database_type_router_cmd);
1912 INSTALL (ENABLE, database_type_router_detail_cmd);
1913 INSTALL (ENABLE, database_type_adv_router_cmd);
1914 INSTALL (ENABLE, database_type_adv_router_detail_cmd);
1915 INSTALL (ENABLE, database_adv_router_linkstate_id_cmd);
1916 INSTALL (ENABLE, database_adv_router_linkstate_id_detail_cmd);
1917 INSTALL (ENABLE, database_id_router_cmd);
1918 INSTALL (ENABLE, database_id_router_detail_cmd);
1919 INSTALL (ENABLE, database_type_id_router_cmd);
1920 INSTALL (ENABLE, database_type_id_router_detail_cmd);
1921 INSTALL (ENABLE, database_type_adv_router_linkstate_id_cmd);
1922 INSTALL (ENABLE, database_type_adv_router_linkstate_id_detail_cmd);
1923 INSTALL (ENABLE, database_self_originated_cmd);
1924 INSTALL (ENABLE, database_self_originated_detail_cmd);
1925 INSTALL (ENABLE, database_type_self_originated_cmd);
1926 INSTALL (ENABLE, database_type_self_originated_detail_cmd);
1927 INSTALL (ENABLE, database_type_id_self_originated_cmd);
1928 INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
1929 INSTALL (ENABLE, database_type_self_originated_linkstate_id_cmd);
1930 INSTALL (ENABLE, database_type_self_originated_linkstate_id_detail_cmd);
1931 INSTALL (ENABLE, database_type_id_self_originated_cmd);
1932 INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
1934 /* Make ospf protocol socket. */
1935 ospf6_serv_sock ();
1936 thread_add_read (master, ospf6_receive, NULL, ospf6_sock);