--------------------- PatchSet 4675 Date: 2007/05/31 10:39:07 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Fix DNS send to IPv6 DNS Servers. Squid now speaks fluent DNS on IPv6. Members: NOTES-IPv6:1.1.2.27->1.1.2.28 lib/IPAddress.cc:1.1.2.42->1.1.2.43 src/comm.cc:1.47.2.31->1.47.2.32 Index: squid3/NOTES-IPv6 =================================================================== RCS file: /cvsroot/squid-sf//squid3/Attic/NOTES-IPv6,v retrieving revision 1.1.2.27 retrieving revision 1.1.2.28 diff -u -r1.1.2.27 -r1.1.2.28 --- squid3/NOTES-IPv6 30 May 2007 11:48:25 -0000 1.1.2.27 +++ squid3/NOTES-IPv6 31 May 2007 10:39:07 -0000 1.1.2.28 @@ -1,4 +1,4 @@ -$Id: NOTES-IPv6,v 1.1.2.27 2007/05/30 11:48:25 amosjeffries Exp $ +$Id: NOTES-IPv6,v 1.1.2.28 2007/05/31 10:39:07 amosjeffries Exp $ KNOWN BUGS: @@ -21,6 +21,10 @@ 2007/05/29 02:27:33.567| idnsSendQuery: FD 7: sendto: (97) Address family not supported by protocol 2007/05/29 02:27:33.567| idnsSendQuery: FD 7: sendto: (97) Address family not supported by protocol LOCATION: src/tools.cc:605 +ADDITIONAL: (adding dst IP:port to debug display) +2007/05/30 01:35:42.284| idnsCheckQueue: ID 0x76e7timeout +2007/05/30 01:35:42.284| comm_udp_sendto: FD 7, [2002:3cea:e96f:0:2e0:18ff:febb:b02e]:53: (97) Address family not supported by protocol +2007/05/30 01:35:42.284| comm_udp_sendto: FD 7, [2001:5c0:9388:0:2e0:18ff:febb:b02e]:53: (97) Address family not supported by protocol cache.log lines detected showing problems: Index: squid3/lib/IPAddress.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/lib/Attic/IPAddress.cc,v retrieving revision 1.1.2.42 retrieving revision 1.1.2.43 diff -u -r1.1.2.42 -r1.1.2.43 --- squid3/lib/IPAddress.cc 27 May 2007 14:22:09 -0000 1.1.2.42 +++ squid3/lib/IPAddress.cc 31 May 2007 10:39:09 -0000 1.1.2.43 @@ -1,6 +1,6 @@ /* - * $Id: IPAddress.cc,v 1.1.2.42 2007/05/27 14:22:09 amosjeffries Exp $ + * $Id: IPAddress.cc,v 1.1.2.43 2007/05/31 10:39:09 amosjeffries Exp $ * * DEBUG: section 14 IP Storage and Handling * AUTHOR: Amos Jeffries @@ -722,17 +722,17 @@ if(dst.ai_socktype == SOCK_DGRAM // implies UDP && dst.ai_protocol == 0) - dst.ai_protocol = IPPROTO_TCP; - - if( IsIPv4() ) { - dst.ai_addr = (struct sockaddr*)new sockaddr_in; - GetSockAddr(*((struct sockaddr_in*)dst.ai_addr)); - dst.ai_addrlen = sizeof(struct sockaddr_in); + dst.ai_protocol = IPPROTO_UDP; - dst.ai_family = ((struct sockaddr_in*)dst.ai_addr)->sin_family; - } + /* FIXME INET6 : for Split-Stack systems + * some way needs to be made to open two ports (one v4 and one v6) + * for each listener service. DNS needs a UDP port at the very least + * and any ports configured with ::/0.0.0.0 as listener. + * + * For now enable Dual-Stack systems by prefering an IPv6 dual-use port + */ #if USE_IPV6 - else if( IsIPv6() ) { + if( IsIPv6() ) { dst.ai_addr = (struct sockaddr*)new sockaddr_in6; GetSockAddr(*((struct sockaddr_in6*)dst.ai_addr)); dst.ai_addrlen = sizeof(struct sockaddr_in6); @@ -740,7 +740,15 @@ dst.ai_family = ((struct sockaddr_in6*)dst.ai_addr)->sin6_family; dst.ai_protocol = IPPROTO_IPV6; } + else #endif + if( IsIPv4() ) { + dst.ai_addr = (struct sockaddr*)new sockaddr_in; + GetSockAddr(*((struct sockaddr_in*)dst.ai_addr)); + dst.ai_addrlen = sizeof(struct sockaddr_in); + + dst.ai_family = ((struct sockaddr_in*)dst.ai_addr)->sin_family; + } else { assert(false); } Index: squid3/src/comm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/comm.cc,v retrieving revision 1.47.2.31 retrieving revision 1.47.2.32 diff -u -r1.47.2.31 -r1.47.2.32 --- squid3/src/comm.cc 28 May 2007 13:32:48 -0000 1.47.2.31 +++ squid3/src/comm.cc 31 May 2007 10:39:09 -0000 1.47.2.32 @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.47.2.31 2007/05/28 13:32:48 amosjeffries Exp $ + * $Id: comm.cc,v 1.47.2.32 2007/05/31 10:39:09 amosjeffries Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -887,6 +887,10 @@ AI->ai_protocol = proto; AI->ai_flags = flags; + debugs(50, 3, "comm_openex: Attempt open socket to/from : " << addr); + debugs(50, 3, "AYJ: protocol=" << AI->ai_protocol << " WANT=" << IPPROTO_TCP << " or " << IPPROTO_UDP ); + debugs(50, 3, "AYJ: protocol=" << AI->ai_socktype << " WANT=" << SOCK_STREAM); + if ((new_socket = socket( AI->ai_family, AI->ai_socktype, AI->ai_protocol)) < 0) { /* Increase the number of reserved fd's if calls to socket() @@ -1648,12 +1652,18 @@ struct addrinfo *AI = new addrinfo; to_addr.GetAddrInfo(*AI); // MUST be first! resets AI. +// Hmm, these details are never used from here on! AI->ai_protocol = IPPROTO_UDP; AI->ai_socktype = SOCK_DGRAM; PROF_start(comm_udp_sendto); statCounter.syscalls.sock.sendtos++; + debugs(50, 3, "comm_udp_sendto: Attempt open socket to/from : " << to_addr); + debugs(50, 3, "AYJ: using FD " << fd << " using Port " << comm_local_port(fd) ); + debugs(50, 3, "AYJ: protocol=" << AI->ai_protocol << " WANT=" << IPPROTO_UDP ); + debugs(50, 3, "AYJ: socktype=" << AI->ai_socktype << " WANT=" << SOCK_DGRAM); + x = sendto(fd, buf, len, 0, (struct sockaddr *)AI->ai_addr, AI->ai_addrlen); PROF_stop(comm_udp_sendto);