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/ip/dhcpv4: Set source IP address for DHCP renewal requests #15179

Merged
merged 1 commit into from
Apr 17, 2019

Conversation

pfl
Copy link
Collaborator

@pfl pfl commented Apr 4, 2019

The source address in unicast DHCPv4 Request packets was found out
to be all zeros address 0.0.0.0. This address is only acceptable if
the destination is a multicast one, where the host in question is
acquiring a DHCP address lease. This is true for the DHCP Discover
and the initial DHCP Request message from the client towards the
server. As subsequent DHCP Request renewal messages are sent as
unicast to the server, the server will drop such packets.

Fix this issue by explicitely specifying what source IP address is
to be used, if none is specified, the all zeros address 0.0.0.0 is
used in multicast addresses. The source address in the other
unicast cases is identical to the 'ciaddr' in the DHCP message.

Signed-off-by: Patrik Flykt [email protected]

@pfl pfl added the bug The issue is a bug, or the PR is fixing a bug label Apr 4, 2019
@pfl pfl requested review from jukkar, tbursztyka and rveerama1 April 4, 2019 04:41
@pfl pfl requested a review from pfalcon as a code owner April 4, 2019 04:41
Copy link
Collaborator

@tbursztyka tbursztyka left a comment

Choose a reason for hiding this comment

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

small issues

subsys/net/ip/dhcpv4.c Outdated Show resolved Hide resolved
subsys/net/ip/dhcpv4.c Outdated Show resolved Hide resolved
subsys/net/ip/dhcpv4.c Outdated Show resolved Hide resolved
subsys/net/ip/dhcpv4.c Outdated Show resolved Hide resolved
subsys/net/ip/dhcpv4.c Outdated Show resolved Hide resolved
subsys/net/ip/dhcpv4.c Outdated Show resolved Hide resolved
The source address in unicast DHCPv4 Request packets was found out
to be all zeros address 0.0.0.0. This address is only acceptable if
the destination is a multicast one, where the host in question is
acquiring a DHCP address lease. This is true for the DHCP Discover
and the initial DHCP Request message from the client towards the
server. As subsequent DHCP Request renewal messages are sent as
unicast to the server, the server will drop such packets.

Fix this issue by explicitely specifying what source IP address is
to be used, if none is specified, the all zeros address 0.0.0.0 is
used in multicast addresses. The source address in the other
unicast cases is identical to the 'ciaddr' in the DHCP message.

Signed-off-by: Patrik Flykt <[email protected]>
@pfl pfl force-pushed the dhcp_client_address branch from 7113b9a to 5aed333 Compare April 4, 2019 15:46
@pfl
Copy link
Collaborator Author

pfl commented Apr 4, 2019

To clarify: Linux user space never sees the DHCP Request messages sent with source address 0.0.0.0. It will eventually work, as the Zephyr DHCP client restarts the address acquisition procedure with a DHCP Discover, but depending on the situation and DHCP servers involved, Zephyr might loose its address in between or get a new one assigned due to restarting of the DHCP procedure.

@pfl
Copy link
Collaborator Author

pfl commented Apr 11, 2019

It would probably be a good idea to get this merged, I'd guess users would need this fix in the LTS anyway later.

Copy link
Contributor

@pfalcon pfalcon left a comment

Choose a reason for hiding this comment

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

This looks like a clean fix, and probably would (severely) affect production, long-running devices. @pfl, Please post a bug describing that case, and add "Fixes: " header to commit, to satisfy conditions for its inclusion in the release.

@pfalcon pfalcon changed the title net/ip/dhcpv4: Set source IP address in DHCP Request net/ip/dhcpv4: Set source IP address for DHCP renewal requests Apr 16, 2019
@galak galak merged commit 91ca8aa into zephyrproject-rtos:master Apr 17, 2019
@pfl
Copy link
Collaborator Author

pfl commented May 8, 2019

Bug is #16012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants