From aecdb781fcb1acf68b79879500e6abcfd677eeb3 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 15 Oct 2007 14:19:17 +0000 Subject: [PATCH] Fixup compression, and test for byteformat compression results. git-svn-id: file:///svn/unbound/trunk@676 be551aaa-1e26-0410-a405-d3ace91eadb9 --- daemon/worker.c | 3 ++- doc/Changelog | 3 +++ testcode/do-tests.sh | 12 ++++++++++++ testdata/fwd_compress_c00c.tpkg | Bin 0 -> 2059 bytes util/data/msgencode.c | 6 +++--- 5 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 testdata/fwd_compress_c00c.tpkg diff --git a/daemon/worker.c b/daemon/worker.c index 7ed290d49..c4f795383 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -662,7 +662,8 @@ worker_handle_request(struct comm_point* c, void* arg, int error, struct edns_data edns; if(error != NETEVENT_NOERROR) { - log_err("handle request called with err=%d", error); + /* some bad tcp query DNS formats give these error calls */ + verbose(VERB_ALGO, "handle request called with err=%d", error); return 0; } if((ret=worker_check_request(c->buffer, worker)) != 0) { diff --git a/doc/Changelog b/doc/Changelog index 604f0200c..d33539d5f 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,9 @@ 15 October 2007: Wouter - nicer warning. - fix IP6 TCP, wrong definition check. With test package. + - fixup the fact that the query section was not compressed to, + the code was there but was called by value instead of by reference. + And test for the case, uses xxd and nc. 8 October 2007: Wouter - --disable-rpath option in configure for 64bit systems with diff --git a/testcode/do-tests.sh b/testcode/do-tests.sh index 2685caea1..b8a7170b0 100755 --- a/testcode/do-tests.sh +++ b/testcode/do-tests.sh @@ -3,6 +3,8 @@ NEED_SPLINT='00-lint.tpkg' NEED_DOXYGEN='01-doc.tpkg' NEED_LDNS_TESTNS='fwd_no_edns.tpkg fwd_tcp_tc.tpkg fwd_tcp.tpkg fwd_three_service.tpkg fwd_three.tpkg fwd_ttlexpire.tpkg fwd_udp.tpkg' +NEED_XXD='fwd_compress_c00c.tpkg' +NEED_NC='fwd_compress_c00c.tpkg' cd testdata; sh ../testcode/mini_tpkg.sh clean @@ -23,6 +25,16 @@ for test in `ls *.tpkg`; do SKIP=1; fi fi + if echo $NEED_XXD | grep $test >/dev/null; then + if test ! -x "`which xxd`"; then + SKIP=1; + fi + fi + if echo $NEED_NC | grep $test >/dev/null; then + if test ! -x "`which nc`"; then + SKIP=1; + fi + fi if test $SKIP -eq 0; then echo $test sh ../testcode/mini_tpkg.sh -a ../.. exe $test diff --git a/testdata/fwd_compress_c00c.tpkg b/testdata/fwd_compress_c00c.tpkg new file mode 100644 index 0000000000000000000000000000000000000000..9e6b8524433e740326765b1ba6a09eff2fea888e GIT binary patch literal 2059 zc-jFA2=wNDvQtq2``B$6GJw>i^0M8a;dv3 zR!9SAjU^(95by1M_v;=ZkZf2xUKe$b`Nfe&)6Z-Z`G>l{A-$F?5VnDnAJT{pSG);@qa%5ufeykdBnr7 zJOr9#7GwVl-nOwBJ8Sk&-a{~R z0++*=_-2MrlFNGS^ADflV-K25=ycn?Ubn}Ztv_8}^uY;cHv`XQ7wwb&X}1F(FWVPX zV7GLF0NNtZT(xg@E0BglTk#|1m*5K9p@%3B<{Lhe&$-2y412rNV(cmA|Dpar3!?b3I_~vMwM>ir zUo}+e|GU6G?3c^1dA^}s-e>y|1@qA15KlN<+Yt@|e8mx?Z2}e(?t>Q}L_`fa`x}%; zpePk3o?VR_7#U{j!gwIr9h+N@~;(tj&*wDxwaBC_lLpUch{mW zJ8!#}oo(VW)H@>iH!lYDNj&`b@lgMFBj?dN?(=`ssIC0JW@zaDs-;@e|9646cEme) zQrGY90qie4jJ&|FgQlpg#Um&5X0fPv7laFRC9r)LoC$ZXAmv0d1S2Fw3koO#_%i3= zjR-Onb`o-%1hniJ6`oW?O&!(YBZoz>ZSxT&KG7TGy&cpGV0 z&-#2bQS30y`L}ntQIVE&JBqklXYXupijH32fdl_RJkss@MJp^BfXwt5)!z&hI+0Vq@S!!-gX1ZXItW?3fS6q;cDXmPNr z;uE<^-3l z7$6G5aQv`&yLU8o{ivMW(=l(94BRssr{d3xiRVm20@LpOTzpOQ<+DPg_hp0j1jbX0nl?ITqz3tM_9awRA5N8UKO zkixJE${Y@&$}w5+_v6YzZd4B{2PwVZUA0IJ&QNjQR^)UJiTq|mr^o(RQe3ibHfSYP7IpXVPG!x$jWOF60an8H4%k z#Y^}nE1Wg|I=DO^^n0I=G+kwdPtDW*p#Q$tzBn@QleD6{#o^773a{x6Z;qg}=1MAG zy+Rknq8qS6Aziq*Y)cwB^k^LN85B!;kt)`Ca=M5Mg=DB)jQ;`cBrPR;6p1v%gyZTp zmT(=fWfK{f!Fyfi;^*i(t1?ZN}?&p zUTI4vvYq`aH(M*`rn$gX$x*XdfMR|QK6tos`c%X&&w?;MAX9NJ6_%eUNFB0xhozWP zn6A`~>Mq2($Gnc@dJf;JExWLb(Jijx(_C3fJR!d4_n*h=xF`P8s+zgV|IAuV-2dt_ z{@V$*#ec~r{67={W{+lZBb?qeFOS;B@}?^PyA1pWz5}r{!@{?3F7hU=DO;sv8MDbG z`^^G#MoNV#6Q)F%@?gpyDGR0~c-dYnCNiNMQg9^{X?jgj@n81tnBuLZ;csX!o^kV7 zL`13CbP_EO@u(<*fON|jADJC_%_6Ssk~_L0#fr%po4E_9*~L^*dT1rgaS*`J8`B|} z9DEcaZjxX*TO@S&_2epX zIU&bv9_N+p?7ICw4iDY`DQ&tVXG@l73c zR@euBeqD|y7(dhXIR>f}G1fsOU&pL~gE0h#4A4@KNn3n|5R-4Lr*8{zRXojaDnqlAQngoK2IgoK2IgoK2I pgoK2IgoK2IgoK2IgoK2IgoK2IgoK2IgoMQ2zX1{<&8`4Y008p70P+9; literal 0 Hc-jL100001 diff --git a/util/data/msgencode.c b/util/data/msgencode.c index 4d199ef05..fdba17304 100644 --- a/util/data/msgencode.c +++ b/util/data/msgencode.c @@ -573,13 +573,13 @@ insert_section(struct reply_info* rep, size_t num_rrsets, uint16_t* num_rrs, /** store query section in wireformat buffer, return RETVAL */ static int -insert_query(struct query_info* qinfo, struct compress_tree_node* tree, +insert_query(struct query_info* qinfo, struct compress_tree_node** tree, ldns_buffer* buffer, struct region* region) { if(ldns_buffer_remaining(buffer) < qinfo->qname_len+sizeof(uint16_t)*2) return RETVAL_TRUNC; /* buffer too small */ - if(!compress_tree_store(&tree, qinfo->qname, + if(!compress_tree_store(tree, qinfo->qname, dname_count_labels(qinfo->qname), ldns_buffer_position(buffer), region, NULL)) return RETVAL_OUTMEM; @@ -612,7 +612,7 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep, /* insert query section */ if(rep->qdcount) { - if((r=insert_query(qinfo, tree, buffer, region)) != + if((r=insert_query(qinfo, &tree, buffer, region)) != RETVAL_OK) { if(r == RETVAL_TRUNC) { /* create truncated message */ -- 2.47.2