On 6/7/07, Colm MacCarthaigh <[EMAIL PROTECTED]> wrote:
On Thu, Jun 07, 2007 at 02:06:49AM +0300, Lucian Adrian Grijincu wrote:
> <snip from=man getaddrinfo(3)>
> If hints.ai_flags contains the
> AI_NUMERICHOST flag then the node parameter must be a numerical
> network
> address. The AI_NUMERICHOST flag suppresses any potentially
> lengthy
> network host address lookups.
> </snip>
>
> how does this work with string names like "localhost" too?
Eh, it doesn't, that's why it's got the word numeric in there ;-) But if
people want to translate literal IP addresses into addrinfo structures
regardless of connectivity - that's how to do it.
> As I understand the APR interface that's misbehaving now needs to
> support hostnames besides IPs represented as strings.
Very much so, that's the majority use-case by a long long way, it works
fine btw!
> Suppose that a this string is read from the commandline as a
> parameter. The app coder cannot pass this new APR_NUMERIC_ADDRESS
> flag, because he doesn't know if the string he received is a name for
> a link-local IP.
Firstly: I'm not sure what your point here is :-) That wouldn't be the
use-case.
You said (or so I understood) that APR should add a new flag
(APR_NUMERIC_ADDRESS) to it's API. When a programmer wants to use
"::1" in a call to apr_sockaddr_info_get, they should pass in this
flag as well, to be sure that the call succeeds on Ubuntu 7.04 32bit
too.
What would that programmer do if it had to pass a hostname to
apr_sockaddr_info_get and that name would point to "::1".
More verbose:
I added this to my /etc/hosts "::1 my_name_lo"
and modified the testsocket.c file that failed replacing "::1" with
"my_name_lo".
The test failed (on Ubuntu 7.04, see here:
https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/24828 some
explanation for this behaviour on this platform.)
What good would APR_NUMERIC_ADDRESS do in this case?
Or maybe I haven't understood what you were proposing ...
--
Lucian Adrian Grijincu
Secondly: It's incredibly trivial to tell if a string is a literal IP
address or not, they are programatically distinguishable from hostnames
with extreme ease. But it'd be a bad idea to do that, still not the
use-case!
--
Colm MacCárthaigh Public Key: [EMAIL PROTECTED]