IPv4-mapped

Mark Martinec via amavis-users amavis-users at amavis.org
Thu Sep 5 00:59:05 CEST 2013


Patrick,

> I'm having an issue with 2.8.1 and ubuntu 12.04 with mapped addresses.
> It seems the inet_acl isn't mapping it correctly.
> 
> (!)DENIED ACCESS due to INVALID PEER IP ADDRESS::ffff:127.0.0.1:
> lookup_ip_acl (inet_acl): IPv6 address [::ffff:127.0.0.1] contains
> fewer than 8 fields

Ugh, an ugly bug (actually two of them), still in 2.8.2-rc1.
Will get it fixed for the final 2.8.2 release, thanks!

Here is the patch:

--- amavisd~	2013-09-04 14:43:24.000000000 +0200
+++ amavisd	2013-09-05 00:54:37.000000000 +0200
@@ -5612,5 +5612,5 @@
     !grep($_ > 255, @d)
       or die "Invalid decimal field value in IPv6 address: [$ip]\n";
-    $ipa = $2 . sprintf('%02x%02x:%02x%02x', @d);
+    $ipa = $1 . sprintf('%02x%02x:%02x%02x', @d);
   } elsif (!$have_ipv6 &&
            $ipa =~ m{^ \d{1,3} (?: \. \d{1,3}){0,3} \z}xs) {  # IPv4
@@ -5650,5 +5650,5 @@
   @ip_fields >= 8  or die "IPv6 address [$ip] contains fewer than 8 fields\n";
   @ip_fields <= 8  or die "IPv6 address [$ip] contains more than 8 fields\n";
-  !grep(!/^[0-9a-zA-Z]{1,4}\z/, @ip_fields)  # this is quite slow
+  !grep(!/^[0-9a-fA-F]{1,4}\z/, @ip_fields)  # this is quite slow
     or die "Invalid syntax of IPv6 address: [$ip]\n";
   my $vec = pack('n8', map(hex($_), at ip_fields));


Mark


More information about the amavis-users mailing list