Skip to content

sys/net/dhcpv6: Add IA_NA support to the DHCPv6 client#16228

Merged
miri64 merged 2 commits intoRIOT-OS:masterfrom
JKRhb:dhcp-ia-na
Aug 11, 2021
Merged

sys/net/dhcpv6: Add IA_NA support to the DHCPv6 client#16228
miri64 merged 2 commits intoRIOT-OS:masterfrom
JKRhb:dhcp-ia-na

Conversation

@JKRhb
Copy link
Copy Markdown
Member

@JKRhb JKRhb commented Mar 24, 2021

Contribution description

This PR adds identity association for non-temporary addresses (IA_NA) to the DHCPv6 client and makes it possible to use the auto_init_dhcpv6_client module for auto configuring it.

While requesting a non-temporary address already works (see below), the implementation is probably not finished yet as I wasn't entirely sure how to correctly add the obtained address to the respective net interface and where to remove them if their lifetime passes. There also some other aspects which I wasn't quite sure about (the relevant lines on IA_NA in _nib-slaac.c for example) and code passages that probably need refactoring.

I would be very grateful to receive some feedback on this and hope that this PR is not too far away from a mergeable state.

Testing procedure

You can use the provided test under tests/gnrc_dhcpv6_client_auto_init to test the correct assignment of a non-temporary IPv6 address. You can run it by first using make all and then sudo make test-as-root.

For the test procedure, the existing test under tests/gnrc_dhcpv6_client_6lbr was adapted, which uses the Python library scapy.

@miri64 miri64 added Area: network Area: Networking State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Mar 25, 2021
@miri64
Copy link
Copy Markdown
Member

miri64 commented Mar 25, 2021

For a mesh you probably need a DHCPv6 Relay implementation first to have other nodes than the border router receive an address, right?

Other than that, I can have a look at the code soon™ (currently I have to do some other stuff first, so not much time sadly)

@JKRhb
Copy link
Copy Markdown
Member Author

JKRhb commented Mar 25, 2021

For a mesh you probably need a DHCPv6 Relay implementation first to have other nodes than the border router receive an address, right?

Oh, yes, very good point! I have to admit that so far I focused primarily on the use case of a "regular" device that requests an address via DHCPv6. But making it work for 6LoWPAN should of course be part of this PR eventually. The border router act as the relay agent in this scenario, right? Do you think the relay agent functionality should be a seperate module or could it be integrated into the existing DHCPv6 client?

Edit: Hmm, or should there be a seperate PR to implement the relay agent?

Other than that, I can have a look at the code soon™ (currently I have to do some other stuff first, so not much time sadly)

No worries, thank you already :) I will continue to work on this PR – hopefully the code will be a bit more refined once you have time to look at it.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Mar 25, 2021

The border router act as the relay agent in this scenario, right?

The border router, yes, but also any router (6LR) between the border router and a leaf node when having a multihop network, as DHCPv6 is link-local only.

Do you think the relay agent functionality should be a seperate module or could it be integrated into the existing DHCPv6 client?

IMHO this should be a separate module (that should reuse client-like behavior from the client) and a separate PR for that matter, otherwise the focus of this PR can easily get out of hands ;-).

miri64
miri64 previously requested changes Mar 30, 2021
@JKRhb
Copy link
Copy Markdown
Member Author

JKRhb commented May 2, 2021

@miri64 Making some small additions and updating the tests, I resumed working on this PR again now :) Maybe you could have a quick look to assess how much there is missing for this PR to be merged?

@miri64 miri64 dismissed their stale review May 3, 2021 08:48

Will do. However, I don't have much time this week. So for now, I dismiss my change request, as the comment was addressed.

@github-actions github-actions bot added Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration Area: sys Area: System Area: tests Area: tests and testing framework labels Jun 7, 2021
@JKRhb
Copy link
Copy Markdown
Member Author

JKRhb commented Jun 7, 2021

I think I managed to make the implementation more stack-independent now. I also added the dhcpv6_client_req_ia_na function to the test under gnrc_dhcpv6_client to be able to test both the auto initialization and the "manual" case.

There might be still room for improvement, however. Should I maybe highlight the passages I am a bit uncertain about to make reviewing them a bit easier?

@JKRhb
Copy link
Copy Markdown
Member Author

JKRhb commented Jun 21, 2021

@miri64 Sorry to bother you, but can you estimate when you might have the time for a review? Should I maybe highlight the probably most critical portions as suggested in my last comment?

@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 22, 2021
@miri64
Copy link
Copy Markdown
Member

miri64 commented Jun 22, 2021

Should I maybe highlight the probably most critical portions as suggested in my last comment?

That would be great. Probably next week at the latest I will finally have some time to have a look!

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial review.

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Murdock had a complaint. Please squash and rebase (to resolve merge conflicts due to the merging of #16606) [edit: to my surprise there were none] immediately.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Aug 11, 2021

Please squash ;-).

@miri64
Copy link
Copy Markdown
Member

miri64 commented Aug 11, 2021

tests: Add test for DHCPv6 IA_NA and auto_init

While you are at it, I think the commit message for the test needs an update ;-)

@JKRhb
Copy link
Copy Markdown
Member Author

JKRhb commented Aug 11, 2021

Please squash ;-).

Ehem, done ;)

@JKRhb
Copy link
Copy Markdown
Member Author

JKRhb commented Aug 11, 2021

tests: Add test for DHCPv6 IA_NA and auto_init

While you are at it, I think the commit message for the test needs an update ;-)

Done :) I hope the new commit message is okay

@miri64
Copy link
Copy Markdown
Member

miri64 commented Aug 11, 2021

Done :) I hope the new commit message is okay

@JKRhb
Copy link
Copy Markdown
Member Author

JKRhb commented Aug 11, 2021

Running the test for gnrc_dhcpv6_client_6lbr locally I am afraid there is another error incoming:

ISO C forbids zero-size array ‘addr_leases’

I think it might be the easiest to just add another definition like CONFIG_DHCPV6_CLIENT_ADDRS that is used for calculating CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF. I will make such a suggestion in another fixup commit. Sorry that this PR is causing so much hassle.

@JKRhb
Copy link
Copy Markdown
Member Author

JKRhb commented Aug 11, 2021

I guess with the latest addition the tests should pass now. Let me know if there is anything that should be changed.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Aug 11, 2021

I think it might be the easiest to just add another definition like CONFIG_DHCPV6_CLIENT_ADDRS that is used for calculating CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF. I will make such a suggestion in another fixup commit. Sorry that this PR is causing so much hassle.

With my latest proposals, the situation should be less confusing for a user.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Aug 11, 2021

Don't forget about #16228 (comment) ;-)

@JKRhb
Copy link
Copy Markdown
Member Author

JKRhb commented Aug 11, 2021

Don't forget about #16228 (comment) ;-)

Ahem, should be fixed now :)

@miri64
Copy link
Copy Markdown
Member

miri64 commented Aug 11, 2021

Here. We. Go. 🎉

@miri64 miri64 merged commit f2f6700 into RIOT-OS:master Aug 11, 2021
@JKRhb JKRhb deleted the dhcp-ia-na branch August 11, 2021 19:08
@JKRhb
Copy link
Copy Markdown
Member Author

JKRhb commented Aug 11, 2021

Here. We. Go. 🎉

Yay! \o/ Thank you so much for help and feedback along the way :)

@benpicco benpicco added this to the Release 2021.10 milestone Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system Area: Kconfig Area: Kconfig integration Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants