diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-07-29 10:15:31 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-07-29 10:15:31 +0000 |
commit | 980731f68574e02d9d3952d76805b1ada65d7085 (patch) | |
tree | 55e8416a54dd01deb947e3fc7206bd9e7ad61746 | |
parent | d86b92f399c4a5ed9f0629316277db8495527e2d (diff) |
query ip6.arpa then ip6.int for IPv6 reverse lookup. follows RFC3152.
(need some string-manipulation cleanup near here)
-rw-r--r-- | lib/libc/net/gethostnamadr.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c index f1aa4486706..dae31eaedbf 100644 --- a/lib/libc/net/gethostnamadr.c +++ b/lib/libc/net/gethostnamadr.c @@ -52,7 +52,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.49 2002/07/25 21:13:45 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.50 2002/07/29 10:15:30 itojun Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -713,7 +713,6 @@ gethostbyaddr(addr, len, af) qp += sprintf(qp, "%x.%x.", uaddr[n] & 0xf, (uaddr[n] >> 4) & 0xf); } - strcpy(qp, "ip6.int"); break; } @@ -732,8 +731,15 @@ gethostbyaddr(addr, len, af) break; #endif case 'b': + if (af == AF_INET6) + strcpy(qp, "ip6.arpa"); n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf); + if (n < 0 && af == AF_INET6) { + strcpy(qp, "ip6.int"); + n = res_query(qbuf, C_IN, T_PTR, + (u_char *)buf.buf, sizeof buf.buf); + } if (n < 0) { #ifdef DEBUG if (_res.options & RES_DEBUG) |