gnrc_ipv6_nib: fix for 'holey' NIB
When there are holes in the NIB (e.g. when entries were removed) currently the NIB crashes the system due to a failed assertion (`DEVELHELP` needs to be activated to test this behavior). This fixes this behavior by making the assertion a check that is always compiled in.
This commit is contained in:
parent
fa81932a8f
commit
72db5e48f0
@ -100,8 +100,9 @@ bool gnrc_ipv6_nib_ft_iter(const ipv6_addr_t *next_hop, unsigned iface,
|
||||
_nib_offl_entry_t *offl = *state;
|
||||
|
||||
while ((offl = _nib_offl_iter(offl))) {
|
||||
assert((offl->mode != 0) || (offl->next_hop != NULL));
|
||||
if (((iface == 0) || (iface == _nib_onl_get_if(offl->next_hop))) &&
|
||||
assert(offl->mode != 0);
|
||||
if ((offl->next_hop != NULL) &&
|
||||
((iface == 0) || (iface == _nib_onl_get_if(offl->next_hop))) &&
|
||||
((next_hop == NULL) || ipv6_addr_equal(&offl->next_hop->ipv6,
|
||||
next_hop))) {
|
||||
_nib_ft_get(offl, fte);
|
||||
@ -113,8 +114,8 @@ bool gnrc_ipv6_nib_ft_iter(const ipv6_addr_t *next_hop, unsigned iface,
|
||||
}
|
||||
entry = *state;
|
||||
while ((entry = _nib_drl_iter(entry))) {
|
||||
assert((entry->next_hop != NULL));
|
||||
if (((iface == 0) || (iface == _nib_onl_get_if(entry->next_hop))) &&
|
||||
if ((entry->next_hop != NULL) &&
|
||||
((iface == 0) || (iface == _nib_onl_get_if(entry->next_hop))) &&
|
||||
((next_hop == NULL) || ipv6_addr_equal(&entry->next_hop->ipv6,
|
||||
next_hop))) {
|
||||
_nib_drl_ft_get(entry, fte);
|
||||
|
||||
@ -81,8 +81,7 @@ bool gnrc_ipv6_nib_pl_iter(unsigned iface, void **state,
|
||||
mutex_lock(&_nib_mutex);
|
||||
while ((dst = _nib_offl_iter(dst)) != NULL) {
|
||||
const _nib_onl_entry_t *node = dst->next_hop;
|
||||
assert(node != NULL);
|
||||
if ((dst->mode & _PL) &&
|
||||
if ((node != NULL) && (dst->mode & _PL) &&
|
||||
((iface == 0) || (_nib_onl_get_if(node) == iface))) {
|
||||
entry->pfx_len = dst->pfx_len;
|
||||
ipv6_addr_set_unspecified(&entry->pfx);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user