mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-15 00:02:49 +03:00
IPv6 on esp8266-nonos-sdk and arduino (#5136)
This commit is contained in:
@ -201,10 +201,19 @@ bool ESP8266WiFiAPClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPA
|
||||
}
|
||||
bool ret = true;
|
||||
|
||||
if ( !local_ip.isV4()
|
||||
|| !subnet.isV4()
|
||||
#if LWIP_IPV6
|
||||
// uninitialized gateway is valid
|
||||
|| gateway.isV6()
|
||||
#endif
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
struct ip_info info;
|
||||
info.ip.addr = static_cast<uint32_t>(local_ip);
|
||||
info.gw.addr = static_cast<uint32_t>(gateway);
|
||||
info.netmask.addr = static_cast<uint32_t>(subnet);
|
||||
info.ip.addr = local_ip.v4();
|
||||
info.gw.addr = gateway.v4();
|
||||
info.netmask.addr = subnet.v4();
|
||||
|
||||
if(!wifi_softap_dhcps_stop()) {
|
||||
DEBUG_WIFI("[APConfig] wifi_softap_dhcps_stop failed!\n");
|
||||
@ -218,11 +227,11 @@ bool ESP8266WiFiAPClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPA
|
||||
struct dhcps_lease dhcp_lease;
|
||||
IPAddress ip = local_ip;
|
||||
ip[3] += 99;
|
||||
dhcp_lease.start_ip.addr = static_cast<uint32_t>(ip);
|
||||
dhcp_lease.start_ip.addr = ip.v4();
|
||||
DEBUG_WIFI("[APConfig] DHCP IP start: %s\n", ip.toString().c_str());
|
||||
|
||||
ip[3] += 100;
|
||||
dhcp_lease.end_ip.addr = static_cast<uint32_t>(ip);
|
||||
dhcp_lease.end_ip.addr = ip.v4();
|
||||
DEBUG_WIFI("[APConfig] DHCP IP end: %s\n", ip.toString().c_str());
|
||||
|
||||
if(!wifi_softap_set_dhcps_lease(&dhcp_lease)) {
|
||||
@ -252,7 +261,7 @@ bool ESP8266WiFiAPClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPA
|
||||
if(info.ip.addr == 0x00000000) {
|
||||
DEBUG_WIFI("[APConfig] IP config Invalid?!\n");
|
||||
ret = false;
|
||||
} else if(local_ip != info.ip.addr) {
|
||||
} 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());
|
||||
ret = false;
|
||||
|
Reference in New Issue
Block a user