From 7fcc2ab5d68c927ff310b5ce6321e9c52dc05bd8 Mon Sep 17 00:00:00 2001 From: Martine Lenders <m.lenders@fu-berlin.de> Date: Tue, 12 Feb 2019 12:06:04 +0100 Subject: [PATCH] gnrc_ipv6_nib: fix iteration conditions for cache-out --- sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index acea7db365..c730fdb825 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -152,7 +152,11 @@ static inline _nib_onl_entry_t *_cache_out_onl_entry(const ipv6_addr_t *addr, /* no new entry created yet, get next entry in FIFO */ tmp = (_nib_onl_entry_t *)clist_lpop(&_next_removable); } - } while ((tmp != first) && (res != NULL)); + } while ((tmp != first) && (res == NULL)); + if (res == NULL) { + /* we did not find any removable entry => requeue current one */ + clist_rpush(&_next_removable, (clist_node_t *)tmp); + } return res; } -- GitLab