]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6_top.c
Merge pull request #2696 from sworleys/Netlink-Fuzz
[mirror_frr.git] / ospf6d / ospf6_top.c
CommitLineData
718e3744 1/*
508e53e2 2 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
896014f4
DL
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
718e3744 19 */
20
21#include <zebra.h>
22
23#include "log.h"
24#include "memory.h"
25#include "vty.h"
26#include "linklist.h"
27#include "prefix.h"
28#include "table.h"
29#include "thread.h"
30#include "command.h"
8efe88ea 31#include "defaults.h"
718e3744 32
718e3744 33#include "ospf6_proto.h"
508e53e2 34#include "ospf6_message.h"
718e3744 35#include "ospf6_lsa.h"
36#include "ospf6_lsdb.h"
718e3744 37#include "ospf6_route.h"
38#include "ospf6_zebra.h"
39
508e53e2 40#include "ospf6_top.h"
41#include "ospf6_area.h"
42#include "ospf6_interface.h"
43#include "ospf6_neighbor.h"
718e3744 44
6452df09 45#include "ospf6_flood.h"
508e53e2 46#include "ospf6_asbr.h"
049207c3 47#include "ospf6_abr.h"
6452df09 48#include "ospf6_intra.h"
3810e06e 49#include "ospf6_spf.h"
049207c3 50#include "ospf6d.h"
718e3744 51
ae19c240
DL
52DEFINE_QOBJ_TYPE(ospf6)
53
718e3744 54/* global ospf6d variable */
55struct ospf6 *ospf6;
78c6ba61
CS
56static struct ospf6_master ospf6_master;
57struct ospf6_master *om6;
718e3744 58
d62a17ae 59static void ospf6_disable(struct ospf6 *o);
ae2254aa 60
d62a17ae 61static void ospf6_top_lsdb_hook_add(struct ospf6_lsa *lsa)
718e3744 62{
d62a17ae 63 switch (ntohs(lsa->header->type)) {
64 case OSPF6_LSTYPE_AS_EXTERNAL:
65 ospf6_asbr_lsa_add(lsa);
66 break;
67
68 default:
69 break;
70 }
718e3744 71}
72
d62a17ae 73static void ospf6_top_lsdb_hook_remove(struct ospf6_lsa *lsa)
718e3744 74{
d62a17ae 75 switch (ntohs(lsa->header->type)) {
76 case OSPF6_LSTYPE_AS_EXTERNAL:
07b37f93 77 ospf6_asbr_lsa_remove(lsa, NULL);
d62a17ae 78 break;
79
80 default:
81 break;
82 }
718e3744 83}
84
d62a17ae 85static void ospf6_top_route_hook_add(struct ospf6_route *route)
049207c3 86{
d62a17ae 87 ospf6_abr_originate_summary(route);
88 ospf6_zebra_route_update_add(route);
049207c3 89}
90
d62a17ae 91static void ospf6_top_route_hook_remove(struct ospf6_route *route)
049207c3 92{
d62a17ae 93 route->flag |= OSPF6_ROUTE_REMOVE;
94 ospf6_abr_originate_summary(route);
95 ospf6_zebra_route_update_remove(route);
049207c3 96}
97
d62a17ae 98static void ospf6_top_brouter_hook_add(struct ospf6_route *route)
6452df09 99{
99ab28cb
CS
100 if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL) ||
101 IS_OSPF6_DEBUG_BROUTER) {
07b37f93
CS
102 uint32_t brouter_id;
103 char brouter_name[16];
104
105 brouter_id = ADV_ROUTER_IN_PREFIX(&route->prefix);
106 inet_ntop(AF_INET, &brouter_id, brouter_name,
107 sizeof(brouter_name));
108 zlog_debug("%s: brouter %s add with adv router %x nh count %u",
109 __PRETTY_FUNCTION__, brouter_name,
110 route->path.origin.adv_router,
111 listcount(route->nh_list));
064d4355 112 }
d62a17ae 113 ospf6_abr_examin_brouter(ADV_ROUTER_IN_PREFIX(&route->prefix));
114 ospf6_asbr_lsentry_add(route);
115 ospf6_abr_originate_summary(route);
6452df09 116}
117
d62a17ae 118static void ospf6_top_brouter_hook_remove(struct ospf6_route *route)
6452df09 119{
99ab28cb
CS
120 if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL) ||
121 IS_OSPF6_DEBUG_BROUTER) {
07b37f93
CS
122 uint32_t brouter_id;
123 char brouter_name[16];
064d4355 124
07b37f93
CS
125 brouter_id = ADV_ROUTER_IN_PREFIX(&route->prefix);
126 inet_ntop(AF_INET, &brouter_id, brouter_name,
127 sizeof(brouter_name));
99ab28cb
CS
128 zlog_debug("%s: brouter %p %s del with adv router %x nh %u",
129 __PRETTY_FUNCTION__, (void *)route, brouter_name,
130 route->path.origin.adv_router,
07b37f93 131 listcount(route->nh_list));
064d4355 132 }
d62a17ae 133 route->flag |= OSPF6_ROUTE_REMOVE;
134 ospf6_abr_examin_brouter(ADV_ROUTER_IN_PREFIX(&route->prefix));
135 ospf6_asbr_lsentry_remove(route);
136 ospf6_abr_originate_summary(route);
6452df09 137}
138
d62a17ae 139static struct ospf6 *ospf6_create(void)
718e3744 140{
d62a17ae 141 struct ospf6 *o;
718e3744 142
d62a17ae 143 o = XCALLOC(MTYPE_OSPF6_TOP, sizeof(struct ospf6));
718e3744 144
d62a17ae 145 /* initialize */
146 monotime(&o->starttime);
147 o->area_list = list_new();
148 o->area_list->cmp = ospf6_area_cmp;
149 o->lsdb = ospf6_lsdb_create(o);
150 o->lsdb_self = ospf6_lsdb_create(o);
151 o->lsdb->hook_add = ospf6_top_lsdb_hook_add;
152 o->lsdb->hook_remove = ospf6_top_lsdb_hook_remove;
718e3744 153
d62a17ae 154 o->spf_delay = OSPF_SPF_DELAY_DEFAULT;
155 o->spf_holdtime = OSPF_SPF_HOLDTIME_DEFAULT;
156 o->spf_max_holdtime = OSPF_SPF_MAX_HOLDTIME_DEFAULT;
157 o->spf_hold_multiplier = 1;
3810e06e 158
d62a17ae 159 /* LSA timers value init */
160 o->lsa_minarrival = OSPF_MIN_LS_ARRIVAL;
b6927875 161
d62a17ae 162 o->route_table = OSPF6_ROUTE_TABLE_CREATE(GLOBAL, ROUTES);
163 o->route_table->scope = o;
164 o->route_table->hook_add = ospf6_top_route_hook_add;
165 o->route_table->hook_remove = ospf6_top_route_hook_remove;
718e3744 166
d62a17ae 167 o->brouter_table = OSPF6_ROUTE_TABLE_CREATE(GLOBAL, BORDER_ROUTERS);
168 o->brouter_table->scope = o;
169 o->brouter_table->hook_add = ospf6_top_brouter_hook_add;
170 o->brouter_table->hook_remove = ospf6_top_brouter_hook_remove;
049207c3 171
d62a17ae 172 o->external_table = OSPF6_ROUTE_TABLE_CREATE(GLOBAL, EXTERNAL_ROUTES);
173 o->external_table->scope = o;
cf1ce250 174
d62a17ae 175 o->external_id_table = route_table_init();
718e3744 176
d62a17ae 177 o->ref_bandwidth = OSPF6_REFERENCE_BANDWIDTH;
fd500689 178
d62a17ae 179 o->distance_table = route_table_init();
baff583e 180
d62a17ae 181/* Enable "log-adjacency-changes" */
8efe88ea 182#if DFLT_OSPF6_LOG_ADJACENCY_CHANGES
d62a17ae 183 SET_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
8efe88ea 184#endif
692c7954 185
d62a17ae 186 QOBJ_REG(o, ospf6);
692c7954 187
d62a17ae 188 return o;
718e3744 189}
190
d62a17ae 191void ospf6_delete(struct ospf6 *o)
718e3744 192{
d62a17ae 193 struct listnode *node, *nnode;
194 struct ospf6_area *oa;
718e3744 195
d62a17ae 196 QOBJ_UNREG(o);
76249532
CS
197
198 ospf6_flush_self_originated_lsas_now();
d62a17ae 199 ospf6_disable(ospf6);
ae2254aa 200
d62a17ae 201 for (ALL_LIST_ELEMENTS(o->area_list, node, nnode, oa))
202 ospf6_area_delete(oa);
d9628728
CF
203
204
affe9e99 205 list_delete_and_null(&o->area_list);
718e3744 206
d62a17ae 207 ospf6_lsdb_delete(o->lsdb);
208 ospf6_lsdb_delete(o->lsdb_self);
718e3744 209
d62a17ae 210 ospf6_route_table_delete(o->route_table);
211 ospf6_route_table_delete(o->brouter_table);
718e3744 212
d62a17ae 213 ospf6_route_table_delete(o->external_table);
214 route_table_finish(o->external_id_table);
718e3744 215
d62a17ae 216 ospf6_distance_reset(o);
217 route_table_finish(o->distance_table);
baff583e 218
d62a17ae 219 XFREE(MTYPE_OSPF6_TOP, o);
508e53e2 220}
718e3744 221
d62a17ae 222static void ospf6_disable(struct ospf6 *o)
718e3744 223{
d62a17ae 224 struct listnode *node, *nnode;
225 struct ospf6_area *oa;
226
227 if (!CHECK_FLAG(o->flag, OSPF6_DISABLED)) {
228 SET_FLAG(o->flag, OSPF6_DISABLED);
229
230 for (ALL_LIST_ELEMENTS(o->area_list, node, nnode, oa))
231 ospf6_area_disable(oa);
232
233 /* XXX: This also changes persistent settings */
234 ospf6_asbr_redistribute_reset();
235
236 ospf6_lsdb_remove_all(o->lsdb);
237 ospf6_route_remove_all(o->route_table);
238 ospf6_route_remove_all(o->brouter_table);
239
240 THREAD_OFF(o->maxage_remover);
241 THREAD_OFF(o->t_spf_calc);
242 THREAD_OFF(o->t_ase_calc);
856ae1eb 243 THREAD_OFF(o->t_distribute_update);
d62a17ae 244 }
508e53e2 245}
718e3744 246
78c6ba61
CS
247void ospf6_master_init(void)
248{
249 memset(&ospf6_master, 0, sizeof(struct ospf6_master));
250
251 om6 = &ospf6_master;
252}
253
d62a17ae 254static int ospf6_maxage_remover(struct thread *thread)
508e53e2 255{
d62a17ae 256 struct ospf6 *o = (struct ospf6 *)THREAD_ARG(thread);
257 struct ospf6_area *oa;
258 struct ospf6_interface *oi;
259 struct ospf6_neighbor *on;
260 struct listnode *i, *j, *k;
261 int reschedule = 0;
262
263 o->maxage_remover = (struct thread *)NULL;
264
265 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
266 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
267 for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, k, on)) {
268 if (on->state != OSPF6_NEIGHBOR_EXCHANGE
269 && on->state != OSPF6_NEIGHBOR_LOADING)
270 continue;
271
272 ospf6_maxage_remove(o);
273 return 0;
274 }
275 }
2449fcd6 276 }
d62a17ae 277
278 for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) {
279 for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) {
280 if (ospf6_lsdb_maxage_remover(oi->lsdb)) {
281 reschedule = 1;
282 }
283 }
284
285 if (ospf6_lsdb_maxage_remover(oa->lsdb)) {
286 reschedule = 1;
287 }
2449fcd6 288 }
2449fcd6 289
d62a17ae 290 if (ospf6_lsdb_maxage_remover(o->lsdb)) {
291 reschedule = 1;
292 }
2449fcd6 293
d62a17ae 294 if (reschedule) {
295 ospf6_maxage_remove(o);
296 }
508e53e2 297
d62a17ae 298 return 0;
718e3744 299}
300
d62a17ae 301void ospf6_maxage_remove(struct ospf6 *o)
718e3744 302{
d62a17ae 303 if (o)
304 thread_add_timer(master, ospf6_maxage_remover, o,
305 OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT,
306 &o->maxage_remover);
718e3744 307}
308
78c6ba61
CS
309void ospf6_router_id_update(void)
310{
311 if (!ospf6)
312 return;
313
314 if (ospf6->router_id_static != 0)
315 ospf6->router_id = ospf6->router_id_static;
316 else
317 ospf6->router_id = om6->zebra_router_id;
318}
319
508e53e2 320/* start ospf6 */
505e5056 321DEFUN_NOSH (router_ospf6,
508e53e2 322 router_ospf6_cmd,
323 "router ospf6",
324 ROUTER_STR
325 OSPF6_STR)
718e3744 326{
78c6ba61 327 if (ospf6 == NULL) {
d62a17ae 328 ospf6 = ospf6_create();
78c6ba61
CS
329 if (ospf6->router_id == 0)
330 ospf6_router_id_update();
331 }
d62a17ae 332 /* set current ospf point. */
333 VTY_PUSH_CONTEXT(OSPF6_NODE, ospf6);
508e53e2 334
d62a17ae 335 return CMD_SUCCESS;
718e3744 336}
337
508e53e2 338/* stop ospf6 */
339DEFUN (no_router_ospf6,
340 no_router_ospf6_cmd,
341 "no router ospf6",
342 NO_STR
16cedbb0
QY
343 ROUTER_STR
344 OSPF6_STR)
718e3744 345{
d62a17ae 346 if (ospf6 == NULL)
347 vty_out(vty, "OSPFv3 is not configured\n");
348 else {
349 ospf6_delete(ospf6);
350 ospf6 = NULL;
351 }
34288970 352
d62a17ae 353 /* return to config node . */
354 VTY_PUSH_CONTEXT_NULL(CONFIG_NODE);
508e53e2 355
d62a17ae 356 return CMD_SUCCESS;
718e3744 357}
358
508e53e2 359/* change Router_ID commands. */
60466a63
QY
360DEFUN(ospf6_router_id,
361 ospf6_router_id_cmd,
362 "ospf6 router-id A.B.C.D",
363 OSPF6_STR
364 "Configure OSPF6 Router-ID\n"
365 V4NOTATION_STR)
718e3744 366{
d62a17ae 367 VTY_DECLVAR_CONTEXT(ospf6, o);
5d1a2ee8 368 int idx = 0;
d62a17ae 369 int ret;
5d1a2ee8 370 const char *router_id_str;
d7c0a89a 371 uint32_t router_id;
d6927cf3
CS
372 struct ospf6_area *oa;
373 struct listnode *node;
d62a17ae 374
5d1a2ee8
QY
375 argv_find(argv, argc, "A.B.C.D", &idx);
376 router_id_str = argv[idx]->arg;
377
378 ret = inet_pton(AF_INET, router_id_str, &router_id);
d62a17ae 379 if (ret == 0) {
60466a63 380 vty_out(vty, "malformed OSPF Router-ID: %s\n", router_id_str);
d62a17ae 381 return CMD_SUCCESS;
382 }
508e53e2 383
d62a17ae 384 o->router_id_static = router_id;
d6927cf3
CS
385
386 for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) {
387 if (oa->full_nbrs) {
388 vty_out(vty,
389 "For this router-id change to take effect,"
390 " save config and restart ospf6d\n");
391 return CMD_SUCCESS;
392 }
393 }
394
395 o->router_id = router_id;
c8a440ec 396
d62a17ae 397 return CMD_SUCCESS;
718e3744 398}
399
60466a63
QY
400DEFUN(no_ospf6_router_id,
401 no_ospf6_router_id_cmd,
402 "no ospf6 router-id [A.B.C.D]",
403 NO_STR OSPF6_STR
404 "Configure OSPF6 Router-ID\n"
405 V4NOTATION_STR)
5d1a2ee8
QY
406{
407 VTY_DECLVAR_CONTEXT(ospf6, o);
d6927cf3
CS
408 struct ospf6_area *oa;
409 struct listnode *node;
410
5d1a2ee8 411 o->router_id_static = 0;
d6927cf3
CS
412
413 for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) {
414 if (oa->full_nbrs) {
415 vty_out(vty,
416 "For this router-id change to take effect,"
417 " save config and restart ospf6d\n");
418 return CMD_SUCCESS;
419 }
420 }
5d1a2ee8 421 o->router_id = 0;
d6927cf3
CS
422 if (o->router_id_zebra.s_addr)
423 o->router_id = (uint32_t)o->router_id_zebra.s_addr;
5d1a2ee8
QY
424
425 return CMD_SUCCESS;
426}
427
66f99ce5 428#if CONFDATE > 20180828
5d1a2ee8
QY
429CPP_NOTICE("ospf6: `router-id A.B.C.D` deprecated 2017/08/28")
430#endif
996c9314
LB
431ALIAS_HIDDEN(ospf6_router_id, ospf6_router_id_hdn_cmd, "router-id A.B.C.D",
432 "Configure OSPF6 Router-ID\n" V4NOTATION_STR)
5d1a2ee8 433
66f99ce5 434#if CONFDATE > 20180828
5d1a2ee8
QY
435CPP_NOTICE("ospf6: `no router-id A.B.C.D` deprecated 2017/08/28")
436#endif
996c9314 437ALIAS_HIDDEN(no_ospf6_router_id, no_ospf6_router_id_hdn_cmd,
5d1a2ee8 438 "no router-id [A.B.C.D]",
996c9314 439 NO_STR "Configure OSPF6 Router-ID\n" V4NOTATION_STR)
5d1a2ee8 440
3d35ca48
DD
441DEFUN (ospf6_log_adjacency_changes,
442 ospf6_log_adjacency_changes_cmd,
443 "log-adjacency-changes",
444 "Log changes in adjacency state\n")
445{
d62a17ae 446 VTY_DECLVAR_CONTEXT(ospf6, ospf6);
3d35ca48 447
d62a17ae 448 SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
449 UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
450 return CMD_SUCCESS;
3d35ca48
DD
451}
452
453DEFUN (ospf6_log_adjacency_changes_detail,
454 ospf6_log_adjacency_changes_detail_cmd,
455 "log-adjacency-changes detail",
692c7954 456 "Log changes in adjacency state\n"
3d35ca48
DD
457 "Log all state changes\n")
458{
d62a17ae 459 VTY_DECLVAR_CONTEXT(ospf6, ospf6);
3d35ca48 460
d62a17ae 461 SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
462 SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
463 return CMD_SUCCESS;
3d35ca48
DD
464}
465
466DEFUN (no_ospf6_log_adjacency_changes,
467 no_ospf6_log_adjacency_changes_cmd,
468 "no log-adjacency-changes",
692c7954 469 NO_STR
3d35ca48
DD
470 "Log changes in adjacency state\n")
471{
d62a17ae 472 VTY_DECLVAR_CONTEXT(ospf6, ospf6);
3d35ca48 473
d62a17ae 474 UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
475 UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
476 return CMD_SUCCESS;
3d35ca48
DD
477}
478
479DEFUN (no_ospf6_log_adjacency_changes_detail,
480 no_ospf6_log_adjacency_changes_detail_cmd,
481 "no log-adjacency-changes detail",
692c7954
DW
482 NO_STR
483 "Log changes in adjacency state\n"
3d35ca48
DD
484 "Log all state changes\n")
485{
d62a17ae 486 VTY_DECLVAR_CONTEXT(ospf6, ospf6);
3d35ca48 487
d62a17ae 488 UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
489 return CMD_SUCCESS;
3d35ca48
DD
490}
491
b6927875
DS
492DEFUN (ospf6_timers_lsa,
493 ospf6_timers_lsa_cmd,
6147e2c6 494 "timers lsa min-arrival (0-600000)",
b6927875
DS
495 "Adjust routing timers\n"
496 "OSPF6 LSA timers\n"
497 "Minimum delay in receiving new version of a LSA\n"
498 "Delay in milliseconds\n")
499{
d62a17ae 500 VTY_DECLVAR_CONTEXT(ospf6, ospf);
501 int idx_number = 3;
502 unsigned int minarrival;
b6927875 503
d62a17ae 504 minarrival = strtoul(argv[idx_number]->arg, NULL, 10);
505 ospf->lsa_minarrival = minarrival;
b6927875 506
d62a17ae 507 return CMD_SUCCESS;
b6927875
DS
508}
509
510DEFUN (no_ospf6_timers_lsa,
511 no_ospf6_timers_lsa_cmd,
1d68dbfe 512 "no timers lsa min-arrival [(0-600000)]",
b6927875
DS
513 NO_STR
514 "Adjust routing timers\n"
515 "OSPF6 LSA timers\n"
3a2d747c
QY
516 "Minimum delay in receiving new version of a LSA\n"
517 "Delay in milliseconds\n")
b6927875 518{
d62a17ae 519 VTY_DECLVAR_CONTEXT(ospf6, ospf);
520 int idx_number = 4;
521 unsigned int minarrival;
b6927875 522
d62a17ae 523 if (argc == 5) {
524 minarrival = strtoul(argv[idx_number]->arg, NULL, 10);
b6927875 525
d62a17ae 526 if (ospf->lsa_minarrival != minarrival
527 || minarrival == OSPF_MIN_LS_ARRIVAL)
528 return CMD_SUCCESS;
529 }
b6927875 530
d62a17ae 531 ospf->lsa_minarrival = OSPF_MIN_LS_ARRIVAL;
b6927875 532
d62a17ae 533 return CMD_SUCCESS;
b6927875
DS
534}
535
b6927875 536
baff583e
MZ
537DEFUN (ospf6_distance,
538 ospf6_distance_cmd,
39e92c06 539 "distance (1-255)",
baff583e
MZ
540 "Administrative distance\n"
541 "OSPF6 Administrative distance\n")
542{
d62a17ae 543 VTY_DECLVAR_CONTEXT(ospf6, o);
baff583e 544
d62a17ae 545 o->distance_all = atoi(argv[1]->arg);
baff583e 546
d62a17ae 547 return CMD_SUCCESS;
baff583e
MZ
548}
549
550DEFUN (no_ospf6_distance,
551 no_ospf6_distance_cmd,
39e92c06 552 "no distance (1-255)",
baff583e
MZ
553 NO_STR
554 "Administrative distance\n"
555 "OSPF6 Administrative distance\n")
556{
d62a17ae 557 VTY_DECLVAR_CONTEXT(ospf6, o);
baff583e 558
d62a17ae 559 o->distance_all = 0;
baff583e 560
d62a17ae 561 return CMD_SUCCESS;
baff583e
MZ
562}
563
564DEFUN (ospf6_distance_ospf6,
565 ospf6_distance_ospf6_cmd,
eaa1ae0d 566 "distance ospf6 {intra-area (1-255)|inter-area (1-255)|external (1-255)}",
baff583e 567 "Administrative distance\n"
eaa1ae0d 568 "OSPF6 administrative distance\n"
39e92c06
QY
569 "Intra-area routes\n"
570 "Distance for intra-area routes\n"
571 "Inter-area routes\n"
572 "Distance for inter-area routes\n"
573 "External routes\n"
baff583e
MZ
574 "Distance for external routes\n")
575{
d62a17ae 576 VTY_DECLVAR_CONTEXT(ospf6, o);
577 int idx = 0;
578
f89a449b
CS
579 o->distance_intra = 0;
580 o->distance_inter = 0;
581 o->distance_external = 0;
582
d62a17ae 583 if (argv_find(argv, argc, "intra-area", &idx))
584 o->distance_intra = atoi(argv[idx + 1]->arg);
585 idx = 0;
586 if (argv_find(argv, argc, "inter-area", &idx))
587 o->distance_inter = atoi(argv[idx + 1]->arg);
588 idx = 0;
589 if (argv_find(argv, argc, "external", &idx))
590 o->distance_external = atoi(argv[idx + 1]->arg);
39e92c06 591
d62a17ae 592 return CMD_SUCCESS;
baff583e
MZ
593}
594
595DEFUN (no_ospf6_distance_ospf6,
596 no_ospf6_distance_ospf6_cmd,
eaa1ae0d 597 "no distance ospf6 [{intra-area [(1-255)]|inter-area [(1-255)]|external [(1-255)]}]",
baff583e
MZ
598 NO_STR
599 "Administrative distance\n"
600 "OSPF6 distance\n"
601 "Intra-area routes\n"
602 "Distance for intra-area routes\n"
603 "Inter-area routes\n"
604 "Distance for inter-area routes\n"
605 "External routes\n"
606 "Distance for external routes\n")
607{
d62a17ae 608 VTY_DECLVAR_CONTEXT(ospf6, o);
609 int idx = 0;
baff583e 610
d62a17ae 611 if (argv_find(argv, argc, "intra-area", &idx) || argc == 3)
612 idx = o->distance_intra = 0;
613 if (argv_find(argv, argc, "inter-area", &idx) || argc == 3)
614 idx = o->distance_inter = 0;
615 if (argv_find(argv, argc, "external", &idx) || argc == 3)
616 o->distance_external = 0;
baff583e 617
d62a17ae 618 return CMD_SUCCESS;
baff583e
MZ
619}
620
d7d73ffc 621#if 0
baff583e
MZ
622DEFUN (ospf6_distance_source,
623 ospf6_distance_source_cmd,
39e92c06 624 "distance (1-255) X:X::X:X/M [WORD]",
baff583e
MZ
625 "Administrative distance\n"
626 "Distance value\n"
627 "IP source prefix\n"
628 "Access list name\n")
629{
cdc2d765 630 VTY_DECLVAR_CONTEXT(ospf6, o);
39e92c06
QY
631 char *alname = (argc == 4) ? argv[3]->arg : NULL;
632 ospf6_distance_set (vty, o, argv[1]->arg, argv[2]->arg, alname);
baff583e
MZ
633
634 return CMD_SUCCESS;
635}
636
637DEFUN (no_ospf6_distance_source,
638 no_ospf6_distance_source_cmd,
39e92c06 639 "no distance (1-255) X:X::X:X/M [WORD]",
baff583e
MZ
640 NO_STR
641 "Administrative distance\n"
642 "Distance value\n"
643 "IP source prefix\n"
644 "Access list name\n")
645{
cdc2d765 646 VTY_DECLVAR_CONTEXT(ospf6, o);
39e92c06
QY
647 char *alname = (argc == 5) ? argv[4]->arg : NULL;
648 ospf6_distance_unset (vty, o, argv[2]->arg, argv[3]->arg, alname);
baff583e
MZ
649
650 return CMD_SUCCESS;
651}
d7d73ffc 652#endif
baff583e 653
508e53e2 654DEFUN (ospf6_interface_area,
655 ospf6_interface_area_cmd,
656 "interface IFNAME area A.B.C.D",
657 "Enable routing on an IPv6 interface\n"
658 IFNAME_STR
659 "Specify the OSPF6 area ID\n"
660 "OSPF6 area ID in IPv4 address notation\n"
661 )
718e3744 662{
d62a17ae 663 VTY_DECLVAR_CONTEXT(ospf6, o);
664 int idx_ifname = 1;
665 int idx_ipv4 = 3;
666 struct ospf6_area *oa;
667 struct ospf6_interface *oi;
668 struct interface *ifp;
d7c0a89a 669 uint32_t area_id;
d62a17ae 670
671 /* find/create ospf6 interface */
bcc24579 672 ifp = if_get_by_name(argv[idx_ifname]->arg, VRF_DEFAULT, 0);
d62a17ae 673 oi = (struct ospf6_interface *)ifp->info;
674 if (oi == NULL)
675 oi = ospf6_interface_create(ifp);
676 if (oi->area) {
677 vty_out(vty, "%s already attached to Area %s\n",
678 oi->interface->name, oi->area->name);
679 return CMD_SUCCESS;
680 }
6452df09 681
d62a17ae 682 /* parse Area-ID */
683 if (inet_pton(AF_INET, argv[idx_ipv4]->arg, &area_id) != 1) {
684 vty_out(vty, "Invalid Area-ID: %s\n", argv[idx_ipv4]->arg);
685 return CMD_SUCCESS;
686 }
687
688 /* find/create ospf6 area */
689 oa = ospf6_area_lookup(area_id, o);
690 if (oa == NULL)
691 oa = ospf6_area_create(area_id, o, OSPF6_AREA_FMT_DOTTEDQUAD);
692
693 /* attach interface to area */
694 listnode_add(oa->if_list, oi); /* sort ?? */
695 oi->area = oa;
696
697 SET_FLAG(oa->flag, OSPF6_AREA_ENABLE);
698
699 /* ospf6 process is currently disabled, not much more to do */
700 if (CHECK_FLAG(o->flag, OSPF6_DISABLED))
701 return CMD_SUCCESS;
702
703 /* start up */
704 ospf6_interface_enable(oi);
705
706 /* If the router is ABR, originate summary routes */
707 if (ospf6_is_router_abr(o))
708 ospf6_abr_enable_area(oa);
709
710 return CMD_SUCCESS;
718e3744 711}
712
508e53e2 713DEFUN (no_ospf6_interface_area,
714 no_ospf6_interface_area_cmd,
715 "no interface IFNAME area A.B.C.D",
716 NO_STR
717 "Disable routing on an IPv6 interface\n"
718 IFNAME_STR
719 "Specify the OSPF6 area ID\n"
720 "OSPF6 area ID in IPv4 address notation\n"
721 )
718e3744 722{
d62a17ae 723 int idx_ifname = 2;
724 int idx_ipv4 = 4;
725 struct ospf6_interface *oi;
726 struct ospf6_area *oa;
727 struct interface *ifp;
d7c0a89a 728 uint32_t area_id;
d62a17ae 729
730 ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT);
731 if (ifp == NULL) {
732 vty_out(vty, "No such interface %s\n", argv[idx_ifname]->arg);
733 return CMD_SUCCESS;
734 }
6452df09 735
d62a17ae 736 oi = (struct ospf6_interface *)ifp->info;
737 if (oi == NULL) {
738 vty_out(vty, "Interface %s not enabled\n", ifp->name);
739 return CMD_SUCCESS;
740 }
741
742 /* parse Area-ID */
743 if (inet_pton(AF_INET, argv[idx_ipv4]->arg, &area_id) != 1) {
744 vty_out(vty, "Invalid Area-ID: %s\n", argv[idx_ipv4]->arg);
745 return CMD_SUCCESS;
746 }
747
748 /* Verify Area */
749 if (oi->area == NULL) {
750 vty_out(vty, "No such Area-ID: %s\n", argv[idx_ipv4]->arg);
751 return CMD_SUCCESS;
752 }
753
754 if (oi->area->area_id != area_id) {
755 vty_out(vty, "Wrong Area-ID: %s is attached to area %s\n",
756 oi->interface->name, oi->area->name);
757 return CMD_SUCCESS;
758 }
759
760 thread_execute(master, interface_down, oi, 0);
761
762 oa = oi->area;
763 listnode_delete(oi->area->if_list, oi);
764 oi->area = (struct ospf6_area *)NULL;
765
766 /* Withdraw inter-area routes from this area, if necessary */
767 if (oa->if_list->count == 0) {
768 UNSET_FLAG(oa->flag, OSPF6_AREA_ENABLE);
769 ospf6_abr_disable_area(oa);
770 }
771
772 return CMD_SUCCESS;
718e3744 773}
774
f41b4a02
DD
775DEFUN (ospf6_stub_router_admin,
776 ospf6_stub_router_admin_cmd,
777 "stub-router administrative",
778 "Make router a stub router\n"
f41b4a02
DD
779 "Administratively applied, for an indefinite period\n")
780{
d62a17ae 781 struct listnode *node;
782 struct ospf6_area *oa;
783
784 if (!CHECK_FLAG(ospf6->flag, OSPF6_STUB_ROUTER)) {
785 for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) {
786 OSPF6_OPT_CLEAR(oa->options, OSPF6_OPT_V6);
787 OSPF6_OPT_CLEAR(oa->options, OSPF6_OPT_R);
788 OSPF6_ROUTER_LSA_SCHEDULE(oa);
789 }
790 SET_FLAG(ospf6->flag, OSPF6_STUB_ROUTER);
f41b4a02 791 }
f41b4a02 792
d62a17ae 793 return CMD_SUCCESS;
f41b4a02
DD
794}
795
796DEFUN (no_ospf6_stub_router_admin,
797 no_ospf6_stub_router_admin_cmd,
798 "no stub-router administrative",
799 NO_STR
800 "Make router a stub router\n"
f41b4a02
DD
801 "Administratively applied, for an indefinite period\n")
802{
d62a17ae 803 struct listnode *node;
804 struct ospf6_area *oa;
805
806 if (CHECK_FLAG(ospf6->flag, OSPF6_STUB_ROUTER)) {
807 for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) {
808 OSPF6_OPT_SET(oa->options, OSPF6_OPT_V6);
809 OSPF6_OPT_SET(oa->options, OSPF6_OPT_R);
810 OSPF6_ROUTER_LSA_SCHEDULE(oa);
811 }
812 UNSET_FLAG(ospf6->flag, OSPF6_STUB_ROUTER);
f41b4a02 813 }
f41b4a02 814
d62a17ae 815 return CMD_SUCCESS;
f41b4a02
DD
816}
817
d7d73ffc 818#if 0
f41b4a02
DD
819DEFUN (ospf6_stub_router_startup,
820 ospf6_stub_router_startup_cmd,
6147e2c6 821 "stub-router on-startup (5-86400)",
f41b4a02
DD
822 "Make router a stub router\n"
823 "Advertise inability to be a transit router\n"
824 "Automatically advertise as stub-router on startup of OSPF6\n"
825 "Time (seconds) to advertise self as stub-router\n")
826{
827 return CMD_SUCCESS;
828}
829
830DEFUN (no_ospf6_stub_router_startup,
831 no_ospf6_stub_router_startup_cmd,
832 "no stub-router on-startup",
833 NO_STR
834 "Make router a stub router\n"
835 "Advertise inability to be a transit router\n"
836 "Automatically advertise as stub-router on startup of OSPF6\n"
837 "Time (seconds) to advertise self as stub-router\n")
838{
839 return CMD_SUCCESS;
840}
841
842DEFUN (ospf6_stub_router_shutdown,
843 ospf6_stub_router_shutdown_cmd,
6147e2c6 844 "stub-router on-shutdown (5-86400)",
f41b4a02
DD
845 "Make router a stub router\n"
846 "Advertise inability to be a transit router\n"
847 "Automatically advertise as stub-router before shutdown\n"
848 "Time (seconds) to advertise self as stub-router\n")
849{
850 return CMD_SUCCESS;
851}
852
853DEFUN (no_ospf6_stub_router_shutdown,
854 no_ospf6_stub_router_shutdown_cmd,
855 "no stub-router on-shutdown",
856 NO_STR
857 "Make router a stub router\n"
858 "Advertise inability to be a transit router\n"
859 "Automatically advertise as stub-router before shutdown\n"
860 "Time (seconds) to advertise self as stub-router\n")
861{
862 return CMD_SUCCESS;
863}
d7d73ffc 864#endif
f41b4a02 865
d62a17ae 866static void ospf6_show(struct vty *vty, struct ospf6 *o)
718e3744 867{
d62a17ae 868 struct listnode *n;
869 struct ospf6_area *oa;
870 char router_id[16], duration[32];
871 struct timeval now, running, result;
872 char buf[32], rbuf[32];
873
874 /* process id, router id */
875 inet_ntop(AF_INET, &o->router_id, router_id, sizeof(router_id));
876 vty_out(vty, " OSPFv3 Routing Process (0) with Router-ID %s\n",
877 router_id);
878
879 /* running time */
880 monotime(&now);
881 timersub(&now, &o->starttime, &running);
882 timerstring(&running, duration, sizeof(duration));
883 vty_out(vty, " Running %s\n", duration);
884
885 /* Redistribute configuration */
886 /* XXX */
887
888 vty_out(vty, " LSA minimum arrival %d msecs\n", o->lsa_minarrival);
889
890 /* Show SPF parameters */
891 vty_out(vty,
892 " Initial SPF scheduling delay %d millisec(s)\n"
893 " Minimum hold time between consecutive SPFs %d millsecond(s)\n"
894 " Maximum hold time between consecutive SPFs %d millsecond(s)\n"
895 " Hold time multiplier is currently %d\n",
896 o->spf_delay, o->spf_holdtime, o->spf_max_holdtime,
897 o->spf_hold_multiplier);
898
899 vty_out(vty, " SPF algorithm ");
900 if (o->ts_spf.tv_sec || o->ts_spf.tv_usec) {
901 timersub(&now, &o->ts_spf, &result);
902 timerstring(&result, buf, sizeof(buf));
903 ospf6_spf_reason_string(o->last_spf_reason, rbuf, sizeof(rbuf));
904 vty_out(vty, "last executed %s ago, reason %s\n", buf, rbuf);
905 vty_out(vty, " Last SPF duration %lld sec %lld usec\n",
906 (long long)o->ts_spf_duration.tv_sec,
907 (long long)o->ts_spf_duration.tv_usec);
908 } else
ab0f1135 909 vty_out(vty, "has not been run\n");
d62a17ae 910 threadtimer_string(now, o->t_spf_calc, buf, sizeof(buf));
911 vty_out(vty, " SPF timer %s%s\n", (o->t_spf_calc ? "due in " : "is "),
912 buf);
913
914 if (CHECK_FLAG(o->flag, OSPF6_STUB_ROUTER))
915 vty_out(vty, " Router Is Stub Router\n");
916
917 /* LSAs */
918 vty_out(vty, " Number of AS scoped LSAs is %u\n", o->lsdb->count);
919
920 /* Areas */
921 vty_out(vty, " Number of areas in this router is %u\n",
922 listcount(o->area_list));
923
924 if (CHECK_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_CHANGES)) {
925 if (CHECK_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_DETAIL))
926 vty_out(vty, " All adjacency changes are logged\n");
927 else
928 vty_out(vty, " Adjacency changes are logged\n");
929 }
930
931 vty_out(vty, "\n");
932
933 for (ALL_LIST_ELEMENTS_RO(o->area_list, n, oa))
934 ospf6_area_show(vty, oa);
718e3744 935}
936
508e53e2 937/* show top level structures */
938DEFUN (show_ipv6_ospf6,
939 show_ipv6_ospf6_cmd,
940 "show ipv6 ospf6",
941 SHOW_STR
942 IP6_STR
943 OSPF6_STR)
718e3744 944{
d62a17ae 945 OSPF6_CMD_CHECK_RUNNING();
508e53e2 946
d62a17ae 947 ospf6_show(vty, ospf6);
948 return CMD_SUCCESS;
718e3744 949}
950
951DEFUN (show_ipv6_ospf6_route,
952 show_ipv6_ospf6_route_cmd,
6de69f83 953 "show ipv6 ospf6 route [<intra-area|inter-area|external-1|external-2|X:X::X:X|X:X::X:X/M|detail|summary>]",
718e3744 954 SHOW_STR
955 IP6_STR
956 OSPF6_STR
508e53e2 957 ROUTE_STR
1d68dbfe
DW
958 "Display Intra-Area routes\n"
959 "Display Inter-Area routes\n"
960 "Display Type-1 External routes\n"
961 "Display Type-2 External routes\n"
962 "Specify IPv6 address\n"
963 "Specify IPv6 prefix\n"
964 "Detailed information\n"
965 "Summary of route table\n")
718e3744 966{
d62a17ae 967 OSPF6_CMD_CHECK_RUNNING();
b52a8a52 968
d62a17ae 969 ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table);
970 return CMD_SUCCESS;
718e3744 971}
972
508e53e2 973DEFUN (show_ipv6_ospf6_route_match,
974 show_ipv6_ospf6_route_match_cmd,
1d68dbfe 975 "show ipv6 ospf6 route X:X::X:X/M <match|longer>",
718e3744 976 SHOW_STR
977 IP6_STR
978 OSPF6_STR
508e53e2 979 ROUTE_STR
980 "Specify IPv6 prefix\n"
981 "Display routes which match the specified route\n"
1d68dbfe 982 "Display routes longer than the specified route\n")
718e3744 983{
d62a17ae 984 OSPF6_CMD_CHECK_RUNNING();
b52a8a52 985
d62a17ae 986 ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table);
987 return CMD_SUCCESS;
718e3744 988}
989
508e53e2 990DEFUN (show_ipv6_ospf6_route_match_detail,
991 show_ipv6_ospf6_route_match_detail_cmd,
4846ef64 992 "show ipv6 ospf6 route X:X::X:X/M match detail",
718e3744 993 SHOW_STR
994 IP6_STR
995 OSPF6_STR
508e53e2 996 ROUTE_STR
997 "Specify IPv6 prefix\n"
998 "Display routes which match the specified route\n"
718e3744 999 "Detailed information\n"
1000 )
508e53e2 1001{
d62a17ae 1002 OSPF6_CMD_CHECK_RUNNING();
b52a8a52 1003
d62a17ae 1004 ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table);
1005 return CMD_SUCCESS;
508e53e2 1006}
718e3744 1007
cb4b8845 1008
4846ef64 1009DEFUN (show_ipv6_ospf6_route_type_detail,
1010 show_ipv6_ospf6_route_type_detail_cmd,
6147e2c6 1011 "show ipv6 ospf6 route <intra-area|inter-area|external-1|external-2> detail",
4846ef64 1012 SHOW_STR
1013 IP6_STR
1014 OSPF6_STR
1015 ROUTE_STR
ea402198
DO
1016 "Display Intra-Area routes\n"
1017 "Display Inter-Area routes\n"
1018 "Display Type-1 External routes\n"
1019 "Display Type-2 External routes\n"
4846ef64 1020 "Detailed information\n"
1021 )
1022{
d62a17ae 1023 OSPF6_CMD_CHECK_RUNNING();
b52a8a52 1024
d62a17ae 1025 ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table);
1026 return CMD_SUCCESS;
4846ef64 1027}
718e3744 1028
d62a17ae 1029static void ospf6_stub_router_config_write(struct vty *vty)
f41b4a02 1030{
d62a17ae 1031 if (CHECK_FLAG(ospf6->flag, OSPF6_STUB_ROUTER)) {
1032 vty_out(vty, " stub-router administrative\n");
1033 }
1034 return;
f41b4a02
DD
1035}
1036
d62a17ae 1037static int ospf6_distance_config_write(struct vty *vty)
baff583e 1038{
d62a17ae 1039 struct route_node *rn;
1040 struct ospf6_distance *odistance;
1041
1042 if (ospf6->distance_all)
1043 vty_out(vty, " distance %u\n", ospf6->distance_all);
1044
1045 if (ospf6->distance_intra || ospf6->distance_inter
1046 || ospf6->distance_external) {
1047 vty_out(vty, " distance ospf6");
1048
1049 if (ospf6->distance_intra)
1050 vty_out(vty, " intra-area %u", ospf6->distance_intra);
1051 if (ospf6->distance_inter)
1052 vty_out(vty, " inter-area %u", ospf6->distance_inter);
1053 if (ospf6->distance_external)
1054 vty_out(vty, " external %u", ospf6->distance_external);
1055
1056 vty_out(vty, "\n");
1057 }
1058
1059 for (rn = route_top(ospf6->distance_table); rn; rn = route_next(rn))
1060 if ((odistance = rn->info) != NULL) {
1061 char buf[PREFIX_STRLEN];
1062
1063 vty_out(vty, " distance %u %s %s\n",
1064 odistance->distance,
1065 prefix2str(&rn->p, buf, sizeof(buf)),
1066 odistance->access_list ? odistance->access_list
1067 : "");
1068 }
1069 return 0;
baff583e
MZ
1070}
1071
508e53e2 1072/* OSPF configuration write function. */
d62a17ae 1073static int config_write_ospf6(struct vty *vty)
508e53e2 1074{
d62a17ae 1075 char router_id[16];
1076 struct listnode *j, *k;
1077 struct ospf6_area *oa;
1078 struct ospf6_interface *oi;
1079
1080 /* OSPFv3 configuration. */
1081 if (ospf6 == NULL)
1082 return CMD_SUCCESS;
1083
1084 inet_ntop(AF_INET, &ospf6->router_id_static, router_id,
1085 sizeof(router_id));
1086 vty_out(vty, "router ospf6\n");
1087 if (ospf6->router_id_static != 0)
5d1a2ee8 1088 vty_out(vty, " ospf6 router-id %s\n", router_id);
d62a17ae 1089
1090 /* log-adjacency-changes flag print. */
1091 if (CHECK_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES)) {
1092 if (CHECK_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL))
1093 vty_out(vty, " log-adjacency-changes detail\n");
1094 else if (!DFLT_OSPF6_LOG_ADJACENCY_CHANGES)
1095 vty_out(vty, " log-adjacency-changes\n");
1096 } else if (DFLT_OSPF6_LOG_ADJACENCY_CHANGES) {
1097 vty_out(vty, " no log-adjacency-changes\n");
1098 }
1099
1100 if (ospf6->ref_bandwidth != OSPF6_REFERENCE_BANDWIDTH)
1101 vty_out(vty, " auto-cost reference-bandwidth %d\n",
1102 ospf6->ref_bandwidth);
1103
1104 /* LSA timers print. */
1105 if (ospf6->lsa_minarrival != OSPF_MIN_LS_ARRIVAL)
1106 vty_out(vty, " timers lsa min-arrival %d\n",
1107 ospf6->lsa_minarrival);
1108
1109 ospf6_stub_router_config_write(vty);
1110 ospf6_redistribute_config_write(vty);
1111 ospf6_area_config_write(vty);
1112 ospf6_spf_config_write(vty);
1113 ospf6_distance_config_write(vty);
1114
1115 for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, j, oa)) {
1116 for (ALL_LIST_ELEMENTS_RO(oa->if_list, k, oi))
1117 vty_out(vty, " interface %s area %s\n",
1118 oi->interface->name, oa->name);
1119 }
1120 vty_out(vty, "!\n");
1121 return 0;
508e53e2 1122}
1123
1124/* OSPF6 node structure. */
d62a17ae 1125static struct cmd_node ospf6_node = {
1126 OSPF6_NODE, "%s(config-ospf6)# ", 1 /* VTYSH */
508e53e2 1127};
1128
1129/* Install ospf related commands. */
d62a17ae 1130void ospf6_top_init(void)
718e3744 1131{
d62a17ae 1132 /* Install ospf6 top node. */
1133 install_node(&ospf6_node, config_write_ospf6);
1134
1135 install_element(VIEW_NODE, &show_ipv6_ospf6_cmd);
1136 install_element(CONFIG_NODE, &router_ospf6_cmd);
1137 install_element(CONFIG_NODE, &no_router_ospf6_cmd);
1138
1139 install_element(VIEW_NODE, &show_ipv6_ospf6_route_cmd);
1140 install_element(VIEW_NODE, &show_ipv6_ospf6_route_match_cmd);
1141 install_element(VIEW_NODE, &show_ipv6_ospf6_route_match_detail_cmd);
1142 install_element(VIEW_NODE, &show_ipv6_ospf6_route_type_detail_cmd);
1143
1144 install_default(OSPF6_NODE);
1145 install_element(OSPF6_NODE, &ospf6_router_id_cmd);
5d1a2ee8
QY
1146 install_element(OSPF6_NODE, &no_ospf6_router_id_cmd);
1147 install_element(OSPF6_NODE, &ospf6_router_id_hdn_cmd);
1148 install_element(OSPF6_NODE, &no_ospf6_router_id_hdn_cmd);
d62a17ae 1149 install_element(OSPF6_NODE, &ospf6_log_adjacency_changes_cmd);
1150 install_element(OSPF6_NODE, &ospf6_log_adjacency_changes_detail_cmd);
1151 install_element(OSPF6_NODE, &no_ospf6_log_adjacency_changes_cmd);
1152 install_element(OSPF6_NODE, &no_ospf6_log_adjacency_changes_detail_cmd);
1153
1154 /* LSA timers commands */
1155 install_element(OSPF6_NODE, &ospf6_timers_lsa_cmd);
1156 install_element(OSPF6_NODE, &no_ospf6_timers_lsa_cmd);
1157
1158 install_element(OSPF6_NODE, &ospf6_interface_area_cmd);
1159 install_element(OSPF6_NODE, &no_ospf6_interface_area_cmd);
1160 install_element(OSPF6_NODE, &ospf6_stub_router_admin_cmd);
1161 install_element(OSPF6_NODE, &no_ospf6_stub_router_admin_cmd);
1162/* For a later time */
34d5ef45 1163#if 0
f41b4a02
DD
1164 install_element (OSPF6_NODE, &ospf6_stub_router_startup_cmd);
1165 install_element (OSPF6_NODE, &no_ospf6_stub_router_startup_cmd);
1166 install_element (OSPF6_NODE, &ospf6_stub_router_shutdown_cmd);
1167 install_element (OSPF6_NODE, &no_ospf6_stub_router_shutdown_cmd);
34d5ef45 1168#endif
508e53e2 1169
d62a17ae 1170 install_element(OSPF6_NODE, &ospf6_distance_cmd);
1171 install_element(OSPF6_NODE, &no_ospf6_distance_cmd);
1172 install_element(OSPF6_NODE, &ospf6_distance_ospf6_cmd);
1173 install_element(OSPF6_NODE, &no_ospf6_distance_ospf6_cmd);
baff583e
MZ
1174#if 0
1175 install_element (OSPF6_NODE, &ospf6_distance_source_cmd);
1176 install_element (OSPF6_NODE, &no_ospf6_distance_source_cmd);
1177#endif
718e3744 1178}