Let getaddrinfo() and related functions supports traditional IPv4 format
(shortend format, etc) Current KAME getaddrinfo() supports only d.d.d.d format IPv4 addr. But traditionally inet_aton() and etc support other formats. (shortend format and octal/deciaml/hex format) Aboud this, -As far as the discussion on freebsd-current, many people think traditional format should also be supported by getaddrinfo(). -X/Open spec requires getaddrinfo() also support those traditional IPv4 format. -RFC2553 say nothing about it. -As the result of confirmation in ietf/ipng list, there is no clear concensus yet, and the reply was, "RFC2553 update and X/Open spec will be in sync" So takeing these conditions into account, I think getaddrinfo() should also support traditional IPv4 format. Specified by: Marc Schneiders <marc@oldserver.demon.nl> Approved by: jkh
This commit is contained in:
parent
1344c9bdf6
commit
be26adb5b6
@ -635,7 +635,9 @@ explore_numeric(pai, hostname, servname, res)
|
||||
return 0;
|
||||
flags = pai->ai_flags;
|
||||
|
||||
if (inet_pton(afd->a_af, hostname, pton) == 1) {
|
||||
if ((afd->a_af == AF_INET
|
||||
? inet_aton(hostname, (struct in_addr *)pton)
|
||||
: inet_pton(afd->a_af, hostname, pton)) == 1) {
|
||||
if (pai->ai_family == afd->a_af ||
|
||||
pai->ai_family == PF_UNSPEC /*?*/) {
|
||||
GET_AI(cur->ai_next, afd, pton);
|
||||
|
@ -296,7 +296,7 @@ getipnodebyname(const char *name, int af, int flags, int *errp)
|
||||
return _hpaddr(af, name, &addrbuf, errp);
|
||||
}
|
||||
#endif
|
||||
if (inet_pton(AF_INET, name, &addrbuf) == 1) {
|
||||
if (inet_aton(name, (struct in_addr *)&addrbuf) == 1) {
|
||||
if (af != AF_INET) {
|
||||
if (MAPADDRENABLED(flags)) {
|
||||
MAPADDR(&addrbuf, &addrbuf.in_addr);
|
||||
@ -759,7 +759,9 @@ _files_ghbyname(const char *name, int af, int *errp)
|
||||
}
|
||||
if (!match)
|
||||
continue;
|
||||
if (inet_pton(af, addrstr, &addrbuf) != 1) {
|
||||
if ((af == AF_INET
|
||||
? inet_aton(addrstr, (struct in_addr *)&addrbuf)
|
||||
: inet_pton(af, addrstr, &addrbuf)) != 1) {
|
||||
*errp = NO_DATA; /* name found */
|
||||
continue;
|
||||
}
|
||||
@ -796,7 +798,9 @@ _files_ghbyaddr(const void *addr, int addrlen, int af, int *errp)
|
||||
while (fgets(buf, sizeof(buf), fp)) {
|
||||
line = buf;
|
||||
if ((p = _hgetword(&line)) == NULL
|
||||
|| inet_pton(af, p, &addrbuf) != 1
|
||||
|| (af == AF_INET
|
||||
? inet_aton(p, (struct in_addr *)&addrbuf)
|
||||
: inet_pton(af, p, &addrbuf)) != 1
|
||||
|| memcmp(addr, &addrbuf, addrlen) != 0
|
||||
|| (p = _hgetword(&line)) == NULL)
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user