]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: peers: Missing TX cache entries reset.
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 12 Nov 2020 20:01:54 +0000 (21:01 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 13 Nov 2020 05:04:18 +0000 (06:04 +0100)
The TX part of a cache for a dictionary is made of an reserved array of ebtree nodes
which are pointers to dictionary entries. So when we flush the TX part of such a
cache, we must not only remove these nodes to dictionary entries from their ebtree.
We must also reset their values. Furthermore, the LRU key and the last lookup
result must also be reset.

src/peers.c

index 9a0f3cbdfcec6bcf69d11d5784f073cd06ae1ef8..6dbc3a964984788e15daa469487e30d9e7b9f734 100644 (file)
@@ -3062,8 +3062,12 @@ static inline void flush_dcache(struct peer *peer)
        int i;
        struct dcache *dc = peer->dcache;
 
-       for (i = 0; i < dc->max_entries; i++)
+       for (i = 0; i < dc->max_entries; i++) {
                ebpt_delete(&dc->tx->entries[i]);
+               dc->tx->entries[i].key = NULL;
+       }
+       dc->tx->prev_lookup = NULL;
+       dc->tx->lru_key = 0;
 
        memset(dc->rx, 0, dc->max_entries * sizeof *dc->rx);
 }