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:
parent
d5d4fc869a
commit
1d3b320c2e
@ -25,6 +25,7 @@
|
|||||||
#include "net/gnrc/ipv6/nib/nc.h"
|
#include "net/gnrc/ipv6/nib/nc.h"
|
||||||
#include "net/gnrc/ipv6/nib.h"
|
#include "net/gnrc/ipv6/nib.h"
|
||||||
#include "net/gnrc/netif/internal.h"
|
#include "net/gnrc/netif/internal.h"
|
||||||
|
#include "net/ipv6/addr.h"
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
|
|
||||||
#include "_nib-internal.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)
|
void _nib_offl_clear(_nib_offl_entry_t *dst)
|
||||||
{
|
{
|
||||||
if (dst->next_hop != NULL) {
|
if (dst->mode == _EMPTY) {
|
||||||
_nib_offl_entry_t *ptr;
|
if (dst->next_hop != NULL) {
|
||||||
for (ptr = _dsts; _in_dsts(ptr); ptr++) {
|
_nib_offl_entry_t *ptr;
|
||||||
/* there is another dst pointing to next-hop => only remove dst */
|
for (ptr = _dsts; _in_dsts(ptr); ptr++) {
|
||||||
if ((dst != ptr) && (dst->next_hop == ptr->next_hop)) {
|
/* there is another dst pointing to next-hop => only remove dst */
|
||||||
break;
|
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));
|
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)
|
_nib_offl_entry_t *_nib_offl_iter(const _nib_offl_entry_t *last)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user