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

Merge pull request #13709 from miri64/gnrc_ipv6_nib/fix/pl-on-link

gnrc_ipv6_nib: only route to prefix list entry if on-link
This commit is contained in:
Martine Lenders 2020-03-25 15:10:50 +01:00 committed by GitHub
commit 9f3fe33277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View File

@ -619,7 +619,9 @@ int _nib_get_route(const ipv6_addr_t *dst, gnrc_pktsnip_t *pkt,
(void *)pkt);
_nib_offl_entry_t *offl = _nib_offl_get_match(dst);
if (offl == NULL) {
if ((offl == NULL) ||
/* give default route precedence over off-link PLEs */
((offl->mode == _PL) && !(offl->flags & _PFX_ON_LINK))) {
_nib_dr_entry_t *router = _nib_drl_get_dr();
if ((router == NULL) && (offl == NULL)) {

View File

@ -102,6 +102,9 @@ static gnrc_pktsnip_t *_offl_to_pio(_nib_offl_entry_t *offl,
{
uint32_t now = (xtimer_now_usec64() / US_PER_MS) & UINT32_MAX;
gnrc_pktsnip_t *pio;
gnrc_netif_t *netif = gnrc_netif_get_by_pid(
_nib_onl_get_if(offl->next_hop)
);
uint8_t flags = 0;
uint32_t valid_ltime = (offl->valid_until == UINT32_MAX) ? UINT32_MAX :
((offl->valid_until - now) / MS_PER_SEC);
@ -111,7 +114,11 @@ static gnrc_pktsnip_t *_offl_to_pio(_nib_offl_entry_t *offl,
DEBUG("nib: Build PIO for %s/%u\n",
ipv6_addr_to_str(addr_str, &offl->pfx, sizeof(addr_str)),
offl->pfx_len);
if (offl->flags & _PFX_ON_LINK) {
/* do not advertise as on-link if 6LN
* https://tools.ietf.org/html/rfc6775#section-6.1 otherwise the PIO will be
* ignored by other nodes (https://tools.ietf.org/html/rfc6775#section-5.4)
*/
if ((offl->flags & _PFX_ON_LINK) && !gnrc_netif_is_6ln(netif)) {
flags |= NDP_OPT_PI_FLAGS_L;
}
if (offl->flags & _PFX_SLAAC) {

View File

@ -58,7 +58,12 @@ int gnrc_ipv6_nib_pl_set(unsigned iface,
return 0;
}
gnrc_netif_acquire(netif);
if (!gnrc_netif_is_6ln(netif) &&
/* prefixes within a 6Lo-ND-performing network are typically off-link, the
* border router however should configure the prefix as on-link to only do
* address resolution towards the LoWPAN and not the upstream interface
* See https://github.com/RIOT-OS/RIOT/pull/10627 and follow-ups
*/
if ((!gnrc_netif_is_6ln(netif) || gnrc_netif_is_6lbr(netif)) &&
((idx = gnrc_netif_ipv6_addr_match(netif, pfx)) >= 0) &&
(ipv6_addr_match_prefix(&netif->ipv6.addrs[idx], pfx) >= pfx_len)) {
dst->flags |= _PFX_ON_LINK;