Skip to content

Ethernet Library spam - fixes #2571 / #985 #2642

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

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 10 additions & 2 deletions libraries/Ethernet/src/Dhcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int DhcpClass::request_DHCP_lease(){
}
if(_dhcpT2 == 0){
//T2 should be 87.5% (7/8ths) of _dhcpLeaseTime
_dhcpT2 = _dhcpT1 << 1;
_dhcpT2 = _dhcpLeaseTime*7/8;
}
_renewInSec = _dhcpT1;
_rebindInSec = _dhcpT2;
Expand Down Expand Up @@ -201,7 +201,15 @@ void DhcpClass::send_DHCP_MESSAGE(uint8_t messageType, uint16_t secondsElapsed)
buffer[8] = 0x07;
buffer[9] = 0x01;
memcpy(buffer + 10, _dhcpMacAddr, 6);

// SurferTim added
if(messageType == DHCP_REQUEST)
{
buffer[12] = _dhcpLocalIp[0];
buffer[13] = _dhcpLocalIp[1];
buffer[14] = _dhcpLocalIp[2];
buffer[15] = _dhcpLocalIp[3];
}
// end SurferTim added
// OPT - host name
buffer[16] = hostName;
buffer[17] = strlen(HOST_NAME) + 6; // length of hostname + last 3 bytes of mac address
Expand Down