even less dependence on crappy arpa headers
This commit is contained in:
parent
b4d406b781
commit
a7c0bddd4e
1 changed files with 7 additions and 10 deletions
|
|
@ -150,8 +150,8 @@ doquery(char *name, char *type)
|
||||||
{
|
{
|
||||||
int n, nstype;
|
int n, nstype;
|
||||||
uchar *buf, *p;
|
uchar *buf, *p;
|
||||||
HEADER *h;
|
|
||||||
Ndbtuple *t;
|
Ndbtuple *t;
|
||||||
|
int qdcount, ancount;
|
||||||
|
|
||||||
if((nstype = name2type(type)) < 0){
|
if((nstype = name2type(type)) < 0){
|
||||||
werrstr("unknown dns type %s", type);
|
werrstr("unknown dns type %s", type);
|
||||||
|
|
@ -172,15 +172,12 @@ doquery(char *name, char *type)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
h = (HEADER*)buf;
|
qdcount = (buf[4]<<8)|buf[5];
|
||||||
h->qdcount = ntohs(h->qdcount);
|
ancount = (buf[6]<<8)|buf[7];
|
||||||
h->ancount = ntohs(h->ancount);
|
|
||||||
h->nscount = ntohs(h->nscount);
|
|
||||||
h->arcount = ntohs(h->arcount);
|
|
||||||
|
|
||||||
p = buf+sizeof(HEADER);
|
p = buf+12;
|
||||||
p = skipquestion(buf, buf+n, p, h->qdcount);
|
p = skipquestion(buf, buf+n, p, qdcount);
|
||||||
p = unpack(buf, buf+n, p, &t, h->ancount);
|
p = unpack(buf, buf+n, p, &t, ancount);
|
||||||
USED(p);
|
USED(p);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue