1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_ipv6_nib: refactor

Co-Authored-By: benpicco <benpicco@googlemail.com>
This commit is contained in:
xnumad 2024-09-02 18:10:57 +02:00
parent 48a2417892
commit 92b77ed944

View File

@ -132,15 +132,26 @@ bool gnrc_ipv6_nib_ft_iter(const ipv6_addr_t *next_hop, unsigned iface,
while ((offl = _nib_offl_iter(offl))) {
assert(offl->mode != 0);
if ((offl->next_hop != NULL) &&
(offl->mode != _PL || offl->flags & _PFX_ON_LINK) &&
((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);
*state = offl;
return true;
if (offl->next_hop == NULL) {
/* 'holey' NIB / dangling reference.
* there is no next hop (not even an interface) */
continue;
}
if (offl->mode == _PL && !(offl->flags & _PFX_ON_LINK)) {
/* prefix list entry is off-link */
continue;
}
if (iface && iface != _nib_onl_get_if(offl->next_hop)) {
/* interface does not match */
continue;
}
if (next_hop && !ipv6_addr_equal(&offl->next_hop->ipv6, next_hop)) {
/* next hop does not match */
continue;
}
_nib_ft_get(offl, fte);
*state = offl;
return true;
}
*state = NULL;
}