summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
Diffstat (limited to 'conf')
-rw-r--r--conf/cf-lex.l18
-rw-r--r--conf/conf.c4
-rw-r--r--conf/confbase.Y2
3 files changed, 23 insertions, 1 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l
index 94c2b2ab..21727a9d 100644
--- a/conf/cf-lex.l
+++ b/conf/cf-lex.l
@@ -65,9 +65,25 @@ WHITE [ \t]
%%
{DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+ {
+#ifdef IPV6
+ if (ipv4_pton_u32(yytext, &cf_lval.i32))
+ return RTRID;
+ cf_error("Invalid IPv4 address %s", yytext);
+#else
if (ip_pton(yytext, &cf_lval.a))
return IPA;
- cf_error("Invalid IP address");
+ cf_error("Invalid IP address %s", yytext);
+#endif
+}
+
+({XIGIT}*::|({XIGIT}*:){3,})({XIGIT}*|{DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+) {
+#ifdef IPV6
+ if (ip_pton(yytext, &cf_lval.a))
+ return IPA;
+ cf_error("Invalid IP address %s", yytext);
+#else
+ cf_error("This is an IPv4 router, therefore IPv6 addresses are not supported");
+#endif
}
0x{DIGIT}+ {
diff --git a/conf/conf.c b/conf/conf.c
index 0ce593c7..d9bf9d88 100644
--- a/conf/conf.c
+++ b/conf/conf.c
@@ -54,6 +54,10 @@ config_parse(struct config *c)
cf_parse();
filters_postconfig(); /* FIXME: Do we really need this? */
protos_postconfig(c);
+#ifdef IPV6
+ if (!c->router_id)
+ cf_error("Router ID must be configured manually on IPv6 routers");
+#endif
return 1;
}
diff --git a/conf/confbase.Y b/conf/confbase.Y
index f9293a40..a6eb8764 100644
--- a/conf/confbase.Y
+++ b/conf/confbase.Y
@@ -22,6 +22,7 @@ CF_DECLS
%union {
int i;
+ u32 i32;
ip_addr a;
struct symbol *s;
char *t;
@@ -35,6 +36,7 @@ CF_DECLS
%token END
%token <i> NUM
+%token <i32> RTRID
%token <a> IPA
%token <s> SYM
%token <t> TEXT