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