zhhyu7 opened a new pull request, #4201:
URL: https://github.com/apache/nuttx-apps/pull/4201

   ## Summary
   
   A raw ICMP socket sees every echo reply on the host, so two ping
   instances running at the same time printed "WARNING: Ignoring ICMP reply
   with ID x. Expected y" for each other's replies.  Drop the warning, as
   Linux does, and only count replies with our own id.  The wait for a reply
   is now bounded by info->timeout alone, since info->delay used to cut it
   short and lose a reply, and the id comes from gettid(), which is unique
   across processes.
   
   The branch also carries a small compile fix in the same file
   (6a4a506b6, netutils/ping: fix complie error).
   
   ## Impact
   
   - ping/ping6 output only.  Single pings behave as before.
   - No Kconfig, API or build-system change.
   
   ## Testing
   
   sim:dynconns on the nuttx0 bridge (host 10.0.1.1, target 10.0.1.2),
   x86_64 gcc 13.  Same test on apache/master for comparison.
   
   Two concurrent pings, this branch:
   
   ```
   nsh> ping -c 3 10.0.1.1 &
   ping [9:100]
   nsh> PING 10.0.1.1 56 bytes of data
   56 bytes from 10.0.1.1: icmp_seq=0 time=0.1 ms
   56 bytes from 10.0.1.1: icmp_seq=1 time=0.1 ms
   ping -c 3 10.0.1.1
   PING 10.0.1.1 56 bytes of data
   56 bytes from 10.0.1.1: icmp_seq=0 time=0.1 ms
   56 bytes from 10.0.1.1: icmp_seq=2 time=0.1 ms
   56 bytes from 10.0.1.1: icmp_seq=1 time=0.1 ms
   3 packets transmitted, 3 received, 0% packet loss, time 3029 ms
   rtt min/avg/max/mdev = 0.158/0.168/0.184/0.015 ms
   56 bytes from 10.0.1.1: icmp_seq=2 time=0.1 ms
   3 packets transmitted, 3 received, 0% packet loss, time 3029 ms
   rtt min/avg/max/mdev = 0.161/0.169/0.175/0.005 ms
   ```
   
   Same test on apache/master:
   
   ```
   nsh> ping -c 3 10.0.1.1 &
   ping [9:100]
   nsh> PING 10.0.1.1 56 bytes of data
   56 bytes from 10.0.1.1: icmp_seq=0 time=0.1 ms
   56 bytes from 10.0.1.1: icmp_seq=1 time=0.0 ms
   ping -c 3 10.0.1.1
   PING 10.0.1.1 56 bytes of data
   56 bytes from 10.0.1.1: icmp_seq=0 time=0.1 ms
   WARNING: Ignoring ICMP reply with ID 3.  Expected 2
   56 bytes from 10.0.1.1: icmp_seq=2 time=0.2 ms
   WARNING: Ignoring ICMP reply with ID 2.  Expected 3
   56 bytes from 10.0.1.1: icmp_seq=1 time=0.2 ms
   3 packets transmitted, 3 received, 0% packet loss, time 3028 ms
   rtt min/avg/max/mdev = 0.079/0.165/0.237/0.065 ms
   56 bytes from 10.0.1.1: icmp_seq=2 time=0.1 ms
   3 packets transmitted, 3 received, 0% packet loss, time 3029 ms
   rtt min/avg/max/mdev = 0.153/0.181/0.225/0.033 ms
   ```
   
   ping6 still works:
   
   ```
   nsh> ping6 -c 2 fc00::1
   PING6 fc00::1: 56 bytes of data
   56 bytes from fc00::1 icmp_seq=0 time=0.3 ms
   56 bytes from fc00::1 icmp_seq=1 time=0.1 ms
   2 packets transmitted, 2 received, 0% packet loss,time 2019 ms
   rtt min/avg/max/mdev = 0.164/0.245/0.326/0.081 ms
   ```
   
   Also built with CONFIG_NET_SOCKOPTS=n.  checkpatch.sh -c -u -m -g passes
   for every commit.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to