]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6d.c
*: add indent control files
[mirror_frr.git] / ospf6d / ospf6d.c
CommitLineData
718e3744 1/*
508e53e2 2 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 3 *
4 * This file is part of GNU Zebra.
5 *
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.
10 *
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.
15 *
896014f4
DL
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
718e3744 19 */
20
508e53e2 21#include <zebra.h>
718e3744 22
508e53e2 23#include "thread.h"
24#include "linklist.h"
25#include "vty.h"
26#include "command.h"
718e3744 27
508e53e2 28#include "ospf6_proto.h"
29#include "ospf6_network.h"
30#include "ospf6_lsa.h"
31#include "ospf6_lsdb.h"
32#include "ospf6_message.h"
33#include "ospf6_route.h"
34#include "ospf6_zebra.h"
35#include "ospf6_spf.h"
36#include "ospf6_top.h"
37#include "ospf6_area.h"
38#include "ospf6_interface.h"
39#include "ospf6_neighbor.h"
40#include "ospf6_intra.h"
41#include "ospf6_asbr.h"
049207c3 42#include "ospf6_abr.h"
1e05838a 43#include "ospf6_flood.h"
049207c3 44#include "ospf6d.h"
7f342629 45#include "ospf6_bfd.h"
718e3744 46
47char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION;
48
508e53e2 49struct route_node *
50route_prev (struct route_node *node)
718e3744 51{
508e53e2 52 struct route_node *end;
53 struct route_node *prev = NULL;
718e3744 54
508e53e2 55 end = node;
56 node = node->parent;
3b68735f 57 if (node)
58 route_lock_node (node);
508e53e2 59 while (node)
60 {
61 prev = node;
3b68735f 62 node = route_next (node);
63 if (node == end)
64 {
65 route_unlock_node (node);
66 node = NULL;
67 }
508e53e2 68 }
69 route_unlock_node (end);
3b68735f 70 if (prev)
71 route_lock_node (prev);
718e3744 72
508e53e2 73 return prev;
718e3744 74}
75
6b0655a2 76
6452df09 77/* show database functions */
718e3744 78DEFUN (show_version_ospf6,
79 show_version_ospf6_cmd,
80 "show version ospf6",
81 SHOW_STR
3a2d747c
QY
82 "Display version\n"
83 "Display ospf6d version\n"
508e53e2 84 )
718e3744 85{
55f70b67
DL
86 vty_out (vty, "Zebra OSPF6d Version: %s\n",
87 ospf6_daemon_version);
718e3744 88
89 return CMD_SUCCESS;
90}
91
7fc626de 92static struct cmd_node debug_node =
718e3744 93{
508e53e2 94 DEBUG_NODE,
69b4a810 95 "",
96 1 /* VTYSH */
508e53e2 97};
718e3744 98
6ac29a51 99static int
508e53e2 100config_write_ospf6_debug (struct vty *vty)
101{
102 config_write_ospf6_debug_message (vty);
103 config_write_ospf6_debug_lsa (vty);
104 config_write_ospf6_debug_zebra (vty);
105 config_write_ospf6_debug_interface (vty);
106 config_write_ospf6_debug_neighbor (vty);
107 config_write_ospf6_debug_spf (vty);
108 config_write_ospf6_debug_route (vty);
cb4b8845 109 config_write_ospf6_debug_brouter (vty);
508e53e2 110 config_write_ospf6_debug_asbr (vty);
049207c3 111 config_write_ospf6_debug_abr (vty);
1e05838a 112 config_write_ospf6_debug_flood (vty);
26a429fe 113 vty_out (vty, "!\n");
508e53e2 114 return 0;
718e3744 115}
116
049207c3 117#define AREA_LSDB_TITLE_FORMAT \
625e016d 118 "\n Area Scoped Link State Database (Area %s)\n\n"
049207c3 119#define IF_LSDB_TITLE_FORMAT \
625e016d 120 "\n I/F Scoped Link State Database (I/F %s in Area %s)\n\n"
049207c3 121#define AS_LSDB_TITLE_FORMAT \
625e016d 122 "\n AS Scoped Link State Database\n\n"
049207c3 123
124static int
14b16482 125parse_show_level (int idx_level, int argc, struct cmd_token **argv)
049207c3 126{
14b16482
DW
127 int level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
128
129 if (argc > idx_level)
049207c3 130 {
14b16482 131 if (strmatch (argv[idx_level]->text, "detail"))
049207c3 132 level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;
14b16482 133 else if (strmatch (argv[idx_level]->text, "dump"))
049207c3 134 level = OSPF6_LSDB_SHOW_LEVEL_DUMP;
14b16482 135 else if (strmatch (argv[idx_level]->text, "internal"))
049207c3 136 level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL;
137 }
14b16482 138
049207c3 139 return level;
140}
141
142static u_int16_t
14b16482 143parse_type_spec (int idx_lsa, int argc, struct cmd_token **argv)
049207c3 144{
6452df09 145 u_int16_t type = 0;
14b16482
DW
146
147 if (argc > idx_lsa)
148 {
30a24af0 149 if (strmatch (argv[idx_lsa]->text, "router"))
14b16482 150 type = htons (OSPF6_LSTYPE_ROUTER);
30a24af0 151 else if (strmatch (argv[idx_lsa]->text, "network"))
14b16482 152 type = htons (OSPF6_LSTYPE_NETWORK);
30a24af0 153 else if (strmatch (argv[idx_lsa]->text, "as-external"))
14b16482 154 type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
30a24af0 155 else if (strmatch (argv[idx_lsa]->text, "intra-prefix"))
14b16482 156 type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
30a24af0 157 else if (strmatch (argv[idx_lsa]->text, "inter-router"))
14b16482 158 type = htons (OSPF6_LSTYPE_INTER_ROUTER);
30a24af0 159 else if (strmatch (argv[idx_lsa]->text, "inter-prefix"))
14b16482 160 type = htons (OSPF6_LSTYPE_INTER_PREFIX);
30a24af0 161 else if (strmatch (argv[idx_lsa]->text, "link"))
14b16482
DW
162 type = htons (OSPF6_LSTYPE_LINK);
163 }
164
049207c3 165 return type;
166}
167
508e53e2 168DEFUN (show_ipv6_ospf6_database,
169 show_ipv6_ospf6_database_cmd,
6de69f83 170 "show ipv6 ospf6 database [<detail|dump|internal>]",
508e53e2 171 SHOW_STR
172 IPV6_STR
173 OSPF6_STR
174 "Display Link state database\n"
14b16482
DW
175 "Display details of LSAs\n"
176 "Dump LSAs\n"
177 "Display LSA's internal information\n")
718e3744 178{
14b16482 179 int idx_level = 4;
049207c3 180 int level;
52dc7ee6 181 struct listnode *i, *j;
508e53e2 182 struct ospf6 *o = ospf6;
049207c3 183 struct ospf6_area *oa;
184 struct ospf6_interface *oi;
508e53e2 185
186 OSPF6_CMD_CHECK_RUNNING ();
187
14b16482 188 level = parse_show_level (idx_level, argc, argv);
718e3744 189
1eb8ef25 190 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
508e53e2 191 {
625e016d 192 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 193 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oa->lsdb);
508e53e2 194 }
049207c3 195
1eb8ef25 196 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
508e53e2 197 {
1eb8ef25 198 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
508e53e2 199 {
625e016d
DL
200 vty_out (vty, IF_LSDB_TITLE_FORMAT,
201 oi->interface->name, oa->name);
049207c3 202 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oi->lsdb);
508e53e2 203 }
204 }
718e3744 205
625e016d 206 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 207 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, o->lsdb);
208
26a429fe 209 vty_out (vty, "\n");
718e3744 210 return CMD_SUCCESS;
211}
212
508e53e2 213DEFUN (show_ipv6_ospf6_database_type,
214 show_ipv6_ospf6_database_type_cmd,
14b16482 215 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>]",
718e3744 216 SHOW_STR
508e53e2 217 IPV6_STR
218 OSPF6_STR
219 "Display Link state database\n"
220 "Display Router LSAs\n"
221 "Display Network LSAs\n"
222 "Display Inter-Area-Prefix LSAs\n"
223 "Display Inter-Area-Router LSAs\n"
224 "Display As-External LSAs\n"
225 "Display Group-Membership LSAs\n"
226 "Display Type-7 LSAs\n"
227 "Display Link LSAs\n"
228 "Display Intra-Area-Prefix LSAs\n"
14b16482
DW
229 "Display details of LSAs\n"
230 "Dump LSAs\n"
231 "Display LSA's internal information\n"
508e53e2 232 )
718e3744 233{
14b16482
DW
234 int idx_lsa = 4;
235 int idx_level = 5;
049207c3 236 int level;
52dc7ee6 237 struct listnode *i, *j;
508e53e2 238 struct ospf6 *o = ospf6;
049207c3 239 struct ospf6_area *oa;
240 struct ospf6_interface *oi;
508e53e2 241 u_int16_t type = 0;
242
718e3744 243 OSPF6_CMD_CHECK_RUNNING ();
244
14b16482
DW
245 type = parse_type_spec (idx_lsa, argc, argv);
246 level = parse_show_level (idx_level, argc, argv);
508e53e2 247
049207c3 248 switch (OSPF6_LSA_SCOPE (type))
508e53e2 249 {
6452df09 250 case OSPF6_SCOPE_AREA:
1eb8ef25 251 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 252 {
625e016d 253 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 254 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oa->lsdb);
255 }
256 break;
257
6452df09 258 case OSPF6_SCOPE_LINKLOCAL:
1eb8ef25 259 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 260 {
1eb8ef25 261 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
049207c3 262 {
625e016d
DL
263 vty_out (vty, IF_LSDB_TITLE_FORMAT,
264 oi->interface->name, oa->name);
049207c3 265 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oi->lsdb);
266 }
267 }
268 break;
269
6452df09 270 case OSPF6_SCOPE_AS:
625e016d 271 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 272 ospf6_lsdb_show (vty, level, &type, NULL, NULL, o->lsdb);
273 break;
274
275 default:
276 assert (0);
277 break;
508e53e2 278 }
279
26a429fe 280 vty_out (vty, "\n");
718e3744 281 return CMD_SUCCESS;
282}
283
508e53e2 284DEFUN (show_ipv6_ospf6_database_id,
285 show_ipv6_ospf6_database_id_cmd,
093d7a3a 286 "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D [<detail|dump|internal>]",
718e3744 287 SHOW_STR
508e53e2 288 IPV6_STR
718e3744 289 OSPF6_STR
508e53e2 290 "Display Link state database\n"
291 "Any Link state Type\n"
093d7a3a 292 "Search by Link state ID\n"
508e53e2 293 "Specify Link state ID as IPv4 address notation\n"
093d7a3a
DW
294 "Display details of LSAs\n"
295 "Dump LSAs\n"
296 "Display LSA's internal information\n")
718e3744 297{
373886ab 298 int idx_ipv4 = 5;
14b16482 299 int idx_level = 6;
049207c3 300 int level;
52dc7ee6 301 struct listnode *i, *j;
508e53e2 302 struct ospf6 *o = ospf6;
049207c3 303 struct ospf6_area *oa;
304 struct ospf6_interface *oi;
508e53e2 305 u_int32_t id = 0;
306
718e3744 307 OSPF6_CMD_CHECK_RUNNING ();
093d7a3a
DW
308
309 if (argv[idx_ipv4]->type == IPV4_TKN)
310 inet_pton (AF_INET, argv[idx_ipv4]->arg, &id);
311
14b16482 312 level = parse_show_level (idx_level, argc, argv);
049207c3 313
1eb8ef25 314 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
508e53e2 315 {
625e016d 316 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 317 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oa->lsdb);
508e53e2 318 }
049207c3 319
1eb8ef25 320 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
508e53e2 321 {
1eb8ef25 322 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
508e53e2 323 {
625e016d
DL
324 vty_out (vty, IF_LSDB_TITLE_FORMAT,
325 oi->interface->name, oa->name);
049207c3 326 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oi->lsdb);
508e53e2 327 }
328 }
718e3744 329
625e016d 330 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 331 ospf6_lsdb_show (vty, level, NULL, &id, NULL, o->lsdb);
332
26a429fe 333 vty_out (vty, "\n");
718e3744 334 return CMD_SUCCESS;
335}
336
508e53e2 337DEFUN (show_ipv6_ospf6_database_router,
338 show_ipv6_ospf6_database_router_cmd,
093d7a3a 339 "show ipv6 ospf6 database <*|adv-router> * A.B.C.D <detail|dump|internal>",
508e53e2 340 SHOW_STR
341 IPV6_STR
342 OSPF6_STR
343 "Display Link state database\n"
344 "Any Link state Type\n"
093d7a3a 345 "Search by Advertising Router\n"
508e53e2 346 "Any Link state ID\n"
347 "Specify Advertising Router as IPv4 address notation\n"
093d7a3a
DW
348 "Display details of LSAs\n"
349 "Dump LSAs\n"
350 "Display LSA's internal information\n")
718e3744 351{
51c26414 352 int idx_ipv4 = 6;
14b16482 353 int idx_level = 7;
049207c3 354 int level;
52dc7ee6 355 struct listnode *i, *j;
508e53e2 356 struct ospf6 *o = ospf6;
049207c3 357 struct ospf6_area *oa;
358 struct ospf6_interface *oi;
359 u_int32_t adv_router = 0;
718e3744 360
508e53e2 361 OSPF6_CMD_CHECK_RUNNING ();
14b16482
DW
362 inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router);
363 level = parse_show_level (idx_level, argc, argv);
049207c3 364
1eb8ef25 365 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
718e3744 366 {
625e016d 367 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 368 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
718e3744 369 }
049207c3 370
1eb8ef25 371 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
718e3744 372 {
1eb8ef25 373 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
508e53e2 374 {
625e016d
DL
375 vty_out (vty, IF_LSDB_TITLE_FORMAT,
376 oi->interface->name, oa->name);
049207c3 377 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
508e53e2 378 }
718e3744 379 }
380
625e016d 381 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 382 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
383
26a429fe 384 vty_out (vty, "\n");
508e53e2 385 return CMD_SUCCESS;
386}
387
508e53e2 388DEFUN (show_ipv6_ospf6_database_type_id,
389 show_ipv6_ospf6_database_type_id_cmd,
373886ab 390 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> linkstate-id A.B.C.D [<detail|dump|internal>]",
508e53e2 391 SHOW_STR
392 IPV6_STR
393 OSPF6_STR
394 "Display Link state database\n"
395 "Display Router LSAs\n"
396 "Display Network LSAs\n"
397 "Display Inter-Area-Prefix LSAs\n"
398 "Display Inter-Area-Router LSAs\n"
399 "Display As-External LSAs\n"
400 "Display Group-Membership LSAs\n"
401 "Display Type-7 LSAs\n"
402 "Display Link LSAs\n"
403 "Display Intra-Area-Prefix LSAs\n"
093d7a3a 404 "Search by Link state ID\n"
508e53e2 405 "Specify Link state ID as IPv4 address notation\n"
093d7a3a
DW
406 "Display details of LSAs\n"
407 "Dump LSAs\n"
408 "Display LSA's internal information\n"
508e53e2 409 )
410{
51c26414 411 int idx_lsa = 4;
093d7a3a
DW
412 int idx_ipv4 = 6;
413 int idx_level = 7;
049207c3 414 int level;
52dc7ee6 415 struct listnode *i, *j;
508e53e2 416 struct ospf6 *o = ospf6;
049207c3 417 struct ospf6_area *oa;
418 struct ospf6_interface *oi;
508e53e2 419 u_int16_t type = 0;
420 u_int32_t id = 0;
421
422 OSPF6_CMD_CHECK_RUNNING ();
423
14b16482
DW
424 type = parse_type_spec (idx_lsa, argc, argv);
425 inet_pton (AF_INET, argv[idx_ipv4]->arg, &id);
426 level = parse_show_level (idx_level, argc, argv);
049207c3 427
428 switch (OSPF6_LSA_SCOPE (type))
718e3744 429 {
6452df09 430 case OSPF6_SCOPE_AREA:
1eb8ef25 431 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 432 {
625e016d 433 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 434 ospf6_lsdb_show (vty, level, &type, &id, NULL, oa->lsdb);
435 }
436 break;
437
6452df09 438 case OSPF6_SCOPE_LINKLOCAL:
1eb8ef25 439 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 440 {
1eb8ef25 441 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
049207c3 442 {
625e016d
DL
443 vty_out (vty, IF_LSDB_TITLE_FORMAT,
444 oi->interface->name, oa->name);
049207c3 445 ospf6_lsdb_show (vty, level, &type, &id, NULL, oi->lsdb);
446 }
447 }
448 break;
449
6452df09 450 case OSPF6_SCOPE_AS:
625e016d 451 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 452 ospf6_lsdb_show (vty, level, &type, &id, NULL, o->lsdb);
453 break;
454
455 default:
456 assert (0);
457 break;
718e3744 458 }
459
26a429fe 460 vty_out (vty, "\n");
718e3744 461 return CMD_SUCCESS;
462}
463
508e53e2 464DEFUN (show_ipv6_ospf6_database_type_router,
465 show_ipv6_ospf6_database_type_router_cmd,
093d7a3a 466 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> <*|adv-router> A.B.C.D [<detail|dump|internal>]",
508e53e2 467 SHOW_STR
468 IPV6_STR
469 OSPF6_STR
470 "Display Link state database\n"
471 "Display Router LSAs\n"
472 "Display Network LSAs\n"
473 "Display Inter-Area-Prefix LSAs\n"
474 "Display Inter-Area-Router LSAs\n"
475 "Display As-External LSAs\n"
476 "Display Group-Membership LSAs\n"
477 "Display Type-7 LSAs\n"
478 "Display Link LSAs\n"
479 "Display Intra-Area-Prefix LSAs\n"
480 "Any Link state ID\n"
093d7a3a 481 "Search by Advertising Router\n"
508e53e2 482 "Specify Advertising Router as IPv4 address notation\n"
093d7a3a
DW
483 "Display details of LSAs\n"
484 "Dump LSAs\n"
485 "Display LSA's internal information\n"
718e3744 486 )
487{
51c26414 488 int idx_lsa = 4;
14b16482
DW
489 int idx_ipv4 = 6;
490 int idx_level = 7;
049207c3 491 int level;
52dc7ee6 492 struct listnode *i, *j;
508e53e2 493 struct ospf6 *o = ospf6;
049207c3 494 struct ospf6_area *oa;
495 struct ospf6_interface *oi;
508e53e2 496 u_int16_t type = 0;
049207c3 497 u_int32_t adv_router = 0;
718e3744 498
508e53e2 499 OSPF6_CMD_CHECK_RUNNING ();
718e3744 500
14b16482
DW
501 type = parse_type_spec (idx_lsa, argc, argv);
502 inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router);
503 level = parse_show_level (idx_level, argc, argv);
049207c3 504
505 switch (OSPF6_LSA_SCOPE (type))
508e53e2 506 {
6452df09 507 case OSPF6_SCOPE_AREA:
1eb8ef25 508 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 509 {
625e016d 510 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 511 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
512 }
513 break;
514
6452df09 515 case OSPF6_SCOPE_LINKLOCAL:
1eb8ef25 516 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 517 {
1eb8ef25 518 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
049207c3 519 {
625e016d
DL
520 vty_out (vty, IF_LSDB_TITLE_FORMAT,
521 oi->interface->name, oa->name);
049207c3 522 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
523 }
524 }
525 break;
526
6452df09 527 case OSPF6_SCOPE_AS:
625e016d 528 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 529 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
530 break;
531
532 default:
533 assert (0);
534 break;
508e53e2 535 }
718e3744 536
26a429fe 537 vty_out (vty, "\n");
508e53e2 538 return CMD_SUCCESS;
718e3744 539}
540
508e53e2 541
049207c3 542DEFUN (show_ipv6_ospf6_database_id_router,
543 show_ipv6_ospf6_database_id_router_cmd,
14b16482 544 "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>]",
049207c3 545 SHOW_STR
546 IPV6_STR
547 OSPF6_STR
548 "Display Link state database\n"
549 "Any Link state Type\n"
550 "Specify Link state ID as IPv4 address notation\n"
551 "Specify Advertising Router as IPv4 address notation\n"
14b16482
DW
552 "Display details of LSAs\n"
553 "Dump LSAs\n"
554 "Display LSA's internal information\n"
049207c3 555 )
556{
14b16482
DW
557 int idx_ls_id = 5;
558 int idx_adv_rtr = 6;
559 int idx_level = 7;
049207c3 560 int level;
52dc7ee6 561 struct listnode *i, *j;
049207c3 562 struct ospf6 *o = ospf6;
563 struct ospf6_area *oa;
564 struct ospf6_interface *oi;
565 u_int32_t id = 0;
566 u_int32_t adv_router = 0;
567
568 OSPF6_CMD_CHECK_RUNNING ();
14b16482
DW
569 inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
570 inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
571 level = parse_show_level (idx_level, argc, argv);
049207c3 572
1eb8ef25 573 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
508e53e2 574 {
625e016d 575 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 576 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
508e53e2 577 }
049207c3 578
1eb8ef25 579 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
508e53e2 580 {
1eb8ef25 581 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
508e53e2 582 {
625e016d
DL
583 vty_out (vty, IF_LSDB_TITLE_FORMAT,
584 oi->interface->name, oa->name);
049207c3 585 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
508e53e2 586 }
587 }
718e3744 588
625e016d 589 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 590 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
591
26a429fe 592 vty_out (vty, "\n");
718e3744 593 return CMD_SUCCESS;
594}
595
508e53e2 596
049207c3 597DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
598 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd,
14b16482 599 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>]",
049207c3 600 SHOW_STR
601 IPV6_STR
602 OSPF6_STR
603 "Display Link state database\n"
604 "Search by Advertising Router\n"
605 "Specify Advertising Router as IPv4 address notation\n"
606 "Search by Link state ID\n"
607 "Specify Link state ID as IPv4 address notation\n"
14b16482
DW
608 "Display details of LSAs\n"
609 "Dump LSAs\n"
610 "Display LSA's internal information\n")
049207c3 611{
14b16482
DW
612 int idx_adv_rtr = 5;
613 int idx_ls_id = 7;
614 int idx_level = 8;
049207c3 615 int level;
52dc7ee6 616 struct listnode *i, *j;
049207c3 617 struct ospf6 *o = ospf6;
618 struct ospf6_area *oa;
619 struct ospf6_interface *oi;
620 u_int32_t id = 0;
621 u_int32_t adv_router = 0;
622
623 OSPF6_CMD_CHECK_RUNNING ();
14b16482
DW
624 inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
625 inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
626 level = parse_show_level (idx_level, argc, argv);
049207c3 627
1eb8ef25 628 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 629 {
625e016d 630 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 631 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
632 }
633
1eb8ef25 634 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 635 {
1eb8ef25 636 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
049207c3 637 {
625e016d
DL
638 vty_out (vty, IF_LSDB_TITLE_FORMAT,
639 oi->interface->name, oa->name);
049207c3 640 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
641 }
642 }
643
625e016d 644 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 645 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
646
26a429fe 647 vty_out (vty, "\n");
049207c3 648 return CMD_SUCCESS;
649}
650
508e53e2 651DEFUN (show_ipv6_ospf6_database_type_id_router,
652 show_ipv6_ospf6_database_type_id_router_cmd,
14b16482 653 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D A.B.C.D [<dump|internal>]",
508e53e2 654 SHOW_STR
655 IPV6_STR
656 OSPF6_STR
657 "Display Link state database\n"
658 "Display Router LSAs\n"
659 "Display Network LSAs\n"
660 "Display Inter-Area-Prefix LSAs\n"
661 "Display Inter-Area-Router LSAs\n"
662 "Display As-External LSAs\n"
663 "Display Group-Membership LSAs\n"
664 "Display Type-7 LSAs\n"
665 "Display Link LSAs\n"
666 "Display Intra-Area-Prefix LSAs\n"
667 "Specify Link state ID as IPv4 address notation\n"
668 "Specify Advertising Router as IPv4 address notation\n"
14b16482
DW
669 "Dump LSAs\n"
670 "Display LSA's internal information\n")
718e3744 671{
51c26414 672 int idx_lsa = 4;
14b16482
DW
673 int idx_ls_id = 5;
674 int idx_adv_rtr = 6;
675 int idx_level = 7;
049207c3 676 int level;
52dc7ee6 677 struct listnode *i, *j;
508e53e2 678 struct ospf6 *o = ospf6;
049207c3 679 struct ospf6_area *oa;
680 struct ospf6_interface *oi;
508e53e2 681 u_int16_t type = 0;
682 u_int32_t id = 0;
049207c3 683 u_int32_t adv_router = 0;
508e53e2 684
685 OSPF6_CMD_CHECK_RUNNING ();
718e3744 686
14b16482
DW
687 type = parse_type_spec (idx_lsa, argc, argv);
688 inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
689 inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
690 level = parse_show_level (idx_level, argc, argv);
049207c3 691
692 switch (OSPF6_LSA_SCOPE (type))
508e53e2 693 {
6452df09 694 case OSPF6_SCOPE_AREA:
1eb8ef25 695 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 696 {
625e016d 697 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 698 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
699 }
700 break;
701
6452df09 702 case OSPF6_SCOPE_LINKLOCAL:
1eb8ef25 703 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 704 {
1eb8ef25 705 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
049207c3 706 {
625e016d
DL
707 vty_out (vty, IF_LSDB_TITLE_FORMAT,
708 oi->interface->name, oa->name);
049207c3 709 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
710 }
711 }
712 break;
713
6452df09 714 case OSPF6_SCOPE_AS:
625e016d 715 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 716 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
717 break;
718
719 default:
720 assert (0);
721 break;
718e3744 722 }
723
26a429fe 724 vty_out (vty, "\n");
718e3744 725 return CMD_SUCCESS;
726}
727
049207c3 728
729DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
730 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd,
14b16482 731 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> adv-router A.B.C.D linkstate-id A.B.C.D [<dump|internal>]",
049207c3 732 SHOW_STR
733 IPV6_STR
734 OSPF6_STR
735 "Display Link state database\n"
736 "Display Router LSAs\n"
737 "Display Network LSAs\n"
738 "Display Inter-Area-Prefix LSAs\n"
739 "Display Inter-Area-Router LSAs\n"
740 "Display As-External LSAs\n"
741 "Display Group-Membership LSAs\n"
742 "Display Type-7 LSAs\n"
743 "Display Link LSAs\n"
744 "Display Intra-Area-Prefix LSAs\n"
745 "Search by Advertising Router\n"
746 "Specify Advertising Router as IPv4 address notation\n"
747 "Search by Link state ID\n"
748 "Specify Link state ID as IPv4 address notation\n"
14b16482
DW
749 "Dump LSAs\n"
750 "Display LSA's internal information\n")
049207c3 751{
51c26414 752 int idx_lsa = 4;
14b16482
DW
753 int idx_adv_rtr = 6;
754 int idx_ls_id = 8;
755 int idx_level = 9;
049207c3 756 int level;
52dc7ee6 757 struct listnode *i, *j;
049207c3 758 struct ospf6 *o = ospf6;
759 struct ospf6_area *oa;
760 struct ospf6_interface *oi;
761 u_int16_t type = 0;
762 u_int32_t id = 0;
763 u_int32_t adv_router = 0;
764
765 OSPF6_CMD_CHECK_RUNNING ();
766
14b16482
DW
767 type = parse_type_spec (idx_lsa, argc, argv);
768 inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
769 inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
770 level = parse_show_level (idx_level, argc, argv);
049207c3 771
772 switch (OSPF6_LSA_SCOPE (type))
773 {
6452df09 774 case OSPF6_SCOPE_AREA:
1eb8ef25 775 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 776 {
625e016d 777 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 778 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
779 }
780 break;
781
6452df09 782 case OSPF6_SCOPE_LINKLOCAL:
1eb8ef25 783 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 784 {
1eb8ef25 785 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
049207c3 786 {
625e016d
DL
787 vty_out (vty, IF_LSDB_TITLE_FORMAT,
788 oi->interface->name, oa->name);
049207c3 789 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
790 }
791 }
792 break;
793
6452df09 794 case OSPF6_SCOPE_AS:
625e016d 795 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 796 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
797 break;
798
799 default:
800 assert (0);
801 break;
802 }
803
26a429fe 804 vty_out (vty, "\n");
049207c3 805 return CMD_SUCCESS;
806}
807
508e53e2 808DEFUN (show_ipv6_ospf6_database_self_originated,
809 show_ipv6_ospf6_database_self_originated_cmd,
14b16482 810 "show ipv6 ospf6 database self-originated [<detail|dump|internal>]",
508e53e2 811 SHOW_STR
812 IPV6_STR
813 OSPF6_STR
16cedbb0 814 "Display Link state database\n"
508e53e2 815 "Display Self-originated LSAs\n"
14b16482
DW
816 "Display details of LSAs\n"
817 "Dump LSAs\n"
818 "Display LSA's internal information\n")
718e3744 819{
14b16482 820 int idx_level = 5;
049207c3 821 int level;
52dc7ee6 822 struct listnode *i, *j;
508e53e2 823 struct ospf6 *o = ospf6;
049207c3 824 struct ospf6_area *oa;
825 struct ospf6_interface *oi;
826 u_int32_t adv_router = 0;
718e3744 827
508e53e2 828 OSPF6_CMD_CHECK_RUNNING ();
14b16482 829 level = parse_show_level (idx_level, argc, argv);
049207c3 830 adv_router = o->router_id;
718e3744 831
1eb8ef25 832 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
508e53e2 833 {
625e016d 834 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 835 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
508e53e2 836 }
049207c3 837
1eb8ef25 838 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
718e3744 839 {
1eb8ef25 840 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
508e53e2 841 {
625e016d
DL
842 vty_out (vty, IF_LSDB_TITLE_FORMAT,
843 oi->interface->name, oa->name);
049207c3 844 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
508e53e2 845 }
718e3744 846 }
847
625e016d 848 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 849 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
850
26a429fe 851 vty_out (vty, "\n");
718e3744 852 return CMD_SUCCESS;
853}
854
508e53e2 855
856DEFUN (show_ipv6_ospf6_database_type_self_originated,
857 show_ipv6_ospf6_database_type_self_originated_cmd,
14b16482 858 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]",
508e53e2 859 SHOW_STR
860 IPV6_STR
861 OSPF6_STR
862 "Display Link state database\n"
863 "Display Router LSAs\n"
864 "Display Network LSAs\n"
865 "Display Inter-Area-Prefix LSAs\n"
866 "Display Inter-Area-Router LSAs\n"
867 "Display As-External LSAs\n"
868 "Display Group-Membership LSAs\n"
869 "Display Type-7 LSAs\n"
870 "Display Link LSAs\n"
871 "Display Intra-Area-Prefix LSAs\n"
872 "Display Self-originated LSAs\n"
14b16482
DW
873 "Display details of LSAs\n"
874 "Dump LSAs\n"
875 "Display LSA's internal information\n")
718e3744 876{
14b16482
DW
877 int idx_lsa = 4;
878 int idx_level = 6;
049207c3 879 int level;
52dc7ee6 880 struct listnode *i, *j;
508e53e2 881 struct ospf6 *o = ospf6;
049207c3 882 struct ospf6_area *oa;
883 struct ospf6_interface *oi;
508e53e2 884 u_int16_t type = 0;
049207c3 885 u_int32_t adv_router = 0;
718e3744 886
508e53e2 887 OSPF6_CMD_CHECK_RUNNING ();
718e3744 888
14b16482
DW
889 type = parse_type_spec (idx_lsa, argc, argv);
890 level = parse_show_level (idx_level, argc, argv);
049207c3 891
892 adv_router = o->router_id;
893
894 switch (OSPF6_LSA_SCOPE (type))
718e3744 895 {
6452df09 896 case OSPF6_SCOPE_AREA:
1eb8ef25 897 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 898 {
625e016d 899 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 900 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
901 }
902 break;
903
6452df09 904 case OSPF6_SCOPE_LINKLOCAL:
1eb8ef25 905 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 906 {
1eb8ef25 907 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
049207c3 908 {
625e016d
DL
909 vty_out (vty, IF_LSDB_TITLE_FORMAT,
910 oi->interface->name, oa->name);
049207c3 911 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
912 }
913 }
914 break;
915
6452df09 916 case OSPF6_SCOPE_AS:
625e016d 917 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 918 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
919 break;
920
921 default:
922 assert (0);
923 break;
718e3744 924 }
508e53e2 925
26a429fe 926 vty_out (vty, "\n");
049207c3 927 return CMD_SUCCESS;
928}
508e53e2 929
049207c3 930DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
931 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
14b16482 932 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated linkstate-id A.B.C.D [<detail|dump|internal>]",
049207c3 933 SHOW_STR
934 IPV6_STR
935 OSPF6_STR
936 "Display Link state database\n"
937 "Display Router LSAs\n"
938 "Display Network LSAs\n"
939 "Display Inter-Area-Prefix LSAs\n"
940 "Display Inter-Area-Router LSAs\n"
941 "Display As-External LSAs\n"
942 "Display Group-Membership LSAs\n"
943 "Display Type-7 LSAs\n"
944 "Display Link LSAs\n"
945 "Display Intra-Area-Prefix LSAs\n"
946 "Display Self-originated LSAs\n"
947 "Search by Link state ID\n"
948 "Specify Link state ID as IPv4 address notation\n"
14b16482
DW
949 "Display details of LSAs\n"
950 "Dump LSAs\n"
951 "Display LSA's internal information\n")
049207c3 952{
51c26414 953 int idx_lsa = 4;
14b16482
DW
954 int idx_ls_id = 7;
955 int idx_level = 8;
049207c3 956 int level;
52dc7ee6 957 struct listnode *i, *j;
049207c3 958 struct ospf6 *o = ospf6;
959 struct ospf6_area *oa;
960 struct ospf6_interface *oi;
961 u_int16_t type = 0;
962 u_int32_t adv_router = 0;
963 u_int32_t id = 0;
964
965 OSPF6_CMD_CHECK_RUNNING ();
966
14b16482
DW
967 type = parse_type_spec (idx_lsa, argc, argv);
968 inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
969 level = parse_show_level (idx_level, argc, argv);
049207c3 970 adv_router = o->router_id;
971
972 switch (OSPF6_LSA_SCOPE (type))
718e3744 973 {
6452df09 974 case OSPF6_SCOPE_AREA:
1eb8ef25 975 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 976 {
625e016d 977 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 978 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
979 }
980 break;
981
6452df09 982 case OSPF6_SCOPE_LINKLOCAL:
1eb8ef25 983 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 984 {
1eb8ef25 985 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
049207c3 986 {
625e016d
DL
987 vty_out (vty, IF_LSDB_TITLE_FORMAT,
988 oi->interface->name, oa->name);
049207c3 989 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
990 }
991 }
992 break;
993
6452df09 994 case OSPF6_SCOPE_AS:
625e016d 995 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 996 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
997 break;
998
999 default:
1000 assert (0);
1001 break;
718e3744 1002 }
718e3744 1003
26a429fe 1004 vty_out (vty, "\n");
718e3744 1005 return CMD_SUCCESS;
1006}
718e3744 1007
508e53e2 1008DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
1009 show_ipv6_ospf6_database_type_id_self_originated_cmd,
14b16482 1010 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D self-originated [<detail|dump|internal>]",
508e53e2 1011 SHOW_STR
1012 IPV6_STR
1013 OSPF6_STR
1014 "Display Link state database\n"
1015 "Display Router LSAs\n"
1016 "Display Network LSAs\n"
1017 "Display Inter-Area-Prefix LSAs\n"
1018 "Display Inter-Area-Router LSAs\n"
1019 "Display As-External LSAs\n"
1020 "Display Group-Membership LSAs\n"
1021 "Display Type-7 LSAs\n"
1022 "Display Link LSAs\n"
1023 "Display Intra-Area-Prefix LSAs\n"
1024 "Specify Link state ID as IPv4 address notation\n"
1025 "Display Self-originated LSAs\n"
14b16482
DW
1026 "Display details of LSAs\n"
1027 "Dump LSAs\n"
1028 "Display LSA's internal information\n")
718e3744 1029{
51c26414 1030 int idx_lsa = 4;
14b16482
DW
1031 int idx_ls_id = 5;
1032 int idx_level = 7;
049207c3 1033 int level;
52dc7ee6 1034 struct listnode *i, *j;
508e53e2 1035 struct ospf6 *o = ospf6;
049207c3 1036 struct ospf6_area *oa;
1037 struct ospf6_interface *oi;
508e53e2 1038 u_int16_t type = 0;
049207c3 1039 u_int32_t adv_router = 0;
508e53e2 1040 u_int32_t id = 0;
718e3744 1041
508e53e2 1042 OSPF6_CMD_CHECK_RUNNING ();
718e3744 1043
14b16482
DW
1044 type = parse_type_spec (idx_lsa, argc, argv);
1045 inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
1046 level = parse_show_level (idx_level, argc, argv);
049207c3 1047 adv_router = o->router_id;
1048
1049 switch (OSPF6_LSA_SCOPE (type))
718e3744 1050 {
6452df09 1051 case OSPF6_SCOPE_AREA:
1eb8ef25 1052 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 1053 {
625e016d 1054 vty_out (vty, AREA_LSDB_TITLE_FORMAT, oa->name);
049207c3 1055 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1056 }
1057 break;
1058
6452df09 1059 case OSPF6_SCOPE_LINKLOCAL:
1eb8ef25 1060 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
049207c3 1061 {
1eb8ef25 1062 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
049207c3 1063 {
625e016d
DL
1064 vty_out (vty, IF_LSDB_TITLE_FORMAT,
1065 oi->interface->name, oa->name);
049207c3 1066 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1067 }
1068 }
1069 break;
1070
6452df09 1071 case OSPF6_SCOPE_AS:
625e016d 1072 vty_out (vty, AS_LSDB_TITLE_FORMAT);
049207c3 1073 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1074 break;
1075
1076 default:
1077 assert (0);
1078 break;
718e3744 1079 }
508e53e2 1080
26a429fe 1081 vty_out (vty, "\n");
508e53e2 1082 return CMD_SUCCESS;
718e3744 1083}
1084
6452df09 1085DEFUN (show_ipv6_ospf6_border_routers,
1086 show_ipv6_ospf6_border_routers_cmd,
14b16482 1087 "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
6452df09 1088 SHOW_STR
1089 IP6_STR
1090 OSPF6_STR
1091 "Display routing table for ABR and ASBR\n"
16cedbb0
QY
1092 "Router ID\n"
1093 "Show detailed output\n")
6452df09 1094{
14b16482 1095 int idx_ipv4 = 4;
6452df09 1096 u_int32_t adv_router;
6452df09 1097 struct ospf6_route *ro;
1098 struct prefix prefix;
1099
1100 OSPF6_CMD_CHECK_RUNNING ();
1101
14b16482 1102 if (argc == 5)
6452df09 1103 {
14b16482 1104 if (strmatch (argv[idx_ipv4]->text, "detail"))
6452df09 1105 {
14b16482
DW
1106 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1107 ro = ospf6_route_next (ro))
1108 ospf6_route_show_detail (vty, ro);
6452df09 1109 }
14b16482 1110 else
597fa7c1 1111 {
14b16482
DW
1112 inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router);
1113
1114 ospf6_linkstate_prefix (adv_router, 0, &prefix);
1115 ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
1116 if (!ro)
1117 {
55f70b67 1118 vty_out (vty, "No Route found for Router ID: %s\n", argv[4]->arg);
14b16482
DW
1119 return CMD_SUCCESS;
1120 }
1121
1122 ospf6_route_show_detail (vty, ro);
597fa7c1
J
1123 return CMD_SUCCESS;
1124 }
6452df09 1125 }
14b16482
DW
1126 else
1127 {
1128 ospf6_brouter_show_header (vty);
6452df09 1129
14b16482
DW
1130 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1131 ro = ospf6_route_next (ro))
1132 ospf6_brouter_show (vty, ro);
1133 }
6452df09 1134
1135 return CMD_SUCCESS;
1136}
1137
6452df09 1138
4846ef64 1139DEFUN (show_ipv6_ospf6_linkstate,
1140 show_ipv6_ospf6_linkstate_cmd,
093d7a3a 1141 "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>",
4846ef64 1142 SHOW_STR
1143 IP6_STR
1144 OSPF6_STR
1145 "Display linkstate routing table\n"
093d7a3a
DW
1146 "Display Router Entry\n"
1147 "Specify Router ID as IPv4 address notation\n"
1148 "Display Network Entry\n"
1149 "Specify Router ID as IPv4 address notation\n"
3a2d747c 1150 "Specify Link state ID as IPv4 address notation\n")
4846ef64 1151{
093d7a3a 1152 int idx_ipv4 = 4;
52dc7ee6 1153 struct listnode *node;
4846ef64 1154 struct ospf6_area *oa;
1155
b52a8a52
DS
1156 OSPF6_CMD_CHECK_RUNNING ();
1157
1eb8ef25 1158 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
4846ef64 1159 {
55f70b67 1160 vty_out (vty, "\n SPF Result in Area %s\n\n", oa->name);
093d7a3a 1161 ospf6_linkstate_table_show (vty, idx_ipv4, argc, argv, oa->spf_table);
4846ef64 1162 }
1163
26a429fe 1164 vty_out (vty, "\n");
4846ef64 1165 return CMD_SUCCESS;
1166}
1167
4846ef64 1168
4846ef64 1169
1170DEFUN (show_ipv6_ospf6_linkstate_detail,
1171 show_ipv6_ospf6_linkstate_detail_cmd,
1172 "show ipv6 ospf6 linkstate detail",
1173 SHOW_STR
1174 IP6_STR
1175 OSPF6_STR
1176 "Display linkstate routing table\n"
3a2d747c 1177 "Display detailed information\n")
4846ef64 1178{
093d7a3a 1179 int idx_detail = 4;
52dc7ee6 1180 struct listnode *node;
4846ef64 1181 struct ospf6_area *oa;
1182
b52a8a52
DS
1183 OSPF6_CMD_CHECK_RUNNING ();
1184
1eb8ef25 1185 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
4846ef64 1186 {
55f70b67 1187 vty_out (vty, "\n SPF Result in Area %s\n\n", oa->name);
093d7a3a 1188 ospf6_linkstate_table_show (vty, idx_detail, argc, argv, oa->spf_table);
4846ef64 1189 }
1190
26a429fe 1191 vty_out (vty, "\n");
4846ef64 1192 return CMD_SUCCESS;
1193}
6452df09 1194
718e3744 1195/* Install ospf related commands. */
1196void
6ac29a51 1197ospf6_init (void)
718e3744 1198{
1e05838a 1199 ospf6_top_init ();
1200 ospf6_area_init ();
1201 ospf6_interface_init ();
1202 ospf6_neighbor_init ();
4140ca4d 1203 ospf6_zebra_init(master);
1e05838a 1204
1205 ospf6_lsa_init ();
1206 ospf6_spf_init ();
1207 ospf6_intra_init ();
1208 ospf6_asbr_init ();
1209 ospf6_abr_init ();
1210
7f342629 1211 ospf6_bfd_init();
508e53e2 1212 install_node (&debug_node, config_write_ospf6_debug);
1213
92300491
DW
1214 install_element_ospf6_debug_message ();
1215 install_element_ospf6_debug_lsa ();
1216 install_element_ospf6_debug_interface ();
1217 install_element_ospf6_debug_neighbor ();
1218 install_element_ospf6_debug_zebra ();
1219 install_element_ospf6_debug_spf ();
1220 install_element_ospf6_debug_route ();
1221 install_element_ospf6_debug_brouter ();
1222 install_element_ospf6_debug_asbr ();
1223 install_element_ospf6_debug_abr ();
1224 install_element_ospf6_debug_flood ();
1225
1226 install_element_ospf6_clear_interface ();
1227
1228 install_element (VIEW_NODE, &show_version_ospf6_cmd);
92300491
DW
1229
1230 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
92300491
DW
1231
1232 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd);
1233 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
92300491 1234
34d5ef45
DL
1235 install_element (VIEW_NODE, &show_ipv6_ospf6_database_cmd);
1236 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_cmd);
1237 install_element (VIEW_NODE, &show_ipv6_ospf6_database_id_cmd);
1238 install_element (VIEW_NODE, &show_ipv6_ospf6_database_router_cmd);
1239 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_id_cmd);
1240 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_router_cmd);
1241 install_element (VIEW_NODE, &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd);
1242 install_element (VIEW_NODE, &show_ipv6_ospf6_database_id_router_cmd);
1243 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_id_router_cmd);
1244 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd);
1245 install_element (VIEW_NODE, &show_ipv6_ospf6_database_self_originated_cmd);
1246 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_self_originated_cmd);
1247 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_id_self_originated_cmd);
1248 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd);
92300491 1249
92300491
DW
1250 /* Make ospf protocol socket. */
1251 ospf6_serv_sock ();
ffa2c898 1252 thread_add_read(master, ospf6_receive, NULL, ospf6_sock, NULL);
92300491
DW
1253}
1254
1255void
1256ospf6_clean (void)
1257{
1258 if (!ospf6)
1259 return;
1260 if (ospf6->route_table)
1261 ospf6_route_remove_all (ospf6->route_table);
1262 if (ospf6->brouter_table)
1263 ospf6_route_remove_all (ospf6->brouter_table);
1264}