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
28 #include "ospf6_proto.h"
29 #include "ospf6_network.h"
30 #include "ospf6_lsa.h"
31 #include "ospf6_lsdb.h"
32 #include "ospf6_message.h"
33 #include "ospf6_route.h"
34 #include "ospf6_zebra.h"
35 #include "ospf6_spf.h"
36 #include "ospf6_top.h"
37 #include "ospf6_area.h"
38 #include "ospf6_interface.h"
39 #include "ospf6_neighbor.h"
40 #include "ospf6_intra.h"
41 #include "ospf6_asbr.h"
42 #include "ospf6_abr.h"
43 #include "ospf6_flood.h"
45 #include "ospf6_bfd.h"
47 char ospf6_daemon_version
[] = OSPF6_DAEMON_VERSION
;
50 route_prev (struct route_node
*node
)
52 struct route_node
*end
;
53 struct route_node
*prev
= NULL
;
58 route_lock_node (node
);
62 node
= route_next (node
);
65 route_unlock_node (node
);
69 route_unlock_node (end
);
71 route_lock_node (prev
);
77 /* show database functions */
78 DEFUN (show_version_ospf6
,
79 show_version_ospf6_cmd
,
83 "Display ospf6d version\n"
86 vty_out (vty
, "Zebra OSPF6d Version: %s%s",
87 ospf6_daemon_version
, VTYNL
);
92 static struct cmd_node debug_node
=
100 config_write_ospf6_debug (struct vty
*vty
)
102 config_write_ospf6_debug_message (vty
);
103 config_write_ospf6_debug_lsa (vty
);
104 config_write_ospf6_debug_zebra (vty
);
105 config_write_ospf6_debug_interface (vty
);
106 config_write_ospf6_debug_neighbor (vty
);
107 config_write_ospf6_debug_spf (vty
);
108 config_write_ospf6_debug_route (vty
);
109 config_write_ospf6_debug_brouter (vty
);
110 config_write_ospf6_debug_asbr (vty
);
111 config_write_ospf6_debug_abr (vty
);
112 config_write_ospf6_debug_flood (vty
);
113 vty_out (vty
, "!\n");
117 #define AREA_LSDB_TITLE_FORMAT \
118 "%s Area Scoped Link State Database (Area %s)%s%s"
119 #define IF_LSDB_TITLE_FORMAT \
120 "%s I/F Scoped Link State Database (I/F %s in Area %s)%s%s"
121 #define AS_LSDB_TITLE_FORMAT \
122 "%s AS Scoped Link State Database%s%s"
125 parse_show_level (int idx_level
, int argc
, struct cmd_token
**argv
)
127 int level
= OSPF6_LSDB_SHOW_LEVEL_NORMAL
;
129 if (argc
> idx_level
)
131 if (strmatch (argv
[idx_level
]->text
, "detail"))
132 level
= OSPF6_LSDB_SHOW_LEVEL_DETAIL
;
133 else if (strmatch (argv
[idx_level
]->text
, "dump"))
134 level
= OSPF6_LSDB_SHOW_LEVEL_DUMP
;
135 else if (strmatch (argv
[idx_level
]->text
, "internal"))
136 level
= OSPF6_LSDB_SHOW_LEVEL_INTERNAL
;
143 parse_type_spec (int idx_lsa
, int argc
, struct cmd_token
**argv
)
149 if (strmatch (argv
[idx_lsa
]->text
, "router"))
150 type
= htons (OSPF6_LSTYPE_ROUTER
);
151 else if (strmatch (argv
[idx_lsa
]->text
, "network"))
152 type
= htons (OSPF6_LSTYPE_NETWORK
);
153 else if (strmatch (argv
[idx_lsa
]->text
, "as-external"))
154 type
= htons (OSPF6_LSTYPE_AS_EXTERNAL
);
155 else if (strmatch (argv
[idx_lsa
]->text
, "intra-prefix"))
156 type
= htons (OSPF6_LSTYPE_INTRA_PREFIX
);
157 else if (strmatch (argv
[idx_lsa
]->text
, "inter-router"))
158 type
= htons (OSPF6_LSTYPE_INTER_ROUTER
);
159 else if (strmatch (argv
[idx_lsa
]->text
, "inter-prefix"))
160 type
= htons (OSPF6_LSTYPE_INTER_PREFIX
);
161 else if (strmatch (argv
[idx_lsa
]->text
, "link"))
162 type
= htons (OSPF6_LSTYPE_LINK
);
168 DEFUN (show_ipv6_ospf6_database
,
169 show_ipv6_ospf6_database_cmd
,
170 "show ipv6 ospf6 database [<detail|dump|internal>]",
174 "Display Link state database\n"
175 "Display details of LSAs\n"
177 "Display LSA's internal information\n")
181 struct listnode
*i
, *j
;
182 struct ospf6
*o
= ospf6
;
183 struct ospf6_area
*oa
;
184 struct ospf6_interface
*oi
;
186 OSPF6_CMD_CHECK_RUNNING ();
188 level
= parse_show_level (idx_level
, argc
, argv
);
190 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
192 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
193 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, NULL
, oa
->lsdb
);
196 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
198 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
200 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
201 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
202 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, NULL
, oi
->lsdb
);
206 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
207 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, NULL
, o
->lsdb
);
213 DEFUN (show_ipv6_ospf6_database_type
,
214 show_ipv6_ospf6_database_type_cmd
,
215 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>]",
219 "Display Link state database\n"
220 "Display Router LSAs\n"
221 "Display Network LSAs\n"
222 "Display Inter-Area-Prefix LSAs\n"
223 "Display Inter-Area-Router LSAs\n"
224 "Display As-External LSAs\n"
225 "Display Group-Membership LSAs\n"
226 "Display Type-7 LSAs\n"
227 "Display Link LSAs\n"
228 "Display Intra-Area-Prefix LSAs\n"
229 "Display details of LSAs\n"
231 "Display LSA's internal information\n"
237 struct listnode
*i
, *j
;
238 struct ospf6
*o
= ospf6
;
239 struct ospf6_area
*oa
;
240 struct ospf6_interface
*oi
;
243 OSPF6_CMD_CHECK_RUNNING ();
245 type
= parse_type_spec (idx_lsa
, argc
, argv
);
246 level
= parse_show_level (idx_level
, argc
, argv
);
248 switch (OSPF6_LSA_SCOPE (type
))
250 case OSPF6_SCOPE_AREA
:
251 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
253 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
254 ospf6_lsdb_show (vty
, level
, &type
, NULL
, NULL
, oa
->lsdb
);
258 case OSPF6_SCOPE_LINKLOCAL
:
259 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
261 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
263 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
264 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
265 ospf6_lsdb_show (vty
, level
, &type
, NULL
, NULL
, oi
->lsdb
);
271 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
272 ospf6_lsdb_show (vty
, level
, &type
, NULL
, NULL
, o
->lsdb
);
284 DEFUN (show_ipv6_ospf6_database_id
,
285 show_ipv6_ospf6_database_id_cmd
,
286 "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D [<detail|dump|internal>]",
290 "Display Link state database\n"
291 "Any Link state Type\n"
292 "Search by Link state ID\n"
293 "Specify Link state ID as IPv4 address notation\n"
294 "Display details of LSAs\n"
296 "Display LSA's internal information\n")
301 struct listnode
*i
, *j
;
302 struct ospf6
*o
= ospf6
;
303 struct ospf6_area
*oa
;
304 struct ospf6_interface
*oi
;
307 OSPF6_CMD_CHECK_RUNNING ();
309 if (argv
[idx_ipv4
]->type
== IPV4_TKN
)
310 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
312 level
= parse_show_level (idx_level
, argc
, argv
);
314 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
316 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
317 ospf6_lsdb_show (vty
, level
, NULL
, &id
, NULL
, oa
->lsdb
);
320 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
322 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
324 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
325 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
326 ospf6_lsdb_show (vty
, level
, NULL
, &id
, NULL
, oi
->lsdb
);
330 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
331 ospf6_lsdb_show (vty
, level
, NULL
, &id
, NULL
, o
->lsdb
);
337 DEFUN (show_ipv6_ospf6_database_router
,
338 show_ipv6_ospf6_database_router_cmd
,
339 "show ipv6 ospf6 database <*|adv-router> * A.B.C.D <detail|dump|internal>",
343 "Display Link state database\n"
344 "Any Link state Type\n"
345 "Search by Advertising Router\n"
346 "Any Link state ID\n"
347 "Specify Advertising Router as IPv4 address notation\n"
348 "Display details of LSAs\n"
350 "Display LSA's internal information\n")
355 struct listnode
*i
, *j
;
356 struct ospf6
*o
= ospf6
;
357 struct ospf6_area
*oa
;
358 struct ospf6_interface
*oi
;
359 u_int32_t adv_router
= 0;
361 OSPF6_CMD_CHECK_RUNNING ();
362 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
363 level
= parse_show_level (idx_level
, argc
, argv
);
365 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
367 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
368 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, oa
->lsdb
);
371 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
373 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
375 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
376 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
377 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, oi
->lsdb
);
381 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
382 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, o
->lsdb
);
388 DEFUN (show_ipv6_ospf6_database_type_id
,
389 show_ipv6_ospf6_database_type_id_cmd
,
390 "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>]",
394 "Display Link state database\n"
395 "Display Router LSAs\n"
396 "Display Network LSAs\n"
397 "Display Inter-Area-Prefix LSAs\n"
398 "Display Inter-Area-Router LSAs\n"
399 "Display As-External LSAs\n"
400 "Display Group-Membership LSAs\n"
401 "Display Type-7 LSAs\n"
402 "Display Link LSAs\n"
403 "Display Intra-Area-Prefix LSAs\n"
404 "Search by Link state ID\n"
405 "Specify Link state ID as IPv4 address notation\n"
406 "Display details of LSAs\n"
408 "Display LSA's internal information\n"
415 struct listnode
*i
, *j
;
416 struct ospf6
*o
= ospf6
;
417 struct ospf6_area
*oa
;
418 struct ospf6_interface
*oi
;
422 OSPF6_CMD_CHECK_RUNNING ();
424 type
= parse_type_spec (idx_lsa
, argc
, argv
);
425 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
426 level
= parse_show_level (idx_level
, argc
, argv
);
428 switch (OSPF6_LSA_SCOPE (type
))
430 case OSPF6_SCOPE_AREA
:
431 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
433 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
434 ospf6_lsdb_show (vty
, level
, &type
, &id
, NULL
, oa
->lsdb
);
438 case OSPF6_SCOPE_LINKLOCAL
:
439 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
441 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
443 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
444 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
445 ospf6_lsdb_show (vty
, level
, &type
, &id
, NULL
, oi
->lsdb
);
451 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
452 ospf6_lsdb_show (vty
, level
, &type
, &id
, NULL
, o
->lsdb
);
464 DEFUN (show_ipv6_ospf6_database_type_router
,
465 show_ipv6_ospf6_database_type_router_cmd
,
466 "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>]",
470 "Display Link state database\n"
471 "Display Router LSAs\n"
472 "Display Network LSAs\n"
473 "Display Inter-Area-Prefix LSAs\n"
474 "Display Inter-Area-Router LSAs\n"
475 "Display As-External LSAs\n"
476 "Display Group-Membership LSAs\n"
477 "Display Type-7 LSAs\n"
478 "Display Link LSAs\n"
479 "Display Intra-Area-Prefix LSAs\n"
480 "Any Link state ID\n"
481 "Search by Advertising Router\n"
482 "Specify Advertising Router as IPv4 address notation\n"
483 "Display details of LSAs\n"
485 "Display LSA's internal information\n"
492 struct listnode
*i
, *j
;
493 struct ospf6
*o
= ospf6
;
494 struct ospf6_area
*oa
;
495 struct ospf6_interface
*oi
;
497 u_int32_t adv_router
= 0;
499 OSPF6_CMD_CHECK_RUNNING ();
501 type
= parse_type_spec (idx_lsa
, argc
, argv
);
502 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
503 level
= parse_show_level (idx_level
, argc
, argv
);
505 switch (OSPF6_LSA_SCOPE (type
))
507 case OSPF6_SCOPE_AREA
:
508 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
510 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
511 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, oa
->lsdb
);
515 case OSPF6_SCOPE_LINKLOCAL
:
516 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
518 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
520 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
521 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
522 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, oi
->lsdb
);
528 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
529 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
542 DEFUN (show_ipv6_ospf6_database_id_router
,
543 show_ipv6_ospf6_database_id_router_cmd
,
544 "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>]",
548 "Display Link state database\n"
549 "Any Link state Type\n"
550 "Specify Link state ID as IPv4 address notation\n"
551 "Specify Advertising Router as IPv4 address notation\n"
552 "Display details of LSAs\n"
554 "Display LSA's internal information\n"
561 struct listnode
*i
, *j
;
562 struct ospf6
*o
= ospf6
;
563 struct ospf6_area
*oa
;
564 struct ospf6_interface
*oi
;
566 u_int32_t adv_router
= 0;
568 OSPF6_CMD_CHECK_RUNNING ();
569 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
570 inet_pton (AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
571 level
= parse_show_level (idx_level
, argc
, argv
);
573 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
575 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
576 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, oa
->lsdb
);
579 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
581 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
583 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
584 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
585 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, oi
->lsdb
);
589 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
590 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, o
->lsdb
);
597 DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id
,
598 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
,
599 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>]",
603 "Display Link state database\n"
604 "Search by Advertising Router\n"
605 "Specify Advertising Router as IPv4 address notation\n"
606 "Search by Link state ID\n"
607 "Specify Link state ID as IPv4 address notation\n"
608 "Display details of LSAs\n"
610 "Display LSA's internal information\n")
616 struct listnode
*i
, *j
;
617 struct ospf6
*o
= ospf6
;
618 struct ospf6_area
*oa
;
619 struct ospf6_interface
*oi
;
621 u_int32_t adv_router
= 0;
623 OSPF6_CMD_CHECK_RUNNING ();
624 inet_pton (AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
625 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
626 level
= parse_show_level (idx_level
, argc
, argv
);
628 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
630 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
631 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, oa
->lsdb
);
634 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
636 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
638 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
639 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
640 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, oi
->lsdb
);
644 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
645 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, o
->lsdb
);
651 DEFUN (show_ipv6_ospf6_database_type_id_router
,
652 show_ipv6_ospf6_database_type_id_router_cmd
,
653 "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>]",
657 "Display Link state database\n"
658 "Display Router LSAs\n"
659 "Display Network LSAs\n"
660 "Display Inter-Area-Prefix LSAs\n"
661 "Display Inter-Area-Router LSAs\n"
662 "Display As-External LSAs\n"
663 "Display Group-Membership LSAs\n"
664 "Display Type-7 LSAs\n"
665 "Display Link LSAs\n"
666 "Display Intra-Area-Prefix LSAs\n"
667 "Specify Link state ID as IPv4 address notation\n"
668 "Specify Advertising Router as IPv4 address notation\n"
670 "Display LSA's internal information\n")
677 struct listnode
*i
, *j
;
678 struct ospf6
*o
= ospf6
;
679 struct ospf6_area
*oa
;
680 struct ospf6_interface
*oi
;
683 u_int32_t adv_router
= 0;
685 OSPF6_CMD_CHECK_RUNNING ();
687 type
= parse_type_spec (idx_lsa
, argc
, argv
);
688 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
689 inet_pton (AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
690 level
= parse_show_level (idx_level
, argc
, argv
);
692 switch (OSPF6_LSA_SCOPE (type
))
694 case OSPF6_SCOPE_AREA
:
695 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
697 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
698 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oa
->lsdb
);
702 case OSPF6_SCOPE_LINKLOCAL
:
703 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
705 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
707 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
708 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
709 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oi
->lsdb
);
715 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
716 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
729 DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id
,
730 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
,
731 "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>]",
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 "Search by Advertising Router\n"
746 "Specify Advertising Router as IPv4 address notation\n"
747 "Search by Link state ID\n"
748 "Specify Link state ID as IPv4 address notation\n"
750 "Display LSA's internal information\n")
757 struct listnode
*i
, *j
;
758 struct ospf6
*o
= ospf6
;
759 struct ospf6_area
*oa
;
760 struct ospf6_interface
*oi
;
763 u_int32_t adv_router
= 0;
765 OSPF6_CMD_CHECK_RUNNING ();
767 type
= parse_type_spec (idx_lsa
, argc
, argv
);
768 inet_pton (AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
769 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
770 level
= parse_show_level (idx_level
, argc
, argv
);
772 switch (OSPF6_LSA_SCOPE (type
))
774 case OSPF6_SCOPE_AREA
:
775 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
777 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
778 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oa
->lsdb
);
782 case OSPF6_SCOPE_LINKLOCAL
:
783 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
785 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
787 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
788 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
789 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oi
->lsdb
);
795 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
796 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
808 DEFUN (show_ipv6_ospf6_database_self_originated
,
809 show_ipv6_ospf6_database_self_originated_cmd
,
810 "show ipv6 ospf6 database self-originated [<detail|dump|internal>]",
814 "Display Link state database\n"
815 "Display Self-originated LSAs\n"
816 "Display details of LSAs\n"
818 "Display LSA's internal information\n")
822 struct listnode
*i
, *j
;
823 struct ospf6
*o
= ospf6
;
824 struct ospf6_area
*oa
;
825 struct ospf6_interface
*oi
;
826 u_int32_t adv_router
= 0;
828 OSPF6_CMD_CHECK_RUNNING ();
829 level
= parse_show_level (idx_level
, argc
, argv
);
830 adv_router
= o
->router_id
;
832 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
834 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
835 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, oa
->lsdb
);
838 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
840 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
842 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
843 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
844 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, oi
->lsdb
);
848 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
849 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, o
->lsdb
);
856 DEFUN (show_ipv6_ospf6_database_type_self_originated
,
857 show_ipv6_ospf6_database_type_self_originated_cmd
,
858 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]",
862 "Display Link state database\n"
863 "Display Router LSAs\n"
864 "Display Network LSAs\n"
865 "Display Inter-Area-Prefix LSAs\n"
866 "Display Inter-Area-Router LSAs\n"
867 "Display As-External LSAs\n"
868 "Display Group-Membership LSAs\n"
869 "Display Type-7 LSAs\n"
870 "Display Link LSAs\n"
871 "Display Intra-Area-Prefix LSAs\n"
872 "Display Self-originated LSAs\n"
873 "Display details of LSAs\n"
875 "Display LSA's internal information\n")
880 struct listnode
*i
, *j
;
881 struct ospf6
*o
= ospf6
;
882 struct ospf6_area
*oa
;
883 struct ospf6_interface
*oi
;
885 u_int32_t adv_router
= 0;
887 OSPF6_CMD_CHECK_RUNNING ();
889 type
= parse_type_spec (idx_lsa
, argc
, argv
);
890 level
= parse_show_level (idx_level
, argc
, argv
);
892 adv_router
= o
->router_id
;
894 switch (OSPF6_LSA_SCOPE (type
))
896 case OSPF6_SCOPE_AREA
:
897 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
899 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
900 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, oa
->lsdb
);
904 case OSPF6_SCOPE_LINKLOCAL
:
905 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
907 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
909 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
910 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
911 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, oi
->lsdb
);
917 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
918 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
930 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id
,
931 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
,
932 "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>]",
936 "Display Link state database\n"
937 "Display Router LSAs\n"
938 "Display Network LSAs\n"
939 "Display Inter-Area-Prefix LSAs\n"
940 "Display Inter-Area-Router LSAs\n"
941 "Display As-External LSAs\n"
942 "Display Group-Membership LSAs\n"
943 "Display Type-7 LSAs\n"
944 "Display Link LSAs\n"
945 "Display Intra-Area-Prefix LSAs\n"
946 "Display Self-originated LSAs\n"
947 "Search by Link state ID\n"
948 "Specify Link state ID as IPv4 address notation\n"
949 "Display details of LSAs\n"
951 "Display LSA's internal information\n")
957 struct listnode
*i
, *j
;
958 struct ospf6
*o
= ospf6
;
959 struct ospf6_area
*oa
;
960 struct ospf6_interface
*oi
;
962 u_int32_t adv_router
= 0;
965 OSPF6_CMD_CHECK_RUNNING ();
967 type
= parse_type_spec (idx_lsa
, argc
, argv
);
968 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
969 level
= parse_show_level (idx_level
, argc
, argv
);
970 adv_router
= o
->router_id
;
972 switch (OSPF6_LSA_SCOPE (type
))
974 case OSPF6_SCOPE_AREA
:
975 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
977 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
978 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oa
->lsdb
);
982 case OSPF6_SCOPE_LINKLOCAL
:
983 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
985 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
987 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
988 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
989 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oi
->lsdb
);
995 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
996 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1004 vty_out (vty
, "\n");
1008 DEFUN (show_ipv6_ospf6_database_type_id_self_originated
,
1009 show_ipv6_ospf6_database_type_id_self_originated_cmd
,
1010 "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>]",
1014 "Display Link state database\n"
1015 "Display Router LSAs\n"
1016 "Display Network LSAs\n"
1017 "Display Inter-Area-Prefix LSAs\n"
1018 "Display Inter-Area-Router LSAs\n"
1019 "Display As-External LSAs\n"
1020 "Display Group-Membership LSAs\n"
1021 "Display Type-7 LSAs\n"
1022 "Display Link LSAs\n"
1023 "Display Intra-Area-Prefix LSAs\n"
1024 "Specify Link state ID as IPv4 address notation\n"
1025 "Display Self-originated LSAs\n"
1026 "Display details of LSAs\n"
1028 "Display LSA's internal information\n")
1034 struct listnode
*i
, *j
;
1035 struct ospf6
*o
= ospf6
;
1036 struct ospf6_area
*oa
;
1037 struct ospf6_interface
*oi
;
1039 u_int32_t adv_router
= 0;
1042 OSPF6_CMD_CHECK_RUNNING ();
1044 type
= parse_type_spec (idx_lsa
, argc
, argv
);
1045 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
1046 level
= parse_show_level (idx_level
, argc
, argv
);
1047 adv_router
= o
->router_id
;
1049 switch (OSPF6_LSA_SCOPE (type
))
1051 case OSPF6_SCOPE_AREA
:
1052 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
1054 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VTYNL
, oa
->name
, VTYNL
, VTYNL
);
1055 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oa
->lsdb
);
1059 case OSPF6_SCOPE_LINKLOCAL
:
1060 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
1062 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
1064 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VTYNL
,
1065 oi
->interface
->name
, oa
->name
, VTYNL
, VTYNL
);
1066 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oi
->lsdb
);
1071 case OSPF6_SCOPE_AS
:
1072 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VTYNL
, VTYNL
, VTYNL
);
1073 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1081 vty_out (vty
, "\n");
1085 DEFUN (show_ipv6_ospf6_border_routers
,
1086 show_ipv6_ospf6_border_routers_cmd
,
1087 "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
1091 "Display routing table for ABR and ASBR\n"
1093 "Show detailed output\n")
1096 u_int32_t adv_router
;
1097 struct ospf6_route
*ro
;
1098 struct prefix prefix
;
1100 OSPF6_CMD_CHECK_RUNNING ();
1104 if (strmatch (argv
[idx_ipv4
]->text
, "detail"))
1106 for (ro
= ospf6_route_head (ospf6
->brouter_table
); ro
;
1107 ro
= ospf6_route_next (ro
))
1108 ospf6_route_show_detail (vty
, ro
);
1112 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
1114 ospf6_linkstate_prefix (adv_router
, 0, &prefix
);
1115 ro
= ospf6_route_lookup (&prefix
, ospf6
->brouter_table
);
1118 vty_out (vty
, "No Route found for Router ID: %s%s", argv
[4]->arg
, VTYNL
);
1122 ospf6_route_show_detail (vty
, ro
);
1128 ospf6_brouter_show_header (vty
);
1130 for (ro
= ospf6_route_head (ospf6
->brouter_table
); ro
;
1131 ro
= ospf6_route_next (ro
))
1132 ospf6_brouter_show (vty
, ro
);
1139 DEFUN (show_ipv6_ospf6_linkstate
,
1140 show_ipv6_ospf6_linkstate_cmd
,
1141 "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>",
1145 "Display linkstate routing table\n"
1146 "Display Router Entry\n"
1147 "Specify Router ID as IPv4 address notation\n"
1148 "Display Network Entry\n"
1149 "Specify Router ID as IPv4 address notation\n"
1150 "Specify Link state ID as IPv4 address notation\n")
1153 struct listnode
*node
;
1154 struct ospf6_area
*oa
;
1156 OSPF6_CMD_CHECK_RUNNING ();
1158 for (ALL_LIST_ELEMENTS_RO (ospf6
->area_list
, node
, oa
))
1160 vty_out (vty
, "\n SPF Result in Area %s%s%s", oa
->name
, VTYNL
, VTYNL
);
1161 ospf6_linkstate_table_show (vty
, idx_ipv4
, argc
, argv
, oa
->spf_table
);
1164 vty_out (vty
, "\n");
1170 DEFUN (show_ipv6_ospf6_linkstate_detail
,
1171 show_ipv6_ospf6_linkstate_detail_cmd
,
1172 "show ipv6 ospf6 linkstate detail",
1176 "Display linkstate routing table\n"
1177 "Display detailed information\n")
1180 struct listnode
*node
;
1181 struct ospf6_area
*oa
;
1183 OSPF6_CMD_CHECK_RUNNING ();
1185 for (ALL_LIST_ELEMENTS_RO (ospf6
->area_list
, node
, oa
))
1187 vty_out (vty
, "\n SPF Result in Area %s%s%s", oa
->name
, VTYNL
, VTYNL
);
1188 ospf6_linkstate_table_show (vty
, idx_detail
, argc
, argv
, oa
->spf_table
);
1191 vty_out (vty
, "\n");
1195 /* Install ospf related commands. */
1201 ospf6_interface_init ();
1202 ospf6_neighbor_init ();
1203 ospf6_zebra_init(master
);
1207 ospf6_intra_init ();
1212 install_node (&debug_node
, config_write_ospf6_debug
);
1214 install_element_ospf6_debug_message ();
1215 install_element_ospf6_debug_lsa ();
1216 install_element_ospf6_debug_interface ();
1217 install_element_ospf6_debug_neighbor ();
1218 install_element_ospf6_debug_zebra ();
1219 install_element_ospf6_debug_spf ();
1220 install_element_ospf6_debug_route ();
1221 install_element_ospf6_debug_brouter ();
1222 install_element_ospf6_debug_asbr ();
1223 install_element_ospf6_debug_abr ();
1224 install_element_ospf6_debug_flood ();
1226 install_element_ospf6_clear_interface ();
1228 install_element (VIEW_NODE
, &show_version_ospf6_cmd
);
1230 install_element (VIEW_NODE
, &show_ipv6_ospf6_border_routers_cmd
);
1232 install_element (VIEW_NODE
, &show_ipv6_ospf6_linkstate_cmd
);
1233 install_element (VIEW_NODE
, &show_ipv6_ospf6_linkstate_detail_cmd
);
1235 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_cmd
);
1236 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_cmd
);
1237 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_id_cmd
);
1238 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_router_cmd
);
1239 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_id_cmd
);
1240 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_router_cmd
);
1241 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
);
1242 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_id_router_cmd
);
1243 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_id_router_cmd
);
1244 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
);
1245 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_self_originated_cmd
);
1246 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_self_originated_cmd
);
1247 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_id_self_originated_cmd
);
1248 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
);
1250 /* Make ospf protocol socket. */
1252 thread_add_read(master
, ospf6_receive
, NULL
, ospf6_sock
, NULL
);
1260 if (ospf6
->route_table
)
1261 ospf6_route_remove_all (ospf6
->route_table
);
1262 if (ospf6
->brouter_table
)
1263 ospf6_route_remove_all (ospf6
->brouter_table
);