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:");
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 u_int16_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 u_int32_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 (show_ipv6_ospf6_database_type_id
,
364 show_ipv6_ospf6_database_type_id_cmd
,
365 "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>]",
369 "Display Link state database\n"
370 "Display Router LSAs\n"
371 "Display Network LSAs\n"
372 "Display Inter-Area-Prefix LSAs\n"
373 "Display Inter-Area-Router LSAs\n"
374 "Display As-External LSAs\n"
375 "Display Group-Membership LSAs\n"
376 "Display Type-7 LSAs\n"
377 "Display Link LSAs\n"
378 "Display Intra-Area-Prefix LSAs\n"
379 "Search by Link state ID\n"
380 "Specify Link state ID as IPv4 address notation\n"
381 "Display details of LSAs\n"
383 "Display LSA's internal information\n"
390 struct listnode
*i
, *j
;
391 struct ospf6
*o
= ospf6
;
392 struct ospf6_area
*oa
;
393 struct ospf6_interface
*oi
;
397 OSPF6_CMD_CHECK_RUNNING();
399 type
= parse_type_spec(idx_lsa
, argc
, argv
);
400 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
401 level
= parse_show_level(idx_level
, argc
, argv
);
403 switch (OSPF6_LSA_SCOPE(type
)) {
404 case OSPF6_SCOPE_AREA
:
405 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
406 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
407 ospf6_lsdb_show(vty
, level
, &type
, &id
, NULL
, oa
->lsdb
);
411 case OSPF6_SCOPE_LINKLOCAL
:
412 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
413 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
414 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
415 oi
->interface
->name
, oa
->name
);
416 ospf6_lsdb_show(vty
, level
, &type
, &id
, NULL
,
423 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
424 ospf6_lsdb_show(vty
, level
, &type
, &id
, NULL
, o
->lsdb
);
436 DEFUN (show_ipv6_ospf6_database_type_router
,
437 show_ipv6_ospf6_database_type_router_cmd
,
438 "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>]",
442 "Display Link state database\n"
443 "Display Router LSAs\n"
444 "Display Network LSAs\n"
445 "Display Inter-Area-Prefix LSAs\n"
446 "Display Inter-Area-Router LSAs\n"
447 "Display As-External LSAs\n"
448 "Display Group-Membership LSAs\n"
449 "Display Type-7 LSAs\n"
450 "Display Link LSAs\n"
451 "Display Intra-Area-Prefix LSAs\n"
452 "Any Link state ID\n"
453 "Search by Advertising Router\n"
454 "Specify Advertising Router as IPv4 address notation\n"
455 "Display details of LSAs\n"
457 "Display LSA's internal information\n"
464 struct listnode
*i
, *j
;
465 struct ospf6
*o
= ospf6
;
466 struct ospf6_area
*oa
;
467 struct ospf6_interface
*oi
;
469 u_int32_t adv_router
= 0;
471 OSPF6_CMD_CHECK_RUNNING();
473 type
= parse_type_spec(idx_lsa
, argc
, argv
);
474 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
475 level
= parse_show_level(idx_level
, argc
, argv
);
477 switch (OSPF6_LSA_SCOPE(type
)) {
478 case OSPF6_SCOPE_AREA
:
479 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
480 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
481 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
,
486 case OSPF6_SCOPE_LINKLOCAL
:
487 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
488 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
489 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
490 oi
->interface
->name
, oa
->name
);
491 ospf6_lsdb_show(vty
, level
, &type
, NULL
,
492 &adv_router
, oi
->lsdb
);
498 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
499 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
512 DEFUN (show_ipv6_ospf6_database_id_router
,
513 show_ipv6_ospf6_database_id_router_cmd
,
514 "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>]",
518 "Display Link state database\n"
519 "Any Link state Type\n"
520 "Specify Link state ID as IPv4 address notation\n"
521 "Specify Advertising Router as IPv4 address notation\n"
522 "Display details of LSAs\n"
524 "Display LSA's internal information\n"
531 struct listnode
*i
, *j
;
532 struct ospf6
*o
= ospf6
;
533 struct ospf6_area
*oa
;
534 struct ospf6_interface
*oi
;
536 u_int32_t adv_router
= 0;
538 OSPF6_CMD_CHECK_RUNNING();
539 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
540 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
541 level
= parse_show_level(idx_level
, argc
, argv
);
543 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
544 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
545 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, oa
->lsdb
);
548 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
549 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
550 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
552 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
,
557 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
558 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, o
->lsdb
);
565 DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id
,
566 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
,
567 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>]",
571 "Display Link state database\n"
572 "Search by Advertising Router\n"
573 "Specify Advertising Router as IPv4 address notation\n"
574 "Search by Link state ID\n"
575 "Specify Link state ID as IPv4 address notation\n"
576 "Display details of LSAs\n"
578 "Display LSA's internal information\n")
584 struct listnode
*i
, *j
;
585 struct ospf6
*o
= ospf6
;
586 struct ospf6_area
*oa
;
587 struct ospf6_interface
*oi
;
589 u_int32_t adv_router
= 0;
591 OSPF6_CMD_CHECK_RUNNING();
592 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
593 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
594 level
= parse_show_level(idx_level
, argc
, argv
);
596 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
597 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
598 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, oa
->lsdb
);
601 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
602 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
603 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
605 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
,
610 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
611 ospf6_lsdb_show(vty
, level
, NULL
, &id
, &adv_router
, o
->lsdb
);
617 DEFUN (show_ipv6_ospf6_database_type_id_router
,
618 show_ipv6_ospf6_database_type_id_router_cmd
,
619 "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>]",
623 "Display Link state database\n"
624 "Display Router LSAs\n"
625 "Display Network LSAs\n"
626 "Display Inter-Area-Prefix LSAs\n"
627 "Display Inter-Area-Router LSAs\n"
628 "Display As-External LSAs\n"
629 "Display Group-Membership LSAs\n"
630 "Display Type-7 LSAs\n"
631 "Display Link LSAs\n"
632 "Display Intra-Area-Prefix LSAs\n"
633 "Specify Link state ID as IPv4 address notation\n"
634 "Specify Advertising Router as IPv4 address notation\n"
636 "Display LSA's internal information\n")
643 struct listnode
*i
, *j
;
644 struct ospf6
*o
= ospf6
;
645 struct ospf6_area
*oa
;
646 struct ospf6_interface
*oi
;
649 u_int32_t adv_router
= 0;
651 OSPF6_CMD_CHECK_RUNNING();
653 type
= parse_type_spec(idx_lsa
, argc
, argv
);
654 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
655 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
656 level
= parse_show_level(idx_level
, argc
, argv
);
658 switch (OSPF6_LSA_SCOPE(type
)) {
659 case OSPF6_SCOPE_AREA
:
660 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
661 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
662 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
667 case OSPF6_SCOPE_LINKLOCAL
:
668 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
669 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
670 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
671 oi
->interface
->name
, oa
->name
);
672 ospf6_lsdb_show(vty
, level
, &type
, &id
,
673 &adv_router
, oi
->lsdb
);
679 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
680 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
693 DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id
,
694 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
,
695 "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>]",
699 "Display Link state database\n"
700 "Display Router LSAs\n"
701 "Display Network LSAs\n"
702 "Display Inter-Area-Prefix LSAs\n"
703 "Display Inter-Area-Router LSAs\n"
704 "Display As-External LSAs\n"
705 "Display Group-Membership LSAs\n"
706 "Display Type-7 LSAs\n"
707 "Display Link LSAs\n"
708 "Display Intra-Area-Prefix LSAs\n"
709 "Search by Advertising Router\n"
710 "Specify Advertising Router as IPv4 address notation\n"
711 "Search by Link state ID\n"
712 "Specify Link state ID as IPv4 address notation\n"
714 "Display LSA's internal information\n")
721 struct listnode
*i
, *j
;
722 struct ospf6
*o
= ospf6
;
723 struct ospf6_area
*oa
;
724 struct ospf6_interface
*oi
;
727 u_int32_t adv_router
= 0;
729 OSPF6_CMD_CHECK_RUNNING();
731 type
= parse_type_spec(idx_lsa
, argc
, argv
);
732 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
733 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
734 level
= parse_show_level(idx_level
, argc
, argv
);
736 switch (OSPF6_LSA_SCOPE(type
)) {
737 case OSPF6_SCOPE_AREA
:
738 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
739 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
740 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
745 case OSPF6_SCOPE_LINKLOCAL
:
746 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
747 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
748 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
749 oi
->interface
->name
, oa
->name
);
750 ospf6_lsdb_show(vty
, level
, &type
, &id
,
751 &adv_router
, oi
->lsdb
);
757 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
758 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
770 DEFUN (show_ipv6_ospf6_database_self_originated
,
771 show_ipv6_ospf6_database_self_originated_cmd
,
772 "show ipv6 ospf6 database self-originated [<detail|dump|internal>]",
776 "Display Link state database\n"
777 "Display Self-originated LSAs\n"
778 "Display details of LSAs\n"
780 "Display LSA's internal information\n")
784 struct listnode
*i
, *j
;
785 struct ospf6
*o
= ospf6
;
786 struct ospf6_area
*oa
;
787 struct ospf6_interface
*oi
;
788 u_int32_t adv_router
= 0;
790 OSPF6_CMD_CHECK_RUNNING();
791 level
= parse_show_level(idx_level
, argc
, argv
);
792 adv_router
= o
->router_id
;
794 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
795 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
796 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, oa
->lsdb
);
799 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
800 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
801 vty_out(vty
, IF_LSDB_TITLE_FORMAT
, oi
->interface
->name
,
803 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
,
808 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
809 ospf6_lsdb_show(vty
, level
, NULL
, NULL
, &adv_router
, o
->lsdb
);
816 DEFUN (show_ipv6_ospf6_database_type_self_originated
,
817 show_ipv6_ospf6_database_type_self_originated_cmd
,
818 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]",
822 "Display Link state database\n"
823 "Display Router LSAs\n"
824 "Display Network LSAs\n"
825 "Display Inter-Area-Prefix LSAs\n"
826 "Display Inter-Area-Router LSAs\n"
827 "Display As-External LSAs\n"
828 "Display Group-Membership LSAs\n"
829 "Display Type-7 LSAs\n"
830 "Display Link LSAs\n"
831 "Display Intra-Area-Prefix LSAs\n"
832 "Display Self-originated LSAs\n"
833 "Display details of LSAs\n"
835 "Display LSA's internal information\n")
840 struct listnode
*i
, *j
;
841 struct ospf6
*o
= ospf6
;
842 struct ospf6_area
*oa
;
843 struct ospf6_interface
*oi
;
845 u_int32_t adv_router
= 0;
847 OSPF6_CMD_CHECK_RUNNING();
849 type
= parse_type_spec(idx_lsa
, argc
, argv
);
850 level
= parse_show_level(idx_level
, argc
, argv
);
852 adv_router
= o
->router_id
;
854 switch (OSPF6_LSA_SCOPE(type
)) {
855 case OSPF6_SCOPE_AREA
:
856 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
857 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
858 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
,
863 case OSPF6_SCOPE_LINKLOCAL
:
864 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
865 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
866 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
867 oi
->interface
->name
, oa
->name
);
868 ospf6_lsdb_show(vty
, level
, &type
, NULL
,
869 &adv_router
, oi
->lsdb
);
875 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
876 ospf6_lsdb_show(vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
888 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id
,
889 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
,
890 "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>]",
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 "Search by Link state ID\n"
906 "Specify Link state ID as IPv4 address notation\n"
907 "Display details of LSAs\n"
909 "Display LSA's internal information\n")
915 struct listnode
*i
, *j
;
916 struct ospf6
*o
= ospf6
;
917 struct ospf6_area
*oa
;
918 struct ospf6_interface
*oi
;
920 u_int32_t adv_router
= 0;
923 OSPF6_CMD_CHECK_RUNNING();
925 type
= parse_type_spec(idx_lsa
, argc
, argv
);
926 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
927 level
= parse_show_level(idx_level
, argc
, argv
);
928 adv_router
= o
->router_id
;
930 switch (OSPF6_LSA_SCOPE(type
)) {
931 case OSPF6_SCOPE_AREA
:
932 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
933 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
934 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
939 case OSPF6_SCOPE_LINKLOCAL
:
940 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
941 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
942 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
943 oi
->interface
->name
, oa
->name
);
944 ospf6_lsdb_show(vty
, level
, &type
, &id
,
945 &adv_router
, oi
->lsdb
);
951 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
952 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
964 DEFUN (show_ipv6_ospf6_database_type_id_self_originated
,
965 show_ipv6_ospf6_database_type_id_self_originated_cmd
,
966 "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>]",
970 "Display Link state database\n"
971 "Display Router LSAs\n"
972 "Display Network LSAs\n"
973 "Display Inter-Area-Prefix LSAs\n"
974 "Display Inter-Area-Router LSAs\n"
975 "Display As-External LSAs\n"
976 "Display Group-Membership LSAs\n"
977 "Display Type-7 LSAs\n"
978 "Display Link LSAs\n"
979 "Display Intra-Area-Prefix LSAs\n"
980 "Specify Link state ID as IPv4 address notation\n"
981 "Display Self-originated LSAs\n"
982 "Display details of LSAs\n"
984 "Display LSA's internal information\n")
990 struct listnode
*i
, *j
;
991 struct ospf6
*o
= ospf6
;
992 struct ospf6_area
*oa
;
993 struct ospf6_interface
*oi
;
995 u_int32_t adv_router
= 0;
998 OSPF6_CMD_CHECK_RUNNING();
1000 type
= parse_type_spec(idx_lsa
, argc
, argv
);
1001 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
1002 level
= parse_show_level(idx_level
, argc
, argv
);
1003 adv_router
= o
->router_id
;
1005 switch (OSPF6_LSA_SCOPE(type
)) {
1006 case OSPF6_SCOPE_AREA
:
1007 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
1008 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
1009 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
,
1014 case OSPF6_SCOPE_LINKLOCAL
:
1015 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
1016 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
1017 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
1018 oi
->interface
->name
, oa
->name
);
1019 ospf6_lsdb_show(vty
, level
, &type
, &id
,
1020 &adv_router
, oi
->lsdb
);
1025 case OSPF6_SCOPE_AS
:
1026 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
1027 ospf6_lsdb_show(vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1039 DEFUN (show_ipv6_ospf6_border_routers
,
1040 show_ipv6_ospf6_border_routers_cmd
,
1041 "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
1045 "Display routing table for ABR and ASBR\n"
1047 "Show detailed output\n")
1050 u_int32_t adv_router
;
1051 struct ospf6_route
*ro
;
1052 struct prefix prefix
;
1054 OSPF6_CMD_CHECK_RUNNING();
1057 if (strmatch(argv
[idx_ipv4
]->text
, "detail")) {
1058 for (ro
= ospf6_route_head(ospf6
->brouter_table
); ro
;
1059 ro
= ospf6_route_next(ro
))
1060 ospf6_route_show_detail(vty
, ro
);
1062 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
1064 ospf6_linkstate_prefix(adv_router
, 0, &prefix
);
1065 ro
= ospf6_route_lookup(&prefix
, ospf6
->brouter_table
);
1068 "No Route found for Router ID: %s\n",
1073 ospf6_route_show_detail(vty
, ro
);
1077 ospf6_brouter_show_header(vty
);
1079 for (ro
= ospf6_route_head(ospf6
->brouter_table
); ro
;
1080 ro
= ospf6_route_next(ro
))
1081 ospf6_brouter_show(vty
, ro
);
1088 DEFUN (show_ipv6_ospf6_linkstate
,
1089 show_ipv6_ospf6_linkstate_cmd
,
1090 "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>",
1094 "Display linkstate routing table\n"
1095 "Display Router Entry\n"
1096 "Specify Router ID as IPv4 address notation\n"
1097 "Display Network Entry\n"
1098 "Specify Router ID as IPv4 address notation\n"
1099 "Specify Link state ID as IPv4 address notation\n")
1102 struct listnode
*node
;
1103 struct ospf6_area
*oa
;
1105 OSPF6_CMD_CHECK_RUNNING();
1107 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, node
, oa
)) {
1108 vty_out(vty
, "\n SPF Result in Area %s\n\n", oa
->name
);
1109 ospf6_linkstate_table_show(vty
, idx_ipv4
, argc
, argv
,
1118 DEFUN (show_ipv6_ospf6_linkstate_detail
,
1119 show_ipv6_ospf6_linkstate_detail_cmd
,
1120 "show ipv6 ospf6 linkstate detail",
1124 "Display linkstate routing table\n"
1125 "Display detailed information\n")
1128 struct listnode
*node
;
1129 struct ospf6_area
*oa
;
1131 OSPF6_CMD_CHECK_RUNNING();
1133 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, node
, oa
)) {
1134 vty_out(vty
, "\n SPF Result in Area %s\n\n", oa
->name
);
1135 ospf6_linkstate_table_show(vty
, idx_detail
, argc
, argv
,
1143 static void ospf6_plist_add(struct prefix_list
*plist
)
1145 if (prefix_list_afi(plist
) != AFI_IP6
)
1147 ospf6_area_plist_update(plist
, 1);
1150 static void ospf6_plist_del(struct prefix_list
*plist
)
1152 if (prefix_list_afi(plist
) != AFI_IP6
)
1154 ospf6_area_plist_update(plist
, 0);
1157 /* Install ospf related commands. */
1158 void ospf6_init(void)
1162 ospf6_interface_init();
1163 ospf6_neighbor_init();
1164 ospf6_zebra_init(master
);
1172 prefix_list_add_hook(ospf6_plist_add
);
1173 prefix_list_delete_hook(ospf6_plist_del
);
1176 install_node(&debug_node
, config_write_ospf6_debug
);
1178 install_element_ospf6_debug_message();
1179 install_element_ospf6_debug_lsa();
1180 install_element_ospf6_debug_interface();
1181 install_element_ospf6_debug_neighbor();
1182 install_element_ospf6_debug_zebra();
1183 install_element_ospf6_debug_spf();
1184 install_element_ospf6_debug_route();
1185 install_element_ospf6_debug_brouter();
1186 install_element_ospf6_debug_asbr();
1187 install_element_ospf6_debug_abr();
1188 install_element_ospf6_debug_flood();
1190 install_element_ospf6_clear_interface();
1192 install_element(VIEW_NODE
, &show_debugging_ospf6_cmd
);
1194 install_element(VIEW_NODE
, &show_ipv6_ospf6_border_routers_cmd
);
1196 install_element(VIEW_NODE
, &show_ipv6_ospf6_linkstate_cmd
);
1197 install_element(VIEW_NODE
, &show_ipv6_ospf6_linkstate_detail_cmd
);
1199 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_cmd
);
1200 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_cmd
);
1201 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_id_cmd
);
1202 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_router_cmd
);
1203 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_id_cmd
);
1204 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_router_cmd
);
1205 install_element(VIEW_NODE
,
1206 &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
);
1207 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_id_router_cmd
);
1208 install_element(VIEW_NODE
,
1209 &show_ipv6_ospf6_database_type_id_router_cmd
);
1212 &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
);
1213 install_element(VIEW_NODE
,
1214 &show_ipv6_ospf6_database_self_originated_cmd
);
1215 install_element(VIEW_NODE
,
1216 &show_ipv6_ospf6_database_type_self_originated_cmd
);
1217 install_element(VIEW_NODE
,
1218 &show_ipv6_ospf6_database_type_id_self_originated_cmd
);
1221 &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
);
1223 /* Make ospf protocol socket. */
1225 thread_add_read(master
, ospf6_receive
, NULL
, ospf6_sock
, NULL
);
1228 void ospf6_clean(void)
1232 if (ospf6
->route_table
)
1233 ospf6_route_remove_all(ospf6
->route_table
);
1234 if (ospf6
->brouter_table
)
1235 ospf6_route_remove_all(ospf6
->brouter_table
);