mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
net/: Now handles reception of IPv4 packets with larger IPv4 headers containing options.
This commit is contained in:
@@ -118,40 +118,6 @@ struct icmp_hdr_s
|
||||
uint16_t seqno; /* " " "" " " " " " " " " */
|
||||
};
|
||||
|
||||
/* The ICMP and IPv4 headers */
|
||||
|
||||
struct icmp_iphdr_s
|
||||
{
|
||||
/* IPv4 IP header */
|
||||
|
||||
uint8_t vhl; /* 8-bit Version (4) and header length (5 or 6) */
|
||||
uint8_t tos; /* 8-bit Type of service (e.g., 6=TCP) */
|
||||
uint8_t len[2]; /* 16-bit Total length */
|
||||
uint8_t ipid[2]; /* 16-bit Identification */
|
||||
uint8_t ipoffset[2]; /* 16-bit IP flags + fragment offset */
|
||||
uint8_t ttl; /* 8-bit Time to Live */
|
||||
uint8_t proto; /* 8-bit Protocol */
|
||||
uint16_t ipchksum; /* 16-bit Header checksum */
|
||||
uint16_t srcipaddr[2]; /* 32-bit Source IP address */
|
||||
uint16_t destipaddr[2]; /* 32-bit Destination IP address */
|
||||
|
||||
/* ICMP header */
|
||||
|
||||
uint8_t type; /* Defines the format of the ICMP message */
|
||||
uint8_t icode; /* Further qualifies the ICMP messsage */
|
||||
uint16_t icmpchksum; /* Checksum of ICMP header and data */
|
||||
|
||||
/* All ICMP packets have an 8-byte header and variable-sized data section.
|
||||
* The first 4 bytes of the header have fixed format, while the last 4 bytes
|
||||
* depend on the type/code of that ICMP packet.
|
||||
*/
|
||||
|
||||
/* ICMP_ECHO_REQUEST and ICMP_ECHO_REPLY data */
|
||||
|
||||
uint16_t id; /* Used to match requests with replies */
|
||||
uint16_t seqno; /* " " "" " " " " " " " " */
|
||||
};
|
||||
|
||||
/* The structure holding the ICMP statistics that are gathered if
|
||||
* CONFIG_NET_STATISTICS is defined.
|
||||
*/
|
||||
|
||||
+14
-14
@@ -3,7 +3,7 @@
|
||||
* The definitions in this header file are intended only for internal use
|
||||
* by the NuttX network stack.
|
||||
*
|
||||
* Copyright (C) 2010, 2012, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010, 2012, 2014, 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* The NuttX implementation of IGMP was inspired by the IGMP add-on for the
|
||||
@@ -72,14 +72,9 @@
|
||||
#define IGMPv3_MEMBERSHIP_REPORT 0x22 /* IGMP Ver. 3 Membership Report */
|
||||
#define IGMP_LEAVE_GROUP 0x17 /* Leave Group */
|
||||
|
||||
/* Header sizes:
|
||||
*
|
||||
* IGMP_HDRLEN - Size of IGMP header in bytes
|
||||
* IPIGMP_HDRLEN - Size of IP + Size of IGMP header + Size of router alert
|
||||
*/
|
||||
/* Size of IGMP header in bytes */
|
||||
|
||||
#define IGMP_HDRLEN 8
|
||||
#define IPIGMP_HDRLEN (IGMP_HDRLEN + IPv4_HDRLEN + 4)
|
||||
|
||||
/* Time-to-Live must be one */
|
||||
|
||||
@@ -89,13 +84,7 @@
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* IGMPv2 packet structure as defined by RFC 2236.
|
||||
*
|
||||
* The Max Response Time (maxresp) specifies the time limit for the
|
||||
* corresponding report. The field has a resolution of 100 miliseconds, the
|
||||
* value is taken directly. This field is meaningful only in Membership Query
|
||||
* (0x11); in other messages it is set to 0 and ignored by the receiver.
|
||||
*/
|
||||
/* Convenience [re-]definition of the IPv4 header with the router alert */
|
||||
|
||||
struct igmp_iphdr_s
|
||||
{
|
||||
@@ -115,7 +104,18 @@ struct igmp_iphdr_s
|
||||
/* Router Alert IP header option */
|
||||
|
||||
uint16_t ra[2]; /* RFC 2113 */
|
||||
};
|
||||
|
||||
/* IGMPv2 packet structure as defined by RFC 2236.
|
||||
*
|
||||
* The Max Response Time (maxresp) specifies the time limit for the
|
||||
* corresponding report. The field has a resolution of 100 miliseconds, the
|
||||
* value is taken directly. This field is meaningful only in Membership Query
|
||||
* (0x11); in other messages it is set to 0 and ignored by the receiver.
|
||||
*/
|
||||
|
||||
struct igmp_hdr_s
|
||||
{
|
||||
/* IGMPv2 header:
|
||||
*
|
||||
* 0 1 2 3
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
# define IPv4_HDRLEN 20 /* Size of IPv4 header (without options) */
|
||||
# define IPv4_HLMASK 0x0f /* Isolates headler length in VHL field */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
|
||||
Reference in New Issue
Block a user