mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 11:18:43 +00:00
lib: Allow optional whitespace in ranges
Makes ranges where both endpoints are negative somewhat more readable. Also validate ranges. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
5a8bbed0b1
commit
ef955a80a6
@ -11,7 +11,7 @@ IPV6 X:X::X:X
|
|||||||
IPV6_PREFIX X:X::X:X\/M
|
IPV6_PREFIX X:X::X:X\/M
|
||||||
VARIABLE [A-Z][-_a-zA-Z:0-9]+
|
VARIABLE [A-Z][-_a-zA-Z:0-9]+
|
||||||
NUMBER [-|+]?[0-9]{1,20}
|
NUMBER [-|+]?[0-9]{1,20}
|
||||||
RANGE \({NUMBER}\-{NUMBER}\)
|
RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\)
|
||||||
|
|
||||||
/* yytext shall be a pointer */
|
/* yytext shall be a pointer */
|
||||||
%pointer
|
%pointer
|
||||||
|
@ -206,7 +206,11 @@ placeholder_token:
|
|||||||
|
|
||||||
// get the numbers out
|
// get the numbers out
|
||||||
$$->min = strtoimax( yylval.string+1, &yylval.string, 10 );
|
$$->min = strtoimax( yylval.string+1, &yylval.string, 10 );
|
||||||
$$->max = strtoimax( yylval.string+1, &yylval.string, 10 );
|
strsep (&yylval.string, "-");
|
||||||
|
$$->max = strtoimax( yylval.string, &yylval.string, 10 );
|
||||||
|
|
||||||
|
// validate range
|
||||||
|
if ($$->min >= $$->max) yyerror("Invalid range.");
|
||||||
|
|
||||||
free ($1);
|
free ($1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user