From: Matthijs Mekking Date: Wed, 8 Dec 2010 12:35:28 +0000 (+0000) Subject: correct timestamp on query packets X-Git-Tag: release-1.6.8rc1~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef38a1efb02613bd151fc6489506f1d5fd4e81af;p=thirdparty%2Fldns.git correct timestamp on query packets --- diff --git a/Changelog b/Changelog index c90cc6fc..ecb20353 100644 --- a/Changelog +++ b/Changelog @@ -1,10 +1,11 @@ 1.6.8 * Fix ldns zone, so that $TTL definition match RFC 2308. - * Drill: Print both SHA-1 and SHA-256 corresponding DS records. * Fix lots of missing checks on allocation failures and parse of NSEC with many types and max parse length in hosts_frm_fp routine and off by one in read_anchor_file routine (thanks Dan Kaminsky and Justin Ferguson). + * Drill: Print both SHA-1 and SHA-256 corresponding DS records. + * Print correct WHEN in query packet (is not always 1-1-1970) 1.6.7 2010-11-08 * EXPERIMENTAL ecdsa implementation, please do not enable on real diff --git a/resolver.c b/resolver.c index 34bd35b0..ffb3b25d 100644 --- a/resolver.c +++ b/resolver.c @@ -1079,6 +1079,8 @@ ldns_resolver_prepare_query_pkt(ldns_pkt **query_pkt, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags) { + struct timeval now; + /* prepare a question pkt from the parameters * and then send this */ *query_pkt = ldns_pkt_query_new(ldns_rdf_clone(name), t, c, flags); @@ -1102,6 +1104,12 @@ ldns_resolver_prepare_query_pkt(ldns_pkt **query_pkt, ldns_resolver *r, ldns_pkt_set_edns_udp_size(*query_pkt, ldns_resolver_edns_udp_size(r)); } + /* set the timestamp */ + now.tv_sec = time(NULL); + now.tv_usec = 0; + ldns_pkt_set_timestamp(*query_pkt, now); + + if (ldns_resolver_debug(r)) { ldns_pkt_print(stdout, *query_pkt); }