1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-23 05:23:50 +01:00

ipv6/nib: _nib_offl_clear() delete offlink entry when mode is not zero

This commit is contained in:
Fabian Hüßler 2022-11-13 21:52:20 +01:00 committed by Fabian Hüßler
parent d5d4fc869a
commit 1d3b320c2e

View File

@ -25,6 +25,7 @@
#include "net/gnrc/ipv6/nib/nc.h"
#include "net/gnrc/ipv6/nib.h"
#include "net/gnrc/netif/internal.h"
#include "net/ipv6/addr.h"
#include "random.h"
#include "_nib-internal.h"
@ -552,21 +553,28 @@ static inline bool _in_abrs(const _nib_abr_entry_t *abr)
void _nib_offl_clear(_nib_offl_entry_t *dst)
{
if (dst->next_hop != NULL) {
_nib_offl_entry_t *ptr;
for (ptr = _dsts; _in_dsts(ptr); ptr++) {
/* there is another dst pointing to next-hop => only remove dst */
if ((dst != ptr) && (dst->next_hop == ptr->next_hop)) {
break;
if (dst->mode == _EMPTY) {
if (dst->next_hop != NULL) {
_nib_offl_entry_t *ptr;
for (ptr = _dsts; _in_dsts(ptr); ptr++) {
/* there is another dst pointing to next-hop => only remove dst */
if ((dst != ptr) && (dst->next_hop == ptr->next_hop)) {
break;
}
}
/* we iterated and found no further dst pointing to next-hop */
if (!_in_dsts(ptr)) {
dst->next_hop->mode &= ~(_DST);
_nib_onl_clear(dst->next_hop);
}
}
/* we iterated and found no further dst pointing to next-hop */
if (!_in_dsts(ptr)) {
dst->next_hop->mode &= ~(_DST);
_nib_onl_clear(dst->next_hop);
}
memset(dst, 0, sizeof(_nib_offl_entry_t));
}
else {
DEBUG("nib: offlink entry %s/%u with mode %u not cleared\n",
ipv6_addr_to_str(addr_str, &dst->pfx, sizeof(addr_str)),
dst->pfx_len, dst->mode);
}
}
_nib_offl_entry_t *_nib_offl_iter(const _nib_offl_entry_t *last)