Skip to content

Commit c735fd4

Browse files
committed
Dhcp.cpp - fix reset_DHCP_lease()
1 parent 89788e3 commit c735fd4

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Dhcp.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ int DhcpClass::beginWithDHCP(uint8_t *mac, unsigned long timeout, unsigned long
2424
}
2525

2626
void DhcpClass::reset_DHCP_lease(){
27-
// zero out _dhcpSubnetMask, _dhcpGatewayIp, _dhcpLocalIp, _dhcpDhcpServerIp, _dhcpDnsServerIp
28-
memset(_dhcpLocalIp, 0, 20);
27+
memset(_dhcpLocalIp, 0, 4);
28+
memset(_dhcpSubnetMask, 0, 4);
29+
memset(_dhcpGatewayIp, 0, 4);
30+
memset(_dhcpDhcpServerIp, 0, 4);
31+
memset(_dhcpDnsServerIp, 0, 4);
2932
}
3033

3134
//return:0 on error, 1 if request is sent and response is received

src/Dhcp.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,19 @@ class DhcpClass {
141141
uint32_t _dhcpInitialTransactionId;
142142
uint32_t _dhcpTransactionId;
143143
uint8_t _dhcpMacAddr[6];
144+
#ifdef __arm__
145+
uint8_t _dhcpLocalIp[4] __attribute__((aligned(4)));
146+
uint8_t _dhcpSubnetMask[4] __attribute__((aligned(4)));
147+
uint8_t _dhcpGatewayIp[4] __attribute__((aligned(4)));
148+
uint8_t _dhcpDhcpServerIp[4] __attribute__((aligned(4)));
149+
uint8_t _dhcpDnsServerIp[4] __attribute__((aligned(4)));
150+
#else
144151
uint8_t _dhcpLocalIp[4];
145152
uint8_t _dhcpSubnetMask[4];
146153
uint8_t _dhcpGatewayIp[4];
147154
uint8_t _dhcpDhcpServerIp[4];
148155
uint8_t _dhcpDnsServerIp[4];
156+
#endif
149157
uint32_t _dhcpLeaseTime;
150158
uint32_t _dhcpT1, _dhcpT2;
151159
signed long _renewInSec;

0 commit comments

Comments
 (0)