diff options
author | ume <ume@FreeBSD.org> | 2002-10-26 19:00:14 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2002-10-26 19:00:14 +0000 |
commit | 46eab906451692bc2ec684f548a8d6594c695446 (patch) | |
tree | e627d1a4657f2979ac70e78eb0847420bf7475ce | |
parent | 65fb9af8bb369fb316152787398a9c6f9c9129d2 (diff) | |
download | FreeBSD-src-46eab906451692bc2ec684f548a8d6594c695446.zip FreeBSD-src-46eab906451692bc2ec684f548a8d6594c695446.tar.gz |
query ip6.arpa then ip6.int for IPv6 reverse lookup. follows RFC3152.
MFC after: 5 days
-rw-r--r-- | lib/libc/net/gethostbydns.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libc/net/gethostbydns.c b/lib/libc/net/gethostbydns.c index d55ea89..02cd223 100644 --- a/lib/libc/net/gethostbydns.c +++ b/lib/libc/net/gethostbydns.c @@ -674,7 +674,7 @@ _dns_gethostbyaddr(void *rval, void *cb_data, va_list ap) uaddr[n] & 0xf, (uaddr[n] >> 4) & 0xf)); } - strcpy(qp, "ip6.int"); + strlcat(qbuf, "ip6.arpa", sizeof(qbuf)); break; default: abort(); @@ -684,6 +684,12 @@ _dns_gethostbyaddr(void *rval, void *cb_data, va_list ap) return NS_NOTFOUND; } n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf->buf, sizeof buf->buf); + if (n < 0 && af == AF_INET6) { + *qp = '\0'; + strlcat(qbuf, "ip6.int", sizeof(qbuf)); + n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf->buf, + sizeof buf->buf); + } if (n < 0) { free(buf); dprintf("res_query failed (%d)\n", n); |