2 * Copyright (C) 2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License 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
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"
46 #include "ospf6_bfd.h"
48 struct route_node
*route_prev(struct route_node
*node
)
50 struct route_node
*end
;
51 struct route_node
*prev
= NULL
;
56 route_lock_node(node
);
59 node
= route_next(node
);
61 route_unlock_node(node
);
65 route_unlock_node(end
);
67 route_lock_node(prev
);
72 static int config_write_ospf6_debug(struct vty
*vty
);
73 static struct cmd_node debug_node
= {
77 .config_write
= config_write_ospf6_debug
,
80 static int config_write_ospf6_debug(struct vty
*vty
)
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
);
97 DEFUN_NOSH (show_debugging_ospf6
,
98 show_debugging_ospf6_cmd
,
99 "show debugging [ospf6]",
104 vty_out(vty
, "OSPF6 debugging status:\n");
106 config_write_ospf6_debug(vty
);
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"
117 static int parse_show_level(int idx_level
, int argc
, struct cmd_token
**argv
)
119 int level
= OSPF6_LSDB_SHOW_LEVEL_NORMAL
;
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
;
133 static uint16_t parse_type_spec(int idx_lsa
, int argc
, struct cmd_token
**argv
)
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
);
157 DEFUN (show_ipv6_ospf6_database
,
158 show_ipv6_ospf6_database_cmd
,
159 "show ipv6 ospf6 database [<detail|dump|internal>]",
163 "Display Link state database\n"
164 "Display details of LSAs\n"
166 "Display LSA's internal information\n")
170 struct listnode
*i
, *j
;
172 struct ospf6_area
*oa
;
173 struct ospf6_interface
*oi
;
176 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
177 OSPF6_CMD_CHECK_RUNNING(ospf6
);
179 level
= parse_show_level(idx_level
, argc
, argv
);
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
);
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
,
190 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, NULL
, oi
->lsdb
);
194 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
195 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, NULL
, ospf6
->lsdb
);
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>]",
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"
219 "Display LSA's internal information\n"
225 struct listnode
*i
, *j
;
227 struct ospf6_area
*oa
;
228 struct ospf6_interface
*oi
;
232 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
233 OSPF6_CMD_CHECK_RUNNING(ospf6
);
235 type
= parse_type_spec(idx_lsa
, argc
, argv
);
236 level
= parse_show_level(idx_level
, argc
, argv
);
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
,
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
,
259 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
260 ospf6_lsdb_show(vty
, level
, &type
, NULL
, NULL
, ospf6
->lsdb
);
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>]",
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"
284 "Display LSA's internal information\n")
289 struct listnode
*i
, *j
;
291 struct ospf6_area
*oa
;
292 struct ospf6_interface
*oi
;
296 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
297 OSPF6_CMD_CHECK_RUNNING(ospf6
);
299 if (argv
[idx_ipv4
]->type
== IPV4_TKN
)
300 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
302 level
= parse_show_level(idx_level
, argc
, argv
);
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
);
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
,
313 ospf6_lsdb_show(vty
, level
, NULL
, &id
, NULL
, oi
->lsdb
);
317 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
318 ospf6_lsdb_show(vty
, level
, NULL
, &id
, NULL
, ospf6
->lsdb
);
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>",
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"
337 "Display LSA's internal information\n")
342 struct listnode
*i
, *j
;
344 struct ospf6_area
*oa
;
345 struct ospf6_interface
*oi
;
346 uint32_t adv_router
= 0;
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
);
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
);
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
,
363 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
,
368 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
369 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, ospf6
->lsdb
);
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",
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")
386 int level
= OSPF6_LSDB_SHOW_LEVEL_DETAIL
;
387 uint16_t type
= htons(OSPF6_LSTYPE_ROUTER
);
391 struct ospf6_area
*oa
;
392 struct ospf6_lsdb
*lsdb
;
393 uint32_t adv_router
= 0;
395 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
396 OSPF6_CMD_CHECK_RUNNING(ospf6
);
398 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
400 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, i
, oa
)) {
401 if (adv_router
== ospf6
->router_id
)
402 lsdb
= oa
->lsdb_self
;
405 if (ospf6_create_single_router_lsa(oa
, lsdb
, adv_router
)
407 vty_out(vty
, "Adv router is not found in LSDB.");
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
);
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>]",
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"
441 "Display LSA's internal information\n"
448 struct listnode
*i
, *j
;
450 struct ospf6_area
*oa
;
451 struct ospf6_interface
*oi
;
456 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
457 OSPF6_CMD_CHECK_RUNNING(ospf6
);
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
);
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
);
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
,
483 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
484 ospf6_lsdb_show(vty
, level
, &type
, &id
, NULL
, ospf6
->lsdb
);
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>]",
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"
517 "Display LSA's internal information\n"
524 struct listnode
*i
, *j
;
526 struct ospf6_area
*oa
;
527 struct ospf6_interface
*oi
;
529 uint32_t adv_router
= 0;
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
);
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
,
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
);
559 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
560 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
,
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>]",
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"
586 "Display LSA's internal information\n"
593 struct listnode
*i
, *j
;
595 struct ospf6_area
*oa
;
596 struct ospf6_interface
*oi
;
598 uint32_t adv_router
= 0;
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
);
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
);
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
,
615 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
,
620 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
621 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, ospf6
->lsdb
);
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>]",
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"
641 "Display LSA's internal information\n")
647 struct listnode
*i
, *j
;
649 struct ospf6_area
*oa
;
650 struct ospf6_interface
*oi
;
652 uint32_t adv_router
= 0;
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
);
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
);
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
,
670 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
,
675 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
676 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, ospf6
->lsdb
);
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>]",
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"
701 "Display LSA's internal information\n")
708 struct listnode
*i
, *j
;
710 struct ospf6_area
*oa
;
711 struct ospf6_interface
*oi
;
714 uint32_t adv_router
= 0;
717 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
718 OSPF6_CMD_CHECK_RUNNING(ospf6
);
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
);
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
,
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
);
746 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
747 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
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>]",
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"
782 "Display LSA's internal information\n")
789 struct listnode
*i
, *j
;
791 struct ospf6_area
*oa
;
792 struct ospf6_interface
*oi
;
795 uint32_t adv_router
= 0;
798 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
799 OSPF6_CMD_CHECK_RUNNING(ospf6
);
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
);
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
,
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
);
827 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
828 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
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>]",
847 "Display Link state database\n"
848 "Display Self-originated LSAs\n"
849 "Display details of LSAs\n"
851 "Display LSA's internal information\n")
855 struct listnode
*i
, *j
;
857 struct ospf6_area
*oa
;
858 struct ospf6_interface
*oi
;
859 uint32_t adv_router
= 0;
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
;
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
);
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
,
875 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
,
880 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
881 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, ospf6
->lsdb
);
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>]",
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"
907 "Display LSA's internal information\n")
912 struct listnode
*i
, *j
;
914 struct ospf6_area
*oa
;
915 struct ospf6_interface
*oi
;
917 uint32_t adv_router
= 0;
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
);
924 adv_router
= ospf6
->router_id
;
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
,
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
);
947 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
948 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
,
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>]",
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"
982 "Display LSA's internal information\n")
988 struct listnode
*i
, *j
;
990 struct ospf6_area
*oa
;
991 struct ospf6_interface
*oi
;
993 uint32_t adv_router
= 0;
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
;
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
,
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
);
1023 case OSPF6_SCOPE_AS
:
1024 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
1025 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
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>]",
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"
1058 "Display LSA's internal information\n")
1064 struct listnode
*i
, *j
;
1065 struct ospf6
*ospf6
;
1066 struct ospf6_area
*oa
;
1067 struct ospf6_interface
*oi
;
1069 uint32_t adv_router
= 0;
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
;
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
,
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
);
1099 case OSPF6_SCOPE_AS
:
1100 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
1101 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
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>]",
1120 "Display routing table for ABR and ASBR\n"
1122 "Show detailed output\n")
1125 uint32_t adv_router
;
1126 struct ospf6_route
*ro
;
1127 struct prefix prefix
;
1128 struct ospf6
*ospf6
= NULL
;
1131 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
1132 OSPF6_CMD_CHECK_RUNNING(ospf6
);
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
);
1139 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
1141 ospf6_linkstate_prefix(adv_router
, 0, &prefix
);
1142 ro
= ospf6_route_lookup(&prefix
, ospf6
->brouter_table
);
1145 "No Route found for Router ID: %s\n",
1150 ospf6_route_show_detail(vty
, ro
);
1154 ospf6_brouter_show_header(vty
);
1156 for (ro
= ospf6_route_head(ospf6
->brouter_table
); ro
;
1157 ro
= ospf6_route_next(ro
))
1158 ospf6_brouter_show(vty
, ro
);
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>",
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")
1179 struct listnode
*node
;
1180 struct ospf6_area
*oa
;
1181 struct ospf6
*ospf6
= NULL
;
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
,
1196 DEFUN (show_ipv6_ospf6_linkstate_detail
,
1197 show_ipv6_ospf6_linkstate_detail_cmd
,
1198 "show ipv6 ospf6 linkstate detail",
1202 "Display linkstate routing table\n"
1203 "Display detailed information\n")
1206 struct listnode
*node
;
1207 struct ospf6_area
*oa
;
1208 struct ospf6
*ospf6
= NULL
;
1210 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
1211 OSPF6_CMD_CHECK_RUNNING(ospf6
);
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
,
1223 static void ospf6_plist_add(struct prefix_list
*plist
)
1225 if (prefix_list_afi(plist
) != AFI_IP6
)
1227 ospf6_area_plist_update(plist
, 1);
1230 static void ospf6_plist_del(struct prefix_list
*plist
)
1232 if (prefix_list_afi(plist
) != AFI_IP6
)
1234 ospf6_area_plist_update(plist
, 0);
1237 /* Install ospf related commands. */
1238 void ospf6_init(struct thread_master
*master
)
1240 struct ospf6
*ospf6
;
1244 ospf6_interface_init();
1245 ospf6_neighbor_init();
1246 ospf6_zebra_init(master
);
1254 prefix_list_add_hook(ospf6_plist_add
);
1255 prefix_list_delete_hook(ospf6_plist_del
);
1258 install_node(&debug_node
);
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();
1272 install_element_ospf6_clear_interface();
1274 install_element(ENABLE_NODE
, &show_debugging_ospf6_cmd
);
1276 install_element(VIEW_NODE
, &show_ipv6_ospf6_border_routers_cmd
);
1278 install_element(VIEW_NODE
, &show_ipv6_ospf6_linkstate_cmd
);
1279 install_element(VIEW_NODE
, &show_ipv6_ospf6_linkstate_detail_cmd
);
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
);
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
);
1303 &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
);
1304 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_aggr_router_cmd
);
1306 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
1308 ospf6_instance_create(VRF_DEFAULT_NAME
);