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