diff options
| author | Jerome Forissier <[email protected]> | 2025-04-15 23:17:38 +0200 |
|---|---|---|
| committer | Jerome Forissier <[email protected]> | 2025-04-23 10:02:49 +0200 |
| commit | 7156533162afccf5f6315e021fb57c28c1d4c3d6 (patch) | |
| tree | f6654ca0fd8d84182320bcb8f2acf0b4c623f4d8 | |
| parent | 761fe6719c462716b11eddc45171d952ff86dc21 (diff) | |
net: lwip: add restart support to ping
Use net_start_again() in do_ping() to determine if a failed ping should
be restarted on a different interface.
Signed-off-by: Jerome Forissier <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
| -rw-r--r-- | net/lwip/ping.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/lwip/ping.c b/net/lwip/ping.c index 542ef2cb148..d8042ceecf9 100644 --- a/net/lwip/ping.c +++ b/net/lwip/ping.c @@ -168,11 +168,13 @@ int do_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (!ipaddr_aton(argv[1], &addr)) return CMD_RET_USAGE; - if (net_lwip_eth_start() < 0) - return CMD_RET_FAILURE; - - if (ping_loop(eth_get_dev(), &addr) < 0) - return CMD_RET_FAILURE; +restart: + if (net_lwip_eth_start() < 0 || ping_loop(eth_get_dev(), &addr) < 0) { + if (net_start_again() == 0) + goto restart; + else + return CMD_RET_FAILURE; + } return CMD_RET_SUCCESS; } |
