mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-09 03:41:41 +03:00
adaptations for lwIP-v1.4 (#5682)
* adaptations for lwIP-v1.4 * add lwIP-v1.4 in CI
This commit is contained in:
parent
013d01d743
commit
f42bfdfc0d
11
.travis.yml
11
.travis.yml
@ -65,6 +65,17 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
- BUILD_PARITY=odd
|
- BUILD_PARITY=odd
|
||||||
|
|
||||||
|
- name: "Build lwIP-v1.4 (1)"
|
||||||
|
stage: build
|
||||||
|
script: $TRAVIS_BUILD_DIR/tests/build1.sh
|
||||||
|
env:
|
||||||
|
- BUILD_PARITY=even
|
||||||
|
- name: "Build lwIP-v1.4 (2)"
|
||||||
|
stage: build
|
||||||
|
script: $TRAVIS_BUILD_DIR/tests/build1.sh
|
||||||
|
env:
|
||||||
|
- BUILD_PARITY=odd
|
||||||
|
|
||||||
- name: "Host tests"
|
- name: "Host tests"
|
||||||
stage: build
|
stage: build
|
||||||
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
|
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
|
||||||
|
@ -35,9 +35,12 @@
|
|||||||
#define IP_IS_V4_VAL(x) (1)
|
#define IP_IS_V4_VAL(x) (1)
|
||||||
#define IP_SET_TYPE_VAL(x,y) do { (void)0; } while (0)
|
#define IP_SET_TYPE_VAL(x,y) do { (void)0; } while (0)
|
||||||
#define IP_ANY_TYPE (&ip_addr_any)
|
#define IP_ANY_TYPE (&ip_addr_any)
|
||||||
|
#define IP4_ADDR_ANY IPADDR_ANY
|
||||||
#define IP4_ADDR_ANY4 IPADDR_ANY
|
#define IP4_ADDR_ANY4 IPADDR_ANY
|
||||||
#define IPADDR4_INIT(x) { x }
|
#define IPADDR4_INIT(x) { x }
|
||||||
#define CONST /* nothing: lwIP-v1 does not use const */
|
#define CONST /* nothing: lwIP-v1 does not use const */
|
||||||
|
#define ip4_addr_netcmp ip_addr_netcmp
|
||||||
|
#define netif_dhcp_data(netif) ((netif)->dhcp)
|
||||||
#else // lwIP-v2+
|
#else // lwIP-v2+
|
||||||
#define CONST const
|
#define CONST const
|
||||||
#if !LWIP_IPV6
|
#if !LWIP_IPV6
|
||||||
|
@ -182,7 +182,7 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint1
|
|||||||
size_t len = pb->len;
|
size_t len = pb->len;
|
||||||
#if LWIP_VERSION_MAJOR == 1
|
#if LWIP_VERSION_MAJOR == 1
|
||||||
// check UdpContext.h
|
// check UdpContext.h
|
||||||
const ip_addr_t* saddr = ¤t_iphdr_src;
|
ip_addr_t* saddr = ¤t_iphdr_src;
|
||||||
#else
|
#else
|
||||||
// check UdpContext.h
|
// check UdpContext.h
|
||||||
const ip_addr_t* saddr = &ip_data.current_iphdr_src;
|
const ip_addr_t* saddr = &ip_data.current_iphdr_src;
|
||||||
|
@ -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 */
|
/* Create a WiFi access point and provide static lease */
|
||||||
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
@ -19,9 +34,7 @@ void handleRoot() {
|
|||||||
char wifiClientMac[18];
|
char wifiClientMac[18];
|
||||||
unsigned char number_client;
|
unsigned char number_client;
|
||||||
struct station_info *stat_info;
|
struct station_info *stat_info;
|
||||||
struct ip4_addr *IPaddress;
|
|
||||||
|
|
||||||
IPAddress address;
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
number_client = wifi_softap_get_station_num();
|
number_client = wifi_softap_get_station_num();
|
||||||
@ -31,13 +44,11 @@ void handleRoot() {
|
|||||||
result += String(number_client);
|
result += String(number_client);
|
||||||
result += "</h1></br>";
|
result += "</h1></br>";
|
||||||
while (stat_info != NULL) {
|
while (stat_info != NULL) {
|
||||||
IPaddress = &stat_info->ip;
|
|
||||||
address = IPaddress->addr;
|
|
||||||
|
|
||||||
result += "Client ";
|
result += "Client ";
|
||||||
result += String(i);
|
result += String(i);
|
||||||
result += " = ";
|
result += " = ";
|
||||||
result += String(address.toString());
|
result += IPAddress(stat_info->ip).toString();
|
||||||
result += " - ";
|
result += " - ";
|
||||||
sprintf(wifiClientMac, "%02X:%02X:%02X:%02X:%02X:%02X", MAC2STR(stat_info->bssid));
|
sprintf(wifiClientMac, "%02X:%02X:%02X:%02X:%02X:%02X", MAC2STR(stat_info->bssid));
|
||||||
result += wifiClientMac;
|
result += wifiClientMac;
|
||||||
@ -93,3 +104,5 @@ void setup() {
|
|||||||
void loop() {
|
void loop() {
|
||||||
server.handleClient();
|
server.handleClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // lwIP-v2
|
||||||
|
@ -534,7 +534,11 @@ bool ESP8266WiFiSTAClass::hostname(const char* aHostname) {
|
|||||||
for (netif* intf = netif_list; intf; intf = intf->next) {
|
for (netif* intf = netif_list; intf; intf = intf->next) {
|
||||||
|
|
||||||
// unconditionally update all known interfaces
|
// unconditionally update all known interfaces
|
||||||
|
#if LWIP_VERSION_MAJOR == 1
|
||||||
|
intf->hostname = (char*)wifi_station_get_hostname();
|
||||||
|
#else
|
||||||
intf->hostname = wifi_station_get_hostname();
|
intf->hostname = wifi_station_get_hostname();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (netif_dhcp_data(intf) != nullptr) {
|
if (netif_dhcp_data(intf) != nullptr) {
|
||||||
// renew already started DHCP leases
|
// renew already started DHCP leases
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
// cherry pick from lwip1 dns.c/mdns.c source files:
|
// cherry pick from lwip1 dns.c/mdns.c source files:
|
||||||
#define DNS_MQUERY_PORT 5353
|
#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 */
|
#define DNS_RRCLASS_ANY 255 /* any class */
|
||||||
|
|
||||||
#else // lwIP > 1
|
#else // lwIP > 1
|
||||||
|
22
tests/build1.sh
Executable file
22
tests/build1.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cache_dir=$(mktemp -d)
|
||||||
|
|
||||||
|
source "$TRAVIS_BUILD_DIR"/tests/common.sh
|
||||||
|
|
||||||
|
if [ -z "$BUILD_PARITY" ]; then
|
||||||
|
mod=1
|
||||||
|
rem=0
|
||||||
|
elif [ "$BUILD_PARITY" = "even" ]; then
|
||||||
|
mod=2
|
||||||
|
rem=0
|
||||||
|
elif [ "$BUILD_PARITY" = "odd" ]; then
|
||||||
|
mod=2
|
||||||
|
rem=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
install_arduino nodebug
|
||||||
|
build_sketches_with_arduino "$mod" "$rem" hb1
|
||||||
|
|
||||||
|
rm -rf "$cache_dir"
|
||||||
|
|
@ -280,7 +280,7 @@ bool wifi_station_get_config_default (struct station_config *config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char wifi_station_get_hostname_str [128];
|
char wifi_station_get_hostname_str [128];
|
||||||
char* wifi_station_get_hostname (void)
|
const char* wifi_station_get_hostname (void)
|
||||||
{
|
{
|
||||||
return strcpy(wifi_station_get_hostname_str, "esposix");
|
return strcpy(wifi_station_get_hostname_str, "esposix");
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ bool wifi_station_set_config_current (struct station_config *config)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wifi_station_set_hostname (char *name)
|
bool wifi_station_set_hostname (const char *name)
|
||||||
{
|
{
|
||||||
(void)name;
|
(void)name;
|
||||||
return true;
|
return true;
|
||||||
|
@ -54,12 +54,13 @@ while true; do
|
|||||||
Which build?
|
Which build?
|
||||||
1. main
|
1. main
|
||||||
2. main + IPv6
|
2. main + IPv6
|
||||||
3. debug even
|
3. main with lwIP-v1.4
|
||||||
4. debug odd
|
4. debug even
|
||||||
5. platformio
|
5. debug odd
|
||||||
6. package
|
6. platformio
|
||||||
7. host
|
7. package
|
||||||
8. style
|
8. host
|
||||||
|
9. style
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
read ans
|
read ans
|
||||||
@ -68,12 +69,13 @@ EOF
|
|||||||
case "$ans" in
|
case "$ans" in
|
||||||
1) BUILD_TYPE=build;;
|
1) BUILD_TYPE=build;;
|
||||||
2) BUILD_TYPE=build6;;
|
2) BUILD_TYPE=build6;;
|
||||||
3) BUILD_TYPE=debug_even;;
|
3) BUILD_TYPE=build1;;
|
||||||
4) BUILD_TYPE=debug_odd;;
|
4) BUILD_TYPE=debug_even;;
|
||||||
5) BUILD_TYPE=platformio;;
|
5) BUILD_TYPE=debug_odd;;
|
||||||
6) BUILD_TYPE=package;;
|
6) BUILD_TYPE=platformio;;
|
||||||
7) BUILD_TYPE=host;;
|
7) BUILD_TYPE=package;;
|
||||||
8) BUILD_TYPE=style;;
|
8) BUILD_TYPE=host;;
|
||||||
|
9) BUILD_TYPE=style;;
|
||||||
esac
|
esac
|
||||||
test -z "$BUILD_TYPE" || break
|
test -z "$BUILD_TYPE" || break
|
||||||
done
|
done
|
||||||
@ -105,6 +107,13 @@ elif [ "$BUILD_TYPE" = "build6_even" ]; then
|
|||||||
elif [ "$BUILD_TYPE" = "build6_odd" ]; then
|
elif [ "$BUILD_TYPE" = "build6_odd" ]; then
|
||||||
BUILD_PARITY=odd tests/build6.sh
|
BUILD_PARITY=odd tests/build6.sh
|
||||||
|
|
||||||
|
elif [ "$BUILD_TYPE" = "build1" ]; then
|
||||||
|
tests/build1.sh
|
||||||
|
elif [ "$BUILD_TYPE" = "build1_even" ]; then
|
||||||
|
BUILD_PARITY=even tests/build1.sh
|
||||||
|
elif [ "$BUILD_TYPE" = "build1_odd" ]; then
|
||||||
|
BUILD_PARITY=odd tests/build1.sh
|
||||||
|
|
||||||
elif [ "$BUILD_TYPE" = "platformio" ]; then
|
elif [ "$BUILD_TYPE" = "platformio" ]; then
|
||||||
tests/platformio-custom.sh
|
tests/platformio-custom.sh
|
||||||
elif [ "$BUILD_TYPE" = "platformio_even" ]; then
|
elif [ "$BUILD_TYPE" = "platformio_even" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user