diff --git a/extras/wificfg/wificfg.c b/extras/wificfg/wificfg.c index 1e4c5d2..2d507a0 100644 --- a/extras/wificfg/wificfg.c +++ b/extras/wificfg/wificfg.c @@ -1692,6 +1692,14 @@ static bool host_is_name(const char *host) } +#if LWIP_MDNS_RESPONDER +static void mdns_srv_txt(struct mdns_service *service, void *txt_userdata) +{ + err_t res = mdns_resp_add_service_txtitem(service, "path=/", 6); + LWIP_ERROR("mdns add service txt failed\n", (res == ERR_OK), return); +} +#endif + /* * The http server uses a single thread to service all requests, one request at * a time, to keep peak resource usage to a minimum. Keeping connections open @@ -1745,16 +1753,16 @@ static void server_task(void *pvParameters) LOCK_TCPIP_CORE(); if (wifi_sta_mdns && station_netif) { LOCK_TCPIP_CORE(); - mdns_resp_add_netif(station_netif, hostname, 120); + mdns_resp_add_netif(station_netif, hostname); mdns_resp_add_service(station_netif, hostname, "_http", - DNSSD_PROTO_TCP, 80, 3600, NULL, NULL); + DNSSD_PROTO_TCP, 80, mdns_srv_txt, NULL); UNLOCK_TCPIP_CORE(); } if (wifi_ap_mdns && softap_netif) { LOCK_TCPIP_CORE(); - mdns_resp_add_netif(softap_netif, hostname, 120); + mdns_resp_add_netif(softap_netif, hostname); mdns_resp_add_service(softap_netif, hostname, "_http", - DNSSD_PROTO_TCP, 80, 3600, NULL, NULL); + DNSSD_PROTO_TCP, 80, mdns_srv_txt, NULL); UNLOCK_TCPIP_CORE(); } UNLOCK_TCPIP_CORE(); diff --git a/lwip/esp_interface.c b/lwip/esp_interface.c index 77ad177..2517220 100644 --- a/lwip/esp_interface.c +++ b/lwip/esp_interface.c @@ -81,6 +81,10 @@ low_level_init(struct netif *netif) /* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */ netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP | NETIF_FLAG_IGMP | NETIF_FLAG_MLD6; +#if LWIP_ACD + netif->acd_list = NULL; +#endif /* LWIP_ACD */ + /* Do whatever else is needed to initialize interface. */ } @@ -384,7 +388,7 @@ ethernetif_init(struct netif *netif) netif->name[0] = IFNAME0; netif->name[1] = IFNAME1; /* We directly use etharp_output() here to save a function call. - * You can instead declare your own function an call etharp_output() + * You can instead declare your own function and call etharp_output() * from it if you have to do some checks before sending (e.g. if link * is available...) */ #if LWIP_IPV4 diff --git a/lwip/include/lwipopts.h b/lwip/include/lwipopts.h index 57c6f05..084acaa 100644 --- a/lwip/include/lwipopts.h +++ b/lwip/include/lwipopts.h @@ -258,6 +258,8 @@ void sys_unlock_tcpip_core(void); * Since the received pbufs are enqueued, be sure to configure * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive * packets even if the maximum amount of fragments is enqueued for reassembly! + * When IPv4 *and* IPv6 are enabled, this even changes to + * (PBUF_POOL_SIZE > 2 * IP_REASS_MAX_PBUFS)! */ #ifndef IP_REASS_MAX_PBUFS #define IP_REASS_MAX_PBUFS 2 @@ -290,17 +292,82 @@ void sys_unlock_tcpip_core(void); /** * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address. */ -#ifndef DHCP_DOES_ARP_CHECK -#define DHCP_DOES_ARP_CHECK ((LWIP_DHCP) && (LWIP_ARP)) +#ifndef LWIP_DHCP_DOES_ACD_CHECK +#define LWIP_DHCP_DOES_ACD_CHECK LWIP_DHCP #endif #define LWIP_DHCP_BOOTP_FILE 0 +/** + * LWIP_DHCP_GETS_NTP==1: Request NTP servers with discover/select. For each + * response packet, an callback is called, which has to be provided by the port: + * void dhcp_set_ntp_servers(u8_t num_ntp_servers, ip_addr_t* ntp_server_addrs); +*/ +#ifndef LWIP_DHCP_GET_NTP_SRV +#define LWIP_DHCP_GET_NTP_SRV 0 +#endif + +/** + * The maximum of NTP servers requested + */ +#ifndef LWIP_DHCP_MAX_NTP_SERVERS +#define LWIP_DHCP_MAX_NTP_SERVERS 1 +#endif + +/** + * LWIP_DHCP_MAX_DNS_SERVERS > 0: Request DNS servers with discover/select. + * DNS servers received in the response are passed to DNS via @ref dns_setserver() + * (up to the maximum limit defined here). + */ +#ifndef LWIP_DHCP_MAX_DNS_SERVERS +#define LWIP_DHCP_MAX_DNS_SERVERS DNS_MAX_SERVERS +#endif + /* ------------------------------------ ---------- AUTOIP options ---------- ------------------------------------ */ + +/** + * LWIP_AUTOIP==1: Enable AUTOIP module. + */ +#ifndef LWIP_AUTOIP +#define LWIP_AUTOIP 0 +#endif + +/** + * LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on + * the same interface at the same time. + */ +#ifndef LWIP_DHCP_AUTOIP_COOP +#define LWIP_DHCP_AUTOIP_COOP 0 +#endif + +/** + * LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes + * that should be sent before falling back on AUTOIP (the DHCP client keeps + * running in this case). This can be set as low as 1 to get an AutoIP address + * very quickly, but you should be prepared to handle a changing IP address + * when DHCP overrides AutoIP. + */ +#ifndef LWIP_DHCP_AUTOIP_COOP_TRIES +#define LWIP_DHCP_AUTOIP_COOP_TRIES 9 +#endif + +/* + ------------------------------------ + ----------- ACD options ------------ + ------------------------------------ +*/ + +/** + * LWIP_ACD==1: Enable ACD module. ACD module is needed when using AUTOIP. + */ +#ifndef LWIP_ACD +#define LWIP_ACD (LWIP_AUTOIP || LWIP_DHCP_DOES_ACD_CHECK) +#endif + /* ---------------------------------- ----- SNMP MIB2 support ----- @@ -514,6 +581,12 @@ void sys_unlock_tcpip_core(void); */ #define PBUF_LINK_ENCAPSULATION_HLEN 36 +/** + * LWIP_PBUF_CUSTOM_DATA: Store private data on pbufs (e.g. timestamps) + * This extends struct pbuf so user can store custom data on every pbuf. + */ +#define LWIP_PBUF_CUSTOM_DATA void *esf_buf; + /* ------------------------------------------------ ---------- Network Interfaces options ---------- @@ -642,6 +715,26 @@ void sys_unlock_tcpip_core(void); #define LWIP_SOCKET_OFFSET 3 #endif +/** + * LWIP_SOCKET_EXTERNAL_HEADERS==1: Use external headers instead of sockets.h + * and inet.h. In this case, user must provide its own headers by setting the + * values for LWIP_SOCKET_EXTERNAL_HEADER_SOCKETS_H and + * LWIP_SOCKET_EXTERNAL_HEADER_INET_H to appropriate include file names and the + * whole content of the default sockets.h and inet.h is skipped. + */ +#ifndef LWIP_SOCKET_EXTERNAL_HEADERS +#define LWIP_SOCKET_EXTERNAL_HEADERS 0 +#endif + +/** + * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT + * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set + * in seconds. (does not require sockets.c, and will affect tcp.c) + */ +#ifndef LWIP_TCP_KEEPALIVE +#define LWIP_TCP_KEEPALIVE 1 +#endif + /** * LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and * SO_SNDTIMEO processing. @@ -658,15 +751,6 @@ void sys_unlock_tcpip_core(void); #define LWIP_SO_RCVTIMEO 1 #endif -/** - * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT - * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set - * in seconds. (does not require sockets.c, and will affect tcp.c) - */ -#ifndef LWIP_TCP_KEEPALIVE -#define LWIP_TCP_KEEPALIVE 1 -#endif - /** * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing. */ @@ -674,6 +758,27 @@ void sys_unlock_tcpip_core(void); #define LWIP_SO_RCVBUF 0 #endif +/** + * LWIP_SO_LINGER==1: Enable SO_LINGER processing. + */ +#ifndef LWIP_SO_LINGER +#define LWIP_SO_LINGER 0 +#endif + +/** + * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize. + */ +#ifndef RECV_BUFSIZE_DEFAULT +#define RECV_BUFSIZE_DEFAULT INT_MAX +#endif + +/** + * By default, TCP socket/netconn close waits 20 seconds max to send the FIN + */ +#ifndef LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT +#define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000 +#endif + /** * SO_REUSE==1: Enable SO_REUSEADDR option. */ @@ -681,6 +786,45 @@ void sys_unlock_tcpip_core(void); #define SO_REUSE 1 #endif +/** + * SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets + * to all local matches if SO_REUSEADDR is turned on. + * WARNING: Adds a memcpy for every packet if passing to more than one pcb! + */ +#ifndef SO_REUSE_RXTOALL +#define SO_REUSE_RXTOALL 0 +#endif + +/** + * LWIP_FIONREAD_LINUXMODE==0 (default): ioctl/FIONREAD returns the amount of + * pending data in the network buffer. This is the way windows does it. It's + * the default for lwIP since it is smaller. + * LWIP_FIONREAD_LINUXMODE==1: ioctl/FIONREAD returns the size of the next + * pending datagram in bytes. This is the way linux does it. This code is only + * here for compatibility. + */ +#ifndef LWIP_FIONREAD_LINUXMODE +#define LWIP_FIONREAD_LINUXMODE 0 +#endif + +/** + * LWIP_SOCKET_SELECT==1 (default): enable select() for sockets (uses a netconn + * callback to keep track of events). + * This saves RAM (counters per socket) and code (netconn event callback), which + * should improve performance a bit). + */ +#ifndef LWIP_SOCKET_SELECT +#define LWIP_SOCKET_SELECT 1 +#endif + +/** + * LWIP_SOCKET_POLL==1 (default): enable poll() for sockets (including + * struct pollfd, nfds_t, and constants) + */ +#ifndef LWIP_SOCKET_POLL +#define LWIP_SOCKET_POLL 1 +#endif + /* ---------------------------------------- ---------- Statistics options ---------- @@ -725,6 +869,21 @@ void sys_unlock_tcpip_core(void); #define LWIP_IPV6 0 #endif +/** + * LWIP_ND6_QUEUEING==1: queue outgoing IPv6 packets while MAC address + * is being resolved. + */ +#ifndef LWIP_ND6_QUEUEING +#define LWIP_ND6_QUEUEING LWIP_IPV6 +#endif + +/** + * MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution. + */ +#ifndef MEMP_NUM_ND6_QUEUE +#define MEMP_NUM_ND6_QUEUE 5 +#endif + /* --------------------------------------- ---------- Hook options --------------- @@ -737,14 +896,6 @@ void sys_unlock_tcpip_core(void); --------------------------------------- */ -/** - * LWIP_MDNS_RESPONDER_QUEUE_ANNOUNCEMENTS==1: Unsolicited announcements are - * queued and run from a timer callback. - */ -#ifndef LWIP_MDNS_RESPONDER_QUEUE_ANNOUNCEMENTS -#define LWIP_MDNS_RESPONDER_QUEUE_ANNOUNCEMENTS 1 -#endif - /* --------------------------------------- ---------- Debugging options ---------- @@ -918,6 +1069,11 @@ void sys_unlock_tcpip_core(void); */ #define AUTOIP_DEBUG LWIP_DBG_OFF +/** + * ACD_DEBUG: Enable debugging in acd.c. + */ +#define ACD_DEBUG LWIP_DBG_OFF + /** * DNS_DEBUG: Enable debugging for DNS. */ @@ -928,6 +1084,11 @@ void sys_unlock_tcpip_core(void); */ #define IP6_DEBUG LWIP_DBG_OFF +/** + * DHCP6_DEBUG: Enable debugging in dhcp6.c. + */ +#define DHCP6_DEBUG LWIP_DBG_OFF + /** * MDNS_DEBUG: Enable debugging for multicast DNS. */ diff --git a/lwip/lwip b/lwip/lwip index d74e9ad..be044b5 160000 --- a/lwip/lwip +++ b/lwip/lwip @@ -1 +1 @@ -Subproject commit d74e9ad2f7c9db996fb398cd41bf59ef463ae6fe +Subproject commit be044b574011ce56699dc400c853c369d93ffde6