]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6d.c
vtysh: fix some macro breakage
[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 Link state database\n"
819 "Display Self-originated LSAs\n"
820 "Display details of LSAs\n"
821 "Dump LSAs\n"
822 "Display LSA's internal information\n")
823 {
824 int idx_level = 5;
825 int level;
826 struct listnode *i, *j;
827 struct ospf6 *o = ospf6;
828 struct ospf6_area *oa;
829 struct ospf6_interface *oi;
830 u_int32_t adv_router = 0;
831
832 OSPF6_CMD_CHECK_RUNNING ();
833 level = parse_show_level (idx_level, argc, argv);
834 adv_router = o->router_id;
835
836 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
837 {
838 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
839 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
840 }
841
842 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
843 {
844 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
845 {
846 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
847 oi->interface->name, oa->name, VNL, VNL);
848 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
849 }
850 }
851
852 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
853 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
854
855 vty_out (vty, "%s", VNL);
856 return CMD_SUCCESS;
857 }
858
859
860 DEFUN (show_ipv6_ospf6_database_type_self_originated,
861 show_ipv6_ospf6_database_type_self_originated_cmd,
862 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]",
863 SHOW_STR
864 IPV6_STR
865 OSPF6_STR
866 "Display Link state database\n"
867 "Display Router LSAs\n"
868 "Display Network LSAs\n"
869 "Display Inter-Area-Prefix LSAs\n"
870 "Display Inter-Area-Router LSAs\n"
871 "Display As-External LSAs\n"
872 "Display Group-Membership LSAs\n"
873 "Display Type-7 LSAs\n"
874 "Display Link LSAs\n"
875 "Display Intra-Area-Prefix LSAs\n"
876 "Display Self-originated LSAs\n"
877 "Display details of LSAs\n"
878 "Dump LSAs\n"
879 "Display LSA's internal information\n")
880 {
881 int idx_lsa = 4;
882 int idx_level = 6;
883 int level;
884 struct listnode *i, *j;
885 struct ospf6 *o = ospf6;
886 struct ospf6_area *oa;
887 struct ospf6_interface *oi;
888 u_int16_t type = 0;
889 u_int32_t adv_router = 0;
890
891 OSPF6_CMD_CHECK_RUNNING ();
892
893 type = parse_type_spec (idx_lsa, argc, argv);
894 level = parse_show_level (idx_level, argc, argv);
895
896 adv_router = o->router_id;
897
898 switch (OSPF6_LSA_SCOPE (type))
899 {
900 case OSPF6_SCOPE_AREA:
901 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
902 {
903 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
904 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
905 }
906 break;
907
908 case OSPF6_SCOPE_LINKLOCAL:
909 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
910 {
911 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
912 {
913 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
914 oi->interface->name, oa->name, VNL, VNL);
915 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
916 }
917 }
918 break;
919
920 case OSPF6_SCOPE_AS:
921 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
922 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
923 break;
924
925 default:
926 assert (0);
927 break;
928 }
929
930 vty_out (vty, "%s", VNL);
931 return CMD_SUCCESS;
932 }
933
934 DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
935 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
936 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated linkstate-id A.B.C.D [<detail|dump|internal>]",
937 SHOW_STR
938 IPV6_STR
939 OSPF6_STR
940 "Display Link state database\n"
941 "Display Router LSAs\n"
942 "Display Network LSAs\n"
943 "Display Inter-Area-Prefix LSAs\n"
944 "Display Inter-Area-Router LSAs\n"
945 "Display As-External LSAs\n"
946 "Display Group-Membership LSAs\n"
947 "Display Type-7 LSAs\n"
948 "Display Link LSAs\n"
949 "Display Intra-Area-Prefix LSAs\n"
950 "Display Self-originated LSAs\n"
951 "Search by Link state ID\n"
952 "Specify Link state ID as IPv4 address notation\n"
953 "Display details of LSAs\n"
954 "Dump LSAs\n"
955 "Display LSA's internal information\n")
956 {
957 int idx_lsa = 4;
958 int idx_ls_id = 7;
959 int idx_level = 8;
960 int level;
961 struct listnode *i, *j;
962 struct ospf6 *o = ospf6;
963 struct ospf6_area *oa;
964 struct ospf6_interface *oi;
965 u_int16_t type = 0;
966 u_int32_t adv_router = 0;
967 u_int32_t id = 0;
968
969 OSPF6_CMD_CHECK_RUNNING ();
970
971 type = parse_type_spec (idx_lsa, argc, argv);
972 inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
973 level = parse_show_level (idx_level, argc, argv);
974 adv_router = o->router_id;
975
976 switch (OSPF6_LSA_SCOPE (type))
977 {
978 case OSPF6_SCOPE_AREA:
979 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
980 {
981 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
982 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
983 }
984 break;
985
986 case OSPF6_SCOPE_LINKLOCAL:
987 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
988 {
989 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
990 {
991 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
992 oi->interface->name, oa->name, VNL, VNL);
993 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
994 }
995 }
996 break;
997
998 case OSPF6_SCOPE_AS:
999 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1000 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1001 break;
1002
1003 default:
1004 assert (0);
1005 break;
1006 }
1007
1008 vty_out (vty, "%s", VNL);
1009 return CMD_SUCCESS;
1010 }
1011
1012 DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
1013 show_ipv6_ospf6_database_type_id_self_originated_cmd,
1014 "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D self-originated [<detail|dump|internal>]",
1015 SHOW_STR
1016 IPV6_STR
1017 OSPF6_STR
1018 "Display Link state database\n"
1019 "Display Router LSAs\n"
1020 "Display Network LSAs\n"
1021 "Display Inter-Area-Prefix LSAs\n"
1022 "Display Inter-Area-Router LSAs\n"
1023 "Display As-External LSAs\n"
1024 "Display Group-Membership LSAs\n"
1025 "Display Type-7 LSAs\n"
1026 "Display Link LSAs\n"
1027 "Display Intra-Area-Prefix LSAs\n"
1028 "Specify Link state ID as IPv4 address notation\n"
1029 "Display Self-originated LSAs\n"
1030 "Display details of LSAs\n"
1031 "Dump LSAs\n"
1032 "Display LSA's internal information\n")
1033 {
1034 int idx_lsa = 4;
1035 int idx_ls_id = 5;
1036 int idx_level = 7;
1037 int level;
1038 struct listnode *i, *j;
1039 struct ospf6 *o = ospf6;
1040 struct ospf6_area *oa;
1041 struct ospf6_interface *oi;
1042 u_int16_t type = 0;
1043 u_int32_t adv_router = 0;
1044 u_int32_t id = 0;
1045
1046 OSPF6_CMD_CHECK_RUNNING ();
1047
1048 type = parse_type_spec (idx_lsa, argc, argv);
1049 inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
1050 level = parse_show_level (idx_level, argc, argv);
1051 adv_router = o->router_id;
1052
1053 switch (OSPF6_LSA_SCOPE (type))
1054 {
1055 case OSPF6_SCOPE_AREA:
1056 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1057 {
1058 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1059 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1060 }
1061 break;
1062
1063 case OSPF6_SCOPE_LINKLOCAL:
1064 for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
1065 {
1066 for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
1067 {
1068 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1069 oi->interface->name, oa->name, VNL, VNL);
1070 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1071 }
1072 }
1073 break;
1074
1075 case OSPF6_SCOPE_AS:
1076 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1077 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1078 break;
1079
1080 default:
1081 assert (0);
1082 break;
1083 }
1084
1085 vty_out (vty, "%s", VNL);
1086 return CMD_SUCCESS;
1087 }
1088
1089 DEFUN (show_ipv6_ospf6_border_routers,
1090 show_ipv6_ospf6_border_routers_cmd,
1091 "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
1092 SHOW_STR
1093 IP6_STR
1094 OSPF6_STR
1095 "Display routing table for ABR and ASBR\n"
1096 "Router ID\n"
1097 "Show detailed output\n")
1098 {
1099 int idx_ipv4 = 4;
1100 u_int32_t adv_router;
1101 struct ospf6_route *ro;
1102 struct prefix prefix;
1103
1104 OSPF6_CMD_CHECK_RUNNING ();
1105
1106 if (argc == 5)
1107 {
1108 if (strmatch (argv[idx_ipv4]->text, "detail"))
1109 {
1110 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1111 ro = ospf6_route_next (ro))
1112 ospf6_route_show_detail (vty, ro);
1113 }
1114 else
1115 {
1116 inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router);
1117
1118 ospf6_linkstate_prefix (adv_router, 0, &prefix);
1119 ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
1120 if (!ro)
1121 {
1122 vty_out (vty, "No Route found for Router ID: %s%s", argv[4]->arg, VNL);
1123 return CMD_SUCCESS;
1124 }
1125
1126 ospf6_route_show_detail (vty, ro);
1127 return CMD_SUCCESS;
1128 }
1129 }
1130 else
1131 {
1132 ospf6_brouter_show_header (vty);
1133
1134 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1135 ro = ospf6_route_next (ro))
1136 ospf6_brouter_show (vty, ro);
1137 }
1138
1139 return CMD_SUCCESS;
1140 }
1141
1142
1143 DEFUN (show_ipv6_ospf6_linkstate,
1144 show_ipv6_ospf6_linkstate_cmd,
1145 "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>",
1146 SHOW_STR
1147 IP6_STR
1148 OSPF6_STR
1149 "Display linkstate routing table\n"
1150 "Display Router Entry\n"
1151 "Specify Router ID as IPv4 address notation\n"
1152 "Display Network Entry\n"
1153 "Specify Router ID as IPv4 address notation\n"
1154 "Specify Link state ID as IPv4 address notation\n"
1155 )
1156 {
1157 int idx_ipv4 = 4;
1158 struct listnode *node;
1159 struct ospf6_area *oa;
1160
1161 OSPF6_CMD_CHECK_RUNNING ();
1162
1163 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
1164 {
1165 vty_out (vty, "%s SPF Result in Area %s%s%s",
1166 VNL, oa->name, VNL, VNL);
1167 ospf6_linkstate_table_show (vty, idx_ipv4, argc, argv, oa->spf_table);
1168 }
1169
1170 vty_out (vty, "%s", VNL);
1171 return CMD_SUCCESS;
1172 }
1173
1174
1175
1176 DEFUN (show_ipv6_ospf6_linkstate_detail,
1177 show_ipv6_ospf6_linkstate_detail_cmd,
1178 "show ipv6 ospf6 linkstate detail",
1179 SHOW_STR
1180 IP6_STR
1181 OSPF6_STR
1182 "Display linkstate routing table\n"
1183 )
1184 {
1185 int idx_detail = 4;
1186 struct listnode *node;
1187 struct ospf6_area *oa;
1188
1189 OSPF6_CMD_CHECK_RUNNING ();
1190
1191 for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
1192 {
1193 vty_out (vty, "%s SPF Result in Area %s%s%s",
1194 VNL, oa->name, VNL, VNL);
1195 ospf6_linkstate_table_show (vty, idx_detail, argc, argv, oa->spf_table);
1196 }
1197
1198 vty_out (vty, "%s", VNL);
1199 return CMD_SUCCESS;
1200 }
1201
1202 /* Install ospf related commands. */
1203 void
1204 ospf6_init (void)
1205 {
1206 ospf6_top_init ();
1207 ospf6_area_init ();
1208 ospf6_interface_init ();
1209 ospf6_neighbor_init ();
1210 ospf6_zebra_init(master);
1211
1212 ospf6_lsa_init ();
1213 ospf6_spf_init ();
1214 ospf6_intra_init ();
1215 ospf6_asbr_init ();
1216 ospf6_abr_init ();
1217
1218 #ifdef HAVE_SNMP
1219 ospf6_snmp_init (master);
1220 #endif /*HAVE_SNMP*/
1221
1222 ospf6_bfd_init();
1223 install_node (&debug_node, config_write_ospf6_debug);
1224
1225 install_element_ospf6_debug_message ();
1226 install_element_ospf6_debug_lsa ();
1227 install_element_ospf6_debug_interface ();
1228 install_element_ospf6_debug_neighbor ();
1229 install_element_ospf6_debug_zebra ();
1230 install_element_ospf6_debug_spf ();
1231 install_element_ospf6_debug_route ();
1232 install_element_ospf6_debug_brouter ();
1233 install_element_ospf6_debug_asbr ();
1234 install_element_ospf6_debug_abr ();
1235 install_element_ospf6_debug_flood ();
1236
1237 install_element_ospf6_clear_interface ();
1238
1239 install_element (VIEW_NODE, &show_version_ospf6_cmd);
1240
1241 install_element (VIEW_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
1246 install_element (VIEW_NODE, &show_ipv6_ospf6_database_cmd);
1247 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_cmd);
1248 install_element (VIEW_NODE, &show_ipv6_ospf6_database_id_cmd);
1249 install_element (VIEW_NODE, &show_ipv6_ospf6_database_router_cmd);
1250 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_id_cmd);
1251 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_router_cmd);
1252 install_element (VIEW_NODE, &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd);
1253 install_element (VIEW_NODE, &show_ipv6_ospf6_database_id_router_cmd);
1254 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_id_router_cmd);
1255 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd);
1256 install_element (VIEW_NODE, &show_ipv6_ospf6_database_self_originated_cmd);
1257 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_self_originated_cmd);
1258 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_id_self_originated_cmd);
1259 install_element (VIEW_NODE, &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd);
1260
1261 /* Make ospf protocol socket. */
1262 ospf6_serv_sock ();
1263 thread_add_read (master, ospf6_receive, NULL, ospf6_sock);
1264 }
1265
1266 void
1267 ospf6_clean (void)
1268 {
1269 if (!ospf6)
1270 return;
1271 if (ospf6->route_table)
1272 ospf6_route_remove_all (ospf6->route_table);
1273 if (ospf6->brouter_table)
1274 ospf6_route_remove_all (ospf6->brouter_table);
1275 }