On Thu, Jun 02, 2022 at 01:07:07PM +0200, Claudio Jeker wrote:
> On Thu, Jun 02, 2022 at 12:44:49PM +0200, Theo Buehler wrote:
> > On Thu, Jun 02, 2022 at 11:38:05AM +0200, Claudio Jeker wrote:
> > > Lets use the same check for both priority checks in parse.y.
> > > Also rephrase the error messages to be less cryptic.
> > > Both checks do the same check since RTP_NONE = 0 and RTP_LOCAL = 1.
> > 
> > ok
> > 
> > > Using RTP_LOCAL as a priority is actually not possible since that one is
> > > reserved for the kernel (used by interface address entries). So maybe the
> > > check should be 'if ($2 <= RTP_LOCAL'. That would be a followup diff since
> > > that would change behaviour.
> > 
> > That would make sense to me.
> 
> See below for that.

ok

> 
> -- 
> :wq Claudio
> 
> Index: parse.y
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
> retrieving revision 1.427
> diff -u -p -r1.427 parse.y
> --- parse.y   2 Jun 2022 11:05:15 -0000       1.427
> +++ parse.y   2 Jun 2022 11:06:10 -0000
> @@ -707,9 +707,9 @@ conf_main : AS as4number          {
>                       TAILQ_INSERT_TAIL(conf->listen_addrs, la, entry);
>               }
>               | FIBPRIORITY NUMBER            {
> -                     if ($2 < RTP_LOCAL || $2 > RTP_MAX) {
> +                     if ($2 <= RTP_LOCAL || $2 > RTP_MAX) {
>                               yyerror("fib-priority %lld must be between "
> -                                 "%u and %u", $2, RTP_LOCAL, RTP_MAX);
> +                                 "%u and %u", $2, RTP_LOCAL + 1, RTP_MAX);
>                               YYERROR;
>                       }
>                       conf->fib_priority = $2;
> @@ -1045,9 +1045,9 @@ network         : NETWORK prefix filter_set     {
>               }
>               | NETWORK family PRIORITY NUMBER filter_set     {
>                       struct network  *n;
> -                     if ($4 < RTP_LOCAL && $4 > RTP_MAX) {
> +                     if ($4 <= RTP_LOCAL && $4 > RTP_MAX) {
>                               yyerror("priority %lld must be between "
> -                                 "%u and %u", $4, RTP_LOCAL, RTP_MAX);
> +                                 "%u and %u", $4, RTP_LOCAL + 1, RTP_MAX);
>                               YYERROR;
>                       }
>  

Reply via email to