|
|
|
@ -48,16 +48,23 @@ int dns_name4(stralloc *out,const char ip[4])
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int dns_name6(stralloc *out,char ip[16])
|
|
|
|
|
static int dns_name6_inner(stralloc *out,const char ip[16],int t)
|
|
|
|
|
{
|
|
|
|
|
char name[DNS_NAME6_DOMAIN];
|
|
|
|
|
|
|
|
|
|
if (ip6_isv4mapped(ip))
|
|
|
|
|
return dns_name4(out,ip+12);
|
|
|
|
|
dns_name6_domain(name,ip);
|
|
|
|
|
dns_name6_domain(name,ip,t);
|
|
|
|
|
if (dns_resolve(name,DNS_T_PTR) == -1) return -1;
|
|
|
|
|
if (dns_name_packet(out,dns_resolve_tx.packet,dns_resolve_tx.packetlen) == -1) return -1;
|
|
|
|
|
dns_transmit_free(&dns_resolve_tx);
|
|
|
|
|
dns_domain_free(&q);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int dns_name6(stralloc *out,const char ip[16])
|
|
|
|
|
{
|
|
|
|
|
if (ip6_isv4mapped(ip))
|
|
|
|
|
return dns_name4(out,ip+12);
|
|
|
|
|
if (dns_name6_inner(out,ip,DNS_IP6_ARPA)) return -1;
|
|
|
|
|
if (!out->len) return dns_name6_inner(out,ip,DNS_IP6_INT);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|