This change adds support for semi-standard IPPROTO_ICMP AF_INET datagram sockets. This replaces the old ad hoc, nonstandard way of implementing ping with a more standard, socket interface.

Squashed commit of the following:

    net/icmp:  Finishes off icmp_recvfrom().
    net/icmp:  Add readahead support for IPPROTO_ICMP sockets.
    net/icmp:  Add poll() support for IPPROTO_ICMP sockets.
    net/icmp:  Add a connection structure for IPPROTO_ICMP sockets.
    net/icmp:  Implements sendto for the IPPROTO_ICMP socket.
    net/icmp:  Move icmp_sendto() and icmp_recvfrom() to separate files.  They are likely to be complex (when they are implemented).
    net/icmp:  Hook IPPROTO_ICMP sockets into network.  Fix some naming collisions.  Still missing basic ICMP send/receive logic.
    configs: apps/system/ping current need poll() enabled.
    configs: All defconfig files that use to enable low-level support must now enabled CONFIG_SYSTEM_PING.
    net/icmp:  Adds basic build framework to support IPPROTO_ICMP sockets.
This commit is contained in:
Gregory Nutt
2017-10-23 08:45:12 -06:00
parent c28b938600
commit cccc86da09
106 changed files with 2918 additions and 842 deletions
+2 -32
View File
@@ -92,8 +92,8 @@
/* Header sizes */
#define ICMP_HDRLEN 4 /* Size of ICMP header */
#define IPICMP_HDRLEN (ICMP_HDRLEN + IPv4_HDRLEN) /* Size of IP + ICMP header */
#define ICMP_HDRLEN 8 /* Size of ICMP header */
#define IPICMP_HDRLEN (ICMP_HDRLEN + IPv4_HDRLEN) /* Size of IPv4 + ICMP header */
/****************************************************************************
* Public Type Definitions
@@ -182,36 +182,6 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: imcp_ping
*
* Description:
* Send a ECHO request and wait for the ECHO response
*
* Parameters:
* addr - The IP address of the peer to send the ICMP ECHO request to
* in network order.
* id - The ID to use in the ICMP ECHO request. This number should be
* unique; only ECHO responses with this matching ID will be
* processed (host order)
* seqno - The sequence number used in the ICMP ECHO request. NOT used
* to match responses (host order)
* dsecs - Wait up to this many deci-seconds for the ECHO response to be
* returned (host order).
*
* Return:
* seqno of received ICMP ECHO with matching ID (may be different
* from the seqno argument (may be a delayed response from an earlier
* ping with the same ID). Or a negated errno on any failure.
*
* Assumptions:
* Called from the user level with interrupts enabled.
*
****************************************************************************/
int icmp_ping(in_addr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen,
int dsecs);
#undef EXTERN
#ifdef __cplusplus
}
+1 -1
View File
@@ -79,7 +79,7 @@
# define _NX_GETERRNO(r) (-(r))
# define _NX_GETERRVAL(r) (r)
#else
# define _NX_SEND(s,b,l,f) send(s,b,l,f)
# define _NX_SEND(s,b,l,f) send(s,b,l,f)
# define _NX_RECV(s,b,l,f) recv(s,b,l,f)
# define _NX_RECVFROM(s,b,l,f,a,n) recvfrom(s,b,l,f,a,n)
# define _NX_GETERRNO(r) errno
+1 -1
View File
@@ -226,7 +226,7 @@
/* ICMP configuration options */
#ifndef CONFIG_NET_ICMP
# undef CONFIG_NET_ICMP_PING
# undef CONFIG_NET_ICMP_SOCKET
#endif
/* UDP configuration options */