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_network.h"
31 #include "ospf6_lsa.h"
32 #include "ospf6_lsdb.h"
33 #include "ospf6_message.h"
34 #include "ospf6_route.h"
35 #include "ospf6_zebra.h"
36 #include "ospf6_spf.h"
37 #include "ospf6_top.h"
38 #include "ospf6_area.h"
39 #include "ospf6_interface.h"
40 #include "ospf6_neighbor.h"
41 #include "ospf6_intra.h"
42 #include "ospf6_asbr.h"
43 #include "ospf6_abr.h"
44 #include "ospf6_flood.h"
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 struct cmd_node debug_node
= {
73 DEBUG_NODE
, "", 1 /* VTYSH */
76 static int config_write_ospf6_debug(struct vty
*vty
)
78 config_write_ospf6_debug_message(vty
);
79 config_write_ospf6_debug_lsa(vty
);
80 config_write_ospf6_debug_zebra(vty
);
81 config_write_ospf6_debug_interface(vty
);
82 config_write_ospf6_debug_neighbor(vty
);
83 config_write_ospf6_debug_spf(vty
);
84 config_write_ospf6_debug_route(vty
);
85 config_write_ospf6_debug_brouter(vty
);
86 config_write_ospf6_debug_asbr(vty
);
87 config_write_ospf6_debug_abr(vty
);
88 config_write_ospf6_debug_flood(vty
);
93 DEFUN_NOSH (show_debugging_ospf6
,
94 show_debugging_ospf6_cmd
,
95 "show debugging [ospf6]",
100 vty_out(vty
, "OSPF6 debugging status:\n");
102 config_write_ospf6_debug(vty
);
107 #define AREA_LSDB_TITLE_FORMAT \
108 "\n Area Scoped Link State Database (Area %s)\n\n"
109 #define IF_LSDB_TITLE_FORMAT \
110 "\n I/F Scoped Link State Database (I/F %s in Area %s)\n\n"
111 #define AS_LSDB_TITLE_FORMAT "\n AS Scoped Link State Database\n\n"
113 static int parse_show_level(int idx_level
, int argc
, struct cmd_token
**argv
)
115 int level
= OSPF6_LSDB_SHOW_LEVEL_NORMAL
;
117 if (argc
> idx_level
) {
118 if (strmatch(argv
[idx_level
]->text
, "detail"))
119 level
= OSPF6_LSDB_SHOW_LEVEL_DETAIL
;
120 else if (strmatch(argv
[idx_level
]->text
, "dump"))
121 level
= OSPF6_LSDB_SHOW_LEVEL_DUMP
;
122 else if (strmatch(argv
[idx_level
]->text
, "internal"))
123 level
= OSPF6_LSDB_SHOW_LEVEL_INTERNAL
;
129 static uint16_t parse_type_spec(int idx_lsa
, int argc
, struct cmd_token
**argv
)
133 if (argc
> idx_lsa
) {
134 if (strmatch(argv
[idx_lsa
]->text
, "router"))
135 type
= htons(OSPF6_LSTYPE_ROUTER
);
136 else if (strmatch(argv
[idx_lsa
]->text
, "network"))
137 type
= htons(OSPF6_LSTYPE_NETWORK
);
138 else if (strmatch(argv
[idx_lsa
]->text
, "as-external"))
139 type
= htons(OSPF6_LSTYPE_AS_EXTERNAL
);
140 else if (strmatch(argv
[idx_lsa
]->text
, "intra-prefix"))
141 type
= htons(OSPF6_LSTYPE_INTRA_PREFIX
);
142 else if (strmatch(argv
[idx_lsa
]->text
, "inter-router"))
143 type
= htons(OSPF6_LSTYPE_INTER_ROUTER
);
144 else if (strmatch(argv
[idx_lsa
]->text
, "inter-prefix"))
145 type
= htons(OSPF6_LSTYPE_INTER_PREFIX
);
146 else if (strmatch(argv
[idx_lsa
]->text
, "link"))
147 type
= htons(OSPF6_LSTYPE_LINK
);
153 DEFUN (show_ipv6_ospf6_database
,
154 show_ipv6_ospf6_database_cmd
,
155 "show ipv6 ospf6 database [<detail|dump|internal>]",
159 "Display Link state database\n"
160 "Display details of LSAs\n"
162 "Display LSA's internal information\n")
166 struct listnode
*i
, *j
;
167 struct ospf6
*o
= ospf6
;
168 struct ospf6_area
*oa
;
169 struct ospf6_interface
*oi
;
171 OSPF6_CMD_CHECK_RUNNING();
173 level
= parse_show_level(idx_level
, argc
, argv
);
175 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
176 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
177 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, NULL
, oa
->lsdb
);
180 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
181 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
182 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
184 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, NULL
, oi
->lsdb
);
188 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
189 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, NULL
, o
->lsdb
);
195 DEFUN (show_ipv6_ospf6_database_type
,
196 show_ipv6_ospf6_database_type_cmd
,
197 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>]",
201 "Display Link state database\n"
202 "Display Router LSAs\n"
203 "Display Network LSAs\n"
204 "Display Inter-Area-Prefix LSAs\n"
205 "Display Inter-Area-Router LSAs\n"
206 "Display As-External LSAs\n"
207 "Display Group-Membership LSAs\n"
208 "Display Type-7 LSAs\n"
209 "Display Link LSAs\n"
210 "Display Intra-Area-Prefix LSAs\n"
211 "Display details of LSAs\n"
213 "Display LSA's internal information\n"
219 struct listnode
*i
, *j
;
220 struct ospf6
*o
= ospf6
;
221 struct ospf6_area
*oa
;
222 struct ospf6_interface
*oi
;
225 OSPF6_CMD_CHECK_RUNNING();
227 type
= parse_type_spec(idx_lsa
, argc
, argv
);
228 level
= parse_show_level(idx_level
, argc
, argv
);
230 switch (OSPF6_LSA_SCOPE(type
)) {
231 case OSPF6_SCOPE_AREA
:
232 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
233 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
234 ospf6_lsdb_show(vty
, level
, &type
, NULL
, NULL
,
239 case OSPF6_SCOPE_LINKLOCAL
:
240 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
241 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
242 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
243 oi
->interface
->name
, oa
->name
);
244 ospf6_lsdb_show(vty
, level
, &type
, NULL
, NULL
,
251 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
252 ospf6_lsdb_show(vty
, level
, &type
, NULL
, NULL
, o
->lsdb
);
264 DEFUN (show_ipv6_ospf6_database_id
,
265 show_ipv6_ospf6_database_id_cmd
,
266 "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D [<detail|dump|internal>]",
270 "Display Link state database\n"
271 "Any Link state Type\n"
272 "Search by Link state ID\n"
273 "Specify Link state ID as IPv4 address notation\n"
274 "Display details of LSAs\n"
276 "Display LSA's internal information\n")
281 struct listnode
*i
, *j
;
282 struct ospf6
*o
= ospf6
;
283 struct ospf6_area
*oa
;
284 struct ospf6_interface
*oi
;
287 OSPF6_CMD_CHECK_RUNNING();
289 if (argv
[idx_ipv4
]->type
== IPV4_TKN
)
290 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
292 level
= parse_show_level(idx_level
, argc
, argv
);
294 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
295 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
296 ospf6_lsdb_show(vty
, level
, NULL
, &id
, NULL
, oa
->lsdb
);
299 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
300 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
301 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
303 ospf6_lsdb_show(vty
, level
, NULL
, &id
, NULL
, oi
->lsdb
);
307 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
308 ospf6_lsdb_show(vty
, level
, NULL
, &id
, NULL
, o
->lsdb
);
314 DEFUN (show_ipv6_ospf6_database_router
,
315 show_ipv6_ospf6_database_router_cmd
,
316 "show ipv6 ospf6 database <*|adv-router> * A.B.C.D <detail|dump|internal>",
320 "Display Link state database\n"
321 "Any Link state Type\n"
322 "Search by Advertising Router\n"
323 "Any Link state ID\n"
324 "Specify Advertising Router as IPv4 address notation\n"
325 "Display details of LSAs\n"
327 "Display LSA's internal information\n")
332 struct listnode
*i
, *j
;
333 struct ospf6
*o
= ospf6
;
334 struct ospf6_area
*oa
;
335 struct ospf6_interface
*oi
;
336 uint32_t adv_router
= 0;
338 OSPF6_CMD_CHECK_RUNNING();
339 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
340 level
= parse_show_level(idx_level
, argc
, argv
);
342 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
343 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
344 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, oa
->lsdb
);
347 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
348 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
349 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
351 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
,
356 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
357 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, o
->lsdb
);
363 DEFUN_HIDDEN (show_ipv6_ospf6_database_aggr_router
,
364 show_ipv6_ospf6_database_aggr_router_cmd
,
365 "show ipv6 ospf6 database aggr adv-router A.B.C.D",
369 "Display Link state database\n"
370 "Aggregated Router LSA\n"
371 "Search by Advertising Router\n"
372 "Specify Advertising Router as IPv4 address notation\n")
374 int level
= OSPF6_LSDB_SHOW_LEVEL_DETAIL
;
375 uint16_t type
= htons(OSPF6_LSTYPE_ROUTER
);
378 struct ospf6
*o
= ospf6
;
379 struct ospf6_area
*oa
;
380 struct ospf6_lsdb
*lsdb
;
381 uint32_t adv_router
= 0;
383 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
385 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
386 if (adv_router
== o
->router_id
)
387 lsdb
= oa
->lsdb_self
;
390 if (ospf6_create_single_router_lsa(oa
, lsdb
, adv_router
)
392 vty_out(vty
, "Adv router is not found in LSDB.");
395 ospf6_lsdb_show(vty
, level
, &type
, NULL
, NULL
,
396 oa
->temp_router_lsa_lsdb
);
397 /* Remove the temp cache */
398 ospf6_remove_temp_router_lsa(oa
);
406 DEFUN (show_ipv6_ospf6_database_type_id
,
407 show_ipv6_ospf6_database_type_id_cmd
,
408 "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>]",
412 "Display Link state database\n"
413 "Display Router LSAs\n"
414 "Display Network LSAs\n"
415 "Display Inter-Area-Prefix LSAs\n"
416 "Display Inter-Area-Router LSAs\n"
417 "Display As-External LSAs\n"
418 "Display Group-Membership LSAs\n"
419 "Display Type-7 LSAs\n"
420 "Display Link LSAs\n"
421 "Display Intra-Area-Prefix LSAs\n"
422 "Search by Link state ID\n"
423 "Specify Link state ID as IPv4 address notation\n"
424 "Display details of LSAs\n"
426 "Display LSA's internal information\n"
433 struct listnode
*i
, *j
;
434 struct ospf6
*o
= ospf6
;
435 struct ospf6_area
*oa
;
436 struct ospf6_interface
*oi
;
440 OSPF6_CMD_CHECK_RUNNING();
442 type
= parse_type_spec(idx_lsa
, argc
, argv
);
443 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
444 level
= parse_show_level(idx_level
, argc
, argv
);
446 switch (OSPF6_LSA_SCOPE(type
)) {
447 case OSPF6_SCOPE_AREA
:
448 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
449 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
450 ospf6_lsdb_show(vty
, level
, &type
, &id
, NULL
, oa
->lsdb
);
454 case OSPF6_SCOPE_LINKLOCAL
:
455 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
456 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
457 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
458 oi
->interface
->name
, oa
->name
);
459 ospf6_lsdb_show(vty
, level
, &type
, &id
, NULL
,
466 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
467 ospf6_lsdb_show(vty
, level
, &type
, &id
, NULL
, o
->lsdb
);
479 DEFUN (show_ipv6_ospf6_database_type_router
,
480 show_ipv6_ospf6_database_type_router_cmd
,
481 "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>]",
485 "Display Link state database\n"
486 "Display Router LSAs\n"
487 "Display Network LSAs\n"
488 "Display Inter-Area-Prefix LSAs\n"
489 "Display Inter-Area-Router LSAs\n"
490 "Display As-External LSAs\n"
491 "Display Group-Membership LSAs\n"
492 "Display Type-7 LSAs\n"
493 "Display Link LSAs\n"
494 "Display Intra-Area-Prefix LSAs\n"
495 "Any Link state ID\n"
496 "Search by Advertising Router\n"
497 "Specify Advertising Router as IPv4 address notation\n"
498 "Display details of LSAs\n"
500 "Display LSA's internal information\n"
507 struct listnode
*i
, *j
;
508 struct ospf6
*o
= ospf6
;
509 struct ospf6_area
*oa
;
510 struct ospf6_interface
*oi
;
512 uint32_t adv_router
= 0;
514 OSPF6_CMD_CHECK_RUNNING();
516 type
= parse_type_spec(idx_lsa
, argc
, argv
);
517 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
518 level
= parse_show_level(idx_level
, argc
, argv
);
520 switch (OSPF6_LSA_SCOPE(type
)) {
521 case OSPF6_SCOPE_AREA
:
522 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
523 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
524 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
,
529 case OSPF6_SCOPE_LINKLOCAL
:
530 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
531 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
532 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
533 oi
->interface
->name
, oa
->name
);
534 ospf6_lsdb_show(vty
, level
, &type
, NULL
,
535 &adv_router
, oi
->lsdb
);
541 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
542 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
555 DEFUN (show_ipv6_ospf6_database_id_router
,
556 show_ipv6_ospf6_database_id_router_cmd
,
557 "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>]",
561 "Display Link state database\n"
562 "Any Link state Type\n"
563 "Specify Link state ID as IPv4 address notation\n"
564 "Specify Advertising Router as IPv4 address notation\n"
565 "Display details of LSAs\n"
567 "Display LSA's internal information\n"
574 struct listnode
*i
, *j
;
575 struct ospf6
*o
= ospf6
;
576 struct ospf6_area
*oa
;
577 struct ospf6_interface
*oi
;
579 uint32_t adv_router
= 0;
581 OSPF6_CMD_CHECK_RUNNING();
582 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
583 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
584 level
= parse_show_level(idx_level
, argc
, argv
);
586 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
587 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
588 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, oa
->lsdb
);
591 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
592 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
593 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
595 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
,
600 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
601 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, o
->lsdb
);
608 DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id
,
609 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
,
610 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>]",
614 "Display Link state database\n"
615 "Search by Advertising Router\n"
616 "Specify Advertising Router as IPv4 address notation\n"
617 "Search by Link state ID\n"
618 "Specify Link state ID as IPv4 address notation\n"
619 "Display details of LSAs\n"
621 "Display LSA's internal information\n")
627 struct listnode
*i
, *j
;
628 struct ospf6
*o
= ospf6
;
629 struct ospf6_area
*oa
;
630 struct ospf6_interface
*oi
;
632 uint32_t adv_router
= 0;
634 OSPF6_CMD_CHECK_RUNNING();
635 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
636 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
637 level
= parse_show_level(idx_level
, argc
, argv
);
639 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
640 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
641 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, oa
->lsdb
);
644 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
645 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
646 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
648 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
,
653 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
654 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, o
->lsdb
);
660 DEFUN (show_ipv6_ospf6_database_type_id_router
,
661 show_ipv6_ospf6_database_type_id_router_cmd
,
662 "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>]",
666 "Display Link state database\n"
667 "Display Router LSAs\n"
668 "Display Network LSAs\n"
669 "Display Inter-Area-Prefix LSAs\n"
670 "Display Inter-Area-Router LSAs\n"
671 "Display As-External LSAs\n"
672 "Display Group-Membership LSAs\n"
673 "Display Type-7 LSAs\n"
674 "Display Link LSAs\n"
675 "Display Intra-Area-Prefix LSAs\n"
676 "Specify Link state ID as IPv4 address notation\n"
677 "Specify Advertising Router as IPv4 address notation\n"
679 "Display LSA's internal information\n")
686 struct listnode
*i
, *j
;
687 struct ospf6
*o
= ospf6
;
688 struct ospf6_area
*oa
;
689 struct ospf6_interface
*oi
;
692 uint32_t adv_router
= 0;
694 OSPF6_CMD_CHECK_RUNNING();
696 type
= parse_type_spec(idx_lsa
, argc
, argv
);
697 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
698 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
699 level
= parse_show_level(idx_level
, argc
, argv
);
701 switch (OSPF6_LSA_SCOPE(type
)) {
702 case OSPF6_SCOPE_AREA
:
703 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
704 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
705 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
710 case OSPF6_SCOPE_LINKLOCAL
:
711 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
712 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
713 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
714 oi
->interface
->name
, oa
->name
);
715 ospf6_lsdb_show(vty
, level
, &type
, &id
,
716 &adv_router
, oi
->lsdb
);
722 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
723 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
736 DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id
,
737 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
,
738 "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>]",
742 "Display Link state database\n"
743 "Display Router LSAs\n"
744 "Display Network LSAs\n"
745 "Display Inter-Area-Prefix LSAs\n"
746 "Display Inter-Area-Router LSAs\n"
747 "Display As-External LSAs\n"
748 "Display Group-Membership LSAs\n"
749 "Display Type-7 LSAs\n"
750 "Display Link LSAs\n"
751 "Display Intra-Area-Prefix LSAs\n"
752 "Search by Advertising Router\n"
753 "Specify Advertising Router as IPv4 address notation\n"
754 "Search by Link state ID\n"
755 "Specify Link state ID as IPv4 address notation\n"
757 "Display LSA's internal information\n")
764 struct listnode
*i
, *j
;
765 struct ospf6
*o
= ospf6
;
766 struct ospf6_area
*oa
;
767 struct ospf6_interface
*oi
;
770 uint32_t adv_router
= 0;
772 OSPF6_CMD_CHECK_RUNNING();
774 type
= parse_type_spec(idx_lsa
, argc
, argv
);
775 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
776 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
777 level
= parse_show_level(idx_level
, argc
, argv
);
779 switch (OSPF6_LSA_SCOPE(type
)) {
780 case OSPF6_SCOPE_AREA
:
781 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
782 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
783 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
788 case OSPF6_SCOPE_LINKLOCAL
:
789 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
790 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
791 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
792 oi
->interface
->name
, oa
->name
);
793 ospf6_lsdb_show(vty
, level
, &type
, &id
,
794 &adv_router
, oi
->lsdb
);
800 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
801 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
813 DEFUN (show_ipv6_ospf6_database_self_originated
,
814 show_ipv6_ospf6_database_self_originated_cmd
,
815 "show ipv6 ospf6 database self-originated [<detail|dump|internal>]",
819 "Display Link state database\n"
820 "Display Self-originated LSAs\n"
821 "Display details of LSAs\n"
823 "Display LSA's internal information\n")
827 struct listnode
*i
, *j
;
828 struct ospf6
*o
= ospf6
;
829 struct ospf6_area
*oa
;
830 struct ospf6_interface
*oi
;
831 uint32_t adv_router
= 0;
833 OSPF6_CMD_CHECK_RUNNING();
834 level
= parse_show_level(idx_level
, argc
, argv
);
835 adv_router
= o
->router_id
;
837 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
838 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
839 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, oa
->lsdb
);
842 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
843 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
844 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
846 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
,
851 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
852 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, o
->lsdb
);
859 DEFUN (show_ipv6_ospf6_database_type_self_originated
,
860 show_ipv6_ospf6_database_type_self_originated_cmd
,
861 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]",
865 "Display Link state database\n"
866 "Display Router LSAs\n"
867 "Display Network LSAs\n"
868 "Display Inter-Area-Prefix LSAs\n"
869 "Display Inter-Area-Router LSAs\n"
870 "Display As-External LSAs\n"
871 "Display Group-Membership LSAs\n"
872 "Display Type-7 LSAs\n"
873 "Display Link LSAs\n"
874 "Display Intra-Area-Prefix LSAs\n"
875 "Display Self-originated LSAs\n"
876 "Display details of LSAs\n"
878 "Display LSA's internal information\n")
883 struct listnode
*i
, *j
;
884 struct ospf6
*o
= ospf6
;
885 struct ospf6_area
*oa
;
886 struct ospf6_interface
*oi
;
888 uint32_t adv_router
= 0;
890 OSPF6_CMD_CHECK_RUNNING();
892 type
= parse_type_spec(idx_lsa
, argc
, argv
);
893 level
= parse_show_level(idx_level
, argc
, argv
);
895 adv_router
= o
->router_id
;
897 switch (OSPF6_LSA_SCOPE(type
)) {
898 case OSPF6_SCOPE_AREA
:
899 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
900 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
901 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
,
906 case OSPF6_SCOPE_LINKLOCAL
:
907 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
908 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
909 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
910 oi
->interface
->name
, oa
->name
);
911 ospf6_lsdb_show(vty
, level
, &type
, NULL
,
912 &adv_router
, oi
->lsdb
);
918 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
919 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
931 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id
,
932 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
,
933 "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>]",
937 "Display Link state database\n"
938 "Display Router LSAs\n"
939 "Display Network LSAs\n"
940 "Display Inter-Area-Prefix LSAs\n"
941 "Display Inter-Area-Router LSAs\n"
942 "Display As-External LSAs\n"
943 "Display Group-Membership LSAs\n"
944 "Display Type-7 LSAs\n"
945 "Display Link LSAs\n"
946 "Display Intra-Area-Prefix LSAs\n"
947 "Display Self-originated LSAs\n"
948 "Search by Link state ID\n"
949 "Specify Link state ID as IPv4 address notation\n"
950 "Display details of LSAs\n"
952 "Display LSA's internal information\n")
958 struct listnode
*i
, *j
;
959 struct ospf6
*o
= ospf6
;
960 struct ospf6_area
*oa
;
961 struct ospf6_interface
*oi
;
963 uint32_t adv_router
= 0;
966 OSPF6_CMD_CHECK_RUNNING();
968 type
= parse_type_spec(idx_lsa
, argc
, argv
);
969 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
970 level
= parse_show_level(idx_level
, argc
, argv
);
971 adv_router
= o
->router_id
;
973 switch (OSPF6_LSA_SCOPE(type
)) {
974 case OSPF6_SCOPE_AREA
:
975 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
976 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
977 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
982 case OSPF6_SCOPE_LINKLOCAL
:
983 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
984 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
985 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
986 oi
->interface
->name
, oa
->name
);
987 ospf6_lsdb_show(vty
, level
, &type
, &id
,
988 &adv_router
, oi
->lsdb
);
994 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
995 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1007 DEFUN (show_ipv6_ospf6_database_type_id_self_originated
,
1008 show_ipv6_ospf6_database_type_id_self_originated_cmd
,
1009 "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>]",
1013 "Display Link state database\n"
1014 "Display Router LSAs\n"
1015 "Display Network LSAs\n"
1016 "Display Inter-Area-Prefix LSAs\n"
1017 "Display Inter-Area-Router LSAs\n"
1018 "Display As-External LSAs\n"
1019 "Display Group-Membership LSAs\n"
1020 "Display Type-7 LSAs\n"
1021 "Display Link LSAs\n"
1022 "Display Intra-Area-Prefix LSAs\n"
1023 "Specify Link state ID as IPv4 address notation\n"
1024 "Display Self-originated LSAs\n"
1025 "Display details of LSAs\n"
1027 "Display LSA's internal information\n")
1033 struct listnode
*i
, *j
;
1034 struct ospf6
*o
= ospf6
;
1035 struct ospf6_area
*oa
;
1036 struct ospf6_interface
*oi
;
1038 uint32_t adv_router
= 0;
1041 OSPF6_CMD_CHECK_RUNNING();
1043 type
= parse_type_spec(idx_lsa
, argc
, argv
);
1044 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
1045 level
= parse_show_level(idx_level
, argc
, argv
);
1046 adv_router
= o
->router_id
;
1048 switch (OSPF6_LSA_SCOPE(type
)) {
1049 case OSPF6_SCOPE_AREA
:
1050 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
1051 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
1052 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
1057 case OSPF6_SCOPE_LINKLOCAL
:
1058 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
1059 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
1060 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
1061 oi
->interface
->name
, oa
->name
);
1062 ospf6_lsdb_show(vty
, level
, &type
, &id
,
1063 &adv_router
, oi
->lsdb
);
1068 case OSPF6_SCOPE_AS
:
1069 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
1070 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1082 DEFUN (show_ipv6_ospf6_border_routers
,
1083 show_ipv6_ospf6_border_routers_cmd
,
1084 "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
1088 "Display routing table for ABR and ASBR\n"
1090 "Show detailed output\n")
1093 uint32_t adv_router
;
1094 struct ospf6_route
*ro
;
1095 struct prefix prefix
;
1097 OSPF6_CMD_CHECK_RUNNING();
1100 if (strmatch(argv
[idx_ipv4
]->text
, "detail")) {
1101 for (ro
= ospf6_route_head(ospf6
->brouter_table
); ro
;
1102 ro
= ospf6_route_next(ro
))
1103 ospf6_route_show_detail(vty
, ro
);
1105 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
1107 ospf6_linkstate_prefix(adv_router
, 0, &prefix
);
1108 ro
= ospf6_route_lookup(&prefix
, ospf6
->brouter_table
);
1111 "No Route found for Router ID: %s\n",
1116 ospf6_route_show_detail(vty
, ro
);
1120 ospf6_brouter_show_header(vty
);
1122 for (ro
= ospf6_route_head(ospf6
->brouter_table
); ro
;
1123 ro
= ospf6_route_next(ro
))
1124 ospf6_brouter_show(vty
, ro
);
1131 DEFUN (show_ipv6_ospf6_linkstate
,
1132 show_ipv6_ospf6_linkstate_cmd
,
1133 "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>",
1137 "Display linkstate routing table\n"
1138 "Display Router Entry\n"
1139 "Specify Router ID as IPv4 address notation\n"
1140 "Display Network Entry\n"
1141 "Specify Router ID as IPv4 address notation\n"
1142 "Specify Link state ID as IPv4 address notation\n")
1145 struct listnode
*node
;
1146 struct ospf6_area
*oa
;
1148 OSPF6_CMD_CHECK_RUNNING();
1150 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, node
, oa
)) {
1151 vty_out(vty
, "\n SPF Result in Area %s\n\n", oa
->name
);
1152 ospf6_linkstate_table_show(vty
, idx_ipv4
, argc
, argv
,
1161 DEFUN (show_ipv6_ospf6_linkstate_detail
,
1162 show_ipv6_ospf6_linkstate_detail_cmd
,
1163 "show ipv6 ospf6 linkstate detail",
1167 "Display linkstate routing table\n"
1168 "Display detailed information\n")
1171 struct listnode
*node
;
1172 struct ospf6_area
*oa
;
1174 OSPF6_CMD_CHECK_RUNNING();
1176 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, node
, oa
)) {
1177 vty_out(vty
, "\n SPF Result in Area %s\n\n", oa
->name
);
1178 ospf6_linkstate_table_show(vty
, idx_detail
, argc
, argv
,
1186 static void ospf6_plist_add(struct prefix_list
*plist
)
1188 if (prefix_list_afi(plist
) != AFI_IP6
)
1190 ospf6_area_plist_update(plist
, 1);
1193 static void ospf6_plist_del(struct prefix_list
*plist
)
1195 if (prefix_list_afi(plist
) != AFI_IP6
)
1197 ospf6_area_plist_update(plist
, 0);
1200 /* Install ospf related commands. */
1201 void ospf6_init(void)
1205 ospf6_interface_init();
1206 ospf6_neighbor_init();
1207 ospf6_zebra_init(master
);
1215 prefix_list_add_hook(ospf6_plist_add
);
1216 prefix_list_delete_hook(ospf6_plist_del
);
1219 install_node(&debug_node
, config_write_ospf6_debug
);
1221 install_element_ospf6_debug_message();
1222 install_element_ospf6_debug_lsa();
1223 install_element_ospf6_debug_interface();
1224 install_element_ospf6_debug_neighbor();
1225 install_element_ospf6_debug_zebra();
1226 install_element_ospf6_debug_spf();
1227 install_element_ospf6_debug_route();
1228 install_element_ospf6_debug_brouter();
1229 install_element_ospf6_debug_asbr();
1230 install_element_ospf6_debug_abr();
1231 install_element_ospf6_debug_flood();
1233 install_element_ospf6_clear_interface();
1235 install_element(VIEW_NODE
, &show_debugging_ospf6_cmd
);
1237 install_element(VIEW_NODE
, &show_ipv6_ospf6_border_routers_cmd
);
1239 install_element(VIEW_NODE
, &show_ipv6_ospf6_linkstate_cmd
);
1240 install_element(VIEW_NODE
, &show_ipv6_ospf6_linkstate_detail_cmd
);
1242 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_cmd
);
1243 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_cmd
);
1244 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_id_cmd
);
1245 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_router_cmd
);
1246 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_id_cmd
);
1247 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_router_cmd
);
1248 install_element(VIEW_NODE
,
1249 &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
);
1250 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_id_router_cmd
);
1251 install_element(VIEW_NODE
,
1252 &show_ipv6_ospf6_database_type_id_router_cmd
);
1255 &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
);
1256 install_element(VIEW_NODE
,
1257 &show_ipv6_ospf6_database_self_originated_cmd
);
1258 install_element(VIEW_NODE
,
1259 &show_ipv6_ospf6_database_type_self_originated_cmd
);
1260 install_element(VIEW_NODE
,
1261 &show_ipv6_ospf6_database_type_id_self_originated_cmd
);
1264 &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
);
1265 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_aggr_router_cmd
);
1267 /* Make ospf protocol socket. */
1269 thread_add_read(master
, ospf6_receive
, NULL
, ospf6_sock
, NULL
);
1272 void ospf6_clean(void)
1276 if (ospf6
->route_table
)
1277 ospf6_route_remove_all(ospf6
->route_table
);
1278 if (ospf6
->brouter_table
)
1279 ospf6_route_remove_all(ospf6
->brouter_table
);