]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6d.c
Merge pull request #1663 from donaldsharp/mpls
[mirror_frr.git] / ospf6d / ospf6d.c
CommitLineData
718e3744 1/*
508e53e2 2 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 3 *
4 * This file is part of GNU Zebra.
5 *
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
9 * later version.
10 *
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.
15 *
896014f4
DL
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
718e3744 19 */
20
508e53e2 21#include <zebra.h>
718e3744 22
508e53e2 23#include "thread.h"
24#include "linklist.h"
25#include "vty.h"
26#include "command.h"
427f8e61 27#include "plist.h"
718e3744 28
508e53e2 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"
049207c3 43#include "ospf6_abr.h"
1e05838a 44#include "ospf6_flood.h"
049207c3 45#include "ospf6d.h"
7f342629 46#include "ospf6_bfd.h"
718e3744 47
d62a17ae 48struct route_node *route_prev(struct route_node *node)
718e3744 49{
d62a17ae 50 struct route_node *end;
51 struct route_node *prev = NULL;
52
53 end = node;
54 node = node->parent;
55 if (node)
56 route_lock_node(node);
57 while (node) {
58 prev = node;
59 node = route_next(node);
60 if (node == end) {
61 route_unlock_node(node);
62 node = NULL;
63 }
64 }
65 route_unlock_node(end);
66 if (prev)
67 route_lock_node(prev);
68
69 return prev;
718e3744 70}
71
d62a17ae 72static struct cmd_node debug_node = {
73 DEBUG_NODE, "", 1 /* VTYSH */
508e53e2 74};
718e3744 75
d62a17ae 76static int config_write_ospf6_debug(struct vty *vty)
508e53e2 77{
d62a17ae 78 config_write_ospf6_debug_message(vty);
79 config_write_ospf6_debug_lsa(vty);
80 config_write_ospf6_debug_zebra(vty);
81 config_write_ospf6_debug_interface(vty);
82 config_write_ospf6_debug_neighbor(vty);
83 config_write_ospf6_debug_spf(vty);
84 config_write_ospf6_debug_route(vty);
85 config_write_ospf6_debug_brouter(vty);
86 config_write_ospf6_debug_asbr(vty);
87 config_write_ospf6_debug_abr(vty);
88 config_write_ospf6_debug_flood(vty);
87f6dc50 89
d62a17ae 90 return 0;
718e3744 91}
92
87f6dc50
DS
93DEFUN_NOSH (show_debugging_ospf6,
94 show_debugging_ospf6_cmd,
95 "show debugging [ospf6]",
96 SHOW_STR
97 DEBUG_STR
98 OSPF6_STR)
99{
100 vty_out(vty, "OSPF6 debugging status:");
101
102 config_write_ospf6_debug(vty);
103
104 return CMD_SUCCESS;
105}
106
d62a17ae 107#define AREA_LSDB_TITLE_FORMAT \
108 "\n Area Scoped Link State Database (Area %s)\n\n"
109#define IF_LSDB_TITLE_FORMAT \
110 "\n I/F Scoped Link State Database (I/F %s in Area %s)\n\n"
111#define AS_LSDB_TITLE_FORMAT "\n AS Scoped Link State Database\n\n"
049207c3 112
d62a17ae 113static int parse_show_level(int idx_level, int argc, struct cmd_token **argv)
049207c3 114{
d62a17ae 115 int level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
116
117 if (argc > idx_level) {
118 if (strmatch(argv[idx_level]->text, "detail"))
119 level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;
120 else if (strmatch(argv[idx_level]->text, "dump"))
121 level = OSPF6_LSDB_SHOW_LEVEL_DUMP;
122 else if (strmatch(argv[idx_level]->text, "internal"))
123 level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL;
124 }
125
126 return level;
049207c3 127}
128
d62a17ae 129static u_int16_t parse_type_spec(int idx_lsa, int argc, struct cmd_token **argv)
049207c3 130{
d62a17ae 131 u_int16_t type = 0;
132
133 if (argc > idx_lsa) {
134 if (strmatch(argv[idx_lsa]->text, "router"))
135 type = htons(OSPF6_LSTYPE_ROUTER);
136 else if (strmatch(argv[idx_lsa]->text, "network"))
137 type = htons(OSPF6_LSTYPE_NETWORK);
138 else if (strmatch(argv[idx_lsa]->text, "as-external"))
139 type = htons(OSPF6_LSTYPE_AS_EXTERNAL);
140 else if (strmatch(argv[idx_lsa]->text, "intra-prefix"))
141 type = htons(OSPF6_LSTYPE_INTRA_PREFIX);
142 else if (strmatch(argv[idx_lsa]->text, "inter-router"))
143 type = htons(OSPF6_LSTYPE_INTER_ROUTER);
144 else if (strmatch(argv[idx_lsa]->text, "inter-prefix"))
145 type = htons(OSPF6_LSTYPE_INTER_PREFIX);
146 else if (strmatch(argv[idx_lsa]->text, "link"))
147 type = htons(OSPF6_LSTYPE_LINK);
148 }
149
150 return type;
049207c3 151}
152
508e53e2 153DEFUN (show_ipv6_ospf6_database,
154 show_ipv6_ospf6_database_cmd,
6de69f83 155 "show ipv6 ospf6 database [<detail|dump|internal>]",
508e53e2 156 SHOW_STR
157 IPV6_STR
158 OSPF6_STR
159 "Display Link state database\n"
14b16482
DW
160 "Display details of LSAs\n"
161 "Dump LSAs\n"
162 "Display LSA's internal information\n")
718e3744 163{
d62a17ae 164 int idx_level = 4;
165 int level;
166 struct listnode *i, *j;
167 struct ospf6 *o = ospf6;
168 struct ospf6_area *oa;
169 struct ospf6_interface *oi;
170
171 OSPF6_CMD_CHECK_RUNNING();
172
173 level = parse_show_level(idx_level, argc, argv);
174
175 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
176 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
177 ospf6_lsdb_show(vty, level, NULL, NULL, NULL, oa->lsdb);
178 }
179
180 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
181 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
182 vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name,
183 oa->name);
184 ospf6_lsdb_show(vty, level, NULL, NULL, NULL, oi->lsdb);
185 }
186 }
187
188 vty_out(vty, AS_LSDB_TITLE_FORMAT);
189 ospf6_lsdb_show(vty, level, NULL, NULL, NULL, o->lsdb);
190
191 vty_out(vty, "\n");
192 return CMD_SUCCESS;
718e3744 193}
194
508e53e2 195DEFUN (show_ipv6_ospf6_database_type,
196 show_ipv6_ospf6_database_type_cmd,
14b16482 197 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>]",
718e3744 198 SHOW_STR
508e53e2 199 IPV6_STR
200 OSPF6_STR
201 "Display Link state database\n"
202 "Display Router LSAs\n"
203 "Display Network LSAs\n"
204 "Display Inter-Area-Prefix LSAs\n"
205 "Display Inter-Area-Router LSAs\n"
206 "Display As-External LSAs\n"
207 "Display Group-Membership LSAs\n"
208 "Display Type-7 LSAs\n"
209 "Display Link LSAs\n"
210 "Display Intra-Area-Prefix LSAs\n"
14b16482
DW
211 "Display details of LSAs\n"
212 "Dump LSAs\n"
213 "Display LSA's internal information\n"
508e53e2 214 )
718e3744 215{
d62a17ae 216 int idx_lsa = 4;
217 int idx_level = 5;
218 int level;
219 struct listnode *i, *j;
220 struct ospf6 *o = ospf6;
221 struct ospf6_area *oa;
222 struct ospf6_interface *oi;
223 u_int16_t type = 0;
224
225 OSPF6_CMD_CHECK_RUNNING();
226
227 type = parse_type_spec(idx_lsa, argc, argv);
228 level = parse_show_level(idx_level, argc, argv);
229
230 switch (OSPF6_LSA_SCOPE(type)) {
231 case OSPF6_SCOPE_AREA:
232 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
233 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
234 ospf6_lsdb_show(vty, level, &type, NULL, NULL,
235 oa->lsdb);
236 }
237 break;
238
239 case OSPF6_SCOPE_LINKLOCAL:
240 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
241 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
242 vty_out(vty, IF_LSDB_TITLE_FORMAT,
243 oi->interface->name, oa->name);
244 ospf6_lsdb_show(vty, level, &type, NULL, NULL,
245 oi->lsdb);
246 }
247 }
248 break;
249
250 case OSPF6_SCOPE_AS:
251 vty_out(vty, AS_LSDB_TITLE_FORMAT);
252 ospf6_lsdb_show(vty, level, &type, NULL, NULL, o->lsdb);
253 break;
254
255 default:
256 assert(0);
257 break;
258 }
259
260 vty_out(vty, "\n");
261 return CMD_SUCCESS;
718e3744 262}
263
508e53e2 264DEFUN (show_ipv6_ospf6_database_id,
265 show_ipv6_ospf6_database_id_cmd,
093d7a3a 266 "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D [<detail|dump|internal>]",
718e3744 267 SHOW_STR
508e53e2 268 IPV6_STR
718e3744 269 OSPF6_STR
508e53e2 270 "Display Link state database\n"
271 "Any Link state Type\n"
093d7a3a 272 "Search by Link state ID\n"
508e53e2 273 "Specify Link state ID as IPv4 address notation\n"
093d7a3a
DW
274 "Display details of LSAs\n"
275 "Dump LSAs\n"
276 "Display LSA's internal information\n")
718e3744 277{
d62a17ae 278 int idx_ipv4 = 5;
279 int idx_level = 6;
280 int level;
281 struct listnode *i, *j;
282 struct ospf6 *o = ospf6;
283 struct ospf6_area *oa;
284 struct ospf6_interface *oi;
285 u_int32_t id = 0;
286
287 OSPF6_CMD_CHECK_RUNNING();
288
289 if (argv[idx_ipv4]->type == IPV4_TKN)
290 inet_pton(AF_INET, argv[idx_ipv4]->arg, &id);
291
292 level = parse_show_level(idx_level, argc, argv);
293
294 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
295 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
296 ospf6_lsdb_show(vty, level, NULL, &id, NULL, oa->lsdb);
297 }
298
299 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
300 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
301 vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name,
302 oa->name);
303 ospf6_lsdb_show(vty, level, NULL, &id, NULL, oi->lsdb);
304 }
305 }
306
307 vty_out(vty, AS_LSDB_TITLE_FORMAT);
308 ospf6_lsdb_show(vty, level, NULL, &id, NULL, o->lsdb);
309
310 vty_out(vty, "\n");
311 return CMD_SUCCESS;
718e3744 312}
313
508e53e2 314DEFUN (show_ipv6_ospf6_database_router,
315 show_ipv6_ospf6_database_router_cmd,
093d7a3a 316 "show ipv6 ospf6 database <*|adv-router> * A.B.C.D <detail|dump|internal>",
508e53e2 317 SHOW_STR
318 IPV6_STR
319 OSPF6_STR
320 "Display Link state database\n"
321 "Any Link state Type\n"
093d7a3a 322 "Search by Advertising Router\n"
508e53e2 323 "Any Link state ID\n"
324 "Specify Advertising Router as IPv4 address notation\n"
093d7a3a
DW
325 "Display details of LSAs\n"
326 "Dump LSAs\n"
327 "Display LSA's internal information\n")
718e3744 328{
d62a17ae 329 int idx_ipv4 = 6;
330 int idx_level = 7;
331 int level;
332 struct listnode *i, *j;
333 struct ospf6 *o = ospf6;
334 struct ospf6_area *oa;
335 struct ospf6_interface *oi;
336 u_int32_t adv_router = 0;
337
338 OSPF6_CMD_CHECK_RUNNING();
339 inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router);
340 level = parse_show_level(idx_level, argc, argv);
341
342 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
343 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
344 ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, oa->lsdb);
345 }
346
347 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
348 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
349 vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name,
350 oa->name);
351 ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router,
352 oi->lsdb);
353 }
354 }
355
356 vty_out(vty, AS_LSDB_TITLE_FORMAT);
357 ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, o->lsdb);
358
359 vty_out(vty, "\n");
360 return CMD_SUCCESS;
508e53e2 361}
362
508e53e2 363DEFUN (show_ipv6_ospf6_database_type_id,
364 show_ipv6_ospf6_database_type_id_cmd,
373886ab 365 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> linkstate-id A.B.C.D [<detail|dump|internal>]",
508e53e2 366 SHOW_STR
367 IPV6_STR
368 OSPF6_STR
369 "Display Link state database\n"
370 "Display Router LSAs\n"
371 "Display Network LSAs\n"
372 "Display Inter-Area-Prefix LSAs\n"
373 "Display Inter-Area-Router LSAs\n"
374 "Display As-External LSAs\n"
375 "Display Group-Membership LSAs\n"
376 "Display Type-7 LSAs\n"
377 "Display Link LSAs\n"
378 "Display Intra-Area-Prefix LSAs\n"
093d7a3a 379 "Search by Link state ID\n"
508e53e2 380 "Specify Link state ID as IPv4 address notation\n"
093d7a3a
DW
381 "Display details of LSAs\n"
382 "Dump LSAs\n"
383 "Display LSA's internal information\n"
508e53e2 384 )
385{
d62a17ae 386 int idx_lsa = 4;
387 int idx_ipv4 = 6;
388 int idx_level = 7;
389 int level;
390 struct listnode *i, *j;
391 struct ospf6 *o = ospf6;
392 struct ospf6_area *oa;
393 struct ospf6_interface *oi;
394 u_int16_t type = 0;
395 u_int32_t id = 0;
396
397 OSPF6_CMD_CHECK_RUNNING();
398
399 type = parse_type_spec(idx_lsa, argc, argv);
400 inet_pton(AF_INET, argv[idx_ipv4]->arg, &id);
401 level = parse_show_level(idx_level, argc, argv);
402
403 switch (OSPF6_LSA_SCOPE(type)) {
404 case OSPF6_SCOPE_AREA:
405 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
406 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
407 ospf6_lsdb_show(vty, level, &type, &id, NULL, oa->lsdb);
408 }
409 break;
410
411 case OSPF6_SCOPE_LINKLOCAL:
412 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
413 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
414 vty_out(vty, IF_LSDB_TITLE_FORMAT,
415 oi->interface->name, oa->name);
416 ospf6_lsdb_show(vty, level, &type, &id, NULL,
417 oi->lsdb);
418 }
419 }
420 break;
421
422 case OSPF6_SCOPE_AS:
423 vty_out(vty, AS_LSDB_TITLE_FORMAT);
424 ospf6_lsdb_show(vty, level, &type, &id, NULL, o->lsdb);
425 break;
426
427 default:
428 assert(0);
429 break;
430 }
431
432 vty_out(vty, "\n");
433 return CMD_SUCCESS;
718e3744 434}
435
508e53e2 436DEFUN (show_ipv6_ospf6_database_type_router,
437 show_ipv6_ospf6_database_type_router_cmd,
093d7a3a 438 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> <*|adv-router> A.B.C.D [<detail|dump|internal>]",
508e53e2 439 SHOW_STR
440 IPV6_STR
441 OSPF6_STR
442 "Display Link state database\n"
443 "Display Router LSAs\n"
444 "Display Network LSAs\n"
445 "Display Inter-Area-Prefix LSAs\n"
446 "Display Inter-Area-Router LSAs\n"
447 "Display As-External LSAs\n"
448 "Display Group-Membership LSAs\n"
449 "Display Type-7 LSAs\n"
450 "Display Link LSAs\n"
451 "Display Intra-Area-Prefix LSAs\n"
452 "Any Link state ID\n"
093d7a3a 453 "Search by Advertising Router\n"
508e53e2 454 "Specify Advertising Router as IPv4 address notation\n"
093d7a3a
DW
455 "Display details of LSAs\n"
456 "Dump LSAs\n"
457 "Display LSA's internal information\n"
718e3744 458 )
459{
d62a17ae 460 int idx_lsa = 4;
461 int idx_ipv4 = 6;
462 int idx_level = 7;
463 int level;
464 struct listnode *i, *j;
465 struct ospf6 *o = ospf6;
466 struct ospf6_area *oa;
467 struct ospf6_interface *oi;
468 u_int16_t type = 0;
469 u_int32_t adv_router = 0;
470
471 OSPF6_CMD_CHECK_RUNNING();
472
473 type = parse_type_spec(idx_lsa, argc, argv);
474 inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router);
475 level = parse_show_level(idx_level, argc, argv);
476
477 switch (OSPF6_LSA_SCOPE(type)) {
478 case OSPF6_SCOPE_AREA:
479 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
480 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
481 ospf6_lsdb_show(vty, level, &type, NULL, &adv_router,
482 oa->lsdb);
483 }
484 break;
485
486 case OSPF6_SCOPE_LINKLOCAL:
487 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
488 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
489 vty_out(vty, IF_LSDB_TITLE_FORMAT,
490 oi->interface->name, oa->name);
491 ospf6_lsdb_show(vty, level, &type, NULL,
492 &adv_router, oi->lsdb);
493 }
494 }
495 break;
496
497 case OSPF6_SCOPE_AS:
498 vty_out(vty, AS_LSDB_TITLE_FORMAT);
499 ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, o->lsdb);
500 break;
501
502 default:
503 assert(0);
504 break;
505 }
506
507 vty_out(vty, "\n");
508 return CMD_SUCCESS;
718e3744 509}
510
508e53e2 511
049207c3 512DEFUN (show_ipv6_ospf6_database_id_router,
513 show_ipv6_ospf6_database_id_router_cmd,
14b16482 514 "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>]",
049207c3 515 SHOW_STR
516 IPV6_STR
517 OSPF6_STR
518 "Display Link state database\n"
519 "Any Link state Type\n"
520 "Specify Link state ID as IPv4 address notation\n"
521 "Specify Advertising Router as IPv4 address notation\n"
14b16482
DW
522 "Display details of LSAs\n"
523 "Dump LSAs\n"
524 "Display LSA's internal information\n"
049207c3 525 )
526{
d62a17ae 527 int idx_ls_id = 5;
528 int idx_adv_rtr = 6;
529 int idx_level = 7;
530 int level;
531 struct listnode *i, *j;
532 struct ospf6 *o = ospf6;
533 struct ospf6_area *oa;
534 struct ospf6_interface *oi;
535 u_int32_t id = 0;
536 u_int32_t adv_router = 0;
537
538 OSPF6_CMD_CHECK_RUNNING();
539 inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);
540 inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
541 level = parse_show_level(idx_level, argc, argv);
542
543 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
544 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
545 ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, oa->lsdb);
546 }
547
548 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
549 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
550 vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name,
551 oa->name);
552 ospf6_lsdb_show(vty, level, NULL, &id, &adv_router,
553 oi->lsdb);
554 }
555 }
556
557 vty_out(vty, AS_LSDB_TITLE_FORMAT);
558 ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, o->lsdb);
559
560 vty_out(vty, "\n");
561 return CMD_SUCCESS;
718e3744 562}
563
508e53e2 564
049207c3 565DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
566 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd,
14b16482 567 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>]",
049207c3 568 SHOW_STR
569 IPV6_STR
570 OSPF6_STR
571 "Display Link state database\n"
572 "Search by Advertising Router\n"
573 "Specify Advertising Router as IPv4 address notation\n"
574 "Search by Link state ID\n"
575 "Specify Link state ID as IPv4 address notation\n"
14b16482
DW
576 "Display details of LSAs\n"
577 "Dump LSAs\n"
578 "Display LSA's internal information\n")
049207c3 579{
d62a17ae 580 int idx_adv_rtr = 5;
581 int idx_ls_id = 7;
582 int idx_level = 8;
583 int level;
584 struct listnode *i, *j;
585 struct ospf6 *o = ospf6;
586 struct ospf6_area *oa;
587 struct ospf6_interface *oi;
588 u_int32_t id = 0;
589 u_int32_t adv_router = 0;
590
591 OSPF6_CMD_CHECK_RUNNING();
592 inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
593 inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);
594 level = parse_show_level(idx_level, argc, argv);
595
596 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
597 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
598 ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, oa->lsdb);
599 }
600
601 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
602 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
603 vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name,
604 oa->name);
605 ospf6_lsdb_show(vty, level, NULL, &id, &adv_router,
606 oi->lsdb);
607 }
608 }
609
610 vty_out(vty, AS_LSDB_TITLE_FORMAT);
611 ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, o->lsdb);
612
613 vty_out(vty, "\n");
614 return CMD_SUCCESS;
049207c3 615}
616
508e53e2 617DEFUN (show_ipv6_ospf6_database_type_id_router,
618 show_ipv6_ospf6_database_type_id_router_cmd,
14b16482 619 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D A.B.C.D [<dump|internal>]",
508e53e2 620 SHOW_STR
621 IPV6_STR
622 OSPF6_STR
623 "Display Link state database\n"
624 "Display Router LSAs\n"
625 "Display Network LSAs\n"
626 "Display Inter-Area-Prefix LSAs\n"
627 "Display Inter-Area-Router LSAs\n"
628 "Display As-External LSAs\n"
629 "Display Group-Membership LSAs\n"
630 "Display Type-7 LSAs\n"
631 "Display Link LSAs\n"
632 "Display Intra-Area-Prefix LSAs\n"
633 "Specify Link state ID as IPv4 address notation\n"
634 "Specify Advertising Router as IPv4 address notation\n"
14b16482
DW
635 "Dump LSAs\n"
636 "Display LSA's internal information\n")
718e3744 637{
d62a17ae 638 int idx_lsa = 4;
639 int idx_ls_id = 5;
640 int idx_adv_rtr = 6;
641 int idx_level = 7;
642 int level;
643 struct listnode *i, *j;
644 struct ospf6 *o = ospf6;
645 struct ospf6_area *oa;
646 struct ospf6_interface *oi;
647 u_int16_t type = 0;
648 u_int32_t id = 0;
649 u_int32_t adv_router = 0;
650
651 OSPF6_CMD_CHECK_RUNNING();
652
653 type = parse_type_spec(idx_lsa, argc, argv);
654 inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);
655 inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
656 level = parse_show_level(idx_level, argc, argv);
657
658 switch (OSPF6_LSA_SCOPE(type)) {
659 case OSPF6_SCOPE_AREA:
660 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
661 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
662 ospf6_lsdb_show(vty, level, &type, &id, &adv_router,
663 oa->lsdb);
664 }
665 break;
666
667 case OSPF6_SCOPE_LINKLOCAL:
668 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
669 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
670 vty_out(vty, IF_LSDB_TITLE_FORMAT,
671 oi->interface->name, oa->name);
672 ospf6_lsdb_show(vty, level, &type, &id,
673 &adv_router, oi->lsdb);
674 }
675 }
676 break;
677
678 case OSPF6_SCOPE_AS:
679 vty_out(vty, AS_LSDB_TITLE_FORMAT);
680 ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb);
681 break;
682
683 default:
684 assert(0);
685 break;
686 }
687
688 vty_out(vty, "\n");
689 return CMD_SUCCESS;
718e3744 690}
691
049207c3 692
693DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
694 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd,
14b16482 695 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> adv-router A.B.C.D linkstate-id A.B.C.D [<dump|internal>]",
049207c3 696 SHOW_STR
697 IPV6_STR
698 OSPF6_STR
699 "Display Link state database\n"
700 "Display Router LSAs\n"
701 "Display Network LSAs\n"
702 "Display Inter-Area-Prefix LSAs\n"
703 "Display Inter-Area-Router LSAs\n"
704 "Display As-External LSAs\n"
705 "Display Group-Membership LSAs\n"
706 "Display Type-7 LSAs\n"
707 "Display Link LSAs\n"
708 "Display Intra-Area-Prefix LSAs\n"
709 "Search by Advertising Router\n"
710 "Specify Advertising Router as IPv4 address notation\n"
711 "Search by Link state ID\n"
712 "Specify Link state ID as IPv4 address notation\n"
14b16482
DW
713 "Dump LSAs\n"
714 "Display LSA's internal information\n")
049207c3 715{
d62a17ae 716 int idx_lsa = 4;
717 int idx_adv_rtr = 6;
718 int idx_ls_id = 8;
719 int idx_level = 9;
720 int level;
721 struct listnode *i, *j;
722 struct ospf6 *o = ospf6;
723 struct ospf6_area *oa;
724 struct ospf6_interface *oi;
725 u_int16_t type = 0;
726 u_int32_t id = 0;
727 u_int32_t adv_router = 0;
728
729 OSPF6_CMD_CHECK_RUNNING();
730
731 type = parse_type_spec(idx_lsa, argc, argv);
732 inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
733 inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);
734 level = parse_show_level(idx_level, argc, argv);
735
736 switch (OSPF6_LSA_SCOPE(type)) {
737 case OSPF6_SCOPE_AREA:
738 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
739 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
740 ospf6_lsdb_show(vty, level, &type, &id, &adv_router,
741 oa->lsdb);
742 }
743 break;
744
745 case OSPF6_SCOPE_LINKLOCAL:
746 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
747 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
748 vty_out(vty, IF_LSDB_TITLE_FORMAT,
749 oi->interface->name, oa->name);
750 ospf6_lsdb_show(vty, level, &type, &id,
751 &adv_router, oi->lsdb);
752 }
753 }
754 break;
755
756 case OSPF6_SCOPE_AS:
757 vty_out(vty, AS_LSDB_TITLE_FORMAT);
758 ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb);
759 break;
760
761 default:
762 assert(0);
763 break;
764 }
765
766 vty_out(vty, "\n");
767 return CMD_SUCCESS;
049207c3 768}
769
508e53e2 770DEFUN (show_ipv6_ospf6_database_self_originated,
771 show_ipv6_ospf6_database_self_originated_cmd,
14b16482 772 "show ipv6 ospf6 database self-originated [<detail|dump|internal>]",
508e53e2 773 SHOW_STR
774 IPV6_STR
775 OSPF6_STR
16cedbb0 776 "Display Link state database\n"
508e53e2 777 "Display Self-originated LSAs\n"
14b16482
DW
778 "Display details of LSAs\n"
779 "Dump LSAs\n"
780 "Display LSA's internal information\n")
718e3744 781{
d62a17ae 782 int idx_level = 5;
783 int level;
784 struct listnode *i, *j;
785 struct ospf6 *o = ospf6;
786 struct ospf6_area *oa;
787 struct ospf6_interface *oi;
788 u_int32_t adv_router = 0;
789
790 OSPF6_CMD_CHECK_RUNNING();
791 level = parse_show_level(idx_level, argc, argv);
792 adv_router = o->router_id;
793
794 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
795 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
796 ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, oa->lsdb);
797 }
798
799 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
800 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
801 vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name,
802 oa->name);
803 ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router,
804 oi->lsdb);
805 }
806 }
807
808 vty_out(vty, AS_LSDB_TITLE_FORMAT);
809 ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, o->lsdb);
810
811 vty_out(vty, "\n");
812 return CMD_SUCCESS;
718e3744 813}
814
508e53e2 815
816DEFUN (show_ipv6_ospf6_database_type_self_originated,
817 show_ipv6_ospf6_database_type_self_originated_cmd,
14b16482 818 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]",
508e53e2 819 SHOW_STR
820 IPV6_STR
821 OSPF6_STR
822 "Display Link state database\n"
823 "Display Router LSAs\n"
824 "Display Network LSAs\n"
825 "Display Inter-Area-Prefix LSAs\n"
826 "Display Inter-Area-Router LSAs\n"
827 "Display As-External LSAs\n"
828 "Display Group-Membership LSAs\n"
829 "Display Type-7 LSAs\n"
830 "Display Link LSAs\n"
831 "Display Intra-Area-Prefix LSAs\n"
832 "Display Self-originated LSAs\n"
14b16482
DW
833 "Display details of LSAs\n"
834 "Dump LSAs\n"
835 "Display LSA's internal information\n")
718e3744 836{
d62a17ae 837 int idx_lsa = 4;
838 int idx_level = 6;
839 int level;
840 struct listnode *i, *j;
841 struct ospf6 *o = ospf6;
842 struct ospf6_area *oa;
843 struct ospf6_interface *oi;
844 u_int16_t type = 0;
845 u_int32_t adv_router = 0;
846
847 OSPF6_CMD_CHECK_RUNNING();
848
849 type = parse_type_spec(idx_lsa, argc, argv);
850 level = parse_show_level(idx_level, argc, argv);
851
852 adv_router = o->router_id;
853
854 switch (OSPF6_LSA_SCOPE(type)) {
855 case OSPF6_SCOPE_AREA:
856 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
857 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
858 ospf6_lsdb_show(vty, level, &type, NULL, &adv_router,
859 oa->lsdb);
860 }
861 break;
862
863 case OSPF6_SCOPE_LINKLOCAL:
864 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
865 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
866 vty_out(vty, IF_LSDB_TITLE_FORMAT,
867 oi->interface->name, oa->name);
868 ospf6_lsdb_show(vty, level, &type, NULL,
869 &adv_router, oi->lsdb);
870 }
871 }
872 break;
873
874 case OSPF6_SCOPE_AS:
875 vty_out(vty, AS_LSDB_TITLE_FORMAT);
876 ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, o->lsdb);
877 break;
878
879 default:
880 assert(0);
881 break;
882 }
883
884 vty_out(vty, "\n");
885 return CMD_SUCCESS;
049207c3 886}
508e53e2 887
049207c3 888DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
889 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
14b16482 890 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated linkstate-id A.B.C.D [<detail|dump|internal>]",
049207c3 891 SHOW_STR
892 IPV6_STR
893 OSPF6_STR
894 "Display Link state database\n"
895 "Display Router LSAs\n"
896 "Display Network LSAs\n"
897 "Display Inter-Area-Prefix LSAs\n"
898 "Display Inter-Area-Router LSAs\n"
899 "Display As-External LSAs\n"
900 "Display Group-Membership LSAs\n"
901 "Display Type-7 LSAs\n"
902 "Display Link LSAs\n"
903 "Display Intra-Area-Prefix LSAs\n"
904 "Display Self-originated LSAs\n"
905 "Search by Link state ID\n"
906 "Specify Link state ID as IPv4 address notation\n"
14b16482
DW
907 "Display details of LSAs\n"
908 "Dump LSAs\n"
909 "Display LSA's internal information\n")
049207c3 910{
d62a17ae 911 int idx_lsa = 4;
912 int idx_ls_id = 7;
913 int idx_level = 8;
914 int level;
915 struct listnode *i, *j;
916 struct ospf6 *o = ospf6;
917 struct ospf6_area *oa;
918 struct ospf6_interface *oi;
919 u_int16_t type = 0;
920 u_int32_t adv_router = 0;
921 u_int32_t id = 0;
922
923 OSPF6_CMD_CHECK_RUNNING();
924
925 type = parse_type_spec(idx_lsa, argc, argv);
926 inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);
927 level = parse_show_level(idx_level, argc, argv);
928 adv_router = o->router_id;
929
930 switch (OSPF6_LSA_SCOPE(type)) {
931 case OSPF6_SCOPE_AREA:
932 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
933 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
934 ospf6_lsdb_show(vty, level, &type, &id, &adv_router,
935 oa->lsdb);
936 }
937 break;
938
939 case OSPF6_SCOPE_LINKLOCAL:
940 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
941 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
942 vty_out(vty, IF_LSDB_TITLE_FORMAT,
943 oi->interface->name, oa->name);
944 ospf6_lsdb_show(vty, level, &type, &id,
945 &adv_router, oi->lsdb);
946 }
947 }
948 break;
949
950 case OSPF6_SCOPE_AS:
951 vty_out(vty, AS_LSDB_TITLE_FORMAT);
952 ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb);
953 break;
954
955 default:
956 assert(0);
957 break;
958 }
959
960 vty_out(vty, "\n");
961 return CMD_SUCCESS;
718e3744 962}
718e3744 963
508e53e2 964DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
965 show_ipv6_ospf6_database_type_id_self_originated_cmd,
14b16482 966 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D self-originated [<detail|dump|internal>]",
508e53e2 967 SHOW_STR
968 IPV6_STR
969 OSPF6_STR
970 "Display Link state database\n"
971 "Display Router LSAs\n"
972 "Display Network LSAs\n"
973 "Display Inter-Area-Prefix LSAs\n"
974 "Display Inter-Area-Router LSAs\n"
975 "Display As-External LSAs\n"
976 "Display Group-Membership LSAs\n"
977 "Display Type-7 LSAs\n"
978 "Display Link LSAs\n"
979 "Display Intra-Area-Prefix LSAs\n"
980 "Specify Link state ID as IPv4 address notation\n"
981 "Display Self-originated LSAs\n"
14b16482
DW
982 "Display details of LSAs\n"
983 "Dump LSAs\n"
984 "Display LSA's internal information\n")
718e3744 985{
d62a17ae 986 int idx_lsa = 4;
987 int idx_ls_id = 5;
988 int idx_level = 7;
989 int level;
990 struct listnode *i, *j;
991 struct ospf6 *o = ospf6;
992 struct ospf6_area *oa;
993 struct ospf6_interface *oi;
994 u_int16_t type = 0;
995 u_int32_t adv_router = 0;
996 u_int32_t id = 0;
997
998 OSPF6_CMD_CHECK_RUNNING();
999
1000 type = parse_type_spec(idx_lsa, argc, argv);
1001 inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);
1002 level = parse_show_level(idx_level, argc, argv);
1003 adv_router = o->router_id;
1004
1005 switch (OSPF6_LSA_SCOPE(type)) {
1006 case OSPF6_SCOPE_AREA:
1007 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
1008 vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name);
1009 ospf6_lsdb_show(vty, level, &type, &id, &adv_router,
1010 oa->lsdb);
1011 }
1012 break;
1013
1014 case OSPF6_SCOPE_LINKLOCAL:
1015 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
1016 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
1017 vty_out(vty, IF_LSDB_TITLE_FORMAT,
1018 oi->interface->name, oa->name);
1019 ospf6_lsdb_show(vty, level, &type, &id,
1020 &adv_router, oi->lsdb);
1021 }
1022 }
1023 break;
1024
1025 case OSPF6_SCOPE_AS:
1026 vty_out(vty, AS_LSDB_TITLE_FORMAT);
1027 ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb);
1028 break;
1029
1030 default:
1031 assert(0);
1032 break;
1033 }
1034
1035 vty_out(vty, "\n");
1036 return CMD_SUCCESS;
718e3744 1037}
1038
6452df09 1039DEFUN (show_ipv6_ospf6_border_routers,
1040 show_ipv6_ospf6_border_routers_cmd,
14b16482 1041 "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
6452df09 1042 SHOW_STR
1043 IP6_STR
1044 OSPF6_STR
1045 "Display routing table for ABR and ASBR\n"
16cedbb0
QY
1046 "Router ID\n"
1047 "Show detailed output\n")
6452df09 1048{
d62a17ae 1049 int idx_ipv4 = 4;
1050 u_int32_t adv_router;
1051 struct ospf6_route *ro;
1052 struct prefix prefix;
1053
1054 OSPF6_CMD_CHECK_RUNNING();
1055
1056 if (argc == 5) {
1057 if (strmatch(argv[idx_ipv4]->text, "detail")) {
1058 for (ro = ospf6_route_head(ospf6->brouter_table); ro;
1059 ro = ospf6_route_next(ro))
1060 ospf6_route_show_detail(vty, ro);
1061 } else {
1062 inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router);
1063
1064 ospf6_linkstate_prefix(adv_router, 0, &prefix);
1065 ro = ospf6_route_lookup(&prefix, ospf6->brouter_table);
1066 if (!ro) {
1067 vty_out(vty,
1068 "No Route found for Router ID: %s\n",
1069 argv[4]->arg);
1070 return CMD_SUCCESS;
1071 }
1072
1073 ospf6_route_show_detail(vty, ro);
1074 return CMD_SUCCESS;
1075 }
1076 } else {
1077 ospf6_brouter_show_header(vty);
1078
1079 for (ro = ospf6_route_head(ospf6->brouter_table); ro;
1080 ro = ospf6_route_next(ro))
1081 ospf6_brouter_show(vty, ro);
1082 }
1083
1084 return CMD_SUCCESS;
6452df09 1085}
1086
6452df09 1087
4846ef64 1088DEFUN (show_ipv6_ospf6_linkstate,
1089 show_ipv6_ospf6_linkstate_cmd,
093d7a3a 1090 "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>",
4846ef64 1091 SHOW_STR
1092 IP6_STR
1093 OSPF6_STR
1094 "Display linkstate routing table\n"
093d7a3a
DW
1095 "Display Router Entry\n"
1096 "Specify Router ID as IPv4 address notation\n"
1097 "Display Network Entry\n"
1098 "Specify Router ID as IPv4 address notation\n"
3a2d747c 1099 "Specify Link state ID as IPv4 address notation\n")
4846ef64 1100{
2026b8af 1101 int idx_ipv4 = 5;
d62a17ae 1102 struct listnode *node;
1103 struct ospf6_area *oa;
4846ef64 1104
d62a17ae 1105 OSPF6_CMD_CHECK_RUNNING();
b52a8a52 1106
d62a17ae 1107 for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) {
1108 vty_out(vty, "\n SPF Result in Area %s\n\n", oa->name);
1109 ospf6_linkstate_table_show(vty, idx_ipv4, argc, argv,
1110 oa->spf_table);
1111 }
4846ef64 1112
d62a17ae 1113 vty_out(vty, "\n");
1114 return CMD_SUCCESS;
4846ef64 1115}
1116
4846ef64 1117
4846ef64 1118DEFUN (show_ipv6_ospf6_linkstate_detail,
1119 show_ipv6_ospf6_linkstate_detail_cmd,
1120 "show ipv6 ospf6 linkstate detail",
1121 SHOW_STR
1122 IP6_STR
1123 OSPF6_STR
1124 "Display linkstate routing table\n"
3a2d747c 1125 "Display detailed information\n")
4846ef64 1126{
d62a17ae 1127 int idx_detail = 4;
1128 struct listnode *node;
1129 struct ospf6_area *oa;
4846ef64 1130
d62a17ae 1131 OSPF6_CMD_CHECK_RUNNING();
b52a8a52 1132
d62a17ae 1133 for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) {
1134 vty_out(vty, "\n SPF Result in Area %s\n\n", oa->name);
1135 ospf6_linkstate_table_show(vty, idx_detail, argc, argv,
1136 oa->spf_table);
1137 }
4846ef64 1138
d62a17ae 1139 vty_out(vty, "\n");
1140 return CMD_SUCCESS;
4846ef64 1141}
6452df09 1142
427f8e61
DL
1143static void ospf6_plist_add(struct prefix_list *plist)
1144{
1145 if (prefix_list_afi(plist) != AFI_IP6)
1146 return;
1147 ospf6_area_plist_update(plist, 1);
1148}
1149
1150static void ospf6_plist_del(struct prefix_list *plist)
1151{
1152 if (prefix_list_afi(plist) != AFI_IP6)
1153 return;
1154 ospf6_area_plist_update(plist, 0);
1155}
1156
718e3744 1157/* Install ospf related commands. */
d62a17ae 1158void ospf6_init(void)
718e3744 1159{
d62a17ae 1160 ospf6_top_init();
1161 ospf6_area_init();
1162 ospf6_interface_init();
1163 ospf6_neighbor_init();
1164 ospf6_zebra_init(master);
1165
1166 ospf6_lsa_init();
1167 ospf6_spf_init();
1168 ospf6_intra_init();
1169 ospf6_asbr_init();
1170 ospf6_abr_init();
1171
427f8e61
DL
1172 prefix_list_add_hook(ospf6_plist_add);
1173 prefix_list_delete_hook(ospf6_plist_del);
1174
d62a17ae 1175 ospf6_bfd_init();
1176 install_node(&debug_node, config_write_ospf6_debug);
1177
1178 install_element_ospf6_debug_message();
1179 install_element_ospf6_debug_lsa();
1180 install_element_ospf6_debug_interface();
1181 install_element_ospf6_debug_neighbor();
1182 install_element_ospf6_debug_zebra();
1183 install_element_ospf6_debug_spf();
1184 install_element_ospf6_debug_route();
1185 install_element_ospf6_debug_brouter();
1186 install_element_ospf6_debug_asbr();
1187 install_element_ospf6_debug_abr();
1188 install_element_ospf6_debug_flood();
1189
1190 install_element_ospf6_clear_interface();
1191
87f6dc50
DS
1192 install_element(VIEW_NODE, &show_debugging_ospf6_cmd);
1193
d62a17ae 1194 install_element(VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
1195
1196 install_element(VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd);
1197 install_element(VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
1198
1199 install_element(VIEW_NODE, &show_ipv6_ospf6_database_cmd);
1200 install_element(VIEW_NODE, &show_ipv6_ospf6_database_type_cmd);
1201 install_element(VIEW_NODE, &show_ipv6_ospf6_database_id_cmd);
1202 install_element(VIEW_NODE, &show_ipv6_ospf6_database_router_cmd);
1203 install_element(VIEW_NODE, &show_ipv6_ospf6_database_type_id_cmd);
1204 install_element(VIEW_NODE, &show_ipv6_ospf6_database_type_router_cmd);
1205 install_element(VIEW_NODE,
1206 &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd);
1207 install_element(VIEW_NODE, &show_ipv6_ospf6_database_id_router_cmd);
1208 install_element(VIEW_NODE,
1209 &show_ipv6_ospf6_database_type_id_router_cmd);
1210 install_element(
1211 VIEW_NODE,
1212 &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd);
1213 install_element(VIEW_NODE,
1214 &show_ipv6_ospf6_database_self_originated_cmd);
1215 install_element(VIEW_NODE,
1216 &show_ipv6_ospf6_database_type_self_originated_cmd);
1217 install_element(VIEW_NODE,
1218 &show_ipv6_ospf6_database_type_id_self_originated_cmd);
1219 install_element(
1220 VIEW_NODE,
1221 &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd);
1222
1223 /* Make ospf protocol socket. */
1224 ospf6_serv_sock();
1225 thread_add_read(master, ospf6_receive, NULL, ospf6_sock, NULL);
92300491
DW
1226}
1227
d62a17ae 1228void ospf6_clean(void)
92300491 1229{
d62a17ae 1230 if (!ospf6)
1231 return;
1232 if (ospf6->route_table)
1233 ospf6_route_remove_all(ospf6->route_table);
1234 if (ospf6->brouter_table)
1235 ospf6_route_remove_all(ospf6->brouter_table);
92300491 1236}