summaryrefslogtreecommitdiff
path: root/net/lwip/ping.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/lwip/ping.c')
-rw-r--r--net/lwip/ping.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/lwip/ping.c b/net/lwip/ping.c
index c586a96806d..d8042ceecf9 100644
--- a/net/lwip/ping.c
+++ b/net/lwip/ping.c
@@ -168,10 +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;
- net_lwip_set_current();
-
- 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;
}