netutils/ping: skip the id check

https://joekuan.wordpress.com/2017/05/30/behaviour-of-identifier-field-in-icmp-ping-as-udp-between-linux-and-osx/
https://lwn.net/Articles/443051/

https: //github.com/apache/incubator-nuttx-apps/blob/master/netutils/ping/icmp_ping.c#L298

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-01-17 18:33:36 +08:00 committed by Petro Karashchenko
parent d17c9509f6
commit b8b9d45706
2 changed files with 8 additions and 2 deletions

View File

@ -315,12 +315,15 @@ void icmp_ping(FAR const struct ping_info_s *info)
if (inhdr->type == ICMP_ECHO_REPLY)
{
#ifndef CONFIG_SIM_NETUSRSOCK
if (ntohs(inhdr->id) != result.id)
{
icmp_callback(&result, ICMP_W_IDDIFF, ntohs(inhdr->id));
retry = true;
}
else if (ntohs(inhdr->seqno) > result.seqno)
else
#endif
if (ntohs(inhdr->seqno) > result.seqno)
{
icmp_callback(&result, ICMP_W_SEQNOBIG,
ntohs(inhdr->seqno));

View File

@ -314,12 +314,15 @@ void icmp6_ping(FAR const struct ping6_info_s *info)
if (inhdr->type == ICMPv6_ECHO_REPLY)
{
#ifndef CONFIG_SIM_NETUSRSOCK
if (ntohs(inhdr->id) != result.id)
{
icmp6_callback(&result, ICMPv6_W_IDDIFF, ntohs(inhdr->id));
retry = true;
}
else if (ntohs(inhdr->seqno) > result.seqno)
else
#endif
if (ntohs(inhdr->seqno) > result.seqno)
{
icmp6_callback(&result, ICMPv6_W_SEQNOBIG,
ntohs(inhdr->seqno));