[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Request for review: NSHost patch

From: Jeremy Tregunna
Subject: Re: Request for review: NSHost patch
Date: Fri, 17 Sep 2004 14:09:46 -0400
User-agent: Mutt/

On Fri, Sep 17, 2004 at 04:21:30PM +0100, Pete French wrote:
> I will try your patch when I get a working IP6 system back up though.
> Looking forward to it...

One need not have a working IP6 system to test this patch. For example, in the
attached test app (which I should have included with the patch, demonstrating
it, but better late than never), you can see that it gets the addresses be
them v4 or v6, and displays them. (This was tested on the system I wrote the
patch on, but with my IPv6 tunnel down.)

I did notice one problem with my patch, and writing the patch like I did.
When you use the attached example application, for example, if when calling
+[NSHost hostWithName:@"localhost"] (localhost on my system has two addresses,, and ::1 so it's an ideal candidate for this purpose); I find that
NSHost does exactly what its supposed too: Converts the string to an address,
calls the private _entryForAddress: method, and in that method, it checks if
a colon is found in the specified address string. If it finds an IPv6 address,
it sets a boolean value, and then later on checks for that value if it finds
it, sets up a v6 protocol dependant datastructure by calling inet_pton(), else
we call v4 functions. Obviously, since v6 addresses are checked first by the
system, it finds my ::1 entry for localhost, and skips over This
will not be good for obvious reasons (most machines support ipv6 but have no

As a result, I should probably retract this patch from review, and rewrite it,
in a more protocol independant manner. I'm not satisfied with it, so I think
I'll do that.

My appologies, I will follow up with this thread, supplying a protocol
independant patch that will fix this problem, and possibly others that have not
been discovered yet.

-Jeremy Tregunna

Attachment: test.m
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]