diff options
Diffstat (limited to 'util/data')
| -rw-r--r-- | util/data/msgencode.c | 7 | ||||
| -rw-r--r-- | util/data/msgreply.c | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/util/data/msgencode.c b/util/data/msgencode.c index 6bc3216ff9e9..4c0a5550be13 100644 --- a/util/data/msgencode.c +++ b/util/data/msgencode.c @@ -50,6 +50,11 @@ #include "sldns/sbuffer.h" #include "services/localzone.h" +#ifdef HAVE_TIME_H +#include <time.h> +#endif +#include <sys/time.h> + /** return code that means the function ran out of memory. negative so it does * not conflict with DNS rcodes. */ #define RETVAL_OUTMEM -2 @@ -672,7 +677,7 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep, } /* roundrobin offset. using query id for random number. With ntohs * for different roundrobins for sequential id client senders. */ - rr_offset = RRSET_ROUNDROBIN?ntohs(id):0; + rr_offset = RRSET_ROUNDROBIN?ntohs(id)+(timenow?timenow:time(NULL)):0; /* "prepend" any local alias records in the answer section if this * response is supposed to be authoritative. Currently it should diff --git a/util/data/msgreply.c b/util/data/msgreply.c index 45d42a87f458..32aec4bf4c95 100644 --- a/util/data/msgreply.c +++ b/util/data/msgreply.c @@ -195,6 +195,8 @@ rdata_copy(sldns_buffer* pkt, struct packed_rrset_data* data, uint8_t* to, } if(*rr_ttl < MIN_TTL) *rr_ttl = MIN_TTL; + if(*rr_ttl > MAX_TTL) + *rr_ttl = MAX_TTL; if(*rr_ttl < data->ttl) data->ttl = *rr_ttl; @@ -853,7 +855,9 @@ log_reply_info(enum verbosity_value v, struct query_info *qinf, addr_to_str(addr, addrlen, clientip_buf, sizeof(clientip_buf)); if(rcode == LDNS_RCODE_FORMERR) { - log_info("%s - - - %s - - - ", clientip_buf, rcode_buf); + if(LOG_TAG_QUERYREPLY) + log_reply("%s - - - %s - - - ", clientip_buf, rcode_buf); + else log_info("%s - - - %s - - - ", clientip_buf, rcode_buf); } else { if(qinf->qname) dname_str(qinf->qname, qname_buf); @@ -861,7 +865,11 @@ log_reply_info(enum verbosity_value v, struct query_info *qinf, pktlen = sldns_buffer_limit(rmsg); sldns_wire2str_type_buf(qinf->qtype, type_buf, sizeof(type_buf)); sldns_wire2str_class_buf(qinf->qclass, class_buf, sizeof(class_buf)); - log_info("%s %s %s %s %s " ARG_LL "d.%6.6d %d %d", + if(LOG_TAG_QUERYREPLY) + log_reply("%s %s %s %s %s " ARG_LL "d.%6.6d %d %d", + clientip_buf, qname_buf, type_buf, class_buf, + rcode_buf, (long long)dur.tv_sec, (int)dur.tv_usec, cached, (int)pktlen); + else log_info("%s %s %s %s %s " ARG_LL "d.%6.6d %d %d", clientip_buf, qname_buf, type_buf, class_buf, rcode_buf, (long long)dur.tv_sec, (int)dur.tv_usec, cached, (int)pktlen); } |
