1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

lwIP: v2.1.3 + dhcp fixes (#8319)

* lwIP: v2.1.3
* interface set as default when gw is valid
This commit is contained in:
david gauchard
2022-01-06 12:38:36 +01:00
committed by GitHub
parent a05a71fa9d
commit 4c07113ff5
21 changed files with 109 additions and 31 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -118,4 +118,20 @@ err_glue_t glue2esp_linkoutput (int netif_idx, void* ref2save, void* data, size
#define lwip_xt_rsil(level) (__extension__({uint32_t state; __asm__ __volatile__("rsil %0," __STRINGIFY(level) : "=a" (state) :: "memory"); state;}))
#define lwip_xt_wsr_ps(state) __asm__ __volatile__("wsr %0,ps; isync" :: "a" (state) : "memory")
// quickfix: workaround for definition of __PRI32(x) in inttypes.h
// it has changed with recent version of xtensa-gcc
// __INT32 is missing
// gcc-4.x: __PRI32(x) is __STRINGIFY(l##x)
// gcc-10.2.0: __PRI32(x) is __INT32 __STRINGIFY(x)
#include <inttypes.h>
#if !defined(__INT8)
#define __INT8
#endif
#if !defined(__INT16)
#define __INT16
#endif
#if !defined(__INT32)
#define __INT32 "l"
#endif
#endif // GLUE_H

View File

@ -1,5 +1,5 @@
// generated by makefiles/make-lwip2-hash
#ifndef LWIP_HASH_H
#define LWIP_HASH_H
#define LWIP_HASH_STR "STABLE-2_1_2_RELEASE/glue:1.2-48-g7421258"
#define LWIP_HASH_STR "STABLE-2_1_3_RELEASE/glue:1.2-58-g450bb63"
#endif // LWIP_HASH_H

View File

@ -120,9 +120,7 @@
#endif /* LWIP_NOASSERT */
#ifndef LWIP_ERROR
#ifndef LWIP_NOASSERT
#define LWIP_PLATFORM_ERROR(message) LWIP_PLATFORM_ASSERT(message)
#elif defined LWIP_DEBUG
#ifdef LWIP_DEBUG
#define LWIP_PLATFORM_ERROR(message) LWIP_PLATFORM_DIAG((message))
#else
#define LWIP_PLATFORM_ERROR(message)

View File

@ -49,7 +49,9 @@
extern "C" {
#endif
#ifndef IF_NAMESIZE
#define IF_NAMESIZE NETIF_NAMESIZE
#endif
char * lwip_if_indextoname(unsigned int ifindex, char *ifname);
unsigned int lwip_if_nametoindex(const char *ifname);

View File

@ -54,7 +54,7 @@ extern "C" {
/** x.X.x: Minor version of the stack */
#define LWIP_VERSION_MINOR 1
/** x.x.X: Revision of the stack */
#define LWIP_VERSION_REVISION 2
#define LWIP_VERSION_REVISION 3
/** For release candidates, this is set to 1..254
* For official releases, this is set to 255 (LWIP_RC_RELEASE)
* For development versions (Git), this is set to 0 (LWIP_RC_DEVELOPMENT) */

View File

@ -386,6 +386,10 @@ struct netif {
#if LWIP_LOOPBACK_MAX_PBUFS
u16_t loop_cnt_current;
#endif /* LWIP_LOOPBACK_MAX_PBUFS */
#if LWIP_NETIF_LOOPBACK_MULTITHREADING
/* Used if the original scheduling failed. */
u8_t reschedule_poll;
#endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */
#endif /* ENABLE_LOOPBACK */
#if LWIP_IPV4 && IP_NAPT
u8_t napt;
@ -454,7 +458,7 @@ void netif_set_gw(struct netif *netif, const ip4_addr_t *gw);
#define netif_set_flags(netif, set_flags) do { (netif)->flags = (u8_t)((netif)->flags | (set_flags)); } while(0)
#define netif_clear_flags(netif, clr_flags) do { (netif)->flags = (u8_t)((netif)->flags & (u8_t)(~(clr_flags) & 0xff)); } while(0)
#define netif_is_flag_set(nefif, flag) (((netif)->flags & (flag)) != 0)
#define netif_is_flag_set(netif, flag) (((netif)->flags & (flag)) != 0)
void netif_set_up(struct netif *netif);
void netif_set_down(struct netif *netif);

View File

@ -1549,7 +1549,7 @@
* TCP_MSS, IP header, and link header.
*/
#if !defined PBUF_POOL_BUFSIZE || defined __DOXYGEN__
#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+PBUF_IP_HLEN+PBUF_TRANSPORT_HLEN+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
#endif
/**
@ -1559,6 +1559,14 @@
#if !defined LWIP_PBUF_REF_T || defined __DOXYGEN__
#define LWIP_PBUF_REF_T u8_t
#endif
/**
* 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.
*/
#if !defined LWIP_PBUF_CUSTOM_DATA || defined __DOXYGEN__
#define LWIP_PBUF_CUSTOM_DATA
#endif
/**
* @}
*/
@ -1916,11 +1924,8 @@
/** LWIP_NETCONN_FULLDUPLEX==1: Enable code that allows reading from one thread,
* writing from a 2nd thread and closing from a 3rd thread at the same time.
* ATTENTION: This is currently really alpha! Some requirements:
* - LWIP_NETCONN_SEM_PER_THREAD==1 is required to use one socket/netconn from
* multiple threads at once
* - sys_mbox_free() has to unblock receive tasks waiting on recvmbox/acceptmbox
* and prevent a task pending on this during/after deletion
* LWIP_NETCONN_SEM_PER_THREAD==1 is required to use one socket/netconn from
* multiple threads at once!
*/
#if !defined LWIP_NETCONN_FULLDUPLEX || defined __DOXYGEN__
#define LWIP_NETCONN_FULLDUPLEX 0
@ -2450,7 +2455,7 @@
* network startup.
*/
#if !defined LWIP_IPV6_SEND_ROUTER_SOLICIT || defined __DOXYGEN__
#define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
#define LWIP_IPV6_SEND_ROUTER_SOLICIT LWIP_IPV6
#endif
/**
@ -2495,10 +2500,12 @@
/**
* LWIP_ICMP6_DATASIZE: bytes from original packet to send back in
* ICMPv6 error messages.
* ICMPv6 error messages (0 = default of IP6_MIN_MTU_LENGTH)
* ATTENTION: RFC4443 section 2.4 says IP6_MIN_MTU_LENGTH is a MUST,
* so override this only if you absolutely have to!
*/
#if !defined LWIP_ICMP6_DATASIZE || defined __DOXYGEN__
#define LWIP_ICMP6_DATASIZE 8
#define LWIP_ICMP6_DATASIZE 0
#endif
/**

View File

@ -219,6 +219,9 @@ struct pbuf {
/** For incoming packets, this contains the input netif's index */
u8_t if_idx;
/** In case the user needs to store data custom data on a pbuf */
LWIP_PBUF_CUSTOM_DATA
};
@ -293,6 +296,7 @@ void pbuf_cat(struct pbuf *head, struct pbuf *tail);
void pbuf_chain(struct pbuf *head, struct pbuf *tail);
struct pbuf *pbuf_dechain(struct pbuf *p);
err_t pbuf_copy(struct pbuf *p_to, const struct pbuf *p_from);
err_t pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_len, u16_t offset);
u16_t pbuf_copy_partial(const struct pbuf *p, void *dataptr, u16_t len, u16_t offset);
void *pbuf_get_contiguous(const struct pbuf *p, void *buffer, size_t bufsize, u16_t len, u16_t offset);
err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len);

View File

@ -85,6 +85,11 @@ typedef err_t (*altcp_get_tcp_addrinfo_fn)(struct altcp_pcb *conn, int local, ip
typedef ip_addr_t *(*altcp_get_ip_fn)(struct altcp_pcb *conn, int local);
typedef u16_t (*altcp_get_port_fn)(struct altcp_pcb *conn, int local);
#if LWIP_TCP_KEEPALIVE
typedef void (*altcp_keepalive_disable_fn)(struct altcp_pcb *conn);
typedef void (*altcp_keepalive_enable_fn)(struct altcp_pcb *conn, u32_t idle, u32_t intvl, u32_t count);
#endif
#ifdef LWIP_DEBUG
typedef enum tcp_state (*altcp_dbg_get_tcp_state_fn)(struct altcp_pcb *conn);
#endif
@ -111,6 +116,10 @@ struct altcp_functions {
altcp_get_tcp_addrinfo_fn addrinfo;
altcp_get_ip_fn getip;
altcp_get_port_fn getport;
#if LWIP_TCP_KEEPALIVE
altcp_keepalive_disable_fn keepalive_disable;
altcp_keepalive_enable_fn keepalive_enable;
#endif
#ifdef LWIP_DEBUG
altcp_dbg_get_tcp_state_fn dbg_get_tcp_state;
#endif
@ -133,6 +142,10 @@ void altcp_default_dealloc(struct altcp_pcb *conn);
err_t altcp_default_get_tcp_addrinfo(struct altcp_pcb *conn, int local, ip_addr_t *addr, u16_t *port);
ip_addr_t *altcp_default_get_ip(struct altcp_pcb *conn, int local);
u16_t altcp_default_get_port(struct altcp_pcb *conn, int local);
#if LWIP_TCP_KEEPALIVE
void altcp_default_keepalive_disable(struct altcp_pcb *conn);
void altcp_default_keepalive_enable(struct altcp_pcb *conn, u32_t idle, u32_t intvl, u32_t count);
#endif
#ifdef LWIP_DEBUG
enum tcp_state altcp_default_dbg_get_tcp_state(struct altcp_pcb *conn);
#endif

View File

@ -146,6 +146,8 @@ PACK_STRUCT_END
# include "arch/epstruct.h"
#endif
#define ICMP6_HLEN 8
/** This is the ICMP6 header adapted for echo req/resp. */
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/bpstruct.h"

View File

@ -44,6 +44,8 @@
extern "C" {
#endif
#define IP6_MIN_MTU_LENGTH 1280
/** This is the packed version of ip6_addr_t,
used in network headers that are itself packed */
#ifdef PACK_STRUCT_USE_INCLUDES

View File

@ -1557,7 +1557,7 @@
* TCP_MSS, IP header, and link header.
*/
#if !defined PBUF_POOL_BUFSIZE || defined __DOXYGEN__
#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+PBUF_IP_HLEN+PBUF_TRANSPORT_HLEN+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
#endif
/**
@ -1567,6 +1567,14 @@
#ifndef LWIP_PBUF_REF_T
#define LWIP_PBUF_REF_T u8_t
#endif
/**
* 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.
*/
#if !defined LWIP_PBUF_CUSTOM_DATA || defined __DOXYGEN__
#define LWIP_PBUF_CUSTOM_DATA
#endif
/**
* @}
*/
@ -1924,11 +1932,8 @@
/** LWIP_NETCONN_FULLDUPLEX==1: Enable code that allows reading from one thread,
* writing from a 2nd thread and closing from a 3rd thread at the same time.
* ATTENTION: This is currently really alpha! Some requirements:
* - LWIP_NETCONN_SEM_PER_THREAD==1 is required to use one socket/netconn from
* multiple threads at once
* - sys_mbox_free() has to unblock receive tasks waiting on recvmbox/acceptmbox
* and prevent a task pending on this during/after deletion
* LWIP_NETCONN_SEM_PER_THREAD==1 is required to use one socket/netconn from
* multiple threads at once!
*/
#if !defined LWIP_NETCONN_FULLDUPLEX || defined __DOXYGEN__
#define LWIP_NETCONN_FULLDUPLEX 0
@ -2464,7 +2469,7 @@
* network startup.
*/
#if !defined LWIP_IPV6_SEND_ROUTER_SOLICIT || defined __DOXYGEN__
#define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
#define LWIP_IPV6_SEND_ROUTER_SOLICIT LWIP_IPV6
#endif
/**
@ -2509,10 +2514,12 @@
/**
* LWIP_ICMP6_DATASIZE: bytes from original packet to send back in
* ICMPv6 error messages.
* ICMPv6 error messages (0 = default of IP6_MIN_MTU_LENGTH)
* ATTENTION: RFC4443 section 2.4 says IP6_MIN_MTU_LENGTH is a MUST,
* so override this only if you absolutely have to!
*/
#if !defined LWIP_ICMP6_DATASIZE || defined __DOXYGEN__
#define LWIP_ICMP6_DATASIZE 8
#define LWIP_ICMP6_DATASIZE 0
#endif
/**
@ -3547,6 +3554,11 @@
--------------------------------------------------
*/
#include "lwip/debug.h"
#include "arch/cc.h"
#include "lwip-git-hash.h"
#include <sys/time.h> // settimeofday() + struct timeval
#ifndef LWIP_FEATURES
#error LWIP_FEATURES must be defined
#endif
@ -3584,6 +3596,19 @@ extern void lwip_hook_dhcp_parse_option(struct netif *netif, struct dhcp *dhcp,
int msg_type, int option, int option_len, struct pbuf *pbuf,
int option_value_offset);
#if LWIP_FEATURES
#define LWIP_HOOK_DHCP_APPEND_OPTIONS(netif, dhcp, state, msg, msg_type, option_len_ptr) { \
/* https://github.com/esp8266/Arduino/issues/8223 */ \
lwip_hook_dhcp_amend_options(netif, dhcp, state, msg, msg_type, option_len_ptr); \
/* https://github.com/esp8266/Arduino/issues/8247 */ \
if ((msg_type) == DHCP_DISCOVER) \
*(option_len_ptr) = dhcp_option_hostname(*(option_len_ptr), (msg)->options, netif); \
}
extern void lwip_hook_dhcp_amend_options(struct netif *netif, struct dhcp *dhcp, int state, struct dhcp_msg *msg,
int msg_type, u16 *option_len_ptr);
#endif
/*
--------------------------------------------------
------------------ SNTP options ------------------
@ -3629,11 +3654,6 @@ uint32_t SNTP_STARTUP_DELAY_FUNC;
--------------------------------------------------
*/
#include "lwip/debug.h"
#include "arch/cc.h"
#include "lwip-git-hash.h"
#include <sys/time.h> // settimeofday() + struct timeval
// allow to handle special packets (user redefinable)
struct pbuf;
struct netif;

View File

@ -44,6 +44,13 @@
#define PPPOE_SUPPORT 0
#endif
/**
* PPPOE_SCNAME_SUPPORT==1: Enable PPP Over Ethernet Service Name and Concentrator Name support
*/
#ifndef PPPOE_SCNAME_SUPPORT
#define PPPOE_SCNAME_SUPPORT 0
#endif
/**
* PPPOL2TP_SUPPORT==1: Enable PPP Over L2TP
*/