]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6d.c
all: removed all DEFUN command stomps
[mirror_frr.git] / ospf6d / ospf6d.c
1 /*
2 * Copyright (C) 2003 Yasuhiro Ohara
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 *
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.
20 */
21
22 #include <zebra.h>
23
24 #include "thread.h"
25 #include "linklist.h"
26 #include "vty.h"
27 #include "command.h"
28
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"
45 #include "ospf6d.h"
46 #include "ospf6_bfd.h"
47
48 #ifdef HAVE_SNMP
49 #include "ospf6_snmp.h"
50 #endif /*HAVE_SNMP*/
51
52 char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION;
53
54 struct route_node *
55 route_prev (struct route_node *node)
56 {
57 struct route_node *end;
58 struct route_node *prev = NULL;
59
60 end = node;
61 node = node->parent;
62 if (node)
63 route_lock_node (node);
64 while (node)
65 {
66 prev = node;
67 node = route_next (node);
68 if (node == end)
69 {
70 route_unlock_node (node);
71 node = NULL;
72 }
73 }
74 route_unlock_node (end);
75 if (prev)
76 route_lock_node (prev);
77
78 return prev;
79 }
80
81
82 /* show database functions */
83 DEFUN (show_version_ospf6,
84 show_version_ospf6_cmd,
85 "show version ospf6",
86 SHOW_STR
87 "Displays ospf6d version\n"
88 )
89 {
90 vty_out (vty, "Zebra OSPF6d Version: %s%s",
91 ospf6_daemon_version, VNL);
92
93 return CMD_SUCCESS;
94 }
95
96 static struct cmd_node debug_node =
97 {
98 DEBUG_NODE,
99 "",
100 1 /* VTYSH */
101 };
102
103 static int
104 config_write_ospf6_debug (struct vty *vty)
105 {
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);
118 return 0;
119 }
120
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"
127
128 static int
129 parse_show_level (int idx_level, int argc, struct cmd_token **argv)
130 {
131 int level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
132
133 if (argc > idx_level)
134 {
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;
141 }
142
143 return level;
144 }
145
146 static u_int16_t
147 parse_type_spec (int idx_lsa, int argc, struct cmd_token **argv)
148 {
149 u_int16_t type = 0;
150
151 if (argc > idx_lsa)
152 {
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);
167 }
168
169 return type;
170 }
171
172 DEFUN (show_ipv6_ospf6_database,
173 show_ipv6_ospf6_database_cmd,
174 "show ipv6 ospf6 database [<detail|dump|internal>]",
175 SHOW_STR
176 IPV6_STR
177 OSPF6_STR
178 "Display Link state database\n"
179 "Display details of LSAs\n"
180 "Dump LSAs\n"
181 "Display LSA's internal information\n")
182 {
183 int idx_level = 4;
184 int level;
185 struct listnode *i, *j;
186 struct ospf6 *o = ospf6;
187 struct ospf6_area *oa;
188 struct ospf6_interface *oi;
189
190 OSPF6_CMD_CHECK_RUNNING ();
191
192 level = parse_show_level (idx_level, argc, argv);
193
194 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
195 {
196 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
197 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oa->lsdb);
198 }
199
200 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
201 {
202 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
203 {
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);
207 }
208 }
209
210 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
211 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, o->lsdb);
212
213 vty_out (vty, "%s", VNL);
214 return CMD_SUCCESS;
215 }
216
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>]",
220 SHOW_STR
221 IPV6_STR
222 OSPF6_STR
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"
234 "Dump LSAs\n"
235 "Display LSA's internal information\n"
236 )
237 {
238 int idx_lsa = 4;
239 int idx_level = 5;
240 int level;
241 struct listnode *i, *j;
242 struct ospf6 *o = ospf6;
243 struct ospf6_area *oa;
244 struct ospf6_interface *oi;
245 u_int16_t type = 0;
246
247 OSPF6_CMD_CHECK_RUNNING ();
248
249 type = parse_type_spec (idx_lsa, argc, argv);
250 level = parse_show_level (idx_level, argc, argv);
251
252 switch (OSPF6_LSA_SCOPE (type))
253 {
254 case OSPF6_SCOPE_AREA:
255 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
256 {
257 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
258 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oa->lsdb);
259 }
260 break;
261
262 case OSPF6_SCOPE_LINKLOCAL:
263 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
264 {
265 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
266 {
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);
270 }
271 }
272 break;
273
274 case OSPF6_SCOPE_AS:
275 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
276 ospf6_lsdb_show (vty, level, &type, NULL, NULL, o->lsdb);
277 break;
278
279 default:
280 assert (0);
281 break;
282 }
283
284 vty_out (vty, "%s", VNL);
285 return CMD_SUCCESS;
286 }
287
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>]",
291 SHOW_STR
292 IPV6_STR
293 OSPF6_STR
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"
299 "Dump LSAs\n"
300 "Display LSA's internal information\n")
301 {
302 int idx_ipv4 = 4;
303 int idx_level = 6;
304 int level;
305 struct listnode *i, *j;
306 struct ospf6 *o = ospf6;
307 struct ospf6_area *oa;
308 struct ospf6_interface *oi;
309 u_int32_t id = 0;
310
311 OSPF6_CMD_CHECK_RUNNING ();
312
313 if (argv[idx_ipv4]->type == IPV4_TKN)
314 inet_pton (AF_INET, argv[idx_ipv4]->arg, &id);
315
316 level = parse_show_level (idx_level, argc, argv);
317
318 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
319 {
320 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
321 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oa->lsdb);
322 }
323
324 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
325 {
326 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
327 {
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);
331 }
332 }
333
334 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
335 ospf6_lsdb_show (vty, level, NULL, &id, NULL, o->lsdb);
336
337 vty_out (vty, "%s", VNL);
338 return CMD_SUCCESS;
339 }
340
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>",
344 SHOW_STR
345 IPV6_STR
346 OSPF6_STR
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"
353 "Dump LSAs\n"
354 "Display LSA's internal information\n")
355 {
356 int idx_ipv4 = 6;
357 int idx_level = 7;
358 int level;
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;
364
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);
368
369 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
370 {
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);
373 }
374
375 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
376 {
377 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
378 {
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);
382 }
383 }
384
385 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
386 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
387
388 vty_out (vty, "%s", VNL);
389 return CMD_SUCCESS;
390 }
391
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>]",
395 SHOW_STR
396 IPV6_STR
397 OSPF6_STR
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"
411 "Dump LSAs\n"
412 "Display LSA's internal information\n"
413 )
414 {
415 int idx_lsa = 4;
416 int idx_ipv4 = 6;
417 int idx_level = 7;
418 int level;
419 struct listnode *i, *j;
420 struct ospf6 *o = ospf6;
421 struct ospf6_area *oa;
422 struct ospf6_interface *oi;
423 u_int16_t type = 0;
424 u_int32_t id = 0;
425
426 OSPF6_CMD_CHECK_RUNNING ();
427
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);
431
432 switch (OSPF6_LSA_SCOPE (type))
433 {
434 case OSPF6_SCOPE_AREA:
435 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
436 {
437 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
438 ospf6_lsdb_show (vty, level, &type, &id, NULL, oa->lsdb);
439 }
440 break;
441
442 case OSPF6_SCOPE_LINKLOCAL:
443 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
444 {
445 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
446 {
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);
450 }
451 }
452 break;
453
454 case OSPF6_SCOPE_AS:
455 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
456 ospf6_lsdb_show (vty, level, &type, &id, NULL, o->lsdb);
457 break;
458
459 default:
460 assert (0);
461 break;
462 }
463
464 vty_out (vty, "%s", VNL);
465 return CMD_SUCCESS;
466 }
467
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>]",
471 SHOW_STR
472 IPV6_STR
473 OSPF6_STR
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"
488 "Dump LSAs\n"
489 "Display LSA's internal information\n"
490 )
491 {
492 int idx_lsa = 4;
493 int idx_ipv4 = 6;
494 int idx_level = 7;
495 int level;
496 struct listnode *i, *j;
497 struct ospf6 *o = ospf6;
498 struct ospf6_area *oa;
499 struct ospf6_interface *oi;
500 u_int16_t type = 0;
501 u_int32_t adv_router = 0;
502
503 OSPF6_CMD_CHECK_RUNNING ();
504
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);
508
509 switch (OSPF6_LSA_SCOPE (type))
510 {
511 case OSPF6_SCOPE_AREA:
512 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
513 {
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);
516 }
517 break;
518
519 case OSPF6_SCOPE_LINKLOCAL:
520 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
521 {
522 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
523 {
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);
527 }
528 }
529 break;
530
531 case OSPF6_SCOPE_AS:
532 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
533 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
534 break;
535
536 default:
537 assert (0);
538 break;
539 }
540
541 vty_out (vty, "%s", VNL);
542 return CMD_SUCCESS;
543 }
544
545
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>]",
549 SHOW_STR
550 IPV6_STR
551 OSPF6_STR
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"
557 "Dump LSAs\n"
558 "Display LSA's internal information\n"
559 )
560 {
561 int idx_ls_id = 5;
562 int idx_adv_rtr = 6;
563 int idx_level = 7;
564 int level;
565 struct listnode *i, *j;
566 struct ospf6 *o = ospf6;
567 struct ospf6_area *oa;
568 struct ospf6_interface *oi;
569 u_int32_t id = 0;
570 u_int32_t adv_router = 0;
571
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);
576
577 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
578 {
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);
581 }
582
583 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
584 {
585 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
586 {
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);
590 }
591 }
592
593 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
594 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
595
596 vty_out (vty, "%s", VNL);
597 return CMD_SUCCESS;
598 }
599
600
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>]",
604 SHOW_STR
605 IPV6_STR
606 OSPF6_STR
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"
613 "Dump LSAs\n"
614 "Display LSA's internal information\n")
615 {
616 int idx_adv_rtr = 5;
617 int idx_ls_id = 7;
618 int idx_level = 8;
619 int level;
620 struct listnode *i, *j;
621 struct ospf6 *o = ospf6;
622 struct ospf6_area *oa;
623 struct ospf6_interface *oi;
624 u_int32_t id = 0;
625 u_int32_t adv_router = 0;
626
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);
631
632 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
633 {
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);
636 }
637
638 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
639 {
640 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
641 {
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);
645 }
646 }
647
648 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
649 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
650
651 vty_out (vty, "%s", VNL);
652 return CMD_SUCCESS;
653 }
654
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>]",
658 SHOW_STR
659 IPV6_STR
660 OSPF6_STR
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"
673 "Dump LSAs\n"
674 "Display LSA's internal information\n")
675 {
676 int idx_lsa = 4;
677 int idx_ls_id = 5;
678 int idx_adv_rtr = 6;
679 int idx_level = 7;
680 int level;
681 struct listnode *i, *j;
682 struct ospf6 *o = ospf6;
683 struct ospf6_area *oa;
684 struct ospf6_interface *oi;
685 u_int16_t type = 0;
686 u_int32_t id = 0;
687 u_int32_t adv_router = 0;
688
689 OSPF6_CMD_CHECK_RUNNING ();
690
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);
695
696 switch (OSPF6_LSA_SCOPE (type))
697 {
698 case OSPF6_SCOPE_AREA:
699 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
700 {
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);
703 }
704 break;
705
706 case OSPF6_SCOPE_LINKLOCAL:
707 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
708 {
709 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
710 {
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);
714 }
715 }
716 break;
717
718 case OSPF6_SCOPE_AS:
719 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
720 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
721 break;
722
723 default:
724 assert (0);
725 break;
726 }
727
728 vty_out (vty, "%s", VNL);
729 return CMD_SUCCESS;
730 }
731
732
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>]",
736 SHOW_STR
737 IPV6_STR
738 OSPF6_STR
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"
753 "Dump LSAs\n"
754 "Display LSA's internal information\n")
755 {
756 int idx_lsa = 4;
757 int idx_adv_rtr = 6;
758 int idx_ls_id = 8;
759 int idx_level = 9;
760 int level;
761 struct listnode *i, *j;
762 struct ospf6 *o = ospf6;
763 struct ospf6_area *oa;
764 struct ospf6_interface *oi;
765 u_int16_t type = 0;
766 u_int32_t id = 0;
767 u_int32_t adv_router = 0;
768
769 OSPF6_CMD_CHECK_RUNNING ();
770
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);
775
776 switch (OSPF6_LSA_SCOPE (type))
777 {
778 case OSPF6_SCOPE_AREA:
779 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
780 {
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);
783 }
784 break;
785
786 case OSPF6_SCOPE_LINKLOCAL:
787 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
788 {
789 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
790 {
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);
794 }
795 }
796 break;
797
798 case OSPF6_SCOPE_AS:
799 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
800 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
801 break;
802
803 default:
804 assert (0);
805 break;
806 }
807
808 vty_out (vty, "%s", VNL);
809 return CMD_SUCCESS;
810 }
811
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>]",
815 SHOW_STR
816 IPV6_STR
817 OSPF6_STR
818 "Display Self-originated LSAs\n"
819 "Display details of LSAs\n"
820 "Dump LSAs\n"
821 "Display LSA's internal information\n")
822 {
823 int idx_level = 5;
824 int level;
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;
830
831 OSPF6_CMD_CHECK_RUNNING ();
832 level = parse_show_level (idx_level, argc, argv);
833 adv_router = o->router_id;
834
835 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
836 {
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);
839 }
840
841 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
842 {
843 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
844 {
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);
848 }
849 }
850
851 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
852 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
853
854 vty_out (vty, "%s", VNL);
855 return CMD_SUCCESS;
856 }
857
858
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>]",
862 SHOW_STR
863 IPV6_STR
864 OSPF6_STR
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"
877 "Dump LSAs\n"
878 "Display LSA's internal information\n")
879 {
880 int idx_lsa = 4;
881 int idx_level = 6;
882 int level;
883 struct listnode *i, *j;
884 struct ospf6 *o = ospf6;
885 struct ospf6_area *oa;
886 struct ospf6_interface *oi;
887 u_int16_t type = 0;
888 u_int32_t adv_router = 0;
889
890 OSPF6_CMD_CHECK_RUNNING ();
891
892 type = parse_type_spec (idx_lsa, argc, argv);
893 level = parse_show_level (idx_level, argc, argv);
894
895 adv_router = o->router_id;
896
897 switch (OSPF6_LSA_SCOPE (type))
898 {
899 case OSPF6_SCOPE_AREA:
900 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
901 {
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);
904 }
905 break;
906
907 case OSPF6_SCOPE_LINKLOCAL:
908 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
909 {
910 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
911 {
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);
915 }
916 }
917 break;
918
919 case OSPF6_SCOPE_AS:
920 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
921 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
922 break;
923
924 default:
925 assert (0);
926 break;
927 }
928
929 vty_out (vty, "%s", VNL);
930 return CMD_SUCCESS;
931 }
932
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>]",
936 SHOW_STR
937 IPV6_STR
938 OSPF6_STR
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"
953 "Dump LSAs\n"
954 "Display LSA's internal information\n")
955 {
956 int idx_lsa = 4;
957 int idx_ls_id = 7;
958 int idx_level = 8;
959 int level;
960 struct listnode *i, *j;
961 struct ospf6 *o = ospf6;
962 struct ospf6_area *oa;
963 struct ospf6_interface *oi;
964 u_int16_t type = 0;
965 u_int32_t adv_router = 0;
966 u_int32_t id = 0;
967
968 OSPF6_CMD_CHECK_RUNNING ();
969
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;
974
975 switch (OSPF6_LSA_SCOPE (type))
976 {
977 case OSPF6_SCOPE_AREA:
978 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
979 {
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);
982 }
983 break;
984
985 case OSPF6_SCOPE_LINKLOCAL:
986 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
987 {
988 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
989 {
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);
993 }
994 }
995 break;
996
997 case OSPF6_SCOPE_AS:
998 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
999 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1000 break;
1001
1002 default:
1003 assert (0);
1004 break;
1005 }
1006
1007 vty_out (vty, "%s", VNL);
1008 return CMD_SUCCESS;
1009 }
1010
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>]",
1014 SHOW_STR
1015 IPV6_STR
1016 OSPF6_STR
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"
1030 "Dump LSAs\n"
1031 "Display LSA's internal information\n")
1032 {
1033 int idx_lsa = 4;
1034 int idx_ls_id = 5;
1035 int idx_level = 7;
1036 int level;
1037 struct listnode *i, *j;
1038 struct ospf6 *o = ospf6;
1039 struct ospf6_area *oa;
1040 struct ospf6_interface *oi;
1041 u_int16_t type = 0;
1042 u_int32_t adv_router = 0;
1043 u_int32_t id = 0;
1044
1045 OSPF6_CMD_CHECK_RUNNING ();
1046
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;
1051
1052 switch (OSPF6_LSA_SCOPE (type))
1053 {
1054 case OSPF6_SCOPE_AREA:
1055 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1056 {
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);
1059 }
1060 break;
1061
1062 case OSPF6_SCOPE_LINKLOCAL:
1063 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1064 {
1065 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1066 {
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);
1070 }
1071 }
1072 break;
1073
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);
1077 break;
1078
1079 default:
1080 assert (0);
1081 break;
1082 }
1083
1084 vty_out (vty, "%s", VNL);
1085 return CMD_SUCCESS;
1086 }
1087
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>]",
1091 SHOW_STR
1092 IP6_STR
1093 OSPF6_STR
1094 "Display routing table for ABR and ASBR\n"
1095 )
1096 {
1097 int idx_ipv4 = 4;
1098 u_int32_t adv_router;
1099 struct ospf6_route *ro;
1100 struct prefix prefix;
1101
1102 OSPF6_CMD_CHECK_RUNNING ();
1103
1104 if (argc == 5)
1105 {
1106 if (strmatch (argv[idx_ipv4]->text, "detail"))
1107 {
1108 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1109 ro = ospf6_route_next (ro))
1110 ospf6_route_show_detail (vty, ro);
1111 }
1112 else
1113 {
1114 inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router);
1115
1116 ospf6_linkstate_prefix (adv_router, 0, &prefix);
1117 ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
1118 if (!ro)
1119 {
1120 vty_out (vty, "No Route found for Router ID: %s%s", argv[4]->arg, VNL);
1121 return CMD_SUCCESS;
1122 }
1123
1124 ospf6_route_show_detail (vty, ro);
1125 return CMD_SUCCESS;
1126 }
1127 }
1128 else
1129 {
1130 ospf6_brouter_show_header (vty);
1131
1132 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1133 ro = ospf6_route_next (ro))
1134 ospf6_brouter_show (vty, ro);
1135 }
1136
1137 return CMD_SUCCESS;
1138 }
1139
1140
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>",
1144 SHOW_STR
1145 IP6_STR
1146 OSPF6_STR
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"
1153 )
1154 {
1155 int idx_ipv4 = 4;
1156 struct listnode *node;
1157 struct ospf6_area *oa;
1158
1159 OSPF6_CMD_CHECK_RUNNING ();
1160
1161 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
1162 {
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);
1166 }
1167
1168 vty_out (vty, "%s", VNL);
1169 return CMD_SUCCESS;
1170 }
1171
1172
1173
1174 DEFUN (show_ipv6_ospf6_linkstate_detail,
1175 show_ipv6_ospf6_linkstate_detail_cmd,
1176 "show ipv6 ospf6 linkstate detail",
1177 SHOW_STR
1178 IP6_STR
1179 OSPF6_STR
1180 "Display linkstate routing table\n"
1181 )
1182 {
1183 int idx_detail = 4;
1184 struct listnode *node;
1185 struct ospf6_area *oa;
1186
1187 OSPF6_CMD_CHECK_RUNNING ();
1188
1189 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
1190 {
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);
1194 }
1195
1196 vty_out (vty, "%s", VNL);
1197 return CMD_SUCCESS;
1198 }
1199
1200 /* Install ospf related commands. */
1201 void
1202 ospf6_init (void)
1203 {
1204 ospf6_top_init ();
1205 ospf6_area_init ();
1206 ospf6_interface_init ();
1207 ospf6_neighbor_init ();
1208 ospf6_zebra_init(master);
1209
1210 ospf6_lsa_init ();
1211 ospf6_spf_init ();
1212 ospf6_intra_init ();
1213 ospf6_asbr_init ();
1214 ospf6_abr_init ();
1215
1216 #ifdef HAVE_SNMP
1217 ospf6_snmp_init (master);
1218 #endif /*HAVE_SNMP*/
1219
1220 ospf6_bfd_init();
1221 install_node (&debug_node, config_write_ospf6_debug);
1222
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 ();
1234
1235 install_element_ospf6_clear_interface ();
1236
1237 install_element (VIEW_NODE, &show_version_ospf6_cmd);
1238 install_element (ENABLE_NODE, &show_version_ospf6_cmd);
1239
1240 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
1241 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_cmd);
1242
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);
1247
1248 #define INSTALL(n,c) \
1249 install_element (n ## _NODE, &show_ipv6_ospf6_ ## c)
1250
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);
1265
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);
1280
1281 /* Make ospf protocol socket. */
1282 ospf6_serv_sock ();
1283 thread_add_read (master, ospf6_receive, NULL, ospf6_sock);
1284 }
1285
1286 void
1287 ospf6_clean (void)
1288 {
1289 if (!ospf6)
1290 return;
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);
1295 }