[Mimedefang] [Patch] relay_is_* not ipv6 friendly (IPv4 Compatible "patch")
-
kd6lvw at yahoo.com
Wed Feb 3 15:32:01 EST 2010
--- On Wed, 2/3/10, Bernd Petrovitsch <bernd at petrovitsch.priv.at> wrote:
> 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
> ...
A human may write that, but the routines for converting IPv6 to text never will. They will output only in the first format appearing above, even if the latter is a possible equivalent. The leading zero-quads will never appear in a machine generated address.
Using the latter-above code, $2 is the IPv4, and if $1 is anything other than "::", then the address was not machine generated and it's likely that the message was manually tampered with (and thus spam).
More information about the MIMEDefang
mailing list