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

Re: Minor feature additions


Chris Backas a écrit :


Hmm, I think we don't have to add a function but rather understand why
it tries to make a DNS lookup even when we give out an IP address.
Almost no highlevel framework adds an option to hint the resolver that
we gave a numeric IP, I think it should not be exported to the public
functions.
I'm going to see what we do wrong, in worst case, doing a regexplike
search on [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ is not that hard. (a bit harder
for ipv6).

In my own modification I did exactly that, had it detect when the host name 'looks like' an IP address, and then set the flag. getaddrinfo(), at least on Mac OS X (where I'm using this) isn't clear about its resolution behavior. It says in the man page:

"An acceptable value for nodename is either a valid host name or a numeric host address string consisting of a dotted decimal IPv4 address or an IPv6 address."

But that doesn't say how it treats them. Experimentally its seems to be "assume this is a host name, and if that fails then try it as a numeric address". The AI_NUMERICHOST flag says:

"AI_NUMERICHOST If the AI_NUMERICHOST bit is set, it indicates that nodename should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted."

My reading of that is that the flag wouldn't need to exist if getaddrinfo() itself made any attempt to realize that the supplied value is not a host name.


Hello Chris,

I have implemented the change as we discussed, by a regular expression matching in the connect code. look commit 052073c36d33089d3a99992840c88c6245461813.

I used extended posix regular expressions which I think are very standard. Gladiac, do we need a particular cmake fix for conditionnal compilation ?

Thanks,

Aris

Follow-Ups:
Re: Minor feature additionsChris Backas <chb@xxxxxxxxxxxxxxxxxx>
Re: Minor feature additionsNorbert Kiesel <nkiesel@xxxxxxxxxxxxxxx>
References:
Minor feature additionsChris Backas <chb@xxxxxxxxxxxxxxxxxx>
Re: Minor feature additionsAndreas Schneider <mail@xxxxxxxxxxxx>
Re: Minor feature additionsAris Adamantiadis <aris@xxxxxxxxxxxx>
Re: Minor feature additionsChris Backas <chb@xxxxxxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org