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 <jerome.forissier@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -168,11 +168,13 @@ int do_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
|||||||
if (!ipaddr_aton(argv[1], &addr))
|
if (!ipaddr_aton(argv[1], &addr))
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
if (net_lwip_eth_start() < 0)
|
restart:
|
||||||
return CMD_RET_FAILURE;
|
if (net_lwip_eth_start() < 0 || ping_loop(eth_get_dev(), &addr) < 0) {
|
||||||
|
if (net_start_again() == 0)
|
||||||
if (ping_loop(eth_get_dev(), &addr) < 0)
|
goto restart;
|
||||||
|
else
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
return CMD_RET_SUCCESS;
|
return CMD_RET_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user