diff --git a/conf/confbase.Y b/conf/confbase.Y index 8e321299..0f00587a 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -32,7 +32,7 @@ CF_DECLS %token SYM %token TEXT -%type expr bool +%type 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