mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-07 16:23:38 +03:00
AP & dhcp-server: fix uninitialized variables (#7905)
This commit is contained in:
parent
e3fe7a5776
commit
807ed51d0f
@ -1140,16 +1140,9 @@ bool DhcpServer::set_dhcps_lease(struct dhcps_lease *please)
|
||||
// logic below is subject for improvement
|
||||
// - is wrong
|
||||
// - limited to /24 address plans
|
||||
#if 1
|
||||
softap_ip = ip_2_ip4(&_netif->ip_addr)->addr;
|
||||
#else
|
||||
struct ip_info info;
|
||||
bzero(&info, sizeof(struct ip_info));
|
||||
wifi_get_ip_info(SOFTAP_IF, &info);
|
||||
softap_ip = htonl(info.ip.addr);
|
||||
softap_ip = htonl(ip_2_ip4(&_netif->ip_addr)->addr);
|
||||
start_ip = htonl(please->start_ip.addr);
|
||||
end_ip = htonl(please->end_ip.addr);
|
||||
#endif
|
||||
/*config ip information can't contain local ip*/
|
||||
if ((start_ip <= softap_ip) && (softap_ip <= end_ip))
|
||||
{
|
||||
|
@ -224,6 +224,7 @@ bool ESP8266WiFiAPClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPA
|
||||
}
|
||||
|
||||
struct dhcps_lease dhcp_lease;
|
||||
dhcp_lease.enable = true;
|
||||
IPAddress ip = local_ip;
|
||||
ip[3] += 99;
|
||||
dhcp_lease.start_ip.addr = ip.v4();
|
||||
@ -264,8 +265,7 @@ bool ESP8266WiFiAPClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPA
|
||||
DEBUG_WIFI("[APConfig] IP config Invalid?!\n");
|
||||
ret = false;
|
||||
} else if(local_ip.v4() != info.ip.addr) {
|
||||
ip = info.ip.addr;
|
||||
DEBUG_WIFI("[APConfig] IP config not set correct?! new IP: %s\n", ip.toString().c_str());
|
||||
DEBUG_WIFI("[APConfig] IP config not set correct?! new IP: %s\n", IPAddress(info.ip.addr).toString().c_str());
|
||||
ret = false;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user