Re: WCCPv1 still broken in squid-3.1

2010-02-08 Thread Amos Jeffries

Graham Keeling wrote:

Hello,

I started a thread over here with the initial problems that I had with
squid-3.1.0.15:
http://www.mail-archive.com/squid-us...@squid-cache.org/msg69906.html

That thread ends with me setting the router port in src/wccp.cc and I say
that WCCPv1 was working for me.

Well, I was mistaken, as it still didn't work (it turned out that I hadn't
actually stopped a previously running squid-3.0 process).

However, I have another patch that really *does* make it work for me (in
addition to the original port patch).


It seemed to me that wccpAssignBuckets() never gets called, and that this
was because wccpLowestIP() never returned non-zero.
And this in turn seemed to be because the ip_addr and local_ip variables in
wccpLowestIP() were being compared, but 'IpAddress local_ip' was getting
initialised from a 'struct addrinfo *';

local_ip = *local;

I changed it to the following, and suddenly my WCCPv1 browsing works:

local_ip.InitAddrInfo(local);

I don't know whether this is the 'correct' thing to do or not, as I don't
understand squid's 'class IpAddress'. Perhaps there needs to be an equivalent
FreeAddrInfo somewhere to stop it eating memory.

But I do know that I can now use WCCPv1, whereas before it didn't work at all.

Patch attached.



Something very weird is going on.

 The local_ip = *local is (should be anyway) taking the result from 
getsockname() stored in *local and copying it to local_ip.


 InitAddrInfo(local) erases any memory pointed to by *local and 
replaces it with 0.0.0.0:0 and whatever family of IPv4/IPv6 address 
local_ip was.


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE7 or 3.0.STABLE23
  Current Beta Squid 3.1.0.16


WCCPv1 still broken in squid-3.1

2010-02-07 Thread Graham Keeling
Hello,

I started a thread over here with the initial problems that I had with
squid-3.1.0.15:
http://www.mail-archive.com/squid-us...@squid-cache.org/msg69906.html

That thread ends with me setting the router port in src/wccp.cc and I say
that WCCPv1 was working for me.

Well, I was mistaken, as it still didn't work (it turned out that I hadn't
actually stopped a previously running squid-3.0 process).

However, I have another patch that really *does* make it work for me (in
addition to the original port patch).


It seemed to me that wccpAssignBuckets() never gets called, and that this
was because wccpLowestIP() never returned non-zero.
And this in turn seemed to be because the ip_addr and local_ip variables in
wccpLowestIP() were being compared, but 'IpAddress local_ip' was getting
initialised from a 'struct addrinfo *';

local_ip = *local;

I changed it to the following, and suddenly my WCCPv1 browsing works:

local_ip.InitAddrInfo(local);

I don't know whether this is the 'correct' thing to do or not, as I don't
understand squid's 'class IpAddress'. Perhaps there needs to be an equivalent
FreeAddrInfo somewhere to stop it eating memory.

But I do know that I can now use WCCPv1, whereas before it didn't work at all.

Patch attached.
Index: wccp.cc
===
RCS file: /cvs/netpilot/GPL/squid-3.1.0.15/WORK/src/wccp.cc,v
retrieving revision 1.2
diff -u -r1.2 wccp.cc
--- wccp.cc	3 Feb 2010 14:36:30 -	1.2
+++ wccp.cc	3 Feb 2010 16:46:38 -
@@ -177,7 +177,7 @@
 if (getsockname(theWccpConnection, local-ai_addr, local-ai_addrlen))
 fatal(Unable to getsockname on WCCP out socket);
 
-local_ip = *local;
+local_ip.InitAddrInfo(local);
 
 Config.Wccp.address.FreeAddrInfo(local);
 }