summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2015-02-21 11:39:45 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2015-02-21 11:39:45 +0100
commit7730553b7eeb33d21e5597f110334ca584ad532d (patch)
treec80bf6d48fc91bafd7f0aefc859a033d3b472c89 /conf
parent0da562a7cb25ed2b8724248ad6f841b1831a09c3 (diff)
parentec2194fa7a20a2768ca0027b5f3c024f0a251866 (diff)
Merge remote-tracking branch 'origin/soft-int'
Diffstat (limited to 'conf')
-rw-r--r--conf/cf-lex.l18
-rw-r--r--conf/confbase.Y2
2 files changed, 11 insertions, 9 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l
index 35b590bb..b3e13311 100644
--- a/conf/cf-lex.l
+++ b/conf/cf-lex.l
@@ -124,22 +124,24 @@ include ^{WHITE}*include{WHITE}*\".*\"{WHITE}*;
}
{DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+ {
+ ip4_addr a;
+ if (!ip4_pton(yytext, &a))
+ cf_error("Invalid IPv4 address %s", yytext);
+
#ifdef IPV6
- if (ipv4_pton_u32(yytext, &cf_lval.i32))
- return RTRID;
- cf_error("Invalid IPv4 address %s", yytext);
+ cf_lval.i32 = ip4_to_u32(a);
+ return RTRID;
#else
- if (ip_pton(yytext, &cf_lval.a))
- return IPA;
- cf_error("Invalid IP address %s", yytext);
+ cf_lval.a = ipa_from_ip4(a);
+ return IPA;
#endif
}
({XIGIT}*::|({XIGIT}*:){3,})({XIGIT}*|{DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+) {
#ifdef IPV6
- if (ip_pton(yytext, &cf_lval.a))
+ if (ipa_pton(yytext, &cf_lval.a))
return IPA;
- cf_error("Invalid IP address %s", yytext);
+ cf_error("Invalid IPv6 address %s", yytext);
#else
cf_error("This is an IPv4 router, therefore IPv6 addresses are not supported");
#endif
diff --git a/conf/confbase.Y b/conf/confbase.Y
index 49831b1a..16a493e9 100644
--- a/conf/confbase.Y
+++ b/conf/confbase.Y
@@ -187,7 +187,7 @@ pxlen:
$$ = $2;
}
| ':' ipa {
- $$ = ipa_mklen($2);
+ $$ = ipa_masklen($2);
if ($$ < 0) cf_error("Invalid netmask %I", $2);
}
;