From a735e6e9d639114d67e4440f9e051a89d2094118 Mon Sep 17 00:00:00 2001 From: Thomas RIENOESSL Date: Wed, 21 Nov 2018 15:56:07 +0100 Subject: net: explicitly assign errno to return code in case of network failure When dealing with two ethernet ports and having "netretry" set to "once", it could occur that the connection (e.g. an ARP request) failed, hence the status of the netloop was "NETLOOP_FAIL". Due to the setting of "netretry", the network logic would then switch to the other network interface, assigning "ret" with the return value of "net_start_again()". If this call succeeded we would return 0 (i.e. success) to the caller when in reality the network action failed. Signed-off-by: Thomas RIENOESSL Reviewed-by: Christian Gmeiner Acked-by: Joe Hershberger --- test/dm/eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/dm/eth.c') diff --git a/test/dm/eth.c b/test/dm/eth.c index 850eabb9dc..6e002b8dce 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -237,7 +237,7 @@ static int _dm_test_net_retry(struct unit_test_state *uts) env_set("ethact", "eth@10004000"); env_set("netretry", "no"); sandbox_eth_skip_timeout(); - ut_asserteq(-ETIMEDOUT, net_loop(PING)); + ut_asserteq(-ENONET, net_loop(PING)); ut_asserteq_str("eth@10004000", env_get("ethact")); return 0; -- cgit