mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-27 21:16:50 +03:00
lwip2: (re)fix setting static ip address (#6194)
This commit is contained in:
parent
9f03bbb8c3
commit
59db907647
@ -309,6 +309,13 @@ bool ESP8266WiFiSTAClass::config(IPAddress local_ip, IPAddress arg1, IPAddress a
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LWIP_VERSION_MAJOR != 1 && !CORE_MOCK
|
||||||
|
// get current->previous IP address
|
||||||
|
// (check below)
|
||||||
|
struct ip_info previp;
|
||||||
|
wifi_get_ip_info(STATION_IF, &previp);
|
||||||
|
#endif
|
||||||
|
|
||||||
struct ip_info info;
|
struct ip_info info;
|
||||||
info.ip.addr = local_ip.v4();
|
info.ip.addr = local_ip.v4();
|
||||||
info.gw.addr = gateway.v4();
|
info.gw.addr = gateway.v4();
|
||||||
@ -334,6 +341,8 @@ bool ESP8266WiFiSTAClass::config(IPAddress local_ip, IPAddress arg1, IPAddress a
|
|||||||
#if LWIP_VERSION_MAJOR != 1 && !CORE_MOCK
|
#if LWIP_VERSION_MAJOR != 1 && !CORE_MOCK
|
||||||
// trigger address change by calling lwIP-v1.4 api
|
// trigger address change by calling lwIP-v1.4 api
|
||||||
// (see explanation above)
|
// (see explanation above)
|
||||||
|
// only when ip is already set by other mean (generally dhcp)
|
||||||
|
if (previp.ip.addr != 0 && previp.ip.addr != info.ip.addr)
|
||||||
netif_set_addr(eagle_lwip_getif(STATION_IF), &info.ip, &info.netmask, &info.gw);
|
netif_set_addr(eagle_lwip_getif(STATION_IF), &info.ip, &info.netmask, &info.gw);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user