summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/name6.c
diff options
context:
space:
mode:
authorshin <shin@FreeBSD.org>2000-02-10 02:59:50 +0000
committershin <shin@FreeBSD.org>2000-02-10 02:59:50 +0000
commitbf70ca5c10ab771d51b44fdada006c5ec5515f04 (patch)
treedfda42e673026bffc09df760606ced9dab4a35e1 /lib/libc/net/name6.c
parent71b17017a34cc8a1346d155debf51f6b57522d11 (diff)
downloadFreeBSD-src-bf70ca5c10ab771d51b44fdada006c5ec5515f04.zip
FreeBSD-src-bf70ca5c10ab771d51b44fdada006c5ec5515f04.tar.gz
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
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 3f39d03..31bc261 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;
OpenPOWER on IntegriCloud