Skip to content

lwIP Callback API

lbuild module: modm:ext:lwip

lwIP 2.2.1 configured for NO_SYS=1. IPv4, Ethernet, ARP, ICMP, UDP, and TCP are enabled by default. Sequential netconn and socket APIs are not included.

Optional callback API protocols and resource sizes can be selected by defining a <lwipopts_local.h> file, which is included automatically if it is found on the application include path. For example:

#define MEM_SIZE        (64 * 1024)
#define TCP_SND_BUF     (8 * TCP_MSS)
#define LWIP_DHCP       1

The mDNS responder (LWIP_MDNS_RESPONDER, <lwip/apps/mdns.h>) and PPP over serial (PPP_SUPPORT and PPPOS_SUPPORT, <netif/ppp/pppos.h>) are compiled too and are enabled the same way.

Statistics and debug output are off by default. Enable them in <lwipopts_local.h> or with the modm:build:cppdefines collector, lwIP prints its diagnostics to MODM_LOG_DEBUG when modm:debug is part of the project:

<collect name="modm:build:cppdefines">LWIP_DEBUG=1</collect>
<collect name="modm:build:cppdefines">TCP_DEBUG=LWIP_DBG_ON</collect>

With modm:processing:fiber, applications must hold modm::lwip::LwIPSingleThreadGuard while calling lwIP APIs, since fibers may interleave. Without fibers, lwIP only checks that it is not called from an interrupt.

Hardware checksum offload cannot be combined with transmit-side IPv4 fragmentation. lwIP invokes a netif's linkoutput callback once per fragment, where the MAC no longer sees the complete transport datagram. Receive reassembly remains available and unchecked frames use software verification.

Options

checksum

Checksum mode for lwIP Ethernet traffic.

Default: software
Inputs: [hardware, software]

ip.fragmentation

Enable outgoing IPv4 fragmentation.

Default: yes
Inputs: [yes, no]

Dependencies

modm:ext:lwip modm_ext_lwip modm: ext: lwip modm_architecture_assert modm: architecture: assert modm_ext_lwip->modm_architecture_assert modm_architecture_clock modm: architecture: clock modm_ext_lwip->modm_architecture_clock modm_architecture_interrupt modm: architecture: interrupt modm_ext_lwip->modm_architecture_interrupt modm_ext_stdc++ modm: ext: stdc++ modm_ext_lwip->modm_ext_stdc++