summaryrefslogtreecommitdiffstats
path: root/conf/confbase.Y
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1998-12-07 00:10:45 +0100
committerMartin Mares <mj@ucw.cz>1998-12-07 00:10:45 +0100
commit89d2355d3d16ac51ad5861d91b17eaa65713f80b (patch)
treebd15d1111033313e0037461e023ddc22fe19033a /conf/confbase.Y
parentcc12cf05c789ef85d72cf19e9b52f0c4982542f7 (diff)
downloadbird-89d2355d3d16ac51ad5861d91b17eaa65713f80b.tar
bird-89d2355d3d16ac51ad5861d91b17eaa65713f80b.zip
Added new rule for prefix length / netmask.
Diffstat (limited to 'conf/confbase.Y')
-rw-r--r--conf/confbase.Y15
1 files changed, 14 insertions, 1 deletions
diff --git a/conf/confbase.Y b/conf/confbase.Y
index 8e32129..0f00587 100644
--- a/conf/confbase.Y
+++ b/conf/confbase.Y
@@ -32,7 +32,7 @@ CF_DECLS
%token <s> SYM
%token <t> TEXT
-%type <i> expr bool
+%type <i> expr bool pxlen
%left '+' '-'
%left '*' '/' '%'
@@ -88,6 +88,19 @@ bool:
| /* Silence means agreement */ { $$ = 1; }
;
+/* Prefixes and netmasks */
+
+pxlen:
+ '/' NUM {
+ if ($2 < 0 || $2 > 32) cf_error("Invalid prefix length %d", $2);
+ $$ = $2;
+ }
+ | ':' IPA {
+ $$ = ipa_mklen($2);
+ if ($$ < 0) cf_error("Invalid netmask %I", $2);
+ }
+ ;
+
CF_CODE
CF_END