]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Print pkts to debug log.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 15 Feb 2007 12:59:26 +0000 (12:59 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 15 Feb 2007 12:59:26 +0000 (12:59 +0000)
git-svn-id: file:///svn/unbound/trunk@103 be551aaa-1e26-0410-a405-d3ace91eadb9

testcode/fake_event.c

index 5ffefb19b1af11e9fbb0ae8a1eec686967964a19..5d3bd79cf4b425e9cc610307264c2a13c5685099 100644 (file)
@@ -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 &&