]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Small off by one in targetcount and double-callback fixup.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 15 Jun 2007 08:40:30 +0000 (08:40 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 15 Jun 2007 08:40:30 +0000 (08:40 +0000)
git-svn-id: file:///svn/unbound/trunk@389 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
iterator/iterator.c
services/outside_network.c

index 21bf259776c357567bb8fd4ae304cc8eeae2eb78..0e4b55bcb162bf8c2433f686f697b8f77bc4fce0 100644 (file)
@@ -1,3 +1,13 @@
+15 June 2007: Wouter
+       - if a query asks to be notified of the same serviced query result
+         multiple times, this will succeed. Only one callback will happen;
+         multiple outbound-list entries result (but the double cleanup of it
+         will not matter).
+
+14 June 2007: Wouter
+       - num query targets was > 0 , not >= 0 compared, so that fetch
+         policy of 0 did nothing.
+
 13 June 2007: Wouter
        - debug option: configure --enable-static-exe for compile where
          ldns and libevent are linked statically. Default is off.
index c734dc114a669a51255535c1e6cc5d05adb1e723..093f1721bbfc422b6dc6cece9b5f1c2c68911ab7 100644 (file)
@@ -940,7 +940,7 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq,
 
                /* if maxtargets is negative, there is no maximum, 
                 * otherwise only query for ntarget names. */
-               if(maxtargets > 0 && ++target_count > maxtargets)
+               if(maxtargets >= 0 && ++target_count > maxtargets)
                        break;
        }
        *num = query_count;
index cd96ea9edf9f182da948516a1cc3d594e9686770..2e83417b7756e737479c3ee8e823972a8a442b3f 100644 (file)
@@ -1130,6 +1130,18 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
        return 0;
 }
 
+/** find callback in list */
+static struct service_callback*
+callback_list_find(struct serviced_query* sq, void* cb_arg)
+{
+       struct service_callback* p;
+       for(p = sq->cblist; p; p = p->next) {
+               if(p->cb_arg == cb_arg)
+                       return p;
+       }
+       return NULL;
+}
+
 struct serviced_query* 
 outnet_serviced_query(struct outside_network* outnet,
        uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
@@ -1141,6 +1153,12 @@ outnet_serviced_query(struct outside_network* outnet,
        struct service_callback* cb;
        serviced_gen_query(buff, qname, qnamelen, qtype, qclass, flags);
        sq = lookup_serviced(outnet, buff, dnssec, addr, addrlen);
+       if(sq) {
+               /* see if it is a duplicate notification request for cb_arg */
+               if((cb = callback_list_find(sq, callback_arg))) {
+                       return sq;
+               }
+       }
        if(!(cb = (struct service_callback*)malloc(sizeof(*cb))))
                return NULL;
        if(!sq) {