[Mimedefang] [Patch] relay_is_* not ipv6 friendly (IPv4 Compatible "patch")
Bernd Petrovitsch
bernd at petrovitsch.priv.at
Wed Feb 3 03:53:36 EST 2010
On Die, 2010-02-02 at 17:49 -0800, - wrote:
> Try this regex for detecting an IPv4-compatible IPv6 address:
>
> ... =~ qr/^::FFFF:(\d{1,3}(\.\d{1,3}){3})$/i ...
To get even more anal:
No one forbids to avoid the leading "::" or write the optional "0"
before and(or after it. So that could be
---- snip ----
... =~ qr/^((0+:)*::(0+:)*|(0+:){6})FFFF:(\d{1,3}(\.\d{1,3}){3})$/i ...
---- snip ----
Caveat emptor 1: Not tested etc.
Caveat emptor 2: Since (normal) regexps can't calculate, we cannot avoid
getting false positives with too many 0 with "(0+:)*::(0+:)*" for an
IPv6 address.
Perhaps reason enough to simply use Net::IP.
And if Net::IP gets it wrong, we can blame them (and send a patch).
Bernd
--
Bernd Petrovitsch Email : bernd at petrovitsch.priv.at
LUGA : http://www.luga.at
More information about the MIMEDefang
mailing list