* find first satisfactory answer
*/
hp = (HEADER *) answer;
- ancount = ntohs(hp->dh_ancount);
- qdcount = ntohs(hp->dh_qdcount);
- nscount = ntohs(hp->dh_nscount);
- arcount = ntohs(hp->dh_arcount);
+ ancount = ntohs(hp->ancount);
+ qdcount = ntohs(hp->qdcount);
+ nscount = ntohs(hp->nscount);
+ arcount = ntohs(hp->arcount);
if (_res.options & RES_DEBUG || (verbose && isls == 0))
printf("rcode = %d (%s), ancount=%d\n",
hp->rcode,
}
cp = answer.qb2 + sizeof(HEADER);
- if (ntohs(answer.qb1.dh_qdcount) > 0)
+ if (ntohs(answer.qb1.qdcount) > 0)
cp += dn_skipname(cp, answer.qb2 + msglen) + QFIXEDSZ;
numns = 0;
i = buf.qb1.rcode;
- if (i != NOERROR || ntohs(buf.qb1.dh_ancount) == 0) {
+ if (i != NOERROR || ntohs(buf.qb1.ancount) == 0) {
if ((thisns+1) < numnsaddr &&
(i == SERVFAIL || i == NOTIMP || i == REFUSED)) {
if (_res.options & RES_DEBUG || verbose)
}
numAnswers++;
cp = buf.qb2 + sizeof(HEADER);
- if (ntohs(buf.qb1.dh_qdcount) > 0)
+ if (ntohs(buf.qb1.qdcount) > 0)
cp += dn_skipname(cp, buf.qb2 + len) + QFIXEDSZ;
nmp = cp;
fprintf(stderr,
" result: %s, answers = %d, authority = %d, additional = %d\n",
resultcodes[headerPtr->rcode],
- ntohs(headerPtr->dh_ancount),
- ntohs(headerPtr->dh_nscount),
- ntohs(headerPtr->dh_arcount));
+ ntohs(headerPtr->ancount),
+ ntohs(headerPtr->nscount),
+ ntohs(headerPtr->arcount));
return(ERROR);
default:
return(ERROR);
if (dp->hdr.cd) printf(" CD");
fputc('\n', stdout);
- count[0]= ntohs(dp->hdr.dh_qdcount);
- count[1]= ntohs(dp->hdr.dh_ancount);
- count[2]= ntohs(dp->hdr.dh_nscount);
- count[3]= ntohs(dp->hdr.dh_arcount);
+ count[0]= ntohs(dp->hdr.qdcount);
+ count[1]= ntohs(dp->hdr.ancount);
+ count[2]= ntohs(dp->hdr.nscount);
+ count[3]= ntohs(dp->hdr.arcount);
cp = dp->data;
for (i= 0; i < 4; i++) {
while (count[i] > 0) {
if (size < sizeof(HEADER)) return 0;
rcode= dp->hdr.rcode;
- count[0]= ntohs(dp->hdr.dh_qdcount);
- count[1]= ntohs(dp->hdr.dh_ancount);
- count[2]= ntohs(dp->hdr.dh_nscount);
- count[3]= ntohs(dp->hdr.dh_arcount);
+ count[0]= ntohs(dp->hdr.qdcount);
+ count[1]= ntohs(dp->hdr.ancount);
+ count[2]= ntohs(dp->hdr.nscount);
+ count[3]= ntohs(dp->hdr.arcount);
cp = dp->data;
for (i= 0; i < 4 && cp < dlim; i++) {
while (count[i] > 0) {
dns.hdr.ad = 0;
dns.hdr.cd = 0;
dns.hdr.rcode = 0;
- dns.hdr.dh_qdcount= HTONS(1);
+ dns.hdr.qdcount= HTONS(1);
ancount= 0;
- dns.hdr.dh_nscount= HTONS(0);
- dns.hdr.dh_arcount= HTONS(0);
+ dns.hdr.nscount= HTONS(0);
+ dns.hdr.arcount= HTONS(0);
dnvec[0]= dns2oct(&dns);
dnvec[1]= nil;
if (r == -1 || ancount == 0) return 0;
- dns.hdr.dh_ancount= htons(ancount);
+ dns.hdr.ancount= htons(ancount);
memcpy(dp, &dns, *pdlen= cp - dns2oct(&dns));
return 1;
}
dns.hdr.ad = 0;
dns.hdr.cd = 0;
dns.hdr.rcode = 0;
- dns.hdr.dh_qdcount= HTONS(1);
- dns.hdr.dh_ancount= HTONS(1);
- dns.hdr.dh_nscount= HTONS(0);
- dns.hdr.dh_arcount= htons(n_nameds);
+ dns.hdr.qdcount= HTONS(1);
+ dns.hdr.ancount= HTONS(1);
+ dns.hdr.nscount= HTONS(0);
+ dns.hdr.arcount= htons(n_nameds);
dnvec[0]= dns2oct(&dns);
dnvec[1]= nil;
u32_t minttl;
if ((dp->hdr.rd && !dp->hdr.tc)) return;
- if (dp->hdr.dh_qdcount != HTONS(1)) return;
+ if (dp->hdr.qdcount != HTONS(1)) return;
cp= dp->data;
r= dn_expand(dns2oct(dp), dns2oct(dp) + dlen, cp, name, MAXDNAME);
if (r == -1) return;
}
/* Remember ID and RD. */
- id= dp->hdr.dh_id;
+ id= dp->hdr.id;
rd= dp->hdr.rd;
if (r == -1) {
}
/* Copy ID and RD back to answer. */
- dp->hdr.dh_id= id;
+ dp->hdr.id= id;
dp->hdr.rd = rd;
*pdlen= dlen;
return 1;
cp += sizeof(u16_t);
dlen= cp - dns2oct(&udp.dns);
- udp.dns.hdr.dh_id= new_id(ID_REFRESH, my_port, ID_IPSELF);
+ udp.dns.hdr.id= new_id(ID_REFRESH, my_port, ID_IPSELF);
udp.dns.hdr.qr = 0;
udp.dns.hdr.opcode = 0;
udp.dns.hdr.aa = 0;
udp.dns.hdr.ad = 0;
udp.dns.hdr.cd = 0;
udp.dns.hdr.rcode = 0;
- udp.dns.hdr.dh_qdcount= HTONS(1);
- udp.dns.hdr.dh_ancount= HTONS(0);
- udp.dns.hdr.dh_nscount= HTONS(0);
- udp.dns.hdr.dh_arcount= HTONS(0);
+ udp.dns.hdr.qdcount= HTONS(1);
+ udp.dns.hdr.ancount= HTONS(0);
+ udp.dns.hdr.nscount= HTONS(0);
+ udp.dns.hdr.arcount= HTONS(0);
udp.hdr.uih_dst_addr= current_named();
udp.hdr.uih_dst_port= named_port;
/* This is a remote named reply, not a query. */
/* Response to a query previously relayed? */
- if (!old_id(udp.dns.hdr.dh_id, &id, &port, &ip)) return 1;
+ if (!old_id(udp.dns.hdr.id, &id, &port, &ip)) return 1;
if (ip == ID_IPSELF && id == ID_PROBE) {
if (searching()) {
if (ip == ID_IPSELF) return 1;
/* Send the reply to the process that asked for it. */
- udp.dns.hdr.dh_id= id;
+ udp.dns.hdr.id= id;
udp.hdr.uih_dst_addr= ip;
udp.hdr.uih_dst_port= port;
if (debug >= 1) printf("To client %s:%u\n", inet_ntoa(ip), ntohs(port));
} else {
/* A query. */
- if (udp.dns.hdr.dh_qdcount != HTONS(1)) return 1;
+ if (udp.dns.hdr.qdcount != HTONS(1)) return 1;
if(localonly) {
/* Check if it's a local query. */
}
} else {
/* Let a real name daemon handle the query. */
- udp.dns.hdr.dh_id= new_id(udp.dns.hdr.dh_id,
+ udp.dns.hdr.id= new_id(udp.dns.hdr.id,
udp.hdr.uih_src_port, udp.hdr.uih_src_addr);
udp.hdr.uih_dst_addr= current_named();
udp.hdr.uih_dst_port= named_port;
/* Send a simple DNS query that all name servers can answer easily:
* "What are the name servers for the root domain?"
*/
- udp.dns.hdr.dh_id= new_id(ID_PROBE, my_port, ID_IPSELF);
+ udp.dns.hdr.id= new_id(ID_PROBE, my_port, ID_IPSELF);
udp.dns.hdr.qr = 0;
udp.dns.hdr.opcode = 0;
udp.dns.hdr.aa = 0;
udp.dns.hdr.ad = 0;
udp.dns.hdr.cd = 0;
udp.dns.hdr.rcode = 0;
- udp.dns.hdr.dh_qdcount= HTONS(1);
- udp.dns.hdr.dh_ancount= HTONS(0);
- udp.dns.hdr.dh_nscount= HTONS(0);
- udp.dns.hdr.dh_arcount= HTONS(0);
+ udp.dns.hdr.qdcount= HTONS(1);
+ udp.dns.hdr.ancount= HTONS(0);
+ udp.dns.hdr.nscount= HTONS(0);
+ udp.dns.hdr.arcount= HTONS(0);
udp.dns.data[0] = 0; /* Null name. */
pack16(udp.dns.data+1, HTONS(T_NS));