Import Upstream version 1.2.2
[quagga-debian.git] / ospf6d / ospf6_top.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 "log.h"
25 #include "memory.h"
26 #include "vty.h"
27 #include "linklist.h"
28 #include "prefix.h"
29 #include "table.h"
30 #include "thread.h"
31 #include "command.h"
32
33 #include "ospf6_proto.h"
34 #include "ospf6_message.h"
35 #include "ospf6_lsa.h"
36 #include "ospf6_lsdb.h"
37 #include "ospf6_route.h"
38 #include "ospf6_zebra.h"
39
40 #include "ospf6_top.h"
41 #include "ospf6_area.h"
42 #include "ospf6_interface.h"
43 #include "ospf6_neighbor.h"
44
45 #include "ospf6_flood.h"
46 #include "ospf6_asbr.h"
47 #include "ospf6_abr.h"
48 #include "ospf6_intra.h"
49 #include "ospf6_spf.h"
50 #include "ospf6d.h"
51
52 /* global ospf6d variable */
53 struct ospf6 *ospf6;
54
55 static void ospf6_disable (struct ospf6 *o);
56
57 static void
58 ospf6_top_lsdb_hook_add (struct ospf6_lsa *lsa)
59 {
60   switch (ntohs (lsa->header->type))
61     {
62       case OSPF6_LSTYPE_AS_EXTERNAL:
63         ospf6_asbr_lsa_add (lsa);
64         break;
65
66       default:
67         break;
68     }
69 }
70
71 static void
72 ospf6_top_lsdb_hook_remove (struct ospf6_lsa *lsa)
73 {
74   switch (ntohs (lsa->header->type))
75     {
76       case OSPF6_LSTYPE_AS_EXTERNAL:
77         ospf6_asbr_lsa_remove (lsa);
78         break;
79
80       default:
81         break;
82     }
83 }
84
85 static void
86 ospf6_top_route_hook_add (struct ospf6_route *route)
87 {
88   ospf6_abr_originate_summary (route);
89   ospf6_zebra_route_update_add (route);
90 }
91
92 static void
93 ospf6_top_route_hook_remove (struct ospf6_route *route)
94 {
95   ospf6_abr_originate_summary (route);
96   ospf6_zebra_route_update_remove (route);
97 }
98
99 static void
100 ospf6_top_brouter_hook_add (struct ospf6_route *route)
101 {
102   ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix));
103   ospf6_asbr_lsentry_add (route);
104   ospf6_abr_originate_summary (route);
105 }
106
107 static void
108 ospf6_top_brouter_hook_remove (struct ospf6_route *route)
109 {
110   ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix));
111   ospf6_asbr_lsentry_remove (route);
112   ospf6_abr_originate_summary (route);
113 }
114
115 static struct ospf6 *
116 ospf6_create (void)
117 {
118   struct ospf6 *o;
119
120   o = XCALLOC (MTYPE_OSPF6_TOP, sizeof (struct ospf6));
121
122   /* initialize */
123   quagga_gettime (QUAGGA_CLK_MONOTONIC, &o->starttime);
124   o->area_list = list_new ();
125   o->area_list->cmp = ospf6_area_cmp;
126   o->lsdb = ospf6_lsdb_create (o);
127   o->lsdb_self = ospf6_lsdb_create (o);
128   o->lsdb->hook_add = ospf6_top_lsdb_hook_add;
129   o->lsdb->hook_remove = ospf6_top_lsdb_hook_remove;
130
131   o->spf_delay = OSPF_SPF_DELAY_DEFAULT;
132   o->spf_holdtime = OSPF_SPF_HOLDTIME_DEFAULT;
133   o->spf_max_holdtime = OSPF_SPF_MAX_HOLDTIME_DEFAULT;
134   o->spf_hold_multiplier = 1;
135
136   o->route_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, ROUTES);
137   o->route_table->scope = o;
138   o->route_table->hook_add = ospf6_top_route_hook_add;
139   o->route_table->hook_remove = ospf6_top_route_hook_remove;
140
141   o->brouter_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, BORDER_ROUTERS);
142   o->brouter_table->scope = o;
143   o->brouter_table->hook_add = ospf6_top_brouter_hook_add;
144   o->brouter_table->hook_remove = ospf6_top_brouter_hook_remove;
145
146   o->external_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, EXTERNAL_ROUTES);
147   o->external_table->scope = o;
148
149   o->external_id_table = route_table_init ();
150
151   o->ref_bandwidth = OSPF6_REFERENCE_BANDWIDTH;
152
153   o->distance_table = route_table_init ();
154
155   return o;
156 }
157
158 void
159 ospf6_delete (struct ospf6 *o)
160 {
161   struct listnode *node, *nnode;
162   struct ospf6_area *oa;
163
164   ospf6_disable (ospf6);
165
166   for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa))
167     ospf6_area_delete (oa);
168
169
170   list_delete (o->area_list);
171
172   ospf6_lsdb_delete (o->lsdb);
173   ospf6_lsdb_delete (o->lsdb_self);
174
175   ospf6_route_table_delete (o->route_table);
176   ospf6_route_table_delete (o->brouter_table);
177
178   ospf6_route_table_delete (o->external_table);
179   route_table_finish (o->external_id_table);
180
181   ospf6_distance_reset (o);
182   route_table_finish (o->distance_table);
183
184   XFREE (MTYPE_OSPF6_TOP, o);
185 }
186
187 static void
188 __attribute__((unused))
189 ospf6_enable (struct ospf6 *o)
190 {
191   struct listnode *node, *nnode;
192   struct ospf6_area *oa;
193
194   if (CHECK_FLAG (o->flag, OSPF6_DISABLED))
195     {
196       UNSET_FLAG (o->flag, OSPF6_DISABLED);
197       for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa))
198         ospf6_area_enable (oa);
199     }
200 }
201
202 static void
203 ospf6_disable (struct ospf6 *o)
204 {
205   struct listnode *node, *nnode;
206   struct ospf6_area *oa;
207
208   if (! CHECK_FLAG (o->flag, OSPF6_DISABLED))
209     {
210       SET_FLAG (o->flag, OSPF6_DISABLED);
211       
212       for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa))
213         ospf6_area_disable (oa);
214
215       /* XXX: This also changes persistent settings */
216       ospf6_asbr_redistribute_reset();
217
218       ospf6_lsdb_remove_all (o->lsdb);
219       ospf6_route_remove_all (o->route_table);
220       ospf6_route_remove_all (o->brouter_table);
221
222       THREAD_OFF(o->maxage_remover);
223       THREAD_OFF(o->t_spf_calc);
224       THREAD_OFF(o->t_ase_calc);
225     }
226 }
227
228 static int
229 ospf6_maxage_remover (struct thread *thread)
230 {
231   struct ospf6 *o = (struct ospf6 *) THREAD_ARG (thread);
232   struct ospf6_area *oa;
233   struct ospf6_interface *oi;
234   struct ospf6_neighbor *on;
235   struct listnode *i, *j, *k;
236   int reschedule = 0;
237
238   o->maxage_remover = (struct thread *) NULL;
239
240   for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
241     {
242       for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
243         {
244           for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, k, on))
245             {
246               if (on->state != OSPF6_NEIGHBOR_EXCHANGE &&
247                   on->state != OSPF6_NEIGHBOR_LOADING)
248                   continue;
249
250               ospf6_maxage_remove (o);
251               return 0;
252             }
253         }
254     }
255
256   for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
257     {
258       for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
259         {
260           if (ospf6_lsdb_maxage_remover (oi->lsdb))
261             {
262               reschedule = 1;
263             }
264         }
265       
266       if (ospf6_lsdb_maxage_remover (oa->lsdb))
267         {
268             reschedule = 1;
269         }
270     }
271
272   if (ospf6_lsdb_maxage_remover (o->lsdb))
273     {
274       reschedule = 1;
275     }
276
277   if (reschedule)
278     {
279       ospf6_maxage_remove (o);
280     }
281
282   return 0;
283 }
284
285 void
286 ospf6_maxage_remove (struct ospf6 *o)
287 {
288   if (o && ! o->maxage_remover)
289     o->maxage_remover = thread_add_timer (master, ospf6_maxage_remover, o,
290                                           OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT);
291 }
292
293 /* start ospf6 */
294 DEFUN (router_ospf6,
295        router_ospf6_cmd,
296        "router ospf6",
297        ROUTER_STR
298        OSPF6_STR)
299 {
300   if (ospf6 == NULL)
301     ospf6 = ospf6_create ();
302
303   /* set current ospf point. */
304   vty->node = OSPF6_NODE;
305   vty->index = ospf6;
306
307   return CMD_SUCCESS;
308 }
309
310 /* stop ospf6 */
311 DEFUN (no_router_ospf6,
312        no_router_ospf6_cmd,
313        "no router ospf6",
314        NO_STR
315        OSPF6_ROUTER_STR)
316 {
317   if (ospf6 == NULL)
318     vty_out (vty, "OSPFv3 is not configured%s", VNL);
319   else
320     {
321       ospf6_delete (ospf6);
322       ospf6 = NULL;
323     }
324
325   /* return to config node . */
326   vty->node = CONFIG_NODE;
327   vty->index = NULL;
328
329   return CMD_SUCCESS;
330 }
331
332 /* change Router_ID commands. */
333 DEFUN (ospf6_router_id,
334        ospf6_router_id_cmd,
335        "router-id A.B.C.D",
336        "Configure OSPF Router-ID\n"
337        V4NOTATION_STR)
338 {
339   int ret;
340   u_int32_t router_id;
341   struct ospf6 *o;
342
343   o = (struct ospf6 *) vty->index;
344
345   ret = inet_pton (AF_INET, argv[0], &router_id);
346   if (ret == 0)
347     {
348       vty_out (vty, "malformed OSPF Router-ID: %s%s", argv[0], VNL);
349       return CMD_SUCCESS;
350     }
351
352   o->router_id_static = router_id;
353   if (o->router_id  == 0)
354     o->router_id  = router_id;
355
356   return CMD_SUCCESS;
357 }
358
359 DEFUN (ospf6_log_adjacency_changes,
360        ospf6_log_adjacency_changes_cmd,
361        "log-adjacency-changes",
362        "Log changes in adjacency state\n")
363 {
364   struct ospf6 *ospf6 = vty->index;
365
366   SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
367   return CMD_SUCCESS;
368 }
369
370 DEFUN (ospf6_log_adjacency_changes_detail,
371        ospf6_log_adjacency_changes_detail_cmd,
372        "log-adjacency-changes detail",
373               "Log changes in adjacency state\n"
374        "Log all state changes\n")
375 {
376   struct ospf6 *ospf6 = vty->index;
377
378   SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
379   SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
380   return CMD_SUCCESS;
381 }
382
383 DEFUN (no_ospf6_log_adjacency_changes,
384        no_ospf6_log_adjacency_changes_cmd,
385        "no log-adjacency-changes",
386               NO_STR
387        "Log changes in adjacency state\n")
388 {
389   struct ospf6 *ospf6 = vty->index;
390
391   UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
392   UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
393   return CMD_SUCCESS;
394 }
395
396 DEFUN (no_ospf6_log_adjacency_changes_detail,
397        no_ospf6_log_adjacency_changes_detail_cmd,
398        "no log-adjacency-changes detail",
399               NO_STR
400               "Log changes in adjacency state\n"
401        "Log all state changes\n")
402 {
403   struct ospf6 *ospf6 = vty->index;
404
405   UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
406   return CMD_SUCCESS;
407 }
408
409 DEFUN (ospf6_distance,
410        ospf6_distance_cmd,
411        "distance <1-255>",
412        NO_STR
413        "Define an administrative distance\n"
414        "OSPF6 Administrative distance\n")
415 {
416   struct ospf6 *o;
417
418   o = (struct ospf6 *) vty->index;
419
420   o->distance_all = atoi (argv[0]);
421
422   return CMD_SUCCESS;
423 }
424
425 DEFUN (no_ospf6_distance,
426        no_ospf6_distance_cmd,
427        "no distance <1-255>",
428        NO_STR
429        "Define an administrative distance\n"
430        "OSPF6 Administrative distance\n")
431 {
432   struct ospf6 *o;
433
434   o = (struct ospf6 *) vty->index;
435
436   o->distance_all = 0;
437
438   return CMD_SUCCESS;
439 }
440
441 DEFUN (no_ospf6_distance_ospf6,
442        no_ospf6_distance_ospf6_cmd,
443        "no distance ospf6",
444        NO_STR
445        "Define an administrative distance\n"
446        "OSPF6 Administrative distance\n"
447        "OSPF6 Distance\n")
448 {
449   struct ospf6 *o;
450
451   o = (struct ospf6 *) vty->index;
452
453   o->distance_intra = 0;
454   o->distance_inter = 0;
455   o->distance_external = 0;
456
457   return CMD_SUCCESS;
458 }
459
460 DEFUN (ospf6_distance_ospf6_intra,
461        ospf6_distance_ospf6_intra_cmd,
462        "distance ospf6 intra-area <1-255>",
463        "Define an administrative distance\n"
464        "OSPF6 Administrative distance\n"
465        "Intra-area routes\n"
466        "Distance for intra-area routes\n")
467 {
468   struct ospf6 *o;
469
470   o = (struct ospf6 *) vty->index;
471
472   o->distance_intra = atoi (argv[0]);
473
474   return CMD_SUCCESS;
475 }
476
477 DEFUN (ospf6_distance_ospf6_intra_inter,
478        ospf6_distance_ospf6_intra_inter_cmd,
479        "distance ospf6 intra-area <1-255> inter-area <1-255>",
480        "Define an administrative distance\n"
481        "OSPF6 Administrative distance\n"
482        "Intra-area routes\n"
483        "Distance for intra-area routes\n"
484        "Inter-area routes\n"
485        "Distance for inter-area routes\n")
486 {
487   struct ospf6 *o;
488
489   o = (struct ospf6 *) vty->index;
490
491   o->distance_intra = atoi (argv[0]);
492   o->distance_inter = atoi (argv[1]);
493
494   return CMD_SUCCESS;
495 }
496
497 DEFUN (ospf6_distance_ospf6_intra_external,
498        ospf6_distance_ospf6_intra_external_cmd,
499        "distance ospf6 intra-area <1-255> external <1-255>",
500        "Define an administrative distance\n"
501        "OSPF6 Administrative distance\n"
502        "Intra-area routes\n"
503        "Distance for intra-area routes\n"
504        "External routes\n"
505        "Distance for external routes\n")
506 {
507   struct ospf6 *o;
508
509   o = (struct ospf6 *) vty->index;
510
511   o->distance_intra = atoi (argv[0]);
512   o->distance_external = atoi (argv[1]);
513
514   return CMD_SUCCESS;
515 }
516
517 DEFUN (ospf6_distance_ospf6_intra_inter_external,
518        ospf6_distance_ospf6_intra_inter_external_cmd,
519        "distance ospf6 intra-area <1-255> inter-area <1-255> external <1-255>",
520        "Define an administrative distance\n"
521        "OSPF6 Administrative distance\n"
522        "Intra-area routes\n"
523        "Distance for intra-area routes\n"
524        "Inter-area routes\n"
525        "Distance for inter-area routes\n"
526        "External routes\n"
527        "Distance for external routes\n")
528 {
529   struct ospf6 *o;
530
531   o = (struct ospf6 *) vty->index;
532
533   o->distance_intra = atoi (argv[0]);
534   o->distance_inter = atoi (argv[1]);
535   o->distance_external = atoi (argv[2]);
536
537   return CMD_SUCCESS;
538 }
539
540 DEFUN (ospf6_distance_ospf6_intra_external_inter,
541        ospf6_distance_ospf6_intra_external_inter_cmd,
542        "distance ospf6 intra-area <1-255> external <1-255> inter-area <1-255>",
543        "Define an administrative distance\n"
544        "OSPF6 Administrative distance\n"
545        "Intra-area routes\n"
546        "Distance for intra-area routes\n"
547        "External routes\n"
548        "Distance for external routes\n"
549        "Inter-area routes\n"
550        "Distance for inter-area routes\n")
551 {
552   struct ospf6 *o;
553
554   o = (struct ospf6 *) vty->index;
555
556   o->distance_intra = atoi (argv[0]);
557   o->distance_external = atoi (argv[1]);
558   o->distance_inter = atoi (argv[2]);
559
560   return CMD_SUCCESS;
561 }
562
563 DEFUN (ospf6_distance_ospf6_inter,
564        ospf6_distance_ospf6_inter_cmd,
565        "distance ospf6 inter-area <1-255>",
566        "Define an administrative distance\n"
567        "OSPF6 Administrative distance\n"
568        "Inter-area routes\n"
569        "Distance for inter-area routes\n")
570 {
571   struct ospf6 *o;
572
573   o = (struct ospf6 *) vty->index;
574
575   o->distance_inter = atoi (argv[0]);
576
577   return CMD_SUCCESS;
578 }
579
580 DEFUN (ospf6_distance_ospf6_inter_intra,
581        ospf6_distance_ospf6_inter_intra_cmd,
582        "distance ospf6 inter-area <1-255> intra-area <1-255>",
583        "Define an administrative distance\n"
584        "OSPF6 Administrative distance\n"
585        "Inter-area routes\n"
586        "Distance for inter-area routes\n"
587        "Intra-area routes\n"
588        "Distance for intra-area routes\n")
589 {
590   struct ospf6 *o;
591
592   o = (struct ospf6 *) vty->index;
593
594   o->distance_inter = atoi (argv[0]);
595   o->distance_intra = atoi (argv[1]);
596
597   return CMD_SUCCESS;
598 }
599
600 DEFUN (ospf6_distance_ospf6_inter_external,
601        ospf6_distance_ospf6_inter_external_cmd,
602        "distance ospf6 inter-area <1-255> external <1-255>",
603        "Define an administrative distance\n"
604        "OSPF6 Administrative distance\n"
605        "Inter-area routes\n"
606        "Distance for inter-area routes\n"
607        "External routes\n"
608        "Distance for external routes\n")
609 {
610   struct ospf6 *o;
611
612   o = (struct ospf6 *) vty->index;
613
614   o->distance_inter = atoi (argv[0]);
615   o->distance_external = atoi (argv[1]);
616
617   return CMD_SUCCESS;
618 }
619
620 DEFUN (ospf6_distance_ospf6_inter_intra_external,
621        ospf6_distance_ospf6_inter_intra_external_cmd,
622        "distance ospf6 inter-area <1-255> intra-area <1-255> external <1-255>",
623        "Define an administrative distance\n"
624        "OSPF6 Administrative distance\n"
625        "Inter-area routes\n"
626        "Distance for inter-area routes\n"
627        "Intra-area routes\n"
628        "Distance for intra-area routes\n"
629        "External routes\n"
630        "Distance for external routes\n")
631 {
632   struct ospf6 *o;
633
634   o = (struct ospf6 *) vty->index;
635
636   o->distance_inter = atoi (argv[0]);
637   o->distance_intra = atoi (argv[1]);
638   o->distance_external = atoi (argv[2]);
639
640   return CMD_SUCCESS;
641 }
642
643 DEFUN (ospf6_distance_ospf6_inter_external_intra,
644        ospf6_distance_ospf6_inter_external_intra_cmd,
645        "distance ospf6 inter-area <1-255> external <1-255> intra-area <1-255>",
646        "Define an administrative distance\n"
647        "OSPF6 Administrative distance\n"
648        "Inter-area routes\n"
649        "Distance for inter-area routes\n"
650        "External routes\n"
651        "Distance for external routes\n"
652        "Intra-area routes\n"
653        "Distance for intra-area routes\n")
654 {
655   struct ospf6 *o;
656
657   o = (struct ospf6 *) vty->index;
658
659   o->distance_inter = atoi (argv[0]);
660   o->distance_external = atoi (argv[1]);
661   o->distance_intra = atoi (argv[2]);
662
663   return CMD_SUCCESS;
664 }
665
666 DEFUN (ospf6_distance_ospf6_external,
667        ospf6_distance_ospf6_external_cmd,
668        "distance ospf6 external <1-255>",
669        "Define an administrative distance\n"
670        "OSPF6 Administrative distance\n"
671        "External routes\n"
672        "Distance for external routes\n")
673 {
674   struct ospf6 *o;
675
676   o = (struct ospf6 *) vty->index;
677
678   o->distance_external = atoi (argv[0]);
679
680   return CMD_SUCCESS;
681 }
682
683 DEFUN (ospf6_distance_ospf6_external_intra,
684        ospf6_distance_ospf6_external_intra_cmd,
685        "distance ospf6 external <1-255> intra-area <1-255>",
686        "Define an administrative distance\n"
687        "OSPF6 Administrative distance\n"
688        "External routes\n"
689        "Distance for external routes\n"
690        "Intra-area routes\n"
691        "Distance for intra-area routes\n")
692 {
693   struct ospf6 *o;
694
695   o = (struct ospf6 *) vty->index;
696
697   o->distance_external = atoi (argv[0]);
698   o->distance_intra = atoi (argv[1]);
699
700   return CMD_SUCCESS;
701 }
702
703 DEFUN (ospf6_distance_ospf6_external_inter,
704        ospf6_distance_ospf6_external_inter_cmd,
705        "distance ospf6 external <1-255> inter-area <1-255>",
706        "Define an administrative distance\n"
707        "OSPF6 Administrative distance\n"
708        "External routes\n"
709        "Distance for external routes\n"
710        "Inter-area routes\n"
711        "Distance for inter-area routes\n")
712 {
713   struct ospf6 *o;
714
715   o = (struct ospf6 *) vty->index;
716
717   o->distance_external = atoi (argv[0]);
718   o->distance_inter = atoi (argv[1]);
719
720   return CMD_SUCCESS;
721 }
722
723 DEFUN (ospf6_distance_ospf6_external_intra_inter,
724        ospf6_distance_ospf6_external_intra_inter_cmd,
725        "distance ospf6 external <1-255> intra-area <1-255> inter-area <1-255>",
726        "Define an administrative distance\n"
727        "OSPF6 Administrative distance\n"
728        "External routes\n"
729        "Distance for external routes\n"
730        "Intra-area routes\n"
731        "Distance for intra-area routes\n"
732        "Inter-area routes\n"
733        "Distance for inter-area routes\n")
734 {
735   struct ospf6 *o;
736
737   o = (struct ospf6 *) vty->index;
738
739   o->distance_external = atoi (argv[0]);
740   o->distance_intra = atoi (argv[1]);
741   o->distance_inter = atoi (argv[2]);
742
743   return CMD_SUCCESS;
744 }
745
746 DEFUN (ospf6_distance_ospf6_external_inter_intra,
747        ospf6_distance_ospf6_external_inter_intra_cmd,
748        "distance ospf6 external <1-255> inter-area <1-255> intra-area <1-255>",
749        "Define an administrative distance\n"
750        "OSPF6 Administrative distance\n"
751        "External routes\n"
752        "Distance for external routes\n"
753        "Inter-area routes\n"
754        "Distance for inter-area routes\n"
755        "Intra-area routes\n"
756        "Distance for intra-area routes\n")
757 {
758   struct ospf6 *o;
759
760   o = (struct ospf6 *) vty->index;
761
762   o->distance_external = atoi (argv[0]);
763   o->distance_inter = atoi (argv[1]);
764   o->distance_intra = atoi (argv[2]);
765
766   return CMD_SUCCESS;
767 }
768
769 DEFUN (ospf6_distance_source,
770        ospf6_distance_source_cmd,
771        "distance <1-255> X:X::X:X/M",
772        "Administrative distance\n"
773        "Distance value\n"
774        "IP source prefix\n")
775 {
776   struct ospf6 *o;
777
778   o = (struct ospf6 *) vty->index;
779
780   ospf6_distance_set (vty, o, argv[0], argv[1], NULL);
781
782   return CMD_SUCCESS;
783 }
784
785 DEFUN (no_ospf6_distance_source,
786        no_ospf6_distance_source_cmd,
787        "no distance <1-255> X:X::X:X/M",
788        NO_STR
789        "Administrative distance\n"
790        "Distance value\n"
791        "IP source prefix\n")
792 {
793   struct ospf6 *o;
794
795   o = (struct ospf6 *) vty->index;
796   
797   /* XXX: distance arg seems to be irrelevant */
798   ospf6_distance_unset (vty, o, argv[1], NULL);
799
800   return CMD_SUCCESS;
801 }
802
803 DEFUN (ospf6_distance_source_access_list,
804        ospf6_distance_source_access_list_cmd,
805        "distance <1-255> X:X::X:X/M WORD",
806        "Administrative distance\n"
807        "Distance value\n"
808        "IP source prefix\n"
809        "Access list name\n")
810 {
811   struct ospf6 *o;
812
813   o = (struct ospf6 *) vty->index;
814
815   ospf6_distance_set (vty, o, argv[0], argv[1], argv[2]);
816
817   return CMD_SUCCESS;
818 }
819
820 DEFUN (no_ospf6_distance_source_access_list,
821        no_ospf6_distance_source_access_list_cmd,
822        "no distance <1-255> X:X::X:X/M WORD",
823        NO_STR
824        "Administrative distance\n"
825        "Distance value\n"
826        "IP source prefix\n"
827        "Access list name\n")
828 {
829   struct ospf6 *o;
830
831   o = (struct ospf6 *) vty->index;
832
833   ospf6_distance_unset (vty, o, argv[1], argv[2]);
834
835   return CMD_SUCCESS;
836 }
837
838 DEFUN (ospf6_interface_area,
839        ospf6_interface_area_cmd,
840        "interface IFNAME area A.B.C.D",
841        "Enable routing on an IPv6 interface\n"
842        IFNAME_STR
843        "Specify the OSPF6 area ID\n"
844        "OSPF6 area ID in IPv4 address notation\n"
845       )
846 {
847   struct ospf6 *o;
848   struct ospf6_area *oa;
849   struct ospf6_interface *oi;
850   struct interface *ifp;
851   u_int32_t area_id;
852
853   o = (struct ospf6 *) vty->index;
854
855   /* find/create ospf6 interface */
856   ifp = if_get_by_name (argv[0]);
857   oi = (struct ospf6_interface *) ifp->info;
858   if (oi == NULL)
859     oi = ospf6_interface_create (ifp);
860   if (oi->area)
861     {
862       vty_out (vty, "%s already attached to Area %s%s",
863                oi->interface->name, oi->area->name, VNL);
864       return CMD_SUCCESS;
865     }
866
867   /* parse Area-ID */
868   if (inet_pton (AF_INET, argv[1], &area_id) != 1)
869     {
870       vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VNL);
871       return CMD_SUCCESS;
872     }
873
874   /* find/create ospf6 area */
875   oa = ospf6_area_lookup (area_id, o);
876   if (oa == NULL)
877     oa = ospf6_area_create (area_id, o);
878
879   /* attach interface to area */
880   listnode_add (oa->if_list, oi); /* sort ?? */
881   oi->area = oa;
882
883   SET_FLAG (oa->flag, OSPF6_AREA_ENABLE);
884
885   /* ospf6 process is currently disabled, not much more to do */
886   if (CHECK_FLAG (o->flag, OSPF6_DISABLED))
887     return CMD_SUCCESS;
888
889   /* start up */
890   ospf6_interface_enable (oi);
891
892   /* If the router is ABR, originate summary routes */
893   if (ospf6_is_router_abr (o))
894     ospf6_abr_enable_area (oa);
895
896   return CMD_SUCCESS;
897 }
898
899 DEFUN (no_ospf6_interface_area,
900        no_ospf6_interface_area_cmd,
901        "no interface IFNAME area A.B.C.D",
902        NO_STR
903        "Disable routing on an IPv6 interface\n"
904        IFNAME_STR
905        "Specify the OSPF6 area ID\n"
906        "OSPF6 area ID in IPv4 address notation\n"
907        )
908 {
909   struct ospf6_interface *oi;
910   struct ospf6_area *oa;
911   struct interface *ifp;
912   u_int32_t area_id;
913
914   ifp = if_lookup_by_name (argv[0]);
915   if (ifp == NULL)
916     {
917       vty_out (vty, "No such interface %s%s", argv[0], VNL);
918       return CMD_SUCCESS;
919     }
920
921   oi = (struct ospf6_interface *) ifp->info;
922   if (oi == NULL)
923     {
924       vty_out (vty, "Interface %s not enabled%s", ifp->name, VNL);
925       return CMD_SUCCESS;
926     }
927
928   /* parse Area-ID */
929   if (inet_pton (AF_INET, argv[1], &area_id) != 1)
930     {
931       vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VNL);
932       return CMD_SUCCESS;
933     }
934
935   /* Verify Area */
936   if (oi->area == NULL)
937     {
938       vty_out (vty, "No such Area-ID: %s%s", argv[1], VNL);
939       return CMD_SUCCESS;
940     }
941
942   if (oi->area->area_id != area_id)
943     {
944       vty_out (vty, "Wrong Area-ID: %s is attached to area %s%s",
945                oi->interface->name, oi->area->name, VNL);
946       return CMD_SUCCESS;
947     }
948
949   thread_execute (master, interface_down, oi, 0);
950
951   oa = oi->area;
952   listnode_delete (oi->area->if_list, oi);
953   oi->area = (struct ospf6_area *) NULL;
954
955   /* Withdraw inter-area routes from this area, if necessary */
956   if (oa->if_list->count == 0)
957     {
958       UNSET_FLAG (oa->flag, OSPF6_AREA_ENABLE);
959       ospf6_abr_disable_area (oa);
960     }
961
962   return CMD_SUCCESS;
963 }
964
965 DEFUN (ospf6_stub_router_admin,
966        ospf6_stub_router_admin_cmd,
967        "stub-router administrative",
968        "Make router a stub router\n"
969        "Advertise inability to be a transit router\n"
970        "Administratively applied, for an indefinite period\n")
971 {
972   struct listnode *node;
973   struct ospf6_area *oa;
974
975   if (!CHECK_FLAG (ospf6->flag, OSPF6_STUB_ROUTER))
976     {
977       for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
978         {
979            OSPF6_OPT_CLEAR (oa->options, OSPF6_OPT_V6);
980            OSPF6_OPT_CLEAR (oa->options, OSPF6_OPT_R);
981            OSPF6_ROUTER_LSA_SCHEDULE (oa);
982         }
983       SET_FLAG (ospf6->flag, OSPF6_STUB_ROUTER);
984     }
985
986   return CMD_SUCCESS;
987 }
988
989 DEFUN (no_ospf6_stub_router_admin,
990        no_ospf6_stub_router_admin_cmd,
991        "no stub-router administrative",
992        NO_STR
993        "Make router a stub router\n"
994        "Advertise ability to be a transit router\n"
995        "Administratively applied, for an indefinite period\n")
996 {
997   struct listnode *node;
998   struct ospf6_area *oa;
999
1000   if (CHECK_FLAG (ospf6->flag, OSPF6_STUB_ROUTER))
1001     {
1002       for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
1003         {
1004            OSPF6_OPT_SET (oa->options, OSPF6_OPT_V6);
1005            OSPF6_OPT_SET (oa->options, OSPF6_OPT_R);
1006            OSPF6_ROUTER_LSA_SCHEDULE (oa);
1007         }
1008       UNSET_FLAG (ospf6->flag, OSPF6_STUB_ROUTER);
1009     }
1010
1011   return CMD_SUCCESS;
1012 }
1013
1014 DEFUN (ospf6_stub_router_startup,
1015        ospf6_stub_router_startup_cmd,
1016        "stub-router on-startup <5-86400>",
1017        "Make router a stub router\n"
1018        "Advertise inability to be a transit router\n"
1019        "Automatically advertise as stub-router on startup of OSPF6\n"
1020        "Time (seconds) to advertise self as stub-router\n")
1021 {
1022   return CMD_SUCCESS;
1023 }
1024
1025 DEFUN (no_ospf6_stub_router_startup,
1026        no_ospf6_stub_router_startup_cmd,
1027        "no stub-router on-startup",
1028        NO_STR
1029        "Make router a stub router\n"
1030        "Advertise inability to be a transit router\n"
1031        "Automatically advertise as stub-router on startup of OSPF6\n"
1032        "Time (seconds) to advertise self as stub-router\n")
1033 {
1034   return CMD_SUCCESS;
1035 }
1036
1037 DEFUN (ospf6_stub_router_shutdown,
1038        ospf6_stub_router_shutdown_cmd,
1039        "stub-router on-shutdown <5-86400>",
1040        "Make router a stub router\n"
1041        "Advertise inability to be a transit router\n"
1042        "Automatically advertise as stub-router before shutdown\n"
1043        "Time (seconds) to advertise self as stub-router\n")
1044 {
1045   return CMD_SUCCESS;
1046 }
1047
1048 DEFUN (no_ospf6_stub_router_shutdown,
1049        no_ospf6_stub_router_shutdown_cmd,
1050        "no stub-router on-shutdown",
1051        NO_STR
1052        "Make router a stub router\n"
1053        "Advertise inability to be a transit router\n"
1054        "Automatically advertise as stub-router before shutdown\n"
1055        "Time (seconds) to advertise self as stub-router\n")
1056 {
1057   return CMD_SUCCESS;
1058 }
1059
1060 static void
1061 ospf6_show (struct vty *vty, struct ospf6 *o)
1062 {
1063   struct listnode *n;
1064   struct ospf6_area *oa;
1065   char router_id[16], duration[32];
1066   struct timeval now, running, result;
1067   char buf[32], rbuf[32];
1068
1069   /* process id, router id */
1070   inet_ntop (AF_INET, &o->router_id, router_id, sizeof (router_id));
1071   vty_out (vty, " OSPFv3 Routing Process (0) with Router-ID %s%s",
1072            router_id, VNL);
1073
1074   /* running time */
1075   quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
1076   timersub (&now, &o->starttime, &running);
1077   timerstring (&running, duration, sizeof (duration));
1078   vty_out (vty, " Running %s%s", duration, VNL);
1079
1080   /* Redistribute configuration */
1081   /* XXX */
1082
1083   /* Show SPF parameters */
1084   vty_out(vty, " Initial SPF scheduling delay %d millisec(s)%s"
1085           " Minimum hold time between consecutive SPFs %d millsecond(s)%s"
1086           " Maximum hold time between consecutive SPFs %d millsecond(s)%s"
1087           " Hold time multiplier is currently %d%s",
1088           o->spf_delay, VNL,
1089           o->spf_holdtime, VNL,
1090           o->spf_max_holdtime, VNL,
1091           o->spf_hold_multiplier, VNL);
1092
1093   vty_out(vty, " SPF algorithm ");
1094   if (o->ts_spf.tv_sec || o->ts_spf.tv_usec)
1095     {
1096       timersub(&now, &o->ts_spf, &result);
1097       timerstring(&result, buf, sizeof(buf));
1098       ospf6_spf_reason_string(o->last_spf_reason, rbuf, sizeof(rbuf));
1099       vty_out(vty, "last executed %s ago, reason %s%s", buf, rbuf, VNL);
1100       vty_out (vty, " Last SPF duration %lld sec %lld usec%s",
1101                (long long)o->ts_spf_duration.tv_sec,
1102                (long long)o->ts_spf_duration.tv_usec, VNL);
1103     }
1104   else
1105     vty_out(vty, "has not been run$%s", VNL);
1106   threadtimer_string(now, o->t_spf_calc, buf, sizeof(buf));
1107   vty_out (vty, " SPF timer %s%s%s",
1108            (o->t_spf_calc ? "due in " : "is "), buf, VNL);
1109
1110   if (CHECK_FLAG (o->flag, OSPF6_STUB_ROUTER))
1111     vty_out (vty, " Router Is Stub Router%s", VNL);
1112
1113   /* LSAs */
1114   vty_out (vty, " Number of AS scoped LSAs is %u%s",
1115            o->lsdb->count, VNL);
1116
1117   /* Areas */
1118   vty_out (vty, " Number of areas in this router is %u%s",
1119            listcount (o->area_list), VNL);
1120
1121   if (CHECK_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_CHANGES))
1122     {
1123       if (CHECK_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_DETAIL))
1124         vty_out(vty, " All adjacency changes are logged%s",VTY_NEWLINE);
1125       else
1126         vty_out(vty, " Adjacency changes are logged%s",VTY_NEWLINE);
1127     }
1128
1129   vty_out (vty, "%s",VTY_NEWLINE);
1130
1131   for (ALL_LIST_ELEMENTS_RO (o->area_list, n, oa))
1132     ospf6_area_show (vty, oa);
1133 }
1134
1135 /* show top level structures */
1136 DEFUN (show_ipv6_ospf6,
1137        show_ipv6_ospf6_cmd,
1138        "show ipv6 ospf6",
1139        SHOW_STR
1140        IP6_STR
1141        OSPF6_STR)
1142 {
1143   OSPF6_CMD_CHECK_RUNNING ();
1144
1145   ospf6_show (vty, ospf6);
1146   return CMD_SUCCESS;
1147 }
1148
1149 DEFUN (show_ipv6_ospf6_route,
1150        show_ipv6_ospf6_route_cmd,
1151        "show ipv6 ospf6 route",
1152        SHOW_STR
1153        IP6_STR
1154        OSPF6_STR
1155        ROUTE_STR
1156        )
1157 {
1158   OSPF6_CMD_CHECK_RUNNING ();
1159
1160   ospf6_route_table_show (vty, argc, argv, ospf6->route_table);
1161   return CMD_SUCCESS;
1162 }
1163
1164 ALIAS (show_ipv6_ospf6_route,
1165        show_ipv6_ospf6_route_detail_cmd,
1166        "show ipv6 ospf6 route (X:X::X:X|X:X::X:X/M|detail|summary)",
1167        SHOW_STR
1168        IP6_STR
1169        OSPF6_STR
1170        ROUTE_STR
1171        "Specify IPv6 address\n"
1172        "Specify IPv6 prefix\n"
1173        "Detailed information\n"
1174        "Summary of route table\n"
1175        )
1176
1177 DEFUN (show_ipv6_ospf6_route_match,
1178        show_ipv6_ospf6_route_match_cmd,
1179        "show ipv6 ospf6 route X:X::X:X/M match",
1180        SHOW_STR
1181        IP6_STR
1182        OSPF6_STR
1183        ROUTE_STR
1184        "Specify IPv6 prefix\n"
1185        "Display routes which match the specified route\n"
1186        )
1187 {
1188   const char *sargv[CMD_ARGC_MAX];
1189   int i, sargc;
1190
1191   OSPF6_CMD_CHECK_RUNNING ();
1192
1193   /* copy argv to sargv and then append "match" */
1194   for (i = 0; i < argc; i++)
1195     sargv[i] = argv[i];
1196   sargc = argc;
1197   sargv[sargc++] = "match";
1198   sargv[sargc] = NULL;
1199
1200   ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table);
1201   return CMD_SUCCESS;
1202 }
1203
1204 DEFUN (show_ipv6_ospf6_route_match_detail,
1205        show_ipv6_ospf6_route_match_detail_cmd,
1206        "show ipv6 ospf6 route X:X::X:X/M match detail",
1207        SHOW_STR
1208        IP6_STR
1209        OSPF6_STR
1210        ROUTE_STR
1211        "Specify IPv6 prefix\n"
1212        "Display routes which match the specified route\n"
1213        "Detailed information\n"
1214        )
1215 {
1216   const char *sargv[CMD_ARGC_MAX];
1217   int i, sargc;
1218
1219   /* copy argv to sargv and then append "match" and "detail" */
1220   for (i = 0; i < argc; i++)
1221     sargv[i] = argv[i];
1222   sargc = argc;
1223   sargv[sargc++] = "match";
1224   sargv[sargc++] = "detail";
1225   sargv[sargc] = NULL;
1226
1227   OSPF6_CMD_CHECK_RUNNING ();
1228
1229   ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table);
1230   return CMD_SUCCESS;
1231 }
1232
1233 ALIAS (show_ipv6_ospf6_route_match,
1234        show_ipv6_ospf6_route_longer_cmd,
1235        "show ipv6 ospf6 route X:X::X:X/M longer",
1236        SHOW_STR
1237        IP6_STR
1238        OSPF6_STR
1239        ROUTE_STR
1240        "Specify IPv6 prefix\n"
1241        "Display routes longer than the specified route\n"
1242        )
1243
1244 DEFUN (show_ipv6_ospf6_route_match_detail,
1245        show_ipv6_ospf6_route_longer_detail_cmd,
1246        "show ipv6 ospf6 route X:X::X:X/M longer detail",
1247        SHOW_STR
1248        IP6_STR
1249        OSPF6_STR
1250        ROUTE_STR
1251        "Specify IPv6 prefix\n"
1252        "Display routes longer than the specified route\n"
1253        "Detailed information\n"
1254        );
1255
1256 ALIAS (show_ipv6_ospf6_route,
1257        show_ipv6_ospf6_route_type_cmd,
1258        "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2)",
1259        SHOW_STR
1260        IP6_STR
1261        OSPF6_STR
1262        ROUTE_STR
1263        "Display Intra-Area routes\n"
1264        "Display Inter-Area routes\n"
1265        "Display Type-1 External routes\n"
1266        "Display Type-2 External routes\n"
1267        )
1268
1269 DEFUN (show_ipv6_ospf6_route_type_detail,
1270        show_ipv6_ospf6_route_type_detail_cmd,
1271        "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2) detail",
1272        SHOW_STR
1273        IP6_STR
1274        OSPF6_STR
1275        ROUTE_STR
1276        "Display Intra-Area routes\n"
1277        "Display Inter-Area routes\n"
1278        "Display Type-1 External routes\n"
1279        "Display Type-2 External routes\n"
1280        "Detailed information\n"
1281        )
1282 {
1283   const char *sargv[CMD_ARGC_MAX];
1284   int i, sargc;
1285
1286   /* copy argv to sargv and then append "detail" */
1287   for (i = 0; i < argc; i++)
1288     sargv[i] = argv[i];
1289   sargc = argc;
1290   sargv[sargc++] = "detail";
1291   sargv[sargc] = NULL;
1292
1293   OSPF6_CMD_CHECK_RUNNING ();
1294
1295   ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table);
1296   return CMD_SUCCESS;
1297 }
1298
1299 static void
1300 ospf6_stub_router_config_write (struct vty *vty)
1301 {
1302   if (CHECK_FLAG (ospf6->flag, OSPF6_STUB_ROUTER))
1303     {
1304       vty_out (vty, " stub-router administrative%s", VNL);
1305     }
1306     return;
1307 }
1308
1309 static int
1310 ospf6_distance_config_write (struct vty *vty)
1311 {
1312   struct route_node *rn;
1313   struct ospf6_distance *odistance;
1314
1315   if (ospf6->distance_all)
1316     vty_out (vty, " distance %d%s", ospf6->distance_all, VTY_NEWLINE);
1317
1318   if (ospf6->distance_intra
1319       || ospf6->distance_inter
1320       || ospf6->distance_external)
1321     {
1322       vty_out (vty, " distance ospf6");
1323
1324       if (ospf6->distance_intra)
1325         vty_out (vty, " intra-area %d", ospf6->distance_intra);
1326       if (ospf6->distance_inter)
1327         vty_out (vty, " inter-area %d", ospf6->distance_inter);
1328       if (ospf6->distance_external)
1329         vty_out (vty, " external %d", ospf6->distance_external);
1330
1331       vty_out (vty, "%s", VTY_NEWLINE);
1332     }
1333
1334   for (rn = route_top (ospf6->distance_table); rn; rn = route_next (rn))
1335     if ((odistance = rn->info) != NULL)
1336       {
1337         char pstr[128];
1338         vty_out (vty, " distance %d %s %s%s", odistance->distance,
1339                  prefix2str (&rn->p, pstr, sizeof(pstr)),
1340                  odistance->access_list ? odistance->access_list : "",
1341                  VTY_NEWLINE);
1342       }
1343   return 0;
1344 }
1345
1346 /* OSPF configuration write function. */
1347 static int
1348 config_write_ospf6 (struct vty *vty)
1349 {
1350   char router_id[16];
1351   struct listnode *j, *k;
1352   struct ospf6_area *oa;
1353   struct ospf6_interface *oi;
1354
1355   /* OSPFv6 configuration. */
1356   if (ospf6 == NULL)
1357     return CMD_SUCCESS;
1358
1359   inet_ntop (AF_INET, &ospf6->router_id_static, router_id, sizeof (router_id));
1360   vty_out (vty, "router ospf6%s", VNL);
1361   if (ospf6->router_id_static != 0)
1362     vty_out (vty, " router-id %s%s", router_id, VNL);
1363
1364   /* log-adjacency-changes flag print. */
1365   if (CHECK_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES))
1366     {
1367       vty_out(vty, " log-adjacency-changes");
1368       if (CHECK_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL))
1369         vty_out(vty, " detail");
1370       vty_out(vty, "%s", VTY_NEWLINE);
1371     }
1372
1373   if (ospf6->ref_bandwidth != OSPF6_REFERENCE_BANDWIDTH)
1374     vty_out (vty, " auto-cost reference-bandwidth %d%s", ospf6->ref_bandwidth / 1000,
1375              VNL);
1376
1377   ospf6_stub_router_config_write (vty);
1378   ospf6_redistribute_config_write (vty);
1379   ospf6_area_config_write (vty);
1380   ospf6_spf_config_write (vty);
1381   ospf6_distance_config_write (vty);
1382
1383   for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, j, oa))
1384     {
1385       for (ALL_LIST_ELEMENTS_RO (oa->if_list, k, oi))
1386         vty_out (vty, " interface %s area %s%s",
1387                  oi->interface->name, oa->name, VNL);
1388     }
1389   vty_out (vty, "!%s", VNL);
1390   return 0;
1391 }
1392
1393 /* OSPF6 node structure. */
1394 static struct cmd_node ospf6_node =
1395 {
1396   OSPF6_NODE,
1397   "%s(config-ospf6)# ",
1398   1 /* VTYSH */
1399 };
1400
1401 /* Install ospf related commands. */
1402 void
1403 ospf6_top_init (void)
1404 {
1405   /* Install ospf6 top node. */
1406   install_node (&ospf6_node, config_write_ospf6);
1407
1408   install_element (VIEW_NODE, &show_ipv6_ospf6_cmd);
1409   install_element (CONFIG_NODE, &router_ospf6_cmd);
1410   install_element (CONFIG_NODE, &no_router_ospf6_cmd);
1411
1412   install_element (VIEW_NODE, &show_ipv6_ospf6_route_cmd);
1413   install_element (VIEW_NODE, &show_ipv6_ospf6_route_detail_cmd);
1414   install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_cmd);
1415   install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_detail_cmd);
1416   install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_cmd);
1417   install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_detail_cmd);
1418   install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_cmd);
1419   install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_detail_cmd);
1420
1421   install_default (OSPF6_NODE);
1422   install_element (OSPF6_NODE, &ospf6_router_id_cmd);
1423   install_element (OSPF6_NODE, &ospf6_log_adjacency_changes_cmd);
1424   install_element (OSPF6_NODE, &ospf6_log_adjacency_changes_detail_cmd);
1425   install_element (OSPF6_NODE, &no_ospf6_log_adjacency_changes_cmd);
1426   install_element (OSPF6_NODE, &no_ospf6_log_adjacency_changes_detail_cmd);
1427   install_element (OSPF6_NODE, &ospf6_interface_area_cmd);
1428   install_element (OSPF6_NODE, &no_ospf6_interface_area_cmd);
1429   install_element (OSPF6_NODE, &ospf6_stub_router_admin_cmd);
1430   install_element (OSPF6_NODE, &no_ospf6_stub_router_admin_cmd);
1431   /* For a later time
1432   install_element (OSPF6_NODE, &ospf6_stub_router_startup_cmd);
1433   install_element (OSPF6_NODE, &no_ospf6_stub_router_startup_cmd);
1434   install_element (OSPF6_NODE, &ospf6_stub_router_shutdown_cmd);
1435   install_element (OSPF6_NODE, &no_ospf6_stub_router_shutdown_cmd);
1436   */
1437
1438   install_element (OSPF6_NODE, &ospf6_distance_cmd);
1439   install_element (OSPF6_NODE, &no_ospf6_distance_cmd);
1440   install_element (OSPF6_NODE, &no_ospf6_distance_ospf6_cmd);
1441   install_element (OSPF6_NODE, &ospf6_distance_ospf6_intra_cmd);
1442   install_element (OSPF6_NODE, &ospf6_distance_ospf6_intra_inter_cmd);
1443   install_element (OSPF6_NODE, &ospf6_distance_ospf6_intra_external_cmd);
1444   install_element (OSPF6_NODE, &ospf6_distance_ospf6_intra_inter_external_cmd);
1445   install_element (OSPF6_NODE, &ospf6_distance_ospf6_intra_external_inter_cmd);
1446   install_element (OSPF6_NODE, &ospf6_distance_ospf6_inter_cmd);
1447   install_element (OSPF6_NODE, &ospf6_distance_ospf6_inter_intra_cmd);
1448   install_element (OSPF6_NODE, &ospf6_distance_ospf6_inter_external_cmd);
1449   install_element (OSPF6_NODE, &ospf6_distance_ospf6_inter_intra_external_cmd);
1450   install_element (OSPF6_NODE, &ospf6_distance_ospf6_inter_external_intra_cmd);
1451   install_element (OSPF6_NODE, &ospf6_distance_ospf6_external_cmd);
1452   install_element (OSPF6_NODE, &ospf6_distance_ospf6_external_intra_cmd);
1453   install_element (OSPF6_NODE, &ospf6_distance_ospf6_external_inter_cmd);
1454   install_element (OSPF6_NODE, &ospf6_distance_ospf6_external_intra_inter_cmd);
1455   install_element (OSPF6_NODE, &ospf6_distance_ospf6_external_inter_intra_cmd);
1456
1457   install_element (OSPF6_NODE, &ospf6_distance_source_cmd);
1458   install_element (OSPF6_NODE, &no_ospf6_distance_source_cmd);
1459   install_element (OSPF6_NODE, &ospf6_distance_source_access_list_cmd);
1460   install_element (OSPF6_NODE, &no_ospf6_distance_source_access_list_cmd);
1461 }
1462
1463