]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Fixup compression, and test for byteformat compression results.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 15 Oct 2007 14:19:17 +0000 (14:19 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 15 Oct 2007 14:19:17 +0000 (14:19 +0000)
git-svn-id: file:///svn/unbound/trunk@676 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/worker.c
doc/Changelog
testcode/do-tests.sh
testdata/fwd_compress_c00c.tpkg [new file with mode: 0644]
util/data/msgencode.c

index 7ed290d498aea16c7caa9a21de45cc471d8e71e3..c4f7953837f806129db6520062c3781ea5b6ca21 100644 (file)
@@ -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) {
index 604f0200c90f7b4e5052897f4101d603e1c76bbf..d33539d5f8219daba65aff2fbbe9628584c0c07d 100644 (file)
@@ -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
index 2685caea18fc83bace3baa608847c2b9ea966b04..b8a7170b0a9684596b21430f87a5d136218162b5 100755 (executable)
@@ -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 (file)
index 0000000..9e6b852
Binary files /dev/null and b/testdata/fwd_compress_c00c.tpkg differ
index 4d199ef05591968beb2a45cf6ee39f0c6fcfcaa7..fdba17304365e8bd1bc8e5d955a5bad196547418 100644 (file)
@@ -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 */