#include <Intercept.h>

Collaboration diagram for Ip::Intercept:

Public Member Functions

 Intercept ()
 
 ~Intercept ()
 
bool LookupNat (const Comm::Connection &)
 
bool ProbeForTproxy (Address &test)
 
int TransparentActive ()
 
void StartTransparency ()
 
void StopTransparency (const char *str)
 
int InterceptActive ()
 
void StartInterception ()
 

Private Member Functions

bool NetfilterInterception (const Comm::ConnectionPointer &newConn)
 
bool IpfwInterception (const Comm::ConnectionPointer &newConn)
 
bool IpfInterception (const Comm::ConnectionPointer &newConn)
 
bool PfInterception (const Comm::ConnectionPointer &newConn)
 
bool UseInterceptionAddressesLookedUpEarlier (const char *, const Comm::ConnectionPointer &)
 

Private Attributes

int transparentActive_
 
int interceptActive_
 

Detailed Description

Definition at line 29 of file Intercept.h.

Constructor & Destructor Documentation

◆ Intercept()

Ip::Intercept::Intercept ( )
inline

Definition at line 32 of file Intercept.h.

◆ ~Intercept()

Ip::Intercept::~Intercept ( )
inline

Definition at line 33 of file Intercept.h.

Member Function Documentation

◆ InterceptActive()

int Ip::Intercept::InterceptActive ( )
inline
Return values
0IP Interception is disabled.
1IP Interception is enabled and active.

Definition at line 77 of file Intercept.h.

References interceptActive_.

◆ IpfInterception()

bool Ip::Intercept::IpfInterception ( const Comm::ConnectionPointer newConn)
private

perform Lookups on IPF interception.

Parameters
newConnDetails known, to be updated where relevant.
Returns
Whether successfully located the new address.

Definition at line 212 of file Intercept.cc.

References DBG_CRITICAL, debugs, Ip::Address::getInAddr(), Ip::Address::isIPv6(), Comm::Connection::local, and Comm::Connection::remote.

◆ IpfwInterception()

bool Ip::Intercept::IpfwInterception ( const Comm::ConnectionPointer newConn)
private

perform Lookups on IPFW interception.

Parameters
newConnDetails known, to be updated where relevant.
Returns
Whether successfully located the new address.

Definition at line 182 of file Intercept.cc.

◆ LookupNat()

bool Ip::Intercept::LookupNat ( const Comm::Connection aConn)

perform NAT lookups for the local address of the given connection

Returns
true to indicate a successful lookup
false on errors that do not warrant listening socket closure
Exceptions
exceptionon errors that warrant listening socket closure

Definition at line 390 of file Intercept.cc.

References assert, debugs, Comm::Connection::local, and Comm::Connection::remote.

◆ NetfilterInterception()

bool Ip::Intercept::NetfilterInterception ( const Comm::ConnectionPointer newConn)
private

perform Lookups on Netfilter interception targets (REDIRECT, DNAT).

Parameters
newConnDetails known, to be updated where relevant.
Returns
Whether successfully located the new address.
Try NAT lookup for REDIRECT or DNAT targets.

Definition at line 124 of file Intercept.cc.

References DBG_IMPORTANT, debugs, Comm::Connection::fd, Ip::Address::getSockAddr(), IP6T_SO_ORIGINAL_DST, Ip::Address::isIPv6(), Comm::Connection::local, and xstrerr().

◆ PfInterception()

bool Ip::Intercept::PfInterception ( const Comm::ConnectionPointer newConn)
private

perform Lookups on PF interception target (REDIRECT).

Parameters
newConnDetails known, to be updated where relevant.
Returns
Whether successfully located the new address.

Definition at line 325 of file Intercept.cc.

References DBG_IMPORTANT, debugs, Ip::Address::getInAddr(), Ip::Address::isIPv6(), Comm::Connection::local, Ip::Address::port(), Comm::Connection::remote, and xstrerr().

◆ ProbeForTproxy()

bool Ip::Intercept::ProbeForTproxy ( Ip::Address test)

Test system networking calls for TPROXY support. Detects IPv6 and IPv4 level of support matches the address being listened on and if the compiled v2/v4 is usable as far down as a bind()ing.

Parameters
testAddress set on the squid.conf *_port being checked.
Return values
trueTPROXY is available.
falseTPROXY is not available.

Definition at line 401 of file Intercept.cc.

References DBG_CRITICAL, debugs, Ip::EnableIpv6, enter_suid(), Ip::Address::isIPv4(), Ip::Address::isIPv6(), leave_suid(), Ip::Address::port(), and Ip::Address::setIPv4().

◆ StartInterception()

void Ip::Intercept::StartInterception ( )
Turn on IP-Interception-Proxy activities. This function should be called during parsing of the squid.conf When any option requiring interception / NAT handling is encountered.

Definition at line 168 of file Intercept.cc.

References Here.

Referenced by parse_port_option().

◆ StartTransparency()

void Ip::Intercept::StartTransparency ( )
Turn on fully Transparent-Proxy activities. This function should be called during parsing of the squid.conf When any option requiring full-transparency is encountered.

Definition at line 153 of file Intercept.cc.

References Here.

Referenced by parse_port_option().

◆ StopTransparency()

void Ip::Intercept::StopTransparency ( const char *  str)
Turn off fully Transparent-Proxy activities on all new connections. Existing transactions and connections are unaffected and will run to their natural completion.
Parameters
strReason for stopping. Will be logged to cache.log

Definition at line 115 of file Intercept.cc.

References DBG_IMPORTANT, debugs, and transparentActive_.

Referenced by keepCapabilities(), and restoreCapabilities().

◆ TransparentActive()

int Ip::Intercept::TransparentActive ( )
inline
Return values
0Full transparency is disabled.
1Full transparency is enabled and active.

Definition at line 56 of file Intercept.h.

References transparentActive_.

◆ UseInterceptionAddressesLookedUpEarlier()

bool Ip::Intercept::UseInterceptionAddressesLookedUpEarlier ( const char *  caller,
const Comm::ConnectionPointer newConn 
)
private

Assume that getsockname() has been called already and provided the necessary TCP packet details. There is no way to identify whether they came from NAT. Trust the user configured properly.

Definition at line 196 of file Intercept.cc.

References debugs.

Member Data Documentation

◆ interceptActive_

int Ip::Intercept::interceptActive_
private

Definition at line 123 of file Intercept.h.

Referenced by InterceptActive().

◆ transparentActive_

int Ip::Intercept::transparentActive_
private

Definition at line 122 of file Intercept.h.

Referenced by StopTransparency(), and TransparentActive().


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous