1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

adaptations for lwIP-v1.4 (#5682)

* adaptations for lwIP-v1.4
* add lwIP-v1.4 in CI
This commit is contained in:
david gauchard
2019-01-28 22:31:59 +01:00
committed by GitHub
parent 013d01d743
commit f42bfdfc0d
9 changed files with 83 additions and 21 deletions

View File

@ -182,7 +182,7 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint1
size_t len = pb->len;
#if LWIP_VERSION_MAJOR == 1
// check UdpContext.h
const ip_addr_t* saddr = &current_iphdr_src;
ip_addr_t* saddr = &current_iphdr_src;
#else
// check UdpContext.h
const ip_addr_t* saddr = &ip_data.current_iphdr_src;

View File

@ -1,3 +1,18 @@
#include <lwip/init.h>
#if LWIP_VERSION_MAJOR == 1
void setup() {
Serial.begin(115200);
Serial.println("wifi_softap_add_dhcps_lease() is not implemented with lwIP-v1");
}
void loop() {
}
#else
/* Create a WiFi access point and provide static lease */
#include <ESP8266WiFi.h>
@ -19,9 +34,7 @@ void handleRoot() {
char wifiClientMac[18];
unsigned char number_client;
struct station_info *stat_info;
struct ip4_addr *IPaddress;
IPAddress address;
int i = 1;
number_client = wifi_softap_get_station_num();
@ -31,13 +44,11 @@ void handleRoot() {
result += String(number_client);
result += "</h1></br>";
while (stat_info != NULL) {
IPaddress = &stat_info->ip;
address = IPaddress->addr;
result += "Client ";
result += String(i);
result += " = ";
result += String(address.toString());
result += IPAddress(stat_info->ip).toString();
result += " - ";
sprintf(wifiClientMac, "%02X:%02X:%02X:%02X:%02X:%02X", MAC2STR(stat_info->bssid));
result += wifiClientMac;
@ -93,3 +104,5 @@ void setup() {
void loop() {
server.handleClient();
}
#endif // lwIP-v2

View File

@ -534,7 +534,11 @@ bool ESP8266WiFiSTAClass::hostname(const char* aHostname) {
for (netif* intf = netif_list; intf; intf = intf->next) {
// unconditionally update all known interfaces
#if LWIP_VERSION_MAJOR == 1
intf->hostname = (char*)wifi_station_get_hostname();
#else
intf->hostname = wifi_station_get_hostname();
#endif
if (netif_dhcp_data(intf) != nullptr) {
// renew already started DHCP leases

View File

@ -32,7 +32,7 @@
// cherry pick from lwip1 dns.c/mdns.c source files:
#define DNS_MQUERY_PORT 5353
#define DNS_MQUERY_IPV4_GROUP_INIT ipaddr_addr("224.0.0.251") /* resolver1.opendns.com */
#define DNS_MQUERY_IPV4_GROUP_INIT IPAddress(224,0,0,251) /* resolver1.opendns.com */
#define DNS_RRCLASS_ANY 255 /* any class */
#else // lwIP > 1