Hello,

We use Pound as an sslizer in front of a Jetty server on an appliance. In order 
to have it listen both on IPv4 and IPv6 on all interfaces it actually needs to 
be configured to listen on IPv6 (::). But that causes a small issue, in the 
sense that the X-Forwarded-For and the log files contain an IPv4 address in a 
IPv6 wrapped form. So an address like 10.20.30.40 is represented as 
::ffff:10.20.30.40 everywhere. While one can work around this, the better 
solution is to strip the ::ffff: header off and represent it in pure IPv4 
form...

This patch will do that.

Kind regards,

Maurice Smulders

----------------------------------------------------------------------
The information contained in this transmission may be confidential. Any 
disclosure, copying, or further distribution of confidential information is not 
permitted unless such privilege is explicitly granted in writing by Quantum. 
Quantum reserves the right to have electronic communications, including email 
and attachments, sent across its networks filtered through anti virus and spam 
software programs and retain such messages in order to comply with applicable 
data security and retention requirements. Quantum is not responsible for the 
proper and complete transmission of the substance of this communication or for 
any delay in its receipt.
--- src.new/svc.c	2015-01-26 09:47:53.000000000 -0700
+++ src/svc.c	2015-09-03 11:59:41.729404399 -0600
@@ -273,6 +273,7 @@
     char    buf[MAXBUF];
     int     port;
     void    *src;
+    char    *p = buf;
 
     memset(res, 0, res_len);
 #ifdef  HAVE_INET_NTOP
@@ -298,10 +299,15 @@
         port = 0;
         break;
     }
-    if(no_port)
-        snprintf(res, res_len, "%s", buf);
+    // Strip off the IPv6 prefix
+    if (strncmp(buf, "::ffff:", 7) == 0)
+    {
+        p = buf + 7;
+    }
+    if (no_port) 
+        snprintf(res, res_len, "%s", p);
     else
-        snprintf(res, res_len, "%s:%d", buf, port);
+        snprintf(res, res_len, "%s:%d", p, port);
 #else
 #error "Pound needs inet_ntop()"
 #endif

Reply via email to