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

Update SDK to 1.5.3

This commit is contained in:
Ivan Grokhotkov
2016-05-06 19:33:48 +08:00
parent d3434d345d
commit f266f8a2ff
27 changed files with 841 additions and 675 deletions

View File

@ -450,26 +450,25 @@ dns_local_addhost(const char *hostname, const ip_addr_t *addr)
* better check for failure: != IPADDR_NONE) or IPADDR_NONE if the hostname
* was not found in the cached dns_table.
*/
/*
static u32_t ICACHE_FLASH_ATTR
dns_lookup(const char *name)
{
u8_t i;
#if DNS_LOCAL_HOSTLIST || defined(DNS_LOOKUP_LOCAL_EXTERN)
u32_t addr;
#endif
#endif /* DNS_LOCAL_HOSTLIST || defined(DNS_LOOKUP_LOCAL_EXTERN) */
#if DNS_LOCAL_HOSTLIST
if ((addr = dns_lookup_local(name)) != IPADDR_NONE) {
return addr;
}
#endif
#endif /* DNS_LOCAL_HOSTLIST */
#ifdef DNS_LOOKUP_LOCAL_EXTERN
if((addr = DNS_LOOKUP_LOCAL_EXTERN(name)) != IPADDR_NONE) {
return addr;
}
#endif
#endif /* DNS_LOOKUP_LOCAL_EXTERN */
// Walk through name list, return entry if found. If not, return NULL.
/* Walk through name list, return entry if found. If not, return NULL. */
for (i = 0; i < DNS_TABLE_SIZE; ++i) {
if ((dns_table[i].state == DNS_STATE_DONE) &&
(strcmp(name, dns_table[i].name) == 0)) {
@ -482,7 +481,7 @@ dns_lookup(const char *name)
return IPADDR_NONE;
}
*/
#if DNS_DOES_NAME_CHECK
/**
* Compare the "dotted" name "query" with the encoded name "response"
@ -775,9 +774,7 @@ dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t
if (i < DNS_TABLE_SIZE) {
pEntry = &dns_table[i];
if(pEntry->state == DNS_STATE_ASKING) {
/* This entry is now completed. */
pEntry->state = DNS_STATE_DONE;
pEntry->err = hdr->flags2 & DNS_FLAG2_ERR_MASK;
pEntry->err = hdr->flags2 & DNS_FLAG2_ERR_MASK;
/* We only care about the question(s) and the answers. The authrr
and the extrarr are simply discarded. */
@ -788,8 +785,11 @@ dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t
if (((hdr->flags1 & DNS_FLAG1_RESPONSE) == 0) || (pEntry->err != 0) || (nquestions != 1)) {
LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": error in flags\n", pEntry->name));
/* call callback to indicate error, clean up memory and return */
goto responseerr;
//goto responseerr;
goto memerr;
}
/* This entry is now completed. */
pEntry->state = DNS_STATE_DONE;
#if DNS_DOES_NAME_CHECK
/* Check if the name in the "question" part match with the name in the entry. */

View File

@ -47,6 +47,7 @@
#include "lwip/inet_chksum.h"
#include "lwip/ip.h"
#include "lwip/def.h"
#include "lwipopts.h"
#include "lwip/stats.h"
#include "lwip/snmp.h"

View File

@ -710,6 +710,17 @@ igmp_start_timer(struct igmp_group *group, u8_t max_time)
group->timer = (LWIP_RAND() % (max_time - 1)) + 1;
}
/**
* Stop a timer for an igmp_group
*
* @param group the igmp_group for which to stop the timer
*/
static void
igmp_stop_timer(struct igmp_group *group)
{
group->timer = 0;
}
/**
* Delaying membership report for a group if necessary
*

View File

@ -900,11 +900,27 @@ mdns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr,
void ICACHE_FLASH_ATTR
mdns_close(void)
{
if (mdns_pcb != NULL && ms_info != NULL)
uint8 text_index = 0;
if (mdns_pcb != NULL && ms_info != NULL) {
udp_remove(mdns_pcb);
for(text_index = 0;text_index < 10;text_index++) {
if(ms_info->txt_data[text_index] != NULL) {
os_free(ms_info->txt_data[text_index]);
ms_info->txt_data[text_index] = NULL;
}
}
if (ms_info->host_name != NULL) {
os_free(ms_info->host_name);
ms_info->host_name = NULL;
}
if (ms_info->server_name != NULL) {
os_free(ms_info->server_name);
ms_info->server_name = NULL;
}
os_free(ms_info);
mdns_pcb = NULL;
ms_info = NULL;
}
}
@ -1034,9 +1050,24 @@ mdns_init(struct mdns_info *info) {
multicast_addr.addr = DNS_MULTICAST_ADDRESS;
struct ip_addr ap_host_addr;
struct ip_info ipconfig;
uint8 text_index = 0;
ms_info = (struct mdns_info *)os_zalloc(sizeof(struct mdns_info));
if (ms_info != NULL) {
os_memcpy(ms_info,info,sizeof(struct mdns_info));
ms_info->host_name = (char *)os_zalloc(os_strlen(info->host_name)+1);
os_memcpy(ms_info->host_name,info->host_name,os_strlen(info->host_name));
ms_info->server_name = (char *)os_zalloc(os_strlen(info->server_name)+1);
os_memcpy(ms_info->server_name,info->server_name,os_strlen(info->server_name));
for(text_index = 0;text_index < 10;text_index++) {
if(info->txt_data[text_index] != NULL) {
ms_info->txt_data[text_index] = (char *)os_zalloc(os_strlen(info->txt_data[text_index])+1);
os_memcpy(ms_info->txt_data[text_index],info->txt_data[text_index],os_strlen(info->txt_data[text_index]));
} else {
break;
}
}
} else {
os_printf("ms_info alloc failed\n");
return;

View File

@ -268,10 +268,7 @@ struct sntp_server {
};
static struct sntp_server sntp_servers[SNTP_MAX_SERVERS];
#if SNTP_GET_SERVERS_FROM_DHCP
static u8_t sntp_set_servers_from_dhcp;
#endif
#if SNTP_SUPPORT_MULTIPLE_SERVERS
/** The currently used server (initialized to 0) */
static u8_t sntp_current_server;
@ -364,6 +361,7 @@ sntp_mktm_r(const time_t * tim_p ,struct tm *res ,int is_gmtime)
{
long days, rem;
time_t lcltime;
int i;
int y;
int yleap;
const int *ip;

View File

@ -114,7 +114,7 @@ tcp_timer_needed(void)
*
* @param arg unused argument
*/
/*
static void ICACHE_FLASH_ATTR
tcp_timer_coarse(void *arg)
{
@ -123,7 +123,7 @@ tcp_timer_coarse(void *arg)
tcp_tmr();
sys_timeout(TCP_TMR_INTERVAL, tcp_timer_coarse, NULL);
}
*/
#endif /* LWIP_TCP */
#if IP_REASSEMBLY