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 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
;
171 struct ospf6
*o
= ospf6
;
172 struct ospf6_area
*oa
;
173 struct ospf6_interface
*oi
;
175 OSPF6_CMD_CHECK_RUNNING();
177 level
= parse_show_level(idx_level
, argc
, argv
);
179 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
180 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
181 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, NULL
, oa
->lsdb
);
184 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
185 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
186 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
188 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, NULL
, oi
->lsdb
);
192 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
193 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, NULL
, o
->lsdb
);
199 DEFUN (show_ipv6_ospf6_database_type
,
200 show_ipv6_ospf6_database_type_cmd
,
201 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>]",
205 "Display Link state database\n"
206 "Display Router LSAs\n"
207 "Display Network LSAs\n"
208 "Display Inter-Area-Prefix LSAs\n"
209 "Display Inter-Area-Router LSAs\n"
210 "Display As-External LSAs\n"
211 "Display Group-Membership LSAs\n"
212 "Display Type-7 LSAs\n"
213 "Display Link LSAs\n"
214 "Display Intra-Area-Prefix LSAs\n"
215 "Display details of LSAs\n"
217 "Display LSA's internal information\n"
223 struct listnode
*i
, *j
;
224 struct ospf6
*o
= ospf6
;
225 struct ospf6_area
*oa
;
226 struct ospf6_interface
*oi
;
229 OSPF6_CMD_CHECK_RUNNING();
231 type
= parse_type_spec(idx_lsa
, argc
, argv
);
232 level
= parse_show_level(idx_level
, argc
, argv
);
234 switch (OSPF6_LSA_SCOPE(type
)) {
235 case OSPF6_SCOPE_AREA
:
236 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
237 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
238 ospf6_lsdb_show(vty
, level
, &type
, NULL
, NULL
,
243 case OSPF6_SCOPE_LINKLOCAL
:
244 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
245 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
246 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
247 oi
->interface
->name
, oa
->name
);
248 ospf6_lsdb_show(vty
, level
, &type
, NULL
, NULL
,
255 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
256 ospf6_lsdb_show(vty
, level
, &type
, NULL
, NULL
, o
->lsdb
);
268 DEFUN (show_ipv6_ospf6_database_id
,
269 show_ipv6_ospf6_database_id_cmd
,
270 "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D [<detail|dump|internal>]",
274 "Display Link state database\n"
275 "Any Link state Type\n"
276 "Search by Link state ID\n"
277 "Specify Link state ID as IPv4 address notation\n"
278 "Display details of LSAs\n"
280 "Display LSA's internal information\n")
285 struct listnode
*i
, *j
;
286 struct ospf6
*o
= ospf6
;
287 struct ospf6_area
*oa
;
288 struct ospf6_interface
*oi
;
291 OSPF6_CMD_CHECK_RUNNING();
293 if (argv
[idx_ipv4
]->type
== IPV4_TKN
)
294 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
296 level
= parse_show_level(idx_level
, argc
, argv
);
298 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
299 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
300 ospf6_lsdb_show(vty
, level
, NULL
, &id
, NULL
, oa
->lsdb
);
303 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
304 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
305 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
307 ospf6_lsdb_show(vty
, level
, NULL
, &id
, NULL
, oi
->lsdb
);
311 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
312 ospf6_lsdb_show(vty
, level
, NULL
, &id
, NULL
, o
->lsdb
);
318 DEFUN (show_ipv6_ospf6_database_router
,
319 show_ipv6_ospf6_database_router_cmd
,
320 "show ipv6 ospf6 database <*|adv-router> * A.B.C.D <detail|dump|internal>",
324 "Display Link state database\n"
325 "Any Link state Type\n"
326 "Search by Advertising Router\n"
327 "Any Link state ID\n"
328 "Specify Advertising Router as IPv4 address notation\n"
329 "Display details of LSAs\n"
331 "Display LSA's internal information\n")
336 struct listnode
*i
, *j
;
337 struct ospf6
*o
= ospf6
;
338 struct ospf6_area
*oa
;
339 struct ospf6_interface
*oi
;
340 uint32_t adv_router
= 0;
342 OSPF6_CMD_CHECK_RUNNING();
343 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
344 level
= parse_show_level(idx_level
, argc
, argv
);
346 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
347 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
348 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, oa
->lsdb
);
351 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
352 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
353 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
355 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
,
360 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
361 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, o
->lsdb
);
367 DEFUN_HIDDEN (show_ipv6_ospf6_database_aggr_router
,
368 show_ipv6_ospf6_database_aggr_router_cmd
,
369 "show ipv6 ospf6 database aggr adv-router A.B.C.D",
373 "Display Link state database\n"
374 "Aggregated Router LSA\n"
375 "Search by Advertising Router\n"
376 "Specify Advertising Router as IPv4 address notation\n")
378 int level
= OSPF6_LSDB_SHOW_LEVEL_DETAIL
;
379 uint16_t type
= htons(OSPF6_LSTYPE_ROUTER
);
382 struct ospf6
*o
= ospf6
;
383 struct ospf6_area
*oa
;
384 struct ospf6_lsdb
*lsdb
;
385 uint32_t adv_router
= 0;
387 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
389 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
390 if (adv_router
== o
->router_id
)
391 lsdb
= oa
->lsdb_self
;
394 if (ospf6_create_single_router_lsa(oa
, lsdb
, adv_router
)
396 vty_out(vty
, "Adv router is not found in LSDB.");
399 ospf6_lsdb_show(vty
, level
, &type
, NULL
, NULL
,
400 oa
->temp_router_lsa_lsdb
);
401 /* Remove the temp cache */
402 ospf6_remove_temp_router_lsa(oa
);
410 DEFUN (show_ipv6_ospf6_database_type_id
,
411 show_ipv6_ospf6_database_type_id_cmd
,
412 "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>]",
416 "Display Link state database\n"
417 "Display Router LSAs\n"
418 "Display Network LSAs\n"
419 "Display Inter-Area-Prefix LSAs\n"
420 "Display Inter-Area-Router LSAs\n"
421 "Display As-External LSAs\n"
422 "Display Group-Membership LSAs\n"
423 "Display Type-7 LSAs\n"
424 "Display Link LSAs\n"
425 "Display Intra-Area-Prefix LSAs\n"
426 "Search by Link state ID\n"
427 "Specify Link state ID as IPv4 address notation\n"
428 "Display details of LSAs\n"
430 "Display LSA's internal information\n"
437 struct listnode
*i
, *j
;
438 struct ospf6
*o
= ospf6
;
439 struct ospf6_area
*oa
;
440 struct ospf6_interface
*oi
;
444 OSPF6_CMD_CHECK_RUNNING();
446 type
= parse_type_spec(idx_lsa
, argc
, argv
);
447 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
448 level
= parse_show_level(idx_level
, argc
, argv
);
450 switch (OSPF6_LSA_SCOPE(type
)) {
451 case OSPF6_SCOPE_AREA
:
452 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
453 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
454 ospf6_lsdb_show(vty
, level
, &type
, &id
, NULL
, oa
->lsdb
);
458 case OSPF6_SCOPE_LINKLOCAL
:
459 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
460 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
461 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
462 oi
->interface
->name
, oa
->name
);
463 ospf6_lsdb_show(vty
, level
, &type
, &id
, NULL
,
470 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
471 ospf6_lsdb_show(vty
, level
, &type
, &id
, NULL
, o
->lsdb
);
483 DEFUN (show_ipv6_ospf6_database_type_router
,
484 show_ipv6_ospf6_database_type_router_cmd
,
485 "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>]",
489 "Display Link state database\n"
490 "Display Router LSAs\n"
491 "Display Network LSAs\n"
492 "Display Inter-Area-Prefix LSAs\n"
493 "Display Inter-Area-Router LSAs\n"
494 "Display As-External LSAs\n"
495 "Display Group-Membership LSAs\n"
496 "Display Type-7 LSAs\n"
497 "Display Link LSAs\n"
498 "Display Intra-Area-Prefix LSAs\n"
499 "Any Link state ID\n"
500 "Search by Advertising Router\n"
501 "Specify Advertising Router as IPv4 address notation\n"
502 "Display details of LSAs\n"
504 "Display LSA's internal information\n"
511 struct listnode
*i
, *j
;
512 struct ospf6
*o
= ospf6
;
513 struct ospf6_area
*oa
;
514 struct ospf6_interface
*oi
;
516 uint32_t adv_router
= 0;
518 OSPF6_CMD_CHECK_RUNNING();
520 type
= parse_type_spec(idx_lsa
, argc
, argv
);
521 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
522 level
= parse_show_level(idx_level
, argc
, argv
);
524 switch (OSPF6_LSA_SCOPE(type
)) {
525 case OSPF6_SCOPE_AREA
:
526 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
527 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
528 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
,
533 case OSPF6_SCOPE_LINKLOCAL
:
534 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
535 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
536 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
537 oi
->interface
->name
, oa
->name
);
538 ospf6_lsdb_show(vty
, level
, &type
, NULL
,
539 &adv_router
, oi
->lsdb
);
545 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
546 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
559 DEFUN (show_ipv6_ospf6_database_id_router
,
560 show_ipv6_ospf6_database_id_router_cmd
,
561 "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>]",
565 "Display Link state database\n"
566 "Any Link state Type\n"
567 "Specify Link state ID as IPv4 address notation\n"
568 "Specify Advertising Router as IPv4 address notation\n"
569 "Display details of LSAs\n"
571 "Display LSA's internal information\n"
578 struct listnode
*i
, *j
;
579 struct ospf6
*o
= ospf6
;
580 struct ospf6_area
*oa
;
581 struct ospf6_interface
*oi
;
583 uint32_t adv_router
= 0;
585 OSPF6_CMD_CHECK_RUNNING();
586 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
587 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
588 level
= parse_show_level(idx_level
, argc
, argv
);
590 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
591 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
592 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, oa
->lsdb
);
595 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
596 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
597 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
599 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
,
604 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
605 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, o
->lsdb
);
612 DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id
,
613 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
,
614 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>]",
618 "Display Link state database\n"
619 "Search by Advertising Router\n"
620 "Specify Advertising Router as IPv4 address notation\n"
621 "Search by Link state ID\n"
622 "Specify Link state ID as IPv4 address notation\n"
623 "Display details of LSAs\n"
625 "Display LSA's internal information\n")
631 struct listnode
*i
, *j
;
632 struct ospf6
*o
= ospf6
;
633 struct ospf6_area
*oa
;
634 struct ospf6_interface
*oi
;
636 uint32_t adv_router
= 0;
638 OSPF6_CMD_CHECK_RUNNING();
639 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
640 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
641 level
= parse_show_level(idx_level
, argc
, argv
);
643 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
644 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
645 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, oa
->lsdb
);
648 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
649 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
650 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
652 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
,
657 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
658 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, o
->lsdb
);
664 DEFUN (show_ipv6_ospf6_database_type_id_router
,
665 show_ipv6_ospf6_database_type_id_router_cmd
,
666 "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>]",
670 "Display Link state database\n"
671 "Display Router LSAs\n"
672 "Display Network LSAs\n"
673 "Display Inter-Area-Prefix LSAs\n"
674 "Display Inter-Area-Router LSAs\n"
675 "Display As-External LSAs\n"
676 "Display Group-Membership LSAs\n"
677 "Display Type-7 LSAs\n"
678 "Display Link LSAs\n"
679 "Display Intra-Area-Prefix LSAs\n"
680 "Specify Link state ID as IPv4 address notation\n"
681 "Specify Advertising Router as IPv4 address notation\n"
683 "Display LSA's internal information\n")
690 struct listnode
*i
, *j
;
691 struct ospf6
*o
= ospf6
;
692 struct ospf6_area
*oa
;
693 struct ospf6_interface
*oi
;
696 uint32_t adv_router
= 0;
698 OSPF6_CMD_CHECK_RUNNING();
700 type
= parse_type_spec(idx_lsa
, argc
, argv
);
701 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
702 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
703 level
= parse_show_level(idx_level
, argc
, argv
);
705 switch (OSPF6_LSA_SCOPE(type
)) {
706 case OSPF6_SCOPE_AREA
:
707 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
708 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
709 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
714 case OSPF6_SCOPE_LINKLOCAL
:
715 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
716 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
717 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
718 oi
->interface
->name
, oa
->name
);
719 ospf6_lsdb_show(vty
, level
, &type
, &id
,
720 &adv_router
, oi
->lsdb
);
726 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
727 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
740 DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id
,
741 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
,
742 "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>]",
746 "Display Link state database\n"
747 "Display Router LSAs\n"
748 "Display Network LSAs\n"
749 "Display Inter-Area-Prefix LSAs\n"
750 "Display Inter-Area-Router LSAs\n"
751 "Display As-External LSAs\n"
752 "Display Group-Membership LSAs\n"
753 "Display Type-7 LSAs\n"
754 "Display Link LSAs\n"
755 "Display Intra-Area-Prefix LSAs\n"
756 "Search by Advertising Router\n"
757 "Specify Advertising Router as IPv4 address notation\n"
758 "Search by Link state ID\n"
759 "Specify Link state ID as IPv4 address notation\n"
761 "Display LSA's internal information\n")
768 struct listnode
*i
, *j
;
769 struct ospf6
*o
= ospf6
;
770 struct ospf6_area
*oa
;
771 struct ospf6_interface
*oi
;
774 uint32_t adv_router
= 0;
776 OSPF6_CMD_CHECK_RUNNING();
778 type
= parse_type_spec(idx_lsa
, argc
, argv
);
779 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
780 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
781 level
= parse_show_level(idx_level
, argc
, argv
);
783 switch (OSPF6_LSA_SCOPE(type
)) {
784 case OSPF6_SCOPE_AREA
:
785 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
786 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
787 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
792 case OSPF6_SCOPE_LINKLOCAL
:
793 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
794 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
795 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
796 oi
->interface
->name
, oa
->name
);
797 ospf6_lsdb_show(vty
, level
, &type
, &id
,
798 &adv_router
, oi
->lsdb
);
804 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
805 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
817 DEFUN (show_ipv6_ospf6_database_self_originated
,
818 show_ipv6_ospf6_database_self_originated_cmd
,
819 "show ipv6 ospf6 database self-originated [<detail|dump|internal>]",
823 "Display Link state database\n"
824 "Display Self-originated LSAs\n"
825 "Display details of LSAs\n"
827 "Display LSA's internal information\n")
831 struct listnode
*i
, *j
;
832 struct ospf6
*o
= ospf6
;
833 struct ospf6_area
*oa
;
834 struct ospf6_interface
*oi
;
835 uint32_t adv_router
= 0;
837 OSPF6_CMD_CHECK_RUNNING();
838 level
= parse_show_level(idx_level
, argc
, argv
);
839 adv_router
= o
->router_id
;
841 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
842 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
843 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, oa
->lsdb
);
846 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
847 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
848 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
850 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
,
855 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
856 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, o
->lsdb
);
863 DEFUN (show_ipv6_ospf6_database_type_self_originated
,
864 show_ipv6_ospf6_database_type_self_originated_cmd
,
865 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]",
869 "Display Link state database\n"
870 "Display Router LSAs\n"
871 "Display Network LSAs\n"
872 "Display Inter-Area-Prefix LSAs\n"
873 "Display Inter-Area-Router LSAs\n"
874 "Display As-External LSAs\n"
875 "Display Group-Membership LSAs\n"
876 "Display Type-7 LSAs\n"
877 "Display Link LSAs\n"
878 "Display Intra-Area-Prefix LSAs\n"
879 "Display Self-originated LSAs\n"
880 "Display details of LSAs\n"
882 "Display LSA's internal information\n")
887 struct listnode
*i
, *j
;
888 struct ospf6
*o
= ospf6
;
889 struct ospf6_area
*oa
;
890 struct ospf6_interface
*oi
;
892 uint32_t adv_router
= 0;
894 OSPF6_CMD_CHECK_RUNNING();
896 type
= parse_type_spec(idx_lsa
, argc
, argv
);
897 level
= parse_show_level(idx_level
, argc
, argv
);
899 adv_router
= o
->router_id
;
901 switch (OSPF6_LSA_SCOPE(type
)) {
902 case OSPF6_SCOPE_AREA
:
903 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
904 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
905 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
,
910 case OSPF6_SCOPE_LINKLOCAL
:
911 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
912 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
913 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
914 oi
->interface
->name
, oa
->name
);
915 ospf6_lsdb_show(vty
, level
, &type
, NULL
,
916 &adv_router
, oi
->lsdb
);
922 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
923 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
935 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id
,
936 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
,
937 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated linkstate-id A.B.C.D [<detail|dump|internal>]",
941 "Display Link state database\n"
942 "Display Router LSAs\n"
943 "Display Network LSAs\n"
944 "Display Inter-Area-Prefix LSAs\n"
945 "Display Inter-Area-Router LSAs\n"
946 "Display As-External LSAs\n"
947 "Display Group-Membership LSAs\n"
948 "Display Type-7 LSAs\n"
949 "Display Link LSAs\n"
950 "Display Intra-Area-Prefix LSAs\n"
951 "Display Self-originated LSAs\n"
952 "Search by Link state ID\n"
953 "Specify Link state ID as IPv4 address notation\n"
954 "Display details of LSAs\n"
956 "Display LSA's internal information\n")
962 struct listnode
*i
, *j
;
963 struct ospf6
*o
= ospf6
;
964 struct ospf6_area
*oa
;
965 struct ospf6_interface
*oi
;
967 uint32_t adv_router
= 0;
970 OSPF6_CMD_CHECK_RUNNING();
972 type
= parse_type_spec(idx_lsa
, argc
, argv
);
973 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
974 level
= parse_show_level(idx_level
, argc
, argv
);
975 adv_router
= o
->router_id
;
977 switch (OSPF6_LSA_SCOPE(type
)) {
978 case OSPF6_SCOPE_AREA
:
979 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
980 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
981 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
986 case OSPF6_SCOPE_LINKLOCAL
:
987 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
988 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
989 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
990 oi
->interface
->name
, oa
->name
);
991 ospf6_lsdb_show(vty
, level
, &type
, &id
,
992 &adv_router
, oi
->lsdb
);
998 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
999 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1011 DEFUN (show_ipv6_ospf6_database_type_id_self_originated
,
1012 show_ipv6_ospf6_database_type_id_self_originated_cmd
,
1013 "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>]",
1017 "Display Link state database\n"
1018 "Display Router LSAs\n"
1019 "Display Network LSAs\n"
1020 "Display Inter-Area-Prefix LSAs\n"
1021 "Display Inter-Area-Router LSAs\n"
1022 "Display As-External LSAs\n"
1023 "Display Group-Membership LSAs\n"
1024 "Display Type-7 LSAs\n"
1025 "Display Link LSAs\n"
1026 "Display Intra-Area-Prefix LSAs\n"
1027 "Specify Link state ID as IPv4 address notation\n"
1028 "Display Self-originated LSAs\n"
1029 "Display details of LSAs\n"
1031 "Display LSA's internal information\n")
1037 struct listnode
*i
, *j
;
1038 struct ospf6
*o
= ospf6
;
1039 struct ospf6_area
*oa
;
1040 struct ospf6_interface
*oi
;
1042 uint32_t adv_router
= 0;
1045 OSPF6_CMD_CHECK_RUNNING();
1047 type
= parse_type_spec(idx_lsa
, argc
, argv
);
1048 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
1049 level
= parse_show_level(idx_level
, argc
, argv
);
1050 adv_router
= o
->router_id
;
1052 switch (OSPF6_LSA_SCOPE(type
)) {
1053 case OSPF6_SCOPE_AREA
:
1054 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
1055 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
1056 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
1061 case OSPF6_SCOPE_LINKLOCAL
:
1062 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
1063 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
1064 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
1065 oi
->interface
->name
, oa
->name
);
1066 ospf6_lsdb_show(vty
, level
, &type
, &id
,
1067 &adv_router
, oi
->lsdb
);
1072 case OSPF6_SCOPE_AS
:
1073 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
1074 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1086 DEFUN (show_ipv6_ospf6_border_routers
,
1087 show_ipv6_ospf6_border_routers_cmd
,
1088 "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
1092 "Display routing table for ABR and ASBR\n"
1094 "Show detailed output\n")
1097 uint32_t adv_router
;
1098 struct ospf6_route
*ro
;
1099 struct prefix prefix
;
1101 OSPF6_CMD_CHECK_RUNNING();
1104 if (strmatch(argv
[idx_ipv4
]->text
, "detail")) {
1105 for (ro
= ospf6_route_head(ospf6
->brouter_table
); ro
;
1106 ro
= ospf6_route_next(ro
))
1107 ospf6_route_show_detail(vty
, ro
);
1109 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
1111 ospf6_linkstate_prefix(adv_router
, 0, &prefix
);
1112 ro
= ospf6_route_lookup(&prefix
, ospf6
->brouter_table
);
1115 "No Route found for Router ID: %s\n",
1120 ospf6_route_show_detail(vty
, ro
);
1124 ospf6_brouter_show_header(vty
);
1126 for (ro
= ospf6_route_head(ospf6
->brouter_table
); ro
;
1127 ro
= ospf6_route_next(ro
))
1128 ospf6_brouter_show(vty
, ro
);
1135 DEFUN (show_ipv6_ospf6_linkstate
,
1136 show_ipv6_ospf6_linkstate_cmd
,
1137 "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>",
1141 "Display linkstate routing table\n"
1142 "Display Router Entry\n"
1143 "Specify Router ID as IPv4 address notation\n"
1144 "Display Network Entry\n"
1145 "Specify Router ID as IPv4 address notation\n"
1146 "Specify Link state ID as IPv4 address notation\n")
1149 struct listnode
*node
;
1150 struct ospf6_area
*oa
;
1152 OSPF6_CMD_CHECK_RUNNING();
1154 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, node
, oa
)) {
1155 vty_out(vty
, "\n SPF Result in Area %s\n\n", oa
->name
);
1156 ospf6_linkstate_table_show(vty
, idx_ipv4
, argc
, argv
,
1165 DEFUN (show_ipv6_ospf6_linkstate_detail
,
1166 show_ipv6_ospf6_linkstate_detail_cmd
,
1167 "show ipv6 ospf6 linkstate detail",
1171 "Display linkstate routing table\n"
1172 "Display detailed information\n")
1175 struct listnode
*node
;
1176 struct ospf6_area
*oa
;
1178 OSPF6_CMD_CHECK_RUNNING();
1180 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, node
, oa
)) {
1181 vty_out(vty
, "\n SPF Result in Area %s\n\n", oa
->name
);
1182 ospf6_linkstate_table_show(vty
, idx_detail
, argc
, argv
,
1190 static void ospf6_plist_add(struct prefix_list
*plist
)
1192 if (prefix_list_afi(plist
) != AFI_IP6
)
1194 ospf6_area_plist_update(plist
, 1);
1197 static void ospf6_plist_del(struct prefix_list
*plist
)
1199 if (prefix_list_afi(plist
) != AFI_IP6
)
1201 ospf6_area_plist_update(plist
, 0);
1204 /* Install ospf related commands. */
1205 void ospf6_init(void)
1209 ospf6_interface_init();
1210 ospf6_neighbor_init();
1211 ospf6_zebra_init(master
);
1219 prefix_list_add_hook(ospf6_plist_add
);
1220 prefix_list_delete_hook(ospf6_plist_del
);
1223 install_node(&debug_node
);
1225 install_element_ospf6_debug_message();
1226 install_element_ospf6_debug_lsa();
1227 install_element_ospf6_debug_interface();
1228 install_element_ospf6_debug_neighbor();
1229 install_element_ospf6_debug_zebra();
1230 install_element_ospf6_debug_spf();
1231 install_element_ospf6_debug_route();
1232 install_element_ospf6_debug_brouter();
1233 install_element_ospf6_debug_asbr();
1234 install_element_ospf6_debug_abr();
1235 install_element_ospf6_debug_flood();
1237 install_element_ospf6_clear_interface();
1239 install_element(VIEW_NODE
, &show_debugging_ospf6_cmd
);
1241 install_element(VIEW_NODE
, &show_ipv6_ospf6_border_routers_cmd
);
1243 install_element(VIEW_NODE
, &show_ipv6_ospf6_linkstate_cmd
);
1244 install_element(VIEW_NODE
, &show_ipv6_ospf6_linkstate_detail_cmd
);
1246 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_cmd
);
1247 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_cmd
);
1248 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_id_cmd
);
1249 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_router_cmd
);
1250 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_id_cmd
);
1251 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_router_cmd
);
1252 install_element(VIEW_NODE
,
1253 &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
);
1254 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_id_router_cmd
);
1255 install_element(VIEW_NODE
,
1256 &show_ipv6_ospf6_database_type_id_router_cmd
);
1259 &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
);
1260 install_element(VIEW_NODE
,
1261 &show_ipv6_ospf6_database_self_originated_cmd
);
1262 install_element(VIEW_NODE
,
1263 &show_ipv6_ospf6_database_type_self_originated_cmd
);
1264 install_element(VIEW_NODE
,
1265 &show_ipv6_ospf6_database_type_id_self_originated_cmd
);
1268 &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
);
1269 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_aggr_router_cmd
);
1271 /* Make ospf protocol socket. */
1273 thread_add_read(master
, ospf6_receive
, NULL
, ospf6_sock
, NULL
);
1276 void ospf6_clean(void)
1280 if (ospf6
->route_table
)
1281 ospf6_route_remove_all(ospf6
->route_table
);
1282 if (ospf6
->brouter_table
)
1283 ospf6_route_remove_all(ospf6
->brouter_table
);