IP forwarding. Adds a little more structure to handle passing packets received on one network device to another network device. Logic is still incomplete.

This commit is contained in:
Gregory Nutt
2017-07-04 10:19:52 -06:00
parent 59cb2a280b
commit c0c275c8fc
16 changed files with 854 additions and 163 deletions
+23 -3
View File
@@ -99,7 +99,26 @@
* Public Type Definitions
****************************************************************************/
/* The ICMP and IP headers */
struct icmp_hdr_s
{
/* 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 ICMP and IPv4 headers */
struct icmp_iphdr_s
{
@@ -122,8 +141,9 @@ struct icmp_iphdr_s
uint8_t icode; /* Further qualifies the ICMP messsage */
uint16_t icmpchksum; /* Checksum of ICMP header and data */
/* Data following the ICMP header contains the data specific to the
* message type indicated by the Type and Code fields.
/* 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 */
+9 -2
View File
@@ -95,9 +95,16 @@
# define TCP_STOPPED 0x10 /* Bit 4: stopped */
/* Bit 5-7: Unused, but not available */
/* TCP header sizes */
/* TCP header sizes
*
* The minimum size header is 5 words and the maximum is 15 words thus
* giving the minimum size of 20 bytes and maximum of 60 bytes, allowing for
* up to 40 bytes of options in the header.
*/
#define TCP_HDRLEN 20 /* Size of TCP header */
#define TCP_HDRLEN 20 /* Size of TCP header (minimum) */
#define TCP_OPT_HDRLEN(n) (20 + ((n) << 2)) /* Size of TCP header w/options */
#define TCP_MAX_HDRLEN 60 /* Maximum size of TCP header */
#ifdef CONFIG_NET_IPv4
# define IPv4TCP_HDRLEN (TCP_HDRLEN + IPv4_HDRLEN) /* Size of IPv4 + TCP header */