1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2003 Yasuhiro Ohara
20 #include "ospf6_proto.h"
21 #include "ospf6_lsa.h"
22 #include "ospf6_lsdb.h"
23 #include "ospf6_route.h"
24 #include "ospf6_spf.h"
25 #include "ospf6_top.h"
26 #include "ospf6_area.h"
27 #include "ospf6_message.h"
28 #include "ospf6_neighbor.h"
29 #include "ospf6_interface.h"
30 #include "ospf6_intra.h"
31 #include "ospf6_abr.h"
32 #include "ospf6_asbr.h"
33 #include "ospf6_zebra.h"
36 #include "ospf6_nssa.h"
37 #include "ospf6d/ospf6_area_clippy.c"
39 DEFINE_MTYPE_STATIC(OSPF6D
, OSPF6_AREA
, "OSPF6 area");
40 DEFINE_MTYPE_STATIC(OSPF6D
, OSPF6_PLISTNAME
, "Prefix list name");
42 int str2area_id(const char *str
, uint32_t *area_id
, int *area_id_fmt
)
46 *area_id
= htonl(strtoul(str
, &ep
, 10));
47 if (*ep
&& inet_pton(AF_INET
, str
, area_id
) != 1)
51 !*ep
? OSPF6_AREA_FMT_DECIMAL
: OSPF6_AREA_FMT_DOTTEDQUAD
;
56 void area_id2str(char *buf
, int len
, uint32_t area_id
, int area_id_fmt
)
58 if (area_id_fmt
== OSPF6_AREA_FMT_DECIMAL
)
59 snprintf(buf
, len
, "%u", ntohl(area_id
));
61 inet_ntop(AF_INET
, &area_id
, buf
, len
);
64 int ospf6_area_cmp(void *va
, void *vb
)
66 struct ospf6_area
*oa
= (struct ospf6_area
*)va
;
67 struct ospf6_area
*ob
= (struct ospf6_area
*)vb
;
68 return (ntohl(oa
->area_id
) < ntohl(ob
->area_id
) ? -1 : 1);
71 /* schedule routing table recalculation */
72 static void ospf6_area_lsdb_hook_add(struct ospf6_lsa
*lsa
)
74 switch (ntohs(lsa
->header
->type
)) {
76 case OSPF6_LSTYPE_ROUTER
:
77 case OSPF6_LSTYPE_NETWORK
:
78 if (IS_OSPF6_DEBUG_EXAMIN_TYPE(lsa
->header
->type
)) {
79 zlog_debug("%s Examin LSA %s", __func__
, lsa
->name
);
80 zlog_debug(" Schedule SPF Calculation for %s",
81 OSPF6_AREA(lsa
->lsdb
->data
)->name
);
84 OSPF6_PROCESS(OSPF6_AREA(lsa
->lsdb
->data
)->ospf6
),
85 ospf6_lsadd_to_spf_reason(lsa
));
88 case OSPF6_LSTYPE_INTRA_PREFIX
:
89 ospf6_intra_prefix_lsa_add(lsa
);
92 case OSPF6_LSTYPE_INTER_PREFIX
:
93 case OSPF6_LSTYPE_INTER_ROUTER
:
94 ospf6_abr_examin_summary(lsa
,
95 (struct ospf6_area
*)lsa
->lsdb
->data
);
98 case OSPF6_LSTYPE_TYPE_7
:
99 ospf6_asbr_lsa_add(lsa
);
107 static void ospf6_area_lsdb_hook_remove(struct ospf6_lsa
*lsa
)
109 switch (ntohs(lsa
->header
->type
)) {
110 case OSPF6_LSTYPE_ROUTER
:
111 case OSPF6_LSTYPE_NETWORK
:
112 if (IS_OSPF6_DEBUG_EXAMIN_TYPE(lsa
->header
->type
)) {
113 zlog_debug("LSA disappearing: %s", lsa
->name
);
114 zlog_debug("Schedule SPF Calculation for %s",
115 OSPF6_AREA(lsa
->lsdb
->data
)->name
);
118 OSPF6_PROCESS(OSPF6_AREA(lsa
->lsdb
->data
)->ospf6
),
119 ospf6_lsremove_to_spf_reason(lsa
));
122 case OSPF6_LSTYPE_INTRA_PREFIX
:
123 ospf6_intra_prefix_lsa_remove(lsa
);
126 case OSPF6_LSTYPE_INTER_PREFIX
:
127 case OSPF6_LSTYPE_INTER_ROUTER
:
128 ospf6_abr_examin_summary(lsa
,
129 (struct ospf6_area
*)lsa
->lsdb
->data
);
131 case OSPF6_LSTYPE_TYPE_7
:
132 ospf6_asbr_lsa_remove(lsa
, NULL
);
139 static void ospf6_area_route_hook_add(struct ospf6_route
*route
)
141 struct ospf6_area
*oa
= route
->table
->scope
;
142 struct ospf6
*ospf6
= oa
->ospf6
;
143 struct ospf6_route
*copy
;
145 copy
= ospf6_route_copy(route
);
146 ospf6_route_add(copy
, ospf6
->route_table
);
149 static void ospf6_area_route_hook_remove(struct ospf6_route
*route
)
151 struct ospf6_area
*oa
= route
->table
->scope
;
152 struct ospf6
*ospf6
= oa
->ospf6
;
153 struct ospf6_route
*copy
;
155 copy
= ospf6_route_lookup_identical(route
, ospf6
->route_table
);
157 ospf6_route_remove(copy
, ospf6
->route_table
);
160 static void ospf6_area_stub_update(struct ospf6_area
*area
)
163 if (IS_AREA_STUB(area
)) {
164 if (IS_OSPF6_DEBUG_ORIGINATE(ROUTER
))
165 zlog_debug("Stubbing out area for area %s", area
->name
);
166 OSPF6_OPT_CLEAR(area
->options
, OSPF6_OPT_E
);
167 ospf6_asbr_remove_externals_from_area(area
);
168 } else if (IS_AREA_ENABLED(area
)) {
169 if (IS_OSPF6_DEBUG_ORIGINATE(ROUTER
))
170 zlog_debug("Normal area for area %s", area
->name
);
171 OSPF6_OPT_SET(area
->options
, OSPF6_OPT_E
);
172 ospf6_asbr_send_externals_to_area(area
);
175 OSPF6_ROUTER_LSA_SCHEDULE(area
);
178 static int ospf6_area_stub_set(struct ospf6
*ospf6
, struct ospf6_area
*area
)
180 if (!IS_AREA_STUB(area
)) {
181 /* Disable NSSA first. */
182 ospf6_area_nssa_unset(ospf6
, area
);
184 SET_FLAG(area
->flag
, OSPF6_AREA_STUB
);
185 ospf6_area_stub_update(area
);
191 void ospf6_area_stub_unset(struct ospf6
*ospf6
, struct ospf6_area
*area
)
193 if (IS_AREA_STUB(area
)) {
194 UNSET_FLAG(area
->flag
, OSPF6_AREA_STUB
);
195 ospf6_area_stub_update(area
);
199 static void ospf6_area_no_summary_set(struct ospf6
*ospf6
,
200 struct ospf6_area
*area
)
203 if (!area
->no_summary
) {
204 area
->no_summary
= 1;
205 ospf6_abr_range_reset_cost(ospf6
);
206 ospf6_abr_prefix_resummarize(ospf6
);
211 static void ospf6_area_no_summary_unset(struct ospf6
*ospf6
,
212 struct ospf6_area
*area
)
215 if (area
->no_summary
) {
216 area
->no_summary
= 0;
217 ospf6_abr_range_reset_cost(ospf6
);
218 ospf6_abr_prefix_resummarize(ospf6
);
223 static void ospf6_nssa_default_originate_set(struct ospf6
*ospf6
,
224 struct ospf6_area
*area
,
225 int metric
, int metric_type
)
227 if (!area
->nssa_default_originate
.enabled
) {
228 area
->nssa_default_originate
.enabled
= true;
229 if (++ospf6
->nssa_default_import_check
.refcnt
== 1) {
230 ospf6
->nssa_default_import_check
.status
= false;
231 ospf6_zebra_import_default_route(ospf6
, false);
235 area
->nssa_default_originate
.metric_value
= metric
;
236 area
->nssa_default_originate
.metric_type
= metric_type
;
239 static void ospf6_nssa_default_originate_unset(struct ospf6
*ospf6
,
240 struct ospf6_area
*area
)
242 if (area
->nssa_default_originate
.enabled
) {
243 area
->nssa_default_originate
.enabled
= false;
244 if (--ospf6
->nssa_default_import_check
.refcnt
== 0) {
245 ospf6
->nssa_default_import_check
.status
= false;
246 ospf6_zebra_import_default_route(ospf6
, true);
248 area
->nssa_default_originate
.metric_value
= -1;
249 area
->nssa_default_originate
.metric_type
= -1;
254 * Make new area structure.
256 * @param area_id - ospf6 area ID
257 * @param o - ospf6 instance
258 * @param df - display format for area ID
260 struct ospf6_area
*ospf6_area_create(uint32_t area_id
, struct ospf6
*o
, int df
)
262 struct ospf6_area
*oa
;
264 oa
= XCALLOC(MTYPE_OSPF6_AREA
, sizeof(struct ospf6_area
));
267 case OSPF6_AREA_FMT_DECIMAL
:
268 snprintf(oa
->name
, sizeof(oa
->name
), "%u", ntohl(area_id
));
271 case OSPF6_AREA_FMT_DOTTEDQUAD
:
272 inet_ntop(AF_INET
, &area_id
, oa
->name
, sizeof(oa
->name
));
276 oa
->area_id
= area_id
;
277 oa
->if_list
= list_new();
279 oa
->lsdb
= ospf6_lsdb_create(oa
);
280 oa
->lsdb
->hook_add
= ospf6_area_lsdb_hook_add
;
281 oa
->lsdb
->hook_remove
= ospf6_area_lsdb_hook_remove
;
282 oa
->lsdb_self
= ospf6_lsdb_create(oa
);
283 oa
->temp_router_lsa_lsdb
= ospf6_lsdb_create(oa
);
285 oa
->spf_table
= OSPF6_ROUTE_TABLE_CREATE(AREA
, SPF_RESULTS
);
286 oa
->spf_table
->scope
= oa
;
287 oa
->route_table
= OSPF6_ROUTE_TABLE_CREATE(AREA
, ROUTES
);
288 oa
->route_table
->scope
= oa
;
289 oa
->route_table
->hook_add
= ospf6_area_route_hook_add
;
290 oa
->route_table
->hook_remove
= ospf6_area_route_hook_remove
;
292 oa
->range_table
= OSPF6_ROUTE_TABLE_CREATE(AREA
, PREFIX_RANGES
);
293 oa
->range_table
->scope
= oa
;
294 oa
->nssa_range_table
= OSPF6_ROUTE_TABLE_CREATE(AREA
, PREFIX_RANGES
);
295 oa
->nssa_range_table
->scope
= oa
;
296 oa
->summary_prefix
= OSPF6_ROUTE_TABLE_CREATE(AREA
, SUMMARY_PREFIXES
);
297 oa
->summary_prefix
->scope
= oa
;
298 oa
->summary_router
= OSPF6_ROUTE_TABLE_CREATE(AREA
, SUMMARY_ROUTERS
);
299 oa
->summary_router
->scope
= oa
;
300 oa
->router_lsa_size_limit
= 1024 + 256;
302 /* set default options */
303 if (CHECK_FLAG(o
->flag
, OSPF6_STUB_ROUTER
)) {
304 OSPF6_OPT_CLEAR(oa
->options
, OSPF6_OPT_V6
);
305 OSPF6_OPT_CLEAR(oa
->options
, OSPF6_OPT_R
);
307 OSPF6_OPT_SET(oa
->options
, OSPF6_OPT_V6
);
308 OSPF6_OPT_SET(oa
->options
, OSPF6_OPT_R
);
311 OSPF6_OPT_SET(oa
->options
, OSPF6_OPT_E
);
313 SET_FLAG(oa
->flag
, OSPF6_AREA_ACTIVE
);
314 SET_FLAG(oa
->flag
, OSPF6_AREA_ENABLE
);
317 listnode_add_sort(o
->area_list
, oa
);
319 if (area_id
== OSPF_AREA_BACKBONE
) {
326 void ospf6_area_delete(struct ospf6_area
*oa
)
329 struct ospf6_interface
*oi
;
331 /* The ospf6_interface structs store configuration
332 * information which should not be lost/reset when
334 * So just detach the interface from the area and
336 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, n
, oi
)) {
339 struct listnode
*node
;
340 struct listnode
*nnode
;
341 struct ospf6_neighbor
*on
;
343 for (ALL_LIST_ELEMENTS(oi
->neighbor_list
, node
, nnode
, on
))
344 ospf6_neighbor_delete(on
);
347 list_delete(&oa
->if_list
);
349 ospf6_lsdb_delete(oa
->lsdb
);
350 ospf6_lsdb_delete(oa
->lsdb_self
);
351 ospf6_lsdb_delete(oa
->temp_router_lsa_lsdb
);
353 ospf6_spf_table_finish(oa
->spf_table
);
354 ospf6_route_table_delete(oa
->spf_table
);
355 ospf6_route_table_delete(oa
->route_table
);
357 ospf6_route_table_delete(oa
->range_table
);
358 ospf6_route_table_delete(oa
->nssa_range_table
);
359 ospf6_route_table_delete(oa
->summary_prefix
);
360 ospf6_route_table_delete(oa
->summary_router
);
362 listnode_delete(oa
->ospf6
->area_list
, oa
);
366 XFREE(MTYPE_OSPF6_AREA
, oa
);
369 struct ospf6_area
*ospf6_area_lookup_by_area_id(uint32_t area_id
)
371 struct ospf6_area
*oa
;
372 struct listnode
*n
, *node
, *nnode
;
375 for (ALL_LIST_ELEMENTS(om6
->ospf6
, node
, nnode
, ospf6
)) {
376 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, n
, oa
))
377 if (oa
->area_id
== area_id
)
380 return (struct ospf6_area
*)NULL
;
383 struct ospf6_area
*ospf6_area_lookup(uint32_t area_id
, struct ospf6
*ospf6
)
385 struct ospf6_area
*oa
;
388 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, n
, oa
))
389 if (oa
->area_id
== area_id
)
392 return (struct ospf6_area
*)NULL
;
395 void ospf6_area_enable(struct ospf6_area
*oa
)
397 struct listnode
*node
, *nnode
;
398 struct ospf6_interface
*oi
;
400 SET_FLAG(oa
->flag
, OSPF6_AREA_ENABLE
);
402 for (ALL_LIST_ELEMENTS(oa
->if_list
, node
, nnode
, oi
))
403 ospf6_interface_enable(oi
);
404 ospf6_abr_enable_area(oa
);
407 void ospf6_area_disable(struct ospf6_area
*oa
)
409 struct listnode
*node
, *nnode
;
410 struct ospf6_interface
*oi
;
412 UNSET_FLAG(oa
->flag
, OSPF6_AREA_ENABLE
);
414 for (ALL_LIST_ELEMENTS(oa
->if_list
, node
, nnode
, oi
))
415 ospf6_interface_disable(oi
);
417 ospf6_abr_disable_area(oa
);
418 ospf6_lsdb_remove_all(oa
->lsdb
);
419 ospf6_lsdb_remove_all(oa
->lsdb_self
);
421 ospf6_spf_table_finish(oa
->spf_table
);
422 ospf6_route_remove_all(oa
->route_table
);
424 THREAD_OFF(oa
->thread_router_lsa
);
425 THREAD_OFF(oa
->thread_intra_prefix_lsa
);
429 void ospf6_area_show(struct vty
*vty
, struct ospf6_area
*oa
,
430 json_object
*json_areas
, bool use_json
)
433 struct ospf6_interface
*oi
;
434 unsigned long result
;
435 json_object
*json_area
;
436 json_object
*array_interfaces
;
439 json_area
= json_object_new_object();
440 json_object_boolean_add(json_area
, "areaIsStub",
442 json_object_boolean_add(json_area
, "areaIsNSSA",
444 if (IS_AREA_STUB(oa
) || IS_AREA_NSSA(oa
)) {
445 json_object_boolean_add(json_area
, "areaNoSummary",
449 json_object_int_add(json_area
, "numberOfAreaScopedLsa",
451 json_object_object_add(
452 json_area
, "lsaStatistics",
453 JSON_OBJECT_NEW_ARRAY(json_object_new_int
,
457 /* Interfaces Attached */
458 array_interfaces
= json_object_new_array();
459 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, i
, oi
))
460 json_object_array_add(
462 json_object_new_string(oi
->interface
->name
));
464 json_object_object_add(json_area
, "interfacesAttachedToArea",
467 if (oa
->ts_spf
.tv_sec
|| oa
->ts_spf
.tv_usec
) {
468 json_object_boolean_true_add(json_area
, "spfHasRun");
469 result
= monotime_since(&oa
->ts_spf
, NULL
);
470 if (result
/ TIMER_SECOND_MICRO
> 0) {
472 json_area
, "spfLastExecutedSecs",
473 result
/ TIMER_SECOND_MICRO
);
476 json_area
, "spfLastExecutedMicroSecs",
477 result
% TIMER_SECOND_MICRO
);
479 json_object_int_add(json_area
,
480 "spfLastExecutedSecs", 0);
481 json_object_int_add(json_area
,
482 "spfLastExecutedMicroSecs",
486 json_object_boolean_false_add(json_area
, "spfHasRun");
489 json_object_object_add(json_areas
, oa
->name
, json_area
);
493 if (!IS_AREA_STUB(oa
) && !IS_AREA_NSSA(oa
))
494 vty_out(vty
, " Area %s\n", oa
->name
);
496 if (oa
->no_summary
) {
497 vty_out(vty
, " Area %s[%s, No Summary]\n",
499 IS_AREA_STUB(oa
) ? "Stub" : "NSSA");
501 vty_out(vty
, " Area %s[%s]\n", oa
->name
,
502 IS_AREA_STUB(oa
) ? "Stub" : "NSSA");
505 vty_out(vty
, " Number of Area scoped LSAs is %u\n",
508 vty_out(vty
, " Interface attached to this area:");
509 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, i
, oi
))
510 vty_out(vty
, " %s", oi
->interface
->name
);
513 if (oa
->ts_spf
.tv_sec
|| oa
->ts_spf
.tv_usec
) {
514 result
= monotime_since(&oa
->ts_spf
, NULL
);
515 if (result
/ TIMER_SECOND_MICRO
> 0) {
517 " SPF last executed %ld.%lds ago\n",
518 result
/ TIMER_SECOND_MICRO
,
519 result
% TIMER_SECOND_MICRO
);
522 " SPF last executed %ldus ago\n",
526 vty_out(vty
, "SPF has not been run\n");
532 "area <A.B.C.D|(0-4294967295)> range X:X::X:X/M [<advertise|not-advertise|cost (0-16777215)>]",
533 "OSPF6 area parameters\n"
534 "OSPF6 area ID in IP address format\n"
535 "OSPF6 area ID as a decimal value\n"
536 "Configured address range\n"
537 "Specify IPv6 prefix\n"
540 "User specified metric for this range\n"
541 "Advertised metric for this range\n")
544 int idx_ipv6_prefixlen
= 3;
547 struct ospf6_area
*oa
;
548 struct prefix prefix
;
549 struct ospf6_route
*range
;
552 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
554 OSPF6_CMD_AREA_GET(argv
[idx_ipv4
]->arg
, oa
, ospf6
);
556 ret
= str2prefix(argv
[idx_ipv6_prefixlen
]->arg
, &prefix
);
557 if (ret
!= 1 || prefix
.family
!= AF_INET6
) {
558 vty_out(vty
, "Malformed argument: %s\n",
559 argv
[idx_ipv6_prefixlen
]->arg
);
563 range
= ospf6_route_lookup(&prefix
, oa
->range_table
);
565 range
= ospf6_route_create(ospf6
);
566 range
->type
= OSPF6_DEST_TYPE_RANGE
;
567 range
->prefix
= prefix
;
568 range
->path
.area_id
= oa
->area_id
;
569 range
->path
.cost
= OSPF_AREA_RANGE_COST_UNSPEC
;
572 /* default settings */
573 cost
= OSPF_AREA_RANGE_COST_UNSPEC
;
574 UNSET_FLAG(range
->flag
, OSPF6_ROUTE_DO_NOT_ADVERTISE
);
576 if (argc
> idx_type
) {
577 if (strmatch(argv
[idx_type
]->text
, "not-advertise"))
578 SET_FLAG(range
->flag
, OSPF6_ROUTE_DO_NOT_ADVERTISE
);
579 else if (strmatch(argv
[idx_type
]->text
, "cost"))
580 cost
= strtoul(argv
[5]->arg
, NULL
, 10);
583 range
->path
.u
.cost_config
= cost
;
585 if (range
->rnode
== NULL
) {
586 ospf6_route_add(range
, oa
->range_table
);
589 if (ospf6_check_and_set_router_abr(ospf6
)) {
590 /* Redo summaries if required */
591 ospf6_abr_prefix_resummarize(ospf6
);
597 DEFUN (no_area_range
,
599 "no area <A.B.C.D|(0-4294967295)> range X:X::X:X/M [<advertise|not-advertise|cost (0-16777215)>]",
601 "OSPF6 area parameters\n"
602 "OSPF6 area ID in IP address format\n"
603 "OSPF6 area ID as a decimal value\n"
604 "Configured address range\n"
605 "Specify IPv6 prefix\n"
608 "User specified metric for this range\n"
609 "Advertised metric for this range\n")
614 struct ospf6_area
*oa
;
615 struct prefix prefix
;
616 struct ospf6_route
*range
, *route
;
618 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
620 OSPF6_CMD_AREA_GET(argv
[idx_ipv4
]->arg
, oa
, ospf6
);
622 ret
= str2prefix(argv
[idx_ipv6
]->arg
, &prefix
);
623 if (ret
!= 1 || prefix
.family
!= AF_INET6
) {
624 vty_out(vty
, "Malformed argument: %s\n", argv
[idx_ipv6
]->arg
);
628 range
= ospf6_route_lookup(&prefix
, oa
->range_table
);
630 vty_out(vty
, "Range %s does not exists.\n",
631 argv
[idx_ipv6
]->arg
);
635 if (ospf6_check_and_set_router_abr(oa
->ospf6
)) {
636 /* Blow away the aggregated LSA and route */
637 SET_FLAG(range
->flag
, OSPF6_ROUTE_REMOVE
);
639 /* Redo summaries if required */
640 for (route
= ospf6_route_head(oa
->ospf6
->route_table
); route
;
641 route
= ospf6_route_next(route
))
642 ospf6_abr_originate_summary(route
, oa
->ospf6
);
644 /* purge the old aggregated summary LSA */
645 ospf6_abr_originate_summary(range
, oa
->ospf6
);
647 ospf6_route_remove(range
, oa
->range_table
);
652 void ospf6_area_config_write(struct vty
*vty
, struct ospf6
*ospf6
)
654 struct listnode
*node
;
655 struct ospf6_area
*oa
;
656 struct ospf6_route
*range
;
658 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, node
, oa
)) {
659 for (range
= ospf6_route_head(oa
->range_table
); range
;
660 range
= ospf6_route_next(range
)) {
661 vty_out(vty
, " area %s range %pFX", oa
->name
,
664 if (CHECK_FLAG(range
->flag
,
665 OSPF6_ROUTE_DO_NOT_ADVERTISE
)) {
666 vty_out(vty
, " not-advertise");
668 // "advertise" is the default so we do not
670 if (range
->path
.u
.cost_config
671 != OSPF_AREA_RANGE_COST_UNSPEC
)
672 vty_out(vty
, " cost %d",
673 range
->path
.u
.cost_config
);
677 if (IS_AREA_STUB(oa
)) {
679 vty_out(vty
, " area %s stub no-summary\n",
682 vty_out(vty
, " area %s stub\n", oa
->name
);
684 if (IS_AREA_NSSA(oa
)) {
685 vty_out(vty
, " area %s nssa", oa
->name
);
686 if (oa
->nssa_default_originate
.enabled
) {
687 vty_out(vty
, " default-information-originate");
688 if (oa
->nssa_default_originate
.metric_value
690 vty_out(vty
, " metric %d",
691 oa
->nssa_default_originate
693 if (oa
->nssa_default_originate
.metric_type
694 != DEFAULT_METRIC_TYPE
)
695 vty_out(vty
, " metric-type 1");
698 vty_out(vty
, " no-summary");
701 for (range
= ospf6_route_head(oa
->nssa_range_table
); range
;
702 range
= ospf6_route_next(range
)) {
703 vty_out(vty
, " area %s nssa range %pFX", oa
->name
,
706 if (CHECK_FLAG(range
->flag
,
707 OSPF6_ROUTE_DO_NOT_ADVERTISE
)) {
708 vty_out(vty
, " not-advertise");
710 if (range
->path
.u
.cost_config
711 != OSPF_AREA_RANGE_COST_UNSPEC
)
712 vty_out(vty
, " cost %u",
713 range
->path
.u
.cost_config
);
717 if (PREFIX_NAME_IN(oa
))
718 vty_out(vty
, " area %s filter-list prefix %s in\n",
719 oa
->name
, PREFIX_NAME_IN(oa
));
720 if (PREFIX_NAME_OUT(oa
))
721 vty_out(vty
, " area %s filter-list prefix %s out\n",
722 oa
->name
, PREFIX_NAME_OUT(oa
));
724 vty_out(vty
, " area %s import-list %s\n", oa
->name
,
727 vty_out(vty
, " area %s export-list %s\n", oa
->name
,
732 DEFUN (area_filter_list
,
733 area_filter_list_cmd
,
734 "area <A.B.C.D|(0-4294967295)> filter-list prefix PREFIXLIST_NAME <in|out>",
735 "OSPF6 area parameters\n"
736 "OSPF6 area ID in IP address format\n"
737 "OSPF6 area ID as a decimal value\n"
738 "Filter networks between OSPF6 areas\n"
739 "Filter prefixes between OSPF6 areas\n"
740 "Name of an IPv6 prefix-list\n"
741 "Filter networks sent to this area\n"
742 "Filter networks sent from this area\n")
744 char *inout
= argv
[argc
- 1]->text
;
745 char *areaid
= argv
[1]->arg
;
746 char *plistname
= argv
[4]->arg
;
748 struct ospf6_area
*area
;
749 struct prefix_list
*plist
;
751 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
753 OSPF6_CMD_AREA_GET(areaid
, area
, ospf6
);
755 plist
= prefix_list_lookup(AFI_IP6
, plistname
);
756 if (strmatch(inout
, "in")) {
757 PREFIX_LIST_IN(area
) = plist
;
758 XFREE(MTYPE_OSPF6_PLISTNAME
, PREFIX_NAME_IN(area
));
759 PREFIX_NAME_IN(area
) =
760 XSTRDUP(MTYPE_OSPF6_PLISTNAME
, plistname
);
762 PREFIX_LIST_OUT(area
) = plist
;
763 XFREE(MTYPE_OSPF6_PLISTNAME
, PREFIX_NAME_OUT(area
));
764 PREFIX_NAME_OUT(area
) =
765 XSTRDUP(MTYPE_OSPF6_PLISTNAME
, plistname
);
768 /* Redo summaries if required */
769 if (ospf6_check_and_set_router_abr(area
->ospf6
))
770 ospf6_schedule_abr_task(ospf6
);
775 DEFUN (no_area_filter_list
,
776 no_area_filter_list_cmd
,
777 "no area <A.B.C.D|(0-4294967295)> filter-list prefix PREFIXLIST_NAME <in|out>",
779 "OSPF6 area parameters\n"
780 "OSPF6 area ID in IP address format\n"
781 "OSPF6 area ID as a decimal value\n"
782 "Filter networks between OSPF6 areas\n"
783 "Filter prefixes between OSPF6 areas\n"
784 "Name of an IPv6 prefix-list\n"
785 "Filter networks sent to this area\n"
786 "Filter networks sent from this area\n")
788 char *inout
= argv
[argc
- 1]->text
;
789 char *areaid
= argv
[2]->arg
;
790 char *plistname
= argv
[5]->arg
;
792 struct ospf6_area
*area
;
794 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
795 OSPF6_CMD_AREA_GET(areaid
, area
, ospf6
);
797 if (strmatch(inout
, "in")) {
798 if (PREFIX_NAME_IN(area
))
799 if (!strmatch(PREFIX_NAME_IN(area
), plistname
))
802 PREFIX_LIST_IN(area
) = NULL
;
803 XFREE(MTYPE_OSPF6_PLISTNAME
, PREFIX_NAME_IN(area
));
805 if (PREFIX_NAME_OUT(area
))
806 if (!strmatch(PREFIX_NAME_OUT(area
), plistname
))
809 XFREE(MTYPE_OSPF6_PLISTNAME
, PREFIX_NAME_OUT(area
));
810 PREFIX_LIST_OUT(area
) = NULL
;
813 /* Redo summaries if required */
814 if (ospf6_check_and_set_router_abr(area
->ospf6
))
815 ospf6_schedule_abr_task(ospf6
);
820 void ospf6_filter_update(struct access_list
*access
)
822 struct ospf6_area
*oa
;
823 struct listnode
*n
, *node
, *nnode
;
826 for (ALL_LIST_ELEMENTS(om6
->ospf6
, node
, nnode
, ospf6
)) {
829 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, n
, oa
)) {
831 && strcmp(IMPORT_NAME(oa
), access
->name
) == 0) {
832 IMPORT_LIST(oa
) = access_list_lookup(
833 AFI_IP6
, IMPORT_NAME(oa
));
838 && strcmp(EXPORT_NAME(oa
), access
->name
) == 0) {
839 EXPORT_LIST(oa
) = access_list_lookup(
840 AFI_IP6
, EXPORT_NAME(oa
));
845 if (update
&& ospf6_check_and_set_router_abr(ospf6
))
846 ospf6_schedule_abr_task(ospf6
);
850 void ospf6_plist_update(struct prefix_list
*plist
)
852 struct listnode
*node
, *nnode
;
853 struct ospf6_area
*oa
;
855 const char *name
= prefix_list_name(plist
);
856 struct ospf6
*ospf6
= NULL
;
858 if (prefix_list_afi(plist
) != AFI_IP6
)
861 for (ALL_LIST_ELEMENTS(om6
->ospf6
, node
, nnode
, ospf6
)) {
864 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, n
, oa
)) {
865 if (PREFIX_NAME_IN(oa
)
866 && !strcmp(PREFIX_NAME_IN(oa
), name
)) {
867 PREFIX_LIST_IN(oa
) = prefix_list_lookup(
868 AFI_IP6
, PREFIX_NAME_IN(oa
));
871 if (PREFIX_NAME_OUT(oa
)
872 && !strcmp(PREFIX_NAME_OUT(oa
), name
)) {
873 PREFIX_LIST_OUT(oa
) = prefix_list_lookup(
874 AFI_IP6
, PREFIX_NAME_OUT(oa
));
879 if (update
&& ospf6_check_and_set_router_abr(ospf6
))
880 ospf6_schedule_abr_task(ospf6
);
884 DEFUN (area_import_list
,
885 area_import_list_cmd
,
886 "area <A.B.C.D|(0-4294967295)> import-list ACCESSLIST6_NAME",
887 "OSPF6 area parameters\n"
888 "OSPF6 area ID in IP address format\n"
889 "OSPF6 area ID as a decimal value\n"
890 "Set the filter for networks from other areas announced to the specified one\n"
891 "Name of the access-list\n")
895 struct ospf6_area
*area
;
896 struct access_list
*list
;
898 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
900 OSPF6_CMD_AREA_GET(argv
[idx_ipv4
]->arg
, area
, ospf6
);
902 list
= access_list_lookup(AFI_IP6
, argv
[idx_name
]->arg
);
904 IMPORT_LIST(area
) = list
;
906 if (IMPORT_NAME(area
))
907 free(IMPORT_NAME(area
));
909 IMPORT_NAME(area
) = strdup(argv
[idx_name
]->arg
);
910 if (ospf6_check_and_set_router_abr(area
->ospf6
))
911 ospf6_schedule_abr_task(ospf6
);
916 DEFUN (no_area_import_list
,
917 no_area_import_list_cmd
,
918 "no area <A.B.C.D|(0-4294967295)> import-list ACCESSLIST6_NAME",
920 "OSPF6 area parameters\n"
921 "OSPF6 area ID in IP address format\n"
922 "OSPF6 area ID as a decimal value\n"
923 "Unset the filter for networks announced to other areas\n"
924 "Name of the access-list\n")
927 struct ospf6_area
*area
;
929 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
931 OSPF6_CMD_AREA_GET(argv
[idx_ipv4
]->arg
, area
, ospf6
);
933 IMPORT_LIST(area
) = NULL
;
935 if (IMPORT_NAME(area
))
936 free(IMPORT_NAME(area
));
938 IMPORT_NAME(area
) = NULL
;
939 if (ospf6_check_and_set_router_abr(area
->ospf6
))
940 ospf6_schedule_abr_task(ospf6
);
945 DEFUN (area_export_list
,
946 area_export_list_cmd
,
947 "area <A.B.C.D|(0-4294967295)> export-list ACCESSLIST6_NAME",
948 "OSPF6 area parameters\n"
949 "OSPF6 area ID in IP address format\n"
950 "OSPF6 area ID as a decimal value\n"
951 "Set the filter for networks announced to other areas\n"
952 "Name of the access-list\n")
956 struct ospf6_area
*area
;
957 struct access_list
*list
;
959 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
961 OSPF6_CMD_AREA_GET(argv
[idx_ipv4
]->arg
, area
, ospf6
);
963 list
= access_list_lookup(AFI_IP6
, argv
[idx_name
]->arg
);
965 EXPORT_LIST(area
) = list
;
967 if (EXPORT_NAME(area
))
968 free(EXPORT_NAME(area
));
970 EXPORT_NAME(area
) = strdup(argv
[idx_name
]->arg
);
972 /* Redo summaries if required */
973 if (ospf6_check_and_set_router_abr(area
->ospf6
))
974 ospf6_schedule_abr_task(ospf6
);
979 DEFUN (no_area_export_list
,
980 no_area_export_list_cmd
,
981 "no area <A.B.C.D|(0-4294967295)> export-list ACCESSLIST6_NAME",
983 "OSPF6 area parameters\n"
984 "OSPF6 area ID in IP address format\n"
985 "OSPF6 area ID as a decimal value\n"
986 "Unset the filter for networks announced to other areas\n"
987 "Name of the access-list\n")
990 struct ospf6_area
*area
;
992 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
994 OSPF6_CMD_AREA_GET(argv
[idx_ipv4
]->arg
, area
, ospf6
);
996 EXPORT_LIST(area
) = NULL
;
998 if (EXPORT_NAME(area
))
999 free(EXPORT_NAME(area
));
1001 EXPORT_NAME(area
) = NULL
;
1002 if (ospf6_check_and_set_router_abr(area
->ospf6
))
1003 ospf6_schedule_abr_task(ospf6
);
1008 static int ipv6_ospf6_spf_tree_common(struct vty
*vty
, struct ospf6
*ospf6
,
1011 struct listnode
*node
;
1012 struct ospf6_area
*oa
;
1013 struct prefix prefix
;
1014 struct ospf6_vertex
*root
;
1015 struct ospf6_route
*route
;
1016 json_object
*json
= NULL
;
1017 json_object
*json_area
= NULL
;
1018 json_object
*json_head
= NULL
;
1021 json
= json_object_new_object();
1022 ospf6_linkstate_prefix(ospf6
->router_id
, htonl(0), &prefix
);
1023 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, node
, oa
)) {
1025 json_area
= json_object_new_object();
1026 json_head
= json_object_new_object();
1028 route
= ospf6_route_lookup(&prefix
, oa
->spf_table
);
1029 if (route
== NULL
) {
1031 json_object_string_add(
1033 "LS entry for not not found");
1034 json_object_free(json_head
);
1035 json_object_free(json_area
);
1038 "LS entry for root not found in area %s\n",
1042 root
= (struct ospf6_vertex
*)route
->route_option
;
1043 ospf6_spf_display_subtree(vty
, "", 0, root
, json_head
, uj
);
1046 json_object_object_add(json_area
, root
->name
,
1048 json_object_object_add(json
, oa
->name
, json_area
);
1053 vty_json(vty
, json
);
1058 DEFUN(show_ipv6_ospf6_spf_tree
, show_ipv6_ospf6_spf_tree_cmd
,
1059 "show ipv6 ospf6 [vrf <NAME|all>] spf tree [json]",
1060 SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR
1062 "Shortest Path First calculation\n"
1063 "Show SPF tree\n" JSON_STR
)
1065 struct listnode
*node
;
1066 struct ospf6
*ospf6
;
1067 const char *vrf_name
= NULL
;
1068 bool all_vrf
= false;
1070 bool uj
= use_json(argc
, argv
);
1072 OSPF6_FIND_VRF_ARGS(argv
, argc
, idx_vrf
, vrf_name
, all_vrf
);
1074 for (ALL_LIST_ELEMENTS_RO(om6
->ospf6
, node
, ospf6
)) {
1075 if (all_vrf
|| strcmp(ospf6
->name
, vrf_name
) == 0) {
1076 ipv6_ospf6_spf_tree_common(vty
, ospf6
, uj
);
1082 OSPF6_CMD_CHECK_VRF(uj
, all_vrf
, ospf6
);
1087 static int show_ospf6_area_spf_tree_common(struct vty
*vty
,
1088 struct cmd_token
**argv
,
1089 struct ospf6
*ospf6
,
1090 uint32_t area_id
, int idx_ipv4
)
1093 struct ospf6_area
*oa
;
1094 struct prefix prefix
;
1095 struct ospf6_vertex
*root
;
1096 struct ospf6_route
*route
;
1098 ospf6_linkstate_prefix(ospf6
->router_id
, htonl(0), &prefix
);
1100 oa
= ospf6_area_lookup(area_id
, ospf6
);
1102 vty_out(vty
, "No such Area: %s\n", argv
[idx_ipv4
]->arg
);
1106 route
= ospf6_route_lookup(&prefix
, oa
->spf_table
);
1107 if (route
== NULL
) {
1108 vty_out(vty
, "LS entry for root not found in area %s\n",
1112 root
= (struct ospf6_vertex
*)route
->route_option
;
1113 ospf6_spf_display_subtree(vty
, "", 0, root
, NULL
, false);
1118 DEFUN(show_ipv6_ospf6_area_spf_tree
, show_ipv6_ospf6_area_spf_tree_cmd
,
1119 "show ipv6 ospf6 [vrf <NAME|all>] area A.B.C.D spf tree",
1120 SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR
1121 "All VRFs\n" OSPF6_AREA_STR OSPF6_AREA_ID_STR
1122 "Shortest Path First calculation\n"
1127 struct ospf6
*ospf6
;
1128 struct listnode
*node
;
1129 const char *vrf_name
= NULL
;
1130 bool all_vrf
= false;
1133 OSPF6_FIND_VRF_ARGS(argv
, argc
, idx_vrf
, vrf_name
, all_vrf
);
1137 if (inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &area_id
) != 1) {
1138 vty_out(vty
, "Malformed Area-ID: %s\n", argv
[idx_ipv4
]->arg
);
1142 for (ALL_LIST_ELEMENTS_RO(om6
->ospf6
, node
, ospf6
)) {
1143 if (all_vrf
|| strcmp(ospf6
->name
, vrf_name
) == 0) {
1144 show_ospf6_area_spf_tree_common(vty
, argv
, ospf6
,
1151 OSPF6_CMD_CHECK_VRF(false, all_vrf
, ospf6
);
1157 show_ospf6_simulate_spf_tree_commen(struct vty
*vty
, struct cmd_token
**argv
,
1158 struct ospf6
*ospf6
, uint32_t router_id
,
1159 uint32_t area_id
, struct prefix prefix
,
1160 int idx_ipv4
, int idx_ipv4_2
)
1162 struct ospf6_area
*oa
;
1163 struct ospf6_vertex
*root
;
1164 struct ospf6_route
*route
;
1165 struct ospf6_route_table
*spf_table
;
1166 unsigned char tmp_debug_ospf6_spf
= 0;
1168 oa
= ospf6_area_lookup(area_id
, ospf6
);
1170 vty_out(vty
, "No such Area: %s\n", argv
[idx_ipv4_2
]->arg
);
1174 tmp_debug_ospf6_spf
= conf_debug_ospf6_spf
;
1175 conf_debug_ospf6_spf
= 0;
1177 spf_table
= OSPF6_ROUTE_TABLE_CREATE(NONE
, SPF_RESULTS
);
1178 ospf6_spf_calculation(router_id
, spf_table
, oa
);
1180 conf_debug_ospf6_spf
= tmp_debug_ospf6_spf
;
1182 route
= ospf6_route_lookup(&prefix
, spf_table
);
1183 if (route
== NULL
) {
1184 ospf6_spf_table_finish(spf_table
);
1185 ospf6_route_table_delete(spf_table
);
1188 root
= (struct ospf6_vertex
*)route
->route_option
;
1189 ospf6_spf_display_subtree(vty
, "", 0, root
, NULL
, false);
1191 ospf6_spf_table_finish(spf_table
);
1192 ospf6_route_table_delete(spf_table
);
1197 DEFUN(show_ipv6_ospf6_simulate_spf_tree_root
,
1198 show_ipv6_ospf6_simulate_spf_tree_root_cmd
,
1199 "show ipv6 ospf6 [vrf <NAME|all>] simulate spf-tree A.B.C.D area A.B.C.D",
1200 SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR
1202 "Shortest Path First calculation\n"
1204 "Specify root's router-id to calculate another router's SPF tree\n"
1205 "OSPF6 area parameters\n" OSPF6_AREA_ID_STR
)
1210 struct prefix prefix
;
1212 struct ospf6
*ospf6
;
1213 struct listnode
*node
;
1214 const char *vrf_name
= NULL
;
1215 bool all_vrf
= false;
1218 OSPF6_FIND_VRF_ARGS(argv
, argc
, idx_vrf
, vrf_name
, all_vrf
);
1223 inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &router_id
);
1224 ospf6_linkstate_prefix(router_id
, htonl(0), &prefix
);
1226 if (inet_pton(AF_INET
, argv
[idx_ipv4_2
]->arg
, &area_id
) != 1) {
1227 vty_out(vty
, "Malformed Area-ID: %s\n", argv
[idx_ipv4_2
]->arg
);
1231 for (ALL_LIST_ELEMENTS_RO(om6
->ospf6
, node
, ospf6
)) {
1232 if (all_vrf
|| strcmp(ospf6
->name
, vrf_name
) == 0) {
1233 show_ospf6_simulate_spf_tree_commen(
1234 vty
, argv
, ospf6
, router_id
, area_id
, prefix
,
1235 idx_ipv4
, idx_ipv4_2
);
1241 OSPF6_CMD_CHECK_VRF(false, all_vrf
, ospf6
);
1246 DEFUN (ospf6_area_stub
,
1247 ospf6_area_stub_cmd
,
1248 "area <A.B.C.D|(0-4294967295)> stub",
1249 "OSPF6 area parameters\n"
1250 "OSPF6 area ID in IP address format\n"
1251 "OSPF6 area ID as a decimal value\n"
1252 "Configure OSPF6 area as stub\n")
1254 int idx_ipv4_number
= 1;
1255 struct ospf6_area
*area
;
1257 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
1259 OSPF6_CMD_AREA_GET(argv
[idx_ipv4_number
]->arg
, area
, ospf6
);
1261 if (!ospf6_area_stub_set(ospf6
, area
)) {
1263 "First deconfigure all virtual link through this area\n");
1264 return CMD_WARNING_CONFIG_FAILED
;
1267 ospf6_area_no_summary_unset(ospf6
, area
);
1272 DEFUN (ospf6_area_stub_no_summary
,
1273 ospf6_area_stub_no_summary_cmd
,
1274 "area <A.B.C.D|(0-4294967295)> stub no-summary",
1275 "OSPF6 stub parameters\n"
1276 "OSPF6 area ID in IP address format\n"
1277 "OSPF6 area ID as a decimal value\n"
1278 "Configure OSPF6 area as stub\n"
1279 "Do not inject inter-area routes into stub\n")
1281 int idx_ipv4_number
= 1;
1282 struct ospf6_area
*area
;
1284 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
1286 OSPF6_CMD_AREA_GET(argv
[idx_ipv4_number
]->arg
, area
, ospf6
);
1288 if (!ospf6_area_stub_set(ospf6
, area
)) {
1290 "First deconfigure all virtual link through this area\n");
1291 return CMD_WARNING_CONFIG_FAILED
;
1294 ospf6_area_no_summary_set(ospf6
, area
);
1299 DEFUN (no_ospf6_area_stub
,
1300 no_ospf6_area_stub_cmd
,
1301 "no area <A.B.C.D|(0-4294967295)> stub",
1303 "OSPF6 area parameters\n"
1304 "OSPF6 area ID in IP address format\n"
1305 "OSPF6 area ID as a decimal value\n"
1306 "Configure OSPF6 area as stub\n")
1308 int idx_ipv4_number
= 2;
1309 struct ospf6_area
*area
;
1311 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
1313 OSPF6_CMD_AREA_GET(argv
[idx_ipv4_number
]->arg
, area
, ospf6
);
1315 ospf6_area_stub_unset(ospf6
, area
);
1316 ospf6_area_no_summary_unset(ospf6
, area
);
1321 DEFUN (no_ospf6_area_stub_no_summary
,
1322 no_ospf6_area_stub_no_summary_cmd
,
1323 "no area <A.B.C.D|(0-4294967295)> stub no-summary",
1325 "OSPF6 area parameters\n"
1326 "OSPF6 area ID in IP address format\n"
1327 "OSPF6 area ID as a decimal value\n"
1328 "Configure OSPF6 area as stub\n"
1329 "Do not inject inter-area routes into area\n")
1331 int idx_ipv4_number
= 2;
1332 struct ospf6_area
*area
;
1334 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
1336 OSPF6_CMD_AREA_GET(argv
[idx_ipv4_number
]->arg
, area
, ospf6
);
1338 ospf6_area_stub_unset(ospf6
, area
);
1339 ospf6_area_no_summary_unset(ospf6
, area
);
1344 DEFPY(ospf6_area_nssa
, ospf6_area_nssa_cmd
,
1345 "area <A.B.C.D|(0-4294967295)>$area_str nssa\
1347 default-information-originate$dflt_originate [{metric (0-16777214)$mval|metric-type (1-2)$mtype}]\
1348 |no-summary$no_summary\
1350 "OSPF6 area parameters\n"
1351 "OSPF6 area ID in IP address format\n"
1352 "OSPF6 area ID as a decimal value\n"
1353 "Configure OSPF6 area as nssa\n"
1354 "Originate Type 7 default into NSSA area\n"
1355 "OSPFv3 default metric\n"
1357 "OSPFv3 metric type for default routes\n"
1358 "Set OSPFv3 External Type 1/2 metrics\n"
1359 "Do not inject inter-area routes into area\n")
1361 struct ospf6_area
*area
;
1363 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
1364 OSPF6_CMD_AREA_GET(area_str
, area
, ospf6
);
1366 if (!ospf6_area_nssa_set(ospf6
, area
)) {
1368 "First deconfigure all virtual link through this area\n");
1369 return CMD_WARNING_CONFIG_FAILED
;
1372 if (dflt_originate
) {
1373 if (mval_str
== NULL
)
1375 if (mtype_str
== NULL
)
1376 mtype
= DEFAULT_METRIC_TYPE
;
1377 ospf6_nssa_default_originate_set(ospf6
, area
, mval
, mtype
);
1379 ospf6_nssa_default_originate_unset(ospf6
, area
);
1382 ospf6_area_no_summary_set(ospf6
, area
);
1384 ospf6_area_no_summary_unset(ospf6
, area
);
1386 if (ospf6_check_and_set_router_abr(ospf6
)) {
1387 ospf6_abr_defaults_to_stub(ospf6
);
1388 ospf6_abr_nssa_type_7_defaults(ospf6
);
1394 DEFPY(no_ospf6_area_nssa
, no_ospf6_area_nssa_cmd
,
1395 "no area <A.B.C.D|(0-4294967295)>$area_str nssa\
1397 default-information-originate [{metric (0-16777214)|metric-type (1-2)}]\
1401 "OSPF6 area parameters\n"
1402 "OSPF6 area ID in IP address format\n"
1403 "OSPF6 area ID as a decimal value\n"
1404 "Configure OSPF6 area as nssa\n"
1405 "Originate Type 7 default into NSSA area\n"
1406 "OSPFv3 default metric\n"
1408 "OSPFv3 metric type for default routes\n"
1409 "Set OSPFv3 External Type 1/2 metrics\n"
1410 "Do not inject inter-area routes into area\n")
1412 struct ospf6_area
*area
;
1414 VTY_DECLVAR_CONTEXT(ospf6
, ospf6
);
1415 OSPF6_CMD_AREA_GET(area_str
, area
, ospf6
);
1417 ospf6_area_nssa_unset(ospf6
, area
);
1418 ospf6_area_no_summary_unset(ospf6
, area
);
1419 ospf6_nssa_default_originate_unset(ospf6
, area
);
1425 void ospf6_area_init(void)
1427 install_element(VIEW_NODE
, &show_ipv6_ospf6_spf_tree_cmd
);
1428 install_element(VIEW_NODE
, &show_ipv6_ospf6_area_spf_tree_cmd
);
1429 install_element(VIEW_NODE
, &show_ipv6_ospf6_simulate_spf_tree_root_cmd
);
1431 install_element(OSPF6_NODE
, &area_range_cmd
);
1432 install_element(OSPF6_NODE
, &no_area_range_cmd
);
1433 install_element(OSPF6_NODE
, &ospf6_area_stub_no_summary_cmd
);
1434 install_element(OSPF6_NODE
, &ospf6_area_stub_cmd
);
1435 install_element(OSPF6_NODE
, &no_ospf6_area_stub_no_summary_cmd
);
1436 install_element(OSPF6_NODE
, &no_ospf6_area_stub_cmd
);
1439 install_element(OSPF6_NODE
, &area_import_list_cmd
);
1440 install_element(OSPF6_NODE
, &no_area_import_list_cmd
);
1441 install_element(OSPF6_NODE
, &area_export_list_cmd
);
1442 install_element(OSPF6_NODE
, &no_area_export_list_cmd
);
1444 install_element(OSPF6_NODE
, &area_filter_list_cmd
);
1445 install_element(OSPF6_NODE
, &no_area_filter_list_cmd
);
1447 /* "area nssa" commands. */
1448 install_element(OSPF6_NODE
, &ospf6_area_nssa_cmd
);
1449 install_element(OSPF6_NODE
, &no_ospf6_area_nssa_cmd
);
1452 void ospf6_area_interface_delete(struct ospf6_interface
*oi
)
1454 struct ospf6_area
*oa
;
1455 struct listnode
*node
, *nnode
;
1456 struct ospf6
*ospf6
;
1458 for (ALL_LIST_ELEMENTS(om6
->ospf6
, node
, nnode
, ospf6
)) {
1459 for (ALL_LIST_ELEMENTS(ospf6
->area_list
, node
, nnode
, oa
))
1460 if (listnode_lookup(oa
->if_list
, oi
))
1461 listnode_delete(oa
->if_list
, oi
);