Skip to content
Merged
Changes from 1 commit
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: 5 additions & 1 deletion src/socket/dhcpv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ struct RequestState {
server: ServerInfo,
/// IP address that we're trying to request.
requested_ip: Ipv4Address,
/// Transaction ID from server's `Offer` message
offer_transaction_id: u32,
Copy link
Member

Choose a reason for hiding this comment

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

this field is redundant. We know the xid of DHCPOFFER is the same as the xid of DHCPDISCOVER, which is stored in the Socket.transaction_id field.

}

#[derive(Debug)]
Expand Down Expand Up @@ -379,6 +381,7 @@ impl<'a> Socket<'a> {
identifier: server_identifier,
},
requested_ip: dhcp_repr.your_ip, // use the offered ip
offer_transaction_id: dhcp_repr.transaction_id,
});
}
(ClientState::Requesting(state), DhcpMessageType::Ack) => {
Expand Down Expand Up @@ -652,6 +655,7 @@ impl<'a> Socket<'a> {
dhcp_repr.message_type = DhcpMessageType::Request;
dhcp_repr.requested_ip = Some(state.requested_ip);
dhcp_repr.server_identifier = Some(state.server.identifier);
dhcp_repr.transaction_id = state.offer_transaction_id;

net_debug!(
"DHCP send request to {}: {:?}",
Expand All @@ -666,7 +670,7 @@ impl<'a> Socket<'a> {
+ (self.retry_config.initial_request_timeout << (state.retry as u32 / 2));
state.retry += 1;

self.transaction_id = next_transaction_id;
self.transaction_id = state.offer_transaction_id;
Ok(())
}
ClientState::Renewing(state) => {
Expand Down
Loading