--------------------- PatchSet 4704 Date: 2007/06/10 06:56:14 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: A better bypass for the netdb IPv4 transfer problem. Members: src/net_db.cc:1.13.4.20->1.13.4.21 Index: squid3/src/net_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/net_db.cc,v retrieving revision 1.13.4.20 retrieving revision 1.13.4.21 diff -u -r1.13.4.20 -r1.13.4.21 --- squid3/src/net_db.cc 8 Jun 2007 16:09:37 -0000 1.13.4.20 +++ squid3/src/net_db.cc 10 Jun 2007 06:56:14 -0000 1.13.4.21 @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.13.4.20 2007/06/08 16:09:37 amosjeffries Exp $ + * $Id: net_db.cc,v 1.13.4.21 2007/06/10 06:56:14 amosjeffries Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -113,7 +113,6 @@ static wordlist *peer_names = NULL; static void - netdbHashInsert(netdbEntry * n, IPAddress &addr) { networkFromInaddr(addr).NtoA(n->network, MAX_IPSTRLEN); @@ -794,9 +793,7 @@ case NETDB_EX_NETWORK: o++; -/* FIXME INET6 : So how do we cope with sending IPv6 addresses ?? */ -/* AYJ: for now we just assume the peer can handle IPv4 addresses only. */ - addr.GetInAddr(line_addr); + /* FIXME INET6 : NetDB can still ony send IPv4 */ xmemcpy(&line_addr, p + o, sizeof(struct in_addr)); addr = line_addr; o += sizeof(struct in_addr); @@ -1169,7 +1166,6 @@ } void - netdbExchangeUpdatePeer(IPAddress &addr, peer * e, double rtt, double hops) { #if USE_ICMP @@ -1179,6 +1175,11 @@ std::setfill('0')<< std::setprecision(2) << hops << " hops, " << rtt << " rtt"); + if( !addr.IsIPv4() ) { + debugs(38, 5, "netdbExchangeUpdatePeer: Aborting peer update for '" << addr << "', NetDB cannt handle IPv6."); + return; + } + n = netdbLookupAddr(addr); if (n == NULL) @@ -1243,7 +1244,7 @@ reply->setHeaders(version, HTTP_OK, "OK", NULL, -1, squid_curtime, -2); s->replaceHttpReply(reply); rec_sz = 0; - rec_sz += 1 + sizeof(addr); + rec_sz += 1 + sizeof(struct in_addr); rec_sz += 1 + sizeof(int); rec_sz += 1 + sizeof(int); buf = (char *)memAllocate(MEM_4K_BUF); @@ -1260,10 +1261,12 @@ if (! (addr = n->network) ) continue; + /* FIXME INET6 : NetDB cannot yet handle IPv6 addresses. Ensure only IPv4 get sent. */ + if( !addr.IsIPv4() ) + continue; + buf[i++] = (char) NETDB_EX_NETWORK; -/* FIXME INET6 : So how do we cope with sending IPv6 addresses ?? */ -/* AYJ: for now we just assume the peer can handle IPv4 addresses only. */ addr.GetInAddr(line_addr); xmemcpy(&buf[i], &line_addr, sizeof(struct in_addr));