Skip to content

Commit 37e61d5

Browse files
Merge branch 'cachebuild' of https://github.com/earlephilhower/Arduino into cachebuild
2 parents ca545a2 + 13a12fd commit 37e61d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+372
-279
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ jobs:
4444
script: $TRAVIS_BUILD_DIR/tests/common.sh
4545
env:
4646
- BUILD_TYPE=debug_odd
47+
- name: "Build IPv6 (1)"
48+
script: $TRAVIS_BUILD_DIR/tests/common.sh
49+
env:
50+
- BUILD_TYPE=build6_even
51+
- name: "Build IPv6 (2)"
52+
script: $TRAVIS_BUILD_DIR/tests/common.sh
53+
env:
54+
- BUILD_TYPE=build6_odd
4755
- name: "Platformio (1)"
4856
script: $TRAVIS_BUILD_DIR/tests/common.sh
4957
env:

boards.txt

Lines changed: 120 additions & 120 deletions
Large diffs are not rendered by default.

cores/esp8266/IPAddress.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ class IPAddress: public Printable {
149149
/*
150150
lwIP address compatibility
151151
*/
152+
IPAddress(const ipv4_addr& fw_addr) { setV4(); v4() = fw_addr.addr; }
152153
IPAddress(const ipv4_addr* fw_addr) { setV4(); v4() = fw_addr->addr; }
153-
IPAddress(const ip_addr_t& lwip_addr) { _ip = lwip_addr; }
154154

155155
operator ip_addr_t () const { return _ip; }
156156
operator const ip_addr_t*() const { return &_ip; }
@@ -163,6 +163,9 @@ class IPAddress: public Printable {
163163

164164
#if LWIP_IPV6
165165

166+
IPAddress(const ip_addr_t& lwip_addr) { ip_addr_copy(_ip, lwip_addr); }
167+
IPAddress(const ip_addr_t* lwip_addr) { ip_addr_copy(_ip, *lwip_addr); }
168+
166169
uint16_t* raw6()
167170
{
168171
setV6();

libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ AVRISPState_t ESP8266AVRISP::update() {
7474
if (_server.hasClient()) {
7575
_client = _server.available();
7676
_client.setNoDelay(true);
77-
ip_addr_t lip;
78-
lip.addr = _client.remoteIP();
79-
AVRISP_DEBUG("client connect %d.%d.%d.%d:%d", IP2STR(&lip), _client.remotePort());
80-
(void) lip; // Avoid unused warning when not in debug mode
77+
AVRISP_DEBUG("client connect %s:%d", _client.remoteIP().toString().c_str(), _client.remotePort());
8178
_client.setTimeout(100); // for getch()
8279
_state = AVRISP_STATE_PENDING;
8380
_reject_incoming();

libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,9 @@ bool ESP8266NetBIOS::begin(const char *name)
154154
if(_pcb != NULL) {
155155
return true;
156156
}
157-
ip_addr_t addr;
158-
addr.addr = INADDR_ANY;
159157
_pcb = udp_new();
160158
udp_recv(_pcb, &_s_recv, (void *) this);
161-
err_t err = udp_bind(_pcb, &addr, NBNS_PORT);
159+
err_t err = udp_bind(_pcb, INADDR_ANY, NBNS_PORT);
162160
if(err != ERR_OK) {
163161
end();
164162
return false;
@@ -182,9 +180,13 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint1
182180
while(pb != NULL) {
183181
uint8_t * data = (uint8_t*)((pb)->payload);
184182
size_t len = pb->len;
185-
ip_hdr* iphdr = reinterpret_cast<ip_hdr*>(data - UDP_HLEN - IP_HLEN);
186-
ip_addr_t saddr;
187-
saddr.addr = iphdr->src.addr;
183+
#if LWIP_VERSION_MAJOR == 1
184+
// check UdpContext.h
185+
const ip_addr_t* saddr = &current_iphdr_src;
186+
#else
187+
// check UdpContext.h
188+
const ip_addr_t* saddr = &ip_data.current_iphdr_src;
189+
#endif
188190

189191
if (len >= sizeof(struct NBNSQUESTION)) {
190192
struct NBNSQUESTION * question = (struct NBNSQUESTION *)data;
@@ -221,7 +223,7 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint1
221223
if(pbt != NULL) {
222224
uint8_t* dst = reinterpret_cast<uint8_t*>(pbt->payload);
223225
memcpy(dst, (uint8_t *)&nbnsa, sizeof(nbnsa));
224-
udp_sendto(_pcb, pbt, &saddr, NBNS_PORT);
226+
udp_sendto(_pcb, pbt, saddr, NBNS_PORT);
225227
pbuf_free(pbt);
226228
}
227229
} else if (0 == strcmp(name, "*")) {
@@ -251,7 +253,7 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint1
251253
if(pbt != NULL) {
252254
uint8_t* dst = reinterpret_cast<uint8_t*>(pbt->payload);
253255
memcpy(dst, (uint8_t *)&nbnsan, sizeof(nbnsan));
254-
udp_sendto(_pcb, pbt, &saddr, NBNS_PORT);
256+
udp_sendto(_pcb, pbt, saddr, NBNS_PORT);
255257
pbuf_free(pbt);
256258
}
257259
}

libraries/ESP8266WiFi/examples/IPv6/IPv6.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ void status(Print& out) {
5454
out.println(F("------------------------------"));
5555
out.println(ESP.getFullVersion());
5656

57-
dns_setserver(DNS_MAX_SERVERS - 1, IPAddress(8, 8, 8, 8));
58-
5957
for (int i = 0; i < DNS_MAX_SERVERS; i++) {
6058
IPAddress dns = WiFi.dnsIP(i);
6159
if (dns.isSet()) {
@@ -98,7 +96,11 @@ void setup() {
9896
Serial.println();
9997
Serial.println(ESP.getFullVersion());
10098

101-
Serial.printf("IPV6 is%s enabled\n", LWIP_IPV6 ? emptyString.c_str() : " NOT");
99+
#if LWIP_IPV6
100+
Serial.printf("IPV6 is enabled\n");
101+
#else
102+
Serial.printf("IPV6 is not enabled\n");
103+
#endif
102104

103105
WiFi.mode(WIFI_STA);
104106
WiFi.begin(STASSID, STAPSK);

libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* passphrase, int ch
185185
return ret;
186186
}
187187

188+
bool ESP8266WiFiAPClass::softAP(const String& ssid, const String& passphrase, int channel, int ssid_hidden, int max_connection) {
189+
return softAP(ssid.c_str(), passphrase.c_str(), channel, ssid_hidden, max_connection);
190+
}
188191

189192
/**
190193
* Configure access point

libraries/ESP8266WiFi/src/ESP8266WiFiAP.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class ESP8266WiFiAPClass {
3737
public:
3838

3939
bool softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0, int max_connection = 4);
40+
bool softAP(const String& ssid,const String& passphrase = emptyString,int channel = 1,int ssid_hidden = 0,int max_connection = 4);
4041
bool softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet);
4142
bool softAPdisconnect(bool wifioff = false);
4243

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ wl_status_t ESP8266WiFiSTAClass::begin(char* ssid, char *passphrase, int32_t cha
190190
return begin((const char*) ssid, (const char*) passphrase, channel, bssid, connect);
191191
}
192192

193+
wl_status_t ESP8266WiFiSTAClass::begin(const String& ssid, const String& passphrase, int32_t channel, const uint8_t* bssid, bool connect) {
194+
return begin(ssid.c_str(), passphrase.c_str(), channel, bssid, connect);
195+
}
196+
193197
/**
194198
* Use to connect to SDK config.
195199
* @return wl_status_t

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class ESP8266WiFiSTAClass {
3838

3939
wl_status_t begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
4040
wl_status_t begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
41+
wl_status_t begin(const String& ssid, const String& passphrase = emptyString, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
4142
wl_status_t begin();
4243

4344
//The argument order for ESP is not the same as for Arduino. However, there is compatibility code under the hood

libraries/ESP8266WiFi/src/include/UdpContext.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,14 @@ class UdpContext
107107
udp_disconnect(_pcb);
108108
}
109109

110-
#if LWIP_VERSION_MAJOR == 1
111-
void setMulticastInterface(const ip_addr_t addr)
110+
void setMulticastInterface(const IPAddress& addr)
112111
{
113-
udp_set_multicast_netif_addr(_pcb, addr);
114-
}
112+
#if LWIP_VERSION_MAJOR == 1
113+
udp_set_multicast_netif_addr(_pcb, (ip_addr_t)addr);
115114
#else
116-
void setMulticastInterface(const ip_addr_t* addr)
117-
{
118-
udp_set_multicast_netif_addr(_pcb, ip_2_ip4(addr));
119-
}
115+
udp_set_multicast_netif_addr(_pcb, ip_2_ip4((const ip_addr_t*)addr));
120116
#endif
117+
}
121118

122119
void setMulticastTTL(int ttl)
123120
{

libraries/ESP8266mDNS/examples/LEAmDNS/mDNS_Clock/mDNS_Clock.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ bool MDNSProbeResultCallback(MDNSResponder* p_pMDNSResponder,
189189
p_pMDNSResponder->setDynamicServiceTxtCallback(hMDNSService, MDNSDynamicServiceTxtCallback, 0);
190190
}
191191
}
192+
}
193+
} else {
194+
// Change hostname, use '-' as divider between base name and index
195+
if (MDNSResponder::indexDomain(pcHostDomain, "-", 0)) {
196+
p_pMDNSResponder->setHostname(pcHostDomain);
192197
} else {
193-
// Change hostname, use '-' as divider between base name and index
194-
if (MDNSResponder::indexDomain(pcHostDomain, "-", 0)) {
195-
p_pMDNSResponder->setHostname(pcHostDomain);
196-
} else {
197-
Serial.println("MDNSProbeResultCallback: FAILED to update hostname!");
198-
}
198+
Serial.println("MDNSProbeResultCallback: FAILED to update hostname!");
199199
}
200200
}
201201
}
@@ -241,8 +241,8 @@ void handleHTTPClient(WiFiClient& client) {
241241
if (req == "/") {
242242
IPAddress ip = WiFi.localIP();
243243
String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
244-
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ESP8266 at ";
245-
s += ipStr;
244+
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ";
245+
s += WiFi.hostname() + " at " + ipStr;
246246
// Simple addition of the current time
247247
s += "\r\nCurrent time is: ";
248248
s += getTimeString();

libraries/ESP8266mDNS/examples/LEAmDNS/mDNS_ServiceMonitor/mDNS_ServiceMonitor.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ bool MDNSProbeResultCallback(MDNSResponder* p_pMDNSResponder,
233233
}
234234
}
235235
}
236+
}
237+
} else {
238+
// Change hostname, use '-' as divider between base name and index
239+
if (MDNSResponder::indexDomain(pcHostDomain, "-", 0)) {
240+
p_pMDNSResponder->setHostname(pcHostDomain);
236241
} else {
237-
// Change hostname, use '-' as divider between base name and index
238-
if (MDNSResponder::indexDomain(pcHostDomain, "-", 0)) {
239-
p_pMDNSResponder->setHostname(pcHostDomain);
240-
} else {
241-
Serial.println("MDNSProbeResultCallback: FAILED to update hostname!");
242-
}
242+
Serial.println("MDNSProbeResultCallback: FAILED to update hostname!");
243243
}
244244
}
245245
}
@@ -280,8 +280,8 @@ void handleHTTPClient(WiFiClient& client) {
280280
if (req == "/") {
281281
IPAddress ip = WiFi.localIP();
282282
String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
283-
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ESP8266 at ";
284-
s += ipStr;
283+
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ";
284+
s += WiFi.hostname() + " at " + ipStr;
285285
// Simple addition of the current time
286286
s += "<br/>Local HTTP services:<br/>";
287287
s += strHTTPServices;

libraries/ESP8266mDNS/src/ESP8266mDNS_Legacy.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,18 @@ class MDNSResponder {
6666
MDNSResponder();
6767
~MDNSResponder();
6868
bool begin(const char* hostName);
69+
bool begin(const String& hostName) {
70+
return begin(hostName.c_str());
71+
}
6972
//for compatibility
7073
bool begin(const char* hostName, IPAddress ip, uint32_t ttl=120){
7174
(void) ip;
7275
(void) ttl;
7376
return begin(hostName);
7477
}
78+
bool begin(const String& hostName, IPAddress ip, uint32_t ttl=120) {
79+
return begin(hostName.c_str(), ip, ttl);
80+
}
7581
/* Application should call this whenever AP is configured/disabled */
7682
void notifyAPChange();
7783
void update();

libraries/ESP8266mDNS/src/LEAmDNS.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,16 @@ class MDNSResponder {
173173
// Later call MDNS::update() in every 'loop' to run the process loop
174174
// (probing, announcing, responding, ...)
175175
bool begin(const char* p_pcHostname);
176+
bool begin(const String& p_strHostname) {return begin(p_strHostname.c_str());}
176177
// for compatibility
177178
bool begin(const char* p_pcHostname,
178179
IPAddress p_IPAddress, // ignored
179180
uint32_t p_u32TTL = 120); // ignored
181+
bool begin(const String& p_strHostname,
182+
IPAddress p_IPAddress, // ignored
183+
uint32_t p_u32TTL = 120) { // ignored
184+
return begin(p_strHostname.c_str(), p_IPAddress, p_u32TTL);
185+
}
180186
// Finish MDNS processing
181187
bool close(void);
182188

libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ bool MDNSResponder::_parseQuery(const MDNSResponder::stcMDNS_MsgHeader& p_MsgHea
203203
u8HostOrServiceReplies |= (pService->m_u8ReplyMask |= u8ReplyMaskForQuestion);
204204
DEBUG_EX_INFO(if (u8ReplyMaskForQuestion) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _parseQuery: Service reply needed for (%s.%s.%s): %u (%s)\n"), (pService->m_pcName ?: m_pcHostname), pService->m_pcService, pService->m_pcProtocol, u8ReplyMaskForQuestion, IPAddress(m_pUDPContext->getRemoteAddress()).toString().c_str()); } );
205205
/*if ((u8ReplyMaskForQuestion) &&
206-
(0 == os_strcmp("hap", pService->m_pcService))) {
206+
(0 == strcmp("hap", pService->m_pcService))) {
207207
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _parseQuery: Service reply needed for (%s.%s.%s): %u (%s)\n"), (pService->m_pcName ?: m_pcHostname), pService->m_pcService, pService->m_pcProtocol, u8ReplyMaskForQuestion, IPAddress(m_pUDPContext->getRemoteAddress()).toString().c_str());
208208
}*/
209209

@@ -244,9 +244,9 @@ bool MDNSResponder::_parseQuery(const MDNSResponder::stcMDNS_MsgHeader& p_MsgHea
244244
ip_info IPInfo_Remote;
245245
if (((IPInfo_Remote.ip.addr = m_pUDPContext->getRemoteAddress())) &&
246246
(((wifi_get_ip_info(SOFTAP_IF, &IPInfo_Local)) &&
247-
(ip_addr_netcmp(&IPInfo_Remote.ip, &IPInfo_Local.ip, &IPInfo_Local.netmask))) || // Remote IP in SOFTAP's subnet OR
247+
(ip4_addr_netcmp(&IPInfo_Remote.ip, &IPInfo_Local.ip, &IPInfo_Local.netmask))) || // Remote IP in SOFTAP's subnet OR
248248
((wifi_get_ip_info(STATION_IF, &IPInfo_Local)) &&
249-
(ip_addr_netcmp(&IPInfo_Remote.ip, &IPInfo_Local.ip, &IPInfo_Local.netmask))))) { // Remote IP in STATION's subnet
249+
(ip4_addr_netcmp(&IPInfo_Remote.ip, &IPInfo_Local.ip, &IPInfo_Local.netmask))))) { // Remote IP in STATION's subnet
250250

251251
DEBUG_EX_RX(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _parseQuery: Legacy query from local host %s!\n"), IPAddress(m_pUDPContext->getRemoteAddress()).toString().c_str()););
252252

@@ -386,7 +386,7 @@ bool MDNSResponder::_parseQuery(const MDNSResponder::stcMDNS_MsgHeader& p_MsgHea
386386
if ((u8ServiceMatchMask) && // The RR in the known answer matches an RR we are planning to send, AND
387387
((MDNS_SERVICE_TTL / 2) <= pKnownRRAnswer->m_u32TTL)) { // The TTL of the known answer is longer than half of the new service TTL (4500s)
388388

389-
/*if ((0 == os_strcmp("hap", pService->m_pcService))) {
389+
/*if ((0 == strcmp("hap", pService->m_pcService))) {
390390
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _parseQuery: Known answer for (%s.%s.%s): %u (%s) %u\n"), (pService->m_pcName ?: m_pcHostname), pService->m_pcService, pService->m_pcProtocol, pKnownRRAnswer->answerType(), IPAddress(m_pUDPContext->getRemoteAddress()).toString().c_str(), pKnownRRAnswer->m_u32TTL);
391391
}*/
392392

@@ -484,7 +484,7 @@ bool MDNSResponder::_parseQuery(const MDNSResponder::stcMDNS_MsgHeader& p_MsgHea
484484
u8ReplyNeeded |= pService->m_u8ReplyMask;
485485

486486
if ((u8ReplyNeeded) &&
487-
(0 == os_strcmp("hap", pService->m_pcService))) {
487+
(0 == strcmp("hap", pService->m_pcService))) {
488488
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _parseQuery: Sending service reply for (%s.%s.%s): %u (%s)\n"), (pService->m_pcName ?: m_pcHostname), pService->m_pcService, pService->m_pcProtocol, u8ReplyNeeded, IPAddress(m_pUDPContext->getRemoteAddress()).toString().c_str()););
489489
}
490490
}

0 commit comments

Comments
 (0)