]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed comm.cc:644: "address.port() != 0" assertion (#1149)
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 19 Sep 2022 14:07:47 +0000 (14:07 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 20 Sep 2022 16:40:48 +0000 (16:40 +0000)
IPC code creating a TCP socket pair for communication with helpers used
comm_open() to create a _listening_ socket, misleading Comm into
applying IP_BIND_ADDRESS_NO_PORT optimization that delays port
assignment until connect(2) (which is never called for listening
sockets). Listening sockets must be opened using comm_open_listener(),
but the IPC use case was missed in 2009 commit 31be869 that introduced
comm_open_listener(). IP_BIND_ADDRESS_NO_PORT changes in recent commit
74d7d19 hit that bug.

Disclaimer: Windows-specific code adjusted without testing.

src/ipc.cc
src/ipc_win32.cc

index 1c048efd7ce6f03eacdc4294ffa98ed1160c36a6..25a97898c0cf9e21274e67c582c5a80311bffa18 100644 (file)
@@ -95,7 +95,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
     } else void(0)
 
     if (type == IPC_TCP_SOCKET) {
-        crfd = cwfd = comm_open(SOCK_STREAM,
+        crfd = cwfd = comm_open_listener(SOCK_STREAM,
                                 0,
                                 local_addr,
                                 COMM_NOCLOEXEC,
index cbd7eaf6a63073ba3b93a7452a3a2aa51f7fe16a..261f942fd6fea8540da853608722817170751e47 100644 (file)
@@ -127,7 +127,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
     }
 
     if (type == IPC_TCP_SOCKET) {
-        crfd = cwfd = comm_open(SOCK_STREAM,
+        crfd = cwfd = comm_open_listener(SOCK_STREAM,
                                 IPPROTO_TCP,
                                 local_addr,
                                 COMM_NOCLOEXEC,