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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions stacks/dhcp_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ func (d *DHCPClient) recv(pkt *UDPPacket) (err error) {
if len(opt.Data) == 1 {
msgType = dhcp.MessageType(opt.Data[0])
}
// The DHCP server information does not have to be in the header, but can
// be in the options. Copy into the decoded header for simplicity.
case dhcp.OptServerIdentification:
if len(opt.Data) == 4 {
copy(rcvHdr.SIAddr[:], opt.Data)
}
}
if debugEnabled && !internal.HeapAllocDebugging {
d.stack.debug("DHCP:rx", slog.String("opt", opt.Num.String()), slog.String("data", stringNumList(opt.Data)))
Expand Down
Loading