From: Wouter Wijngaards Date: Thu, 15 Feb 2007 12:59:26 +0000 (+0000) Subject: Print pkts to debug log. X-Git-Tag: release-0.0~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9e8c7d4799b09e852761642d23418dfa7323b4a;p=thirdparty%2Funbound.git Print pkts to debug log. git-svn-id: file:///svn/unbound/trunk@103 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/testcode/fake_event.c b/testcode/fake_event.c index 5ffefb19b..5d3bd79cf 100644 --- a/testcode/fake_event.c +++ b/testcode/fake_event.c @@ -69,6 +69,19 @@ fake_event_cleanup() saved_scenario = NULL; } +/** helper function that logs a ldns_pkt packet to logfile. */ +static void +log_pkt(const char* desc, ldns_pkt* pkt) +{ + char* str = ldns_pkt2str(pkt); + if(!str) + log_info("%s: (failed)", desc); + else { + log_info("%s%s", desc, str); + free(str); + } +} + /** * Returns a string describing the event type. */ @@ -592,6 +605,7 @@ comm_point_send_reply(struct comm_reply* repinfo) ldns_get_errorstr_by_id(status)); fatal_exit("Sending unparseable DNS replies to clients!"); } + log_pkt("reply pkt: ", ans->pkt); } void @@ -658,6 +672,7 @@ pending_udp_query(struct outside_network* outnet, ldns_buffer* packet, ldns_get_errorstr_by_id(status)); fatal_exit("Sending unparseable DNS packets to servers!"); } + log_pkt("pending udp pkt: ", pend->pkt); /* see if it matches the current moment */ if(runtime->now && runtime->now->evt_type == repevt_back_query &&