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

dhcpcd: Respect IPV6_PREFERRED_ONLY flag regardless of state #307

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

taoyl-g
Copy link
Contributor

@taoyl-g taoyl-g commented Mar 12, 2024

Current IPv6_PREFERRED_ONLY (option 108) handling code is only effective when current state is DHS_DISCOVER or DHS_REBOOT. However the assumption that we'll only receive OFFER and ACK with option 108 in those two states is not true. Particularly, when we receive multiple ACKs upon our REQUEST, the first ACK will trigger the use_v6only code path and dhcp_drop() us into DHS_NONE state, therefore the option 108 on second ACK won't be handled correctly and we'll bind to the lease incorrectly.

DHS_NONE is not the only possible state, considering the corner cases of server configuration change and multiple servers. Thus we should just remove the state check here.

Copy link
Member

@rsmarples rsmarples left a comment

Choose a reason for hiding this comment

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

https://datatracker.ietf.org/doc/html/rfc8925#section-3.2

If the client is in any other state, it SHOULD continue to use the assigned IPv4 address until further DHCPv4 reconfiguration events.

So we need to add the NONE state to the list, not just remove the list.

Current IPv6_PREFERRED_ONLY (option 108) handling code is only effective
when current state is DHS_DISCOVER and DHS_REBOOT. However, when we
receive multiple ACKs upon our REQUEST, the first ACK will trigger the
use_v6only code path and dhcp_drop() us into DHS_NONE state, as a result
the option 108 on the second ACK won't be handled correctly and we'll
bind to the lease instead.

This patch fixes the issue by adding DHS_NONE as a state to respect
option 108 as well.
@taoyl-g
Copy link
Contributor Author

taoyl-g commented Apr 2, 2024

Thanks for the RFC pointer. I've updated the patch.

@rsmarples rsmarples merged commit faa3f54 into NetworkConfiguration:master Apr 2, 2024
3 of 5 checks passed
@rsmarples
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants