summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2021-01-07 09:31:03 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2021-01-07 09:31:03 +0000
commit1bdf17fc8ce4dae67e4f77757ff691312c49d625 (patch)
tree3c8de90fd9eaba35d7063f392a06418f345c11c4 /usr.sbin/ospfd
parente54cf24e23215ddb6cc246115e9c546c3a8839a3 (diff)
Fix multiple shift/reduce conflicts in the parser because of the dependon
synatx element with its optional / empty element. While this is needed for redistribute statements it causes the conflicts in the interface sections since there the statement can not be empty (this conflicts with empty new lines handled in optnl). Add a dependonopt for redistribute statements and make depend on no longer optional. Also sync the curly bracket blocks (interface, area, ...) to be like set blocks and the blocks in bgpd. This should result in more flexible newline handling. Tested by sthen@, benno@, Kapetanakis Giannis OK benno@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r--usr.sbin/ospfd/parse.y28
1 files changed, 15 insertions, 13 deletions
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y
index 3e05873211a..12e4007cc9c 100644
--- a/usr.sbin/ospfd/parse.y
+++ b/usr.sbin/ospfd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.101 2020/12/29 19:44:47 benno Exp $ */
+/* $OpenBSD: parse.y,v 1.102 2021/01/07 09:31:02 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -144,7 +144,7 @@ typedef struct {
%token <v.number> NUMBER
%type <v.number> yesno no optlist optlist_l option demotecount msec
%type <v.number> deadtime
-%type <v.string> string dependon
+%type <v.string> string dependon dependonopt
%type <v.redist> redistribute
%type <v.id> areaid
@@ -297,7 +297,7 @@ conf_main : ROUTERID STRING {
;
-redistribute : no REDISTRIBUTE NUMBER '/' NUMBER optlist dependon {
+redistribute : no REDISTRIBUTE NUMBER '/' NUMBER optlist dependonopt {
struct redistribute *r;
if ((r = calloc(1, sizeof(*r))) == NULL)
@@ -323,7 +323,7 @@ redistribute : no REDISTRIBUTE NUMBER '/' NUMBER optlist dependon {
free($7);
$$ = r;
}
- | no REDISTRIBUTE STRING optlist dependon {
+ | no REDISTRIBUTE STRING optlist dependonopt {
struct redistribute *r;
if ((r = calloc(1, sizeof(*r))) == NULL)
@@ -426,8 +426,10 @@ option : METRIC NUMBER {
}
;
-dependon : /* empty */ { $$ = NULL; }
- | DEPEND ON STRING {
+dependonopt : /* empty */ { $$ = NULL; }
+ | dependon
+
+dependon : DEPEND ON STRING {
struct in_addr addr;
struct kif *kif;
@@ -599,7 +601,7 @@ area : AREA areaid {
memcpy(&areadefs, defs, sizeof(areadefs));
md_list_copy(&areadefs.md_list, &defs->md_list);
defs = &areadefs;
- } '{' optnl areaopts_l '}' {
+ } '{' optnl areaopts_l optnl '}' {
area = NULL;
md_list_clr(&defs->md_list);
defs = &globaldefs;
@@ -627,8 +629,8 @@ areaid : NUMBER {
}
;
-areaopts_l : areaopts_l areaoptsl nl
- | areaoptsl optnl
+areaopts_l : areaopts_l nl areaoptsl
+ | areaoptsl
;
areaoptsl : interface
@@ -739,13 +741,13 @@ interface : INTERFACE STRING {
}
;
-interface_block : '{' optnl interfaceopts_l '}'
+interface_block : '{' optnl interfaceopts_l optnl '}'
| '{' optnl '}'
- |
+ | /* empty */
;
-interfaceopts_l : interfaceopts_l interfaceoptsl nl
- | interfaceoptsl optnl
+interfaceopts_l : interfaceopts_l nl interfaceoptsl
+ | interfaceoptsl
;
interfaceoptsl : PASSIVE { iface->passive = 1; }