2 * Copyright (C) 2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 #include "ospf6_proto.h"
30 #include "ospf6_top.h"
31 #include "ospf6_network.h"
32 #include "ospf6_lsa.h"
33 #include "ospf6_lsdb.h"
34 #include "ospf6_message.h"
35 #include "ospf6_route.h"
36 #include "ospf6_zebra.h"
37 #include "ospf6_spf.h"
38 #include "ospf6_area.h"
39 #include "ospf6_interface.h"
40 #include "ospf6_neighbor.h"
41 #include "ospf6_intra.h"
42 #include "ospf6_asbr.h"
43 #include "ospf6_abr.h"
44 #include "ospf6_flood.h"
46 #include "ospf6_bfd.h"
49 DEFINE_MGROUP(OSPF6D
, "ospf6d");
51 struct route_node
*route_prev(struct route_node
*node
)
53 struct route_node
*end
;
54 struct route_node
*prev
= NULL
;
59 route_lock_node(node
);
62 node
= route_next(node
);
64 route_unlock_node(node
);
68 route_unlock_node(end
);
70 route_lock_node(prev
);
75 static int config_write_ospf6_debug(struct vty
*vty
);
76 static struct cmd_node debug_node
= {
80 .config_write
= config_write_ospf6_debug
,
83 static int config_write_ospf6_debug(struct vty
*vty
)
85 config_write_ospf6_debug_message(vty
);
86 config_write_ospf6_debug_lsa(vty
);
87 config_write_ospf6_debug_zebra(vty
);
88 config_write_ospf6_debug_interface(vty
);
89 config_write_ospf6_debug_neighbor(vty
);
90 config_write_ospf6_debug_spf(vty
);
91 config_write_ospf6_debug_route(vty
);
92 config_write_ospf6_debug_brouter(vty
);
93 config_write_ospf6_debug_asbr(vty
);
94 config_write_ospf6_debug_abr(vty
);
95 config_write_ospf6_debug_flood(vty
);
100 DEFUN_NOSH (show_debugging_ospf6
,
101 show_debugging_ospf6_cmd
,
102 "show debugging [ospf6]",
107 vty_out(vty
, "OSPF6 debugging status:\n");
109 config_write_ospf6_debug(vty
);
114 #define AREA_LSDB_TITLE_FORMAT \
115 "\n Area Scoped Link State Database (Area %s)\n\n"
116 #define IF_LSDB_TITLE_FORMAT \
117 "\n I/F Scoped Link State Database (I/F %s in Area %s)\n\n"
118 #define AS_LSDB_TITLE_FORMAT "\n AS Scoped Link State Database\n\n"
120 static int parse_show_level(int idx_level
, int argc
, struct cmd_token
**argv
)
122 int level
= OSPF6_LSDB_SHOW_LEVEL_NORMAL
;
124 if (argc
> idx_level
) {
125 if (strmatch(argv
[idx_level
]->text
, "detail"))
126 level
= OSPF6_LSDB_SHOW_LEVEL_DETAIL
;
127 else if (strmatch(argv
[idx_level
]->text
, "dump"))
128 level
= OSPF6_LSDB_SHOW_LEVEL_DUMP
;
129 else if (strmatch(argv
[idx_level
]->text
, "internal"))
130 level
= OSPF6_LSDB_SHOW_LEVEL_INTERNAL
;
136 static uint16_t parse_type_spec(int idx_lsa
, int argc
, struct cmd_token
**argv
)
140 if (argc
> idx_lsa
) {
141 if (strmatch(argv
[idx_lsa
]->text
, "router"))
142 type
= htons(OSPF6_LSTYPE_ROUTER
);
143 else if (strmatch(argv
[idx_lsa
]->text
, "network"))
144 type
= htons(OSPF6_LSTYPE_NETWORK
);
145 else if (strmatch(argv
[idx_lsa
]->text
, "as-external"))
146 type
= htons(OSPF6_LSTYPE_AS_EXTERNAL
);
147 else if (strmatch(argv
[idx_lsa
]->text
, "intra-prefix"))
148 type
= htons(OSPF6_LSTYPE_INTRA_PREFIX
);
149 else if (strmatch(argv
[idx_lsa
]->text
, "inter-router"))
150 type
= htons(OSPF6_LSTYPE_INTER_ROUTER
);
151 else if (strmatch(argv
[idx_lsa
]->text
, "inter-prefix"))
152 type
= htons(OSPF6_LSTYPE_INTER_PREFIX
);
153 else if (strmatch(argv
[idx_lsa
]->text
, "link"))
154 type
= htons(OSPF6_LSTYPE_LINK
);
160 void ospf6_lsdb_show(struct vty
*vty
, enum ospf_lsdb_show_level level
,
161 uint16_t *type
, uint32_t *id
, uint32_t *adv_router
,
162 struct ospf6_lsdb
*lsdb
, json_object
*json_obj
,
165 struct ospf6_lsa
*lsa
;
166 const struct route_node
*end
= NULL
;
167 void (*showfunc
)(struct vty
*, struct ospf6_lsa
*, json_object
*,
169 json_object
*json_array
= NULL
;
172 case OSPF6_LSDB_SHOW_LEVEL_DETAIL
:
173 showfunc
= ospf6_lsa_show
;
175 case OSPF6_LSDB_SHOW_LEVEL_INTERNAL
:
176 showfunc
= ospf6_lsa_show_internal
;
178 case OSPF6_LSDB_SHOW_LEVEL_DUMP
:
179 showfunc
= ospf6_lsa_show_dump
;
181 case OSPF6_LSDB_SHOW_LEVEL_NORMAL
:
183 showfunc
= ospf6_lsa_show_summary
;
187 json_array
= json_object_new_array();
189 if (type
&& id
&& adv_router
) {
190 lsa
= ospf6_lsdb_lookup(*type
, *id
, *adv_router
, lsdb
);
192 if (level
== OSPF6_LSDB_SHOW_LEVEL_NORMAL
)
193 ospf6_lsa_show(vty
, lsa
, json_array
, use_json
);
195 (*showfunc
)(vty
, lsa
, json_array
, use_json
);
199 json_object_object_add(json_obj
, "lsa", json_array
);
203 if ((level
== OSPF6_LSDB_SHOW_LEVEL_NORMAL
) && !use_json
)
204 ospf6_lsa_show_summary_header(vty
);
206 end
= ospf6_lsdb_head(lsdb
, !!type
+ !!(type
&& adv_router
),
207 type
? *type
: 0, adv_router
? *adv_router
: 0,
210 if ((!adv_router
|| lsa
->header
->adv_router
== *adv_router
)
211 && (!id
|| lsa
->header
->id
== *id
))
212 (*showfunc
)(vty
, lsa
, json_array
, use_json
);
213 lsa
= ospf6_lsdb_next(end
, lsa
);
217 json_object_object_add(json_obj
, "lsa", json_array
);
220 static void ospf6_lsdb_show_wrapper(struct vty
*vty
,
221 enum ospf_lsdb_show_level level
,
222 uint16_t *type
, uint32_t *id
,
223 uint32_t *adv_router
, bool uj
,
226 struct listnode
*i
, *j
;
227 struct ospf6
*o
= ospf6
;
228 struct ospf6_area
*oa
;
229 struct ospf6_interface
*oi
;
230 json_object
*json
= NULL
;
231 json_object
*json_array
= NULL
;
232 json_object
*json_obj
= NULL
;
235 json
= json_object_new_object();
236 json_array
= json_object_new_array();
238 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
240 json_obj
= json_object_new_object();
241 json_object_string_add(json_obj
, "areaId", oa
->name
);
243 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
244 ospf6_lsdb_show(vty
, level
, type
, id
, adv_router
, oa
->lsdb
,
247 json_object_array_add(json_array
, json_obj
);
250 json_object_object_add(json
, "areaScopedLinkStateDb",
254 json_array
= json_object_new_array();
255 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
256 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
258 json_obj
= json_object_new_object();
259 json_object_string_add(json_obj
, "areaId",
261 json_object_string_add(json_obj
, "interface",
262 oi
->interface
->name
);
264 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
265 oi
->interface
->name
, oa
->name
);
266 ospf6_lsdb_show(vty
, level
, type
, id
, adv_router
,
267 oi
->lsdb
, json_obj
, uj
);
269 json_object_array_add(json_array
, json_obj
);
273 json_object_object_add(json
, "interfaceScopedLinkStateDb",
276 json_array
= json_object_new_array();
277 json_obj
= json_object_new_object();
279 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
281 ospf6_lsdb_show(vty
, level
, type
, id
, adv_router
, o
->lsdb
, json_obj
,
285 json_object_array_add(json_array
, json_obj
);
286 json_object_object_add(json
, "asScopedLinkStateDb", json_array
);
289 json_object_to_json_string_ext(
290 json
, JSON_C_TO_STRING_PRETTY
));
291 json_object_free(json
);
296 static void ospf6_lsdb_type_show_wrapper(struct vty
*vty
,
297 enum ospf_lsdb_show_level level
,
298 uint16_t *type
, uint32_t *id
,
299 uint32_t *adv_router
, bool uj
,
302 struct listnode
*i
, *j
;
303 struct ospf6
*o
= ospf6
;
304 struct ospf6_area
*oa
;
305 struct ospf6_interface
*oi
;
306 json_object
*json
= NULL
;
307 json_object
*json_array
= NULL
;
308 json_object
*json_obj
= NULL
;
311 json
= json_object_new_object();
312 json_array
= json_object_new_array();
315 switch (OSPF6_LSA_SCOPE(*type
)) {
316 case OSPF6_SCOPE_AREA
:
317 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
319 json_obj
= json_object_new_object();
320 json_object_string_add(json_obj
, "areaId",
323 vty_out(vty
, AREA_LSDB_TITLE_FORMAT
, oa
->name
);
325 ospf6_lsdb_show(vty
, level
, type
, id
, adv_router
,
326 oa
->lsdb
, json_obj
, uj
);
328 json_object_array_add(json_array
, json_obj
);
331 json_object_object_add(json
, "areaScopedLinkStateDb",
335 case OSPF6_SCOPE_LINKLOCAL
:
336 for (ALL_LIST_ELEMENTS_RO(o
->area_list
, i
, oa
)) {
337 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
)) {
339 json_obj
= json_object_new_object();
340 json_object_string_add(
341 json_obj
, "areaId", oa
->name
);
342 json_object_string_add(
343 json_obj
, "interface",
344 oi
->interface
->name
);
346 vty_out(vty
, IF_LSDB_TITLE_FORMAT
,
347 oi
->interface
->name
, oa
->name
);
349 ospf6_lsdb_show(vty
, level
, type
, id
,
350 adv_router
, oi
->lsdb
, json_obj
,
354 json_object_array_add(json_array
,
359 json_object_object_add(
360 json
, "interfaceScopedLinkStateDb", json_array
);
365 json_obj
= json_object_new_object();
367 vty_out(vty
, AS_LSDB_TITLE_FORMAT
);
369 ospf6_lsdb_show(vty
, level
, type
, id
, adv_router
, o
->lsdb
,
372 json_object_array_add(json_array
, json_obj
);
373 json_object_object_add(json
, "asScopedLinkStateDb",
384 json_object_to_json_string_ext(
385 json
, JSON_C_TO_STRING_PRETTY
));
386 json_object_free(json
);
391 DEFUN (show_ipv6_ospf6_database
,
392 show_ipv6_ospf6_database_cmd
,
393 "show ipv6 ospf6 database [<detail|dump|internal>] [json]",
397 "Display Link state database\n"
398 "Display details of LSAs\n"
400 "Display LSA's internal information\n"
405 bool uj
= use_json(argc
, argv
);
408 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
409 OSPF6_CMD_CHECK_RUNNING(ospf6
);
411 level
= parse_show_level(idx_level
, argc
, argv
);
412 ospf6_lsdb_show_wrapper(vty
, level
, NULL
, NULL
, NULL
, uj
, ospf6
);
416 DEFUN (show_ipv6_ospf6_database_type
, show_ipv6_ospf6_database_type_cmd
,
417 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>] [json]",
421 "Display Link state database\n"
422 "Display Router LSAs\n"
423 "Display Network LSAs\n"
424 "Display Inter-Area-Prefix LSAs\n"
425 "Display Inter-Area-Router LSAs\n"
426 "Display As-External LSAs\n"
427 "Display Group-Membership LSAs\n"
428 "Display Type-7 LSAs\n"
429 "Display Link LSAs\n"
430 "Display Intra-Area-Prefix LSAs\n"
431 "Display details of LSAs\n"
433 "Display LSA's internal information\n"
440 bool uj
= use_json(argc
, argv
);
444 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
445 OSPF6_CMD_CHECK_RUNNING(ospf6
);
447 type
= parse_type_spec(idx_lsa
, argc
, argv
);
448 level
= parse_show_level(idx_level
, argc
, argv
);
450 ospf6_lsdb_type_show_wrapper(vty
, level
, &type
, NULL
, NULL
, uj
, ospf6
);
454 DEFUN (show_ipv6_ospf6_database_id
,
455 show_ipv6_ospf6_database_id_cmd
,
456 "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D [<detail|dump|internal>] [json]",
460 "Display Link state database\n"
461 "Any Link state Type\n"
462 "Search by Link state ID\n"
463 "Specify Link state ID as IPv4 address notation\n"
464 "Display details of LSAs\n"
466 "Display LSA's internal information\n"
473 bool uj
= use_json(argc
, argv
);
477 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
478 OSPF6_CMD_CHECK_RUNNING(ospf6
);
480 if (argv
[idx_ipv4
]->type
== IPV4_TKN
)
481 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
483 level
= parse_show_level(idx_level
, argc
, argv
);
484 ospf6_lsdb_show_wrapper(vty
, level
, NULL
, &id
, NULL
, uj
, ospf6
);
489 DEFUN (show_ipv6_ospf6_database_router
,
490 show_ipv6_ospf6_database_router_cmd
,
491 "show ipv6 ospf6 database <*|adv-router> * A.B.C.D <detail|dump|internal> [json]",
495 "Display Link state database\n"
496 "Any Link state Type\n"
497 "Search by Advertising Router\n"
498 "Any Link state ID\n"
499 "Specify Advertising Router as IPv4 address notation\n"
500 "Display details of LSAs\n"
502 "Display LSA's internal information\n"
508 uint32_t adv_router
= 0;
509 bool uj
= use_json(argc
, argv
);
513 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
514 OSPF6_CMD_CHECK_RUNNING(ospf6
);
515 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
516 level
= parse_show_level(idx_level
, argc
, argv
);
518 ospf6_lsdb_show_wrapper(vty
, level
, NULL
, NULL
, &adv_router
, uj
, ospf6
);
522 DEFUN_HIDDEN (show_ipv6_ospf6_database_aggr_router
,
523 show_ipv6_ospf6_database_aggr_router_cmd
,
524 "show ipv6 ospf6 database aggr adv-router A.B.C.D",
528 "Display Link state database\n"
529 "Aggregated Router LSA\n"
530 "Search by Advertising Router\n"
531 "Specify Advertising Router as IPv4 address notation\n")
533 int level
= OSPF6_LSDB_SHOW_LEVEL_DETAIL
;
534 uint16_t type
= htons(OSPF6_LSTYPE_ROUTER
);
538 struct ospf6_area
*oa
;
539 struct ospf6_lsdb
*lsdb
;
540 uint32_t adv_router
= 0;
542 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
543 OSPF6_CMD_CHECK_RUNNING(ospf6
);
545 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
547 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, i
, oa
)) {
548 if (adv_router
== ospf6
->router_id
)
549 lsdb
= oa
->lsdb_self
;
552 if (ospf6_create_single_router_lsa(oa
, lsdb
, adv_router
)
554 vty_out(vty
, "Adv router is not found in LSDB.");
557 ospf6_lsdb_show(vty
, level
, &type
, NULL
, NULL
,
558 oa
->temp_router_lsa_lsdb
, NULL
, false);
559 /* Remove the temp cache */
560 ospf6_remove_temp_router_lsa(oa
);
568 DEFUN (show_ipv6_ospf6_database_type_id
,
569 show_ipv6_ospf6_database_type_id_cmd
,
570 "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>] [json]",
574 "Display Link state database\n"
575 "Display Router LSAs\n"
576 "Display Network LSAs\n"
577 "Display Inter-Area-Prefix LSAs\n"
578 "Display Inter-Area-Router LSAs\n"
579 "Display As-External LSAs\n"
580 "Display Group-Membership LSAs\n"
581 "Display Type-7 LSAs\n"
582 "Display Link LSAs\n"
583 "Display Intra-Area-Prefix LSAs\n"
584 "Search by Link state ID\n"
585 "Specify Link state ID as IPv4 address notation\n"
586 "Display details of LSAs\n"
588 "Display LSA's internal information\n"
597 bool uj
= use_json(argc
, argv
);
601 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
602 OSPF6_CMD_CHECK_RUNNING(ospf6
);
604 type
= parse_type_spec(idx_lsa
, argc
, argv
);
605 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
606 level
= parse_show_level(idx_level
, argc
, argv
);
608 ospf6_lsdb_type_show_wrapper(vty
, level
, &type
, &id
, NULL
, uj
, ospf6
);
612 DEFUN (show_ipv6_ospf6_database_type_router
,
613 show_ipv6_ospf6_database_type_router_cmd
,
614 "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>] [json]",
618 "Display Link state database\n"
619 "Display Router LSAs\n"
620 "Display Network LSAs\n"
621 "Display Inter-Area-Prefix LSAs\n"
622 "Display Inter-Area-Router LSAs\n"
623 "Display As-External LSAs\n"
624 "Display Group-Membership LSAs\n"
625 "Display Type-7 LSAs\n"
626 "Display Link LSAs\n"
627 "Display Intra-Area-Prefix LSAs\n"
628 "Any Link state ID\n"
629 "Search by Advertising Router\n"
630 "Specify Advertising Router as IPv4 address notation\n"
631 "Display details of LSAs\n"
633 "Display LSA's internal information\n"
641 uint32_t adv_router
= 0;
642 bool uj
= use_json(argc
, argv
);
646 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
647 OSPF6_CMD_CHECK_RUNNING(ospf6
);
648 type
= parse_type_spec(idx_lsa
, argc
, argv
);
649 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
650 level
= parse_show_level(idx_level
, argc
, argv
);
652 ospf6_lsdb_type_show_wrapper(vty
, level
, &type
, NULL
, &adv_router
, uj
,
658 DEFUN (show_ipv6_ospf6_database_id_router
,
659 show_ipv6_ospf6_database_id_router_cmd
,
660 "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>] [json]",
664 "Display Link state database\n"
665 "Any Link state Type\n"
666 "Specify Link state ID as IPv4 address notation\n"
667 "Specify Advertising Router as IPv4 address notation\n"
668 "Display details of LSAs\n"
670 "Display LSA's internal information\n"
678 uint32_t adv_router
= 0;
679 bool uj
= use_json(argc
, argv
);
682 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
683 OSPF6_CMD_CHECK_RUNNING(ospf6
);
684 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
685 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
686 level
= parse_show_level(idx_level
, argc
, argv
);
688 ospf6_lsdb_show_wrapper(vty
, level
, NULL
, &id
, &adv_router
, uj
, ospf6
);
693 DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id
,
694 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
,
695 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>] [json]",
699 "Display Link state database\n"
700 "Search by Advertising Router\n"
701 "Specify Advertising Router as IPv4 address notation\n"
702 "Search by Link state ID\n"
703 "Specify Link state ID as IPv4 address notation\n"
704 "Display details of LSAs\n"
706 "Display LSA's internal information\n"
714 uint32_t adv_router
= 0;
715 bool uj
= use_json(argc
, argv
);
719 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
720 OSPF6_CMD_CHECK_RUNNING(ospf6
);
721 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
722 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
723 level
= parse_show_level(idx_level
, argc
, argv
);
725 ospf6_lsdb_show_wrapper(vty
, level
, NULL
, &id
, &adv_router
, uj
, ospf6
);
729 DEFUN (show_ipv6_ospf6_database_type_id_router
,
730 show_ipv6_ospf6_database_type_id_router_cmd
,
731 "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>] [json]",
735 "Display Link state database\n"
736 "Display Router LSAs\n"
737 "Display Network LSAs\n"
738 "Display Inter-Area-Prefix LSAs\n"
739 "Display Inter-Area-Router LSAs\n"
740 "Display As-External LSAs\n"
741 "Display Group-Membership LSAs\n"
742 "Display Type-7 LSAs\n"
743 "Display Link LSAs\n"
744 "Display Intra-Area-Prefix LSAs\n"
745 "Specify Link state ID as IPv4 address notation\n"
746 "Specify Advertising Router as IPv4 address notation\n"
748 "Display LSA's internal information\n"
758 uint32_t adv_router
= 0;
759 bool uj
= use_json(argc
, argv
);
763 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
764 OSPF6_CMD_CHECK_RUNNING(ospf6
);
766 type
= parse_type_spec(idx_lsa
, argc
, argv
);
767 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
768 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
769 level
= parse_show_level(idx_level
, argc
, argv
);
771 ospf6_lsdb_type_show_wrapper(vty
, level
, &type
, &id
, &adv_router
, uj
,
777 DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id
,
778 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
,
779 "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>] [json]",
783 "Display Link state database\n"
784 "Display Router LSAs\n"
785 "Display Network LSAs\n"
786 "Display Inter-Area-Prefix LSAs\n"
787 "Display Inter-Area-Router LSAs\n"
788 "Display As-External LSAs\n"
789 "Display Group-Membership LSAs\n"
790 "Display Type-7 LSAs\n"
791 "Display Link LSAs\n"
792 "Display Intra-Area-Prefix LSAs\n"
793 "Search by Advertising Router\n"
794 "Specify Advertising Router as IPv4 address notation\n"
795 "Search by Link state ID\n"
796 "Specify Link state ID as IPv4 address notation\n"
798 "Display LSA's internal information\n"
808 uint32_t adv_router
= 0;
809 bool uj
= use_json(argc
, argv
);
813 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
814 OSPF6_CMD_CHECK_RUNNING(ospf6
);
816 type
= parse_type_spec(idx_lsa
, argc
, argv
);
817 inet_pton(AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
818 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
819 level
= parse_show_level(idx_level
, argc
, argv
);
821 ospf6_lsdb_type_show_wrapper(vty
, level
, &type
, &id
, &adv_router
, uj
,
826 DEFUN (show_ipv6_ospf6_database_self_originated
,
827 show_ipv6_ospf6_database_self_originated_cmd
,
828 "show ipv6 ospf6 database self-originated [<detail|dump|internal>] [json]",
832 "Display Link state database\n"
833 "Display Self-originated LSAs\n"
834 "Display details of LSAs\n"
836 "Display LSA's internal information\n"
841 uint32_t adv_router
= 0;
842 bool uj
= use_json(argc
, argv
);
845 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
846 OSPF6_CMD_CHECK_RUNNING(ospf6
);
847 level
= parse_show_level(idx_level
, argc
, argv
);
848 adv_router
= ospf6
->router_id
;
850 ospf6_lsdb_show_wrapper(vty
, level
, NULL
, NULL
, &adv_router
, uj
, ospf6
);
855 DEFUN (show_ipv6_ospf6_database_type_self_originated
,
856 show_ipv6_ospf6_database_type_self_originated_cmd
,
857 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>] [json]",
861 "Display Link state database\n"
862 "Display Router LSAs\n"
863 "Display Network LSAs\n"
864 "Display Inter-Area-Prefix LSAs\n"
865 "Display Inter-Area-Router LSAs\n"
866 "Display As-External LSAs\n"
867 "Display Group-Membership LSAs\n"
868 "Display Type-7 LSAs\n"
869 "Display Link LSAs\n"
870 "Display Intra-Area-Prefix LSAs\n"
871 "Display Self-originated LSAs\n"
872 "Display details of LSAs\n"
874 "Display LSA's internal information\n"
881 uint32_t adv_router
= 0;
882 bool uj
= use_json(argc
, argv
);
885 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
886 OSPF6_CMD_CHECK_RUNNING(ospf6
);
887 type
= parse_type_spec(idx_lsa
, argc
, argv
);
888 level
= parse_show_level(idx_level
, argc
, argv
);
890 adv_router
= ospf6
->router_id
;
892 ospf6_lsdb_type_show_wrapper(vty
, level
, &type
, NULL
, &adv_router
, uj
,
897 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id
,
898 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
,
899 "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>] [json]",
903 "Display Link state database\n"
904 "Display Router LSAs\n"
905 "Display Network LSAs\n"
906 "Display Inter-Area-Prefix LSAs\n"
907 "Display Inter-Area-Router LSAs\n"
908 "Display As-External LSAs\n"
909 "Display Group-Membership LSAs\n"
910 "Display Type-7 LSAs\n"
911 "Display Link LSAs\n"
912 "Display Intra-Area-Prefix LSAs\n"
913 "Display Self-originated LSAs\n"
914 "Search by Link state ID\n"
915 "Specify Link state ID as IPv4 address notation\n"
916 "Display details of LSAs\n"
918 "Display LSA's internal information\n"
926 uint32_t adv_router
= 0;
928 bool uj
= use_json(argc
, argv
);
931 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
932 OSPF6_CMD_CHECK_RUNNING(ospf6
);
933 type
= parse_type_spec(idx_lsa
, argc
, argv
);
934 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
935 level
= parse_show_level(idx_level
, argc
, argv
);
936 adv_router
= ospf6
->router_id
;
938 ospf6_lsdb_type_show_wrapper(vty
, level
, &type
, &id
, &adv_router
, uj
,
943 DEFUN (show_ipv6_ospf6_database_type_id_self_originated
,
944 show_ipv6_ospf6_database_type_id_self_originated_cmd
,
945 "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>] [json]",
949 "Display Link state database\n"
950 "Display Router LSAs\n"
951 "Display Network LSAs\n"
952 "Display Inter-Area-Prefix LSAs\n"
953 "Display Inter-Area-Router LSAs\n"
954 "Display As-External LSAs\n"
955 "Display Group-Membership LSAs\n"
956 "Display Type-7 LSAs\n"
957 "Display Link LSAs\n"
958 "Display Intra-Area-Prefix LSAs\n"
959 "Specify Link state ID as IPv4 address notation\n"
960 "Display Self-originated LSAs\n"
961 "Display details of LSAs\n"
963 "Display LSA's internal information\n"
971 uint32_t adv_router
= 0;
973 bool uj
= use_json(argc
, argv
);
976 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
977 OSPF6_CMD_CHECK_RUNNING(ospf6
);
978 type
= parse_type_spec(idx_lsa
, argc
, argv
);
979 inet_pton(AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
980 level
= parse_show_level(idx_level
, argc
, argv
);
981 adv_router
= ospf6
->router_id
;
983 ospf6_lsdb_type_show_wrapper(vty
, level
, &type
, &id
, &adv_router
, uj
,
988 DEFUN (show_ipv6_ospf6_border_routers
,
989 show_ipv6_ospf6_border_routers_cmd
,
990 "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
994 "Display routing table for ABR and ASBR\n"
996 "Show detailed output\n")
1000 struct ospf6_route
*ro
;
1001 struct prefix prefix
;
1002 struct ospf6
*ospf6
= NULL
;
1005 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
1006 OSPF6_CMD_CHECK_RUNNING(ospf6
);
1008 if (strmatch(argv
[idx_ipv4
]->text
, "detail")) {
1009 for (ro
= ospf6_route_head(ospf6
->brouter_table
); ro
;
1010 ro
= ospf6_route_next(ro
))
1011 ospf6_route_show_detail(vty
, ro
, NULL
, false);
1013 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
1015 ospf6_linkstate_prefix(adv_router
, 0, &prefix
);
1016 ro
= ospf6_route_lookup(&prefix
, ospf6
->brouter_table
);
1019 "No Route found for Router ID: %s\n",
1024 ospf6_route_show_detail(vty
, ro
, NULL
, false);
1028 ospf6_brouter_show_header(vty
);
1030 for (ro
= ospf6_route_head(ospf6
->brouter_table
); ro
;
1031 ro
= ospf6_route_next(ro
))
1032 ospf6_brouter_show(vty
, ro
);
1039 DEFUN (show_ipv6_ospf6_linkstate
,
1040 show_ipv6_ospf6_linkstate_cmd
,
1041 "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>",
1045 "Display linkstate routing table\n"
1046 "Display Router Entry\n"
1047 "Specify Router ID as IPv4 address notation\n"
1048 "Display Network Entry\n"
1049 "Specify Router ID as IPv4 address notation\n"
1050 "Specify Link state ID as IPv4 address notation\n")
1053 struct listnode
*node
;
1054 struct ospf6_area
*oa
;
1055 struct ospf6
*ospf6
= NULL
;
1057 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
1058 OSPF6_CMD_CHECK_RUNNING(ospf6
);
1059 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, node
, oa
)) {
1060 vty_out(vty
, "\n SPF Result in Area %s\n\n", oa
->name
);
1061 ospf6_linkstate_table_show(vty
, idx_ipv4
, argc
, argv
,
1070 DEFUN (show_ipv6_ospf6_linkstate_detail
,
1071 show_ipv6_ospf6_linkstate_detail_cmd
,
1072 "show ipv6 ospf6 linkstate detail",
1076 "Display linkstate routing table\n"
1077 "Display detailed information\n")
1080 struct listnode
*node
;
1081 struct ospf6_area
*oa
;
1082 struct ospf6
*ospf6
= NULL
;
1084 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
1085 OSPF6_CMD_CHECK_RUNNING(ospf6
);
1087 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, node
, oa
)) {
1088 vty_out(vty
, "\n SPF Result in Area %s\n\n", oa
->name
);
1089 ospf6_linkstate_table_show(vty
, idx_detail
, argc
, argv
,
1097 static void ospf6_plist_add(struct prefix_list
*plist
)
1099 if (prefix_list_afi(plist
) != AFI_IP6
)
1101 ospf6_area_plist_update(plist
, 1);
1104 static void ospf6_plist_del(struct prefix_list
*plist
)
1106 if (prefix_list_afi(plist
) != AFI_IP6
)
1108 ospf6_area_plist_update(plist
, 0);
1111 /* Install ospf related commands. */
1112 void ospf6_init(struct thread_master
*master
)
1116 ospf6_interface_init();
1117 ospf6_neighbor_init();
1118 ospf6_zebra_init(master
);
1126 prefix_list_add_hook(ospf6_plist_add
);
1127 prefix_list_delete_hook(ospf6_plist_del
);
1130 install_node(&debug_node
);
1132 install_element_ospf6_debug_message();
1133 install_element_ospf6_debug_lsa();
1134 install_element_ospf6_debug_interface();
1135 install_element_ospf6_debug_neighbor();
1136 install_element_ospf6_debug_zebra();
1137 install_element_ospf6_debug_spf();
1138 install_element_ospf6_debug_route();
1139 install_element_ospf6_debug_brouter();
1140 install_element_ospf6_debug_asbr();
1141 install_element_ospf6_debug_abr();
1142 install_element_ospf6_debug_flood();
1144 install_element_ospf6_clear_interface();
1146 install_element(ENABLE_NODE
, &show_debugging_ospf6_cmd
);
1148 install_element(VIEW_NODE
, &show_ipv6_ospf6_border_routers_cmd
);
1150 install_element(VIEW_NODE
, &show_ipv6_ospf6_linkstate_cmd
);
1151 install_element(VIEW_NODE
, &show_ipv6_ospf6_linkstate_detail_cmd
);
1153 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_cmd
);
1154 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_cmd
);
1155 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_id_cmd
);
1156 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_router_cmd
);
1157 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_id_cmd
);
1158 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_type_router_cmd
);
1159 install_element(VIEW_NODE
,
1160 &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
);
1161 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_id_router_cmd
);
1162 install_element(VIEW_NODE
,
1163 &show_ipv6_ospf6_database_type_id_router_cmd
);
1166 &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
);
1167 install_element(VIEW_NODE
,
1168 &show_ipv6_ospf6_database_self_originated_cmd
);
1169 install_element(VIEW_NODE
,
1170 &show_ipv6_ospf6_database_type_self_originated_cmd
);
1171 install_element(VIEW_NODE
,
1172 &show_ipv6_ospf6_database_type_id_self_originated_cmd
);
1175 &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
);
1176 install_element(VIEW_NODE
, &show_ipv6_ospf6_database_aggr_router_cmd
);