From: Amos Jeffries Date: Thu, 18 Sep 2008 14:05:10 +0000 (+1200) Subject: Restore IPFW lookup function X-Git-Tag: SQUID_3_1_0_1~49^2~18^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d8b5bcbca46f533065333daafaadc81c583255ee;p=thirdparty%2Fsquid.git Restore IPFW lookup function --- diff --git a/src/IPInterception.cc b/src/IPInterception.cc index 66e4edb3d9..43cdd35404 100644 --- a/src/IPInterception.cc +++ b/src/IPInterception.cc @@ -169,8 +169,37 @@ IPIntercept::NetfilterTransparent(int fd, const IPAddress &me, IPAddress &dst, i #endif } -// TODO split this one call into one per transparency method -// with specific switching at run-time ?? +int +IPIntercept::IPFWInterception(int fd, const IPAddress &me, IPAddress &dst, int silent) +{ +#if IPFW_TRANSPARENT + struct addrinfo *lookup = NULL; + + dst.GetAddrInfo(lookup,AF_INET); + + /** \par + * Try lookup for IPFW interception. */ + if( getsockname(fd, lookup->ai_addr, &lookup->ai_addrlen) != 0 ) { + if( !silent ) { + debugs(89, DBG_IMPORTANT, HERE << " IPFW getsockname(...) failed: " << xstrerror()); + last_reported = squid_curtime; + } + } + else { + dst = *lookup; + } + + dst.FreeAddrInfo(lookup); + + if(me != dst) { + debugs(89, 5, HERE << "address: " << dst); + return 0; + } + + debugs(89, 9, HERE << "address: me= " << me << ", dst= " << dst); +#endif + return -1; +} int IPIntercept::NatLookup(int fd, const IPAddress &me, const IPAddress &peer, IPAddress &dst)