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 Self-originated LSAs\n"
819 "Display details of LSAs\n"
821 "Display LSA's internal information\n")
825 struct listnode
*i
, *j
;
826 struct ospf6
*o
= ospf6
;
827 struct ospf6_area
*oa
;
828 struct ospf6_interface
*oi
;
829 u_int32_t adv_router
= 0;
831 OSPF6_CMD_CHECK_RUNNING ();
832 level
= parse_show_level (idx_level
, argc
, argv
);
833 adv_router
= o
->router_id
;
835 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
837 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
838 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, oa
->lsdb
);
841 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
843 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
845 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
846 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
847 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, oi
->lsdb
);
851 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
852 ospf6_lsdb_show (vty
, level
, NULL
, NULL
, &adv_router
, o
->lsdb
);
854 vty_out (vty
, "%s", VNL
);
859 DEFUN (show_ipv6_ospf6_database_type_self_originated
,
860 show_ipv6_ospf6_database_type_self_originated_cmd
,
861 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]",
865 "Display Link state database\n"
866 "Display Router LSAs\n"
867 "Display Network LSAs\n"
868 "Display Inter-Area-Prefix LSAs\n"
869 "Display Inter-Area-Router LSAs\n"
870 "Display As-External LSAs\n"
871 "Display Group-Membership LSAs\n"
872 "Display Type-7 LSAs\n"
873 "Display Link LSAs\n"
874 "Display Intra-Area-Prefix LSAs\n"
875 "Display Self-originated LSAs\n"
876 "Display details of LSAs\n"
878 "Display LSA's internal information\n")
883 struct listnode
*i
, *j
;
884 struct ospf6
*o
= ospf6
;
885 struct ospf6_area
*oa
;
886 struct ospf6_interface
*oi
;
888 u_int32_t adv_router
= 0;
890 OSPF6_CMD_CHECK_RUNNING ();
892 type
= parse_type_spec (idx_lsa
, argc
, argv
);
893 level
= parse_show_level (idx_level
, argc
, argv
);
895 adv_router
= o
->router_id
;
897 switch (OSPF6_LSA_SCOPE (type
))
899 case OSPF6_SCOPE_AREA
:
900 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
902 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
903 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, oa
->lsdb
);
907 case OSPF6_SCOPE_LINKLOCAL
:
908 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
910 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
912 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
913 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
914 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, oi
->lsdb
);
920 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
921 ospf6_lsdb_show (vty
, level
, &type
, NULL
, &adv_router
, o
->lsdb
);
929 vty_out (vty
, "%s", VNL
);
933 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id
,
934 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd
,
935 "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>]",
939 "Display Link state database\n"
940 "Display Router LSAs\n"
941 "Display Network LSAs\n"
942 "Display Inter-Area-Prefix LSAs\n"
943 "Display Inter-Area-Router LSAs\n"
944 "Display As-External LSAs\n"
945 "Display Group-Membership LSAs\n"
946 "Display Type-7 LSAs\n"
947 "Display Link LSAs\n"
948 "Display Intra-Area-Prefix LSAs\n"
949 "Display Self-originated LSAs\n"
950 "Search by Link state ID\n"
951 "Specify Link state ID as IPv4 address notation\n"
952 "Display details of LSAs\n"
954 "Display LSA's internal information\n")
960 struct listnode
*i
, *j
;
961 struct ospf6
*o
= ospf6
;
962 struct ospf6_area
*oa
;
963 struct ospf6_interface
*oi
;
965 u_int32_t adv_router
= 0;
968 OSPF6_CMD_CHECK_RUNNING ();
970 type
= parse_type_spec (idx_lsa
, argc
, argv
);
971 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
972 level
= parse_show_level (idx_level
, argc
, argv
);
973 adv_router
= o
->router_id
;
975 switch (OSPF6_LSA_SCOPE (type
))
977 case OSPF6_SCOPE_AREA
:
978 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
980 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
981 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oa
->lsdb
);
985 case OSPF6_SCOPE_LINKLOCAL
:
986 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
988 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
990 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
991 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
992 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oi
->lsdb
);
998 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
999 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1007 vty_out (vty
, "%s", VNL
);
1011 DEFUN (show_ipv6_ospf6_database_type_id_self_originated
,
1012 show_ipv6_ospf6_database_type_id_self_originated_cmd
,
1013 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D self-originated [<detail|dump|internal>]",
1017 "Display Link state database\n"
1018 "Display Router LSAs\n"
1019 "Display Network LSAs\n"
1020 "Display Inter-Area-Prefix LSAs\n"
1021 "Display Inter-Area-Router LSAs\n"
1022 "Display As-External LSAs\n"
1023 "Display Group-Membership LSAs\n"
1024 "Display Type-7 LSAs\n"
1025 "Display Link LSAs\n"
1026 "Display Intra-Area-Prefix LSAs\n"
1027 "Specify Link state ID as IPv4 address notation\n"
1028 "Display Self-originated LSAs\n"
1029 "Display details of LSAs\n"
1031 "Display LSA's internal information\n")
1037 struct listnode
*i
, *j
;
1038 struct ospf6
*o
= ospf6
;
1039 struct ospf6_area
*oa
;
1040 struct ospf6_interface
*oi
;
1042 u_int32_t adv_router
= 0;
1045 OSPF6_CMD_CHECK_RUNNING ();
1047 type
= parse_type_spec (idx_lsa
, argc
, argv
);
1048 inet_pton (AF_INET
, argv
[idx_ls_id
]->arg
, &id
);
1049 level
= parse_show_level (idx_level
, argc
, argv
);
1050 adv_router
= o
->router_id
;
1052 switch (OSPF6_LSA_SCOPE (type
))
1054 case OSPF6_SCOPE_AREA
:
1055 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
1057 vty_out (vty
, AREA_LSDB_TITLE_FORMAT
, VNL
, oa
->name
, VNL
, VNL
);
1058 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oa
->lsdb
);
1062 case OSPF6_SCOPE_LINKLOCAL
:
1063 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
1065 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
1067 vty_out (vty
, IF_LSDB_TITLE_FORMAT
, VNL
,
1068 oi
->interface
->name
, oa
->name
, VNL
, VNL
);
1069 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, oi
->lsdb
);
1074 case OSPF6_SCOPE_AS
:
1075 vty_out (vty
, AS_LSDB_TITLE_FORMAT
, VNL
, VNL
, VNL
);
1076 ospf6_lsdb_show (vty
, level
, &type
, &id
, &adv_router
, o
->lsdb
);
1084 vty_out (vty
, "%s", VNL
);
1088 DEFUN (show_ipv6_ospf6_border_routers
,
1089 show_ipv6_ospf6_border_routers_cmd
,
1090 "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
1094 "Display routing table for ABR and ASBR\n"
1098 u_int32_t adv_router
;
1099 struct ospf6_route
*ro
;
1100 struct prefix prefix
;
1102 OSPF6_CMD_CHECK_RUNNING ();
1106 if (strmatch (argv
[idx_ipv4
]->text
, "detail"))
1108 for (ro
= ospf6_route_head (ospf6
->brouter_table
); ro
;
1109 ro
= ospf6_route_next (ro
))
1110 ospf6_route_show_detail (vty
, ro
);
1114 inet_pton (AF_INET
, argv
[idx_ipv4
]->arg
, &adv_router
);
1116 ospf6_linkstate_prefix (adv_router
, 0, &prefix
);
1117 ro
= ospf6_route_lookup (&prefix
, ospf6
->brouter_table
);
1120 vty_out (vty
, "No Route found for Router ID: %s%s", argv
[4]->arg
, VNL
);
1124 ospf6_route_show_detail (vty
, ro
);
1130 ospf6_brouter_show_header (vty
);
1132 for (ro
= ospf6_route_head (ospf6
->brouter_table
); ro
;
1133 ro
= ospf6_route_next (ro
))
1134 ospf6_brouter_show (vty
, ro
);
1141 DEFUN (show_ipv6_ospf6_linkstate
,
1142 show_ipv6_ospf6_linkstate_cmd
,
1143 "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>",
1147 "Display linkstate routing table\n"
1148 "Display Router Entry\n"
1149 "Specify Router ID as IPv4 address notation\n"
1150 "Display Network Entry\n"
1151 "Specify Router ID as IPv4 address notation\n"
1152 "Specify Link state ID as IPv4 address notation\n"
1156 struct listnode
*node
;
1157 struct ospf6_area
*oa
;
1159 OSPF6_CMD_CHECK_RUNNING ();
1161 for (ALL_LIST_ELEMENTS_RO (ospf6
->area_list
, node
, oa
))
1163 vty_out (vty
, "%s SPF Result in Area %s%s%s",
1164 VNL
, oa
->name
, VNL
, VNL
);
1165 ospf6_linkstate_table_show (vty
, idx_ipv4
, argc
, argv
, oa
->spf_table
);
1168 vty_out (vty
, "%s", VNL
);
1174 DEFUN (show_ipv6_ospf6_linkstate_detail
,
1175 show_ipv6_ospf6_linkstate_detail_cmd
,
1176 "show ipv6 ospf6 linkstate detail",
1180 "Display linkstate routing table\n"
1184 struct listnode
*node
;
1185 struct ospf6_area
*oa
;
1187 OSPF6_CMD_CHECK_RUNNING ();
1189 for (ALL_LIST_ELEMENTS_RO (ospf6
->area_list
, node
, oa
))
1191 vty_out (vty
, "%s SPF Result in Area %s%s%s",
1192 VNL
, oa
->name
, VNL
, VNL
);
1193 ospf6_linkstate_table_show (vty
, idx_detail
, argc
, argv
, oa
->spf_table
);
1196 vty_out (vty
, "%s", VNL
);
1200 /* Install ospf related commands. */
1206 ospf6_interface_init ();
1207 ospf6_neighbor_init ();
1208 ospf6_zebra_init(master
);
1212 ospf6_intra_init ();
1217 ospf6_snmp_init (master
);
1218 #endif /*HAVE_SNMP*/
1221 install_node (&debug_node
, config_write_ospf6_debug
);
1223 install_element_ospf6_debug_message ();
1224 install_element_ospf6_debug_lsa ();
1225 install_element_ospf6_debug_interface ();
1226 install_element_ospf6_debug_neighbor ();
1227 install_element_ospf6_debug_zebra ();
1228 install_element_ospf6_debug_spf ();
1229 install_element_ospf6_debug_route ();
1230 install_element_ospf6_debug_brouter ();
1231 install_element_ospf6_debug_asbr ();
1232 install_element_ospf6_debug_abr ();
1233 install_element_ospf6_debug_flood ();
1235 install_element_ospf6_clear_interface ();
1237 install_element (VIEW_NODE
, &show_version_ospf6_cmd
);
1238 install_element (ENABLE_NODE
, &show_version_ospf6_cmd
);
1240 install_element (VIEW_NODE
, &show_ipv6_ospf6_border_routers_cmd
);
1241 install_element (ENABLE_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
);
1245 install_element (ENABLE_NODE
, &show_ipv6_ospf6_linkstate_cmd
);
1246 install_element (ENABLE_NODE
, &show_ipv6_ospf6_linkstate_detail_cmd
);
1248 #define INSTALL(n,c) \
1249 install_element (n ## _NODE, &show_ipv6_ospf6_ ## c)
1251 INSTALL (VIEW
, database_cmd
);
1252 INSTALL (VIEW
, database_type_cmd
);
1253 INSTALL (VIEW
, database_id_cmd
);
1254 INSTALL (VIEW
, database_router_cmd
);
1255 INSTALL (VIEW
, database_type_id_cmd
);
1256 INSTALL (VIEW
, database_type_router_cmd
);
1257 INSTALL (VIEW
, database_adv_router_linkstate_id_cmd
);
1258 INSTALL (VIEW
, database_id_router_cmd
);
1259 INSTALL (VIEW
, database_type_id_router_cmd
);
1260 INSTALL (VIEW
, database_type_adv_router_linkstate_id_cmd
);
1261 INSTALL (VIEW
, database_self_originated_cmd
);
1262 INSTALL (VIEW
, database_type_self_originated_cmd
);
1263 INSTALL (VIEW
, database_type_id_self_originated_cmd
);
1264 INSTALL (VIEW
, database_type_self_originated_linkstate_id_cmd
);
1266 INSTALL (ENABLE
, database_cmd
);
1267 INSTALL (ENABLE
, database_type_cmd
);
1268 INSTALL (ENABLE
, database_id_cmd
);
1269 INSTALL (ENABLE
, database_router_cmd
);
1270 INSTALL (ENABLE
, database_type_id_cmd
);
1271 INSTALL (ENABLE
, database_type_router_cmd
);
1272 INSTALL (ENABLE
, database_adv_router_linkstate_id_cmd
);
1273 INSTALL (ENABLE
, database_id_router_cmd
);
1274 INSTALL (ENABLE
, database_type_id_router_cmd
);
1275 INSTALL (ENABLE
, database_type_adv_router_linkstate_id_cmd
);
1276 INSTALL (ENABLE
, database_self_originated_cmd
);
1277 INSTALL (ENABLE
, database_type_self_originated_cmd
);
1278 INSTALL (ENABLE
, database_type_id_self_originated_cmd
);
1279 INSTALL (ENABLE
, database_type_self_originated_linkstate_id_cmd
);
1281 /* Make ospf protocol socket. */
1283 thread_add_read (master
, ospf6_receive
, NULL
, ospf6_sock
);
1291 if (ospf6
->route_table
)
1292 ospf6_route_remove_all (ospf6
->route_table
);
1293 if (ospf6
->brouter_table
)
1294 ospf6_route_remove_all (ospf6
->brouter_table
);