--------------------- PatchSet 4668 Date: 2007/05/29 13:42:02 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Rollout to allow all UDP services to specify IPv6 in squid.conf Members: src/cache_cf.cc:1.40.2.26->1.40.2.27 src/client_side.cc:1.68.2.29->1.68.2.30 src/dns_internal.cc:1.15.6.20->1.15.6.21 src/htcp.cc:1.15.6.9->1.15.6.10 src/structs.h:1.66.2.19->1.66.2.20 Index: squid3/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/cache_cf.cc,v retrieving revision 1.40.2.26 retrieving revision 1.40.2.27 diff -u -r1.40.2.26 -r1.40.2.27 --- squid3/src/cache_cf.cc 27 May 2007 12:52:46 -0000 1.40.2.26 +++ squid3/src/cache_cf.cc 29 May 2007 13:42:02 -0000 1.40.2.27 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.40.2.26 2007/05/27 12:52:46 amosjeffries Exp $ + * $Id: cache_cf.cc,v 1.40.2.27 2007/05/29 13:42:02 amosjeffries Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -839,13 +839,23 @@ } static void +dump_address(StoreEntry * entry, const char *name, IPAddress &addr) +{ + char buf[MAX_IPSTRLEN]; + storeAppendPrintf(entry, "%s %s\n", name, addr.NtoA(buf,MAX_IPSTRLEN) ); +} + +/* FIXME INET6 : drop this following function once config parsing is fully converted */ +/* exists solely to enable smooth slow transition from old to new code. */ +static void dump_address(StoreEntry * entry, const char *name, struct IN_ADDR addr) { - storeAppendPrintf(entry, "%s %s\n", name, inet_ntoa(addr)); + IPAddress tmp(addr); + dump_address(entry, name, tmp); } static void -parse_address(IPAddress &addr) +parse_address(IPAddress *addr) { char *token = strtok(NULL, w_space); @@ -854,16 +864,16 @@ if (!strcmp(token,"any_addr")) { - addr.SetAnyAddr(); + addr->SetAnyAddr(); (void) 0; } else if ( (!strcmp(token,"no_addr")) || (!strcmp(token,"full_mask")) ) { - addr.SetNoAddr(); + addr->SetNoAddr(); (void) 0; } else - addr = token; + *addr = token; } /* FIXME INET6 : drop this temporary conversion function when Config parse is converted. */ @@ -874,12 +884,20 @@ // use a temporary wrapper IPAddress for the converted code. IPAddress tmp; tmp = *addr; - parse_address(tmp); + parse_address(&tmp); // pull the resulting data back out into the unconverted struct(s) for use by unconverted code. tmp.GetInAddr(*addr); } static void +free_address(IPAddress *addr) +{ + addr->SetEmpty(); +} + +/* FIXME INET6 : drop this function once conf parsing is fully converted */ +/* exists solely to enable smooth incremental transition to IPAddress */ +static void free_address(struct IN_ADDR *addr) { memset(addr, '\0', sizeof(struct IN_ADDR)); @@ -919,7 +937,7 @@ acl_address **tail = head; /* sane name below */ CBDATA_INIT_TYPE_FREECB(acl_address, freed_acl_address); l = cbdataAlloc(acl_address); - parse_address(l->addr); + parse_address(&l->addr); aclParseAclList(LegacyParser, &l->aclList); while (*tail) Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.68.2.29 retrieving revision 1.68.2.30 diff -u -r1.68.2.29 -r1.68.2.30 --- squid3/src/client_side.cc 20 May 2007 11:07:14 -0000 1.68.2.29 +++ squid3/src/client_side.cc 29 May 2007 13:42:03 -0000 1.68.2.30 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.68.2.29 2007/05/20 11:07:14 amosjeffries Exp $ + * $Id: client_side.cc,v 1.68.2.30 2007/05/29 13:42:03 amosjeffries Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2675,8 +2675,7 @@ ConnStateData *result = new ConnStateData; result->peer = peer; result->log_addr = peer; -/* FIXME INET6 : drop temp conversion when netmask is an unsigned int */ IPAddress tmp(Config.Addrs.client_netmask); - result->log_addr.ApplyMask(tmp.GetCIDR()); + result->log_addr.ApplyMask(Config.Addrs.client_netmask.GetCIDR()); result->me = me; result->fd = fd; result->in.buf = (char *)memAllocBuf(CLIENT_REQ_BUF_SZ, &result->in.allocatedSize); Index: squid3/src/dns_internal.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/dns_internal.cc,v retrieving revision 1.15.6.20 retrieving revision 1.15.6.21 diff -u -r1.15.6.20 -r1.15.6.21 --- squid3/src/dns_internal.cc 27 May 2007 12:52:47 -0000 1.15.6.20 +++ squid3/src/dns_internal.cc 29 May 2007 13:42:03 -0000 1.15.6.21 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.cc,v 1.15.6.20 2007/05/27 12:52:47 amosjeffries Exp $ + * $Id: dns_internal.cc,v 1.15.6.21 2007/05/29 13:42:03 amosjeffries Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -706,7 +706,7 @@ IPAddress addr; - if (Config.Addrs.udp_outgoing.s_addr != no_addr.s_addr) + if (!Config.Addrs.udp_outgoing.IsNoAddr()) addr = Config.Addrs.udp_outgoing; else addr = Config.Addrs.udp_incoming; @@ -1215,7 +1215,7 @@ IPAddress addr; - if (Config.Addrs.udp_outgoing.s_addr != no_addr.s_addr) + if (!Config.Addrs.udp_outgoing.IsNoAddr()) addr = Config.Addrs.udp_outgoing; else addr = Config.Addrs.udp_incoming; Index: squid3/src/htcp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/htcp.cc,v retrieving revision 1.15.6.9 retrieving revision 1.15.6.10 diff -u -r1.15.6.9 -r1.15.6.10 --- squid3/src/htcp.cc 15 May 2007 22:30:58 -0000 1.15.6.9 +++ squid3/src/htcp.cc 29 May 2007 13:42:03 -0000 1.15.6.10 @@ -1,6 +1,6 @@ /* - * $Id: htcp.cc,v 1.15.6.9 2007/05/15 22:30:58 amosjeffries Exp $ + * $Id: htcp.cc,v 1.15.6.10 2007/05/29 13:42:03 amosjeffries Exp $ * * DEBUG: section 31 Hypertext Caching Protocol * AUTHOR: Duane Wesssels @@ -1516,7 +1516,7 @@ debugs(31, 1, "Accepting HTCP messages on port " << Config.Port.htcp << ", FD " << htcpInSocket << "."); - if (Config.Addrs.udp_outgoing.s_addr != no_addr.s_addr) { + if (!Config.Addrs.udp_outgoing.IsNoAddr()) { enter_suid(); htcpOutSocket = comm_open(SOCK_DGRAM, IPPROTO_UDP, Index: squid3/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/structs.h,v retrieving revision 1.66.2.19 retrieving revision 1.66.2.20 diff -u -r1.66.2.19 -r1.66.2.20 --- squid3/src/structs.h 27 May 2007 13:18:10 -0000 1.66.2.19 +++ squid3/src/structs.h 29 May 2007 13:42:03 -0000 1.66.2.20 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.66.2.19 2007/05/27 13:18:10 amosjeffries Exp $ + * $Id: structs.h,v 1.66.2.20 2007/05/29 13:42:03 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -429,17 +429,17 @@ struct { - struct IN_ADDR udp_incoming; + IPAddress udp_incoming; - struct IN_ADDR udp_outgoing; + IPAddress udp_outgoing; #if SQUID_SNMP struct IN_ADDR snmp_incoming; struct IN_ADDR snmp_outgoing; #endif - - struct IN_ADDR client_netmask; + /* INET6 : this should really be a CIDR value */ + IPAddress client_netmask; } Addrs;