Subject: Re: [Patch] localhost

Re: [Patch] localhost

From: Peter Pentchev <roam_at_ringlet.net>
Date: Sat, 19 Mar 2011 14:51:17 +0200

On Mon, Feb 28, 2011 at 06:32:24PM +0200, Peter Pentchev wrote:
> On Mon, Feb 28, 2011 at 08:11:30AM -0800, Greg Christopher wrote:
> > Hi folks-
> > I've been watching the patches come in and am not sure but don't think I saw
> > the fix for localhost. Is that eminent?
>
> My "tomorrow" seems to be taking a while to arrive, sorry. Yes, I know
> I need to do that; yes, I will, just haven't gotten around to it yet :/

Okay then, here's an initial version of a patch - actually, two patches -
that make ares_gethostbyname() use Windows's GetUnicastIpAddressTable()
function to:
- return all loopback addresses of the specified family if "localhost" is
  supplied as an argument
- return all addresses registered on this computer if "" is supplied as
  an argument

As noted in the comments, the Windows getaddrinfo() function has
another special case - if the name of the local computer is passed, it
returns all addresses that one can bind to, determined by a flag in the
GetUnicast...() function's result. If this is desirable, I could extend
these patches to do it, too.

More information about the Windows getaddrinfo() function:
http://msdn.microsoft.com/en-us/library/ms738520(v=vs.85).aspx

Of course, if Daniel decides that this is not the correct way to go
about it at all (e.g. fix ares_query() instead of ares_gethostbyname()),
I'll try and rework the patches following his guidance :) And certainly
the ARES_WIN32_LOCALHOST_TESTING code and ifdefs may be removed at
leisure.

Thanks a lot to Greg for the patience and to Daniel and everyone else
for making c-ares the great library that it is!

G'luck,
Peter

-- 
Peter Pentchev	roam_at_ringlet.net roam_at_FreeBSD.org peter_at_packetscale.com
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
This sentence was in the past tense.


Received on 2011-03-19