summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-03-16 10:54:44 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-03-16 10:54:44 +0000
commit7447ddeae630e7d55ef508d37acfed959e6450e2 (patch)
tree819482bf643327b1d0d6987685345eb756cd2ad0
parent547f15bd4611ec89cc98fb3cdf82324cad510e06 (diff)
Make sure that the metric on redistributed prefixes is always != 0.
If no metric was specified for it to DEFAULT_REDIST_METRIC. While this was checked for the simple case it was not done if only a metric type was specified. OK pyr@
-rw-r--r--usr.sbin/ospfd/parse.y14
1 files changed, 11 insertions, 3 deletions
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y
index 660356e9631..d53c0790f6f 100644
--- a/usr.sbin/ospfd/parse.y
+++ b/usr.sbin/ospfd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.43 2007/02/01 13:25:28 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.44 2007/03/16 10:54:43 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -264,8 +264,16 @@ conf_main : ROUTERID STRING {
;
optlist : /* empty */ { $$ = DEFAULT_REDIST_METRIC; }
- | SET option { $$ = $2; }
- | SET optnl '{' optnl optlist_l optnl '}' { $$ = $5; }
+ | SET option {
+ $$ = $2;
+ if (($$ & LSA_METRIC_MASK) == 0)
+ $$ |= DEFAULT_REDIST_METRIC;
+ }
+ | SET optnl '{' optnl optlist_l optnl '}' {
+ $$ = $5;
+ if (($$ & LSA_METRIC_MASK) == 0)
+ $$ |= DEFAULT_REDIST_METRIC;
+ }
;
optlist_l : optlist_l comma option {