]> git.ipfire.org Git - thirdparty/squid.git/commit
Logformat %lp expands to "-" in wildcard listening port configs (#997)
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 30 Mar 2022 15:51:20 +0000 (15:51 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 1 Apr 2022 15:46:37 +0000 (15:46 +0000)
commitb6c0f0dc13cbf0e89adce74d40d94e1d30758761
tree3f368fafed8e898ea79716dab8d3b3ed5500f9c7
parent23d0a3964d181bccdecf7cfbe1d99a6a7b210b83
Logformat %lp expands to "-" in wildcard listening port configs (#997)

FindListeningPortAddress() and its helpers look for "local" address of
an accepted connection. When FindListeningPortAddress() is called in %la
context, we must skip Ip::Address objects with INADDR_ANY IP addresses
because we are looking for a specific IP address, not a wildcard.
However, when called in %lp context, skipping those Ip::Address objects
may, in some cases, result in skipping the only object that actually
contains the port information, resulting in %lp expanding to "-".

Similarly, zero-port Ip::Address objects (with non-any IPs) could be, in
theory, returned instead of continuing the search for an object with a
non-zero port number, although this case was not observed in tests.

Now we configure the address searching helpers with a "good Ip::Address
object" filter so that each %code code path can customize its search.

The problem was introduced in commit ea35939 that expanded INADDR_ANY
check scope from %la to %lp.
src/HttpRequest.cc
src/HttpRequest.h
src/format/Format.cc