Re: [Exim] [grin: ipv6 strikes again - exim rbl]

Top Page
Delete this message
Reply to this message
Author: Philip Blundell
Date:  
To: grin
CC: exim
Subject: Re: [Exim] [grin: ipv6 strikes again - exim rbl]
>Which means that the IPv4 address _is_ on RBL, but Exim got it in
>IPv4-in-IPv6 notation, probably looked up a wrong reverse and let the spam
>flow in.
>
>You should simply look up IPv4 reverse for such addresses. I thought you
>did, but seems the other way.


Sigh, I think you are right. This patch is untested but I think it's along
roughly the right lines. Let me know if it helps any.

p.

--- exim-3.02/src/host.c    Wed Jun  2 09:31:53 1999
+++ exim-3.02-1/src/host.c    Fri Jul 23 14:16:44 1999
@@ -975,7 +975,13 @@
   struct in6_addr addr6;
   if (inet_pton(AF_INET6, address, &addr6) != 1)
     log_write(0, LOG_PANIC_DIE, "unable to parse \"%s\"", address);
-  hosts = gethostbyaddr((char *)(&addr6), sizeof(addr6), AF_INET6);
+  if (IN6_IS_ADDR_V4MAPPED(&addr6))
+    /* Ho ho!  Turns out this is really an IPv4 address.  Such mapped
+     addresses aren't included in the ip6.int domain so we must spot
+     them and use an IPv4 lookup. */
+    hosts = gethostbyaddr((char *)(&addr6)+12, sizeof(addr6), AF_INET);
+  else
+    hosts = gethostbyaddr((char *)(&addr6), sizeof(addr6), AF_INET6);
   }
 else
   {