mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix log_dns_msg to log irrespective of minimal responses config.
This commit is contained in:
parent
8b752e359e
commit
80c2c69fa7
5 changed files with 14 additions and 9 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
|
21 August 2019: Wouter
|
||||||
|
- Fix log_dns_msg to log irrespective of minimal responses config.
|
||||||
|
|
||||||
19 August 2019: Ralph
|
19 August 2019: Ralph
|
||||||
- Document limitation of pidfile removal outside of chroot directory.
|
- Document limitation of pidfile removal outside of chroot directory.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ perf_encode(struct query_info* qi, struct reply_info* rep, uint16_t id,
|
||||||
/* encode a couple times */
|
/* encode a couple times */
|
||||||
for(i=0; i<max; i++) {
|
for(i=0; i<max; i++) {
|
||||||
ret = reply_info_encode(qi, rep, id, flags, out, timenow,
|
ret = reply_info_encode(qi, rep, id, flags, out, timenow,
|
||||||
r2, 65535, (int)(edns->bits & EDNS_DO) );
|
r2, 65535, (int)(edns->bits & EDNS_DO), 0);
|
||||||
unit_assert(ret != 0); /* udp packets should fit */
|
unit_assert(ret != 0); /* udp packets should fit */
|
||||||
attach_edns_record(out, edns);
|
attach_edns_record(out, edns);
|
||||||
regional_free_all(r2);
|
regional_free_all(r2);
|
||||||
|
|
@ -342,7 +342,7 @@ testpkt(sldns_buffer* pkt, struct alloc_cache* alloc, sldns_buffer* out,
|
||||||
} else if(!check_formerr_gone) {
|
} else if(!check_formerr_gone) {
|
||||||
const size_t lim = 512;
|
const size_t lim = 512;
|
||||||
ret = reply_info_encode(&qi, rep, id, flags, out, timenow,
|
ret = reply_info_encode(&qi, rep, id, flags, out, timenow,
|
||||||
region, 65535, (int)(edns.bits & EDNS_DO) );
|
region, 65535, (int)(edns.bits & EDNS_DO), 0);
|
||||||
unit_assert(ret != 0); /* udp packets should fit */
|
unit_assert(ret != 0); /* udp packets should fit */
|
||||||
attach_edns_record(out, &edns);
|
attach_edns_record(out, &edns);
|
||||||
if(vbmp) printf("inlen %u outlen %u\n",
|
if(vbmp) printf("inlen %u outlen %u\n",
|
||||||
|
|
@ -357,7 +357,7 @@ testpkt(sldns_buffer* pkt, struct alloc_cache* alloc, sldns_buffer* out,
|
||||||
ret = reply_info_encode(&qi, rep, id, flags, out,
|
ret = reply_info_encode(&qi, rep, id, flags, out,
|
||||||
timenow, region,
|
timenow, region,
|
||||||
lim - calc_edns_field_size(&edns),
|
lim - calc_edns_field_size(&edns),
|
||||||
(int)(edns.bits & EDNS_DO));
|
(int)(edns.bits & EDNS_DO), 0);
|
||||||
unit_assert(ret != 0); /* should fit, but with TC */
|
unit_assert(ret != 0); /* should fit, but with TC */
|
||||||
attach_edns_record(out, &edns);
|
attach_edns_record(out, &edns);
|
||||||
if( LDNS_QDCOUNT(sldns_buffer_begin(out)) !=
|
if( LDNS_QDCOUNT(sldns_buffer_begin(out)) !=
|
||||||
|
|
|
||||||
|
|
@ -664,7 +664,7 @@ negative_answer(struct reply_info* rep) {
|
||||||
int
|
int
|
||||||
reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
||||||
uint16_t id, uint16_t flags, sldns_buffer* buffer, time_t timenow,
|
uint16_t id, uint16_t flags, sldns_buffer* buffer, time_t timenow,
|
||||||
struct regional* region, uint16_t udpsize, int dnssec)
|
struct regional* region, uint16_t udpsize, int dnssec, int minimise)
|
||||||
{
|
{
|
||||||
uint16_t ancount=0, nscount=0, arcount=0;
|
uint16_t ancount=0, nscount=0, arcount=0;
|
||||||
struct compress_tree_node* tree = 0;
|
struct compress_tree_node* tree = 0;
|
||||||
|
|
@ -744,7 +744,7 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
||||||
sldns_buffer_write_u16_at(buffer, 6, ancount);
|
sldns_buffer_write_u16_at(buffer, 6, ancount);
|
||||||
|
|
||||||
/* if response is positive answer, auth/add sections are not required */
|
/* if response is positive answer, auth/add sections are not required */
|
||||||
if( ! (MINIMAL_RESPONSES && positive_answer(rep, qinfo->qtype)) ) {
|
if( ! (minimise && positive_answer(rep, qinfo->qtype)) ) {
|
||||||
/* insert auth section */
|
/* insert auth section */
|
||||||
if((r=insert_section(rep, rep->ns_numrrsets, &nscount, buffer,
|
if((r=insert_section(rep, rep->ns_numrrsets, &nscount, buffer,
|
||||||
rep->an_numrrsets, timenow, region, &tree,
|
rep->an_numrrsets, timenow, region, &tree,
|
||||||
|
|
@ -761,7 +761,7 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
||||||
}
|
}
|
||||||
sldns_buffer_write_u16_at(buffer, 8, nscount);
|
sldns_buffer_write_u16_at(buffer, 8, nscount);
|
||||||
|
|
||||||
if(! (MINIMAL_RESPONSES && negative_answer(rep))) {
|
if(! (minimise && negative_answer(rep))) {
|
||||||
/* insert add section */
|
/* insert add section */
|
||||||
if((r=insert_section(rep, rep->ar_numrrsets, &arcount, buffer,
|
if((r=insert_section(rep, rep->ar_numrrsets, &arcount, buffer,
|
||||||
rep->an_numrrsets + rep->ns_numrrsets, timenow, region,
|
rep->an_numrrsets + rep->ns_numrrsets, timenow, region,
|
||||||
|
|
@ -874,7 +874,7 @@ reply_info_answer_encode(struct query_info* qinf, struct reply_info* rep,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!reply_info_encode(qinf, rep, id, flags, pkt, timenow, region,
|
if(!reply_info_encode(qinf, rep, id, flags, pkt, timenow, region,
|
||||||
udpsize, dnssec)) {
|
udpsize, dnssec, MINIMAL_RESPONSES)) {
|
||||||
log_err("reply encode: out of memory");
|
log_err("reply encode: out of memory");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,12 +85,14 @@ int reply_info_answer_encode(struct query_info* qinf, struct reply_info* rep,
|
||||||
* @param region: to store temporary data in.
|
* @param region: to store temporary data in.
|
||||||
* @param udpsize: size of the answer, 512, from EDNS, or 64k for TCP.
|
* @param udpsize: size of the answer, 512, from EDNS, or 64k for TCP.
|
||||||
* @param dnssec: if 0 DNSSEC records are omitted from the answer.
|
* @param dnssec: if 0 DNSSEC records are omitted from the answer.
|
||||||
|
* @param minimise: if true, the answer is a minimal response, with
|
||||||
|
* authority and additional removed if possible.
|
||||||
* @return: nonzero is success, or
|
* @return: nonzero is success, or
|
||||||
* 0 on error: malloc failure (no log_err has been done).
|
* 0 on error: malloc failure (no log_err has been done).
|
||||||
*/
|
*/
|
||||||
int reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
int reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
||||||
uint16_t id, uint16_t flags, struct sldns_buffer* buffer, time_t timenow,
|
uint16_t id, uint16_t flags, struct sldns_buffer* buffer, time_t timenow,
|
||||||
struct regional* region, uint16_t udpsize, int dnssec);
|
struct regional* region, uint16_t udpsize, int dnssec, int minimise);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode query packet. Assumes the buffer is large enough.
|
* Encode query packet. Assumes the buffer is large enough.
|
||||||
|
|
|
||||||
|
|
@ -819,7 +819,7 @@ log_dns_msg(const char* str, struct query_info* qinfo, struct reply_info* rep)
|
||||||
sldns_buffer* buf = sldns_buffer_new(65535);
|
sldns_buffer* buf = sldns_buffer_new(65535);
|
||||||
struct regional* region = regional_create();
|
struct regional* region = regional_create();
|
||||||
if(!reply_info_encode(qinfo, rep, 0, rep->flags, buf, 0,
|
if(!reply_info_encode(qinfo, rep, 0, rep->flags, buf, 0,
|
||||||
region, 65535, 1)) {
|
region, 65535, 1, 0)) {
|
||||||
log_info("%s: log_dns_msg: out of memory", str);
|
log_info("%s: log_dns_msg: out of memory", str);
|
||||||
} else {
|
} else {
|
||||||
char* s = sldns_wire2str_pkt(sldns_buffer_begin(buf),
|
char* s = sldns_wire2str_pkt(sldns_buffer_begin(buf),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue