Hello,

    Some v3.3 and trunk helpers are broken on FreeBSD and possibly some
other non-Linux OSes. Squid using ssl_crtd, URL rewriter, and possibly
other helpers asserts on startup:

  assertion failed: comm.cc:800: "address.GetPort() != 0"

Our src/defines.h #include file requires sys/socket.h on FreeBSD for
AF_UNIX to be defined in time for IPC_* tests. I suspect a similar but
not-yet-exposed dependency exists for O_TEXT and friends.

The attached patch fixes the AF_UNIX bug in my tests. A better long-term
fix is welcomed.


Thank you,

Alex.
Fix "address.GetPort() != 0" assertion for helpers on FreeBSD (at least).

The order (or set of?) #include files used by src/ssl/helper.cc (and
probably by other helper source files) has changed in v3.3, exposing a
defines.h dependency on sys/socket.h where that system header is
required to define AF_UNIX. With AF_UNIX incorrectly undefined,
IPC_STREAM was set to IPC_TCP_SOCKET instead of IPC_UNIX_STREAM, and
helpers that do not have a notion of a listening port, were trying to
create communication sockets using TCP streams, triggering a "must have
a port" assertion in comm_connect_addr() called from ipcCreate().

TODO: Moving IPC_* defines into an IPC-specific header file may be a
better solution then exposing all defines.h users to sys/socket.h.


diff -ur squid-3.3.0.2-virgin/src/defines.h squid-3.3.0.2-patched/src/defines.h
--- squid-3.3.0.2-virgin/src/defines.h	2012-12-02 01:30:11.000000000 -0700
+++ squid-3.3.0.2-patched/src/defines.h	2013-01-09 04:00:28.000000000 -0700
@@ -30,6 +30,11 @@
 #ifndef SQUID_DEFINES_H
 #define SQUID_DEFINES_H
 
+/* required for AF_UNIX to be defined [on FreeBSD] */
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h> 
+#endif
+
 #ifndef TRUE
 #define TRUE 1
 #endif

Reply via email to