1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Unified parsing of prefixes.

Had to rename `prefix' in filters to `fprefix'.
This commit is contained in:
Martin Mares
2000-05-13 11:17:49 +00:00
parent 02bd064ab7
commit 758458be05
7 changed files with 38 additions and 24 deletions

View File

@@ -40,6 +40,7 @@ CF_DECLS
struct rt_show_data *ra;
void *g;
bird_clock_t time;
struct prefix px;
}
%token END CLI_MARKER INVALID_TOKEN
@@ -52,6 +53,7 @@ CF_DECLS
%type <i> expr bool pxlen
%type <time> datetime
%type <px> prefix
%nonassoc '=' '<' '>' '~' '.' GEQ LEQ NEQ
%left '+' '-'
@@ -109,6 +111,13 @@ bool:
/* Prefixes and netmasks */
prefix:
IPA pxlen {
if (!ip_is_prefix($1, $2)) cf_error("Invalid prefix");
$$.addr = $1; $$.len = $2;
}
;
pxlen:
'/' NUM {
if ($2 < 0 || $2 > BITS_PER_IP_ADDRESS) cf_error("Invalid prefix length %d", $2);