diff -ur squid-2.4.DEVEL4.orig/configure.in squid-2.4.DEVEL4/configure.in --- squid-2.4.DEVEL4.orig/configure.in Tue Jul 18 02:16:19 2000 +++ squid-2.4.DEVEL4/configure.in Thu Nov 23 14:54:14 2000 @@ -584,6 +584,17 @@ fi ]) +dnl Enable Linux Netfilter (2.4) Transparent Proxy +AC_ARG_ENABLE(linux-netfilter, +[ --enable-linux-netfilter + Enable Transparent Proxy support for Linux 2.4.], +[ if test "$enableval" = "yes" ; then + echo "Linux-Netfilter Transparent Proxy enabled" + AC_DEFINE(LINUX_NETFILTER) + LINUX_NETFILTER="yes" + fi +]) + dnl Enable Leak Finding Functions AC_ARG_ENABLE(leakfinder, [ --enable-leakfinder @@ -798,6 +809,7 @@ ip_nat.h \ libc.h \ limits.h \ + linux/netfilter_ipv4.h \ malloc.h \ math.h \ memory.h \ @@ -1255,6 +1267,26 @@ if test "$IPF_TRANSPARENT" = "no" ; then echo "WARNING: Cannot find necessary IP-Filter header files" echo " Transparent Proxy support WILL NOT be enabled" + sleep 10 +fi + +dnl Linux-Netfilter support requires Linux 2.4 kernel header files. +dnl Shamelessly copied from above +if test "$LINUX_NETFILTER" ; then + AC_MSG_CHECKING(if Linux 2.4 kernel header files are installed) + # hold on to your hats... + if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then + LINUX_NETFILTER="yes" + AC_DEFINE(LINUX_NETFILTER, 1) + else + LINUX_NETFILTER="no" + AC_DEFINE(LINUX_NETFILTER, 0) + fi + AC_MSG_RESULT($LINUX_NETFILTER) +fi +if test "$LINUX_NETFILTER" = "no" ; then + echo "WARNING: Cannot find necessary Linux 2.4 kernel header files" + echo " Linux 2.4 Transparent Proxy support WILL NOT be enabled" sleep 10 fi diff -ur squid-2.4.DEVEL4.orig/include/autoconf.h.in squid-2.4.DEVEL4/include/autoconf.h.in --- squid-2.4.DEVEL4.orig/include/autoconf.h.in Tue Jul 18 02:16:39 2000 +++ squid-2.4.DEVEL4/include/autoconf.h.in Thu Nov 23 14:54:14 2000 @@ -229,6 +229,11 @@ #undef IPF_TRANSPARENT /* + * Enable support for Transparent Proxy on Linux 2.4 systems + */ +#undef LINUX_NETFILTER + +/* * Enable code for assiting in finding memory leaks. Hacker stuff only. */ #undef USE_LEAKFINDER diff -ur squid-2.4.DEVEL4.orig/src/client_side.c squid-2.4.DEVEL4/src/client_side.c --- squid-2.4.DEVEL4.orig/src/client_side.c Tue Jul 18 02:16:41 2000 +++ squid-2.4.DEVEL4/src/client_side.c Thu Nov 23 14:54:53 2000 @@ -62,6 +62,9 @@ #endif #endif +#if LINUX_NETFILTER +#include +#endif #if LINGERING_CLOSE @@ -2227,6 +2230,9 @@ struct natlookup natLookup; static int natfd = -1; #endif +#if LINUX_NETFILTER + size_t sock_sz = sizeof(conn->me); +#endif if ((req_sz = headersEnd(conn->in.buf, conn->in.offset)) == 0) { debug(33, 5) ("Incomplete request, waiting for end of headers\n"); @@ -2402,6 +2408,10 @@ inet_ntoa(natLookup.nl_realip), vport, url); #else +#if LINUX_NETFILTER + /* If the call fails the address structure will be unchanged */ + getsockopt(conn->fd, SOL_IP, SO_ORIGINAL_DST, &conn->me, &sock_sz ); +#endif snprintf(http->uri, url_sz, "http://%s:%d%s", inet_ntoa(http->conn->me.sin_addr), vport, url);