2. lwIP — Lightweight IP

lwIP is a small, independent implementation of the TCP/IP protocol suite, designed for embedded systems with limited resources.

2.1. Integration of lwIP in SO3

The port of lwIP to SO3 was originally done by Julien Quartier as a Diploma work. The stack lives under net/lwip/ and provides TCP, UDP, IPv4/IPv6 and a DNS resolver.

SO3 exposes a BSD-style socket API to user space: the net/ glue maps VFS file descriptors onto lwIP sockets so that socket(), bind(), connect(), send() and recv() work from applications. The network interface driver lives in devices/net/ — currently an smc911x (smsc,smc911x) MAC. See the networking section of the kernel chapter.

Note

Networking is opt-in: it is enabled with CONFIG_NET and is off in the default virt64_defconfig. The smc911x MAC is present on boards such as the ARM Versatile Express; QEMU’s virt machine does not provide one, so a different NIC driver is needed to exercise the stack there.

2.2. Trying it out

With CONFIG_NET enabled and a supported NIC, the ping application exercises the stack end to end. Under QEMU the launch scripts attach a tap network device (scripts/qemu-ifup.sh / qemu-ifdown.sh), so the guest can reach the host network once the tap bridge is configured.