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. > > -- > :wq Claudio > > Index: parse.y > =================================================================== > RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v > retrieving revision 1.426 > diff -u -p -r1.426 parse.y > --- parse.y 2 Jun 2022 09:29:34 -0000 1.426 > +++ parse.y 2 Jun 2022 09:30:34 -0000 > @@ -707,8 +707,9 @@ conf_main : AS as4number { > TAILQ_INSERT_TAIL(conf->listen_addrs, la, entry); > } > | FIBPRIORITY NUMBER { > - if ($2 <= RTP_NONE || $2 > RTP_MAX) { > - yyerror("invalid fib-priority"); > + if ($2 < RTP_LOCAL || $2 > RTP_MAX) { > + yyerror("fib-priority %lld must be between " > + "%u and %u", $2, RTP_LOCAL, RTP_MAX); > YYERROR; > } > conf->fib_priority = $2; > @@ -1045,8 +1046,8 @@ network : NETWORK prefix filter_set { > | NETWORK family PRIORITY NUMBER filter_set { > struct network *n; > if ($4 < RTP_LOCAL && $4 > RTP_MAX) { > - yyerror("priority %lld > max %d or < min %d", > $4, > - RTP_MAX, RTP_LOCAL); > + yyerror("priority %lld must be between " > + "%u and %u", $4, RTP_LOCAL, RTP_MAX); > YYERROR; > } > >