ripd.conf: allow interface without { }

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ripd.conf: allow interface without { }

Remi Locherer
Hi,

ripd wants curly braces for interface blocks even if no parameters are
specified. This is inconsistent with other daemons and a bit annoying.

Below diff makes ripd accepting
        interface if0
without { } afterwards. The example in the man page shows the interface
statement with and without { }.

OK?

Remi



Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/ripd/parse.y,v
retrieving revision 1.43
diff -u -p -r1.43 parse.y
--- parse.y 1 Nov 2018 00:18:44 -0000 1.43
+++ parse.y 10 Nov 2018 19:54:45 -0000
@@ -356,6 +356,7 @@ interface : INTERFACE STRING {
 
 interface_block : '{' optnl interfaceopts_l '}'
  | '{' optnl '}'
+ |
  ;
 
 interfaceopts_l : interfaceopts_l interfaceoptsl nl
Index: ripd.conf.5
===================================================================
RCS file: /cvs/src/usr.sbin/ripd/ripd.conf.5,v
retrieving revision 1.16
diff -u -p -r1.16 ripd.conf.5
--- ripd.conf.5 10 Nov 2018 19:12:34 -0000 1.16
+++ ripd.conf.5 10 Nov 2018 19:54:45 -0000
@@ -156,7 +156,10 @@ Each interface can have several paramete
 they are inherited.
 .Bd -literal -offset indent
 interface em0 {
+ cost 9
+ auth-type none
 }
+interface ix1
 .Ed
 .Pp
 Interface-specific parameters are listed below.

Reply | Threaded
Open this post in threaded view
|

Re: ripd.conf: allow interface without { }

Claudio Jeker
On Sat, Nov 10, 2018 at 09:17:57PM +0100, Remi Locherer wrote:

> Hi,
>
> ripd wants curly braces for interface blocks even if no parameters are
> specified. This is inconsistent with other daemons and a bit annoying.
>
> Below diff makes ripd accepting
> interface if0
> without { } afterwards. The example in the man page shows the interface
> statement with and without { }.
>
> OK?
>
> Remi
>
>
>
> Index: parse.y
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ripd/parse.y,v
> retrieving revision 1.43
> diff -u -p -r1.43 parse.y
> --- parse.y 1 Nov 2018 00:18:44 -0000 1.43
> +++ parse.y 10 Nov 2018 19:54:45 -0000
> @@ -356,6 +356,7 @@ interface : INTERFACE STRING {
>  
>  interface_block : '{' optnl interfaceopts_l '}'
>   | '{' optnl '}'
> + |

Normaly we use the empty as first expand of a rule and also use a comment
like /* empty */ to make them a bit easier to read (and not overlook).
Should we kill '{' optnl '}' somewhen later?

Apart from that OK claudio@

>   ;
>  
>  interfaceopts_l : interfaceopts_l interfaceoptsl nl
> Index: ripd.conf.5
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ripd/ripd.conf.5,v
> retrieving revision 1.16
> diff -u -p -r1.16 ripd.conf.5
> --- ripd.conf.5 10 Nov 2018 19:12:34 -0000 1.16
> +++ ripd.conf.5 10 Nov 2018 19:54:45 -0000
> @@ -156,7 +156,10 @@ Each interface can have several paramete
>  they are inherited.
>  .Bd -literal -offset indent
>  interface em0 {
> + cost 9
> + auth-type none
>  }
> +interface ix1
>  .Ed
>  .Pp
>  Interface-specific parameters are listed below.
>

--
:wq Claudio

Reply | Threaded
Open this post in threaded view
|

Re: ripd.conf: allow interface without { }

Remi Locherer
On Sun, Nov 11, 2018 at 09:48:38AM +0100, Claudio Jeker wrote:

> On Sat, Nov 10, 2018 at 09:17:57PM +0100, Remi Locherer wrote:
> > Hi,
> >
> > ripd wants curly braces for interface blocks even if no parameters are
> > specified. This is inconsistent with other daemons and a bit annoying.
> >
> > Below diff makes ripd accepting
> > interface if0
> > without { } afterwards. The example in the man page shows the interface
> > statement with and without { }.
> >
> > OK?
> >
> > Remi
> >
> >
> >
> > Index: parse.y
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/ripd/parse.y,v
> > retrieving revision 1.43
> > diff -u -p -r1.43 parse.y
> > --- parse.y 1 Nov 2018 00:18:44 -0000 1.43
> > +++ parse.y 10 Nov 2018 19:54:45 -0000
> > @@ -356,6 +356,7 @@ interface : INTERFACE STRING {
> >  
> >  interface_block : '{' optnl interfaceopts_l '}'
> >   | '{' optnl '}'
> > + |
>
> Normaly we use the empty as first expand of a rule and also use a comment
> like /* empty */ to make them a bit easier to read (and not overlook).

I commited it with /* empty */ first.

> Should we kill '{' optnl '}' somewhen later?

This would break existing configs. Until now this form was enforced.
I'm not sure it's worth it.

Reply | Threaded
Open this post in threaded view
|

Re: ripd.conf: allow interface without { }

Sebastian Benoit-3
Remi Locherer([hidden email]) on 2018.11.11 14:57:05 +0100:

> On Sun, Nov 11, 2018 at 09:48:38AM +0100, Claudio Jeker wrote:
> > On Sat, Nov 10, 2018 at 09:17:57PM +0100, Remi Locherer wrote:
> > > Hi,
> > >
> > > ripd wants curly braces for interface blocks even if no parameters are
> > > specified. This is inconsistent with other daemons and a bit annoying.
> > >
> > > Below diff makes ripd accepting
> > > interface if0
> > > without { } afterwards. The example in the man page shows the interface
> > > statement with and without { }.
> > >
> > > OK?
> > >
> > > Remi
> > >
> > >
> > >
> > > Index: parse.y
> > > ===================================================================
> > > RCS file: /cvs/src/usr.sbin/ripd/parse.y,v
> > > retrieving revision 1.43
> > > diff -u -p -r1.43 parse.y
> > > --- parse.y 1 Nov 2018 00:18:44 -0000 1.43
> > > +++ parse.y 10 Nov 2018 19:54:45 -0000
> > > @@ -356,6 +356,7 @@ interface : INTERFACE STRING {
> > >  
> > >  interface_block : '{' optnl interfaceopts_l '}'
> > >   | '{' optnl '}'
> > > + |
> >
> > Normaly we use the empty as first expand of a rule and also use a comment
> > like /* empty */ to make them a bit easier to read (and not overlook).
>
> I commited it with /* empty */ first.
>
> > Should we kill '{' optnl '}' somewhen later?
>
> This would break existing configs. Until now this form was enforced.
> I'm not sure it's worth it.

yes. I think its ok to change this when its in the way of changing other
things, but it's bad to change the config just to make the parser nicer
without some other benefit.