
On Wed, Aug 07, 2024 at 08:54:08PM +0200, Michael Nazzareno Trimarchi wrote:
Hi Jerome
On Thu, Jul 25, 2024 at 2:58 PM Jerome Forissier jerome.forissier@linaro.org wrote:
This is a rework of a patch series by Maxim Uvarov: "net/lwip: add lwip library for the network stack" [1]. The goal is to introduce the lwIP TCP/IP stack [2] [3] as an alternative to the current implementation in net/, selectable with Kconfig, and ultimately keep only lwIP if possible. Some reasons for doing so are:
- Make the support of HTTPS in the wget command easier. Javier T. and
Raymond M. (CC'd) have some additional lwIP and Mbed TLS patches to do so. With that it becomes possible to fetch and launch a distro installer such as Debian etc. using a secure, authenticated connection directly from the U-Boot shell. Several use cases:
- Authentication: prevent MITM attack (third party replacing the
binary with a different one)
- Confidentiality: prevent third parties from grabbing a copy of the
image as it is being downloaded
- Allow connection to servers that do not support plain HTTP anymore
(this is becoming more and more common on the Internet these days)
- Possibly benefit from additional features implemented in lwIP
- Less code to maintain in U-Boot
Prior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command:
$ git subtree add --squash --prefix lib/lwip/lwip https://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE
Notes:
- A number of features are currently incompatible with NET_LWIP: SANDBOX,
DFU_TFTP, FASTBOOT, SPL_NET. All make assumptions on how the network stack is implemented and/or pull sybols that are not trivially exported from lwIP. Some interface rework may be needed.
- Due to the above and in order to provide some level of testing, a new QEMU
configuration is introduced (qemu_arm64_lwip_defconfig) which is the same as qemu_arm64_defconfig but with NET_LWIP and CMD_*_LWIP enabled. Tests are added to test/py/tests/test_net.py for that configuration.
- The default QEMU networking doesn't work with NET_LWIP. wget
pauses and resets the connection. Wireshark shows [TCP Window Full] and [TCP ZeroWindow]. Wen using an emulated e1000 however all is fine (that is "-nic tap,model=e1000" on the QEMU command line, with a bridge configured on the host).
Changes in v5:
- Rebased on next
- Refactor Kconfig options to avoid duplicates
- Library functions use a more consistent naming (dhcp_loop(),
ping_loop() etc.) and take a struct udevice * parameter (Heinrich S.)
- Do not use net_process_receive_packet() for input anymore. Instead of
calling eth_rx() which would invoke net_process_receive_packet(), we call a new net_lwip_rx(udev) function which invokes the device recv() and pushes the packets up the lwIP stack. Thus everything is tied to a udevice now. (Heinrich S.)
- Add "configs: replace '# CONFIG_NET is not set' with CONFIG_NO_NET=y"
(Tom R.)
Here I have some questions. You can have CONFIG_NET with two alternatives and the alternatives are exclusive. Why do we need a CONFIG_NO_NET definition?
For the platforms that today don't enable networking at all (of which there are a small but reasonable number). Since it's a "choice" statement we need a "none of the above" option.