mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
[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
1 changed files with 3 additions and 4 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue