You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by je...@apache.org on 2003/08/25 01:09:19 UTC

cvs commit: apr configure.in CHANGES

jerenkrantz    2003/08/24 16:09:19

  Modified:    .        configure.in CHANGES
  Log:
  Re-enable IPv6 on Darwin 6.6 and beyond as it looks like getaddrinfo() now
  works with IPv4-mapped addresses.
  
  (It works here, but independent confirmation would be welcomed.)
  
  Revision  Changes    Path
  1.532     +11 -3     apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.531
  retrieving revision 1.532
  diff -u -u -r1.531 -r1.532
  --- configure.in	11 Aug 2003 17:40:38 -0000	1.531
  +++ configure.in	24 Aug 2003 23:09:19 -0000	1.532
  @@ -435,7 +435,10 @@
       *linux*)
           os_version=`uname -r | sed -e 's/\(.\)\.\(.\)\.\(.\).*/\1\2\3/'`
           ;;
  -     *)
  +    *darwin*)
  +        os_version=`uname -r | sed -e 's/\(.\)\.\(.\).*/\1\2/'`
  +        ;;
  +    *)
           os_version=OS_VERSION_IS_NOT_SET
           ;;
   esac
  @@ -1781,9 +1784,14 @@
   case $host in
     *apple-darwin*)
       # It appears that Jaguar has all the right features, but
  -    # getnameinfo() fails to find the hostname for a mapped
  +    # getnameinfo() fails to find the hostname for an IPv4mapped
       # address.
  -    broken_ipv6=1
  +    # All signs point that 6.6 (aka Mac OS 10.2.6+) is okay.
  +    if test $os_version -lt "66"; then
  +      broken_ipv6=1
  +    else
  +      broken_ipv6=0
  +    fi
       ;;
     *)
       broken_ipv6=0
  
  
  
  1.425     +3 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.424
  retrieving revision 1.425
  diff -u -u -r1.424 -r1.425
  --- CHANGES	23 Aug 2003 10:03:42 -0000	1.424
  +++ CHANGES	24 Aug 2003 23:09:19 -0000	1.425
  @@ -1,5 +1,8 @@
   Changes with APR 0.9.4
   
  +  *) Re-enable IPv6 on Darwin 6.6 (and higher) as getaddrinfo() looks to be
  +     doing the right things with IPv4-mapped addresses.  [Justin Erenkrantz]
  +
     *) Add apr_temp_dir_get() for getting the most suitable temp directory
        [CMike Pilato <cm...@collab.net>, Thom May]
   
  
  
  

Re: cvs commit: apr configure.in CHANGES

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Wed, Aug 27, 2003 at 09:13:03PM -0700, Justin Erenkrantz wrote:
> >Yeah, that looks reasonable :)  I'm still curious about what was happening
> >on Justin's system.
> 
> No clue, either.  =)  I very well may have gotten what was working mixed 
> up, sorry.

If gni_mapped worked for you then something is definitely different
anyway.

> What I do know is that host-based authorization is working AFAICT.  So, I'm 
> not sure that this particular code path is indicative of the original 
> problem we saw.  That is, I'm not sure how we'd ever execute the code path, 
> or if we are, it isn't showing signs of failure.  If it is failing, I'd 
> like a clear example of its failure.  (What we was posted last year appears 
> to be working.)

But if gni_mapped works for you this is expected :) 

> And, if there is a legitimate bug in Darwin's handling of something, we 
> should file a bug report with Apple.  Not sure whom the best person to file 
> it would be.  -- justin

It very much looks like some peoples Darwin installs have a broken
getnameinfo() and some don't. The bug could be in libc, libresolv
(if any), libsocket, lookupd or libbind (in fact there's an indentical 
old bug in libbind that caused this behaviour so if libc/lookupd use 
it that could be the trigger). 

But anyway ... in the meantime can I persuade you (or someone) to 
commit that patch anyway ? It does no harm on working systems and will 
fix the broken ones. It's a pity to not have IPv6 working on Darwin
because of a small bug with a trivial work-around :)

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net
colm@stdlib.net					  http://www.stdlib.net/

Re: cvs commit: apr configure.in CHANGES

Posted by "B. W. Fitzpatrick" <fi...@red-bean.com>.
Justin Erenkrantz <ju...@erenkrantz.com> writes:
> --On Tuesday, August 26, 2003 6:56 AM -0400 Jeff Trawick 
> <tr...@attglobal.net> wrote:
> 
> > Yeah, that looks reasonable :)  I'm still curious about what was happening
> > on Justin's system.
> 
> No clue, either.  =)  I very well may have gotten what was working mixed up, 
> sorry.
> 
> What I do know is that host-based authorization is working AFAICT.  So, I'm 
> not sure that this particular code path is indicative of the original problem
>  
> we saw.  That is, I'm not sure how we'd ever execute the code path, or if we 
> are, it isn't showing signs of failure.  If it is failing, I'd like a clear 
> example of its failure.  (What we was posted last year appears to be working.
> )
> 
> And, if there is a legitimate bug in Darwin's handling of something, we shoul
> d 
> file a bug report with Apple.  Not sure whom the best person to file it would
>  
> be.  -- justin

I'll be glad to file any Darwin bugs if you want to shoot them to me.
If you or someone else files them, please be sure to send me the Radar
number so that I can 1) add my 2 cents and 2) track it 3) possibly
harass (dis)interested parties at Apple. :-)

-Fitz

--
Brian W. Fitzpatrick    <fi...@red-bean.com>   http://www.red-bean.com/fitz/


Re: cvs commit: apr configure.in CHANGES

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Tuesday, August 26, 2003 6:56 AM -0400 Jeff Trawick 
<tr...@attglobal.net> wrote:

> Yeah, that looks reasonable :)  I'm still curious about what was happening
> on Justin's system.

No clue, either.  =)  I very well may have gotten what was working mixed up, 
sorry.

What I do know is that host-based authorization is working AFAICT.  So, I'm 
not sure that this particular code path is indicative of the original problem 
we saw.  That is, I'm not sure how we'd ever execute the code path, or if we 
are, it isn't showing signs of failure.  If it is failing, I'd like a clear 
example of its failure.  (What we was posted last year appears to be working.)

And, if there is a legitimate bug in Darwin's handling of something, we should 
file a bug report with Apple.  Not sure whom the best person to file it would 
be.  -- justin

Re: cvs commit: apr configure.in CHANGES

Posted by Jeff Trawick <tr...@attglobal.net>.
Colm MacCarthaigh wrote:

>>>-    rc = getnameinfo((struct sockaddr *)&sin6, sizeof sin6, hostbuf, 
>>>sizeof hostbuf, NULL, 0, NI_NAMEREQD);
>>>+    rc = getnameinfo((struct sockaddr *)&sin, sizeof sin, hostbuf, sizeof 
>>>hostbuf, NULL, 0, 0);
>>>    printf("look up via IPv6: %d/%s\n", rc, hostbuf);

> Hmmm, that doesnt make much sense. At the very least the different sin
> size should be making it print an IPv4 address. Did you make both
> sin6 -> sin changes on that line ?

urr, I didn't have the getnameinfo() call patched properly :(  my 
apologies :(

with the patch properly applied the second getnameinfo() call works, 
which I suppose is intended to prove that when it didn't work we had the 
right data in the right place and it failed due to system library fubar

> The one below, it fixes things for at least 3 Darwin using friends
> of mine.
> 
> Index: network_io/unix/sockaddr.c
> ===================================================================
> RCS file: /home/cvspublic/apr/network_io/unix/sockaddr.c,v
> retrieving revision 1.41
> diff -u -r1.41 sockaddr.c
> --- network_io/unix/sockaddr.c	14 Aug 2003 17:36:17 -0000	1.41
> +++ network_io/unix/sockaddr.c	14 Aug 2003 22:40:38 -0000
> @@ -634,9 +634,29 @@
>       * a numeric address string if it fails to resolve the host name;
>       * that is *not* what we want here
>       */
> +#ifdef DARWIN && APR_HAVE_IPV6
> +    /* Darwin's getnameinfo does not work for IPv4-mapped-IPv6 addresses,
> +     * the workaround is to convert the last 32 bits of the IPv6 address 
> +     * to a valid sockaddr_in structure. This is extremely hacky, avoid
> +     * re-use. */
> +    if (sockaddr->family == AF_INET6 && 
> +        IN6_IS_ADDR_V4MAPPED(&sockaddr->sa.sin6.sin6_addr)) {
> +        struct apr_sockaddr_t tmpsa;
> +
> +        tmpsa.sa.sin.sin_family = AF_INET;
> +        tmpsa.sa.sin.sin_addr.s_addr = ((uint32_t *)sockaddr->ipaddr_ptr)[3]; 
> +
> +        rc = getnameinfo((const struct sockaddr *)&tmpsa.sa, 
> +                         sizeof(struct sockaddr_in), tmphostname, 
> +                         sizeof(tmphostname), NULL, 0,
> +                         flags != 0 ? flags : NI_NAMEREQD);
> +    }
> +    else
> +#endif
>      rc = getnameinfo((const struct sockaddr *)&sockaddr->sa, sockaddr->salen,
>                       tmphostname, sizeof(tmphostname), NULL, 0,
>                       flags != 0 ? flags : NI_NAMEREQD);
> +
>      if (rc != 0) {
>          *hostname = NULL;

Yeah, that looks reasonable :)  I'm still curious about what was 
happening on Justin's system.




Re: cvs commit: apr configure.in CHANGES

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Mon, Aug 25, 2003 at 01:54:19PM -0400, Jeff Trawick wrote:
> >--- gni_mapped.c	Sat Feb 15 00:18:30 2003
> >+++ gni_mapped2.c	Mon Aug 25 17:40:15 2003
> >@@ -37,8 +37,10 @@
> >     rc = getnameinfo((struct sockaddr *)&sin, sizeof sin, hostbuf, sizeof 
> >     hostbuf, NULL, 0, 0);
> >     printf("look up via IPv4: %d/%s\n", rc, hostbuf);
> >     
> >+    sin.sin_addr.s_addr = sin6.sin6_addr.s6_addr32[3];
> 
> the presence of this line doesn't make any difference on my box
> 
> compiling with -DKERNEL picks up the s6_addr32 macro on Jaguar
> 
> >+
> >     strcpy(hostbuf, "not found");
> >-    rc = getnameinfo((struct sockaddr *)&sin6, sizeof sin6, hostbuf, 
> >sizeof hostbuf, NULL, 0, NI_NAMEREQD);
> >+    rc = getnameinfo((struct sockaddr *)&sin, sizeof sin, hostbuf, sizeof 
> >hostbuf, NULL, 0, 0);
> >     printf("look up via IPv6: %d/%s\n", rc, hostbuf);
> 
> without the NI_NAMEREQD flag, with our without the line you added 
> previously, I get
> 
> look up via IPv6: 0/::ffff:812a:1263

Hmmm, that doesnt make much sense. At the very least the different sin
size should be making it print an IPv4 address. Did you make both
sin6 -> sin changes on that line ?

> >     return 0;
> >
> >
> >Where .s6_addr32 is the appropriate member of sin6_addr on darwin,
> >for BSDs it should be:
> >
> >sin6.sin6_addr.__u6_addr.__u6_addr32[3];
> >
> >That will tell if the patch would fix thigns (which it does for my
> >friends).
> 
> which patch are we talking about?

The one below, it fixes things for at least 3 Darwin using friends
of mine.

Index: network_io/unix/sockaddr.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/unix/sockaddr.c,v
retrieving revision 1.41
diff -u -r1.41 sockaddr.c
--- network_io/unix/sockaddr.c	14 Aug 2003 17:36:17 -0000	1.41
+++ network_io/unix/sockaddr.c	14 Aug 2003 22:40:38 -0000
@@ -634,9 +634,29 @@
      * a numeric address string if it fails to resolve the host name;
      * that is *not* what we want here
      */
+#ifdef DARWIN && APR_HAVE_IPV6
+    /* Darwin's getnameinfo does not work for IPv4-mapped-IPv6 addresses,
+     * the workaround is to convert the last 32 bits of the IPv6 address 
+     * to a valid sockaddr_in structure. This is extremely hacky, avoid
+     * re-use. */
+    if (sockaddr->family == AF_INET6 && 
+        IN6_IS_ADDR_V4MAPPED(&sockaddr->sa.sin6.sin6_addr)) {
+        struct apr_sockaddr_t tmpsa;
+
+        tmpsa.sa.sin.sin_family = AF_INET;
+        tmpsa.sa.sin.sin_addr.s_addr = ((uint32_t *)sockaddr->ipaddr_ptr)[3]; 
+
+        rc = getnameinfo((const struct sockaddr *)&tmpsa.sa, 
+                         sizeof(struct sockaddr_in), tmphostname, 
+                         sizeof(tmphostname), NULL, 0,
+                         flags != 0 ? flags : NI_NAMEREQD);
+    }
+    else
+#endif
     rc = getnameinfo((const struct sockaddr *)&sockaddr->sa, sockaddr->salen,
                      tmphostname, sizeof(tmphostname), NULL, 0,
                      flags != 0 ? flags : NI_NAMEREQD);
+
     if (rc != 0) {
         *hostname = NULL;
 


-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net
colm@stdlib.net					  http://www.stdlib.net/

Re: cvs commit: apr configure.in CHANGES

Posted by Jeff Trawick <tr...@attglobal.net>.
Colm MacCarthaigh wrote:
> On Mon, Aug 25, 2003 at 12:59:42PM -0400, Jeff Trawick wrote:
> 
>>So what do you get on your system?  I must be missing some OS X fix... 
>>(But this box is running straight Jaguar with all available updates from 
>>Software Update installed.)
> 
> 
> This is what my darwin-using friends have been telling me aswell. Can
> you try:
> 
> --- gni_mapped.c	Sat Feb 15 00:18:30 2003
> +++ gni_mapped2.c	Mon Aug 25 17:40:15 2003
> @@ -37,8 +37,10 @@
>      rc = getnameinfo((struct sockaddr *)&sin, sizeof sin, hostbuf, sizeof hostbuf, NULL, 0, 0);
>      printf("look up via IPv4: %d/%s\n", rc, hostbuf);
>      
> +    sin.sin_addr.s_addr = sin6.sin6_addr.s6_addr32[3];

the presence of this line doesn't make any difference on my box

compiling with -DKERNEL picks up the s6_addr32 macro on Jaguar

> +
>      strcpy(hostbuf, "not found");
> -    rc = getnameinfo((struct sockaddr *)&sin6, sizeof sin6, hostbuf, sizeof hostbuf, NULL, 0, NI_NAMEREQD);
> +    rc = getnameinfo((struct sockaddr *)&sin, sizeof sin, hostbuf, sizeof hostbuf, NULL, 0, 0);
>      printf("look up via IPv6: %d/%s\n", rc, hostbuf);

without the NI_NAMEREQD flag, with our without the line you added 
previously, I get

look up via IPv6: 0/::ffff:812a:1263

>      
>      return 0;
> 
> 
> Where .s6_addr32 is the appropriate member of sin6_addr on darwin,
> for BSDs it should be:
> 
> sin6.sin6_addr.__u6_addr.__u6_addr32[3];
> 
> That will tell if the patch would fix thigns (which it does for my
> friends).

which patch are we talking about?


Re: cvs commit: apr configure.in CHANGES

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Mon, Aug 25, 2003 at 12:59:42PM -0400, Jeff Trawick wrote:
> So what do you get on your system?  I must be missing some OS X fix... 
> (But this box is running straight Jaguar with all available updates from 
> Software Update installed.)

This is what my darwin-using friends have been telling me aswell. Can
you try:

--- gni_mapped.c	Sat Feb 15 00:18:30 2003
+++ gni_mapped2.c	Mon Aug 25 17:40:15 2003
@@ -37,8 +37,10 @@
     rc = getnameinfo((struct sockaddr *)&sin, sizeof sin, hostbuf, sizeof hostbuf, NULL, 0, 0);
     printf("look up via IPv4: %d/%s\n", rc, hostbuf);
     
+    sin.sin_addr.s_addr = sin6.sin6_addr.s6_addr32[3];
+
     strcpy(hostbuf, "not found");
-    rc = getnameinfo((struct sockaddr *)&sin6, sizeof sin6, hostbuf, sizeof hostbuf, NULL, 0, NI_NAMEREQD);
+    rc = getnameinfo((struct sockaddr *)&sin, sizeof sin, hostbuf, sizeof hostbuf, NULL, 0, 0);
     printf("look up via IPv6: %d/%s\n", rc, hostbuf);
     
     return 0;


Where .s6_addr32 is the appropriate member of sin6_addr on darwin,
for BSDs it should be:

sin6.sin6_addr.__u6_addr.__u6_addr32[3];

That will tell if the patch would fix thigns (which it does for my
friends).

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net
colm@stdlib.net					  http://www.stdlib.net/

Re: cvs commit: apr configure.in CHANGES

Posted by Sander Temme <sc...@covalent.net>.
> So what do you get on your system?  I must be missing some OS X fix...
> (But this box is running straight Jaguar with all available updates from
> Software Update installed.)

My laptop, running straight Jaguar plus all available fixes:

[sctemme@MonaLisa] gni $ ./gni_mapped
look up via IPv4: 0/www.ibm.com
look up via IPv6: 8/not found
[sctemme@MonaLisa] gni $ uname -a
Darwin MonaLisa 6.6 Darwin Kernel Version 6.6: Thu May  1 21:48:54 PDT 2003;
root:xnu/xnu-344.34.obj~1/RELEASE_PPC  Power Macintosh powerpc

Doesn't look fixed to me...

S.

-- 
Covalent Technologies                 sctemme@covalent.net
Engineering group                    Voice: (415) 856 4214
303 Second Street #375 South           Fax: (415) 856 4210
San Francisco CA 94107

PGP FP: 7A8D B189 E871 80CB 9521  9320 C11E 7B47 964F 31D9 


Re: cvs commit: apr configure.in CHANGES

Posted by Jeff Trawick <tr...@attglobal.net>.
Justin Erenkrantz wrote:

> --On Monday, August 25, 2003 12:40:47 -0400 Jeff Trawick 
> <tr...@attglobal.net> wrote:
> 
>> IIRC getnameinfo() was the problem, not getaddrinfo().
>>
>> With 6.6 kernel (and whatever else Jaguar+latest updates gets you),
>> http://www.apache.org/~trawick/gni_mapped.c still fails for me.  (This
>> supposedly means that deny/allow from IP controls are broken.)  Can you
>> try gni_mapped on your system?
> 
> 
> I don't understand what gni_mapped is supposed to output.  I get the 
> same output on Darwin as I do on FreeBSD.

On a working system, it displays this:

look up via IPv4: 0/www.ibm.com
look up via IPv6: 0/www.ibm.com

On my Jaguar system (and on other Mac OS X systems in the past), the 
first lookup finds the hostname and the second lookup fails to find the 
hostname.

So what do you get on your system?  I must be missing some OS X fix... 
(But this box is running straight Jaguar with all available updates from 
Software Update installed.)



Re: cvs commit: apr configure.in CHANGES

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Monday, August 25, 2003 12:40:47 -0400 Jeff Trawick 
<tr...@attglobal.net> wrote:

> IIRC getnameinfo() was the problem, not getaddrinfo().
>
> With 6.6 kernel (and whatever else Jaguar+latest updates gets you),
> http://www.apache.org/~trawick/gni_mapped.c still fails for me.  (This
> supposedly means that deny/allow from IP controls are broken.)  Can you
> try gni_mapped on your system?

I don't understand what gni_mapped is supposed to output.  I get the same 
output on Darwin as I do on FreeBSD.

IIRC, the root problem was that host-based authorization didn't work.  When 
IPv6 was overriden to be enabled, host-based authorization works now on 
6.6.  AFAICT, IPv4-mapped addresses look correct.  (The httpd-test 
framework passed the tests it wasn't passing a long time ago.)

I did ask for others to confirm that it worked (as it does here), but no 
one responded, so I assumed people were happy.

As for binary compatibility, I think it just means that we should probably 
stop upgrading APR in releases of httpd-2.0.  -- justin

Re: cvs commit: apr configure.in CHANGES

Posted by Jeff Trawick <tr...@attglobal.net>.
jerenkrantz@apache.org wrote:

> jerenkrantz    2003/08/24 16:09:19
> 
>   Modified:    .        configure.in CHANGES
>   Log:
>   Re-enable IPv6 on Darwin 6.6 and beyond as it looks like getaddrinfo() now
>   works with IPv4-mapped addresses.

IIRC getnameinfo() was the problem, not getaddrinfo().

With 6.6 kernel (and whatever else Jaguar+latest updates gets you), 
http://www.apache.org/~trawick/gni_mapped.c still fails for me.  (This 
supposedly means that deny/allow from IP controls are broken.)  Can you 
try gni_mapped on your system?

Another issue is that switching IPv6 support on/off is a binary 
compatibility issue due to the layout of apr_sockaddr_info_t.  apr < 1.0 
may not care so much about that but Apache 2.0.x does.  We may need 
something in Apache 2.0.x configure.




Re: cvs commit: apr configure.in CHANGES

Posted by Jeff Trawick <tr...@attglobal.net>.
jerenkrantz@apache.org wrote:

> jerenkrantz    2003/08/24 16:09:19
> 
>   Modified:    .        configure.in CHANGES
>   Log:
>   Re-enable IPv6 on Darwin 6.6 and beyond as it looks like getaddrinfo() now
>   works with IPv4-mapped addresses.

IIRC getnameinfo() was the problem, not getaddrinfo().

With 6.6 kernel (and whatever else Jaguar+latest updates gets you), 
http://www.apache.org/~trawick/gni_mapped.c still fails for me.  (This 
supposedly means that deny/allow from IP controls are broken.)  Can you 
try gni_mapped on your system?

Another issue is that switching IPv6 support on/off is a binary 
compatibility issue due to the layout of apr_sockaddr_info_t.  apr < 1.0 
may not care so much about that but Apache 2.0.x does.  We may need 
something in Apache 2.0.x configure.