From: claudio Date: Thu, 2 Jun 2022 11:05:15 +0000 (+0000) Subject: Use a common idiom to check if the user supplied routing priority is X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5241a2d40aee6afc0b117d9bdb4d7b69a7710b4f;p=openbsd Use a common idiom to check if the user supplied routing priority is in range. Also rephrase the error message. OK tb@ --- diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 6a9d08c3f0a..7e85fb25c9c 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.426 2022/06/02 09:29:34 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.427 2022/06/02 11:05:15 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -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; }