aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libc/net/name6.c
diff options
context:
space:
mode:
authorYoshinobu Inoue <shin@FreeBSD.org>2000-02-10 02:59:50 +0000
committerYoshinobu Inoue <shin@FreeBSD.org>2000-02-10 02:59:50 +0000
commitbe26adb5b690b8691f393af3c3823e7f8763ea21 (patch)
treed687e668fda830028739d49e2bc4157ad21d56db /lib/libc/net/name6.c
parent1344c9bdf6e874da9fa9a04c91230d817797351a (diff)
downloadsrc-be26adb5b690b8691f393af3c3823e7f8763ea21.tar.gz
src-be26adb5b690b8691f393af3c3823e7f8763ea21.zip
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
Notes
Notes: svn path=/head/; revision=57107
Diffstat (limited to 'lib/libc/net/name6.c')
-rw-r--r--lib/libc/net/name6.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c
index 3f39d0302dca..31bc26127366 100644
--- a/lib/libc/net/name6.c
+++ b/lib/libc/net/name6.c
@@ -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;