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

Merge pull request #20835 from xnumad/nib-route-hide-on-link-prefixes

gnrc/ipv6: `nib route`: hide off-link PLEs
This commit is contained in:
benpicco 2024-09-24 15:42:48 +00:00 committed by GitHub
commit 5c06502c4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 8 deletions

View File

@ -112,7 +112,8 @@ void gnrc_ipv6_nib_ft_del(const ipv6_addr_t *dst, unsigned dst_len);
* *
* The iteration over all forwarding table entries in the NIB includes all * The iteration over all forwarding table entries in the NIB includes all
* entries added via @p gnrc_ipv6_nib_ft_add() and entries that are currently * entries added via @p gnrc_ipv6_nib_ft_add() and entries that are currently
* in the Destination Cache, in the Prefix List, and in the Default Router List. * in the Destination Cache, in the Prefix List (only if they're on-link),
* and in the Default Router List.
* *
* Usage example: * Usage example:
* *

View File

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