Folks, looking for feedback.
The connection rec in httpd has our apparently-ipv4 addresses stored
as the local and remote host, but we tag these as APR_INET6 addresses.
This makes it very difficult to look things up later on.
I don't think there's a problem if we look up an unspecified or IPV4
form for that address, but in the case of calling up the very same
family we recorded, INET6, shouldn't apr_sockaddr_info_get still
work with that combination???
Otherwise, our truncation of the leading ::ffff: was a pretty foolish
thing to do :(
Let me know if anyone sees issues with the patch below, otherwise I'll
backport Monday.
Bill
[EMAIL PROTECTED] wrote:
Author: wrowe
Date: Fri Dec 7 10:47:29 2007
New Revision: 602176
URL: http://svn.apache.org/viewvc?rev=602176&view=rev
Log:
Where hostname is provided in ipv4 numeric form, as we've
foolishly cooerced all of our IPV4_MAPPED_IPV6 addresses,
we'll need to accept this as a socket lookup call!
Unfortunately, we failed to resolve, for example, 127.0.0.1
for INET6 addressing, where we would resolve ::ffff:127.0.0.1
But the AI_V4MAPPED flag will let us resolve this address after
attempting to resolve the IPV6 notation.
Feedback and careful review is desired before this is applied
to branches 1.2 and 0.9. Thanks.
Modified:
apr/apr/trunk/network_io/unix/sockaddr.c
Modified: apr/apr/trunk/network_io/unix/sockaddr.c
URL:
http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/sockaddr.c?rev=602176&r1=602175&r2=602176&view=diff
==============================================================================
--- apr/apr/trunk/network_io/unix/sockaddr.c (original)
+++ apr/apr/trunk/network_io/unix/sockaddr.c Fri Dec 7 10:47:29 2007
@@ -344,6 +344,11 @@
servname = apr_itoa(p, port);
#endif /* OSF1 */
}
+#if APR_HAVE_IPV6 && defined(AI_V4MAPPED)
+ else if (family == APR_INET6) {
+ hints.ai_flags |= AI_V4MAPPED;
+ }
+#endif
error = getaddrinfo(hostname, servname, &hints, &ai_list);
#ifdef HAVE_GAI_ADDRCONFIG
if (error == EAI_BADFLAGS && family == APR_UNSPEC) {