Squashed 'lib/lwip/lwip/' content from commit 0a0452b2c39b
git-subtree-dir: lib/lwip/lwip
git-subtree-split: 0a0452b2c39bdd91e252aef045c115f88f6ca773
diff --git a/contrib/examples/example_app/default_netif.h b/contrib/examples/example_app/default_netif.h
new file mode 100644
index 0000000..1a64f02
--- /dev/null
+++ b/contrib/examples/example_app/default_netif.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file is part of the lwIP TCP/IP stack.
+ *
+ * Author: Adam Dunkels <adam@sics.se>
+ *
+ */
+
+#ifndef LWIP_DEFAULT_NETIF_H
+#define LWIP_DEFAULT_NETIF_H
+
+#include "lwip/ip_addr.h"
+
+#if LWIP_IPV4
+void init_default_netif(const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw);
+#else
+void init_default_netif(void);
+#endif
+
+void default_netif_poll(void);
+void default_netif_shutdown(void);
+
+#endif
diff --git a/contrib/examples/example_app/lwipcfg.h.ci b/contrib/examples/example_app/lwipcfg.h.ci
new file mode 100644
index 0000000..dc8477c
--- /dev/null
+++ b/contrib/examples/example_app/lwipcfg.h.ci
@@ -0,0 +1,73 @@
+/**
+ * Additional settings for the example app.
+ * Copy this to lwipcfg.h and make the config changes you need.
+ */
+
+/* configuration for this port */
+#define PPP_USERNAME "Admin"
+#define PPP_PASSWORD "pass"
+
+/** Define this to the index of the windows network adapter to use */
+#define PACKET_LIB_ADAPTER_NR 1
+/** Define this to the GUID of the windows network adapter to use
+ * or NOT define this if you want PACKET_LIB_ADAPTER_NR to be used */
+/*#define PACKET_LIB_ADAPTER_GUID "00000000-0000-0000-0000-000000000000"*/
+/*#define PACKET_LIB_GET_ADAPTER_NETADDRESS(addr) IP4_ADDR((addr), 192,168,1,0)*/
+/*#define PACKET_LIB_QUIET*/
+
+/* #define USE_PCAPIF 1 */
+#define LWIP_PORT_INIT_IPADDR(addr) IP4_ADDR((addr), 192,168,1,200)
+#define LWIP_PORT_INIT_GW(addr) IP4_ADDR((addr), 192,168,1,1)
+#define LWIP_PORT_INIT_NETMASK(addr) IP4_ADDR((addr), 255,255,255,0)
+
+/* remember to change this MAC address to suit your needs!
+ the last octet will be increased by netif->num for each netif */
+#define LWIP_MAC_ADDR_BASE {0x00,0x01,0x02,0x03,0x04,0x05}
+
+/* #define USE_SLIPIF 0 */
+/* #define SIO_USE_COMPORT 0 */
+#ifdef USE_SLIPIF
+#if USE_SLIPIF
+#define LWIP_PORT_INIT_SLIP1_IPADDR(addr) IP4_ADDR((addr), 192, 168, 2, 2)
+#define LWIP_PORT_INIT_SLIP1_GW(addr) IP4_ADDR((addr), 192, 168, 2, 1)
+#define LWIP_PORT_INIT_SLIP1_NETMASK(addr) IP4_ADDR((addr), 255, 255, 255, 0)
+#if USE_SLIPIF > 1
+#define LWIP_PORT_INIT_SLIP2_IPADDR(addr) IP4_ADDR((addr), 192, 168, 2, 1)
+#define LWIP_PORT_INIT_SLIP2_GW(addr) IP4_ADDR((addr), 0, 0, 0, 0)
+#define LWIP_PORT_INIT_SLIP2_NETMASK(addr) IP4_ADDR((addr), 255, 255, 255, 0)*/
+#endif /* USE_SLIPIF > 1 */
+#endif /* USE_SLIPIF */
+#endif /* USE_SLIPIF */
+
+/* configuration for applications */
+
+#define LWIP_CHARGEN_APP 1
+#define LWIP_DNS_APP 1
+#define LWIP_HTTPD_APP LWIP_TCP
+/* Set this to 1 to use the netconn http server,
+ * otherwise the raw api server will be used. */
+/*#define LWIP_HTTPD_APP_NETCONN */
+#define LWIP_NETBIOS_APP LWIP_IPV4 && LWIP_UDP
+#define LWIP_NETIO_APP 1
+#define LWIP_MDNS_APP LWIP_UDP
+#define LWIP_MQTT_APP LWIP_TCP
+#define LWIP_PING_APP 1
+#define LWIP_RTP_APP 1
+#define LWIP_SHELL_APP LWIP_TCP
+#define LWIP_SNMP_APP LWIP_UDP
+#define LWIP_SNTP_APP LWIP_UDP
+#define LWIP_SOCKET_EXAMPLES_APP 1
+#define LWIP_TCPECHO_APP LWIP_TCP
+/* Set this to 1 to use the netconn tcpecho server,
+ * otherwise the raw api server will be used. */
+/*#define LWIP_TCPECHO_APP_NETCONN */
+#define LWIP_TFTP_APP LWIP_UDP
+#define LWIP_TFTP_CLIENT_APP LWIP_UDP
+#define LWIP_UDPECHO_APP LWIP_UDP
+#define LWIP_LWIPERF_APP LWIP_TCP
+
+#define USE_DHCP LWIP_DHCP
+#define USE_AUTOIP LWIP_AUTOIP
+
+/* define this to your custom application-init function */
+/* #define LWIP_APP_INIT my_app_init() */
diff --git a/contrib/examples/example_app/lwipcfg.h.example b/contrib/examples/example_app/lwipcfg.h.example
new file mode 100644
index 0000000..b21e19b
--- /dev/null
+++ b/contrib/examples/example_app/lwipcfg.h.example
@@ -0,0 +1,77 @@
+/**
+ * Additional settings for the example app.
+ * Copy this to lwipcfg.h and make the config changes you need.
+ */
+
+/* configuration for this port */
+#define PPP_USERNAME "Admin"
+#define PPP_PASSWORD "pass"
+
+/** Define this to the index of the windows network adapter to use */
+#define PACKET_LIB_ADAPTER_NR 1
+/** Define this to the GUID of the windows network adapter to use
+ * or NOT define this if you want PACKET_LIB_ADAPTER_NR to be used */
+/*#define PACKET_LIB_ADAPTER_GUID "00000000-0000-0000-0000-000000000000"*/
+/*#define PACKET_LIB_GET_ADAPTER_NETADDRESS(addr) IP4_ADDR((addr), 192,168,1,0)*/
+/*#define PACKET_LIB_QUIET*/
+
+/* If these 2 are not defined, the corresponding config setting is used */
+/* #define USE_DHCP 0 */
+/* #define USE_AUTOIP 0 */
+
+/* #define USE_PCAPIF 1 */
+#define LWIP_PORT_INIT_IPADDR(addr) IP4_ADDR((addr), 192,168,1,200)
+#define LWIP_PORT_INIT_GW(addr) IP4_ADDR((addr), 192,168,1,1)
+#define LWIP_PORT_INIT_NETMASK(addr) IP4_ADDR((addr), 255,255,255,0)
+
+/* remember to change this MAC address to suit your needs!
+ the last octet will be increased by netif->num for each netif */
+#define LWIP_MAC_ADDR_BASE {0x00,0x01,0x02,0x03,0x04,0x05}
+
+/* #define USE_SLIPIF 0 */
+/* #define SIO_USE_COMPORT 0 */
+#ifdef USE_SLIPIF
+#if USE_SLIPIF
+#define LWIP_PORT_INIT_SLIP1_IPADDR(addr) IP4_ADDR((addr), 192, 168, 2, 2)
+#define LWIP_PORT_INIT_SLIP1_GW(addr) IP4_ADDR((addr), 192, 168, 2, 1)
+#define LWIP_PORT_INIT_SLIP1_NETMASK(addr) IP4_ADDR((addr), 255, 255, 255, 0)
+#if USE_SLIPIF > 1
+#define LWIP_PORT_INIT_SLIP2_IPADDR(addr) IP4_ADDR((addr), 192, 168, 2, 1)
+#define LWIP_PORT_INIT_SLIP2_GW(addr) IP4_ADDR((addr), 0, 0, 0, 0)
+#define LWIP_PORT_INIT_SLIP2_NETMASK(addr) IP4_ADDR((addr), 255, 255, 255, 0)*/
+#endif /* USE_SLIPIF > 1 */
+#endif /* USE_SLIPIF */
+#endif /* USE_SLIPIF */
+
+/* configuration for applications */
+
+#define LWIP_CHARGEN_APP 0
+#define LWIP_DNS_APP 0
+#define LWIP_HTTPD_APP 0
+/* Set this to 1 to use the netconn http server,
+ * otherwise the raw api server will be used. */
+/*#define LWIP_HTTPD_APP_NETCONN */
+#define LWIP_NETBIOS_APP 0
+#define LWIP_NETIO_APP 0
+#define LWIP_MDNS_APP 0
+#define LWIP_MQTT_APP 0
+#define LWIP_PING_APP 0
+#define LWIP_RTP_APP 0
+#define LWIP_SHELL_APP 0
+#define LWIP_SNMP_APP 0
+#define LWIP_SNTP_APP 0
+#define LWIP_SOCKET_EXAMPLES_APP 0
+#define LWIP_TCPECHO_APP 0
+/* Set this to 1 to use the netconn tcpecho server,
+ * otherwise the raw api server will be used. */
+/*#define LWIP_TCPECHO_APP_NETCONN */
+#define LWIP_TFTP_APP 0
+#define LWIP_TFTP_CLIENT_APP 0
+#define LWIP_UDPECHO_APP 0
+#define LWIP_LWIPERF_APP 0
+
+/*#define USE_DHCP 1*/
+/*#define USE_AUTOIP 1*/
+
+/* define this to your custom application-init function */
+/* #define LWIP_APP_INIT my_app_init() */
diff --git a/contrib/examples/example_app/lwipopts.h b/contrib/examples/example_app/lwipopts.h
new file mode 100644
index 0000000..ea2ca4bdae
--- /dev/null
+++ b/contrib/examples/example_app/lwipopts.h
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file is part of the lwIP TCP/IP stack.
+ *
+ * Author: Adam Dunkels <adam@sics.se>
+ *
+ */
+#ifndef LWIP_LWIPOPTS_H
+#define LWIP_LWIPOPTS_H
+
+#ifdef LWIP_OPTTEST_FILE
+#include "lwipopts_test.h"
+#else /* LWIP_OPTTEST_FILE */
+
+#define LWIP_IPV4 1
+#define LWIP_IPV6 1
+
+#define NO_SYS 0
+#define LWIP_SOCKET (NO_SYS==0)
+#define LWIP_NETCONN (NO_SYS==0)
+#define LWIP_NETIF_API (NO_SYS==0)
+
+#define LWIP_IGMP LWIP_IPV4
+#define LWIP_ICMP LWIP_IPV4
+
+#define LWIP_SNMP LWIP_UDP
+#define MIB2_STATS LWIP_SNMP
+#ifdef LWIP_HAVE_MBEDTLS
+#define LWIP_SNMP_V3 (LWIP_SNMP)
+#endif
+
+#define LWIP_DNS LWIP_UDP
+#define LWIP_MDNS_RESPONDER LWIP_UDP
+
+#define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_MDNS_RESPONDER)
+
+#define LWIP_HAVE_LOOPIF 1
+#define LWIP_NETIF_LOOPBACK 1
+#define LWIP_LOOPBACK_MAX_PBUFS 10
+
+#define TCP_LISTEN_BACKLOG 1
+
+#define LWIP_COMPAT_SOCKETS 1
+#define LWIP_SO_RCVTIMEO 1
+#define LWIP_SO_RCVBUF 1
+
+#define LWIP_TCPIP_CORE_LOCKING 1
+
+#define LWIP_NETIF_LINK_CALLBACK 1
+#define LWIP_NETIF_STATUS_CALLBACK 1
+#define LWIP_NETIF_EXT_STATUS_CALLBACK 1
+
+#ifdef LWIP_DEBUG
+
+#define LWIP_DBG_MIN_LEVEL 0
+#define PPP_DEBUG LWIP_DBG_OFF
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define PBUF_DEBUG LWIP_DBG_OFF
+#define API_LIB_DEBUG LWIP_DBG_OFF
+#define API_MSG_DEBUG LWIP_DBG_OFF
+#define TCPIP_DEBUG LWIP_DBG_OFF
+#define NETIF_DEBUG LWIP_DBG_OFF
+#define SOCKETS_DEBUG LWIP_DBG_OFF
+#define DNS_DEBUG LWIP_DBG_OFF
+#define AUTOIP_DEBUG LWIP_DBG_OFF
+#define DHCP_DEBUG LWIP_DBG_OFF
+#define IP_DEBUG LWIP_DBG_OFF
+#define IP_REASS_DEBUG LWIP_DBG_OFF
+#define ICMP_DEBUG LWIP_DBG_OFF
+#define IGMP_DEBUG LWIP_DBG_OFF
+#define UDP_DEBUG LWIP_DBG_OFF
+#define TCP_DEBUG LWIP_DBG_OFF
+#define TCP_INPUT_DEBUG LWIP_DBG_OFF
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
+#define TCP_RTO_DEBUG LWIP_DBG_OFF
+#define TCP_CWND_DEBUG LWIP_DBG_OFF
+#define TCP_WND_DEBUG LWIP_DBG_OFF
+#define TCP_FR_DEBUG LWIP_DBG_OFF
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF
+#define TCP_RST_DEBUG LWIP_DBG_OFF
+#endif
+
+#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
+
+
+/* ---------- Memory options ---------- */
+/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
+ lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
+ byte alignment -> define MEM_ALIGNMENT to 2. */
+/* MSVC port: intel processors don't need 4-byte alignment,
+ but are faster that way! */
+#define MEM_ALIGNMENT 4U
+
+/* MEM_SIZE: the size of the heap memory. If the application will send
+a lot of data that needs to be copied, this should be set high. */
+#define MEM_SIZE 10240
+
+/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
+ sends a lot of data out of ROM (or other static memory), this
+ should be set high. */
+#define MEMP_NUM_PBUF 16
+/* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
+ per active RAW "connection". */
+#define MEMP_NUM_RAW_PCB 3
+/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
+ per active UDP "connection". */
+#define MEMP_NUM_UDP_PCB 8
+/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
+ connections. */
+#define MEMP_NUM_TCP_PCB 5
+/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
+ connections. */
+#define MEMP_NUM_TCP_PCB_LISTEN 8
+/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
+ segments. */
+#define MEMP_NUM_TCP_SEG 16
+/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
+ timeouts. */
+#define MEMP_NUM_SYS_TIMEOUT 17
+
+/* The following four are used only with the sequential API and can be
+ set to 0 if the application only will use the raw API. */
+/* MEMP_NUM_NETBUF: the number of struct netbufs. */
+#define MEMP_NUM_NETBUF 2
+/* MEMP_NUM_NETCONN: the number of struct netconns. */
+#define MEMP_NUM_NETCONN 12
+/* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
+ for sequential API communication and incoming packets. Used in
+ src/api/tcpip.c. */
+#define MEMP_NUM_TCPIP_MSG_API 16
+#define MEMP_NUM_TCPIP_MSG_INPKT 16
+
+
+/* ---------- Pbuf options ---------- */
+/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
+#define PBUF_POOL_SIZE 120
+
+/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
+#define PBUF_POOL_BUFSIZE 256
+
+/** SYS_LIGHTWEIGHT_PROT
+ * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
+ * for certain critical regions during buffer allocation, deallocation and memory
+ * allocation and deallocation.
+ */
+#define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
+
+
+/* ---------- TCP options ---------- */
+#define LWIP_TCP 1
+#define TCP_TTL 255
+
+#define LWIP_ALTCP (LWIP_TCP)
+#ifdef LWIP_HAVE_MBEDTLS
+#define LWIP_ALTCP_TLS (LWIP_TCP)
+#define LWIP_ALTCP_TLS_MBEDTLS (LWIP_TCP)
+#endif
+
+
+/* Controls if TCP should queue segments that arrive out of
+ order. Define to 0 if your device is low on memory. */
+#define TCP_QUEUE_OOSEQ 1
+
+/* TCP Maximum segment size. */
+#define TCP_MSS 1024
+
+/* TCP sender buffer space (bytes). */
+#define TCP_SND_BUF 2048
+
+/* TCP sender buffer space (pbufs). This must be at least = 2 *
+ TCP_SND_BUF/TCP_MSS for things to work. */
+#define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
+
+/* TCP writable space (bytes). This must be less than or equal
+ to TCP_SND_BUF. It is the amount of space which must be
+ available in the tcp snd_buf for select to return writable */
+#define TCP_SNDLOWAT (TCP_SND_BUF/2)
+
+/* TCP receive window. */
+#define TCP_WND (20 * 1024)
+
+/* Maximum number of retransmissions of data segments. */
+#define TCP_MAXRTX 12
+
+/* Maximum number of retransmissions of SYN segments. */
+#define TCP_SYNMAXRTX 4
+
+
+/* ---------- ARP options ---------- */
+#define LWIP_ARP 1
+#define ARP_TABLE_SIZE 10
+#define ARP_QUEUEING 1
+
+
+/* ---------- IP options ---------- */
+/* Define IP_FORWARD to 1 if you wish to have the ability to forward
+ IP packets across network interfaces. If you are going to run lwIP
+ on a device with only one network interface, define this to 0. */
+#define IP_FORWARD 1
+
+/* IP reassembly and segmentation.These are orthogonal even
+ * if they both deal with IP fragments */
+#define IP_REASSEMBLY 1
+#define IP_REASS_MAX_PBUFS (10 * ((1500 + PBUF_POOL_BUFSIZE - 1) / PBUF_POOL_BUFSIZE))
+#define MEMP_NUM_REASSDATA IP_REASS_MAX_PBUFS
+#define IP_FRAG 1
+#define IPV6_FRAG_COPYHEADER 1
+
+/* ---------- ICMP options ---------- */
+#define ICMP_TTL 255
+
+
+/* ---------- DHCP options ---------- */
+/* Define LWIP_DHCP to 1 if you want DHCP configuration of
+ interfaces. */
+#define LWIP_DHCP LWIP_UDP
+
+/* 1 if you want to do an ARP check on the offered address
+ (recommended). */
+#define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
+
+
+/* ---------- AUTOIP options ------- */
+#define LWIP_AUTOIP (LWIP_DHCP)
+#define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)
+
+
+/* ---------- UDP options ---------- */
+#define LWIP_UDP 1
+#define LWIP_UDPLITE LWIP_UDP
+#define UDP_TTL 255
+
+
+/* ---------- RAW options ---------- */
+#define LWIP_RAW 1
+
+
+/* ---------- Statistics options ---------- */
+
+#define LWIP_STATS 1
+#define LWIP_STATS_DISPLAY 1
+
+#if LWIP_STATS
+#define LINK_STATS 1
+#define IP_STATS 1
+#define ICMP_STATS 1
+#define IGMP_STATS 1
+#define IPFRAG_STATS 1
+#define UDP_STATS 1
+#define TCP_STATS 1
+#define MEM_STATS 1
+#define MEMP_STATS 1
+#define PBUF_STATS 1
+#define SYS_STATS 1
+#endif /* LWIP_STATS */
+
+/* ---------- NETBIOS options ---------- */
+#define LWIP_NETBIOS_RESPOND_NAME_QUERY 1
+
+/* ---------- PPP options ---------- */
+
+#define PPP_SUPPORT 1 /* Set > 0 for PPP */
+
+#if PPP_SUPPORT
+
+#define NUM_PPP 1 /* Max PPP sessions. */
+
+
+/* Select modules to enable. Ideally these would be set in the makefile but
+ * we're limited by the command line length so you need to modify the settings
+ * in this file.
+ */
+#define PPPOE_SUPPORT 1
+#define PPPOS_SUPPORT 1
+
+#define PAP_SUPPORT 1 /* Set > 0 for PAP. */
+#define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
+#define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP */
+#define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
+#define CCP_SUPPORT 0 /* Set > 0 for CCP */
+#define VJ_SUPPORT 0 /* Set > 0 for VJ header compression. */
+#define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
+
+#endif /* PPP_SUPPORT */
+
+#endif /* LWIP_OPTTEST_FILE */
+
+/* The following defines must be done even in OPTTEST mode: */
+
+#if !defined(NO_SYS) || !NO_SYS /* default is 0 */
+void sys_check_core_locking(void);
+#define LWIP_ASSERT_CORE_LOCKED() sys_check_core_locking()
+#endif
+
+#ifndef LWIP_PLATFORM_ASSERT
+/* Define LWIP_PLATFORM_ASSERT to something to catch missing stdio.h includes */
+void lwip_example_app_platform_assert(const char *msg, int line, const char *file);
+#define LWIP_PLATFORM_ASSERT(x) lwip_example_app_platform_assert(x, __LINE__, __FILE__)
+#endif
+
+#endif /* LWIP_LWIPOPTS_H */
diff --git a/contrib/examples/example_app/lwippools.h b/contrib/examples/example_app/lwippools.h
new file mode 100644
index 0000000..f58aa59
--- /dev/null
+++ b/contrib/examples/example_app/lwippools.h
@@ -0,0 +1,20 @@
+/* OPTIONAL: Pools to replace heap allocation
+ * Optional: Pools can be used instead of the heap for mem_malloc. If
+ * so, these should be defined here, in increasing order according to
+ * the pool element size.
+ *
+ * LWIP_MALLOC_MEMPOOL(number_elements, element_size)
+ */
+#if MEM_USE_POOLS
+LWIP_MALLOC_MEMPOOL_START
+LWIP_MALLOC_MEMPOOL(100, 256)
+LWIP_MALLOC_MEMPOOL(50, 512)
+LWIP_MALLOC_MEMPOOL(20, 1024)
+LWIP_MALLOC_MEMPOOL(20, 1536)
+LWIP_MALLOC_MEMPOOL_END
+#endif /* MEM_USE_POOLS */
+
+/* Optional: Your custom pools can go here if you would like to use
+ * lwIP's memory pools for anything else.
+ */
+LWIP_MEMPOOL(SYS_MBOX, 22, 100, "SYS_MBOX")
diff --git a/contrib/examples/example_app/ppp_settings.h b/contrib/examples/example_app/ppp_settings.h
new file mode 100644
index 0000000..7b3ee1a
--- /dev/null
+++ b/contrib/examples/example_app/ppp_settings.h
@@ -0,0 +1,6 @@
+#ifdef _MSC_VER
+#pragma warning (disable: 4242) /* PPP only: conversion from 'x' to 'y', possible loss of data */
+#pragma warning (disable: 4244) /* PPP only: conversion from 'x' to 'y', possible loss of data (again?) */
+#pragma warning (disable: 4310) /* PPP only: cast truncates constant value */
+#pragma warning (disable: 4706) /* PPP only: assignment within conditional expression */
+#endif /* MSC_VER */
diff --git a/contrib/examples/example_app/test.c b/contrib/examples/example_app/test.c
new file mode 100644
index 0000000..4f4b5d7
--- /dev/null
+++ b/contrib/examples/example_app/test.c
@@ -0,0 +1,773 @@
+/*
+ * Copyright (c) 2001,2002 Florian Schulze.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the authors nor the names of the contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * test.c - This file is part of lwIP test
+ *
+ */
+
+/* C runtime includes */
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+
+/* lwIP core includes */
+#include "lwip/opt.h"
+
+#include "lwip/sys.h"
+#include "lwip/timeouts.h"
+#include "lwip/debug.h"
+#include "lwip/stats.h"
+#include "lwip/init.h"
+#include "lwip/tcpip.h"
+#include "lwip/netif.h"
+#include "lwip/api.h"
+
+#include "lwip/tcp.h"
+#include "lwip/udp.h"
+#include "lwip/dns.h"
+#include "lwip/dhcp.h"
+#include "lwip/autoip.h"
+
+/* lwIP netif includes */
+#include "lwip/etharp.h"
+#include "netif/ethernet.h"
+
+/* applications includes */
+#include "lwip/apps/netbiosns.h"
+#include "lwip/apps/httpd.h"
+#include "apps/httpserver/httpserver-netconn.h"
+#include "apps/netio/netio.h"
+#include "apps/ping/ping.h"
+#include "apps/rtp/rtp.h"
+#include "apps/chargen/chargen.h"
+#include "apps/shell/shell.h"
+#include "apps/tcpecho/tcpecho.h"
+#include "apps/udpecho/udpecho.h"
+#include "apps/tcpecho_raw/tcpecho_raw.h"
+#include "apps/socket_examples/socket_examples.h"
+
+#include "examples/lwiperf/lwiperf_example.h"
+#include "examples/mdns/mdns_example.h"
+#include "examples/snmp/snmp_example.h"
+#include "examples/tftp/tftp_example.h"
+#include "examples/sntp/sntp_example.h"
+#include "examples/mqtt/mqtt_example.h"
+
+#include "examples/httpd/cgi_example/cgi_example.h"
+#include "examples/httpd/fs_example/fs_example.h"
+#include "examples/httpd/https_example/https_example.h"
+#include "examples/httpd/ssi_example/ssi_example.h"
+
+#include "default_netif.h"
+
+#if NO_SYS
+/* ... then we need information about the timer intervals: */
+#include "lwip/ip4_frag.h"
+#include "lwip/igmp.h"
+#endif /* NO_SYS */
+
+#include "netif/ppp/ppp_opts.h"
+#if PPP_SUPPORT
+/* PPP includes */
+#include "lwip/sio.h"
+#include "netif/ppp/pppapi.h"
+#include "netif/ppp/pppos.h"
+#include "netif/ppp/pppoe.h"
+#if !NO_SYS && !LWIP_PPP_API
+#error With NO_SYS==0, LWIP_PPP_API==1 is required.
+#endif
+#endif /* PPP_SUPPORT */
+
+/* include the port-dependent configuration */
+#include "lwipcfg.h"
+
+#ifndef LWIP_EXAMPLE_APP_ABORT
+#define LWIP_EXAMPLE_APP_ABORT() 0
+#endif
+
+/** Define this to 1 to enable a port-specific ethernet interface as default interface. */
+#ifndef USE_DEFAULT_ETH_NETIF
+#define USE_DEFAULT_ETH_NETIF 1
+#endif
+
+/** Define this to 1 to enable a PPP interface. */
+#ifndef USE_PPP
+#define USE_PPP 0
+#endif
+
+/** Define this to 1 or 2 to support 1 or 2 SLIP interfaces. */
+#ifndef USE_SLIPIF
+#define USE_SLIPIF 0
+#endif
+
+/** Use an ethernet adapter? Default to enabled if port-specific ethernet netif or PPPoE are used. */
+#ifndef USE_ETHERNET
+#define USE_ETHERNET (USE_DEFAULT_ETH_NETIF || PPPOE_SUPPORT)
+#endif
+
+/** Use an ethernet adapter for TCP/IP? By default only if port-specific ethernet netif is used. */
+#ifndef USE_ETHERNET_TCPIP
+#define USE_ETHERNET_TCPIP (USE_DEFAULT_ETH_NETIF)
+#endif
+
+#if USE_SLIPIF
+#include <netif/slipif.h>
+#endif /* USE_SLIPIF */
+
+#ifndef USE_DHCP
+#define USE_DHCP LWIP_DHCP
+#endif
+#ifndef USE_AUTOIP
+#define USE_AUTOIP LWIP_AUTOIP
+#endif
+
+/* global variables for netifs */
+#if USE_ETHERNET
+#if LWIP_DHCP
+/* dhcp struct for the ethernet netif */
+static struct dhcp netif_dhcp;
+#endif /* LWIP_DHCP */
+#if LWIP_AUTOIP
+/* autoip struct for the ethernet netif */
+static struct autoip netif_autoip;
+#endif /* LWIP_AUTOIP */
+#endif /* USE_ETHERNET */
+#if USE_PPP
+/* THE PPP PCB */
+static ppp_pcb *ppp;
+/* THE PPP interface */
+static struct netif ppp_netif;
+/* THE PPP descriptor */
+static u8_t sio_idx = 0;
+static sio_fd_t ppp_sio;
+#endif /* USE_PPP */
+#if USE_SLIPIF
+static struct netif slipif1;
+#if USE_SLIPIF > 1
+static struct netif slipif2;
+#endif /* USE_SLIPIF > 1 */
+#endif /* USE_SLIPIF */
+
+
+#if USE_PPP
+static void
+pppLinkStatusCallback(ppp_pcb *pcb, int errCode, void *ctx)
+{
+ struct netif *pppif = ppp_netif(pcb);
+ LWIP_UNUSED_ARG(ctx);
+
+ switch(errCode) {
+ case PPPERR_NONE: { /* No error. */
+ printf("pppLinkStatusCallback: PPPERR_NONE\n");
+#if LWIP_IPV4
+ printf(" our_ipaddr = %s\n", ip4addr_ntoa(netif_ip4_addr(pppif)));
+ printf(" his_ipaddr = %s\n", ip4addr_ntoa(netif_ip4_gw(pppif)));
+ printf(" netmask = %s\n", ip4addr_ntoa(netif_ip4_netmask(pppif)));
+#endif /* LWIP_IPV4 */
+#if LWIP_DNS
+ printf(" dns1 = %s\n", ipaddr_ntoa(dns_getserver(0)));
+ printf(" dns2 = %s\n", ipaddr_ntoa(dns_getserver(1)));
+#endif /* LWIP_DNS */
+#if PPP_IPV6_SUPPORT
+ printf(" our6_ipaddr = %s\n", ip6addr_ntoa(netif_ip6_addr(pppif, 0)));
+#endif /* PPP_IPV6_SUPPORT */
+ break;
+ }
+ case PPPERR_PARAM: { /* Invalid parameter. */
+ printf("pppLinkStatusCallback: PPPERR_PARAM\n");
+ break;
+ }
+ case PPPERR_OPEN: { /* Unable to open PPP session. */
+ printf("pppLinkStatusCallback: PPPERR_OPEN\n");
+ break;
+ }
+ case PPPERR_DEVICE: { /* Invalid I/O device for PPP. */
+ printf("pppLinkStatusCallback: PPPERR_DEVICE\n");
+ break;
+ }
+ case PPPERR_ALLOC: { /* Unable to allocate resources. */
+ printf("pppLinkStatusCallback: PPPERR_ALLOC\n");
+ break;
+ }
+ case PPPERR_USER: { /* User interrupt. */
+ printf("pppLinkStatusCallback: PPPERR_USER\n");
+ break;
+ }
+ case PPPERR_CONNECT: { /* Connection lost. */
+ printf("pppLinkStatusCallback: PPPERR_CONNECT\n");
+ break;
+ }
+ case PPPERR_AUTHFAIL: { /* Failed authentication challenge. */
+ printf("pppLinkStatusCallback: PPPERR_AUTHFAIL\n");
+ break;
+ }
+ case PPPERR_PROTOCOL: { /* Failed to meet protocol. */
+ printf("pppLinkStatusCallback: PPPERR_PROTOCOL\n");
+ break;
+ }
+ case PPPERR_PEERDEAD: { /* Connection timeout */
+ printf("pppLinkStatusCallback: PPPERR_PEERDEAD\n");
+ break;
+ }
+ case PPPERR_IDLETIMEOUT: { /* Idle Timeout */
+ printf("pppLinkStatusCallback: PPPERR_IDLETIMEOUT\n");
+ break;
+ }
+ case PPPERR_CONNECTTIME: { /* Max connect time reached */
+ printf("pppLinkStatusCallback: PPPERR_CONNECTTIME\n");
+ break;
+ }
+ case PPPERR_LOOPBACK: { /* Loopback detected */
+ printf("pppLinkStatusCallback: PPPERR_LOOPBACK\n");
+ break;
+ }
+ default: {
+ printf("pppLinkStatusCallback: unknown errCode %d\n", errCode);
+ break;
+ }
+ }
+}
+
+#if PPPOS_SUPPORT
+static u32_t
+ppp_output_cb(ppp_pcb *pcb, const void *data, u32_t len, void *ctx)
+{
+ LWIP_UNUSED_ARG(pcb);
+ LWIP_UNUSED_ARG(ctx);
+ return sio_write(ppp_sio, (const u8_t*)data, len);
+}
+#endif /* PPPOS_SUPPORT */
+#endif /* USE_PPP */
+
+#if LWIP_NETIF_STATUS_CALLBACK
+static void
+status_callback(struct netif *state_netif)
+{
+ if (netif_is_up(state_netif)) {
+#if LWIP_IPV4
+ printf("status_callback==UP, local interface IP is %s\n", ip4addr_ntoa(netif_ip4_addr(state_netif)));
+#else
+ printf("status_callback==UP\n");
+#endif
+ } else {
+ printf("status_callback==DOWN\n");
+ }
+}
+#endif /* LWIP_NETIF_STATUS_CALLBACK */
+
+#if LWIP_NETIF_LINK_CALLBACK
+static void
+link_callback(struct netif *state_netif)
+{
+ if (netif_is_link_up(state_netif)) {
+ printf("link_callback==UP\n");
+ } else {
+ printf("link_callback==DOWN\n");
+ }
+}
+#endif /* LWIP_NETIF_LINK_CALLBACK */
+
+/* This function initializes all network interfaces */
+static void
+test_netif_init(void)
+{
+#if LWIP_IPV4 && USE_ETHERNET
+ ip4_addr_t ipaddr, netmask, gw;
+#endif /* LWIP_IPV4 && USE_ETHERNET */
+#if USE_SLIPIF
+ u8_t num_slip1 = 0;
+#if LWIP_IPV4
+ ip4_addr_t ipaddr_slip1, netmask_slip1, gw_slip1;
+#endif
+#if USE_SLIPIF > 1
+ u8_t num_slip2 = 1;
+#if LWIP_IPV4
+ ip4_addr_t ipaddr_slip2, netmask_slip2, gw_slip2;
+#endif
+#endif /* USE_SLIPIF > 1 */
+#endif /* USE_SLIPIF */
+#if USE_DHCP || USE_AUTOIP
+ err_t err;
+#endif
+
+#if USE_PPP
+ const char *username = NULL, *password = NULL;
+#ifdef PPP_USERNAME
+ username = PPP_USERNAME;
+#endif
+#ifdef PPP_PASSWORD
+ password = PPP_PASSWORD;
+#endif
+ printf("ppp_connect: COM%d\n", (int)sio_idx);
+#if PPPOS_SUPPORT
+ ppp_sio = sio_open(sio_idx);
+ if (ppp_sio == NULL) {
+ printf("sio_open error\n");
+ } else {
+ ppp = pppos_create(&ppp_netif, ppp_output_cb, pppLinkStatusCallback, NULL);
+ if (ppp == NULL) {
+ printf("pppos_create error\n");
+ } else {
+ ppp_set_auth(ppp, PPPAUTHTYPE_ANY, username, password);
+ ppp_connect(ppp, 0);
+ }
+ }
+#endif /* PPPOS_SUPPORT */
+#endif /* USE_PPP */
+
+#if USE_ETHERNET
+#if LWIP_IPV4
+ ip4_addr_set_zero(&gw);
+ ip4_addr_set_zero(&ipaddr);
+ ip4_addr_set_zero(&netmask);
+#if USE_ETHERNET_TCPIP
+#if USE_DHCP
+ printf("Starting lwIP, local interface IP is dhcp-enabled\n");
+#elif USE_AUTOIP
+ printf("Starting lwIP, local interface IP is autoip-enabled\n");
+#else /* USE_DHCP */
+ LWIP_PORT_INIT_GW(&gw);
+ LWIP_PORT_INIT_IPADDR(&ipaddr);
+ LWIP_PORT_INIT_NETMASK(&netmask);
+ printf("Starting lwIP, local interface IP is %s\n", ip4addr_ntoa(&ipaddr));
+#endif /* USE_DHCP */
+#endif /* USE_ETHERNET_TCPIP */
+#else /* LWIP_IPV4 */
+ printf("Starting lwIP, IPv4 disable\n");
+#endif /* LWIP_IPV4 */
+
+#if LWIP_IPV4
+ init_default_netif(&ipaddr, &netmask, &gw);
+#else
+ init_default_netif();
+#endif
+#if LWIP_IPV6
+ netif_create_ip6_linklocal_address(netif_default, 1);
+ printf("ip6 linklocal address: %s\n", ip6addr_ntoa(netif_ip6_addr(netif_default, 0)));
+#endif /* LWIP_IPV6 */
+#if LWIP_NETIF_STATUS_CALLBACK
+ netif_set_status_callback(netif_default, status_callback);
+#endif /* LWIP_NETIF_STATUS_CALLBACK */
+#if LWIP_NETIF_LINK_CALLBACK
+ netif_set_link_callback(netif_default, link_callback);
+#endif /* LWIP_NETIF_LINK_CALLBACK */
+
+#if USE_ETHERNET_TCPIP
+#if LWIP_AUTOIP
+ autoip_set_struct(netif_default, &netif_autoip);
+#endif /* LWIP_AUTOIP */
+#if LWIP_DHCP
+ dhcp_set_struct(netif_default, &netif_dhcp);
+#endif /* LWIP_DHCP */
+ netif_set_up(netif_default);
+#if USE_DHCP
+ err = dhcp_start(netif_default);
+ LWIP_ASSERT("dhcp_start failed", err == ERR_OK);
+#elif USE_AUTOIP
+ err = autoip_start(netif_default);
+ LWIP_ASSERT("autoip_start failed", err == ERR_OK);
+#endif /* USE_DHCP */
+#else /* USE_ETHERNET_TCPIP */
+ /* Use ethernet for PPPoE only */
+ netif.flags &= ~(NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP); /* no ARP */
+ netif.flags |= NETIF_FLAG_ETHERNET; /* but pure ethernet */
+#endif /* USE_ETHERNET_TCPIP */
+
+#if USE_PPP && PPPOE_SUPPORT
+ /* start PPPoE after ethernet netif is added! */
+ ppp = pppoe_create(&ppp_netif, netif_default, NULL, NULL, pppLinkStatusCallback, NULL);
+ if (ppp == NULL) {
+ printf("pppoe_create error\n");
+ } else {
+ ppp_set_auth(ppp, PPPAUTHTYPE_ANY, username, password);
+ ppp_connect(ppp, 0);
+ }
+#endif /* USE_PPP && PPPOE_SUPPORT */
+
+#endif /* USE_ETHERNET */
+#if USE_SLIPIF
+#if LWIP_IPV4
+#define SLIP1_ADDRS &ipaddr_slip1, &netmask_slip1, &gw_slip1,
+ LWIP_PORT_INIT_SLIP1_IPADDR(&ipaddr_slip1);
+ LWIP_PORT_INIT_SLIP1_GW(&gw_slip1);
+ LWIP_PORT_INIT_SLIP1_NETMASK(&netmask_slip1);
+ printf("Starting lwIP slipif, local interface IP is %s\n", ip4addr_ntoa(&ipaddr_slip1));
+#else
+#define SLIP1_ADDRS
+ printf("Starting lwIP slipif\n");
+#endif
+#if defined(SIO_USE_COMPORT) && SIO_USE_COMPORT
+ num_slip1++; /* COM ports cannot be 0-based */
+#endif
+ netif_add(&slipif1, SLIP1_ADDRS &num_slip1, slipif_init, ip_input);
+#if !USE_ETHERNET
+ netif_set_default(&slipif1);
+#endif /* !USE_ETHERNET */
+#if LWIP_IPV6
+ netif_create_ip6_linklocal_address(&slipif1, 1);
+ printf("SLIP ip6 linklocal address: %s\n", ip6addr_ntoa(netif_ip6_addr(&slipif1, 0)));
+#endif /* LWIP_IPV6 */
+#if LWIP_NETIF_STATUS_CALLBACK
+ netif_set_status_callback(&slipif1, status_callback);
+#endif /* LWIP_NETIF_STATUS_CALLBACK */
+#if LWIP_NETIF_LINK_CALLBACK
+ netif_set_link_callback(&slipif1, link_callback);
+#endif /* LWIP_NETIF_LINK_CALLBACK */
+ netif_set_up(&slipif1);
+
+#if USE_SLIPIF > 1
+#if LWIP_IPV4
+#define SLIP2_ADDRS &ipaddr_slip2, &netmask_slip2, &gw_slip2,
+ LWIP_PORT_INIT_SLIP2_IPADDR(&ipaddr_slip2);
+ LWIP_PORT_INIT_SLIP2_GW(&gw_slip2);
+ LWIP_PORT_INIT_SLIP2_NETMASK(&netmask_slip2);
+ printf("Starting lwIP SLIP if #2, local interface IP is %s\n", ip4addr_ntoa(&ipaddr_slip2));
+#else
+#define SLIP2_ADDRS
+ printf("Starting lwIP SLIP if #2\n");
+#endif
+#if defined(SIO_USE_COMPORT) && SIO_USE_COMPORT
+ num_slip2++; /* COM ports cannot be 0-based */
+#endif
+ netif_add(&slipif2, SLIP2_ADDRS &num_slip2, slipif_init, ip_input);
+#if LWIP_IPV6
+ netif_create_ip6_linklocal_address(&slipif1, 1);
+ printf("SLIP2 ip6 linklocal address: ");
+ ip6_addr_debug_print(0xFFFFFFFF & ~LWIP_DBG_HALT, netif_ip6_addr(&slipif2, 0));
+ printf("\n");
+#endif /* LWIP_IPV6 */
+#if LWIP_NETIF_STATUS_CALLBACK
+ netif_set_status_callback(&slipif2, status_callback);
+#endif /* LWIP_NETIF_STATUS_CALLBACK */
+#if LWIP_NETIF_LINK_CALLBACK
+ netif_set_link_callback(&slipif2, link_callback);
+#endif /* LWIP_NETIF_LINK_CALLBACK */
+ netif_set_up(&slipif2);
+#endif /* USE_SLIPIF > 1*/
+#endif /* USE_SLIPIF */
+}
+
+#if LWIP_DNS_APP && LWIP_DNS
+static void
+dns_found(const char *name, const ip_addr_t *addr, void *arg)
+{
+ LWIP_UNUSED_ARG(arg);
+ printf("%s: %s\n", name, addr ? ipaddr_ntoa(addr) : "<not found>");
+}
+
+static void
+dns_dorequest(void *arg)
+{
+ const char* dnsname = "3com.com";
+ ip_addr_t dnsresp;
+ LWIP_UNUSED_ARG(arg);
+
+ if (dns_gethostbyname(dnsname, &dnsresp, dns_found, NULL) == ERR_OK) {
+ dns_found(dnsname, &dnsresp, NULL);
+ }
+}
+#endif /* LWIP_DNS_APP && LWIP_DNS */
+
+/* This function initializes applications */
+static void
+apps_init(void)
+{
+#if LWIP_DNS_APP && LWIP_DNS
+ /* wait until the netif is up (for dhcp, autoip or ppp) */
+ sys_timeout(5000, dns_dorequest, NULL);
+#endif /* LWIP_DNS_APP && LWIP_DNS */
+
+#if LWIP_CHARGEN_APP && LWIP_SOCKET
+ chargen_init();
+#endif /* LWIP_CHARGEN_APP && LWIP_SOCKET */
+
+#if LWIP_PING_APP && LWIP_RAW && LWIP_ICMP
+ ping_init(&netif_default->gw);
+#endif /* LWIP_PING_APP && LWIP_RAW && LWIP_ICMP */
+
+#if LWIP_NETBIOS_APP && LWIP_UDP
+ netbiosns_init();
+#ifndef NETBIOS_LWIP_NAME
+#if LWIP_NETIF_HOSTNAME
+ netbiosns_set_name(netif_default->hostname);
+#else
+ netbiosns_set_name("NETBIOSLWIPDEV");
+#endif
+#endif
+#endif /* LWIP_NETBIOS_APP && LWIP_UDP */
+
+#if LWIP_HTTPD_APP && LWIP_TCP
+#ifdef LWIP_HTTPD_APP_NETCONN
+ http_server_netconn_init();
+#else /* LWIP_HTTPD_APP_NETCONN */
+#if defined(LWIP_HTTPD_EXAMPLE_CUSTOMFILES) && LWIP_HTTPD_EXAMPLE_CUSTOMFILES && defined(LWIP_HTTPD_EXAMPLE_CUSTOMFILES_ROOTDIR)
+ fs_ex_init(LWIP_HTTPD_EXAMPLE_CUSTOMFILES_ROOTDIR);
+#endif
+ httpd_init();
+#if defined(LWIP_HTTPD_EXAMPLE_SSI_SIMPLE) && LWIP_HTTPD_EXAMPLE_SSI_SIMPLE
+ ssi_ex_init();
+#endif
+#if defined(LWIP_HTTPD_EXAMPLE_CGI_SIMPLE) && LWIP_HTTPD_EXAMPLE_CGI_SIMPLE
+ cgi_ex_init();
+#endif
+#if defined(LWIP_HTTPD_EXAMPLE_HTTPS) && LWIP_HTTPD_EXAMPLE_HTTPS
+ https_ex_init();
+#endif
+#endif /* LWIP_HTTPD_APP_NETCONN */
+#endif /* LWIP_HTTPD_APP && LWIP_TCP */
+
+#if LWIP_NETIO_APP && LWIP_TCP
+ netio_init();
+#endif /* LWIP_NETIO_APP && LWIP_TCP */
+
+#if LWIP_RTP_APP && LWIP_SOCKET && LWIP_IGMP
+ rtp_init();
+#endif /* LWIP_RTP_APP && LWIP_SOCKET && LWIP_IGMP */
+
+#if LWIP_SHELL_APP && LWIP_NETCONN
+ shell_init();
+#endif /* LWIP_SHELL_APP && LWIP_NETCONN */
+#if LWIP_TCPECHO_APP
+#if LWIP_NETCONN && defined(LWIP_TCPECHO_APP_NETCONN)
+ tcpecho_init();
+#else /* LWIP_NETCONN && defined(LWIP_TCPECHO_APP_NETCONN) */
+ tcpecho_raw_init();
+#endif
+#endif /* LWIP_TCPECHO_APP && LWIP_NETCONN */
+#if LWIP_UDPECHO_APP && LWIP_NETCONN
+ udpecho_init();
+#endif /* LWIP_UDPECHO_APP && LWIP_NETCONN */
+#if LWIP_SOCKET_EXAMPLES_APP && LWIP_SOCKET
+ socket_examples_init();
+#endif /* LWIP_SOCKET_EXAMPLES_APP && LWIP_SOCKET */
+#if LWIP_MDNS_APP
+ mdns_example_init();
+#endif
+#if LWIP_SNMP_APP
+ snmp_example_init();
+#endif
+#if LWIP_SNTP_APP
+ sntp_example_init();
+#endif
+#if LWIP_TFTP_APP
+ tftp_example_init_server();
+#endif
+#if LWIP_TFTP_CLIENT_APP
+ tftp_example_init_client();
+#endif
+#if LWIP_LWIPERF_APP
+ lwiperf_example_init();
+#endif
+#if LWIP_MQTT_APP
+ mqtt_example_init();
+#endif
+
+#ifdef LWIP_APP_INIT
+ LWIP_APP_INIT();
+#endif
+}
+
+/* This function initializes this lwIP test. When NO_SYS=1, this is done in
+ * the main_loop context (there is no other one), when NO_SYS=0, this is done
+ * in the tcpip_thread context */
+static void
+test_init(void * arg)
+{ /* remove compiler warning */
+#if NO_SYS
+ LWIP_UNUSED_ARG(arg);
+#else /* NO_SYS */
+ sys_sem_t *init_sem;
+ LWIP_ASSERT("arg != NULL", arg != NULL);
+ init_sem = (sys_sem_t*)arg;
+#endif /* NO_SYS */
+
+ /* init randomizer again (seed per thread) */
+ srand((unsigned int)time(NULL));
+
+ /* init network interfaces */
+ test_netif_init();
+
+ /* init apps */
+ apps_init();
+
+#if !NO_SYS
+ sys_sem_signal(init_sem);
+#endif /* !NO_SYS */
+}
+
+/* This is somewhat different to other ports: we have a main loop here:
+ * a dedicated task that waits for packets to arrive. This would normally be
+ * done from interrupt context with embedded hardware, but we don't get an
+ * interrupt in windows for that :-) */
+static void
+main_loop(void)
+{
+#if !NO_SYS
+ err_t err;
+ sys_sem_t init_sem;
+#endif /* NO_SYS */
+#if USE_PPP
+#if !USE_ETHERNET
+ int count;
+ u8_t rxbuf[1024];
+#endif
+ volatile int callClosePpp = 0;
+#endif /* USE_PPP */
+
+ /* initialize lwIP stack, network interfaces and applications */
+#if NO_SYS
+ lwip_init();
+ test_init(NULL);
+#else /* NO_SYS */
+ err = sys_sem_new(&init_sem, 0);
+ LWIP_ASSERT("failed to create init_sem", err == ERR_OK);
+ LWIP_UNUSED_ARG(err);
+ tcpip_init(test_init, &init_sem);
+ /* we have to wait for initialization to finish before
+ * calling update_adapter()! */
+ sys_sem_wait(&init_sem);
+ sys_sem_free(&init_sem);
+#endif /* NO_SYS */
+
+#if (LWIP_SOCKET || LWIP_NETCONN) && LWIP_NETCONN_SEM_PER_THREAD
+ netconn_thread_init();
+#endif
+
+ /* MAIN LOOP for driver update (and timers if NO_SYS) */
+ while (!LWIP_EXAMPLE_APP_ABORT()) {
+#if NO_SYS
+ /* handle timers (already done in tcpip.c when NO_SYS=0) */
+ sys_check_timeouts();
+#endif /* NO_SYS */
+
+#if USE_ETHERNET
+ default_netif_poll();
+#else /* USE_ETHERNET */
+ /* try to read characters from serial line and pass them to PPPoS */
+ count = sio_read(ppp_sio, (u8_t*)rxbuf, 1024);
+ if(count > 0) {
+ pppos_input(ppp, rxbuf, count);
+ } else {
+ /* nothing received, give other tasks a chance to run */
+ sys_msleep(1);
+ }
+
+#endif /* USE_ETHERNET */
+#if USE_SLIPIF
+ slipif_poll(&slipif1);
+#if USE_SLIPIF > 1
+ slipif_poll(&slipif2);
+#endif /* USE_SLIPIF > 1 */
+#endif /* USE_SLIPIF */
+#if ENABLE_LOOPBACK && !LWIP_NETIF_LOOPBACK_MULTITHREADING
+ /* check for loopback packets on all netifs */
+ netif_poll_all();
+#endif /* ENABLE_LOOPBACK && !LWIP_NETIF_LOOPBACK_MULTITHREADING */
+#if USE_PPP
+ {
+ int do_hup = 0;
+ if(do_hup) {
+ ppp_close(ppp, 1);
+ do_hup = 0;
+ }
+ }
+ if(callClosePpp && ppp) {
+ /* make sure to disconnect PPP before stopping the program... */
+ callClosePpp = 0;
+#if NO_SYS
+ ppp_close(ppp, 0);
+#else
+ pppapi_close(ppp, 0);
+#endif
+ ppp = NULL;
+ }
+#endif /* USE_PPP */
+ }
+
+#if USE_PPP
+ if(ppp) {
+ u32_t started;
+ printf("Closing PPP connection...\n");
+ /* make sure to disconnect PPP before stopping the program... */
+#if NO_SYS
+ ppp_close(ppp, 0);
+#else
+ pppapi_close(ppp, 0);
+#endif
+ ppp = NULL;
+ /* Wait for some time to let PPP finish... */
+ started = sys_now();
+ do
+ {
+#if USE_ETHERNET
+ default_netif_poll();
+#endif
+ /* @todo: need a better check here: only wait until PPP is down */
+ } while(sys_now() - started < 5000);
+ }
+#endif /* USE_PPP */
+#if (LWIP_SOCKET || LWIP_NETCONN) && LWIP_NETCONN_SEM_PER_THREAD
+ netconn_thread_cleanup();
+#endif
+#if USE_ETHERNET
+ default_netif_shutdown();
+#endif /* USE_ETHERNET */
+}
+
+#if USE_PPP && PPPOS_SUPPORT
+int main(int argc, char **argv)
+#else /* USE_PPP && PPPOS_SUPPORT */
+int main(void)
+#endif /* USE_PPP && PPPOS_SUPPORT */
+{
+#if USE_PPP && PPPOS_SUPPORT
+ if(argc > 1) {
+ sio_idx = (u8_t)atoi(argv[1]);
+ }
+ printf("Using serial port %d for PPP\n", sio_idx);
+#endif /* USE_PPP && PPPOS_SUPPORT */
+ /* no stdio-buffering, please! */
+ setvbuf(stdout, NULL,_IONBF, 0);
+
+ main_loop();
+
+ return 0;
+}
+
+/* This function is only required to prevent arch.h including stdio.h
+ * (which it does if LWIP_PLATFORM_ASSERT is undefined)
+ */
+void lwip_example_app_platform_assert(const char *msg, int line, const char *file)
+{
+ printf("Assertion \"%s\" failed at line %d in %s\n", msg, line, file);
+ fflush(NULL);
+ abort();
+}
diff --git a/contrib/examples/example_app/test_configs/opt_default.h b/contrib/examples/example_app/test_configs/opt_default.h
new file mode 100644
index 0000000..67b69d2
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_default.h
@@ -0,0 +1,295 @@
+/* test an lwipopts.h file with default contents */
+#define NO_SYS 0
+#define NO_SYS_NO_TIMERS 0
+#define LWIP_TIMERS 1
+#define LWIP_TIMERS_CUSTOM 0
+#define LWIP_MPU_COMPATIBLE 0
+#define LWIP_TCPIP_CORE_LOCKING 1
+#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
+#define SYS_LIGHTWEIGHT_PROT 1
+#define MEM_LIBC_MALLOC 0
+#define MEMP_MEM_MALLOC 0
+#define MEMP_MEM_INIT 0
+#define MEM_ALIGNMENT 1
+#define MEM_SIZE 1600
+#define MEMP_OVERFLOW_CHECK 0
+#define MEMP_SANITY_CHECK 0
+#define MEM_OVERFLOW_CHECK 0
+#define MEM_SANITY_CHECK 0
+#define MEM_USE_POOLS 0
+#define MEM_USE_POOLS_TRY_BIGGER_POOL 0
+#define MEMP_USE_CUSTOM_POOLS 0
+#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
+/*#define MEMP_NUM_PBUF 16
+#define MEMP_NUM_RAW_PCB 4
+#define MEMP_NUM_UDP_PCB 4
+#define MEMP_NUM_TCP_PCB 5
+#define MEMP_NUM_TCP_PCB_LISTEN 8
+#define MEMP_NUM_TCP_SEG 16
+#define MEMP_NUM_ALTCP_PCB MEMP_NUM_TCP_PCB
+#define MEMP_NUM_REASSDATA 5
+#define MEMP_NUM_FRAG_PBUF 15
+#define MEMP_NUM_ARP_QUEUE 30
+#define MEMP_NUM_IGMP_GROUP 8
+#define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 2)
+#define MEMP_NUM_NETBUF 2
+#define MEMP_NUM_NETCONN 4
+#define MEMP_NUM_SELECT_CB 4
+#define MEMP_NUM_TCPIP_MSG_API 8
+#define MEMP_NUM_TCPIP_MSG_INPKT 8
+#define MEMP_NUM_NETDB 1
+#define MEMP_NUM_LOCALHOSTLIST 1
+#define PBUF_POOL_SIZE 16
+#define MEMP_NUM_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_DNS_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_NETIFAPI_MSG MEMP_NUM_TCPIP_MSG_API*/
+#define LWIP_ARP 1
+#define ARP_TABLE_SIZE 10
+#define ARP_MAXAGE 300
+#define ARP_QUEUEING 0
+#define ARP_QUEUE_LEN 3
+#define ETHARP_SUPPORT_VLAN 0
+#define LWIP_ETHERNET LWIP_ARP
+#define ETH_PAD_SIZE 0
+#define ETHARP_SUPPORT_STATIC_ENTRIES 0
+#define ETHARP_TABLE_MATCH_NETIF !LWIP_SINGLE_NETIF
+#define LWIP_IPV4 1
+#define IP_FORWARD 0
+#define IP_REASSEMBLY 1
+#define IP_FRAG 1
+#define IP_OPTIONS_ALLOWED 1
+#define IP_REASS_MAXAGE 15
+#define IP_REASS_MAX_PBUFS 10
+#define IP_DEFAULT_TTL 255
+#define IP_SOF_BROADCAST 0
+#define IP_SOF_BROADCAST_RECV 0
+#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
+#define LWIP_ICMP 1
+#define ICMP_TTL (IP_DEFAULT_TTL)
+#define LWIP_BROADCAST_PING 0
+#define LWIP_MULTICAST_PING 0
+#define LWIP_RAW 0
+#define RAW_TTL (IP_DEFAULT_TTL)
+#define LWIP_DHCP 1
+#define LWIP_DHCP_CHECK_LINK_UP 0
+#define LWIP_DHCP_BOOTP_FILE 0
+#define LWIP_DHCP_GET_NTP_SRV 0
+#define LWIP_DHCP_MAX_NTP_SERVERS 1
+#define LWIP_DHCP_MAX_DNS_SERVERS DNS_MAX_SERVERS
+#define LWIP_AUTOIP 0
+#define LWIP_DHCP_AUTOIP_COOP 0
+#define LWIP_DHCP_AUTOIP_COOP_TRIES 9
+#define LWIP_MIB2_CALLBACKS 0
+#define LWIP_MULTICAST_TX_OPTIONS ((LWIP_IGMP || LWIP_IPV6_MLD) && (LWIP_UDP || LWIP_RAW))
+#define LWIP_IGMP 0
+#define LWIP_DNS 0
+#define DNS_TABLE_SIZE 4
+#define DNS_MAX_NAME_LENGTH 256
+#define DNS_MAX_SERVERS 2
+#define DNS_MAX_RETRIES 4
+#define DNS_DOES_NAME_CHECK 1
+#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
+#define DNS_LOCAL_HOSTLIST 0
+#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
+#define LWIP_DNS_SUPPORT_MDNS_QUERIES 0
+#define LWIP_UDP 1
+#define LWIP_UDPLITE 0
+#define UDP_TTL (IP_DEFAULT_TTL)
+#define LWIP_NETBUF_RECVINFO 0
+#define LWIP_TCP 1
+#define TCP_TTL (IP_DEFAULT_TTL)
+#define TCP_WND (4 * TCP_MSS)
+#define TCP_MAXRTX 12
+#define TCP_SYNMAXRTX 6
+#define TCP_QUEUE_OOSEQ (LWIP_TCP)
+#define LWIP_TCP_SACK_OUT 0
+#define LWIP_TCP_MAX_SACK_NUM 4
+#define TCP_MSS 536
+#define TCP_CALCULATE_EFF_SEND_MSS 1
+#define TCP_SND_BUF (2 * TCP_MSS)
+#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
+#define TCP_SNDLOWAT LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1)
+#define TCP_SNDQUEUELOWAT LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5)
+#define TCP_OOSEQ_MAX_BYTES 0
+#define TCP_OOSEQ_BYTES_LIMIT(pcb) TCP_OOSEQ_MAX_BYTES
+#define TCP_OOSEQ_MAX_PBUFS 0
+#define TCP_OOSEQ_PBUFS_LIMIT(pcb) TCP_OOSEQ_MAX_PBUFS
+#define TCP_LISTEN_BACKLOG 0
+#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
+#define TCP_OVERSIZE TCP_MSS
+#define LWIP_TCP_TIMESTAMPS 0
+#define TCP_WND_UPDATE_THRESHOLD LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4))
+#define LWIP_EVENT_API 0
+#define LWIP_CALLBACK_API 1
+#define LWIP_WND_SCALE 0
+#define TCP_RCV_SCALE 0
+#define LWIP_TCP_PCB_NUM_EXT_ARGS 0
+#define LWIP_ALTCP 0
+#define LWIP_ALTCP_TLS 0
+#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
+#define PBUF_LINK_ENCAPSULATION_HLEN 0
+#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
+#define LWIP_PBUF_REF_T u8_t
+#define LWIP_SINGLE_NETIF 0
+#define LWIP_NETIF_HOSTNAME 0
+#define LWIP_NETIF_API 0
+#define LWIP_NETIF_STATUS_CALLBACK 0
+#define LWIP_NETIF_EXT_STATUS_CALLBACK 0
+#define LWIP_NETIF_LINK_CALLBACK 0
+#define LWIP_NETIF_REMOVE_CALLBACK 0
+#define LWIP_NETIF_HWADDRHINT 0
+#define LWIP_NETIF_TX_SINGLE_PBUF 0
+#define LWIP_NUM_NETIF_CLIENT_DATA 0
+#define LWIP_HAVE_LOOPIF (LWIP_NETIF_LOOPBACK && !LWIP_SINGLE_NETIF)
+#define LWIP_LOOPIF_MULTICAST 0
+#define LWIP_NETIF_LOOPBACK 0
+#define LWIP_LOOPBACK_MAX_PBUFS 0
+#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS)
+/*#define TCPIP_THREAD_NAME "tcpip_thread"
+#define TCPIP_THREAD_STACKSIZE 0
+#define TCPIP_THREAD_PRIO 1
+#define TCPIP_MBOX_SIZE 0
+#define LWIP_TCPIP_THREAD_ALIVE()
+#define SLIPIF_THREAD_NAME "slipif_loop"
+#define SLIPIF_THREAD_STACKSIZE 0
+#define SLIPIF_THREAD_PRIO 1
+#define DEFAULT_THREAD_NAME "lwIP"
+#define DEFAULT_THREAD_STACKSIZE 0
+#define DEFAULT_THREAD_PRIO 1
+#define DEFAULT_RAW_RECVMBOX_SIZE 0
+#define DEFAULT_UDP_RECVMBOX_SIZE 0
+#define DEFAULT_TCP_RECVMBOX_SIZE 0
+#define DEFAULT_ACCEPTMBOX_SIZE 0*/
+#define LWIP_NETCONN 1
+#define LWIP_TCPIP_TIMEOUT 0
+#define LWIP_NETCONN_SEM_PER_THREAD 0
+#define LWIP_NETCONN_FULLDUPLEX 0
+#define LWIP_SOCKET 1
+#define LWIP_COMPAT_SOCKETS 1 /* 0..2 */
+#define LWIP_POSIX_SOCKETS_IO_NAMES 1
+#define LWIP_SOCKET_OFFSET 0
+#define LWIP_TCP_KEEPALIVE 0
+#define LWIP_SO_SNDTIMEO 0
+#define LWIP_SO_RCVTIMEO 0
+#define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 0
+#define LWIP_SO_RCVBUF 0
+#define LWIP_SO_LINGER 0
+#define RECV_BUFSIZE_DEFAULT INT_MAX
+#define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000
+#define SO_REUSE 0
+#define SO_REUSE_RXTOALL 0
+#define LWIP_FIONREAD_LINUXMODE 0
+#define LWIP_SOCKET_SELECT 1
+#define LWIP_SOCKET_POLL 1
+#define LWIP_STATS 1
+#define LWIP_STATS_DISPLAY 0
+#define LINK_STATS 1
+#define ETHARP_STATS (LWIP_ARP)
+#define IP_STATS 1
+#define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG)
+#define ICMP_STATS 1
+#define IGMP_STATS (LWIP_IGMP)
+#define UDP_STATS (LWIP_UDP)
+#define TCP_STATS (LWIP_TCP)
+#define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0))
+#define MEMP_STATS (MEMP_MEM_MALLOC == 0)
+#define SYS_STATS (NO_SYS == 0)
+#define IP6_STATS (LWIP_IPV6)
+#define ICMP6_STATS (LWIP_IPV6 && LWIP_ICMP6)
+#define IP6_FRAG_STATS (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS))
+#define MLD6_STATS (LWIP_IPV6 && LWIP_IPV6_MLD)
+#define ND6_STATS (LWIP_IPV6)
+#define MIB2_STATS 0
+#define LWIP_CHECKSUM_CTRL_PER_NETIF 0
+#define CHECKSUM_GEN_IP 1
+#define CHECKSUM_GEN_UDP 1
+#define CHECKSUM_GEN_TCP 1
+#define CHECKSUM_GEN_ICMP 1
+#define CHECKSUM_GEN_ICMP6 1
+#define CHECKSUM_CHECK_IP 1
+#define CHECKSUM_CHECK_UDP 1
+#define CHECKSUM_CHECK_TCP 1
+#define CHECKSUM_CHECK_ICMP 1
+#define CHECKSUM_CHECK_ICMP6 1
+#define LWIP_CHECKSUM_ON_COPY 0
+#define LWIP_IPV6 0
+#define IPV6_REASS_MAXAGE 60
+#define LWIP_IPV6_SCOPES (LWIP_IPV6 && !LWIP_SINGLE_NETIF)
+#define LWIP_IPV6_SCOPES_DEBUG 0
+#define LWIP_IPV6_NUM_ADDRESSES 3
+#define LWIP_IPV6_FORWARD 0
+#define LWIP_IPV6_FRAG 1
+#define LWIP_IPV6_REASS (LWIP_IPV6)
+#define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
+#define LWIP_IPV6_AUTOCONFIG (LWIP_IPV6)
+#define LWIP_IPV6_ADDRESS_LIFETIMES (LWIP_IPV6_AUTOCONFIG)
+#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1
+#define LWIP_ICMP6 (LWIP_IPV6)
+#define LWIP_ICMP6_DATASIZE 8
+#define LWIP_ICMP6_HL 255
+#define LWIP_IPV6_MLD (LWIP_IPV6)
+#define MEMP_NUM_MLD6_GROUP 4
+#define LWIP_ND6_QUEUEING (LWIP_IPV6)
+#define MEMP_NUM_ND6_QUEUE 20
+#define LWIP_ND6_NUM_NEIGHBORS 10
+#define LWIP_ND6_NUM_DESTINATIONS 10
+#define LWIP_ND6_NUM_PREFIXES 5
+#define LWIP_ND6_NUM_ROUTERS 3
+#define LWIP_ND6_MAX_MULTICAST_SOLICIT 3
+#define LWIP_ND6_MAX_UNICAST_SOLICIT 3
+#define LWIP_ND6_MAX_ANYCAST_DELAY_TIME 1000
+#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT 3
+#define LWIP_ND6_REACHABLE_TIME 30000
+#define LWIP_ND6_RETRANS_TIMER 1000
+#define LWIP_ND6_DELAY_FIRST_PROBE_TIME 5000
+#define LWIP_ND6_ALLOW_RA_UPDATES 1
+#define LWIP_ND6_TCP_REACHABILITY_HINTS 1
+#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0
+#define LWIP_IPV6_DHCP6 0
+#define LWIP_IPV6_DHCP6_STATEFUL 0
+#define LWIP_IPV6_DHCP6_STATELESS LWIP_IPV6_DHCP6
+#define LWIP_DHCP6_GET_NTP_SRV 0
+#define LWIP_DHCP6_MAX_NTP_SERVERS 1
+#define LWIP_DHCP6_MAX_DNS_SERVERS DNS_MAX_SERVERS
+
+/* TODO: check hooks */
+
+#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
+#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
+#define ETHARP_DEBUG LWIP_DBG_OFF
+#define NETIF_DEBUG LWIP_DBG_OFF
+#define PBUF_DEBUG LWIP_DBG_OFF
+#define API_LIB_DEBUG LWIP_DBG_OFF
+#define API_MSG_DEBUG LWIP_DBG_OFF
+#define SOCKETS_DEBUG LWIP_DBG_OFF
+#define ICMP_DEBUG LWIP_DBG_OFF
+#define IGMP_DEBUG LWIP_DBG_OFF
+#define INET_DEBUG LWIP_DBG_OFF
+#define IP_DEBUG LWIP_DBG_OFF
+#define IP_REASS_DEBUG LWIP_DBG_OFF
+#define RAW_DEBUG LWIP_DBG_OFF
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define SYS_DEBUG LWIP_DBG_OFF
+#define TIMERS_DEBUG LWIP_DBG_OFF
+#define TCP_DEBUG LWIP_DBG_OFF
+#define TCP_INPUT_DEBUG LWIP_DBG_OFF
+#define TCP_FR_DEBUG LWIP_DBG_OFF
+#define TCP_RTO_DEBUG LWIP_DBG_OFF
+#define TCP_CWND_DEBUG LWIP_DBG_OFF
+#define TCP_WND_DEBUG LWIP_DBG_OFF
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
+#define TCP_RST_DEBUG LWIP_DBG_OFF
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF
+#define UDP_DEBUG LWIP_DBG_OFF
+#define TCPIP_DEBUG LWIP_DBG_OFF
+#define SLIP_DEBUG LWIP_DBG_OFF
+#define DHCP_DEBUG LWIP_DBG_OFF
+#define AUTOIP_DEBUG LWIP_DBG_OFF
+#define DNS_DEBUG LWIP_DBG_OFF
+#define IP6_DEBUG LWIP_DBG_OFF
+#define DHCP6_DEBUG LWIP_DBG_OFF
+#define LWIP_TESTMODE 0
+
+#define LWIP_PERF 0
diff --git a/contrib/examples/example_app/test_configs/opt_dualstack.h b/contrib/examples/example_app/test_configs/opt_dualstack.h
new file mode 100644
index 0000000..4caf490
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_dualstack.h
@@ -0,0 +1,295 @@
+/* test an lwipopts.h file with default contents */
+#define NO_SYS 0
+#define NO_SYS_NO_TIMERS 0
+#define LWIP_TIMERS 1
+#define LWIP_TIMERS_CUSTOM 0
+#define LWIP_MPU_COMPATIBLE 0
+#define LWIP_TCPIP_CORE_LOCKING 1
+#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
+#define SYS_LIGHTWEIGHT_PROT 1
+#define MEM_LIBC_MALLOC 0
+#define MEMP_MEM_MALLOC 0
+#define MEMP_MEM_INIT 0
+#define MEM_ALIGNMENT 1
+#define MEM_SIZE 1600
+#define MEMP_OVERFLOW_CHECK 0
+#define MEMP_SANITY_CHECK 0
+#define MEM_OVERFLOW_CHECK 0
+#define MEM_SANITY_CHECK 0
+#define MEM_USE_POOLS 0
+#define MEM_USE_POOLS_TRY_BIGGER_POOL 0
+#define MEMP_USE_CUSTOM_POOLS 0
+#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
+/*#define MEMP_NUM_PBUF 16
+#define MEMP_NUM_RAW_PCB 4
+#define MEMP_NUM_UDP_PCB 4
+#define MEMP_NUM_TCP_PCB 5
+#define MEMP_NUM_TCP_PCB_LISTEN 8
+#define MEMP_NUM_TCP_SEG 16
+#define MEMP_NUM_ALTCP_PCB MEMP_NUM_TCP_PCB
+#define MEMP_NUM_REASSDATA 5
+#define MEMP_NUM_FRAG_PBUF 15
+#define MEMP_NUM_ARP_QUEUE 30
+#define MEMP_NUM_IGMP_GROUP 8
+#define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 2)
+#define MEMP_NUM_NETBUF 2
+#define MEMP_NUM_NETCONN 4
+#define MEMP_NUM_SELECT_CB 4
+#define MEMP_NUM_TCPIP_MSG_API 8
+#define MEMP_NUM_TCPIP_MSG_INPKT 8
+#define MEMP_NUM_NETDB 1
+#define MEMP_NUM_LOCALHOSTLIST 1
+#define PBUF_POOL_SIZE 16
+#define MEMP_NUM_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_DNS_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_NETIFAPI_MSG MEMP_NUM_TCPIP_MSG_API*/
+#define LWIP_ARP 1
+#define ARP_TABLE_SIZE 10
+#define ARP_MAXAGE 300
+#define ARP_QUEUEING 0
+#define ARP_QUEUE_LEN 3
+#define ETHARP_SUPPORT_VLAN 0
+#define LWIP_ETHERNET LWIP_ARP
+#define ETH_PAD_SIZE 0
+#define ETHARP_SUPPORT_STATIC_ENTRIES 0
+#define ETHARP_TABLE_MATCH_NETIF !LWIP_SINGLE_NETIF
+#define LWIP_IPV4 1
+#define IP_FORWARD 0
+#define IP_REASSEMBLY 1
+#define IP_FRAG 1
+#define IP_OPTIONS_ALLOWED 1
+#define IP_REASS_MAXAGE 15
+#define IP_REASS_MAX_PBUFS 10
+#define IP_DEFAULT_TTL 255
+#define IP_SOF_BROADCAST 0
+#define IP_SOF_BROADCAST_RECV 0
+#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
+#define LWIP_ICMP 1
+#define ICMP_TTL (IP_DEFAULT_TTL)
+#define LWIP_BROADCAST_PING 0
+#define LWIP_MULTICAST_PING 0
+#define LWIP_RAW 0
+#define RAW_TTL (IP_DEFAULT_TTL)
+#define LWIP_DHCP LWIP_UDP
+#define LWIP_DHCP_CHECK_LINK_UP 0
+#define LWIP_DHCP_BOOTP_FILE 0
+#define LWIP_DHCP_GET_NTP_SRV 0
+#define LWIP_DHCP_MAX_NTP_SERVERS 1
+#define LWIP_DHCP_MAX_DNS_SERVERS DNS_MAX_SERVERS
+#define LWIP_AUTOIP 0
+#define LWIP_DHCP_AUTOIP_COOP 0
+#define LWIP_DHCP_AUTOIP_COOP_TRIES 9
+#define LWIP_MIB2_CALLBACKS 0
+#define LWIP_MULTICAST_TX_OPTIONS ((LWIP_IGMP || LWIP_IPV6_MLD) && (LWIP_UDP || LWIP_RAW))
+#define LWIP_IGMP 0
+#define LWIP_DNS 0
+#define DNS_TABLE_SIZE 4
+#define DNS_MAX_NAME_LENGTH 256
+#define DNS_MAX_SERVERS 2
+#define DNS_MAX_RETRIES 4
+#define DNS_DOES_NAME_CHECK 1
+#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
+#define DNS_LOCAL_HOSTLIST 0
+#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
+#define LWIP_DNS_SUPPORT_MDNS_QUERIES 0
+#define LWIP_UDP 1
+#define LWIP_UDPLITE 0
+#define UDP_TTL (IP_DEFAULT_TTL)
+#define LWIP_NETBUF_RECVINFO 0
+#define LWIP_TCP 1
+#define TCP_TTL (IP_DEFAULT_TTL)
+#define TCP_WND (4 * TCP_MSS)
+#define TCP_MAXRTX 12
+#define TCP_SYNMAXRTX 6
+#define TCP_QUEUE_OOSEQ (LWIP_TCP)
+#define LWIP_TCP_SACK_OUT 0
+#define LWIP_TCP_MAX_SACK_NUM 4
+#define TCP_MSS 536
+#define TCP_CALCULATE_EFF_SEND_MSS 1
+#define TCP_SND_BUF (2 * TCP_MSS)
+#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
+#define TCP_SNDLOWAT LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1)
+#define TCP_SNDQUEUELOWAT LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5)
+#define TCP_OOSEQ_MAX_BYTES 0
+#define TCP_OOSEQ_BYTES_LIMIT(pcb) TCP_OOSEQ_MAX_BYTES
+#define TCP_OOSEQ_MAX_PBUFS 0
+#define TCP_OOSEQ_PBUFS_LIMIT(pcb) TCP_OOSEQ_MAX_PBUFS
+#define TCP_LISTEN_BACKLOG 0
+#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
+#define TCP_OVERSIZE TCP_MSS
+#define LWIP_TCP_TIMESTAMPS 0
+#define TCP_WND_UPDATE_THRESHOLD LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4))
+#define LWIP_EVENT_API 0
+#define LWIP_CALLBACK_API 1
+#define LWIP_WND_SCALE 0
+#define TCP_RCV_SCALE 0
+#define LWIP_TCP_PCB_NUM_EXT_ARGS 0
+#define LWIP_ALTCP 0
+#define LWIP_ALTCP_TLS 0
+#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
+#define PBUF_LINK_ENCAPSULATION_HLEN 0
+#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
+#define LWIP_PBUF_REF_T u8_t
+#define LWIP_SINGLE_NETIF 0
+#define LWIP_NETIF_HOSTNAME 0
+#define LWIP_NETIF_API 0
+#define LWIP_NETIF_STATUS_CALLBACK 0
+#define LWIP_NETIF_EXT_STATUS_CALLBACK 0
+#define LWIP_NETIF_LINK_CALLBACK 0
+#define LWIP_NETIF_REMOVE_CALLBACK 0
+#define LWIP_NETIF_HWADDRHINT 0
+#define LWIP_NETIF_TX_SINGLE_PBUF 0
+#define LWIP_NUM_NETIF_CLIENT_DATA 0
+#define LWIP_HAVE_LOOPIF (LWIP_NETIF_LOOPBACK && !LWIP_SINGLE_NETIF)
+#define LWIP_LOOPIF_MULTICAST 0
+#define LWIP_NETIF_LOOPBACK 0
+#define LWIP_LOOPBACK_MAX_PBUFS 0
+#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS)
+/*#define TCPIP_THREAD_NAME "tcpip_thread"
+#define TCPIP_THREAD_STACKSIZE 0
+#define TCPIP_THREAD_PRIO 1
+#define TCPIP_MBOX_SIZE 0
+#define LWIP_TCPIP_THREAD_ALIVE()
+#define SLIPIF_THREAD_NAME "slipif_loop"
+#define SLIPIF_THREAD_STACKSIZE 0
+#define SLIPIF_THREAD_PRIO 1
+#define DEFAULT_THREAD_NAME "lwIP"
+#define DEFAULT_THREAD_STACKSIZE 0
+#define DEFAULT_THREAD_PRIO 1
+#define DEFAULT_RAW_RECVMBOX_SIZE 0
+#define DEFAULT_UDP_RECVMBOX_SIZE 0
+#define DEFAULT_TCP_RECVMBOX_SIZE 0
+#define DEFAULT_ACCEPTMBOX_SIZE 0*/
+#define LWIP_NETCONN 1
+#define LWIP_TCPIP_TIMEOUT 0
+#define LWIP_NETCONN_SEM_PER_THREAD 0
+#define LWIP_NETCONN_FULLDUPLEX 0
+#define LWIP_SOCKET 1
+#define LWIP_COMPAT_SOCKETS 1 /* 0..2 */
+#define LWIP_POSIX_SOCKETS_IO_NAMES 1
+#define LWIP_SOCKET_OFFSET 0
+#define LWIP_TCP_KEEPALIVE 0
+#define LWIP_SO_SNDTIMEO 0
+#define LWIP_SO_RCVTIMEO 0
+#define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 0
+#define LWIP_SO_RCVBUF 0
+#define LWIP_SO_LINGER 0
+#define RECV_BUFSIZE_DEFAULT INT_MAX
+#define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000
+#define SO_REUSE 0
+#define SO_REUSE_RXTOALL 0
+#define LWIP_FIONREAD_LINUXMODE 0
+#define LWIP_SOCKET_SELECT 1
+#define LWIP_SOCKET_POLL 1
+#define LWIP_STATS 1
+#define LWIP_STATS_DISPLAY 0
+#define LINK_STATS 1
+#define ETHARP_STATS (LWIP_ARP)
+#define IP_STATS 1
+#define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG)
+#define ICMP_STATS 1
+#define IGMP_STATS (LWIP_IGMP)
+#define UDP_STATS (LWIP_UDP)
+#define TCP_STATS (LWIP_TCP)
+#define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0))
+#define MEMP_STATS (MEMP_MEM_MALLOC == 0)
+#define SYS_STATS (NO_SYS == 0)
+#define IP6_STATS (LWIP_IPV6)
+#define ICMP6_STATS (LWIP_IPV6 && LWIP_ICMP6)
+#define IP6_FRAG_STATS (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS))
+#define MLD6_STATS (LWIP_IPV6 && LWIP_IPV6_MLD)
+#define ND6_STATS (LWIP_IPV6)
+#define MIB2_STATS 0
+#define LWIP_CHECKSUM_CTRL_PER_NETIF 0
+#define CHECKSUM_GEN_IP 1
+#define CHECKSUM_GEN_UDP 1
+#define CHECKSUM_GEN_TCP 1
+#define CHECKSUM_GEN_ICMP 1
+#define CHECKSUM_GEN_ICMP6 1
+#define CHECKSUM_CHECK_IP 1
+#define CHECKSUM_CHECK_UDP 1
+#define CHECKSUM_CHECK_TCP 1
+#define CHECKSUM_CHECK_ICMP 1
+#define CHECKSUM_CHECK_ICMP6 1
+#define LWIP_CHECKSUM_ON_COPY 0
+#define LWIP_IPV6 1
+#define IPV6_REASS_MAXAGE 60
+#define LWIP_IPV6_SCOPES (LWIP_IPV6 && !LWIP_SINGLE_NETIF)
+#define LWIP_IPV6_SCOPES_DEBUG 0
+#define LWIP_IPV6_NUM_ADDRESSES 3
+#define LWIP_IPV6_FORWARD 0
+#define LWIP_IPV6_FRAG 1
+#define LWIP_IPV6_REASS (LWIP_IPV6)
+#define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
+#define LWIP_IPV6_AUTOCONFIG (LWIP_IPV6)
+#define LWIP_IPV6_ADDRESS_LIFETIMES (LWIP_IPV6_AUTOCONFIG)
+#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1
+#define LWIP_ICMP6 (LWIP_IPV6)
+#define LWIP_ICMP6_DATASIZE 8
+#define LWIP_ICMP6_HL 255
+#define LWIP_IPV6_MLD (LWIP_IPV6)
+#define MEMP_NUM_MLD6_GROUP 4
+#define LWIP_ND6_QUEUEING (LWIP_IPV6)
+#define MEMP_NUM_ND6_QUEUE 20
+#define LWIP_ND6_NUM_NEIGHBORS 10
+#define LWIP_ND6_NUM_DESTINATIONS 10
+#define LWIP_ND6_NUM_PREFIXES 5
+#define LWIP_ND6_NUM_ROUTERS 3
+#define LWIP_ND6_MAX_MULTICAST_SOLICIT 3
+#define LWIP_ND6_MAX_UNICAST_SOLICIT 3
+#define LWIP_ND6_MAX_ANYCAST_DELAY_TIME 1000
+#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT 3
+#define LWIP_ND6_REACHABLE_TIME 30000
+#define LWIP_ND6_RETRANS_TIMER 1000
+#define LWIP_ND6_DELAY_FIRST_PROBE_TIME 5000
+#define LWIP_ND6_ALLOW_RA_UPDATES 1
+#define LWIP_ND6_TCP_REACHABILITY_HINTS 1
+#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0
+#define LWIP_IPV6_DHCP6 0
+#define LWIP_IPV6_DHCP6_STATEFUL 0
+#define LWIP_IPV6_DHCP6_STATELESS LWIP_IPV6_DHCP6
+#define LWIP_DHCP6_GET_NTP_SRV 0
+#define LWIP_DHCP6_MAX_NTP_SERVERS 1
+#define LWIP_DHCP6_MAX_DNS_SERVERS DNS_MAX_SERVERS
+
+/* TODO: check hooks */
+
+#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
+#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
+#define ETHARP_DEBUG LWIP_DBG_OFF
+#define NETIF_DEBUG LWIP_DBG_OFF
+#define PBUF_DEBUG LWIP_DBG_OFF
+#define API_LIB_DEBUG LWIP_DBG_OFF
+#define API_MSG_DEBUG LWIP_DBG_OFF
+#define SOCKETS_DEBUG LWIP_DBG_OFF
+#define ICMP_DEBUG LWIP_DBG_OFF
+#define IGMP_DEBUG LWIP_DBG_OFF
+#define INET_DEBUG LWIP_DBG_OFF
+#define IP_DEBUG LWIP_DBG_OFF
+#define IP_REASS_DEBUG LWIP_DBG_OFF
+#define RAW_DEBUG LWIP_DBG_OFF
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define SYS_DEBUG LWIP_DBG_OFF
+#define TIMERS_DEBUG LWIP_DBG_OFF
+#define TCP_DEBUG LWIP_DBG_OFF
+#define TCP_INPUT_DEBUG LWIP_DBG_OFF
+#define TCP_FR_DEBUG LWIP_DBG_OFF
+#define TCP_RTO_DEBUG LWIP_DBG_OFF
+#define TCP_CWND_DEBUG LWIP_DBG_OFF
+#define TCP_WND_DEBUG LWIP_DBG_OFF
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
+#define TCP_RST_DEBUG LWIP_DBG_OFF
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF
+#define UDP_DEBUG LWIP_DBG_OFF
+#define TCPIP_DEBUG LWIP_DBG_OFF
+#define SLIP_DEBUG LWIP_DBG_OFF
+#define DHCP_DEBUG LWIP_DBG_OFF
+#define AUTOIP_DEBUG LWIP_DBG_OFF
+#define DNS_DEBUG LWIP_DBG_OFF
+#define IP6_DEBUG LWIP_DBG_OFF
+#define DHCP6_DEBUG LWIP_DBG_OFF
+#define LWIP_TESTMODE 0
+
+#define LWIP_PERF 0
diff --git a/contrib/examples/example_app/test_configs/opt_ipv4only.h b/contrib/examples/example_app/test_configs/opt_ipv4only.h
new file mode 100644
index 0000000..82ba467
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_ipv4only.h
@@ -0,0 +1,295 @@
+/* test an lwipopts.h file with default contents */
+#define NO_SYS 0
+#define NO_SYS_NO_TIMERS 0
+#define LWIP_TIMERS 1
+#define LWIP_TIMERS_CUSTOM 0
+#define LWIP_MPU_COMPATIBLE 0
+#define LWIP_TCPIP_CORE_LOCKING 1
+#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
+#define SYS_LIGHTWEIGHT_PROT 1
+#define MEM_LIBC_MALLOC 0
+#define MEMP_MEM_MALLOC 0
+#define MEMP_MEM_INIT 0
+#define MEM_ALIGNMENT 1
+#define MEM_SIZE 1600
+#define MEMP_OVERFLOW_CHECK 0
+#define MEMP_SANITY_CHECK 0
+#define MEM_OVERFLOW_CHECK 0
+#define MEM_SANITY_CHECK 0
+#define MEM_USE_POOLS 0
+#define MEM_USE_POOLS_TRY_BIGGER_POOL 0
+#define MEMP_USE_CUSTOM_POOLS 0
+#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
+/*#define MEMP_NUM_PBUF 16
+#define MEMP_NUM_RAW_PCB 4
+#define MEMP_NUM_UDP_PCB 4
+#define MEMP_NUM_TCP_PCB 5
+#define MEMP_NUM_TCP_PCB_LISTEN 8
+#define MEMP_NUM_TCP_SEG 16
+#define MEMP_NUM_ALTCP_PCB MEMP_NUM_TCP_PCB
+#define MEMP_NUM_REASSDATA 5
+#define MEMP_NUM_FRAG_PBUF 15
+#define MEMP_NUM_ARP_QUEUE 30
+#define MEMP_NUM_IGMP_GROUP 8
+#define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 2)
+#define MEMP_NUM_NETBUF 2
+#define MEMP_NUM_NETCONN 4
+#define MEMP_NUM_SELECT_CB 4
+#define MEMP_NUM_TCPIP_MSG_API 8
+#define MEMP_NUM_TCPIP_MSG_INPKT 8
+#define MEMP_NUM_NETDB 1
+#define MEMP_NUM_LOCALHOSTLIST 1
+#define PBUF_POOL_SIZE 16
+#define MEMP_NUM_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_DNS_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_NETIFAPI_MSG MEMP_NUM_TCPIP_MSG_API*/
+#define LWIP_ARP 1
+#define ARP_TABLE_SIZE 10
+#define ARP_MAXAGE 300
+#define ARP_QUEUEING 0
+#define ARP_QUEUE_LEN 3
+#define ETHARP_SUPPORT_VLAN 0
+#define LWIP_ETHERNET LWIP_ARP
+#define ETH_PAD_SIZE 0
+#define ETHARP_SUPPORT_STATIC_ENTRIES 0
+#define ETHARP_TABLE_MATCH_NETIF !LWIP_SINGLE_NETIF
+#define LWIP_IPV4 1
+#define IP_FORWARD 0
+#define IP_REASSEMBLY 1
+#define IP_FRAG 1
+#define IP_OPTIONS_ALLOWED 1
+#define IP_REASS_MAXAGE 15
+#define IP_REASS_MAX_PBUFS 10
+#define IP_DEFAULT_TTL 255
+#define IP_SOF_BROADCAST 0
+#define IP_SOF_BROADCAST_RECV 0
+#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
+#define LWIP_ICMP 1
+#define ICMP_TTL (IP_DEFAULT_TTL)
+#define LWIP_BROADCAST_PING 0
+#define LWIP_MULTICAST_PING 0
+#define LWIP_RAW 0
+#define RAW_TTL (IP_DEFAULT_TTL)
+#define LWIP_DHCP LWIP_UDP
+#define LWIP_DHCP_CHECK_LINK_UP 0
+#define LWIP_DHCP_BOOTP_FILE 0
+#define LWIP_DHCP_GET_NTP_SRV 0
+#define LWIP_DHCP_MAX_NTP_SERVERS 1
+#define LWIP_DHCP_MAX_DNS_SERVERS DNS_MAX_SERVERS
+#define LWIP_AUTOIP 0
+#define LWIP_DHCP_AUTOIP_COOP 0
+#define LWIP_DHCP_AUTOIP_COOP_TRIES 9
+#define LWIP_MIB2_CALLBACKS 0
+#define LWIP_MULTICAST_TX_OPTIONS ((LWIP_IGMP || LWIP_IPV6_MLD) && (LWIP_UDP || LWIP_RAW))
+#define LWIP_IGMP 0
+#define LWIP_DNS 0
+#define DNS_TABLE_SIZE 4
+#define DNS_MAX_NAME_LENGTH 256
+#define DNS_MAX_SERVERS 2
+#define DNS_MAX_RETRIES 4
+#define DNS_DOES_NAME_CHECK 1
+#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
+#define DNS_LOCAL_HOSTLIST 0
+#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
+#define LWIP_DNS_SUPPORT_MDNS_QUERIES 0
+#define LWIP_UDP 1
+#define LWIP_UDPLITE 0
+#define UDP_TTL (IP_DEFAULT_TTL)
+#define LWIP_NETBUF_RECVINFO 0
+#define LWIP_TCP 1
+#define TCP_TTL (IP_DEFAULT_TTL)
+#define TCP_WND (4 * TCP_MSS)
+#define TCP_MAXRTX 12
+#define TCP_SYNMAXRTX 6
+#define TCP_QUEUE_OOSEQ (LWIP_TCP)
+#define LWIP_TCP_SACK_OUT 0
+#define LWIP_TCP_MAX_SACK_NUM 4
+#define TCP_MSS 536
+#define TCP_CALCULATE_EFF_SEND_MSS 1
+#define TCP_SND_BUF (2 * TCP_MSS)
+#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
+#define TCP_SNDLOWAT LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1)
+#define TCP_SNDQUEUELOWAT LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5)
+#define TCP_OOSEQ_MAX_BYTES 0
+#define TCP_OOSEQ_BYTES_LIMIT(pcb) TCP_OOSEQ_MAX_BYTES
+#define TCP_OOSEQ_MAX_PBUFS 0
+#define TCP_OOSEQ_PBUFS_LIMIT(pcb) TCP_OOSEQ_MAX_PBUFS
+#define TCP_LISTEN_BACKLOG 0
+#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
+#define TCP_OVERSIZE TCP_MSS
+#define LWIP_TCP_TIMESTAMPS 0
+#define TCP_WND_UPDATE_THRESHOLD LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4))
+#define LWIP_EVENT_API 0
+#define LWIP_CALLBACK_API 1
+#define LWIP_WND_SCALE 0
+#define TCP_RCV_SCALE 0
+#define LWIP_TCP_PCB_NUM_EXT_ARGS 0
+#define LWIP_ALTCP 0
+#define LWIP_ALTCP_TLS 0
+#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
+#define PBUF_LINK_ENCAPSULATION_HLEN 0
+#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
+#define LWIP_PBUF_REF_T u8_t
+#define LWIP_SINGLE_NETIF 0
+#define LWIP_NETIF_HOSTNAME 0
+#define LWIP_NETIF_API 0
+#define LWIP_NETIF_STATUS_CALLBACK 0
+#define LWIP_NETIF_EXT_STATUS_CALLBACK 0
+#define LWIP_NETIF_LINK_CALLBACK 0
+#define LWIP_NETIF_REMOVE_CALLBACK 0
+#define LWIP_NETIF_HWADDRHINT 0
+#define LWIP_NETIF_TX_SINGLE_PBUF 0
+#define LWIP_NUM_NETIF_CLIENT_DATA 0
+#define LWIP_HAVE_LOOPIF (LWIP_NETIF_LOOPBACK && !LWIP_SINGLE_NETIF)
+#define LWIP_LOOPIF_MULTICAST 0
+#define LWIP_NETIF_LOOPBACK 0
+#define LWIP_LOOPBACK_MAX_PBUFS 0
+#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS)
+/*#define TCPIP_THREAD_NAME "tcpip_thread"
+#define TCPIP_THREAD_STACKSIZE 0
+#define TCPIP_THREAD_PRIO 1
+#define TCPIP_MBOX_SIZE 0
+#define LWIP_TCPIP_THREAD_ALIVE()
+#define SLIPIF_THREAD_NAME "slipif_loop"
+#define SLIPIF_THREAD_STACKSIZE 0
+#define SLIPIF_THREAD_PRIO 1
+#define DEFAULT_THREAD_NAME "lwIP"
+#define DEFAULT_THREAD_STACKSIZE 0
+#define DEFAULT_THREAD_PRIO 1
+#define DEFAULT_RAW_RECVMBOX_SIZE 0
+#define DEFAULT_UDP_RECVMBOX_SIZE 0
+#define DEFAULT_TCP_RECVMBOX_SIZE 0
+#define DEFAULT_ACCEPTMBOX_SIZE 0*/
+#define LWIP_NETCONN 1
+#define LWIP_TCPIP_TIMEOUT 0
+#define LWIP_NETCONN_SEM_PER_THREAD 0
+#define LWIP_NETCONN_FULLDUPLEX 0
+#define LWIP_SOCKET 1
+#define LWIP_COMPAT_SOCKETS 1 /* 0..2 */
+#define LWIP_POSIX_SOCKETS_IO_NAMES 1
+#define LWIP_SOCKET_OFFSET 0
+#define LWIP_TCP_KEEPALIVE 0
+#define LWIP_SO_SNDTIMEO 0
+#define LWIP_SO_RCVTIMEO 0
+#define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 0
+#define LWIP_SO_RCVBUF 0
+#define LWIP_SO_LINGER 0
+#define RECV_BUFSIZE_DEFAULT INT_MAX
+#define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000
+#define SO_REUSE 0
+#define SO_REUSE_RXTOALL 0
+#define LWIP_FIONREAD_LINUXMODE 0
+#define LWIP_SOCKET_SELECT 1
+#define LWIP_SOCKET_POLL 1
+#define LWIP_STATS 1
+#define LWIP_STATS_DISPLAY 0
+#define LINK_STATS 1
+#define ETHARP_STATS (LWIP_ARP)
+#define IP_STATS 1
+#define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG)
+#define ICMP_STATS 1
+#define IGMP_STATS (LWIP_IGMP)
+#define UDP_STATS (LWIP_UDP)
+#define TCP_STATS (LWIP_TCP)
+#define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0))
+#define MEMP_STATS (MEMP_MEM_MALLOC == 0)
+#define SYS_STATS (NO_SYS == 0)
+#define IP6_STATS (LWIP_IPV6)
+#define ICMP6_STATS (LWIP_IPV6 && LWIP_ICMP6)
+#define IP6_FRAG_STATS (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS))
+#define MLD6_STATS (LWIP_IPV6 && LWIP_IPV6_MLD)
+#define ND6_STATS (LWIP_IPV6)
+#define MIB2_STATS 0
+#define LWIP_CHECKSUM_CTRL_PER_NETIF 0
+#define CHECKSUM_GEN_IP 1
+#define CHECKSUM_GEN_UDP 1
+#define CHECKSUM_GEN_TCP 1
+#define CHECKSUM_GEN_ICMP 1
+#define CHECKSUM_GEN_ICMP6 1
+#define CHECKSUM_CHECK_IP 1
+#define CHECKSUM_CHECK_UDP 1
+#define CHECKSUM_CHECK_TCP 1
+#define CHECKSUM_CHECK_ICMP 1
+#define CHECKSUM_CHECK_ICMP6 1
+#define LWIP_CHECKSUM_ON_COPY 0
+#define LWIP_IPV6 0
+#define IPV6_REASS_MAXAGE 60
+#define LWIP_IPV6_SCOPES (LWIP_IPV6 && !LWIP_SINGLE_NETIF)
+#define LWIP_IPV6_SCOPES_DEBUG 0
+#define LWIP_IPV6_NUM_ADDRESSES 3
+#define LWIP_IPV6_FORWARD 0
+#define LWIP_IPV6_FRAG 1
+#define LWIP_IPV6_REASS (LWIP_IPV6)
+#define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
+#define LWIP_IPV6_AUTOCONFIG (LWIP_IPV6)
+#define LWIP_IPV6_ADDRESS_LIFETIMES (LWIP_IPV6_AUTOCONFIG)
+#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1
+#define LWIP_ICMP6 (LWIP_IPV6)
+#define LWIP_ICMP6_DATASIZE 8
+#define LWIP_ICMP6_HL 255
+#define LWIP_IPV6_MLD (LWIP_IPV6)
+#define MEMP_NUM_MLD6_GROUP 4
+#define LWIP_ND6_QUEUEING (LWIP_IPV6)
+#define MEMP_NUM_ND6_QUEUE 20
+#define LWIP_ND6_NUM_NEIGHBORS 10
+#define LWIP_ND6_NUM_DESTINATIONS 10
+#define LWIP_ND6_NUM_PREFIXES 5
+#define LWIP_ND6_NUM_ROUTERS 3
+#define LWIP_ND6_MAX_MULTICAST_SOLICIT 3
+#define LWIP_ND6_MAX_UNICAST_SOLICIT 3
+#define LWIP_ND6_MAX_ANYCAST_DELAY_TIME 1000
+#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT 3
+#define LWIP_ND6_REACHABLE_TIME 30000
+#define LWIP_ND6_RETRANS_TIMER 1000
+#define LWIP_ND6_DELAY_FIRST_PROBE_TIME 5000
+#define LWIP_ND6_ALLOW_RA_UPDATES 1
+#define LWIP_ND6_TCP_REACHABILITY_HINTS 1
+#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0
+#define LWIP_IPV6_DHCP6 0
+#define LWIP_IPV6_DHCP6_STATEFUL 0
+#define LWIP_IPV6_DHCP6_STATELESS LWIP_IPV6_DHCP6
+#define LWIP_DHCP6_GET_NTP_SRV 0
+#define LWIP_DHCP6_MAX_NTP_SERVERS 1
+#define LWIP_DHCP6_MAX_DNS_SERVERS DNS_MAX_SERVERS
+
+/* TODO: check hooks */
+
+#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
+#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
+#define ETHARP_DEBUG LWIP_DBG_OFF
+#define NETIF_DEBUG LWIP_DBG_OFF
+#define PBUF_DEBUG LWIP_DBG_OFF
+#define API_LIB_DEBUG LWIP_DBG_OFF
+#define API_MSG_DEBUG LWIP_DBG_OFF
+#define SOCKETS_DEBUG LWIP_DBG_OFF
+#define ICMP_DEBUG LWIP_DBG_OFF
+#define IGMP_DEBUG LWIP_DBG_OFF
+#define INET_DEBUG LWIP_DBG_OFF
+#define IP_DEBUG LWIP_DBG_OFF
+#define IP_REASS_DEBUG LWIP_DBG_OFF
+#define RAW_DEBUG LWIP_DBG_OFF
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define SYS_DEBUG LWIP_DBG_OFF
+#define TIMERS_DEBUG LWIP_DBG_OFF
+#define TCP_DEBUG LWIP_DBG_OFF
+#define TCP_INPUT_DEBUG LWIP_DBG_OFF
+#define TCP_FR_DEBUG LWIP_DBG_OFF
+#define TCP_RTO_DEBUG LWIP_DBG_OFF
+#define TCP_CWND_DEBUG LWIP_DBG_OFF
+#define TCP_WND_DEBUG LWIP_DBG_OFF
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
+#define TCP_RST_DEBUG LWIP_DBG_OFF
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF
+#define UDP_DEBUG LWIP_DBG_OFF
+#define TCPIP_DEBUG LWIP_DBG_OFF
+#define SLIP_DEBUG LWIP_DBG_OFF
+#define DHCP_DEBUG LWIP_DBG_OFF
+#define AUTOIP_DEBUG LWIP_DBG_OFF
+#define DNS_DEBUG LWIP_DBG_OFF
+#define IP6_DEBUG LWIP_DBG_OFF
+#define DHCP6_DEBUG LWIP_DBG_OFF
+#define LWIP_TESTMODE 0
+
+#define LWIP_PERF 0
diff --git a/contrib/examples/example_app/test_configs/opt_ipv6only.h b/contrib/examples/example_app/test_configs/opt_ipv6only.h
new file mode 100644
index 0000000..b3cb1e0
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_ipv6only.h
@@ -0,0 +1,295 @@
+/* test an lwipopts.h file with default contents */
+#define NO_SYS 0
+#define NO_SYS_NO_TIMERS 0
+#define LWIP_TIMERS 1
+#define LWIP_TIMERS_CUSTOM 0
+#define LWIP_MPU_COMPATIBLE 0
+#define LWIP_TCPIP_CORE_LOCKING 1
+#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
+#define SYS_LIGHTWEIGHT_PROT 1
+#define MEM_LIBC_MALLOC 0
+#define MEMP_MEM_MALLOC 0
+#define MEMP_MEM_INIT 0
+#define MEM_ALIGNMENT 1
+#define MEM_SIZE 1600
+#define MEMP_OVERFLOW_CHECK 0
+#define MEMP_SANITY_CHECK 0
+#define MEM_OVERFLOW_CHECK 0
+#define MEM_SANITY_CHECK 0
+#define MEM_USE_POOLS 0
+#define MEM_USE_POOLS_TRY_BIGGER_POOL 0
+#define MEMP_USE_CUSTOM_POOLS 0
+#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
+/*#define MEMP_NUM_PBUF 16
+#define MEMP_NUM_RAW_PCB 4
+#define MEMP_NUM_UDP_PCB 4
+#define MEMP_NUM_TCP_PCB 5
+#define MEMP_NUM_TCP_PCB_LISTEN 8
+#define MEMP_NUM_TCP_SEG 16
+#define MEMP_NUM_ALTCP_PCB MEMP_NUM_TCP_PCB
+#define MEMP_NUM_REASSDATA 5
+#define MEMP_NUM_FRAG_PBUF 15
+#define MEMP_NUM_ARP_QUEUE 30
+#define MEMP_NUM_IGMP_GROUP 8
+#define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 2)
+#define MEMP_NUM_NETBUF 2
+#define MEMP_NUM_NETCONN 4
+#define MEMP_NUM_SELECT_CB 4
+#define MEMP_NUM_TCPIP_MSG_API 8
+#define MEMP_NUM_TCPIP_MSG_INPKT 8
+#define MEMP_NUM_NETDB 1
+#define MEMP_NUM_LOCALHOSTLIST 1
+#define PBUF_POOL_SIZE 16
+#define MEMP_NUM_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_DNS_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_NETIFAPI_MSG MEMP_NUM_TCPIP_MSG_API*/
+#define LWIP_ARP 1
+#define ARP_TABLE_SIZE 10
+#define ARP_MAXAGE 300
+#define ARP_QUEUEING 0
+#define ARP_QUEUE_LEN 3
+#define ETHARP_SUPPORT_VLAN 0
+#define LWIP_ETHERNET LWIP_ARP
+#define ETH_PAD_SIZE 0
+#define ETHARP_SUPPORT_STATIC_ENTRIES 0
+#define ETHARP_TABLE_MATCH_NETIF !LWIP_SINGLE_NETIF
+#define LWIP_IPV4 0
+#define IP_FORWARD 0
+#define IP_REASSEMBLY 1
+#define IP_FRAG 1
+#define IP_OPTIONS_ALLOWED 1
+#define IP_REASS_MAXAGE 15
+#define IP_REASS_MAX_PBUFS 10
+#define IP_DEFAULT_TTL 255
+#define IP_SOF_BROADCAST 0
+#define IP_SOF_BROADCAST_RECV 0
+#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
+#define LWIP_ICMP 1
+#define ICMP_TTL (IP_DEFAULT_TTL)
+#define LWIP_BROADCAST_PING 0
+#define LWIP_MULTICAST_PING 0
+#define LWIP_RAW 0
+#define RAW_TTL (IP_DEFAULT_TTL)
+#define LWIP_DHCP 0
+#define LWIP_DHCP_CHECK_LINK_UP 0
+#define LWIP_DHCP_BOOTP_FILE 0
+#define LWIP_DHCP_GET_NTP_SRV 0
+#define LWIP_DHCP_MAX_NTP_SERVERS 1
+#define LWIP_DHCP_MAX_DNS_SERVERS DNS_MAX_SERVERS
+#define LWIP_AUTOIP 0
+#define LWIP_DHCP_AUTOIP_COOP 0
+#define LWIP_DHCP_AUTOIP_COOP_TRIES 9
+#define LWIP_MIB2_CALLBACKS 0
+#define LWIP_MULTICAST_TX_OPTIONS ((LWIP_IGMP || LWIP_IPV6_MLD) && (LWIP_UDP || LWIP_RAW))
+#define LWIP_IGMP 0
+#define LWIP_DNS 0
+#define DNS_TABLE_SIZE 4
+#define DNS_MAX_NAME_LENGTH 256
+#define DNS_MAX_SERVERS 2
+#define DNS_MAX_RETRIES 4
+#define DNS_DOES_NAME_CHECK 1
+#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
+#define DNS_LOCAL_HOSTLIST 0
+#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
+#define LWIP_DNS_SUPPORT_MDNS_QUERIES 0
+#define LWIP_UDP 1
+#define LWIP_UDPLITE 0
+#define UDP_TTL (IP_DEFAULT_TTL)
+#define LWIP_NETBUF_RECVINFO 0
+#define LWIP_TCP 1
+#define TCP_TTL (IP_DEFAULT_TTL)
+#define TCP_WND (4 * TCP_MSS)
+#define TCP_MAXRTX 12
+#define TCP_SYNMAXRTX 6
+#define TCP_QUEUE_OOSEQ (LWIP_TCP)
+#define LWIP_TCP_SACK_OUT 0
+#define LWIP_TCP_MAX_SACK_NUM 4
+#define TCP_MSS 536
+#define TCP_CALCULATE_EFF_SEND_MSS 1
+#define TCP_SND_BUF (2 * TCP_MSS)
+#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
+#define TCP_SNDLOWAT LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1)
+#define TCP_SNDQUEUELOWAT LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5)
+#define TCP_OOSEQ_MAX_BYTES 0
+#define TCP_OOSEQ_BYTES_LIMIT(pcb) TCP_OOSEQ_MAX_BYTES
+#define TCP_OOSEQ_MAX_PBUFS 0
+#define TCP_OOSEQ_PBUFS_LIMIT(pcb) TCP_OOSEQ_MAX_PBUFS
+#define TCP_LISTEN_BACKLOG 0
+#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
+#define TCP_OVERSIZE TCP_MSS
+#define LWIP_TCP_TIMESTAMPS 0
+#define TCP_WND_UPDATE_THRESHOLD LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4))
+#define LWIP_EVENT_API 0
+#define LWIP_CALLBACK_API 1
+#define LWIP_WND_SCALE 0
+#define TCP_RCV_SCALE 0
+#define LWIP_TCP_PCB_NUM_EXT_ARGS 0
+#define LWIP_ALTCP 0
+#define LWIP_ALTCP_TLS 0
+#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
+#define PBUF_LINK_ENCAPSULATION_HLEN 0
+#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
+#define LWIP_PBUF_REF_T u8_t
+#define LWIP_SINGLE_NETIF 0
+#define LWIP_NETIF_HOSTNAME 0
+#define LWIP_NETIF_API 0
+#define LWIP_NETIF_STATUS_CALLBACK 0
+#define LWIP_NETIF_EXT_STATUS_CALLBACK 0
+#define LWIP_NETIF_LINK_CALLBACK 0
+#define LWIP_NETIF_REMOVE_CALLBACK 0
+#define LWIP_NETIF_HWADDRHINT 0
+#define LWIP_NETIF_TX_SINGLE_PBUF 0
+#define LWIP_NUM_NETIF_CLIENT_DATA 0
+#define LWIP_HAVE_LOOPIF (LWIP_NETIF_LOOPBACK && !LWIP_SINGLE_NETIF)
+#define LWIP_LOOPIF_MULTICAST 0
+#define LWIP_NETIF_LOOPBACK 0
+#define LWIP_LOOPBACK_MAX_PBUFS 0
+#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS)
+/*#define TCPIP_THREAD_NAME "tcpip_thread"
+#define TCPIP_THREAD_STACKSIZE 0
+#define TCPIP_THREAD_PRIO 1
+#define TCPIP_MBOX_SIZE 0
+#define LWIP_TCPIP_THREAD_ALIVE()
+#define SLIPIF_THREAD_NAME "slipif_loop"
+#define SLIPIF_THREAD_STACKSIZE 0
+#define SLIPIF_THREAD_PRIO 1
+#define DEFAULT_THREAD_NAME "lwIP"
+#define DEFAULT_THREAD_STACKSIZE 0
+#define DEFAULT_THREAD_PRIO 1
+#define DEFAULT_RAW_RECVMBOX_SIZE 0
+#define DEFAULT_UDP_RECVMBOX_SIZE 0
+#define DEFAULT_TCP_RECVMBOX_SIZE 0
+#define DEFAULT_ACCEPTMBOX_SIZE 0*/
+#define LWIP_NETCONN 1
+#define LWIP_TCPIP_TIMEOUT 0
+#define LWIP_NETCONN_SEM_PER_THREAD 0
+#define LWIP_NETCONN_FULLDUPLEX 0
+#define LWIP_SOCKET 1
+#define LWIP_COMPAT_SOCKETS 1 /* 0..2 */
+#define LWIP_POSIX_SOCKETS_IO_NAMES 1
+#define LWIP_SOCKET_OFFSET 0
+#define LWIP_TCP_KEEPALIVE 0
+#define LWIP_SO_SNDTIMEO 0
+#define LWIP_SO_RCVTIMEO 0
+#define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 0
+#define LWIP_SO_RCVBUF 0
+#define LWIP_SO_LINGER 0
+#define RECV_BUFSIZE_DEFAULT INT_MAX
+#define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000
+#define SO_REUSE 0
+#define SO_REUSE_RXTOALL 0
+#define LWIP_FIONREAD_LINUXMODE 0
+#define LWIP_SOCKET_SELECT 1
+#define LWIP_SOCKET_POLL 1
+#define LWIP_STATS 1
+#define LWIP_STATS_DISPLAY 0
+#define LINK_STATS 1
+#define ETHARP_STATS (LWIP_ARP)
+#define IP_STATS 1
+#define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG)
+#define ICMP_STATS 1
+#define IGMP_STATS (LWIP_IGMP)
+#define UDP_STATS (LWIP_UDP)
+#define TCP_STATS (LWIP_TCP)
+#define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0))
+#define MEMP_STATS (MEMP_MEM_MALLOC == 0)
+#define SYS_STATS (NO_SYS == 0)
+#define IP6_STATS (LWIP_IPV6)
+#define ICMP6_STATS (LWIP_IPV6 && LWIP_ICMP6)
+#define IP6_FRAG_STATS (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS))
+#define MLD6_STATS (LWIP_IPV6 && LWIP_IPV6_MLD)
+#define ND6_STATS (LWIP_IPV6)
+#define MIB2_STATS 0
+#define LWIP_CHECKSUM_CTRL_PER_NETIF 0
+#define CHECKSUM_GEN_IP 1
+#define CHECKSUM_GEN_UDP 1
+#define CHECKSUM_GEN_TCP 1
+#define CHECKSUM_GEN_ICMP 1
+#define CHECKSUM_GEN_ICMP6 1
+#define CHECKSUM_CHECK_IP 1
+#define CHECKSUM_CHECK_UDP 1
+#define CHECKSUM_CHECK_TCP 1
+#define CHECKSUM_CHECK_ICMP 1
+#define CHECKSUM_CHECK_ICMP6 1
+#define LWIP_CHECKSUM_ON_COPY 0
+#define LWIP_IPV6 1
+#define IPV6_REASS_MAXAGE 60
+#define LWIP_IPV6_SCOPES (LWIP_IPV6 && !LWIP_SINGLE_NETIF)
+#define LWIP_IPV6_SCOPES_DEBUG 0
+#define LWIP_IPV6_NUM_ADDRESSES 3
+#define LWIP_IPV6_FORWARD 0
+#define LWIP_IPV6_FRAG 1
+#define LWIP_IPV6_REASS (LWIP_IPV6)
+#define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
+#define LWIP_IPV6_AUTOCONFIG (LWIP_IPV6)
+#define LWIP_IPV6_ADDRESS_LIFETIMES (LWIP_IPV6_AUTOCONFIG)
+#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1
+#define LWIP_ICMP6 (LWIP_IPV6)
+#define LWIP_ICMP6_DATASIZE 8
+#define LWIP_ICMP6_HL 255
+#define LWIP_IPV6_MLD (LWIP_IPV6)
+#define MEMP_NUM_MLD6_GROUP 4
+#define LWIP_ND6_QUEUEING (LWIP_IPV6)
+#define MEMP_NUM_ND6_QUEUE 20
+#define LWIP_ND6_NUM_NEIGHBORS 10
+#define LWIP_ND6_NUM_DESTINATIONS 10
+#define LWIP_ND6_NUM_PREFIXES 5
+#define LWIP_ND6_NUM_ROUTERS 3
+#define LWIP_ND6_MAX_MULTICAST_SOLICIT 3
+#define LWIP_ND6_MAX_UNICAST_SOLICIT 3
+#define LWIP_ND6_MAX_ANYCAST_DELAY_TIME 1000
+#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT 3
+#define LWIP_ND6_REACHABLE_TIME 30000
+#define LWIP_ND6_RETRANS_TIMER 1000
+#define LWIP_ND6_DELAY_FIRST_PROBE_TIME 5000
+#define LWIP_ND6_ALLOW_RA_UPDATES 1
+#define LWIP_ND6_TCP_REACHABILITY_HINTS 1
+#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0
+#define LWIP_IPV6_DHCP6 0
+#define LWIP_IPV6_DHCP6_STATEFUL 0
+#define LWIP_IPV6_DHCP6_STATELESS LWIP_IPV6_DHCP6
+#define LWIP_DHCP6_GET_NTP_SRV 0
+#define LWIP_DHCP6_MAX_NTP_SERVERS 1
+#define LWIP_DHCP6_MAX_DNS_SERVERS DNS_MAX_SERVERS
+
+/* TODO: check hooks */
+
+#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
+#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
+#define ETHARP_DEBUG LWIP_DBG_OFF
+#define NETIF_DEBUG LWIP_DBG_OFF
+#define PBUF_DEBUG LWIP_DBG_OFF
+#define API_LIB_DEBUG LWIP_DBG_OFF
+#define API_MSG_DEBUG LWIP_DBG_OFF
+#define SOCKETS_DEBUG LWIP_DBG_OFF
+#define ICMP_DEBUG LWIP_DBG_OFF
+#define IGMP_DEBUG LWIP_DBG_OFF
+#define INET_DEBUG LWIP_DBG_OFF
+#define IP_DEBUG LWIP_DBG_OFF
+#define IP_REASS_DEBUG LWIP_DBG_OFF
+#define RAW_DEBUG LWIP_DBG_OFF
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define SYS_DEBUG LWIP_DBG_OFF
+#define TIMERS_DEBUG LWIP_DBG_OFF
+#define TCP_DEBUG LWIP_DBG_OFF
+#define TCP_INPUT_DEBUG LWIP_DBG_OFF
+#define TCP_FR_DEBUG LWIP_DBG_OFF
+#define TCP_RTO_DEBUG LWIP_DBG_OFF
+#define TCP_CWND_DEBUG LWIP_DBG_OFF
+#define TCP_WND_DEBUG LWIP_DBG_OFF
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
+#define TCP_RST_DEBUG LWIP_DBG_OFF
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF
+#define UDP_DEBUG LWIP_DBG_OFF
+#define TCPIP_DEBUG LWIP_DBG_OFF
+#define SLIP_DEBUG LWIP_DBG_OFF
+#define DHCP_DEBUG LWIP_DBG_OFF
+#define AUTOIP_DEBUG LWIP_DBG_OFF
+#define DNS_DEBUG LWIP_DBG_OFF
+#define IP6_DEBUG LWIP_DBG_OFF
+#define DHCP6_DEBUG LWIP_DBG_OFF
+#define LWIP_TESTMODE 0
+
+#define LWIP_PERF 0
diff --git a/contrib/examples/example_app/test_configs/opt_no_tcp_dualstack.h b/contrib/examples/example_app/test_configs/opt_no_tcp_dualstack.h
new file mode 100644
index 0000000..9d70ace
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_no_tcp_dualstack.h
@@ -0,0 +1,4 @@
+#include "test_configs/opt_dualstack.h"
+
+#undef LWIP_TCP
+#define LWIP_TCP 0
diff --git a/contrib/examples/example_app/test_configs/opt_no_tcp_ipv4only.h b/contrib/examples/example_app/test_configs/opt_no_tcp_ipv4only.h
new file mode 100644
index 0000000..bd22831
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_no_tcp_ipv4only.h
@@ -0,0 +1,4 @@
+#include "test_configs/opt_ipv4only.h"
+
+#undef LWIP_TCP
+#define LWIP_TCP 0
diff --git a/contrib/examples/example_app/test_configs/opt_no_tcp_ipv6only.h b/contrib/examples/example_app/test_configs/opt_no_tcp_ipv6only.h
new file mode 100644
index 0000000..9f956e3
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_no_tcp_ipv6only.h
@@ -0,0 +1,4 @@
+#include "test_configs/opt_ipv6only.h"
+
+#undef LWIP_TCP
+#define LWIP_TCP 0
diff --git a/contrib/examples/example_app/test_configs/opt_no_udp_dualstack.h b/contrib/examples/example_app/test_configs/opt_no_udp_dualstack.h
new file mode 100644
index 0000000..c9b9e9a
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_no_udp_dualstack.h
@@ -0,0 +1,4 @@
+#include "test_configs/opt_dualstack.h"
+
+#undef LWIP_UDP
+#define LWIP_UDP 0
diff --git a/contrib/examples/example_app/test_configs/opt_no_udp_ipv4only.h b/contrib/examples/example_app/test_configs/opt_no_udp_ipv4only.h
new file mode 100644
index 0000000..7aa3ace
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_no_udp_ipv4only.h
@@ -0,0 +1,4 @@
+#include "test_configs/opt_ipv4only.h"
+
+#undef LWIP_UDP
+#define LWIP_UDP 0
diff --git a/contrib/examples/example_app/test_configs/opt_no_udp_ipv6only.h b/contrib/examples/example_app/test_configs/opt_no_udp_ipv6only.h
new file mode 100644
index 0000000..0572798
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_no_udp_ipv6only.h
@@ -0,0 +1,4 @@
+#include "test_configs/opt_ipv6only.h"
+
+#undef LWIP_UDP
+#define LWIP_UDP 0
diff --git a/contrib/examples/example_app/test_configs/opt_none.h b/contrib/examples/example_app/test_configs/opt_none.h
new file mode 100644
index 0000000..3c39321
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_none.h
@@ -0,0 +1,2 @@
+/* test and empty lwipopts.h file */
+
diff --git a/contrib/examples/example_app/test_configs/opt_nosys_dual.h b/contrib/examples/example_app/test_configs/opt_nosys_dual.h
new file mode 100644
index 0000000..17ee97f
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_nosys_dual.h
@@ -0,0 +1,295 @@
+/* test an lwipopts.h file with default contents */
+#define NO_SYS 0
+#define NO_SYS_NO_TIMERS 0
+#define LWIP_TIMERS 1
+#define LWIP_TIMERS_CUSTOM 0
+#define LWIP_MPU_COMPATIBLE 0
+#define LWIP_TCPIP_CORE_LOCKING 1
+#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
+#define SYS_LIGHTWEIGHT_PROT 1
+#define MEM_LIBC_MALLOC 0
+#define MEMP_MEM_MALLOC 0
+#define MEMP_MEM_INIT 0
+#define MEM_ALIGNMENT 1
+#define MEM_SIZE 1600
+#define MEMP_OVERFLOW_CHECK 0
+#define MEMP_SANITY_CHECK 0
+#define MEM_OVERFLOW_CHECK 0
+#define MEM_SANITY_CHECK 0
+#define MEM_USE_POOLS 0
+#define MEM_USE_POOLS_TRY_BIGGER_POOL 0
+#define MEMP_USE_CUSTOM_POOLS 0
+#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
+/*#define MEMP_NUM_PBUF 16
+#define MEMP_NUM_RAW_PCB 4
+#define MEMP_NUM_UDP_PCB 4
+#define MEMP_NUM_TCP_PCB 5
+#define MEMP_NUM_TCP_PCB_LISTEN 8
+#define MEMP_NUM_TCP_SEG 16
+#define MEMP_NUM_ALTCP_PCB MEMP_NUM_TCP_PCB
+#define MEMP_NUM_REASSDATA 5
+#define MEMP_NUM_FRAG_PBUF 15
+#define MEMP_NUM_ARP_QUEUE 30
+#define MEMP_NUM_IGMP_GROUP 8
+#define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 2)
+#define MEMP_NUM_NETBUF 2
+#define MEMP_NUM_NETCONN 4
+#define MEMP_NUM_SELECT_CB 4
+#define MEMP_NUM_TCPIP_MSG_API 8
+#define MEMP_NUM_TCPIP_MSG_INPKT 8
+#define MEMP_NUM_NETDB 1
+#define MEMP_NUM_LOCALHOSTLIST 1
+#define PBUF_POOL_SIZE 16
+#define MEMP_NUM_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_DNS_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_NETIFAPI_MSG MEMP_NUM_TCPIP_MSG_API*/
+#define LWIP_ARP 1
+#define ARP_TABLE_SIZE 10
+#define ARP_MAXAGE 300
+#define ARP_QUEUEING 0
+#define ARP_QUEUE_LEN 3
+#define ETHARP_SUPPORT_VLAN 0
+#define LWIP_ETHERNET LWIP_ARP
+#define ETH_PAD_SIZE 0
+#define ETHARP_SUPPORT_STATIC_ENTRIES 0
+#define ETHARP_TABLE_MATCH_NETIF !LWIP_SINGLE_NETIF
+#define LWIP_IPV4 1
+#define IP_FORWARD 0
+#define IP_REASSEMBLY 1
+#define IP_FRAG 1
+#define IP_OPTIONS_ALLOWED 1
+#define IP_REASS_MAXAGE 15
+#define IP_REASS_MAX_PBUFS 10
+#define IP_DEFAULT_TTL 255
+#define IP_SOF_BROADCAST 0
+#define IP_SOF_BROADCAST_RECV 0
+#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
+#define LWIP_ICMP 1
+#define ICMP_TTL (IP_DEFAULT_TTL)
+#define LWIP_BROADCAST_PING 0
+#define LWIP_MULTICAST_PING 0
+#define LWIP_RAW 0
+#define RAW_TTL (IP_DEFAULT_TTL)
+#define LWIP_DHCP 1
+#define LWIP_DHCP_CHECK_LINK_UP 0
+#define LWIP_DHCP_BOOTP_FILE 0
+#define LWIP_DHCP_GET_NTP_SRV 0
+#define LWIP_DHCP_MAX_NTP_SERVERS 1
+#define LWIP_DHCP_MAX_DNS_SERVERS DNS_MAX_SERVERS
+#define LWIP_AUTOIP 0
+#define LWIP_DHCP_AUTOIP_COOP 0
+#define LWIP_DHCP_AUTOIP_COOP_TRIES 9
+#define LWIP_MIB2_CALLBACKS 0
+#define LWIP_MULTICAST_TX_OPTIONS ((LWIP_IGMP || LWIP_IPV6_MLD) && (LWIP_UDP || LWIP_RAW))
+#define LWIP_IGMP 0
+#define LWIP_DNS 0
+#define DNS_TABLE_SIZE 4
+#define DNS_MAX_NAME_LENGTH 256
+#define DNS_MAX_SERVERS 2
+#define DNS_MAX_RETRIES 4
+#define DNS_DOES_NAME_CHECK 1
+#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
+#define DNS_LOCAL_HOSTLIST 0
+#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
+#define LWIP_DNS_SUPPORT_MDNS_QUERIES 0
+#define LWIP_UDP 1
+#define LWIP_UDPLITE 0
+#define UDP_TTL (IP_DEFAULT_TTL)
+#define LWIP_NETBUF_RECVINFO 0
+#define LWIP_TCP 1
+#define TCP_TTL (IP_DEFAULT_TTL)
+#define TCP_WND (4 * TCP_MSS)
+#define TCP_MAXRTX 12
+#define TCP_SYNMAXRTX 6
+#define TCP_QUEUE_OOSEQ (LWIP_TCP)
+#define LWIP_TCP_SACK_OUT 0
+#define LWIP_TCP_MAX_SACK_NUM 4
+#define TCP_MSS 536
+#define TCP_CALCULATE_EFF_SEND_MSS 1
+#define TCP_SND_BUF (2 * TCP_MSS)
+#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
+#define TCP_SNDLOWAT LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1)
+#define TCP_SNDQUEUELOWAT LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5)
+#define TCP_OOSEQ_MAX_BYTES 0
+#define TCP_OOSEQ_BYTES_LIMIT(pcb) TCP_OOSEQ_MAX_BYTES
+#define TCP_OOSEQ_MAX_PBUFS 0
+#define TCP_OOSEQ_PBUFS_LIMIT(pcb) TCP_OOSEQ_MAX_PBUFS
+#define TCP_LISTEN_BACKLOG 0
+#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
+#define TCP_OVERSIZE TCP_MSS
+#define LWIP_TCP_TIMESTAMPS 0
+#define TCP_WND_UPDATE_THRESHOLD LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4))
+#define LWIP_EVENT_API 0
+#define LWIP_CALLBACK_API 1
+#define LWIP_WND_SCALE 0
+#define TCP_RCV_SCALE 0
+#define LWIP_TCP_PCB_NUM_EXT_ARGS 0
+#define LWIP_ALTCP 0
+#define LWIP_ALTCP_TLS 0
+#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
+#define PBUF_LINK_ENCAPSULATION_HLEN 0
+#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
+#define LWIP_PBUF_REF_T u8_t
+#define LWIP_SINGLE_NETIF 0
+#define LWIP_NETIF_HOSTNAME 0
+#define LWIP_NETIF_API 0
+#define LWIP_NETIF_STATUS_CALLBACK 0
+#define LWIP_NETIF_EXT_STATUS_CALLBACK 0
+#define LWIP_NETIF_LINK_CALLBACK 0
+#define LWIP_NETIF_REMOVE_CALLBACK 0
+#define LWIP_NETIF_HWADDRHINT 0
+#define LWIP_NETIF_TX_SINGLE_PBUF 0
+#define LWIP_NUM_NETIF_CLIENT_DATA 0
+#define LWIP_HAVE_LOOPIF (LWIP_NETIF_LOOPBACK && !LWIP_SINGLE_NETIF)
+#define LWIP_LOOPIF_MULTICAST 0
+#define LWIP_NETIF_LOOPBACK 0
+#define LWIP_LOOPBACK_MAX_PBUFS 0
+#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS)
+/*#define TCPIP_THREAD_NAME "tcpip_thread"
+#define TCPIP_THREAD_STACKSIZE 0
+#define TCPIP_THREAD_PRIO 1
+#define TCPIP_MBOX_SIZE 0
+#define LWIP_TCPIP_THREAD_ALIVE()
+#define SLIPIF_THREAD_NAME "slipif_loop"
+#define SLIPIF_THREAD_STACKSIZE 0
+#define SLIPIF_THREAD_PRIO 1
+#define DEFAULT_THREAD_NAME "lwIP"
+#define DEFAULT_THREAD_STACKSIZE 0
+#define DEFAULT_THREAD_PRIO 1
+#define DEFAULT_RAW_RECVMBOX_SIZE 0
+#define DEFAULT_UDP_RECVMBOX_SIZE 0
+#define DEFAULT_TCP_RECVMBOX_SIZE 0
+#define DEFAULT_ACCEPTMBOX_SIZE 0*/
+#define LWIP_NETCONN 0
+#define LWIP_TCPIP_TIMEOUT 0
+#define LWIP_NETCONN_SEM_PER_THREAD 0
+#define LWIP_NETCONN_FULLDUPLEX 0
+#define LWIP_SOCKET 0
+#define LWIP_COMPAT_SOCKETS 1 /* 0..2 */
+#define LWIP_POSIX_SOCKETS_IO_NAMES 1
+#define LWIP_SOCKET_OFFSET 0
+#define LWIP_TCP_KEEPALIVE 0
+#define LWIP_SO_SNDTIMEO 0
+#define LWIP_SO_RCVTIMEO 0
+#define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 0
+#define LWIP_SO_RCVBUF 0
+#define LWIP_SO_LINGER 0
+#define RECV_BUFSIZE_DEFAULT INT_MAX
+#define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000
+#define SO_REUSE 0
+#define SO_REUSE_RXTOALL 0
+#define LWIP_FIONREAD_LINUXMODE 0
+#define LWIP_SOCKET_SELECT 1
+#define LWIP_SOCKET_POLL 1
+#define LWIP_STATS 1
+#define LWIP_STATS_DISPLAY 0
+#define LINK_STATS 1
+#define ETHARP_STATS (LWIP_ARP)
+#define IP_STATS 1
+#define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG)
+#define ICMP_STATS 1
+#define IGMP_STATS (LWIP_IGMP)
+#define UDP_STATS (LWIP_UDP)
+#define TCP_STATS (LWIP_TCP)
+#define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0))
+#define MEMP_STATS (MEMP_MEM_MALLOC == 0)
+#define SYS_STATS (NO_SYS == 0)
+#define IP6_STATS (LWIP_IPV6)
+#define ICMP6_STATS (LWIP_IPV6 && LWIP_ICMP6)
+#define IP6_FRAG_STATS (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS))
+#define MLD6_STATS (LWIP_IPV6 && LWIP_IPV6_MLD)
+#define ND6_STATS (LWIP_IPV6)
+#define MIB2_STATS 0
+#define LWIP_CHECKSUM_CTRL_PER_NETIF 0
+#define CHECKSUM_GEN_IP 1
+#define CHECKSUM_GEN_UDP 1
+#define CHECKSUM_GEN_TCP 1
+#define CHECKSUM_GEN_ICMP 1
+#define CHECKSUM_GEN_ICMP6 1
+#define CHECKSUM_CHECK_IP 1
+#define CHECKSUM_CHECK_UDP 1
+#define CHECKSUM_CHECK_TCP 1
+#define CHECKSUM_CHECK_ICMP 1
+#define CHECKSUM_CHECK_ICMP6 1
+#define LWIP_CHECKSUM_ON_COPY 0
+#define LWIP_IPV6 1
+#define IPV6_REASS_MAXAGE 60
+#define LWIP_IPV6_SCOPES (LWIP_IPV6 && !LWIP_SINGLE_NETIF)
+#define LWIP_IPV6_SCOPES_DEBUG 0
+#define LWIP_IPV6_NUM_ADDRESSES 3
+#define LWIP_IPV6_FORWARD 0
+#define LWIP_IPV6_FRAG 1
+#define LWIP_IPV6_REASS (LWIP_IPV6)
+#define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
+#define LWIP_IPV6_AUTOCONFIG (LWIP_IPV6)
+#define LWIP_IPV6_ADDRESS_LIFETIMES (LWIP_IPV6_AUTOCONFIG)
+#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1
+#define LWIP_ICMP6 (LWIP_IPV6)
+#define LWIP_ICMP6_DATASIZE 8
+#define LWIP_ICMP6_HL 255
+#define LWIP_IPV6_MLD (LWIP_IPV6)
+#define MEMP_NUM_MLD6_GROUP 4
+#define LWIP_ND6_QUEUEING (LWIP_IPV6)
+#define MEMP_NUM_ND6_QUEUE 20
+#define LWIP_ND6_NUM_NEIGHBORS 10
+#define LWIP_ND6_NUM_DESTINATIONS 10
+#define LWIP_ND6_NUM_PREFIXES 5
+#define LWIP_ND6_NUM_ROUTERS 3
+#define LWIP_ND6_MAX_MULTICAST_SOLICIT 3
+#define LWIP_ND6_MAX_UNICAST_SOLICIT 3
+#define LWIP_ND6_MAX_ANYCAST_DELAY_TIME 1000
+#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT 3
+#define LWIP_ND6_REACHABLE_TIME 30000
+#define LWIP_ND6_RETRANS_TIMER 1000
+#define LWIP_ND6_DELAY_FIRST_PROBE_TIME 5000
+#define LWIP_ND6_ALLOW_RA_UPDATES 1
+#define LWIP_ND6_TCP_REACHABILITY_HINTS 1
+#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0
+#define LWIP_IPV6_DHCP6 0
+#define LWIP_IPV6_DHCP6_STATEFUL 0
+#define LWIP_IPV6_DHCP6_STATELESS LWIP_IPV6_DHCP6
+#define LWIP_DHCP6_GET_NTP_SRV 0
+#define LWIP_DHCP6_MAX_NTP_SERVERS 1
+#define LWIP_DHCP6_MAX_DNS_SERVERS DNS_MAX_SERVERS
+
+/* TODO: check hooks */
+
+#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
+#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
+#define ETHARP_DEBUG LWIP_DBG_OFF
+#define NETIF_DEBUG LWIP_DBG_OFF
+#define PBUF_DEBUG LWIP_DBG_OFF
+#define API_LIB_DEBUG LWIP_DBG_OFF
+#define API_MSG_DEBUG LWIP_DBG_OFF
+#define SOCKETS_DEBUG LWIP_DBG_OFF
+#define ICMP_DEBUG LWIP_DBG_OFF
+#define IGMP_DEBUG LWIP_DBG_OFF
+#define INET_DEBUG LWIP_DBG_OFF
+#define IP_DEBUG LWIP_DBG_OFF
+#define IP_REASS_DEBUG LWIP_DBG_OFF
+#define RAW_DEBUG LWIP_DBG_OFF
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define SYS_DEBUG LWIP_DBG_OFF
+#define TIMERS_DEBUG LWIP_DBG_OFF
+#define TCP_DEBUG LWIP_DBG_OFF
+#define TCP_INPUT_DEBUG LWIP_DBG_OFF
+#define TCP_FR_DEBUG LWIP_DBG_OFF
+#define TCP_RTO_DEBUG LWIP_DBG_OFF
+#define TCP_CWND_DEBUG LWIP_DBG_OFF
+#define TCP_WND_DEBUG LWIP_DBG_OFF
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
+#define TCP_RST_DEBUG LWIP_DBG_OFF
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF
+#define UDP_DEBUG LWIP_DBG_OFF
+#define TCPIP_DEBUG LWIP_DBG_OFF
+#define SLIP_DEBUG LWIP_DBG_OFF
+#define DHCP_DEBUG LWIP_DBG_OFF
+#define AUTOIP_DEBUG LWIP_DBG_OFF
+#define DNS_DEBUG LWIP_DBG_OFF
+#define IP6_DEBUG LWIP_DBG_OFF
+#define DHCP6_DEBUG LWIP_DBG_OFF
+#define LWIP_TESTMODE 0
+
+#define LWIP_PERF 0
diff --git a/contrib/examples/example_app/test_configs/opt_nosys_ipv4.h b/contrib/examples/example_app/test_configs/opt_nosys_ipv4.h
new file mode 100644
index 0000000..024d79b
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_nosys_ipv4.h
@@ -0,0 +1,295 @@
+/* test an lwipopts.h file with default contents */
+#define NO_SYS 0
+#define NO_SYS_NO_TIMERS 0
+#define LWIP_TIMERS 1
+#define LWIP_TIMERS_CUSTOM 0
+#define LWIP_MPU_COMPATIBLE 0
+#define LWIP_TCPIP_CORE_LOCKING 1
+#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
+#define SYS_LIGHTWEIGHT_PROT 1
+#define MEM_LIBC_MALLOC 0
+#define MEMP_MEM_MALLOC 0
+#define MEMP_MEM_INIT 0
+#define MEM_ALIGNMENT 1
+#define MEM_SIZE 1600
+#define MEMP_OVERFLOW_CHECK 0
+#define MEMP_SANITY_CHECK 0
+#define MEM_OVERFLOW_CHECK 0
+#define MEM_SANITY_CHECK 0
+#define MEM_USE_POOLS 0
+#define MEM_USE_POOLS_TRY_BIGGER_POOL 0
+#define MEMP_USE_CUSTOM_POOLS 0
+#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
+/*#define MEMP_NUM_PBUF 16
+#define MEMP_NUM_RAW_PCB 4
+#define MEMP_NUM_UDP_PCB 4
+#define MEMP_NUM_TCP_PCB 5
+#define MEMP_NUM_TCP_PCB_LISTEN 8
+#define MEMP_NUM_TCP_SEG 16
+#define MEMP_NUM_ALTCP_PCB MEMP_NUM_TCP_PCB
+#define MEMP_NUM_REASSDATA 5
+#define MEMP_NUM_FRAG_PBUF 15
+#define MEMP_NUM_ARP_QUEUE 30
+#define MEMP_NUM_IGMP_GROUP 8
+#define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 2)
+#define MEMP_NUM_NETBUF 2
+#define MEMP_NUM_NETCONN 4
+#define MEMP_NUM_SELECT_CB 4
+#define MEMP_NUM_TCPIP_MSG_API 8
+#define MEMP_NUM_TCPIP_MSG_INPKT 8
+#define MEMP_NUM_NETDB 1
+#define MEMP_NUM_LOCALHOSTLIST 1
+#define PBUF_POOL_SIZE 16
+#define MEMP_NUM_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_DNS_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_NETIFAPI_MSG MEMP_NUM_TCPIP_MSG_API*/
+#define LWIP_ARP 1
+#define ARP_TABLE_SIZE 10
+#define ARP_MAXAGE 300
+#define ARP_QUEUEING 0
+#define ARP_QUEUE_LEN 3
+#define ETHARP_SUPPORT_VLAN 0
+#define LWIP_ETHERNET LWIP_ARP
+#define ETH_PAD_SIZE 0
+#define ETHARP_SUPPORT_STATIC_ENTRIES 0
+#define ETHARP_TABLE_MATCH_NETIF !LWIP_SINGLE_NETIF
+#define LWIP_IPV4 1
+#define IP_FORWARD 0
+#define IP_REASSEMBLY 1
+#define IP_FRAG 1
+#define IP_OPTIONS_ALLOWED 1
+#define IP_REASS_MAXAGE 15
+#define IP_REASS_MAX_PBUFS 10
+#define IP_DEFAULT_TTL 255
+#define IP_SOF_BROADCAST 0
+#define IP_SOF_BROADCAST_RECV 0
+#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
+#define LWIP_ICMP 1
+#define ICMP_TTL (IP_DEFAULT_TTL)
+#define LWIP_BROADCAST_PING 0
+#define LWIP_MULTICAST_PING 0
+#define LWIP_RAW 0
+#define RAW_TTL (IP_DEFAULT_TTL)
+#define LWIP_DHCP 1
+#define LWIP_DHCP_CHECK_LINK_UP 0
+#define LWIP_DHCP_BOOTP_FILE 0
+#define LWIP_DHCP_GET_NTP_SRV 0
+#define LWIP_DHCP_MAX_NTP_SERVERS 1
+#define LWIP_DHCP_MAX_DNS_SERVERS DNS_MAX_SERVERS
+#define LWIP_AUTOIP 0
+#define LWIP_DHCP_AUTOIP_COOP 0
+#define LWIP_DHCP_AUTOIP_COOP_TRIES 9
+#define LWIP_MIB2_CALLBACKS 0
+#define LWIP_MULTICAST_TX_OPTIONS ((LWIP_IGMP || LWIP_IPV6_MLD) && (LWIP_UDP || LWIP_RAW))
+#define LWIP_IGMP 0
+#define LWIP_DNS 0
+#define DNS_TABLE_SIZE 4
+#define DNS_MAX_NAME_LENGTH 256
+#define DNS_MAX_SERVERS 2
+#define DNS_MAX_RETRIES 4
+#define DNS_DOES_NAME_CHECK 1
+#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
+#define DNS_LOCAL_HOSTLIST 0
+#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
+#define LWIP_DNS_SUPPORT_MDNS_QUERIES 0
+#define LWIP_UDP 1
+#define LWIP_UDPLITE 0
+#define UDP_TTL (IP_DEFAULT_TTL)
+#define LWIP_NETBUF_RECVINFO 0
+#define LWIP_TCP 1
+#define TCP_TTL (IP_DEFAULT_TTL)
+#define TCP_WND (4 * TCP_MSS)
+#define TCP_MAXRTX 12
+#define TCP_SYNMAXRTX 6
+#define TCP_QUEUE_OOSEQ (LWIP_TCP)
+#define LWIP_TCP_SACK_OUT 0
+#define LWIP_TCP_MAX_SACK_NUM 4
+#define TCP_MSS 536
+#define TCP_CALCULATE_EFF_SEND_MSS 1
+#define TCP_SND_BUF (2 * TCP_MSS)
+#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
+#define TCP_SNDLOWAT LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1)
+#define TCP_SNDQUEUELOWAT LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5)
+#define TCP_OOSEQ_MAX_BYTES 0
+#define TCP_OOSEQ_BYTES_LIMIT(pcb) TCP_OOSEQ_MAX_BYTES
+#define TCP_OOSEQ_MAX_PBUFS 0
+#define TCP_OOSEQ_PBUFS_LIMIT(pcb) TCP_OOSEQ_MAX_PBUFS
+#define TCP_LISTEN_BACKLOG 0
+#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
+#define TCP_OVERSIZE TCP_MSS
+#define LWIP_TCP_TIMESTAMPS 0
+#define TCP_WND_UPDATE_THRESHOLD LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4))
+#define LWIP_EVENT_API 0
+#define LWIP_CALLBACK_API 1
+#define LWIP_WND_SCALE 0
+#define TCP_RCV_SCALE 0
+#define LWIP_TCP_PCB_NUM_EXT_ARGS 0
+#define LWIP_ALTCP 0
+#define LWIP_ALTCP_TLS 0
+#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
+#define PBUF_LINK_ENCAPSULATION_HLEN 0
+#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
+#define LWIP_PBUF_REF_T u8_t
+#define LWIP_SINGLE_NETIF 0
+#define LWIP_NETIF_HOSTNAME 0
+#define LWIP_NETIF_API 0
+#define LWIP_NETIF_STATUS_CALLBACK 0
+#define LWIP_NETIF_EXT_STATUS_CALLBACK 0
+#define LWIP_NETIF_LINK_CALLBACK 0
+#define LWIP_NETIF_REMOVE_CALLBACK 0
+#define LWIP_NETIF_HWADDRHINT 0
+#define LWIP_NETIF_TX_SINGLE_PBUF 0
+#define LWIP_NUM_NETIF_CLIENT_DATA 0
+#define LWIP_HAVE_LOOPIF (LWIP_NETIF_LOOPBACK && !LWIP_SINGLE_NETIF)
+#define LWIP_LOOPIF_MULTICAST 0
+#define LWIP_NETIF_LOOPBACK 0
+#define LWIP_LOOPBACK_MAX_PBUFS 0
+#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS)
+/*#define TCPIP_THREAD_NAME "tcpip_thread"
+#define TCPIP_THREAD_STACKSIZE 0
+#define TCPIP_THREAD_PRIO 1
+#define TCPIP_MBOX_SIZE 0
+#define LWIP_TCPIP_THREAD_ALIVE()
+#define SLIPIF_THREAD_NAME "slipif_loop"
+#define SLIPIF_THREAD_STACKSIZE 0
+#define SLIPIF_THREAD_PRIO 1
+#define DEFAULT_THREAD_NAME "lwIP"
+#define DEFAULT_THREAD_STACKSIZE 0
+#define DEFAULT_THREAD_PRIO 1
+#define DEFAULT_RAW_RECVMBOX_SIZE 0
+#define DEFAULT_UDP_RECVMBOX_SIZE 0
+#define DEFAULT_TCP_RECVMBOX_SIZE 0
+#define DEFAULT_ACCEPTMBOX_SIZE 0*/
+#define LWIP_NETCONN 0
+#define LWIP_TCPIP_TIMEOUT 0
+#define LWIP_NETCONN_SEM_PER_THREAD 0
+#define LWIP_NETCONN_FULLDUPLEX 0
+#define LWIP_SOCKET 0
+#define LWIP_COMPAT_SOCKETS 1 /* 0..2 */
+#define LWIP_POSIX_SOCKETS_IO_NAMES 1
+#define LWIP_SOCKET_OFFSET 0
+#define LWIP_TCP_KEEPALIVE 0
+#define LWIP_SO_SNDTIMEO 0
+#define LWIP_SO_RCVTIMEO 0
+#define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 0
+#define LWIP_SO_RCVBUF 0
+#define LWIP_SO_LINGER 0
+#define RECV_BUFSIZE_DEFAULT INT_MAX
+#define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000
+#define SO_REUSE 0
+#define SO_REUSE_RXTOALL 0
+#define LWIP_FIONREAD_LINUXMODE 0
+#define LWIP_SOCKET_SELECT 1
+#define LWIP_SOCKET_POLL 1
+#define LWIP_STATS 1
+#define LWIP_STATS_DISPLAY 0
+#define LINK_STATS 1
+#define ETHARP_STATS (LWIP_ARP)
+#define IP_STATS 1
+#define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG)
+#define ICMP_STATS 1
+#define IGMP_STATS (LWIP_IGMP)
+#define UDP_STATS (LWIP_UDP)
+#define TCP_STATS (LWIP_TCP)
+#define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0))
+#define MEMP_STATS (MEMP_MEM_MALLOC == 0)
+#define SYS_STATS (NO_SYS == 0)
+#define IP6_STATS (LWIP_IPV6)
+#define ICMP6_STATS (LWIP_IPV6 && LWIP_ICMP6)
+#define IP6_FRAG_STATS (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS))
+#define MLD6_STATS (LWIP_IPV6 && LWIP_IPV6_MLD)
+#define ND6_STATS (LWIP_IPV6)
+#define MIB2_STATS 0
+#define LWIP_CHECKSUM_CTRL_PER_NETIF 0
+#define CHECKSUM_GEN_IP 1
+#define CHECKSUM_GEN_UDP 1
+#define CHECKSUM_GEN_TCP 1
+#define CHECKSUM_GEN_ICMP 1
+#define CHECKSUM_GEN_ICMP6 1
+#define CHECKSUM_CHECK_IP 1
+#define CHECKSUM_CHECK_UDP 1
+#define CHECKSUM_CHECK_TCP 1
+#define CHECKSUM_CHECK_ICMP 1
+#define CHECKSUM_CHECK_ICMP6 1
+#define LWIP_CHECKSUM_ON_COPY 0
+#define LWIP_IPV6 0
+#define IPV6_REASS_MAXAGE 60
+#define LWIP_IPV6_SCOPES (LWIP_IPV6 && !LWIP_SINGLE_NETIF)
+#define LWIP_IPV6_SCOPES_DEBUG 0
+#define LWIP_IPV6_NUM_ADDRESSES 3
+#define LWIP_IPV6_FORWARD 0
+#define LWIP_IPV6_FRAG 1
+#define LWIP_IPV6_REASS (LWIP_IPV6)
+#define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
+#define LWIP_IPV6_AUTOCONFIG (LWIP_IPV6)
+#define LWIP_IPV6_ADDRESS_LIFETIMES (LWIP_IPV6_AUTOCONFIG)
+#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1
+#define LWIP_ICMP6 (LWIP_IPV6)
+#define LWIP_ICMP6_DATASIZE 8
+#define LWIP_ICMP6_HL 255
+#define LWIP_IPV6_MLD (LWIP_IPV6)
+#define MEMP_NUM_MLD6_GROUP 4
+#define LWIP_ND6_QUEUEING (LWIP_IPV6)
+#define MEMP_NUM_ND6_QUEUE 20
+#define LWIP_ND6_NUM_NEIGHBORS 10
+#define LWIP_ND6_NUM_DESTINATIONS 10
+#define LWIP_ND6_NUM_PREFIXES 5
+#define LWIP_ND6_NUM_ROUTERS 3
+#define LWIP_ND6_MAX_MULTICAST_SOLICIT 3
+#define LWIP_ND6_MAX_UNICAST_SOLICIT 3
+#define LWIP_ND6_MAX_ANYCAST_DELAY_TIME 1000
+#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT 3
+#define LWIP_ND6_REACHABLE_TIME 30000
+#define LWIP_ND6_RETRANS_TIMER 1000
+#define LWIP_ND6_DELAY_FIRST_PROBE_TIME 5000
+#define LWIP_ND6_ALLOW_RA_UPDATES 1
+#define LWIP_ND6_TCP_REACHABILITY_HINTS 1
+#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0
+#define LWIP_IPV6_DHCP6 0
+#define LWIP_IPV6_DHCP6_STATEFUL 0
+#define LWIP_IPV6_DHCP6_STATELESS LWIP_IPV6_DHCP6
+#define LWIP_DHCP6_GET_NTP_SRV 0
+#define LWIP_DHCP6_MAX_NTP_SERVERS 1
+#define LWIP_DHCP6_MAX_DNS_SERVERS DNS_MAX_SERVERS
+
+/* TODO: check hooks */
+
+#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
+#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
+#define ETHARP_DEBUG LWIP_DBG_OFF
+#define NETIF_DEBUG LWIP_DBG_OFF
+#define PBUF_DEBUG LWIP_DBG_OFF
+#define API_LIB_DEBUG LWIP_DBG_OFF
+#define API_MSG_DEBUG LWIP_DBG_OFF
+#define SOCKETS_DEBUG LWIP_DBG_OFF
+#define ICMP_DEBUG LWIP_DBG_OFF
+#define IGMP_DEBUG LWIP_DBG_OFF
+#define INET_DEBUG LWIP_DBG_OFF
+#define IP_DEBUG LWIP_DBG_OFF
+#define IP_REASS_DEBUG LWIP_DBG_OFF
+#define RAW_DEBUG LWIP_DBG_OFF
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define SYS_DEBUG LWIP_DBG_OFF
+#define TIMERS_DEBUG LWIP_DBG_OFF
+#define TCP_DEBUG LWIP_DBG_OFF
+#define TCP_INPUT_DEBUG LWIP_DBG_OFF
+#define TCP_FR_DEBUG LWIP_DBG_OFF
+#define TCP_RTO_DEBUG LWIP_DBG_OFF
+#define TCP_CWND_DEBUG LWIP_DBG_OFF
+#define TCP_WND_DEBUG LWIP_DBG_OFF
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
+#define TCP_RST_DEBUG LWIP_DBG_OFF
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF
+#define UDP_DEBUG LWIP_DBG_OFF
+#define TCPIP_DEBUG LWIP_DBG_OFF
+#define SLIP_DEBUG LWIP_DBG_OFF
+#define DHCP_DEBUG LWIP_DBG_OFF
+#define AUTOIP_DEBUG LWIP_DBG_OFF
+#define DNS_DEBUG LWIP_DBG_OFF
+#define IP6_DEBUG LWIP_DBG_OFF
+#define DHCP6_DEBUG LWIP_DBG_OFF
+#define LWIP_TESTMODE 0
+
+#define LWIP_PERF 0
diff --git a/contrib/examples/example_app/test_configs/opt_nosys_ipv6.h b/contrib/examples/example_app/test_configs/opt_nosys_ipv6.h
new file mode 100644
index 0000000..d027352
--- /dev/null
+++ b/contrib/examples/example_app/test_configs/opt_nosys_ipv6.h
@@ -0,0 +1,295 @@
+/* test an lwipopts.h file with default contents */
+#define NO_SYS 0
+#define NO_SYS_NO_TIMERS 0
+#define LWIP_TIMERS 1
+#define LWIP_TIMERS_CUSTOM 0
+#define LWIP_MPU_COMPATIBLE 0
+#define LWIP_TCPIP_CORE_LOCKING 1
+#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
+#define SYS_LIGHTWEIGHT_PROT 1
+#define MEM_LIBC_MALLOC 0
+#define MEMP_MEM_MALLOC 0
+#define MEMP_MEM_INIT 0
+#define MEM_ALIGNMENT 1
+#define MEM_SIZE 1600
+#define MEMP_OVERFLOW_CHECK 0
+#define MEMP_SANITY_CHECK 0
+#define MEM_OVERFLOW_CHECK 0
+#define MEM_SANITY_CHECK 0
+#define MEM_USE_POOLS 0
+#define MEM_USE_POOLS_TRY_BIGGER_POOL 0
+#define MEMP_USE_CUSTOM_POOLS 0
+#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
+/*#define MEMP_NUM_PBUF 16
+#define MEMP_NUM_RAW_PCB 4
+#define MEMP_NUM_UDP_PCB 4
+#define MEMP_NUM_TCP_PCB 5
+#define MEMP_NUM_TCP_PCB_LISTEN 8
+#define MEMP_NUM_TCP_SEG 16
+#define MEMP_NUM_ALTCP_PCB MEMP_NUM_TCP_PCB
+#define MEMP_NUM_REASSDATA 5
+#define MEMP_NUM_FRAG_PBUF 15
+#define MEMP_NUM_ARP_QUEUE 30
+#define MEMP_NUM_IGMP_GROUP 8
+#define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 2)
+#define MEMP_NUM_NETBUF 2
+#define MEMP_NUM_NETCONN 4
+#define MEMP_NUM_SELECT_CB 4
+#define MEMP_NUM_TCPIP_MSG_API 8
+#define MEMP_NUM_TCPIP_MSG_INPKT 8
+#define MEMP_NUM_NETDB 1
+#define MEMP_NUM_LOCALHOSTLIST 1
+#define PBUF_POOL_SIZE 16
+#define MEMP_NUM_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_DNS_API_MSG MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA MEMP_NUM_TCPIP_MSG_API
+#define MEMP_NUM_NETIFAPI_MSG MEMP_NUM_TCPIP_MSG_API*/
+#define LWIP_ARP 1
+#define ARP_TABLE_SIZE 10
+#define ARP_MAXAGE 300
+#define ARP_QUEUEING 0
+#define ARP_QUEUE_LEN 3
+#define ETHARP_SUPPORT_VLAN 0
+#define LWIP_ETHERNET LWIP_ARP
+#define ETH_PAD_SIZE 0
+#define ETHARP_SUPPORT_STATIC_ENTRIES 0
+#define ETHARP_TABLE_MATCH_NETIF !LWIP_SINGLE_NETIF
+#define LWIP_IPV4 0
+#define IP_FORWARD 0
+#define IP_REASSEMBLY 1
+#define IP_FRAG 1
+#define IP_OPTIONS_ALLOWED 1
+#define IP_REASS_MAXAGE 15
+#define IP_REASS_MAX_PBUFS 10
+#define IP_DEFAULT_TTL 255
+#define IP_SOF_BROADCAST 0
+#define IP_SOF_BROADCAST_RECV 0
+#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
+#define LWIP_ICMP 1
+#define ICMP_TTL (IP_DEFAULT_TTL)
+#define LWIP_BROADCAST_PING 0
+#define LWIP_MULTICAST_PING 0
+#define LWIP_RAW 0
+#define RAW_TTL (IP_DEFAULT_TTL)
+#define LWIP_DHCP 0
+#define LWIP_DHCP_CHECK_LINK_UP 0
+#define LWIP_DHCP_BOOTP_FILE 0
+#define LWIP_DHCP_GET_NTP_SRV 0
+#define LWIP_DHCP_MAX_NTP_SERVERS 1
+#define LWIP_DHCP_MAX_DNS_SERVERS DNS_MAX_SERVERS
+#define LWIP_AUTOIP 0
+#define LWIP_DHCP_AUTOIP_COOP 0
+#define LWIP_DHCP_AUTOIP_COOP_TRIES 9
+#define LWIP_MIB2_CALLBACKS 0
+#define LWIP_MULTICAST_TX_OPTIONS ((LWIP_IGMP || LWIP_IPV6_MLD) && (LWIP_UDP || LWIP_RAW))
+#define LWIP_IGMP 0
+#define LWIP_DNS 0
+#define DNS_TABLE_SIZE 4
+#define DNS_MAX_NAME_LENGTH 256
+#define DNS_MAX_SERVERS 2
+#define DNS_MAX_RETRIES 4
+#define DNS_DOES_NAME_CHECK 1
+#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
+#define DNS_LOCAL_HOSTLIST 0
+#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
+#define LWIP_DNS_SUPPORT_MDNS_QUERIES 0
+#define LWIP_UDP 1
+#define LWIP_UDPLITE 0
+#define UDP_TTL (IP_DEFAULT_TTL)
+#define LWIP_NETBUF_RECVINFO 0
+#define LWIP_TCP 1
+#define TCP_TTL (IP_DEFAULT_TTL)
+#define TCP_WND (4 * TCP_MSS)
+#define TCP_MAXRTX 12
+#define TCP_SYNMAXRTX 6
+#define TCP_QUEUE_OOSEQ (LWIP_TCP)
+#define LWIP_TCP_SACK_OUT 0
+#define LWIP_TCP_MAX_SACK_NUM 4
+#define TCP_MSS 536
+#define TCP_CALCULATE_EFF_SEND_MSS 1
+#define TCP_SND_BUF (2 * TCP_MSS)
+#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
+#define TCP_SNDLOWAT LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1)
+#define TCP_SNDQUEUELOWAT LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5)
+#define TCP_OOSEQ_MAX_BYTES 0
+#define TCP_OOSEQ_BYTES_LIMIT(pcb) TCP_OOSEQ_MAX_BYTES
+#define TCP_OOSEQ_MAX_PBUFS 0
+#define TCP_OOSEQ_PBUFS_LIMIT(pcb) TCP_OOSEQ_MAX_PBUFS
+#define TCP_LISTEN_BACKLOG 0
+#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
+#define TCP_OVERSIZE TCP_MSS
+#define LWIP_TCP_TIMESTAMPS 0
+#define TCP_WND_UPDATE_THRESHOLD LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4))
+#define LWIP_EVENT_API 0
+#define LWIP_CALLBACK_API 1
+#define LWIP_WND_SCALE 0
+#define TCP_RCV_SCALE 0
+#define LWIP_TCP_PCB_NUM_EXT_ARGS 0
+#define LWIP_ALTCP 0
+#define LWIP_ALTCP_TLS 0
+#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
+#define PBUF_LINK_ENCAPSULATION_HLEN 0
+#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
+#define LWIP_PBUF_REF_T u8_t
+#define LWIP_SINGLE_NETIF 0
+#define LWIP_NETIF_HOSTNAME 0
+#define LWIP_NETIF_API 0
+#define LWIP_NETIF_STATUS_CALLBACK 0
+#define LWIP_NETIF_EXT_STATUS_CALLBACK 0
+#define LWIP_NETIF_LINK_CALLBACK 0
+#define LWIP_NETIF_REMOVE_CALLBACK 0
+#define LWIP_NETIF_HWADDRHINT 0
+#define LWIP_NETIF_TX_SINGLE_PBUF 0
+#define LWIP_NUM_NETIF_CLIENT_DATA 0
+#define LWIP_HAVE_LOOPIF (LWIP_NETIF_LOOPBACK && !LWIP_SINGLE_NETIF)
+#define LWIP_LOOPIF_MULTICAST 0
+#define LWIP_NETIF_LOOPBACK 0
+#define LWIP_LOOPBACK_MAX_PBUFS 0
+#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS)
+/*#define TCPIP_THREAD_NAME "tcpip_thread"
+#define TCPIP_THREAD_STACKSIZE 0
+#define TCPIP_THREAD_PRIO 1
+#define TCPIP_MBOX_SIZE 0
+#define LWIP_TCPIP_THREAD_ALIVE()
+#define SLIPIF_THREAD_NAME "slipif_loop"
+#define SLIPIF_THREAD_STACKSIZE 0
+#define SLIPIF_THREAD_PRIO 1
+#define DEFAULT_THREAD_NAME "lwIP"
+#define DEFAULT_THREAD_STACKSIZE 0
+#define DEFAULT_THREAD_PRIO 1
+#define DEFAULT_RAW_RECVMBOX_SIZE 0
+#define DEFAULT_UDP_RECVMBOX_SIZE 0
+#define DEFAULT_TCP_RECVMBOX_SIZE 0
+#define DEFAULT_ACCEPTMBOX_SIZE 0*/
+#define LWIP_NETCONN 0
+#define LWIP_TCPIP_TIMEOUT 0
+#define LWIP_NETCONN_SEM_PER_THREAD 0
+#define LWIP_NETCONN_FULLDUPLEX 0
+#define LWIP_SOCKET 0
+#define LWIP_COMPAT_SOCKETS 1 /* 0..2 */
+#define LWIP_POSIX_SOCKETS_IO_NAMES 1
+#define LWIP_SOCKET_OFFSET 0
+#define LWIP_TCP_KEEPALIVE 0
+#define LWIP_SO_SNDTIMEO 0
+#define LWIP_SO_RCVTIMEO 0
+#define LWIP_SO_SNDRCVTIMEO_NONSTANDARD 0
+#define LWIP_SO_RCVBUF 0
+#define LWIP_SO_LINGER 0
+#define RECV_BUFSIZE_DEFAULT INT_MAX
+#define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 20000
+#define SO_REUSE 0
+#define SO_REUSE_RXTOALL 0
+#define LWIP_FIONREAD_LINUXMODE 0
+#define LWIP_SOCKET_SELECT 1
+#define LWIP_SOCKET_POLL 1
+#define LWIP_STATS 1
+#define LWIP_STATS_DISPLAY 0
+#define LINK_STATS 1
+#define ETHARP_STATS (LWIP_ARP)
+#define IP_STATS 1
+#define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG)
+#define ICMP_STATS 1
+#define IGMP_STATS (LWIP_IGMP)
+#define UDP_STATS (LWIP_UDP)
+#define TCP_STATS (LWIP_TCP)
+#define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0))
+#define MEMP_STATS (MEMP_MEM_MALLOC == 0)
+#define SYS_STATS (NO_SYS == 0)
+#define IP6_STATS (LWIP_IPV6)
+#define ICMP6_STATS (LWIP_IPV6 && LWIP_ICMP6)
+#define IP6_FRAG_STATS (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS))
+#define MLD6_STATS (LWIP_IPV6 && LWIP_IPV6_MLD)
+#define ND6_STATS (LWIP_IPV6)
+#define MIB2_STATS 0
+#define LWIP_CHECKSUM_CTRL_PER_NETIF 0
+#define CHECKSUM_GEN_IP 1
+#define CHECKSUM_GEN_UDP 1
+#define CHECKSUM_GEN_TCP 1
+#define CHECKSUM_GEN_ICMP 1
+#define CHECKSUM_GEN_ICMP6 1
+#define CHECKSUM_CHECK_IP 1
+#define CHECKSUM_CHECK_UDP 1
+#define CHECKSUM_CHECK_TCP 1
+#define CHECKSUM_CHECK_ICMP 1
+#define CHECKSUM_CHECK_ICMP6 1
+#define LWIP_CHECKSUM_ON_COPY 0
+#define LWIP_IPV6 1
+#define IPV6_REASS_MAXAGE 60
+#define LWIP_IPV6_SCOPES (LWIP_IPV6 && !LWIP_SINGLE_NETIF)
+#define LWIP_IPV6_SCOPES_DEBUG 0
+#define LWIP_IPV6_NUM_ADDRESSES 3
+#define LWIP_IPV6_FORWARD 0
+#define LWIP_IPV6_FRAG 1
+#define LWIP_IPV6_REASS (LWIP_IPV6)
+#define LWIP_IPV6_SEND_ROUTER_SOLICIT 1
+#define LWIP_IPV6_AUTOCONFIG (LWIP_IPV6)
+#define LWIP_IPV6_ADDRESS_LIFETIMES (LWIP_IPV6_AUTOCONFIG)
+#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1
+#define LWIP_ICMP6 (LWIP_IPV6)
+#define LWIP_ICMP6_DATASIZE 8
+#define LWIP_ICMP6_HL 255
+#define LWIP_IPV6_MLD (LWIP_IPV6)
+#define MEMP_NUM_MLD6_GROUP 4
+#define LWIP_ND6_QUEUEING (LWIP_IPV6)
+#define MEMP_NUM_ND6_QUEUE 20
+#define LWIP_ND6_NUM_NEIGHBORS 10
+#define LWIP_ND6_NUM_DESTINATIONS 10
+#define LWIP_ND6_NUM_PREFIXES 5
+#define LWIP_ND6_NUM_ROUTERS 3
+#define LWIP_ND6_MAX_MULTICAST_SOLICIT 3
+#define LWIP_ND6_MAX_UNICAST_SOLICIT 3
+#define LWIP_ND6_MAX_ANYCAST_DELAY_TIME 1000
+#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT 3
+#define LWIP_ND6_REACHABLE_TIME 30000
+#define LWIP_ND6_RETRANS_TIMER 1000
+#define LWIP_ND6_DELAY_FIRST_PROBE_TIME 5000
+#define LWIP_ND6_ALLOW_RA_UPDATES 1
+#define LWIP_ND6_TCP_REACHABILITY_HINTS 1
+#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0
+#define LWIP_IPV6_DHCP6 0
+#define LWIP_IPV6_DHCP6_STATEFUL 0
+#define LWIP_IPV6_DHCP6_STATELESS LWIP_IPV6_DHCP6
+#define LWIP_DHCP6_GET_NTP_SRV 0
+#define LWIP_DHCP6_MAX_NTP_SERVERS 1
+#define LWIP_DHCP6_MAX_DNS_SERVERS DNS_MAX_SERVERS
+
+/* TODO: check hooks */
+
+#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
+#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
+#define ETHARP_DEBUG LWIP_DBG_OFF
+#define NETIF_DEBUG LWIP_DBG_OFF
+#define PBUF_DEBUG LWIP_DBG_OFF
+#define API_LIB_DEBUG LWIP_DBG_OFF
+#define API_MSG_DEBUG LWIP_DBG_OFF
+#define SOCKETS_DEBUG LWIP_DBG_OFF
+#define ICMP_DEBUG LWIP_DBG_OFF
+#define IGMP_DEBUG LWIP_DBG_OFF
+#define INET_DEBUG LWIP_DBG_OFF
+#define IP_DEBUG LWIP_DBG_OFF
+#define IP_REASS_DEBUG LWIP_DBG_OFF
+#define RAW_DEBUG LWIP_DBG_OFF
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define SYS_DEBUG LWIP_DBG_OFF
+#define TIMERS_DEBUG LWIP_DBG_OFF
+#define TCP_DEBUG LWIP_DBG_OFF
+#define TCP_INPUT_DEBUG LWIP_DBG_OFF
+#define TCP_FR_DEBUG LWIP_DBG_OFF
+#define TCP_RTO_DEBUG LWIP_DBG_OFF
+#define TCP_CWND_DEBUG LWIP_DBG_OFF
+#define TCP_WND_DEBUG LWIP_DBG_OFF
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
+#define TCP_RST_DEBUG LWIP_DBG_OFF
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF
+#define UDP_DEBUG LWIP_DBG_OFF
+#define TCPIP_DEBUG LWIP_DBG_OFF
+#define SLIP_DEBUG LWIP_DBG_OFF
+#define DHCP_DEBUG LWIP_DBG_OFF
+#define AUTOIP_DEBUG LWIP_DBG_OFF
+#define DNS_DEBUG LWIP_DBG_OFF
+#define IP6_DEBUG LWIP_DBG_OFF
+#define DHCP6_DEBUG LWIP_DBG_OFF
+#define LWIP_TESTMODE 0
+
+#define LWIP_PERF 0