--------------------- PatchSet 5478 Date: 2007/08/23 04:27:06 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Part 3: helper port IPv4/6 options. - removed name clash between global localhost default and component local address usage. - I expect this breaks a few areas not yet compile-tested. Members: src/external_acl.cc:1.37.6.14->1.37.6.15 src/globals.h:1.17.2.11->1.17.2.12 src/helper.cc:1.16.2.8->1.16.2.9 src/helper.h:1.3.6.2->1.3.6.3 src/icmp.cc:1.8.8.12->1.8.8.13 src/ipc.cc:1.9.4.15->1.9.4.16 src/ipc_win32.cc:1.3.6.4->1.3.6.5 src/main.cc:1.42.4.17->1.42.4.18 src/protos.h:1.48.4.29->1.48.4.30 src/unlinkd.cc:1.7.10.6->1.7.10.7 src/DiskIO/DiskDaemon/DiskdIOStrategy.cc:1.2.4.7->1.2.4.8 src/tests/stub_comm.cc:1.1.6.1->1.1.6.2 Index: squid3/src/external_acl.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/external_acl.cc,v retrieving revision 1.37.6.14 retrieving revision 1.37.6.15 diff -u -r1.37.6.14 -r1.37.6.15 --- squid3/src/external_acl.cc 22 Aug 2007 02:27:04 -0000 1.37.6.14 +++ squid3/src/external_acl.cc 23 Aug 2007 04:27:06 -0000 1.37.6.15 @@ -1,6 +1,6 @@ /* - * $Id: external_acl.cc,v 1.37.6.14 2007/08/22 02:27:04 amosjeffries Exp $ + * $Id: external_acl.cc,v 1.37.6.15 2007/08/23 04:27:06 amosjeffries Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -1312,6 +1312,8 @@ p->theHelper->ipc_type = IPC_TCP_SOCKET; + p->theHelper->addr = p->local_addr; + helperOpenServers(p->theHelper); } Index: squid3/src/globals.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/globals.h,v retrieving revision 1.17.2.11 retrieving revision 1.17.2.12 diff -u -r1.17.2.11 -r1.17.2.12 --- squid3/src/globals.h 22 Aug 2007 02:27:04 -0000 1.17.2.11 +++ squid3/src/globals.h 23 Aug 2007 04:27:06 -0000 1.17.2.12 @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.17.2.11 2007/08/22 02:27:04 amosjeffries Exp $ + * $Id: globals.h,v 1.17.2.12 2007/08/23 04:27:06 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -111,7 +111,9 @@ extern struct _acl_deny_info_list *DenyInfoList; /* NULL */ - extern IPAddress local_addr; + // INET6: this should probably die in favour of locals created as needed. + // especially since its mainly used in startup and helper initialisation. + extern IPAddress default_localhost_addr; extern IPAddress theOutICPAddr; Index: squid3/src/helper.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/helper.cc,v retrieving revision 1.16.2.8 retrieving revision 1.16.2.9 diff -u -r1.16.2.8 -r1.16.2.9 --- squid3/src/helper.cc 7 Aug 2007 21:37:00 -0000 1.16.2.8 +++ squid3/src/helper.cc 23 Aug 2007 04:27:06 -0000 1.16.2.9 @@ -1,6 +1,6 @@ /* - * $Id: helper.cc,v 1.16.2.8 2007/08/07 21:37:00 amosjeffries Exp $ + * $Id: helper.cc,v 1.16.2.9 2007/08/23 04:27:06 amosjeffries Exp $ * * DEBUG: section 84 Helper process maintenance * AUTHOR: Harvest Derived? @@ -120,6 +120,7 @@ progname, args, shortname, + hlp->addr, &rfd, &wfd, &hIpc); @@ -136,6 +137,7 @@ srv->hIpc = hIpc; srv->pid = pid; srv->index = k; + srv->addr = hlp->addr; srv->rfd = rfd; srv->wfd = wfd; srv->rbuf = (char *)memAllocBuf(8192, &srv->rbuf_sz); @@ -219,6 +221,7 @@ progname, args, shortname, + hlp->addr, &rfd, &wfd, &hIpc); @@ -241,6 +244,7 @@ srv->stats.submits = 0; srv->stats.releases = 0; srv->index = k; + srv->addr = hlp->addr; srv->rfd = rfd; srv->wfd = wfd; srv->rbuf = (char *)memAllocBuf(8192, &srv->rbuf_sz); Index: squid3/src/helper.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/helper.h,v retrieving revision 1.3.6.2 retrieving revision 1.3.6.3 diff -u -r1.3.6.2 -r1.3.6.3 --- squid3/src/helper.h 8 May 2007 12:45:39 -0000 1.3.6.2 +++ squid3/src/helper.h 23 Aug 2007 04:27:07 -0000 1.3.6.3 @@ -1,6 +1,6 @@ /* - * $Id: helper.h,v 1.3.6.2 2007/05/08 12:45:39 amosjeffries Exp $ + * $Id: helper.h,v 1.3.6.3 2007/08/23 04:27:07 amosjeffries Exp $ * * DEBUG: section 84 Helper process maintenance * AUTHOR: Harvest Derived? @@ -38,6 +38,7 @@ #include "squid.h" #include "cbdata.h" +#include "IPAddress.h" class helper_request; @@ -65,6 +66,7 @@ int n_running; int n_active; int ipc_type; + IPAddress addr; unsigned int concurrency; time_t last_queue_warn; time_t last_restart; @@ -90,6 +92,7 @@ int n_running; int n_active; int ipc_type; + IPAddress addr; MemAllocator *datapool; HLPSAVAIL *IsAvailable; HLPSONEQ *OnEmptyQueue; @@ -111,6 +114,7 @@ { int index; int pid; + IPAddress addr; int rfd; int wfd; MemBuf *wqueue; @@ -149,6 +153,7 @@ } stats; + void *hIpc; }; @@ -158,6 +163,7 @@ { int index; int pid; + IPAddress addr; int rfd; int wfd; /* MemBuf wqueue; */ Index: squid3/src/icmp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/icmp.cc,v retrieving revision 1.8.8.12 retrieving revision 1.8.8.13 diff -u -r1.8.8.12 -r1.8.8.13 --- squid3/src/icmp.cc 30 Jul 2007 11:46:46 -0000 1.8.8.12 +++ squid3/src/icmp.cc 23 Aug 2007 04:27:07 -0000 1.8.8.13 @@ -1,6 +1,6 @@ /* - * $Id: icmp.cc,v 1.8.8.12 2007/07/30 11:46:46 amosjeffries Exp $ + * $Id: icmp.cc,v 1.8.8.13 2007/08/23 04:27:07 amosjeffries Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels @@ -249,6 +249,7 @@ Config.Program.pinger, args, "Pinger Socket", + default_localhost_addr, &rfd, &wfd, &hIpc); Index: squid3/src/ipc.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipc.cc,v retrieving revision 1.9.4.15 retrieving revision 1.9.4.16 diff -u -r1.9.4.15 -r1.9.4.16 --- squid3/src/ipc.cc 22 Aug 2007 03:29:34 -0000 1.9.4.15 +++ squid3/src/ipc.cc 23 Aug 2007 04:27:07 -0000 1.9.4.16 @@ -1,6 +1,6 @@ /* - * $Id: ipc.cc,v 1.9.4.15 2007/08/22 03:29:34 amosjeffries Exp $ + * $Id: ipc.cc,v 1.9.4.16 2007/08/23 04:27:07 amosjeffries Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -75,7 +75,7 @@ } pid_t -ipcCreate(int type, const char *prog, const char *const args[], const char *name, int *rfd, int *wfd, void **hIpc) +ipcCreate(int type, const char *prog, const char *const args[], const char *name, IPAddress &local_addr, int *rfd, int *wfd, void **hIpc) { pid_t pid; IPAddress ChS; @@ -103,13 +103,7 @@ if (hIpc) *hIpc = NULL; -/* AYJ INET6 TODO : Some external helpers may require IPv4-localhost */ -/* Find a way to migrate the config option down here per-helper */ -/* once here we can set (config)->local_addr */ -/* until then we must use IPv4-localhost here for compatability */ - if (type == IPC_TCP_SOCKET) { - local_addr.SetIPv4(); // force IPv4 crfd = cwfd = comm_open(SOCK_STREAM, 0, local_addr, @@ -120,9 +114,7 @@ local_addr, 0, /* blocking */ name); - local_addr.SetLocalhost(); // reset } else if (type == IPC_UDP_SOCKET) { - local_addr.SetIPv4(); // force IPv4 crfd = cwfd = comm_open(SOCK_DGRAM, 0, local_addr, @@ -133,7 +125,6 @@ local_addr, 0, name); - local_addr.SetLocalhost(); // reset } else if (type == IPC_FIFO) { int p2c[2]; int c2p[2]; Index: squid3/src/ipc_win32.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipc_win32.cc,v retrieving revision 1.3.6.4 retrieving revision 1.3.6.5 diff -u -r1.3.6.4 -r1.3.6.5 --- squid3/src/ipc_win32.cc 1 May 2007 08:32:31 -0000 1.3.6.4 +++ squid3/src/ipc_win32.cc 23 Aug 2007 04:27:07 -0000 1.3.6.5 @@ -1,6 +1,6 @@ /* - * $Id: ipc_win32.cc,v 1.3.6.4 2007/05/01 08:32:31 amosjeffries Exp $ + * $Id: ipc_win32.cc,v 1.3.6.5 2007/08/23 04:27:07 amosjeffries Exp $ * * DEBUG: section 54 Windows Interprocess Communication * AUTHOR: Andrey Shorin @@ -108,7 +108,7 @@ } pid_t -ipcCreate(int type, const char *prog, const char *const args[], const char *name, int *rfd, int *wfd, void **hIpc) +ipcCreate(int type, const char *prog, const char *const args[], const char *name, IPAddress &local_addr, int *rfd, int *wfd, void **hIpc) { unsigned long thread; @@ -118,9 +118,10 @@ DWORD ecode = 0; pid_t pid; +// INET6 TODO: IPv6-enable this function. struct sockaddr_in CS; - struct sockaddr_in PS; + int crfd = -1; int prfd = -1; int cwfd = -1; Index: squid3/src/main.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/main.cc,v retrieving revision 1.42.4.17 retrieving revision 1.42.4.18 diff -u -r1.42.4.17 -r1.42.4.18 --- squid3/src/main.cc 22 Aug 2007 02:27:04 -0000 1.42.4.17 +++ squid3/src/main.cc 23 Aug 2007 04:27:07 -0000 1.42.4.18 @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.42.4.17 2007/08/22 02:27:04 amosjeffries Exp $ + * $Id: main.cc,v 1.42.4.18 2007/08/23 04:27:07 amosjeffries Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -1123,7 +1123,11 @@ if (oldmask) umask(oldmask); - local_addr.SetLocalhost(); + default_localhost_addr.SetLocalhost(); + // AYJ INET6: back-compatible: localhost defaults to IPv4 unless set otherwise. + // that will eventually change, but not during transition period. + // it is blocked by: absent ICMPv6, untested 'external_acl_type ipv*' + default_localhost_addr.SetIPv4(); squid_srandom(time(NULL)); Index: squid3/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/protos.h,v retrieving revision 1.48.4.29 retrieving revision 1.48.4.30 diff -u -r1.48.4.29 -r1.48.4.30 --- squid3/src/protos.h 14 Aug 2007 02:06:53 -0000 1.48.4.29 +++ squid3/src/protos.h 23 Aug 2007 04:27:07 -0000 1.48.4.30 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.48.4.29 2007/08/14 02:06:53 amosjeffries Exp $ + * $Id: protos.h,v 1.48.4.30 2007/08/23 04:27:07 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -684,6 +684,7 @@ const char *prog, const char *const args[], const char *name, + IPAddress &local_addr, int *rfd, int *wfd, void **hIpc); Index: squid3/src/unlinkd.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/unlinkd.cc,v retrieving revision 1.7.10.6 retrieving revision 1.7.10.7 diff -u -r1.7.10.6 -r1.7.10.7 --- squid3/src/unlinkd.cc 1 May 2007 08:32:32 -0000 1.7.10.6 +++ squid3/src/unlinkd.cc 23 Aug 2007 04:27:08 -0000 1.7.10.7 @@ -1,6 +1,6 @@ /* - * $Id: unlinkd.cc,v 1.7.10.6 2007/05/01 08:32:32 amosjeffries Exp $ + * $Id: unlinkd.cc,v 1.7.10.7 2007/08/23 04:27:08 amosjeffries Exp $ * * DEBUG: section 2 Unlink Daemon * AUTHOR: Duane Wessels @@ -211,6 +211,7 @@ Config.Program.unlinkd, args, "unlinkd", + default_localhost_addr, &unlinkd_rfd, &unlinkd_wfd, &hIpc); Index: squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc,v retrieving revision 1.2.4.7 retrieving revision 1.2.4.8 diff -u -r1.2.4.7 -r1.2.4.8 --- squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc 19 Aug 2007 11:03:16 -0000 1.2.4.7 +++ squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc 23 Aug 2007 04:27:08 -0000 1.2.4.8 @@ -1,6 +1,6 @@ /* - * $Id: DiskdIOStrategy.cc,v 1.2.4.7 2007/08/19 11:03:16 amosjeffries Exp $ + * $Id: DiskdIOStrategy.cc,v 1.2.4.8 2007/08/23 04:27:08 amosjeffries Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -188,6 +188,7 @@ Config.Program.diskd, args, "diskd", + default_localhost_addr, &rfd, &wfd, &hIpc); Index: squid3/src/tests/stub_comm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tests/stub_comm.cc,v retrieving revision 1.1.6.1 retrieving revision 1.1.6.2 diff -u -r1.1.6.1 -r1.1.6.2 --- squid3/src/tests/stub_comm.cc 5 Jan 2007 17:00:55 -0000 1.1.6.1 +++ squid3/src/tests/stub_comm.cc 23 Aug 2007 04:27:08 -0000 1.1.6.2 @@ -1,5 +1,5 @@ /* - * $Id: stub_comm.cc,v 1.1.6.1 2007/01/05 17:00:55 hno Exp $ + * $Id: stub_comm.cc,v 1.1.6.2 2007/08/23 04:27:08 amosjeffries Exp $ * * DEBUG: section 84 Helper process maintenance * AUTHOR: Robert Collins @@ -114,7 +114,7 @@ /* bah, cheating on stub count */ pid_t -ipcCreate(int type, const char *prog, const char *const args[], const char *name, int *rfd, int *wfd, void **hIpc) +ipcCreate(int type, const char *prog, const char *const args[], const char *name, IPAddress &local_addr, int *rfd, int *wfd, void **hIpc) { fatal ("Not implemented"); return -1;