Hi,
>>>>> On Tue, 12 Oct 2004 21:25:22 +0200
>>>>> manu@... said:
> Actual fix should be don't match ip6?addr within a line.
manu> How can we acheive that? Any lex expert in the room? :)
How about this patch? Though it is not a way above, it should match
with only exact an IPv6 address.
Index: conf_lex.l
diff -u conf_lex.l.orig conf_lex.l
--- conf_lex.l.orig Mon Aug 9 06:24:20 2004
+++ conf_lex.l Wed Oct 13 05:22:32 2004
@@ -5,7 +5,7 @@
number [0-9]+
ipaddr [0-9]{1,3}"."[0-9]{1,3}"."[0-9]{1,3}"."[0-9]{1,3}
-ip6addr ([0-9a-fA-F]*:)+[0-9a-fA-F]*(%[0-9a-zA-Z]+)?
+ip6addr ([0-9a-fA-F]*:){2,}[0-9a-fA-F]*(%[0-9a-zA-Z]+)?
cidr "/"[0-9]{1,3}
atext [A-Za-z0-9!#$%&'*+/=?$^_`}{|~.-]{1,}
qtext "\""[!-~]{1,}"\""
@@ -128,9 +128,7 @@
if (ipfromstring(yytext, SA(&yylval.ipaddr), &salen,
AF_INET) != 1) {
- printf("invalid IPv4 address line %d\n",
- conf_line);
- exit(EX_DATAERR);
+ REJECT;
}
return IPADDR;
}
@@ -140,9 +138,7 @@
if (ipfromstring(yytext, SA(&yylval.ip6addr), &salen,
AF_INET6) != 1) {
- printf("invalid IPv6 address line %d\n",
- conf_line);
- exit(EX_DATAERR);
+ REJECT;
}
#endif
return IP6ADDR;
Index: dump_lex.l
diff -u dump_lex.l.orig dump_lex.l
--- dump_lex.l.orig Sun Aug 1 18:27:03 2004
+++ dump_lex.l Wed Oct 13 05:23:29 2004
@@ -6,7 +6,7 @@
num [0-9]{1,}
byte [0-9]{1,3}
ipaddr {byte}"."{byte}"."{byte}"."{byte}
-ip6addr ([0-9a-fA-F]*:)+[0-9a-fA-F]*(%[0-9a-zA-Z]+)?
+ip6addr ([0-9a-fA-F]*:){2,}[0-9a-fA-F]*(%[0-9a-zA-Z]+)?
atext [A-Za-z0-9!#$%&'*+/=?$^_`}{|~.-]{1,}
qtext "\""[!-~]{1,}"\""
mailbox {atext}|{qtext}
@@ -48,9 +48,7 @@
if (ipfromstring(yytext, SA(&yylval.ipaddr), &salen,
AF_INET) != 1) {
- printf("invalid IPv4 address line %d\n",
- dump_line);
- exit(EX_DATAERR);
+ REJECT;
}
return IPADDR;
}
@@ -60,10 +58,7 @@
if (ipfromstring(yytext, SA(&yylval.ip6addr), &salen,
AF_INET6) != 1) {
- printf("invalid IPv6 address line %d\n",
- dump_line);
- printf("[%s]\n", yytext);
- exit(EX_DATAERR);
+ REJECT;
}
#endif
return IP6ADDR;
Sincerely,
--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@... ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/