Alex Rousskov [Sat, 5 Jun 2010 19:08:44 +0000 (13:08 -0600)]
Only one process (called the "primary" process) should handle WCCP. In SMP
mode, this is the Coordinator process.
Identified several commonly use process kinds and added the corresponding
Iam*Process() tests to avoid duplicating complex conditions throughout the
code. Note that kinds are not mutually exclusive. For example, a primary
process is also the master process and the worker process when running
in a no-daemon mode.
Alex Rousskov [Sat, 5 Jun 2010 18:32:22 +0000 (12:32 -0600)]
Replaced blocking comm_open_listener() call for incoming and outgoing SNMP
ports with Ipc::StartListening calls, to use the "shared listen" feature when
doing SMP.
Alex Rousskov [Sun, 2 May 2010 18:49:25 +0000 (12:49 -0600)]
Support a "shared listen" concept when multiple concurrent processes listen
on the same socket. The Coordinator is responsible for opening and caching
listening sockets, using comm_open_listener() parameters supplied by remote
callers. Sendmsg/recvmsg is used to shovel socket descriptors from Coordinator
to remote callers.
If SMP is not enabled, we call the local comm_open_listener() as usual but
return the results asynchronously to avoid making SMP/nonSMP special in
the caller code.
Alex Rousskov [Sun, 2 May 2010 01:37:34 +0000 (19:37 -0600)]
Added comm_import_opened() to update Comm state after getting a comm_open()
FD from another process. While both FDs point to the same kernel object, Squid
internal tables are local to each process and need to be maintained
separately.
Alex Rousskov [Sun, 2 May 2010 01:20:05 +0000 (19:20 -0600)]
Added whole-object comparison method so that IpAddress objects can be
properly sorted and used as std::map index.
Existing IpAddress comparison operators do not work well because they only
compare IP addresses (and incorrectly compare "none" and/or "any" IP
addresses).
Alex Rousskov [Sat, 1 May 2010 04:12:07 +0000 (22:12 -0600)]
Fixed IpAddress port printing for ports higher than 9999:
snprintf includes zero-terminator in its size limit, so 7
rather than 6 bytes are needed to snprintf a colon followed
by 5 port digits.
Whether the bug has any runtime effects in the current code,
I do not know, but I did waste a few hours following
misleading debugging output.
Alex Rousskov [Thu, 29 Apr 2010 22:35:11 +0000 (16:35 -0600)]
Implemented basic file descriptor exchange between IPC Strand and Coordinator.
Tested using on-disk file. The test hack will be removed.
Fixed Port code to allow it to receive more than one message with varying
msghdr buffer configurations. We must [re]allocate all msghdr buffers before
every read/recvmsg() call.
Alex Rousskov [Thu, 29 Apr 2010 20:12:03 +0000 (14:12 -0600)]
Switched from sendto/recvfrom to sendmsg/recvmsg for UDS I/O. Replaced
inlined sendto/recvfrom hacks with FD_WRITE/READ_METHOD-based code.
A common msghdr-based interface allows us to use the same API for regular
IPC messages and for future messages that pass socket descriptors. While
msghdr allows for complex vector-based scatter/gather I/O, the IPC code
limits complexity by using a single-element I/O vector and a control message
part dedicated to passing descriptors.
Added a temporary hack to block-sleep between IPC message sending attempts so
that we do not use up all the allowed attempts in a short period of time. The
hack will be replace with a non-blocking addEvent-based sleep.
Alex Rousskov [Mon, 26 Apr 2010 20:57:11 +0000 (14:57 -0600)]
Do not check pid file unless we are a master process. Kids processes start and
run when the pid file may point to a live Squid process.
There are some must-be-single processes like Coordinator, but it is probably
better to manage their uniqueness differently because there may be many kinds
of must-be-single processes.
Alex Rousskov [Mon, 26 Apr 2010 07:53:14 +0000 (01:53 -0600)]
Designate one process to maintain the PID file. Coordinator does that
when Squid runs in SMP mode. The only kid does it when running "mono".
The master process does it when not daemonizing. This change allows SMP
Squid to work with a single PID file.
Broadcast management signals from Coordinator to kids. This change
makes both "squid -k ..." and "kill `cat <PID file>`" work for SMP Squid.
Alex Rousskov [Mon, 26 Apr 2010 07:09:03 +0000 (01:09 -0600)]
Added IPC Strand and Coordinator classes. Strands are jobs responsible
for registering Squid processes or threads with the central Coordinator
job. Coordinator will broadcast control signals and shared ports to
Strands.
Added a simple hierarchy of inter-process communication (IPC) classes to
support Coordinator and Strands.
Print current process number (KidIdentifier) when writing debug messages.
This allows to easily isolate per-process progress even when using a single
cache.log.
Alex Rousskov [Thu, 4 Mar 2010 06:25:18 +0000 (23:25 -0700)]
Start a configurable number of "main" Squid processes. Each process
does what a regular Squid daemon does. Listening conflicts are resolved
using a temporary hack (incrementing the port number for each process).
Restart dying processes as needed, maintaining the old overall daemon
restart logic and quitting on frequent repeated failures or successful
daemon completion.
Needs more work to polish restarting code, to share common resources
such as listening ports, to unify reporting, including logging. CPU
core affinity and process specialization need to be configurable.
Amos Jeffries [Sun, 14 Feb 2010 05:36:46 +0000 (18:36 +1300)]
Author: Serassio Guido <serassio@squid-cache.org>
Windows port: Update mswin_check_ad_group to version 2.0
The global groups support was rewritten, now is based on ADSI.
New Features:
- support for Domain Local, Domain Global ad Universal groups
- full group nesting support
This helper, like the previous version, can be compiled only using
Microsoft Visual Studio because some needed library are not available
on MSYS+MinGW or Cygwin.
Amos Jeffries [Sat, 6 Feb 2010 06:32:11 +0000 (19:32 +1300)]
Author: Henrik Nordstrom <hno@squid-cache.org>
Clean up use of httpReplySetHeaders to be consistent across the code, and
remove the unneeded http_version argument.
Amos Jeffries [Fri, 5 Feb 2010 23:27:27 +0000 (12:27 +1300)]
Author: Jean-Gabriel Dick <jean-gabriel.dick@curie.fr>
Bug 1843: multicast-siblings cache_peer option for optimising multicast ICP relations
'multicast-siblings' : this option is meant to be used only for cache peers of
type "multicast". It instructs Squid that ALL members of this multicast group
have "sibling" relationship with it, not "parent". This is an optimization
that avoids useless multicast queries to a multicast group when the requested
object would be fetched only from a "parent" cache, anyway. It's useful, e.g.,
when configuring a pool of redundant Squid proxies, being members of the same
multicast group.
Amos Jeffries [Sun, 31 Jan 2010 06:20:21 +0000 (19:20 +1300)]
Author: Graham Keeling <graham@equiinet.com>
WCCPv1 not connecting to router correctly
I am coming across a problem with WCCPv1...
squid-2.5 connects to UDP port 2048, I get replies, and everything else then works.
squid-3.1 looks like it is trying to connect to UDP port 0 on the cisco.
[and fails to work]
I have looked at the src/wccp.c for squid-2.5, and it is clear that the port is
being set to 2048 for the connection to the router.
I have also looked at the source for 2.6, 2.7 and 3.0 (src/wccp.cc for this
version).
In all those, it appears to be setting the port on the outgoing connection.
Add the http::>ha format code and make http::>h log virgin request headers
This patch:
- Modify the existin "http::>h format code to log HTTP request headers
before any adaptation and redirection
- Add the new format code "http::>ha" which allow the user to log HTTP
request header or header fields after adaptation and redirection.
Amos Jeffries [Thu, 21 Jan 2010 10:01:16 +0000 (23:01 +1300)]
Author: Wolfgang Nothdurft <wolfgang@linogate.de>
Bug 2730: Regressions in follow_x_forwarded_for since Squid-2
Two Major Regressions:
* Omitted testing for trust of the directly connecting client.
this is critical is trusting the header content itself.
The absence permitted remote clients to forge X-Forwarded-For
and gain access to resources through Squid.
(mitigated by the following)
* Bad logic in implementing the trust model resulted in any XFF
headers containing untrusted IPs to be dropped in their entirety.
This resulted in clients transiting more than one proxy heirarchy to
be incorrectly logged and reported in the second.
Some polish alterations to the existing logics:
* Testing the direct client address for trust means the testing must be
fully async 'slow'. Thus avoiding the memory leaks found on occasion.
* acl_uses_indirect_client is not strictly needed to test multiple levels
of X-Forwarded-For properly. The entire list of IPs are now always
tested until on untrusted is found or an ACL failure occurs.