summaryrefslogtreecommitdiffstats
path: root/conf/confbase.Y
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-05-13 13:17:49 +0200
committerMartin Mares <mj@ucw.cz>2000-05-13 13:17:49 +0200
commit758458be054ebdf4cd77620faf214f2b491a49dc (patch)
treee8cdebbcf3095ddc1db63ac3c5b611f9708c9879 /conf/confbase.Y
parent02bd064ab76f163313261dad5c273cb376be2a75 (diff)
downloadbird-758458be054ebdf4cd77620faf214f2b491a49dc.tar
bird-758458be054ebdf4cd77620faf214f2b491a49dc.zip
Unified parsing of prefixes.
Had to rename `prefix' in filters to `fprefix'.
Diffstat (limited to 'conf/confbase.Y')
-rw-r--r--conf/confbase.Y9
1 files changed, 9 insertions, 0 deletions
diff --git a/conf/confbase.Y b/conf/confbase.Y
index 7ac07fe..c614301 100644
--- a/conf/confbase.Y
+++ b/conf/confbase.Y
@@ -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);