mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
update to lwIP-2.1.0: partial SACK support by default (de-selectable in menu) (#5126)
* update to lwIP-2.1.0rc1: partial SACK support fix #4176 * hash fix * get some flash back due to mistake in conf (fragmentation & reassembly was incorrectly enabled) (ahah I scared you) * add missing include files * update to lwip-2.1.0(release) + remove unused lwIP's include files * lwIP release 2.1.0, SACK is now default, bigger, no-SACK is selectable * fix ldscript * pio * rename 'sack' option to 'feat'ure option, + IP fragmentation/reassembly * merge, fix pio * change internal/hidden string * pio: more lwip2 configuration: + without sack for no change in flash footprint
This commit is contained in:
@ -63,6 +63,12 @@ extern "C" {
|
||||
#define NETIF_MAX_HWADDR_LEN 6U
|
||||
#endif
|
||||
|
||||
/** The size of a fully constructed netif name which the
|
||||
* netif can be identified by in APIs. Composed of
|
||||
* 2 chars, 3 (max) digits, and 1 \0
|
||||
*/
|
||||
#define NETIF_NAMESIZE 6
|
||||
|
||||
/**
|
||||
* @defgroup netif_flags Flags
|
||||
* @ingroup netif
|
||||
@ -106,6 +112,7 @@ extern "C" {
|
||||
|
||||
enum lwip_internal_netif_client_data_index
|
||||
{
|
||||
#if LWIP_IPV4
|
||||
#if LWIP_DHCP
|
||||
LWIP_NETIF_CLIENT_DATA_INDEX_DHCP,
|
||||
#endif
|
||||
@ -115,9 +122,15 @@ enum lwip_internal_netif_client_data_index
|
||||
#if LWIP_IGMP
|
||||
LWIP_NETIF_CLIENT_DATA_INDEX_IGMP,
|
||||
#endif
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
#if LWIP_IPV6_DHCP6
|
||||
LWIP_NETIF_CLIENT_DATA_INDEX_DHCP6,
|
||||
#endif
|
||||
#if LWIP_IPV6_MLD
|
||||
LWIP_NETIF_CLIENT_DATA_INDEX_MLD6,
|
||||
#endif
|
||||
#endif /* LWIP_IPV6 */
|
||||
LWIP_NETIF_CLIENT_DATA_INDEX_MAX
|
||||
};
|
||||
|
||||
@ -158,6 +171,9 @@ typedef err_t (*netif_init_fn)(struct netif *netif);
|
||||
*
|
||||
* @param p The received packet, copied into a pbuf
|
||||
* @param inp The netif which received the packet
|
||||
* @return ERR_OK if the packet was handled
|
||||
* != ERR_OK is the packet was NOT handled, in this case, the caller has
|
||||
* to free the pbuf
|
||||
*/
|
||||
typedef err_t (*netif_input_fn)(struct pbuf *p, struct netif *inp);
|
||||
|
||||
@ -207,8 +223,10 @@ typedef err_t (*netif_mld_mac_filter_fn)(struct netif *netif,
|
||||
const ip6_addr_t *group, enum netif_mac_filter_action action);
|
||||
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
|
||||
|
||||
#if LWIP_DHCP || LWIP_AUTOIP || LWIP_IGMP || LWIP_IPV6_MLD || (LWIP_NUM_NETIF_CLIENT_DATA > 0)
|
||||
#if LWIP_DHCP || LWIP_AUTOIP || LWIP_IGMP || LWIP_IPV6_MLD || LWIP_IPV6_DHCP6 || (LWIP_NUM_NETIF_CLIENT_DATA > 0)
|
||||
#if LWIP_NUM_NETIF_CLIENT_DATA > 0
|
||||
u8_t netif_alloc_client_data_id(void);
|
||||
#endif
|
||||
/** @ingroup netif_cd
|
||||
* Set client data. Obtain ID from netif_alloc_client_data_id().
|
||||
*/
|
||||
@ -217,14 +235,33 @@ u8_t netif_alloc_client_data_id(void);
|
||||
* Get client data. Obtain ID from netif_alloc_client_data_id().
|
||||
*/
|
||||
#define netif_get_client_data(netif, id) (netif)->client_data[(id)]
|
||||
#endif /* LWIP_DHCP || LWIP_AUTOIP || (LWIP_NUM_NETIF_CLIENT_DATA > 0) */
|
||||
#endif
|
||||
|
||||
#if (LWIP_IPV4 && LWIP_ARP && (ARP_TABLE_SIZE > 0x7f)) || (LWIP_IPV6 && (LWIP_ND6_NUM_DESTINATIONS > 0x7f))
|
||||
typedef u16_t netif_addr_idx_t;
|
||||
#define NETIF_ADDR_IDX_MAX 0x7FFF
|
||||
#else
|
||||
typedef u8_t netif_addr_idx_t;
|
||||
#define NETIF_ADDR_IDX_MAX 0x7F
|
||||
#endif
|
||||
|
||||
#if LWIP_NETIF_HWADDRHINT
|
||||
#define LWIP_NETIF_USE_HINTS 1
|
||||
struct netif_hint {
|
||||
netif_addr_idx_t addr_hint;
|
||||
};
|
||||
#else /* LWIP_NETIF_HWADDRHINT */
|
||||
#define LWIP_NETIF_USE_HINTS 0
|
||||
#endif /* LWIP_NETIF_HWADDRHINT */
|
||||
|
||||
/** Generic data structure used for all lwIP network interfaces.
|
||||
* The following fields should be filled in by the initialization
|
||||
* function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
|
||||
struct netif {
|
||||
#if !LWIP_SINGLE_NETIF
|
||||
/** pointer to next in linked list */
|
||||
struct netif *next;
|
||||
#endif
|
||||
|
||||
#if LWIP_IPV4
|
||||
/** IP address configuration in network byte order */
|
||||
@ -238,6 +275,13 @@ struct netif {
|
||||
/** The state of each IPv6 address (Tentative, Preferred, etc).
|
||||
* @see ip6_addr.h */
|
||||
u8_t ip6_addr_state[LWIP_IPV6_NUM_ADDRESSES];
|
||||
#if LWIP_IPV6_ADDRESS_LIFETIMES
|
||||
/** Remaining valid and preferred lifetime of each IPv6 address, in seconds.
|
||||
* For valid lifetimes, the special value of IP6_ADDR_LIFE_STATIC (0)
|
||||
* indicates the address is static and has no lifetimes. */
|
||||
u32_t ip6_addr_valid_life[LWIP_IPV6_NUM_ADDRESSES];
|
||||
u32_t ip6_addr_pref_life[LWIP_IPV6_NUM_ADDRESSES];
|
||||
#endif /* LWIP_IPV6_ADDRESS_LIFETIMES */
|
||||
#endif /* LWIP_IPV6 */
|
||||
/** This function is called by the network device driver
|
||||
* to pass a packet up the TCP/IP stack. */
|
||||
@ -280,14 +324,6 @@ struct netif {
|
||||
#ifdef netif_get_client_data
|
||||
void* client_data[LWIP_NETIF_CLIENT_DATA_INDEX_MAX + LWIP_NUM_NETIF_CLIENT_DATA];
|
||||
#endif
|
||||
#if LWIP_IPV6_AUTOCONFIG
|
||||
/** is this netif enabled for IPv6 autoconfiguration */
|
||||
u8_t ip6_autoconfig_enabled;
|
||||
#endif /* LWIP_IPV6_AUTOCONFIG */
|
||||
#if LWIP_IPV6_SEND_ROUTER_SOLICIT
|
||||
/** Number of Router Solicitation messages that remain to be sent. */
|
||||
u8_t rs_count;
|
||||
#endif /* LWIP_IPV6_SEND_ROUTER_SOLICIT */
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
/* the hostname for this netif, NULL is a valid value */
|
||||
const char* hostname;
|
||||
@ -297,16 +333,29 @@ struct netif {
|
||||
#endif /* LWIP_CHECKSUM_CTRL_PER_NETIF*/
|
||||
/** maximum transfer unit (in bytes) */
|
||||
u16_t mtu;
|
||||
/** number of bytes used in hwaddr */
|
||||
u8_t hwaddr_len;
|
||||
#if LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES
|
||||
/** maximum transfer unit (in bytes), updated by RA */
|
||||
u16_t mtu6;
|
||||
#endif /* LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES */
|
||||
/** link level hardware address of this interface */
|
||||
u8_t hwaddr[NETIF_MAX_HWADDR_LEN];
|
||||
/** number of bytes used in hwaddr */
|
||||
u8_t hwaddr_len;
|
||||
/** flags (@see @ref netif_flags) */
|
||||
u8_t flags;
|
||||
/** descriptive abbreviation */
|
||||
char name[2];
|
||||
/** number of this interface */
|
||||
/** number of this interface. Used for @ref if_api and @ref netifapi_netif,
|
||||
* as well as for IPv6 zones */
|
||||
u8_t num;
|
||||
#if LWIP_IPV6_AUTOCONFIG
|
||||
/** is this netif enabled for IPv6 autoconfiguration */
|
||||
u8_t ip6_autoconfig_enabled;
|
||||
#endif /* LWIP_IPV6_AUTOCONFIG */
|
||||
#if LWIP_IPV6_SEND_ROUTER_SOLICIT
|
||||
/** Number of Router Solicitation messages that remain to be sent. */
|
||||
u8_t rs_count;
|
||||
#endif /* LWIP_IPV6_SEND_ROUTER_SOLICIT */
|
||||
#if MIB2_STATS
|
||||
/** link type (from "snmp_ifType" enum from snmp_mib2.h) */
|
||||
u8_t link_type;
|
||||
@ -327,9 +376,9 @@ struct netif {
|
||||
filter table of the ethernet MAC. */
|
||||
netif_mld_mac_filter_fn mld_mac_filter;
|
||||
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
|
||||
#if LWIP_NETIF_HWADDRHINT
|
||||
u8_t *addr_hint;
|
||||
#endif /* LWIP_NETIF_HWADDRHINT */
|
||||
#if LWIP_NETIF_USE_HINTS
|
||||
struct netif_hint *hints;
|
||||
#endif /* LWIP_NETIF_USE_HINTS */
|
||||
#if ENABLE_LOOPBACK
|
||||
/* List of packets to be queued for ourselves. */
|
||||
struct pbuf *loop_first;
|
||||
@ -349,21 +398,28 @@ struct netif {
|
||||
#define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag)
|
||||
#endif /* LWIP_CHECKSUM_CTRL_PER_NETIF */
|
||||
|
||||
#if LWIP_SINGLE_NETIF
|
||||
#define NETIF_FOREACH(netif) if (((netif) = netif_default) != NULL)
|
||||
#else /* LWIP_SINGLE_NETIF */
|
||||
/** The list of network interfaces. */
|
||||
extern struct netif *netif_list;
|
||||
#define NETIF_FOREACH(netif) for ((netif) = netif_list; (netif) != NULL; (netif) = (netif)->next)
|
||||
#endif /* LWIP_SINGLE_NETIF */
|
||||
/** The default network interface. */
|
||||
extern struct netif *netif_default;
|
||||
|
||||
void netif_init(void);
|
||||
|
||||
struct netif *netif_add_noaddr(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input);
|
||||
|
||||
#if LWIP_IPV4
|
||||
struct netif *netif_add(struct netif *netif,
|
||||
#if LWIP_IPV4
|
||||
const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw,
|
||||
#endif /* LWIP_IPV4 */
|
||||
void *state, netif_init_fn init, netif_input_fn input);
|
||||
#if LWIP_IPV4
|
||||
const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw,
|
||||
void *state, netif_init_fn init, netif_input_fn input);
|
||||
void netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask,
|
||||
const ip4_addr_t *gw);
|
||||
#else /* LWIP_IPV4 */
|
||||
struct netif *netif_add(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input);
|
||||
#endif /* LWIP_IPV4 */
|
||||
void netif_remove(struct netif * netif);
|
||||
|
||||
@ -393,6 +449,10 @@ void netif_set_gw(struct netif *netif, const ip4_addr_t *gw);
|
||||
#define netif_ip_gw4(netif) ((const ip_addr_t*)&((netif)->gw))
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
#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)
|
||||
|
||||
void netif_set_up(struct netif *netif);
|
||||
void netif_set_down(struct netif *netif);
|
||||
/** @ingroup netif
|
||||
@ -459,13 +519,148 @@ s8_t netif_get_ip6_addr_match(struct netif *netif, const ip6_addr_t *ip6addr);
|
||||
void netif_create_ip6_linklocal_address(struct netif *netif, u8_t from_mac_48bit);
|
||||
err_t netif_add_ip6_address(struct netif *netif, const ip6_addr_t *ip6addr, s8_t *chosen_idx);
|
||||
#define netif_set_ip6_autoconfig_enabled(netif, action) do { if(netif) { (netif)->ip6_autoconfig_enabled = (action); }}while(0)
|
||||
#if LWIP_IPV6_ADDRESS_LIFETIMES
|
||||
#define netif_ip6_addr_valid_life(netif, i) \
|
||||
(((netif) != NULL) ? ((netif)->ip6_addr_valid_life[i]) : IP6_ADDR_LIFE_STATIC)
|
||||
#define netif_ip6_addr_set_valid_life(netif, i, secs) \
|
||||
do { if (netif != NULL) { (netif)->ip6_addr_valid_life[i] = (secs); }} while (0)
|
||||
#define netif_ip6_addr_pref_life(netif, i) \
|
||||
(((netif) != NULL) ? ((netif)->ip6_addr_pref_life[i]) : IP6_ADDR_LIFE_STATIC)
|
||||
#define netif_ip6_addr_set_pref_life(netif, i, secs) \
|
||||
do { if (netif != NULL) { (netif)->ip6_addr_pref_life[i] = (secs); }} while (0)
|
||||
#define netif_ip6_addr_isstatic(netif, i) \
|
||||
(netif_ip6_addr_valid_life((netif), (i)) == IP6_ADDR_LIFE_STATIC)
|
||||
#else /* !LWIP_IPV6_ADDRESS_LIFETIMES */
|
||||
#define netif_ip6_addr_isstatic(netif, i) (1) /* all addresses are static */
|
||||
#endif /* !LWIP_IPV6_ADDRESS_LIFETIMES */
|
||||
#if LWIP_ND6_ALLOW_RA_UPDATES
|
||||
#define netif_mtu6(netif) ((netif)->mtu6)
|
||||
#else /* LWIP_ND6_ALLOW_RA_UPDATES */
|
||||
#define netif_mtu6(netif) ((netif)->mtu)
|
||||
#endif /* LWIP_ND6_ALLOW_RA_UPDATES */
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
#if LWIP_NETIF_HWADDRHINT
|
||||
#define NETIF_SET_HWADDRHINT(netif, hint) ((netif)->addr_hint = (hint))
|
||||
#else /* LWIP_NETIF_HWADDRHINT */
|
||||
#define NETIF_SET_HWADDRHINT(netif, hint)
|
||||
#endif /* LWIP_NETIF_HWADDRHINT */
|
||||
#if LWIP_NETIF_USE_HINTS
|
||||
#define NETIF_SET_HINTS(netif, netifhint) (netif)->hints = (netifhint)
|
||||
#define NETIF_RESET_HINTS(netif) (netif)->hints = NULL
|
||||
#else /* LWIP_NETIF_USE_HINTS */
|
||||
#define NETIF_SET_HINTS(netif, netifhint)
|
||||
#define NETIF_RESET_HINTS(netif)
|
||||
#endif /* LWIP_NETIF_USE_HINTS */
|
||||
|
||||
u8_t netif_name_to_index(const char *name);
|
||||
char * netif_index_to_name(u8_t idx, char *name);
|
||||
struct netif* netif_get_by_index(u8_t idx);
|
||||
|
||||
/* Interface indexes always start at 1 per RFC 3493, section 4, num starts at 0 (internal index is 0..254)*/
|
||||
#define netif_get_index(netif) ((u8_t)((netif)->num + 1))
|
||||
#define NETIF_NO_INDEX (0)
|
||||
|
||||
/**
|
||||
* @ingroup netif
|
||||
* Extended netif status callback (NSC) reasons flags.
|
||||
* May be extended in the future!
|
||||
*/
|
||||
typedef u16_t netif_nsc_reason_t;
|
||||
|
||||
/* used for initialization only */
|
||||
#define LWIP_NSC_NONE 0x0000
|
||||
/** netif was added. arg: NULL. Called AFTER netif was added. */
|
||||
#define LWIP_NSC_NETIF_ADDED 0x0001
|
||||
/** netif was removed. arg: NULL. Called BEFORE netif is removed. */
|
||||
#define LWIP_NSC_NETIF_REMOVED 0x0002
|
||||
/** link changed */
|
||||
#define LWIP_NSC_LINK_CHANGED 0x0004
|
||||
/** netif administrative status changed.\n
|
||||
* up is called AFTER netif is set up.\n
|
||||
* down is called BEFORE the netif is actually set down. */
|
||||
#define LWIP_NSC_STATUS_CHANGED 0x0008
|
||||
/** IPv4 address has changed */
|
||||
#define LWIP_NSC_IPV4_ADDRESS_CHANGED 0x0010
|
||||
/** IPv4 gateway has changed */
|
||||
#define LWIP_NSC_IPV4_GATEWAY_CHANGED 0x0020
|
||||
/** IPv4 netmask has changed */
|
||||
#define LWIP_NSC_IPV4_NETMASK_CHANGED 0x0040
|
||||
/** called AFTER IPv4 address/gateway/netmask changes have been applied */
|
||||
#define LWIP_NSC_IPV4_SETTINGS_CHANGED 0x0080
|
||||
/** IPv6 address was added */
|
||||
#define LWIP_NSC_IPV6_SET 0x0100
|
||||
/** IPv6 address state has changed */
|
||||
#define LWIP_NSC_IPV6_ADDR_STATE_CHANGED 0x0200
|
||||
|
||||
/** @ingroup netif
|
||||
* Argument supplied to netif_ext_callback_fn.
|
||||
*/
|
||||
typedef union
|
||||
{
|
||||
/** Args to LWIP_NSC_LINK_CHANGED callback */
|
||||
struct link_changed_s
|
||||
{
|
||||
/** 1: up; 0: down */
|
||||
u8_t state;
|
||||
} link_changed;
|
||||
/** Args to LWIP_NSC_STATUS_CHANGED callback */
|
||||
struct status_changed_s
|
||||
{
|
||||
/** 1: up; 0: down */
|
||||
u8_t state;
|
||||
} status_changed;
|
||||
/** Args to LWIP_NSC_IPV4_ADDRESS_CHANGED|LWIP_NSC_IPV4_GATEWAY_CHANGED|LWIP_NSC_IPV4_NETMASK_CHANGED|LWIP_NSC_IPV4_SETTINGS_CHANGED callback */
|
||||
struct ipv4_changed_s
|
||||
{
|
||||
/** Old IPv4 address */
|
||||
const ip_addr_t* old_address;
|
||||
const ip_addr_t* old_netmask;
|
||||
const ip_addr_t* old_gw;
|
||||
} ipv4_changed;
|
||||
/** Args to LWIP_NSC_IPV6_SET callback */
|
||||
struct ipv6_set_s
|
||||
{
|
||||
/** Index of changed IPv6 address */
|
||||
s8_t addr_index;
|
||||
/** Old IPv6 address */
|
||||
const ip_addr_t* old_address;
|
||||
} ipv6_set;
|
||||
/** Args to LWIP_NSC_IPV6_ADDR_STATE_CHANGED callback */
|
||||
struct ipv6_addr_state_changed_s
|
||||
{
|
||||
/** Index of affected IPv6 address */
|
||||
s8_t addr_index;
|
||||
/** Old IPv6 address state */
|
||||
u8_t old_state;
|
||||
/** Affected IPv6 address */
|
||||
const ip_addr_t* address;
|
||||
} ipv6_addr_state_changed;
|
||||
} netif_ext_callback_args_t;
|
||||
|
||||
/**
|
||||
* @ingroup netif
|
||||
* Function used for extended netif status callbacks
|
||||
* Note: When parsing reason argument, keep in mind that more reasons may be added in the future!
|
||||
* @param netif netif that is affected by change
|
||||
* @param reason change reason
|
||||
* @param args depends on reason, see reason description
|
||||
*/
|
||||
typedef void (*netif_ext_callback_fn)(struct netif* netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t* args);
|
||||
|
||||
#if LWIP_NETIF_EXT_STATUS_CALLBACK
|
||||
struct netif_ext_callback;
|
||||
typedef struct netif_ext_callback
|
||||
{
|
||||
netif_ext_callback_fn callback_fn;
|
||||
struct netif_ext_callback* next;
|
||||
} netif_ext_callback_t;
|
||||
|
||||
#define NETIF_DECLARE_EXT_CALLBACK(name) static netif_ext_callback_t name;
|
||||
void netif_add_ext_callback(netif_ext_callback_t* callback, netif_ext_callback_fn fn);
|
||||
void netif_remove_ext_callback(netif_ext_callback_t* callback);
|
||||
void netif_invoke_ext_callback(struct netif* netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t* args);
|
||||
#else
|
||||
#define NETIF_DECLARE_EXT_CALLBACK(name)
|
||||
#define netif_add_ext_callback(callback, fn)
|
||||
#define netif_remove_ext_callback(callback)
|
||||
#define netif_invoke_ext_callback(netif, reason, args)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user