zhhyu7 opened a new pull request, #4193: URL: https://github.com/apache/nuttx-apps/pull/4193
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary Add arping(), which sends an ARP REQUEST through an AF_PACKET socket and waits for the ARP REPLY to resolve the MAC address of an IP address on the local link, and an NSH "arping" command on top of it: arping -i <device> [-w <timeout in seconds>] <destination_ip> ## Impact - New, opt-in: CONFIG_NETUTILS_ARPING (depends on NET_ARP && NET_PKT) and CONFIG_SYSTEM_ARPING. ## Testing sim:dynconns + CONFIG_NET_PKT on the nuttx0 bridge: ``` nsh> arping -i eth0 10.0.1.1 ARPING 10.0.1.1 from 10.0.1.2 eth0 Unicast reply from 10.0.1.1 [a2:96:06:65:38:2a] 0.058ms ``` (a2:96:06:65:38:2a is the MAC of the host bridge nuttx0.) Depends on the kernel: - With no reply, arping relies on SO_RCVTIMEO on the packet socket. pkt_recvmsg() on apache/master waits with UINT_MAX and ignores SO_RCVTIMEO, so "arping 10.0.1.250" (no such host) never returns. With a local fix in net/pkt/pkt_recvmsg.c (use _SO_TIMEOUT(s_rcvtimeo) and map -ETIMEDOUT to -EAGAIN, as UDP and TCP do), it returns after -w seconds: ``` nsh> arping -i eth0 -w 1 10.0.1.250 ARPING 10.0.1.250 from 10.0.1.2 eth0 nsh> echo alive alive ``` That nuttx fix has to be submitted first (or together); see pkt_rcvtimeo.patch. - On timeout the command prints nothing and returns -ETIMEDOUT; a "Timeout" line would be friendlier. 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]
