mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-03 07:02:28 +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:
|
||||
- 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"
|
||||
stage: build
|
||||
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
|
||||
|
@ -35,9 +35,12 @@
|
||||
#define IP_IS_V4_VAL(x) (1)
|
||||
#define IP_SET_TYPE_VAL(x,y) do { (void)0; } while (0)
|
||||
#define IP_ANY_TYPE (&ip_addr_any)
|
||||
#define IP4_ADDR_ANY IPADDR_ANY
|
||||
#define IP4_ADDR_ANY4 IPADDR_ANY
|
||||
#define IPADDR4_INIT(x) { x }
|
||||
#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+
|
||||
#define CONST const
|
||||
#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;
|
||||
#if LWIP_VERSION_MAJOR == 1
|
||||
// check UdpContext.h
|
||||
const ip_addr_t* saddr = ¤t_iphdr_src;
|
||||
ip_addr_t* saddr = ¤t_iphdr_src;
|
||||
#else
|
||||
// check UdpContext.h
|
||||
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 */
|
||||
|
||||
#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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
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 (void)
|
||||
const char* wifi_station_get_hostname (void)
|
||||
{
|
||||
return strcpy(wifi_station_get_hostname_str, "esposix");
|
||||
}
|
||||
@ -312,7 +312,7 @@ bool wifi_station_set_config_current (struct station_config *config)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wifi_station_set_hostname (char *name)
|
||||
bool wifi_station_set_hostname (const char *name)
|
||||
{
|
||||
(void)name;
|
||||
return true;
|
||||
|
@ -54,12 +54,13 @@ while true; do
|
||||
Which build?
|
||||
1. main
|
||||
2. main + IPv6
|
||||
3. debug even
|
||||
4. debug odd
|
||||
5. platformio
|
||||
6. package
|
||||
7. host
|
||||
8. style
|
||||
3. main with lwIP-v1.4
|
||||
4. debug even
|
||||
5. debug odd
|
||||
6. platformio
|
||||
7. package
|
||||
8. host
|
||||
9. style
|
||||
EOF
|
||||
|
||||
read ans
|
||||
@ -68,12 +69,13 @@ EOF
|
||||
case "$ans" in
|
||||
1) BUILD_TYPE=build;;
|
||||
2) BUILD_TYPE=build6;;
|
||||
3) BUILD_TYPE=debug_even;;
|
||||
4) BUILD_TYPE=debug_odd;;
|
||||
5) BUILD_TYPE=platformio;;
|
||||
6) BUILD_TYPE=package;;
|
||||
7) BUILD_TYPE=host;;
|
||||
8) BUILD_TYPE=style;;
|
||||
3) BUILD_TYPE=build1;;
|
||||
4) BUILD_TYPE=debug_even;;
|
||||
5) BUILD_TYPE=debug_odd;;
|
||||
6) BUILD_TYPE=platformio;;
|
||||
7) BUILD_TYPE=package;;
|
||||
8) BUILD_TYPE=host;;
|
||||
9) BUILD_TYPE=style;;
|
||||
esac
|
||||
test -z "$BUILD_TYPE" || break
|
||||
done
|
||||
@ -105,6 +107,13 @@ elif [ "$BUILD_TYPE" = "build6_even" ]; then
|
||||
elif [ "$BUILD_TYPE" = "build6_odd" ]; then
|
||||
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
|
||||
tests/platformio-custom.sh
|
||||
elif [ "$BUILD_TYPE" = "platformio_even" ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user