]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4302: IPFilter v5 transparent interception
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 16 Aug 2015 07:56:20 +0000 (00:56 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 16 Aug 2015 07:56:20 +0000 (00:56 -0700)
src/ip/Intercept.cc

index 9e5f18800544606d07f0a1353b9e8eec3e079f55..1cd5ceac3b20d0804c3bb12c204a4b256d16d503 100644 (file)
@@ -200,6 +200,19 @@ Ip::Intercept::IpfInterception(const Comm::ConnectionPointer &newConn, int silen
     // all fields must be set to 0
     memset(&natLookup, 0, sizeof(natLookup));
     // for NAT lookup set local and remote IP:port's
+    if (newConn->remote.isIPv6()) {
+#if IPFILTER_VERSION < 5000003
+        // warn once every 10 at critical level, then push down a level each repeated event
+        static int warningLevel = DBG_CRITICAL;
+        debugs(89, warningLevel, "IPF (IPFilter v4) NAT does not support IPv6. Please upgrade to IPFilter v5.1");
+        warningLevel = ++warningLevel % 10;
+        return false;
+#else
+        natLookup.nl_v = 6;
+    } else {
+        natLookup.nl_v = 4;
+#endif
+    }
     natLookup.nl_inport = htons(newConn->local.port());
     newConn->local.getInAddr(natLookup.nl_inip);
     natLookup.nl_outport = htons(newConn->remote.port());