[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Minor feature additions
[Thread Prev] | [Thread Next]
- Subject: Re: Minor feature additions
- From: Chris Backas <chb@xxxxxxxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Tue, 14 Jul 2009 10:24:53 -0400
- To: libssh@xxxxxxxxxx
Chris Backas a écrit :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.Hmm, I think we don't have to add a function but rather understand whyit 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 publicfunctions. I'm going to see what we do wrong, in worst case, doing a regexplikesearch on [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ is not that hard. (a bit harderfor ipv6).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
Hi Aris,I looked over this change, and "kicked the tires" a little. Looks good, and seems to work fine. Just wondering about IPv6 addresses though. My own approach didn't handle these either, and the worst that happens is that the delay occurs on an IPv6 host since it's not recognized as an IP Address. So, no big deal, but perhaps the comments should reference it. Just a thought.
Chris Backas
Minor feature additions | Chris Backas <chb@xxxxxxxxxxxxxxxxxx> |
Re: Minor feature additions | Andreas Schneider <mail@xxxxxxxxxxxx> |
Re: Minor feature additions | Aris Adamantiadis <aris@xxxxxxxxxxxx> |
Re: Minor feature additions | Chris Backas <chb@xxxxxxxxxxxxxxxxxx> |
Re: Minor feature additions | Aris Adamantiadis <aris@xxxxxxxxxxxx> |