From: robertc <> Date: Fri, 27 Sep 2002 17:21:09 +0000 (+0000) Subject: fix netfilter support for NAT X-Git-Tag: SQUID_3_0_PRE1~727 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0077dd02c81c40455530619a461878494e5ea2aa;p=thirdparty%2Fsquid.git fix netfilter support for NAT --- diff --git a/src/IPInterception.cc b/src/IPInterception.cc index b82cac680e..7f29967d1b 100644 --- a/src/IPInterception.cc +++ b/src/IPInterception.cc @@ -1,6 +1,6 @@ /* - * $Id: IPInterception.cc,v 1.2 2002/09/24 11:56:50 robertc Exp $ + * $Id: IPInterception.cc,v 1.3 2002/09/27 11:21:10 robertc Exp $ * * DEBUG: section 89 NAT / IP Interception * AUTHOR: Robert Collins @@ -79,7 +79,7 @@ #endif void -rewriteURIwithInterceptedDetails(char const *originalURL, char *uriBuffer, size_t bufferLength, struct sockaddr_in me, struct sockaddr_in peer, int vport) +rewriteURIwithInterceptedDetails(char const *originalURL, char *uriBuffer, size_t bufferLength, int fd, struct sockaddr_in me, struct sockaddr_in peer, int vport) { #if IPF_TRANSPARENT struct natlookup natLookup; @@ -92,7 +92,7 @@ rewriteURIwithInterceptedDetails(char const *originalURL, char *uriBuffer, size_ static int pffd = -1; #endif #if LINUX_NETFILTER - size_t sock_sz = sizeof(conn->me); + size_t sock_sz = sizeof(me); #endif #if IPF_TRANSPARENT natLookup.nl_inport = me.sin_port; @@ -182,9 +182,9 @@ rewriteURIwithInterceptedDetails(char const *originalURL, char *uriBuffer, size_ #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); + getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, &me, &sock_sz); debug(89, 5) ("rewriteURIwithInterceptedDetails: addr = %s", - inet_ntoa(conn->me.sin_addr)); + inet_ntoa(me.sin_addr)); if (vport_mode) vport = (int) ntohs(me.sin_port); #endif diff --git a/src/IPInterception.h b/src/IPInterception.h index b161e05c39..42fea2a81e 100644 --- a/src/IPInterception.h +++ b/src/IPInterception.h @@ -1,6 +1,6 @@ /* - * $Id: IPInterception.h,v 1.1 2002/09/24 10:46:43 robertc Exp $ + * $Id: IPInterception.h,v 1.2 2002/09/27 11:21:10 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -35,6 +35,6 @@ #define SQUID_IPINTERCEPTION_H void - rewriteURIwithInterceptedDetails(char const *originalURL, char *uriBuffer, size_t bufferLength, struct sockaddr_in me, struct sockaddr_in peer, int vport); + rewriteURIwithInterceptedDetails(char const *originalURL, char *uriBuffer, size_t bufferLength, int fd, struct sockaddr_in me, struct sockaddr_in peer, int vport); #endif /* SQUID_IPINTERCEPTION_H */ diff --git a/src/client_side.cc b/src/client_side.cc index 041dc8c9b9..df1acd96d0 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.595 2002/09/26 13:33:08 robertc Exp $ + * $Id: client_side.cc,v 1.596 2002/09/27 11:21:09 robertc Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1031,7 +1031,7 @@ prepareAcceleratedUrl(clientHttpRequest * http, char *url, char *req_hdr) vport = (int) ntohs(http->conn->me.sin_port); else vport = (int) Config.Accel.port; - rewriteURIwithInterceptedDetails(url, http->uri, url_sz, + rewriteURIwithInterceptedDetails(url, http->uri, url_sz, http->conn->fd, http->conn->me, http->conn->peer, vport); debug(33, 5) ("VHOST REWRITE: '%s'\n", http->uri); } else {