diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2014-10-14 17:23:34 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2014-10-14 17:23:34 +0200 |
commit | 78342404ff573e85e396f0611014b90cea9b4c0a (patch) | |
tree | 39fd70db506dc05d83528b7afab258b07b8ac482 /conf | |
parent | 178a197afb77770d8a90765e39065679936a45d1 (diff) | |
parent | cfdea7b85f6c520cc5a62eb907d2190db14c9900 (diff) |
Merge remote-tracking branch 'origin/master' into soft-int
Diffstat (limited to 'conf')
-rw-r--r-- | conf/cf-lex.l | 2 | ||||
-rw-r--r-- | conf/conf.h | 4 | ||||
-rw-r--r-- | conf/confbase.Y | 12 |
3 files changed, 15 insertions, 3 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l index 99785057..35b590bb 100644 --- a/conf/cf-lex.l +++ b/conf/cf-lex.l @@ -646,7 +646,7 @@ cf_walk_symbols(struct config *cf, struct symbol *sym, int *pos) char * cf_symbol_class_name(struct symbol *sym) { - if ((sym->class & 0xff00) == SYM_CONSTANT) + if (cf_symbol_is_constant(sym)) return "constant"; switch (sym->class) diff --git a/conf/conf.h b/conf/conf.h index fa14d7b5..799873d2 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -149,6 +149,10 @@ void cf_pop_scope(void); struct symbol *cf_walk_symbols(struct config *cf, struct symbol *sym, int *pos); char *cf_symbol_class_name(struct symbol *sym); +static inline int cf_symbol_is_constant(struct symbol *sym) +{ return (sym->class & 0xff00) == SYM_CONSTANT; } + + /* Parser */ int cf_parse(void); diff --git a/conf/confbase.Y b/conf/confbase.Y index cba6fc56..49831b1a 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -72,7 +72,7 @@ CF_DECLS %token <t> TEXT %type <iface> ipa_scope -%type <i> expr bool pxlen +%type <i> expr bool pxlen ipa_port %type <i32> expr_us %type <time> datetime %type <a> ipa @@ -88,7 +88,7 @@ CF_DECLS %left '!' %nonassoc '.' -CF_KEYWORDS(DEFINE, ON, OFF, YES, NO, S, MS, US) +CF_KEYWORDS(DEFINE, ON, OFF, YES, NO, S, MS, US, PORT) CF_GRAMMAR @@ -161,6 +161,14 @@ ipa_scope: | '%' SYM { $$ = if_get_by_name($2->name); } ; +ipa_port: + /* empty */ { $$ = 0; } + | PORT expr { + if (($2 < 1) || ($2 > 65535)) cf_error("Invalid port number"); + $$ = $2; + } + ; + prefix: ipa pxlen { if (!ip_is_prefix($1, $2)) cf_error("Invalid prefix"); |