diff --git a/include/nuttx/net/icmp.h b/include/nuttx/net/icmp.h index d949c255d30..eeb52a308b1 100644 --- a/include/nuttx/net/icmp.h +++ b/include/nuttx/net/icmp.h @@ -94,6 +94,26 @@ #define ICMP_HDRLEN 8 /* Size of ICMP header */ #define IPICMP_HDRLEN (ICMP_HDRLEN + IPv4_HDRLEN) /* Size of IPv4 + ICMP header */ +/* Codes for UNREACH. */ + +#define ICMP_NET_UNREACH 0 /* Network Unreachable */ +#define ICMP_HOST_UNREACH 1 /* Host Unreachable */ +#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ +#define ICMP_PORT_UNREACH 3 /* Port Unreachable */ +#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ +#define ICMP_SR_FAILED 5 /* Source Route failed */ +#define ICMP_NET_UNKNOWN 6 +#define ICMP_HOST_UNKNOWN 7 +#define ICMP_HOST_ISOLATED 8 +#define ICMP_NET_ANO 9 +#define ICMP_HOST_ANO 10 +#define ICMP_NET_UNR_TOS 11 +#define ICMP_HOST_UNR_TOS 12 +#define ICMP_PKT_FILTERED 13 /* Packet filtered */ +#define ICMP_PREC_VIOLATION 14 /* Precedence violation */ +#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ +#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ + /**************************************************************************** * Public Type Definitions ****************************************************************************/ @@ -113,8 +133,16 @@ struct icmp_hdr_s /* ICMP_ECHO_REQUEST and ICMP_ECHO_REPLY data */ - uint16_t id; /* Used to match requests with replies */ - uint16_t seqno; /* " " "" " " " " " " " " */ + union + { + struct + { + uint16_t id; /* Used to match requests with replies */ + uint16_t seqno; /* " " "" " " " " " " " " */ + }; + + uint32_t data; + }; }; /* The structure holding the ICMP statistics that are gathered if diff --git a/include/nuttx/net/icmpv6.h b/include/nuttx/net/icmpv6.h index e520fc1c9cd..457619d223b 100644 --- a/include/nuttx/net/icmpv6.h +++ b/include/nuttx/net/icmpv6.h @@ -131,6 +131,16 @@ #define ICMPv6_OPT_SIZE(a) ((a) > 0 ? ((a) + 2 + 7) & ~7 : 0) #define ICMPv6_OPT_OCTECTS(a) ((a) > 0 ? ((a) + 2 + 7) >> 3 : 0) +/* Codes for Destination Unreachable */ + +#define ICMPv6_NOROUTE 0 +#define ICMPv6_ADM_PROHIBITED 1 +#define ICMPv6_NOT_NEIGHBOUR 2 +#define ICMPv6_ADDR_UNREACH 3 +#define ICMPv6_PORT_UNREACH 4 +#define ICMPv6_POLICY_FAIL 5 +#define ICMPv6_REJECT_ROUTE 6 + /**************************************************************************** * Public Type Definitions ****************************************************************************/ @@ -146,6 +156,8 @@ struct icmpv6_hdr_s /* Data following the ICMP header contains the data specific to the * message type indicated by the Type and Code fields. */ + + uint32_t data; }; /* The ICMPv6 and IPv6 headers */