tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: getaddrinfo(3) on numerical addresses
> That's what AI_NUMERICHOST is for?
No (or so I think).
I would like to save the resolver lookup if we know beforehand we don't need it.
> It's not clear whether it should or should not parse the behavior
I can't parse that sentence.
What's wrong with the following argument?
1a. domain name componentss consist of letters, digits and hyphens
1b. purely numeric components may be allowed, but are crazy
2. syntactically correct numerical IPv6 addresses contain at least one colon
3. syntactically correct numerical IPv4 addresses contain digits and dots
4. So a numeric IPv4 address can't be a a numeric IPv6 address, and vice
versa, and neither of them can be a FQDN.
First, try to inet_pton(AF_INET) (or equivalent) the argument. If that succeeds
-- with an AF_INET6 hint, fail
-- with an AF_INET hint or no hint, return the result
Next, try to inet_pton(AF_INET6) the argument. If that succeeds
-- with an AF_INET hint, fail
-- with an AF_INET6 hint or no hint, return the result
If both inet_pton()s fail, continue as normal.
Home |
Main Index |
Thread Index |
Old Index