Merge pull request #10998 from miri64/gnrc_ipv6_nib/fix/cache-out-loop-iteration

gnrc_ipv6_nib: fix iteration conditions for cache-out
This commit is contained in:
Cenk Gündoğan 2019-02-12 14:10:15 +01:00 committed by GitHub
commit fa48e662a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,13 +146,18 @@ static inline _nib_onl_entry_t *_cache_out_onl_entry(const ipv6_addr_t *addr,
res->mode = _NC;
}
/* requeue if not garbage collectible at the moment or queueing
* newly created NCE */
* newly created NCE or in case entry becomes garbage collectible
* again */
clist_rpush(&_next_removable, (clist_node_t *)tmp);
if (res == NULL) {
/* 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;
}