From 9650ee94b3cc5bc2e6c2a7cf67ef66c0273c1404 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Thu, 12 Nov 2020 21:01:54 +0100 Subject: [PATCH] BUG/MINOR: peers: Missing TX cache entries reset. 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. (cherry picked from commit ea875e62e6b2f69c50533c5cd52eb5284c69723f) Signed-off-by: Christopher Faulet --- src/peers.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/peers.c b/src/peers.c index 53c3c73..646fe46 100644 --- a/src/peers.c +++ b/src/peers.c @@ -2948,8 +2948,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); } -- 1.7.10.4