]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
EDNS test.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 22 May 2007 13:40:49 +0000 (13:40 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 22 May 2007 13:40:49 +0000 (13:40 +0000)
git-svn-id: file:///svn/unbound/trunk@329 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/outside_network.c
testcode/ldns-testpkts.c
testcode/ldns-testpkts.h
testdata/fwd_no_edns.tpkg [new file with mode: 0644]

index 3ba2be7dea57ae4e45c72252d4c99c590d35c134..d9c37c8b3138e718b33c4acd0c5941254c07764d 100644 (file)
@@ -3,6 +3,7 @@
          outbound entry to the module.
        - testbound support for new serviced queries.
        - test for retry to TCP cannot use testbound any longer.
+       - testns test for EDNS fallback, test for TCP fallback already exists.
 
 21 May 2007: Wouter
        - small comment on hash table locking.
index b515af281e588cb3ba6891415d606e4c92be3976..0fcb7a4a1d32bb3fe34b36036684a5a285433102 100644 (file)
@@ -287,7 +287,6 @@ outnet_udp_cb(struct comm_point* c, void* arg, int error,
        memcpy(&key.addr, &reply_info->addr, reply_info->addrlen);
        key.addrlen = reply_info->addrlen;
        verbose(VERB_ALGO, "Incoming reply id=%4.4x addr=", key.id);
-       log_addr(&key.addr, key.addrlen);
 
        /* find it, see if this thing is a valid query response */
        verbose(VERB_ALGO, "lookup size is %d entries", (int)outnet->pending->count);
@@ -660,8 +659,7 @@ new_pending(struct outside_network* outnet, ldns_buffer* packet,
                        return NULL;
                }
        }
-       verbose(VERB_ALGO, "inserted new pending reply id=%4.4x addr=", pend->id);
-       log_addr(&pend->addr, pend->addrlen);
+       verbose(VERB_ALGO, "inserted new pending reply id=%4.4x", pend->id);
        return pend;
 }
 
index 059d6e9d2540b9f21abd9d15f29cd600996e02ea..d090a722240f92e1dd383d5133ef3d806f309af6 100644 (file)
@@ -108,6 +108,8 @@ static void matchline(const char* line, struct entry* e)
                        e->match_all = true;
                } else if(str_keyword(&parse, "ttl")) {
                        e->match_ttl = true;
+               } else if(str_keyword(&parse, "DO")) {
+                       e->match_do = true;
                } else if(str_keyword(&parse, "UDP")) {
                        e->match_transport = transport_udp;
                } else if(str_keyword(&parse, "TCP")) {
@@ -220,6 +222,7 @@ static struct entry* new_entry()
        e->match_qname = false;
        e->match_all = false;
        e->match_ttl = false;
+       e->match_do = false;
        e->match_serial = false;
        e->ixfr_soa_serial = 0;
        e->match_transport = transport_any;
@@ -663,6 +666,10 @@ find_match(struct entry* entries, ldns_pkt* query_pkt,
                                verbose(3, "bad serial\n");
                                continue;
                }
+               if(p->match_do && !ldns_pkt_edns_do(query_pkt)) {
+                       verbose(3, "no DO bit set\n");
+                       continue;
+               }
                if(p->match_transport != transport_any && p->match_transport != transport) {
                        verbose(3, "bad transport\n");
                        continue;
index 95b2ca332ba43e4e29eb014907da710853c01390..670ee62f57a4531137786b63af6add7f1a1a14f3 100644 (file)
@@ -45,8 +45,9 @@
        ; 'serial=1023' makes the query match if ixfr serial is 1023. 
        ; 'all' has to match header byte for byte and all rrs in packet.
        ; 'ttl' used with all, rrs in packet must also have matching TTLs.
+       ; 'DO' will match only queries with DO bit set.
        MATCH [opcode] [qtype] [qname] [serial=<value>] [all] [ttl]
-       MATCH [UDP|TCP]
+       MATCH [UDP|TCP] DO
        MATCH ...
        ; Then the REPLY header is specified.
        REPLY opcode, rcode or flags.
@@ -160,6 +161,8 @@ struct entry {
        bool match_all;
        /** match ttls in the packet */
        bool match_ttl;
+       /** match DO bit */
+       bool match_do;
        /** match query serial with this value. */
        uint32_t ixfr_soa_serial; 
        /** match on UDP/TCP */
diff --git a/testdata/fwd_no_edns.tpkg b/testdata/fwd_no_edns.tpkg
new file mode 100644 (file)
index 0000000..9415f01
Binary files /dev/null and b/testdata/fwd_no_edns.tpkg differ