]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Don't do lru operations on root node.
authorYuri Schaeffer <yuri@nlnetlabs.nl>
Wed, 20 May 2015 19:26:43 +0000 (19:26 +0000)
committerYuri Schaeffer <yuri@nlnetlabs.nl>
Wed, 20 May 2015 19:26:43 +0000 (19:26 +0000)
Update TTL when overriding a node contents.

git-svn-id: file:///svn/unbound/branches/edns-subnet@3425 be551aaa-1e26-0410-a405-d3ace91eadb9

edns-subnet/addrtree.c

index 6c64d52a1f81711588a05d080f19a26e3fafd487..917b9852d77d816ff75a814fad2f3a8b5de0e068 100644 (file)
@@ -168,6 +168,7 @@ lru_push(struct addrtree *tree, struct addrnode *node)
 static void
 lru_update(struct addrtree *tree, struct addrnode *node)
 {
+       if (tree->root == node) return;
        lru_pop(tree, node);
        lru_push(tree, node);
 }
@@ -348,6 +349,7 @@ addrtree_insert(struct addrtree *tree, const addrkey_t *addr,
                if (depth == sourcemask) {
                        /* update this node's scope and data */
                        clean_node(tree, node);
+                       node->ttl = ttl;
                        node->elem = elem;
                        node->scope = scope;
                        tree->size_bytes += tree->sizefunc(elem);