aboutsummaryrefslogtreecommitdiff
path: root/src/libndb
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-01-29 17:37:31 +0000
committerrsc <devnull@localhost>2006-01-29 17:37:31 +0000
commita7c0bddd4e5283139a6d9bef6012a2f8b046071b (patch)
treead808596aa1facbbee4a587cb7476537d9d6b016 /src/libndb
parentb4d406b781710c8a6983c0ac1fe99aa409fe9dc3 (diff)
downloadplan9port-a7c0bddd4e5283139a6d9bef6012a2f8b046071b.tar.gz
plan9port-a7c0bddd4e5283139a6d9bef6012a2f8b046071b.tar.bz2
plan9port-a7c0bddd4e5283139a6d9bef6012a2f8b046071b.zip
even less dependence on crappy arpa headers
Diffstat (limited to 'src/libndb')
-rw-r--r--src/libndb/sysdnsquery.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/libndb/sysdnsquery.c b/src/libndb/sysdnsquery.c
index d50a8312..8d3bf7b6 100644
--- a/src/libndb/sysdnsquery.c
+++ b/src/libndb/sysdnsquery.c
@@ -150,8 +150,8 @@ doquery(char *name, char *type)
{
int n, nstype;
uchar *buf, *p;
- HEADER *h;
Ndbtuple *t;
+ int qdcount, ancount;
if((nstype = name2type(type)) < 0){
werrstr("unknown dns type %s", type);
@@ -171,16 +171,13 @@ doquery(char *name, char *type)
werrstr("too much dns information");
return nil;
}
+
+ qdcount = (buf[4]<<8)|buf[5];
+ ancount = (buf[6]<<8)|buf[7];
- h = (HEADER*)buf;
- h->qdcount = ntohs(h->qdcount);
- h->ancount = ntohs(h->ancount);
- h->nscount = ntohs(h->nscount);
- h->arcount = ntohs(h->arcount);
-
- p = buf+sizeof(HEADER);
- p = skipquestion(buf, buf+n, p, h->qdcount);
- p = unpack(buf, buf+n, p, &t, h->ancount);
+ p = buf+12;
+ p = skipquestion(buf, buf+n, p, qdcount);
+ p = unpack(buf, buf+n, p, &t, ancount);
USED(p);
return t;
}