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
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, 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"
49 #include "ospf6_snmp.h"
52 char ospf6_daemon_version
[] = OSPF6_DAEMON_VERSION
;
55 route_prev (struct route_node
*node
)
57 struct route_node
*end
;
58 struct route_node
*prev
= NULL
;
63 route_lock_node (node
);
67 node
= route_next (node
);
70 route_unlock_node (node
);
74 route_unlock_node (end
);
76 route_lock_node (prev
);
82 /* show database functions */
83 DEFUN (show_version_ospf6
,
84 show_version_ospf6_cmd
,
87 "Displays ospf6d version\n"
90 vty_out (vty
, "Zebra OSPF6d Version: %s%s",
91 ospf6_daemon_version
, VNL
);
96 static struct cmd_node debug_node
=
104 config_write_ospf6_debug (struct vty
*vty
)
106 config_write_ospf6_debug_message (vty
);
107 config_write_ospf6_debug_lsa (vty
);
108 config_write_ospf6_debug_zebra (vty
);
109 config_write_ospf6_debug_interface (vty
);
110 config_write_ospf6_debug_neighbor (vty
);
111 config_write_ospf6_debug_spf (vty
);
112 config_write_ospf6_debug_route (vty
);
113 config_write_ospf6_debug_brouter (vty
);
114 config_write_ospf6_debug_asbr (vty
);
115 config_write_ospf6_debug_abr (vty
);
116 config_write_ospf6_debug_flood (vty
);
117 vty_out (vty
, "!%s", VNL
);
121 #define AREA_LSDB_TITLE_FORMAT \
122 "%s Area Scoped Link State Database (Area %s)%s%s"
123 #define IF_LSDB_TITLE_FORMAT \
124 "%s I/F Scoped Link State Database (I/F %s in Area %s)%s%s"
125 #define AS_LSDB_TITLE_FORMAT \
126 "%s AS Scoped Link State Database%s%s"
129 parse_show_level (int idx_level
, int argc
, struct cmd_token
**argv
)
131 int level
= OSPF6_LSDB_SHOW_LEVEL_NORMAL
;
133 if (argc
> idx_level
)
135 if (strmatch (argv
[idx_level
]->text
, "detail"))
136 level
= OSPF6_LSDB_SHOW_LEVEL_DETAIL
;
137 else if (strmatch (argv
[idx_level
]->text
, "dump"))
138 level
= OSPF6_LSDB_SHOW_LEVEL_DUMP
;
139 else if (strmatch (argv
[idx_level
]->text
, "internal"))
140 level
= OSPF6_LSDB_SHOW_LEVEL_INTERNAL
;
147 parse_type_spec (int idx_lsa
, int argc
, struct cmd_token
**argv
)
153 if (strmatch (argv
[0]->text
, "router"))
154 type
= htons (OSPF6_LSTYPE_ROUTER
);
155 else if (strmatch (argv
[0]->text
, "network"))
156 type
= htons (OSPF6_LSTYPE_NETWORK
);
157 else if (strmatch (argv
[0]->text
, "as-external"))
158 type
= htons (OSPF6_LSTYPE_AS_EXTERNAL
);
159 else if (strmatch (argv
[0]->text
, "intra-prefix"))
160 type
= htons (OSPF6_LSTYPE_INTRA_PREFIX
);
161 else if (strmatch (argv
[0]->text
, "inter-router"))
162 type
= htons (OSPF6_LSTYPE_INTER_ROUTER
);
163 else if (strmatch (argv
[0]->text
, "inter-prefix"))
164 type
= htons (OSPF6_LSTYPE_INTER_PREFIX
);
165 else if (strmatch (argv
[0]->text
, "link"))
166 type
= htons (OSPF6_LSTYPE_LINK
);
172 DEFUN (show_ipv6_ospf6_database
,
173 show_ipv6_ospf6_database_cmd
,
174 "show ipv6 ospf6 database [<detail|dump|internal>]",
178 "Display Link state database\n"
179 "Display details of LSAs\n"
181 "Display LSA's internal information\n")
185 struct listnode
*i
, *j
;
186 struct ospf6
*o
= ospf6
;
187 struct ospf6_area
*oa
;
188 struct ospf6_interface
*oi
;
190 OSPF6_CMD_CHECK_RUNNING ();
192 level
= parse_show_level (idx_level
, argc
, argv
);
194 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
196 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
197 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, NULL
, oa
->lsdb
);
200 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
202 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
204 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
205 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
206 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, NULL
, oi
->lsdb
);
210 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
211 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, NULL
, o
->lsdb
);
213 vty_out (vty
, "%s", VNL
);
217 DEFUN (show_ipv6_ospf6_database_type
,
218 show_ipv6_ospf6_database_type_cmd
,
219 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>]",
223 "Display Link state database\n"
224 "Display Router LSAs\n"
225 "Display Network LSAs\n"
226 "Display Inter-Area-Prefix LSAs\n"
227 "Display Inter-Area-Router LSAs\n"
228 "Display As-External LSAs\n"
229 "Display Group-Membership LSAs\n"
230 "Display Type-7 LSAs\n"
231 "Display Link LSAs\n"
232 "Display Intra-Area-Prefix LSAs\n"
233 "Display details of LSAs\n"
235 "Display LSA's internal information\n"
241 struct listnode
*i
, *j
;
242 struct ospf6
*o
= ospf6
;
243 struct ospf6_area
*oa
;
244 struct ospf6_interface
*oi
;
247 OSPF6_CMD_CHECK_RUNNING ();
249 type
= parse_type_spec (idx_lsa
, argc
, argv
);
250 level
= parse_show_level (idx_level
, argc
, argv
);
252 switch (OSPF6_LSA_SCOPE (type
))
254 case OSPF6_SCOPE_AREA
:
255 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
257 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
258 ospf6_lsdb_show (vty
, level
, &type
, NULL
, NULL
, oa
->lsdb
);
262 case OSPF6_SCOPE_LINKLOCAL
:
263 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
265 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
267 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
268 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
269 ospf6_lsdb_show (vty
, level
, &type
, NULL
, NULL
, oi
->lsdb
);
275 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
276 ospf6_lsdb_show (vty
, level
, &type
, NULL
, NULL
, o
->lsdb
);
284 vty_out (vty
, "%s", VNL
);
288 DEFUN (show_ipv6_ospf6_database_id
,
289 show_ipv6_ospf6_database_id_cmd
,
290 "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D [<detail|dump|internal>]",
294 "Display Link state database\n"
295 "Any Link state Type\n"
296 "Search by Link state ID\n"
297 "Specify Link state ID as IPv4 address notation\n"
298 "Display details of LSAs\n"
300 "Display LSA's internal information\n")
305 struct listnode
*i
, *j
;
306 struct ospf6
*o
= ospf6
;
307 struct ospf6_area
*oa
;
308 struct ospf6_interface
*oi
;
311 OSPF6_CMD_CHECK_RUNNING ();
313 if (argv
[idx_ipv4
]->type
== IPV4_TKN
)
314 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
316 level
= parse_show_level (idx_level
, argc
, argv
);
318 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
320 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
321 ospf6_lsdb_show (vty
, level
, NULL
, &id
, NULL
, oa
->lsdb
);
324 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
326 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
328 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
329 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
330 ospf6_lsdb_show (vty
, level
, NULL
, &id
, NULL
, oi
->lsdb
);
334 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
335 ospf6_lsdb_show (vty
, level
, NULL
, &id
, NULL
, o
->lsdb
);
337 vty_out (vty
, "%s", VNL
);
341 DEFUN (show_ipv6_ospf6_database_router
,
342 show_ipv6_ospf6_database_router_cmd
,
343 "show ipv6 ospf6 database <*|adv-router> * A.B.C.D <detail|dump|internal>",
347 "Display Link state database\n"
348 "Any Link state Type\n"
349 "Search by Advertising Router\n"
350 "Any Link state ID\n"
351 "Specify Advertising Router as IPv4 address notation\n"
352 "Display details of LSAs\n"
354 "Display LSA's internal information\n")
359 struct listnode
*i
, *j
;
360 struct ospf6
*o
= ospf6
;
361 struct ospf6_area
*oa
;
362 struct ospf6_interface
*oi
;
363 u_int32_t adv_router
= 0;
365 OSPF6_CMD_CHECK_RUNNING ();
366 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
367 level
= parse_show_level (idx_level
, argc
, argv
);
369 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
371 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
372 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, oa
->lsdb
);
375 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
377 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
379 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
380 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
381 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, oi
->lsdb
);
385 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
386 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, o
->lsdb
);
388 vty_out (vty
, "%s", VNL
);
392 DEFUN (show_ipv6_ospf6_database_type_id
,
393 show_ipv6_ospf6_database_type_id_cmd
,
394 "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>]",
398 "Display Link state database\n"
399 "Display Router LSAs\n"
400 "Display Network LSAs\n"
401 "Display Inter-Area-Prefix LSAs\n"
402 "Display Inter-Area-Router LSAs\n"
403 "Display As-External LSAs\n"
404 "Display Group-Membership LSAs\n"
405 "Display Type-7 LSAs\n"
406 "Display Link LSAs\n"
407 "Display Intra-Area-Prefix LSAs\n"
408 "Search by Link state ID\n"
409 "Specify Link state ID as IPv4 address notation\n"
410 "Display details of LSAs\n"
412 "Display LSA's internal information\n"
419 struct listnode
*i
, *j
;
420 struct ospf6
*o
= ospf6
;
421 struct ospf6_area
*oa
;
422 struct ospf6_interface
*oi
;
426 OSPF6_CMD_CHECK_RUNNING ();
428 type
= parse_type_spec (idx_lsa
, argc
, argv
);
429 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &id
);
430 level
= parse_show_level (idx_level
, argc
, argv
);
432 switch (OSPF6_LSA_SCOPE (type
))
434 case OSPF6_SCOPE_AREA
:
435 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
437 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
438 ospf6_lsdb_show (vty
, level
, &type
, &id
, NULL
, oa
->lsdb
);
442 case OSPF6_SCOPE_LINKLOCAL
:
443 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
445 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
447 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
448 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
449 ospf6_lsdb_show (vty
, level
, &type
, &id
, NULL
, oi
->lsdb
);
455 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
456 ospf6_lsdb_show (vty
, level
, &type
, &id
, NULL
, o
->lsdb
);
464 vty_out (vty
, "%s", VNL
);
468 DEFUN (show_ipv6_ospf6_database_type_router
,
469 show_ipv6_ospf6_database_type_router_cmd
,
470 "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>]",
474 "Display Link state database\n"
475 "Display Router LSAs\n"
476 "Display Network LSAs\n"
477 "Display Inter-Area-Prefix LSAs\n"
478 "Display Inter-Area-Router LSAs\n"
479 "Display As-External LSAs\n"
480 "Display Group-Membership LSAs\n"
481 "Display Type-7 LSAs\n"
482 "Display Link LSAs\n"
483 "Display Intra-Area-Prefix LSAs\n"
484 "Any Link state ID\n"
485 "Search by Advertising Router\n"
486 "Specify Advertising Router as IPv4 address notation\n"
487 "Display details of LSAs\n"
489 "Display LSA's internal information\n"
496 struct listnode
*i
, *j
;
497 struct ospf6
*o
= ospf6
;
498 struct ospf6_area
*oa
;
499 struct ospf6_interface
*oi
;
501 u_int32_t adv_router
= 0;
503 OSPF6_CMD_CHECK_RUNNING ();
505 type
= parse_type_spec (idx_lsa
, argc
, argv
);
506 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
507 level
= parse_show_level (idx_level
, argc
, argv
);
509 switch (OSPF6_LSA_SCOPE (type
))
511 case OSPF6_SCOPE_AREA
:
512 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
514 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
515 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, oa
->lsdb
);
519 case OSPF6_SCOPE_LINKLOCAL
:
520 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
522 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
524 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
525 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
526 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, oi
->lsdb
);
532 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
533 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
541 vty_out (vty
, "%s", VNL
);
546 DEFUN (show_ipv6_ospf6_database_id_router
,
547 show_ipv6_ospf6_database_id_router_cmd
,
548 "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>]",
552 "Display Link state database\n"
553 "Any Link state Type\n"
554 "Specify Link state ID as IPv4 address notation\n"
555 "Specify Advertising Router as IPv4 address notation\n"
556 "Display details of LSAs\n"
558 "Display LSA's internal information\n"
565 struct listnode
*i
, *j
;
566 struct ospf6
*o
= ospf6
;
567 struct ospf6_area
*oa
;
568 struct ospf6_interface
*oi
;
570 u_int32_t adv_router
= 0;
572 OSPF6_CMD_CHECK_RUNNING ();
573 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
574 inet_pton (AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
575 level
= parse_show_level (idx_level
, argc
, argv
);
577 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
579 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
580 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, oa
->lsdb
);
583 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
585 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
587 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
588 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
589 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, oi
->lsdb
);
593 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
594 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, o
->lsdb
);
596 vty_out (vty
, "%s", VNL
);
601 DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id
,
602 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
,
603 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>]",
607 "Display Link state database\n"
608 "Search by Advertising Router\n"
609 "Specify Advertising Router as IPv4 address notation\n"
610 "Search by Link state ID\n"
611 "Specify Link state ID as IPv4 address notation\n"
612 "Display details of LSAs\n"
614 "Display LSA's internal information\n")
620 struct listnode
*i
, *j
;
621 struct ospf6
*o
= ospf6
;
622 struct ospf6_area
*oa
;
623 struct ospf6_interface
*oi
;
625 u_int32_t adv_router
= 0;
627 OSPF6_CMD_CHECK_RUNNING ();
628 inet_pton (AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
629 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
630 level
= parse_show_level (idx_level
, argc
, argv
);
632 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
634 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
635 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, oa
->lsdb
);
638 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
640 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
642 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
643 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
644 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, oi
->lsdb
);
648 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
649 ospf6_lsdb_show (vty
, level
, NULL
, &id
, &adv_router
, o
->lsdb
);
651 vty_out (vty
, "%s", VNL
);
655 DEFUN (show_ipv6_ospf6_database_type_id_router
,
656 show_ipv6_ospf6_database_type_id_router_cmd
,
657 "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>]",
661 "Display Link state database\n"
662 "Display Router LSAs\n"
663 "Display Network LSAs\n"
664 "Display Inter-Area-Prefix LSAs\n"
665 "Display Inter-Area-Router LSAs\n"
666 "Display As-External LSAs\n"
667 "Display Group-Membership LSAs\n"
668 "Display Type-7 LSAs\n"
669 "Display Link LSAs\n"
670 "Display Intra-Area-Prefix LSAs\n"
671 "Specify Link state ID as IPv4 address notation\n"
672 "Specify Advertising Router as IPv4 address notation\n"
674 "Display LSA's internal information\n")
681 struct listnode
*i
, *j
;
682 struct ospf6
*o
= ospf6
;
683 struct ospf6_area
*oa
;
684 struct ospf6_interface
*oi
;
687 u_int32_t adv_router
= 0;
689 OSPF6_CMD_CHECK_RUNNING ();
691 type
= parse_type_spec (idx_lsa
, argc
, argv
);
692 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
693 inet_pton (AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
694 level
= parse_show_level (idx_level
, argc
, argv
);
696 switch (OSPF6_LSA_SCOPE (type
))
698 case OSPF6_SCOPE_AREA
:
699 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
701 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
702 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oa
->lsdb
);
706 case OSPF6_SCOPE_LINKLOCAL
:
707 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
709 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
711 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
712 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
713 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oi
->lsdb
);
719 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
720 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
728 vty_out (vty
, "%s", VNL
);
733 DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id
,
734 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
,
735 "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>]",
739 "Display Link state database\n"
740 "Display Router LSAs\n"
741 "Display Network LSAs\n"
742 "Display Inter-Area-Prefix LSAs\n"
743 "Display Inter-Area-Router LSAs\n"
744 "Display As-External LSAs\n"
745 "Display Group-Membership LSAs\n"
746 "Display Type-7 LSAs\n"
747 "Display Link LSAs\n"
748 "Display Intra-Area-Prefix LSAs\n"
749 "Search by Advertising Router\n"
750 "Specify Advertising Router as IPv4 address notation\n"
751 "Search by Link state ID\n"
752 "Specify Link state ID as IPv4 address notation\n"
754 "Display LSA's internal information\n")
761 struct listnode
*i
, *j
;
762 struct ospf6
*o
= ospf6
;
763 struct ospf6_area
*oa
;
764 struct ospf6_interface
*oi
;
767 u_int32_t adv_router
= 0;
769 OSPF6_CMD_CHECK_RUNNING ();
771 type
= parse_type_spec (idx_lsa
, argc
, argv
);
772 inet_pton (AF_INET
, argv
[idx_adv_rtr
]->arg
, &adv_router
);
773 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
774 level
= parse_show_level (idx_level
, argc
, argv
);
776 switch (OSPF6_LSA_SCOPE (type
))
778 case OSPF6_SCOPE_AREA
:
779 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
781 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
782 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oa
->lsdb
);
786 case OSPF6_SCOPE_LINKLOCAL
:
787 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
789 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
791 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
792 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
793 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oi
->lsdb
);
799 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
800 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
808 vty_out (vty
, "%s", VNL
);
812 DEFUN (show_ipv6_ospf6_database_self_originated
,
813 show_ipv6_ospf6_database_self_originated_cmd
,
814 "show ipv6 ospf6 database self-originated [<detail|dump|internal>]",
818 "Display Link state database\n"
819 "Display Self-originated LSAs\n"
820 "Display details of LSAs\n"
822 "Display LSA's internal information\n")
826 struct listnode
*i
, *j
;
827 struct ospf6
*o
= ospf6
;
828 struct ospf6_area
*oa
;
829 struct ospf6_interface
*oi
;
830 u_int32_t adv_router
= 0;
832 OSPF6_CMD_CHECK_RUNNING ();
833 level
= parse_show_level (idx_level
, argc
, argv
);
834 adv_router
= o
->router_id
;
836 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
838 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
839 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, oa
->lsdb
);
842 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
844 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
846 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
847 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
848 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, oi
->lsdb
);
852 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
853 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, o
->lsdb
);
855 vty_out (vty
, "%s", VNL
);
860 DEFUN (show_ipv6_ospf6_database_type_self_originated
,
861 show_ipv6_ospf6_database_type_self_originated_cmd
,
862 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]",
866 "Display Link state database\n"
867 "Display Router LSAs\n"
868 "Display Network LSAs\n"
869 "Display Inter-Area-Prefix LSAs\n"
870 "Display Inter-Area-Router LSAs\n"
871 "Display As-External LSAs\n"
872 "Display Group-Membership LSAs\n"
873 "Display Type-7 LSAs\n"
874 "Display Link LSAs\n"
875 "Display Intra-Area-Prefix LSAs\n"
876 "Display Self-originated LSAs\n"
877 "Display details of LSAs\n"
879 "Display LSA's internal information\n")
884 struct listnode
*i
, *j
;
885 struct ospf6
*o
= ospf6
;
886 struct ospf6_area
*oa
;
887 struct ospf6_interface
*oi
;
889 u_int32_t adv_router
= 0;
891 OSPF6_CMD_CHECK_RUNNING ();
893 type
= parse_type_spec (idx_lsa
, argc
, argv
);
894 level
= parse_show_level (idx_level
, argc
, argv
);
896 adv_router
= o
->router_id
;
898 switch (OSPF6_LSA_SCOPE (type
))
900 case OSPF6_SCOPE_AREA
:
901 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
903 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
904 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, oa
->lsdb
);
908 case OSPF6_SCOPE_LINKLOCAL
:
909 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
911 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
913 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
914 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
915 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, oi
->lsdb
);
921 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
922 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
930 vty_out (vty
, "%s", VNL
);
934 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id
,
935 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
,
936 "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>]",
940 "Display Link state database\n"
941 "Display Router LSAs\n"
942 "Display Network LSAs\n"
943 "Display Inter-Area-Prefix LSAs\n"
944 "Display Inter-Area-Router LSAs\n"
945 "Display As-External LSAs\n"
946 "Display Group-Membership LSAs\n"
947 "Display Type-7 LSAs\n"
948 "Display Link LSAs\n"
949 "Display Intra-Area-Prefix LSAs\n"
950 "Display Self-originated LSAs\n"
951 "Search by Link state ID\n"
952 "Specify Link state ID as IPv4 address notation\n"
953 "Display details of LSAs\n"
955 "Display LSA's internal information\n")
961 struct listnode
*i
, *j
;
962 struct ospf6
*o
= ospf6
;
963 struct ospf6_area
*oa
;
964 struct ospf6_interface
*oi
;
966 u_int32_t adv_router
= 0;
969 OSPF6_CMD_CHECK_RUNNING ();
971 type
= parse_type_spec (idx_lsa
, argc
, argv
);
972 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
973 level
= parse_show_level (idx_level
, argc
, argv
);
974 adv_router
= o
->router_id
;
976 switch (OSPF6_LSA_SCOPE (type
))
978 case OSPF6_SCOPE_AREA
:
979 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
981 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
982 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oa
->lsdb
);
986 case OSPF6_SCOPE_LINKLOCAL
:
987 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
989 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
991 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
992 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
993 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oi
->lsdb
);
999 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
1000 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1008 vty_out (vty
, "%s", VNL
);
1012 DEFUN (show_ipv6_ospf6_database_type_id_self_originated
,
1013 show_ipv6_ospf6_database_type_id_self_originated_cmd
,
1014 "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>]",
1018 "Display Link state database\n"
1019 "Display Router LSAs\n"
1020 "Display Network LSAs\n"
1021 "Display Inter-Area-Prefix LSAs\n"
1022 "Display Inter-Area-Router LSAs\n"
1023 "Display As-External LSAs\n"
1024 "Display Group-Membership LSAs\n"
1025 "Display Type-7 LSAs\n"
1026 "Display Link LSAs\n"
1027 "Display Intra-Area-Prefix LSAs\n"
1028 "Specify Link state ID as IPv4 address notation\n"
1029 "Display Self-originated LSAs\n"
1030 "Display details of LSAs\n"
1032 "Display LSA's internal information\n")
1038 struct listnode
*i
, *j
;
1039 struct ospf6
*o
= ospf6
;
1040 struct ospf6_area
*oa
;
1041 struct ospf6_interface
*oi
;
1043 u_int32_t adv_router
= 0;
1046 OSPF6_CMD_CHECK_RUNNING ();
1048 type
= parse_type_spec (idx_lsa
, argc
, argv
);
1049 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
1050 level
= parse_show_level (idx_level
, argc
, argv
);
1051 adv_router
= o
->router_id
;
1053 switch (OSPF6_LSA_SCOPE (type
))
1055 case OSPF6_SCOPE_AREA
:
1056 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
1058 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
1059 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oa
->lsdb
);
1063 case OSPF6_SCOPE_LINKLOCAL
:
1064 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
1066 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
1068 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
1069 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
1070 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oi
->lsdb
);
1075 case OSPF6_SCOPE_AS
:
1076 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
1077 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1085 vty_out (vty
, "%s", VNL
);
1089 DEFUN (show_ipv6_ospf6_border_routers
,
1090 show_ipv6_ospf6_border_routers_cmd
,
1091 "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
1095 "Display routing table for ABR and ASBR\n"
1097 "Show detailed output\n")
1100 u_int32_t adv_router
;
1101 struct ospf6_route
*ro
;
1102 struct prefix prefix
;
1104 OSPF6_CMD_CHECK_RUNNING ();
1108 if (strmatch (argv
[idx_ipv4
]->text
, "detail"))
1110 for (ro
= ospf6_route_head (ospf6
->brouter_table
); ro
;
1111 ro
= ospf6_route_next (ro
))
1112 ospf6_route_show_detail (vty
, ro
);
1116 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
1118 ospf6_linkstate_prefix (adv_router
, 0, &prefix
);
1119 ro
= ospf6_route_lookup (&prefix
, ospf6
->brouter_table
);
1122 vty_out (vty
, "No Route found for Router ID: %s%s", argv
[4]->arg
, VNL
);
1126 ospf6_route_show_detail (vty
, ro
);
1132 ospf6_brouter_show_header (vty
);
1134 for (ro
= ospf6_route_head (ospf6
->brouter_table
); ro
;
1135 ro
= ospf6_route_next (ro
))
1136 ospf6_brouter_show (vty
, ro
);
1143 DEFUN (show_ipv6_ospf6_linkstate
,
1144 show_ipv6_ospf6_linkstate_cmd
,
1145 "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>",
1149 "Display linkstate routing table\n"
1150 "Display Router Entry\n"
1151 "Specify Router ID as IPv4 address notation\n"
1152 "Display Network Entry\n"
1153 "Specify Router ID as IPv4 address notation\n"
1154 "Specify Link state ID as IPv4 address notation\n"
1158 struct listnode
*node
;
1159 struct ospf6_area
*oa
;
1161 OSPF6_CMD_CHECK_RUNNING ();
1163 for (ALL_LIST_ELEMENTS_RO (ospf6
->area_list
, node
, oa
))
1165 vty_out (vty
, "%s SPF Result in Area %s%s%s",
1166 VNL
, oa
->name
, VNL
, VNL
);
1167 ospf6_linkstate_table_show (vty
, idx_ipv4
, argc
, argv
, oa
->spf_table
);
1170 vty_out (vty
, "%s", VNL
);
1176 DEFUN (show_ipv6_ospf6_linkstate_detail
,
1177 show_ipv6_ospf6_linkstate_detail_cmd
,
1178 "show ipv6 ospf6 linkstate detail",
1182 "Display linkstate routing table\n"
1186 struct listnode
*node
;
1187 struct ospf6_area
*oa
;
1189 OSPF6_CMD_CHECK_RUNNING ();
1191 for (ALL_LIST_ELEMENTS_RO (ospf6
->area_list
, node
, oa
))
1193 vty_out (vty
, "%s SPF Result in Area %s%s%s",
1194 VNL
, oa
->name
, VNL
, VNL
);
1195 ospf6_linkstate_table_show (vty
, idx_detail
, argc
, argv
, oa
->spf_table
);
1198 vty_out (vty
, "%s", VNL
);
1202 /* Install ospf related commands. */
1208 ospf6_interface_init ();
1209 ospf6_neighbor_init ();
1210 ospf6_zebra_init(master
);
1214 ospf6_intra_init ();
1219 ospf6_snmp_init (master
);
1220 #endif /*HAVE_SNMP*/
1223 install_node (&debug_node
, config_write_ospf6_debug
);
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_version_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
, &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd
);
1253 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_id_router_cmd
);
1254 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_id_router_cmd
);
1255 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd
);
1256 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_self_originated_cmd
);
1257 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_self_originated_cmd
);
1258 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_id_self_originated_cmd
);
1259 install_element (VIEW_NODE
, &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
);
1261 /* Make ospf protocol socket. */
1263 thread_add_read (master
, ospf6_receive
, NULL
, ospf6_sock
);
1271 if (ospf6
->route_table
)
1272 ospf6_route_remove_all (ospf6
->route_table
);
1273 if (ospf6
->brouter_table
)
1274 ospf6_route_remove_all (ospf6
->brouter_table
);