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

Read the DHCP server information from OPTs #12

Merged
merged 1 commit into from
Dec 27, 2023

Conversation

cmol
Copy link
Contributor

@cmol cmol commented Dec 27, 2023

Not all DHCP servers will have the DHCP server address in the header of the offer, but rather in the options. When making the request, this information needs to be added to the request. The request DHCP server and the next hop does not have to be the same address or even be on the same network, so parsing these needs to be separated out.

For now, just copy in the DHCP server address from the OPTs into the read header.

I would appreciate a test of this on one of the existing networks where things have been working prior to this change.

$ tinygo flash -target=pico -opt=1 -stack-size=32kb -size=short -monitor  ./examples/tcpserver/
go: downloading github.com/tinygo-org/pio v0.0.0-20231216154340-cd888eb58899
   code    data     bss |   flash     ram
 569016   15740    5184 |  584756   20924
Connected to /dev/ttyACM0. Press Ctrl-C to exit.
starting program



MAC: 28:cd:c1:0d:93:c7
dhcp ongoing...
time=1970-01-01T00:00:06.968Z level=INFO msg=DHCP:tx msg=Discover
time=1970-01-01T00:00:07.018Z level=INFO msg=DHCP:rx msg=Offer
time=1970-01-01T00:00:07.019Z level=INFO msg=DHCP:tx msg=Request
time=1970-01-01T00:00:07.120Z level=INFO msg=DHCP:rx msg=Ack
DHCP complete IP: 10.0.0.26
start listening on: 10.0.0.26:1234

Not all DHCP servers will have the DHCP server address in the header of
the offer, but rather in the options. When making the request, this
information needs to be added to the request.

For now, just copy in the address from the OPTs into the read header.
@soypat
Copy link
Owner

soypat commented Dec 27, 2023

Thank you Claus! Tested and my DHCP still works as expected!

@soypat soypat merged commit 4af6191 into soypat:main Dec 27, 2023
1 check passed
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