summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
Diffstat (limited to 'conf')
-rw-r--r--conf/confbase.Y9
1 files changed, 9 insertions, 0 deletions
diff --git a/conf/confbase.Y b/conf/confbase.Y
index 7ac07fea..c6143012 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);