summaryrefslogtreecommitdiffstats
path: root/proto/ospf/config.Y
diff options
context:
space:
mode:
Diffstat (limited to 'proto/ospf/config.Y')
-rw-r--r--proto/ospf/config.Y29
1 files changed, 24 insertions, 5 deletions
diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y
index e48f460..ec7da8e 100644
--- a/proto/ospf/config.Y
+++ b/proto/ospf/config.Y
@@ -58,7 +58,16 @@ static void
ospf_area_finish(void)
{
if ((this_area->areaid == 0) && (this_area->type != OPT_E))
- cf_error( "Backbone area cannot be stub/NSSA");
+ cf_error("Backbone area cannot be stub/NSSA");
+
+ if (this_area->summary && (this_area->type == OPT_E))
+ cf_error("Only Stub/NSSA areas can use summary propagation");
+
+ if (this_area->default_nssa && ((this_area->type != OPT_N) || ! this_area->summary))
+ cf_error("Only NSSA areas with summary propagation can use NSSA default route");
+
+ if ((this_area->default_cost & LSA_EXT_EBIT) && ! this_area->default_nssa)
+ cf_error("Only NSSA default route can use type 2 metric");
}
static void
@@ -94,10 +103,17 @@ ospf_proto_finish(void)
cf_error( "Vlinks cannot be used on single area router");
}
+static inline void
+check_defcost(int cost)
+{
+ if ((cost <= 0) || (cost >= LSINFINITY))
+ cf_error("Default cost must be in range 1-%d", LSINFINITY);
+}
+
CF_DECLS
CF_KEYWORDS(OSPF, AREA, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG, OSPF_ROUTER_ID)
-CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK, COST, RETRANSMIT)
+CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK, COST, COST2, RETRANSMIT)
CF_KEYWORDS(HELLO, TRANSMIT, PRIORITY, DEAD, TYPE, BROADCAST, BCAST)
CF_KEYWORDS(NONBROADCAST, NBMA, POINTOPOINT, PTP, POINTOMULTIPOINT, PTMP)
CF_KEYWORDS(NONE, SIMPLE, AUTHENTICATION, STRICT, CRYPTOGRAPHIC)
@@ -139,7 +155,7 @@ ospf_area_start: AREA idval {
this_area = cfg_allocz(sizeof(struct ospf_area_config));
add_tail(&OSPF_CFG->area_list, NODE this_area);
this_area->areaid = $2;
- this_area->stub_cost = DEFAULT_STUB_COST;
+ this_area->default_cost = DEFAULT_STUB_COST;
this_area->type = OPT_E;
this_area->transint = DEFAULT_TRANSINT;
@@ -159,10 +175,13 @@ ospf_area_opts:
;
ospf_area_item:
- STUB COST expr { this_area->stub_cost = $3 ; if($3<=0) cf_error("Stub cost must be greater than zero"); }
- | STUB bool { this_area->type = $2 ? 0 : OPT_E; /* We should remove the option */ }
+ STUB bool { this_area->type = $2 ? 0 : OPT_E; /* We should remove the option */ }
| NSSA { this_area->type = OPT_N; }
| SUMMARY bool { this_area->summary = $2; }
+ | DEFAULT NSSA bool { this_area->default_nssa = $3; }
+ | DEFAULT COST expr { this_area->default_cost = $3; check_defcost($3); }
+ | DEFAULT COST2 expr { this_area->default_cost = $3 | LSA_EXT_EBIT; check_defcost($3); }
+ | STUB COST expr { this_area->default_cost = $3; check_defcost($3); }
| TRANSLATOR bool { this_area->translator = $2; }
| TRANSLATOR STABILITY expr { this_area->transint = $3; }
| NETWORKS { this_nets = &this_area->net_list; } '{' pref_list '}'