summaryrefslogtreecommitdiff
path: root/ucspi-tcp-0.88/dns_name.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-30 14:34:05 -0700
committerJohn Denker <jsd@av8n.com>2012-07-30 14:34:05 -0700
commit7024dc330299921af649330c45b99c21c3d7f022 (patch)
tree9f747a0423647b016376fe353ceea197a5848cbf /ucspi-tcp-0.88/dns_name.c
parentce0dbe5332d4eb921c09cc48cc52634211d7089a (diff)
parentf8be4baf5a2318363b42f8883f66ed8a976dfc79 (diff)
Merge branch 'master' of ephedra:usr/src/qmail into e_master
Conflicts: tools/makefile
Diffstat (limited to 'ucspi-tcp-0.88/dns_name.c')
-rw-r--r--ucspi-tcp-0.88/dns_name.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/ucspi-tcp-0.88/dns_name.c b/ucspi-tcp-0.88/dns_name.c
index dcb10c7..1f03186 100644
--- a/ucspi-tcp-0.88/dns_name.c
+++ b/ucspi-tcp-0.88/dns_name.c
@@ -2,10 +2,11 @@
#include "uint16.h"
#include "byte.h"
#include "dns.h"
+#include "ip6.h"
static char *q = 0;
-int dns_name_packet(stralloc *out,char *buf,unsigned int len)
+int dns_name_packet(stralloc *out,const char *buf,unsigned int len)
{
unsigned int pos;
char header[12];
@@ -35,7 +36,7 @@ int dns_name_packet(stralloc *out,char *buf,unsigned int len)
return 0;
}
-int dns_name4(stralloc *out,char ip[4])
+int dns_name4(stralloc *out,const char ip[4])
{
char name[DNS_NAME4_DOMAIN];
@@ -46,3 +47,17 @@ int dns_name4(stralloc *out,char ip[4])
dns_domain_free(&q);
return 0;
}
+
+int dns_name6(stralloc *out,char ip[16])
+{
+ char name[DNS_NAME6_DOMAIN];
+
+ if (ip6_isv4mapped(ip))
+ return dns_name4(out,ip+12);
+ dns_name6_domain(name,ip);
+ 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;
+}