4 Commits

Author SHA1 Message Date
Jerome Forissier
90c05f68fc net: lwip: ping: set net_try_count to 1
The legacy network stack sets net_try_count to 1 at the beginning of the
net_loop() function. This is required for net_start_again() to work
properly. Therefore, set the variable accordingly in the do_ping()
function when NET_LWIP=y. This fixes an issue where a ping to an
unreachable destination would run twice on the same network device. For
example with qemu_arm64_lwip_defconfig:

 => dhcp
 DHCP client bound to address 10.0.2.15 (3 ms)
 => ping 10.0.0.1
 Using virtio-net#32 device
 ping failed; host 10.0.0.1 is not alive
 Using virtio-net#32 device
 ping failed; host 10.0.0.1 is not alive
 => QEMU: Terminated

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-08-18 15:47:58 +02:00
Jerome Forissier
ab1fdb5436 lwip: ping: accept host name when CONFIG_CMD_DNS=y
Update the ping command so that a host name is accepted in addition to
an IP address, provided DNS support is enabled.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-07-08 11:07:37 +02:00
Jerome Forissier
ba814b8b5a lwip: split cmd/net-lwip.c into one file per command
Move each command in cmd/net-lwip.c into its own file
(cmd/lwip/${cmd}.c).

Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-07-08 11:07:37 +02:00
Jerome Forissier
d63c4434bf lwip: move net/lwip/ping.c to cmd/lwip
Prepare to split the ping command from cmd/net-lwip.c by moving the
implementation from net/lwip/dns.c to cmd/lwip.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-07-08 11:07:37 +02:00