]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 5294: ERR_CANNOT_FORWARD returned instead of ERR_DNS_FAIL (#1453)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 12 Aug 2023 15:40:12 +0000 (15:40 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 12 Aug 2023 15:40:20 +0000 (15:40 +0000)
commitcef32d3e1dd72e69a3ed54f8b423ad06112e0747
tree7deb45f0567b83bb087ce315bc11e409874eed80
parentd2149fc9aea418202fb49d0efd68bc3048ba01c6
Bug 5294: ERR_CANNOT_FORWARD returned instead of ERR_DNS_FAIL (#1453)

Since 2017 commit fd9c47d, peer selection code stopped reporting
ERR_DNS_FAIL cases because PeerSelector::noteIps() treated DNS answers
without IP addresses as if at least one IP address was received. Without
seeing a DNS resolution error, the ultimate recipient of the DNS
resolution results (e.g., CONNECT tunneling or regular forwarding code)
used ERR_CANNOT_FORWARD to indicate a failure to find a forwarding path.

PeerSelector::noteIps() code mimicked legacy IPH code with regard to
handling of the addresses parameter. However, IPH caller had a special
emptyIsNil adjustment that was missing from the noteIps() call! We now
apply that adjustment to both noteIps() and IPH code paths.

Long-term, we should probably remove nil address container pointers.
Having two different ways to signal lack of IPs is dangerous. Currently,
there is only one known supplier of nil address container:
IpcacheStats.invalid code that validates ipcache_nbgethostbyname() name
parameter. Either the corresponding nil/empty name check should be
converted into an assertion (blaming the ipcache_nbgethostbyname()
caller for not validating the name) OR that checking code should supply
an empty address container to finalCallback().
src/ipcache.cc
src/ipcache.h