[ping] fix ping early return when ping is interrupted by ifdown
During a long ping, the tester will repeatedly switch the dev interface on and off. When the interface is down and ping is in sendto sem_wait state,ifdown will trigger event of sendto and post sem. in func of sendto_eventhandler: if ((flags & NETDEV_DOWN) != 0) { nerr("ERROR: Interface is down\n"); pstate->snd_result = -ENETUNREACH; goto end_wait; } Signed-off-by: meijian <meijian@xiaomi.com>
This commit is contained in:
parent
c0c9a6007c
commit
a7cffe03b5
@ -270,22 +270,21 @@ void icmp_ping(FAR const struct ping_info_s *info)
|
||||
}
|
||||
|
||||
priv->start = clock();
|
||||
result.nrequests++;
|
||||
priv->nsent = sendto(priv->sockfd, iobuffer, result.outsize, 0,
|
||||
(FAR struct sockaddr *)&priv->destaddr,
|
||||
sizeof(struct sockaddr_in));
|
||||
if (priv->nsent < 0)
|
||||
{
|
||||
icmp_callback(&result, ICMP_E_SENDTO, errno);
|
||||
goto done;
|
||||
continue;
|
||||
}
|
||||
else if (priv->nsent != result.outsize)
|
||||
{
|
||||
icmp_callback(&result, ICMP_E_SENDSMALL, priv->nsent);
|
||||
goto done;
|
||||
continue;
|
||||
}
|
||||
|
||||
result.nrequests++;
|
||||
|
||||
priv->elapsed = 0;
|
||||
do
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user