Thanks,
i think the dependon might have been my fault.

code reads ok.

I also checked a few configs, including an artificial one that uses depend
on.

/Benno

Claudio Jeker(cje...@diehard.n-r-g.com) on 2021.01.06 11:11:49 +0100:
> The dependon statement in ospfd parse.y introduces some troubles since it
> holds an empty rule that then conflicts with optnl.
> This diff changes dependon into dependon and dependonopt so that in the
> place where it is optional dependonopt can be used and in the places where
> it must not be optional it isn't. With this the shift/reduce conficts are
> gone. While at it cleanup some other rules and use the same optnl idiom
> for area and interface (it is the same one as used by bgpd).
> 
> Please test this with your configs to see if this causes any parse errors
> (ospfd -n should be enough for this).
> -- 
> :wq Claudio
> 
> 
> Index: parse.y
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospfd/parse.y,v
> retrieving revision 1.101
> diff -u -p -r1.101 parse.y
> --- parse.y   29 Dec 2020 19:44:47 -0000      1.101
> +++ parse.y   6 Jan 2021 10:10:23 -0000
> @@ -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 '/
>                       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; }
> 

Reply via email to