From: sborrill <33655983+sborrill@users.noreply.github.com> Date: Fri, 1 May 2020 02:26:44 +0000 (+0000) Subject: Fix IPFilter IPv6 detection, especially on NetBSD (#596) X-Git-Tag: SQUID_5_0_3~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=014d70252e5fed693d63a155b77104b29c8dbf3a;p=thirdparty%2Fsquid.git Fix IPFilter IPv6 detection, especially on NetBSD (#596) Has been broken since 4eaf432. 1. acinclude/os-deps.m4 was missing sys/param.h header 2. acinclude/os-deps.m4 was incorrectly assuming that netinet/ip_nat.h header is always present 3. acinclude/os-deps.m4 was missing netinet/ip_nat.h header where it was used instead of ip_nat.h 4. src/ip/Intercept.cc assumed that AC_CHECK_MEMBERS(`struct X`) outputs `HAVE_X`, but it actually outputs `HAVE_STRUCT_X`. 5. acinclude/os-deps.m4: AC_CHECK_MEMBERS(`X `) converted trailing whitespace into surprising trailing underscores: `HAVE_X__` --- diff --git a/acinclude/os-deps.m4 b/acinclude/os-deps.m4 index 2f06986da9..e88ae7b9b7 100644 --- a/acinclude/os-deps.m4 +++ b/acinclude/os-deps.m4 @@ -925,11 +925,13 @@ AC_DEFUN([SQUID_CHECK_BROKEN_SOLARIS_IPFILTER],[ ## Solaris 10+ backported IPv6 NAT to their IPFilter v4.1 instead of using v5 AC_CHECK_MEMBERS([ struct natlookup.nl_inipaddr.in6, - struct natlookup.nl_realipaddr.in6 - ],,,[ + struct natlookup.nl_realipaddr.in6],,,[ #if USE_SOLARIS_IPFILTER_MINOR_T_HACK #define minor_t fubar #endif +#if HAVE_SYS_PARAM_H +#include +#endif #if HAVE_SYS_TYPES_H #include #endif @@ -955,7 +957,11 @@ AC_DEFUN([SQUID_CHECK_BROKEN_SOLARIS_IPFILTER],[ #elif HAVE_NETINET_IP_FIL_H #include #endif +#if HAVE_IP_NAT_H #include +#elif HAVE_NETINET_IP_NAT_H +#include +#endif ]) ]) diff --git a/src/ip/Intercept.cc b/src/ip/Intercept.cc index 55fc730349..9db2424fd5 100644 --- a/src/ip/Intercept.cc +++ b/src/ip/Intercept.cc @@ -204,7 +204,7 @@ Ip::Intercept::IpfInterception(const Comm::ConnectionPointer &newConn, int silen memset(&natLookup, 0, sizeof(natLookup)); // for NAT lookup set local and remote IP:port's if (newConn->remote.isIPv6()) { -#if HAVE_NATLOOKUP_NL_INIPADDR_IN6 +#if HAVE_STRUCT_NATLOOKUP_NL_INIPADDR_IN6 natLookup.nl_v = 6; newConn->local.getInAddr(natLookup.nl_inipaddr.in6); newConn->remote.getInAddr(natLookup.nl_outipaddr.in6); @@ -292,7 +292,7 @@ Ip::Intercept::IpfInterception(const Comm::ConnectionPointer &newConn, int silen debugs(89, 9, HERE << "address: " << newConn); return false; } else { -#if HAVE_NATLOOKUP_NL_REALIPADDR_IN6 +#if HAVE_STRUCT_NATLOOKUP_NL_REALIPADDR_IN6 if (newConn->remote.isIPv6()) newConn->local = natLookup.nl_realipaddr.in6; else