Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: ipv6: Improve DAD/MLD behavior on interface down/up #72587

Merged

Conversation

rlubos
Copy link
Contributor

@rlubos rlubos commented May 10, 2024

We generally need to improve IPv6 test coverage, involving test cases when interface goes down/up, but opening a PR early with a few fixes for issues spotted when testing manually.

In case a network interface is brought down and back up, DAD was not
performed for link-local unicast address.

This happens because the logic in the network interface code assumed
that DAD for link-local address is triggered when the address is added,
and it's explicitly omited when looping over IPv6 address. This wasn't
the case however when interface was brought back up, as the address was
already present on the interface, hence DAD skipped.

In Linux, the link-local address is removed from the interface when the
interface is brought down. Such approach solves the issue described,
hence implement it in a similar way in Zephyr.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When bringing interface down, all IPv6 multicast addresses are removed
from the interface. However, when the interface was brought back up,
rejoin_ipv6_mcast_groups() would look only for solicited node mcast
addresses already present on the interface. In result, after going back
up, the interface was missing solicited-node mcast addresses for those
unicast addresses, that were already present on the interface when
bringing up.

As net_ipv6_mld_join() does similar checks to skip MLD when not needed,
we can just skip the lookup when rejoining, and use already defined
join_mcast_nodes().

Additionally, check for IPV6 and NO_ND flags on the interface before
attempting to add the address back, those multicast addresses are not
needed if ND is disabled on the interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
pdgendt
pdgendt previously approved these changes May 13, 2024
jukkar
jukkar previously approved these changes May 13, 2024
When the network inteface goes operational DOWN (for example cable
unplugged), clear "joined" flag on all registered multicast addresses,
so that MLD report is sent for them when the interface goes back up.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
@rlubos rlubos dismissed stale reviews from jukkar and pdgendt via 90c6940 May 13, 2024 07:31
@rlubos rlubos force-pushed the net/ipv6-missing-dad-and-mcast-addresses branch from 120d8d1 to 90c6940 Compare May 13, 2024 07:31
pdgendt
pdgendt previously approved these changes May 13, 2024
jukkar
jukkar previously approved these changes May 13, 2024
@rlubos rlubos dismissed stale reviews from jukkar and pdgendt via 714dfd5 May 13, 2024 08:37
@rlubos
Copy link
Contributor Author

rlubos commented May 13, 2024

Sorry for another push, DHCP tests needed fixing too.

pdgendt
pdgendt previously approved these changes May 13, 2024
The test suite assigns LL address to the interface manually, hence need
to reapply it whenever interface goes up.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
@rlubos rlubos force-pushed the net/ipv6-missing-dad-and-mcast-addresses branch from 714dfd5 to fc0be1d Compare May 13, 2024 08:46
@nashif nashif merged commit fab2f97 into zephyrproject-rtos:main May 14, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants