net: lwip: fix initialization sequence before a command
authorJerome Forissier <jerome.forissier@linaro.org>
Tue, 15 Apr 2025 21:17:36 +0000 (23:17 +0200)
committerJerome Forissier <jerome.forissier@linaro.org>
Wed, 23 Apr 2025 08:02:49 +0000 (10:02 +0200)
commit5666865decb8f24b4710a15be35207a62f972aee
treec159c9d736e82e76b9b26b5c27dc2e8bd0e578ea
parentfd7607be6268157b3a35f5d5e2b04938ce9f8701
net: lwip: fix initialization sequence before a command

The things that are done prior to executing a network command with
NET_LWIP are not consistent with what is done with NET. It impacts the
selection of the current device, and more precisely if the active device
is invalid NET would return an error while NET_LWIP would try to pick a
new device. This incorrect behavior was detected thanks to the eth_rotate
sandbox test (dm_test_eth_rotate()).

Fix it by re-using a sequence similar to what NET has in net_loop().
This piece of code is inserted in a function called net_lwip_eth_start()
renamed from net_lwip_eth_set_current().

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/net-lwip.h
net/lwip/dhcp.c
net/lwip/dns.c
net/lwip/net-lwip.c
net/lwip/ping.c
net/lwip/tftp.c
net/lwip/wget.c