You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/04/14 20:23:12 UTC
[incubator-nuttx-apps] branch master updated: netutils/ping: skip the id check
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new b8b9d4570 netutils/ping: skip the id check
b8b9d4570 is described below
commit b8b9d45706431006ff793437bbcae458e23e2de9
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Jan 17 18:33:36 2022 +0800
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 <an...@xiaomi.com>
---
netutils/ping/icmp_ping.c | 5 ++++-
netutils/ping/icmpv6_ping.c | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/netutils/ping/icmp_ping.c b/netutils/ping/icmp_ping.c
index f158ce808..89740d8f2 100644
--- a/netutils/ping/icmp_ping.c
+++ b/netutils/ping/icmp_ping.c
@@ -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));
diff --git a/netutils/ping/icmpv6_ping.c b/netutils/ping/icmpv6_ping.c
index 793de1796..ad9bb875d 100644
--- a/netutils/ping/icmpv6_ping.c
+++ b/netutils/ping/icmpv6_ping.c
@@ -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));