Skip to content

Bug 4828: Use feature detection for IPFilter API/ABI checks#177

Merged
yadij merged 3 commits intosquid-cache:masterfrom
yadij:bug4828
Mar 18, 2018
Merged

Bug 4828: Use feature detection for IPFilter API/ABI checks#177
yadij merged 3 commits intosquid-cache:masterfrom
yadij:bug4828

Conversation

@yadij
Copy link
Contributor

@yadij yadij commented Mar 14, 2018

Solaris 10+ backported IPFiter v5 features to their v4.1.9 which breaks
the IPFilterv4 logic when IPv6 is received. Resulting in crashes when
IPFilver version detection builds for IPv4-only code.

Fix by switching to feature detection of the relevant library symbols
instead of library version.

Solaris 10+ backported IPFiter v5 features to their v4.1.9 which breaks
the IPFilterv4 logic when IPv6 is received. Resulting in crashes.
see bug 4828
Copy link
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see inlined comments for one potentially important concern before committing this.

I am approving this PR without understanding the code just to avoid blocking this fix. I assume it is well-tested and well-understood by you and/or the folks you trust enough to commit this.

#if HAVE_NATLOOKUP_NL_INIPADDR_IN6
// warn once every 10 at critical level, then push down a level each repeated event
static int warningLevel = DBG_CRITICAL;
debugs(89, warningLevel, "IPF (IPFilter v4) NAT does not support IPv6. Please upgrade to IPFilter v5.1");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are no longer relying on the IPFilter version for this check, should we replace "IPF (IPFilter v4)" with something like "Your IPF" or "Your IPFilter"?

// for NAT lookup set local and remote IP:port's
if (newConn->remote.isIPv6()) {
#if IPFILTER_VERSION < 5000003
#if HAVE_NATLOOKUP_NL_INIPADDR_IN6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know nothing about these macros, but please double check this condition -- it looks like it is reversed:

#if HAVE_FOO
    complain that we do not have something we need
#else
    // OK, so we do not have FOO, but we use foo in an assignment?!
    newConn->local.getInAddr(natLookup.nl_inipaddr.in6);
#endif

@squid-anubis squid-anubis added the M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels label Mar 16, 2018
squid-anubis pushed a commit that referenced this pull request Mar 16, 2018
Solaris 10+ backported IPFiter v5 features to their v4.1.9 which breaks
the IPFilterv4 logic when IPv6 is received. Resulting in crashes when
IPFilver version detection builds for IPv4-only code.

Fix by switching to feature detection of the relevant library symbols
instead of library version.
@squid-anubis squid-anubis added M-passed-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels and removed M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels labels Mar 16, 2018
@yadij yadij merged commit 4eaf432 into squid-cache:master Mar 18, 2018
@squid-anubis squid-anubis added M-failed-other https://github.com/measurement-factory/anubis#pull-request-labels and removed M-passed-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels labels Mar 18, 2018
@yadij yadij deleted the bug4828 branch March 18, 2018 10:36
squidadm pushed a commit to squidadm/squid that referenced this pull request Apr 22, 2018
…che#177)

Solaris 10+ backported IPFiter v5 features to their v4.1.9 which breaks
the IPFilterv4 logic when IPv6 is received. Resulting in crashes.
see bug 4828
yadij added a commit that referenced this pull request Apr 23, 2018
Solaris 10+ backported IPFiter v5 features to their v4.1.9 which breaks
the IPFilterv4 logic when IPv6 is received. Resulting in crashes.
see bug 4828
@sborrill
Copy link
Contributor

sborrill commented Apr 9, 2020

This is broken in quite a few ways. For instance, trying to compile on NetBSD highlights:

  • configure tests don't include correct headers (need sys/param.h to set NetBSD_Version which in turn sets USE_INET6 in netinet/ip_compat.h. Also tries to unconditionally include <ip_nat.h> without checking it exists or checking whether <netinet/ip_nat.h> is present)
  • Even after configure is fixed, the defined value is HAVE_STRUCT_NATLOOKUP_NL_INIPADDR_IN6 not HAVE_NATLOOKUP_NL_INIPADDR_IN6

Patch for autoconf is here:
http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/pkgsrc/www/squid4/patches/patch-acinclude_os-deps.m4?rev=1.1&content-type=text/plain&hideattic=0

Patch for ip/Intercept.cc is here:
http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/pkgsrc/www/squid4/patches/patch-src_ip_Intercept.cc?rev=1.1&content-type=text/plain&hideattic=0

@rousskov
Copy link
Contributor

rousskov commented Apr 9, 2020

@sborrill, thank you for letting us know! Unfortunately, a bug report filed as a comment in an old closed PR may be mishandled. If you can, please submit a pull request fixing this regression.

@rousskov rousskov removed the M-failed-other https://github.com/measurement-factory/anubis#pull-request-labels label Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants