RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

gnrc/ipv6: `nib route`: hide off-link PLEs

Open xnumad opened this issue 1 year ago • 6 comments

Contribution description

An off-link prefix with SLAAC (i.e. RA PIO: L flag = 0, A flag = 1):

  • is listed in nib prefix. Listing it here only means it’s a "managed" prefix (for SLAAC lifetimes), no indication about whether it’s on-link.
  • nib route ❌ Currently falsely displays it as on-link (e.g. 2001:db8::/32 dev #6) Should not list it, to reflect the actually used routing logic [1] https://github.com/RIOT-OS/RIOT/blob/0e7636a463894c177a2982fd08f7e02cef83aa89/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c#L653

This PR removes it from the nib route output.

[1] which is correct ("forward the packet to a default router" - https://datatracker.ietf.org/doc/html/rfc4861#section-6.3.4)

Testing procedure

Expand

sudo dist/tools/tapsetup/tapsetup

In any directory: Set file content of radvd-offl.conf to:

interface tapbr0 {
    AdvSendAdvert on;
    prefix 2001:db8::/32 {
        AdvOnLink off;
    };
};

Run sudo radvd --nodaemon --config=radvd-offl.conf

cd examples/gnrc_networking/
make && make term

In RIOT terminal: command nib route In command output, observe unexpected line 2001:db8::/32 dev #6.

Issues/PRs references

#20757 revealed this bug by adding a feature

xnumad avatar Aug 26 '24 09:08 xnumad

Murdock results

:heavy_check_mark: PASSED

92b77ed944a76439e497d27d7cabf1da014535aa gnrc_ipv6_nib: refactor

Success Failures Total Runtime
10196 0 10197 17m:40s

Artifacts

riot-ci avatar Aug 26 '24 13:08 riot-ci

  • nib route ❌ Currently falsely displays it as on-link (e.g. 2001:db8::/32 dev #6) Should not list it, to reflect the actually used routing logic [1] https://github.com/RIOT-OS/RIOT/blob/0e7636a463894c177a2982fd08f7e02cef83aa89/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c#L653 […] [1] which is correct ("forward the packet to a default router" - https://datatracker.ietf.org/doc/html/rfc4861#section-6.3.4)

I'm confused. RFC 4861 does not say anything about the concept of a forwarding table (which nib route effectively displays). Can you please quote the part of 6.3.4 where the listing of on-link prefixes is explicitly forbidden in forwarding tables? The example you gave, also happens e.g. with iproute2 in Linux:

$ ip -6 route
[...]
fd01:d470:435e:2000::9 dev eth0 proto kernel metric 100 pref medium
fd01:d470:435e:2000::/64 dev eth0 proto ra metric 100 pref medium
[...]

miri64 avatar Aug 26 '24 13:08 miri64

Sorry for the confusion, I meant off-link PLEs (changed the PR title and commit title, can't rename the branch without closing the PR, everything else like PR description is correct)!

Here's the full sentence I quoted in part:

The default behavior (see Section 5.2) when sending a packet to an address for which no information is known about the on-link status of the address is to forward the packet to a default router

I.e. if PIO L-flag was never set in any PIO for the prefix, and therefore _PFX_ON_LINK was never set, then - as I understand - the prefix should be effectively ignored for routing, and the default route shall be simply used. Therefore, it should not be displayed in nib route; esp. not as on-link (like now), ideally not at all.

xnumad avatar Aug 26 '24 14:08 xnumad

Here's the full sentence I quoted in part:

The default behavior (see Section 5.2) when sending a packet to an address for which no information is known about the on-link status of the address is to forward the packet to a default router

This is about sending behavior, not what to show or not to show in a forwarding table. Since with 6LoWPAN, the mesh prefix is always off-link, I am not sure it is a good idea to not list those in the forwarding table (granted RPL would add the downstream addresses that use that prefix anyway, but it would feel weird if the RPL DODAG ID would not show up there).

miri64 avatar Aug 26 '24 15:08 miri64

For a 6LN, the A-flag is still usually set and therefore the prefix is listed in nib prefix. In RIOT, it has only unintentionally begun to be displayed in nib route since #20757.

I think it's wrong that nib route displays it as on-link in when it is nowhere treated as on-link. It just doesn't have a next hop address specified.

For comparison, ip -6 route in Linux (iproute2) does not list such prefixes. (see also L-flag handling)

xnumad avatar Aug 26 '24 17:08 xnumad

For a 6LN, the A-flag is still usually set and therefore the prefix is listed in nib prefix. In RIOT, it has only unintentionally begun to be displayed in nib route since #20757.

Ah ok, if this is something that only showed up recently, then nevermind.

miri64 avatar Aug 27 '24 04:08 miri64

Amended.

xnumad avatar Sep 18 '24 14:09 xnumad