Network: All logic will now handle varialbe length link layer protocol headers within incoming packets. This permits use of multiple network interfaces with differing data links. For example, ETHERNET + SLIP

This commit is contained in:
Gregory Nutt
2014-11-15 13:13:23 -06:00
parent 5d05b00fda
commit 2e55db369d
28 changed files with 144 additions and 90 deletions
+9 -3
View File
@@ -1713,11 +1713,17 @@ static int nfs_bind(FAR struct inode *blkdriver, FAR const void *data,
buflen = tmp;
}
/* But don't let the buffer size exceed the MSS of the socket type */
/* But don't let the buffer size exceed the MSS of the socket type.
*
* In the case where there are multiple network devices with different
* link layer protocols (CONFIG_NET_MULTILINK), each network device
* may support a different UDP MSS value. Here we arbitrarily select
* the minimum MSS for that case.
*/
if (buflen > UDP_MSS)
if (buflen > MIN_UDP_MSS)
{
buflen = UDP_MSS;
buflen = MIN_UDP_MSS;
}
/* Create an instance of the mountpt state structure */
+45 -14
View File
@@ -86,16 +86,16 @@
* varies and is obtained from the network device structure.
*/
#ifdef CONFIG_NET_MULTILINK
/* We are supporting multiple network devices and using different link
* level protocols. Get the size of the link layer header from the
* device structure.
*/
#if defined(CONFIG_NET_MULTILINK)
/* We are supporting multiple network devices using different link layer
* protocols. Get the size of the link layer header from the device
* structure.
*/
# define NET_LL_HDRLEN(d) ((d)->d_llhdrlen)
#if defined(CONFIG_NET_SLIP)
/* There is no link layer header with SLIP */
#elif defined(CONFIG_NET_SLIP)
/* There is no link layer header with SLIP */
# ifdef CONFIG_NET_IPv6
# error SLIP is not available for IPv6
@@ -103,11 +103,11 @@
# define NET_LL_HDRLEN(d) 0
#else /* if defined(CONFIG_NET_ETHERNET) */
/* Assume standard Ethernet header */
/* Assume standard Ethernet link layer header */
# define NET_LL_HDRLEN(d) 14
#endif
#endif /* MULTILINK or SLIP or ETHERNET */
/* Layer 3/4 Configuration Options ******************************************/
@@ -162,10 +162,22 @@
#endif
/* The UDP maximum packet size. This is should not be to set to more
* than CONFIG_NET_BUFSIZE - NET_LL_HDRLEN - IPUDP_HDRLEN.
* than CONFIG_NET_BUFSIZE - NET_LL_HDRLEN(dev) - IPUDP_HDRLEN.
*/
#define UDP_MSS(d) (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN(d) - IPUDP_HDRLEN)
#define UDP_MSS(d) (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN(d) - IPUDP_HDRLEN)
#ifdef CONFIG_NET_ETHERNET
# define MIN_UDP_MSS (CONFIG_NET_BUFSIZE - ETH_HDRLEN - IPUDP_HDRLEN)
#else /* if defined(CONFIG_NET_SLIP) */
# define MIN_UDP_MSS (CONFIG_NET_BUFSIZE - IPUDP_HDRLEN)
#endif
#ifdef CONFIG_NET_SLIP
# define MAX_UDP_MSS (CONFIG_NET_BUFSIZE - IPUDP_HDRLEN)
#else /* if defined(CONFIG_NET_ETHERNET) */
# define MAX_UDP_MSS (CONFIG_NET_BUFSIZE - ETH_HDRLEN - IPUDP_HDRLEN)
#endif
/* TCP configuration options */
@@ -227,20 +239,39 @@
#define TCP_MAXSYNRTX 5
/* The TCP maximum segment size. This is should not be set to more
* than CONFIG_NET_BUFSIZE - NET_LL_HDRLEN - IPTCP_HDRLEN.
* than CONFIG_NET_BUFSIZE - NET_LL_HDRLEN(dev) - IPTCP_HDRLEN.
*
* In the case where there are multiple network devices with different
* link layer protocols (CONFIG_NET_MULTILINK), each network device
* may support a different UDP MSS value. Here we arbitrarily select
* the minimum MSS for that case.
*/
#define TCP_MSS (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN - IPTCP_HDRLEN)
#define TCP_MSS(d) (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN(d) - IPTCP_HDRLEN)
#ifdef CONFIG_NET_ETHERNET
# define MIN_TCP_MSS (CONFIG_NET_BUFSIZE - ETH_HDRLEN - IPTCP_HDRLEN)
#else /* if defined(CONFIG_NET_SLIP) */
# define MIN_TCP_MSS (CONFIG_NET_BUFSIZE - IPTCP_HDRLEN)
#endif
#ifdef CONFIG_NET_SLIP
# define MAX_TCP_MSS (CONFIG_NET_BUFSIZE - IPTCP_HDRLEN)
#else /* if defined(CONFIG_NET_ETHERNET) */
# define MAX_TCP_MSS (CONFIG_NET_BUFSIZE - ETH_HDRLEN - IPTCP_HDRLEN)
#endif
/* The size of the advertised receiver's window.
*
* Should be set low (i.e., to the size of the d_buf buffer) is the
* application is slow to process incoming data, or high (32768 bytes)
* if the application processes data quickly.
*
* See the note above regarding the TCP MSS and CONFIG_NET_MULTILINK.
*/
#ifndef CONFIG_NET_RECEIVE_WINDOW
# define CONFIG_NET_RECEIVE_WINDOW TCP_MSS
# define CONFIG_NET_RECEIVE_WINDOW MIN_TCP_MSS
#endif
/* How long a connection should stay in the TIME_WAIT state.
+1 -1
View File
@@ -119,7 +119,7 @@ struct net_driver_s
* driver should place incoming data into this buffer. When sending data,
* the device driver should read the link level headers and the TCP/IP
* headers from this buffer. The size of the link level headers is
* configured by the NET_LL_HDRLEN define.
* configured by the NET_LL_HDRLEN(dev) define.
*
* uIP will handle only a single buffer for both incoming and outgoing
* packets. However, the drive design may be concurrently send and
+5 -5
View File
@@ -56,6 +56,7 @@
#include <stdint.h>
#include <nuttx/net/netconfig.h>
#include <nuttx/net/arp.h>
#include <nuttx/net/ip.h>
/****************************************************************************
@@ -117,11 +118,10 @@
* This is a long established rule.
*/
#if TCP_MSS > 576
# define TCP_INITIAL_MSS 576
#else
# define TCP_INITIAL_MSS TCP_MSS
#endif
#define TCP_INITIAL_MSS(d) (TCP_MSS(d) > 576 ? 576 : TCP_MSS(d))
#define MIN_TCP_INITIAL_MSS (MIN_TCP_MSS > 576 ? 576 : MIN_TCP_MSS)
#define MAX_TCP_INITIAL_MSS (MAX_TCP_MSS > 576 ? 576 : MAX_TCP_MSS)
/****************************************************************************
* Public Type Definitions
+2 -2
View File
@@ -107,13 +107,13 @@
/* Macros */
#define BUF ((FAR struct net_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define BUF ((FAR struct net_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
#define FBUF ((FAR struct net_iphdr_s *)&g_reassembly_buffer[0])
/* IP fragment re-assembly */
#define IP_MF 0x20
#define TCP_REASS_BUFSIZE (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN)
#define TCP_REASS_BUFSIZE (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN(dev))
#define TCP_REASS_LASTFRAG 0x01
/****************************************************************************
+1 -1
View File
@@ -66,7 +66,7 @@
* Pre-processor Definitions
****************************************************************************/
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Public Variables
+2 -2
View File
@@ -65,8 +65,8 @@
* Pre-processor Definitions
****************************************************************************/
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define ICMPDAT (&dev->d_buf[NET_LL_HDRLEN + sizeof(struct icmp_iphdr_s)])
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
#define ICMPDAT (&dev->d_buf[NET_LL_HDRLEN(dev) + sizeof(struct icmp_iphdr_s)])
/* Allocate a new ICMP data callback */
+2 -2
View File
@@ -90,8 +90,8 @@ void icmp_poll(FAR struct net_driver_s *dev)
{
/* Setup for the application callback */
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPICMP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN + IPICMP_HDRLEN];
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPICMP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPICMP_HDRLEN];
dev->d_len = 0;
dev->d_sndlen = 0;
+1 -1
View File
@@ -57,7 +57,7 @@
* Pre-processor Definitions
****************************************************************************/
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Public Variables
+2 -2
View File
@@ -62,7 +62,7 @@
* Pre-processor Definitions
****************************************************************************/
#define IGMPBUF ((struct igmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define IGMPBUF ((struct igmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Private Functions
@@ -125,7 +125,7 @@ void igmp_input(struct net_driver_s *dev)
/* Verify the message length */
if (dev->d_len < NET_LL_HDRLEN+IPIGMP_HDRLEN)
if (dev->d_len < NET_LL_HDRLEN(dev) + IPIGMP_HDRLEN)
{
IGMP_STATINCR(g_netstats.igmp.length_errors);
nlldbg("Length error\n");
+2 -2
View File
@@ -151,8 +151,8 @@ void igmp_poll(FAR struct net_driver_s *dev)
/* Setup the poll operation */
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPIGMP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN + IPIGMP_HDRLEN];
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPIGMP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPIGMP_HDRLEN];
dev->d_len = 0;
dev->d_sndlen = 0;
+1 -1
View File
@@ -76,7 +76,7 @@
/* Buffer layout */
#define RASIZE (4)
#define IGMPBUF ((struct igmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define IGMPBUF ((struct igmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Public Variables
+2 -2
View File
@@ -102,8 +102,8 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn)
{
/* Setup for the application callback */
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPUDP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPUDP_HDRLEN];
dev->d_len = 0;
dev->d_sndlen = 0;
+13 -2
View File
@@ -169,7 +169,7 @@ static inline void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate,
* connection operation via by the lower, device interfacing layer.
*
* Parameters:
* dev The sructure of the network driver that caused the interrupt
* dev The structure of the network driver that caused the interrupt
* pvconn The connection structure associated with the socket
* flags Set of events describing why the callback was invoked
*
@@ -250,6 +250,17 @@ static uint16_t psock_connect_interrupt(FAR struct net_driver_s *dev,
psock_teardown_callbacks(pstate, pstate->tc_result);
#ifdef CONFIG_NET_MULTILINK
/* When we set up the connection structure, we did not know the size
* of the initial MSS. Now that the connection is associated with a
* network device, we now know the size of link layer header and can
* determine the correct initial MSS.
*/
DEBUGASSERT(psock->s_conn);
psock->s_conn->mss = TCP_INITIAL_MSS(dev);
#endif
/* Wake up the waiting thread */
sem_post(&pstate->tc_sem);
@@ -305,7 +316,7 @@ static inline int psock_tcp_connect(FAR struct socket *psock,
}
else
{
/* Perform the uIP connection operation */
/* Perform the TCP connection operation */
ret = tcp_connect(psock->s_conn, inaddr);
}
+2 -2
View File
@@ -70,14 +70,14 @@
#include "socket/socket.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
#if defined(CONFIG_NET_TCP_SPLIT) && !defined(CONFIG_NET_TCP_SPLIT_SIZE)
# define CONFIG_NET_TCP_SPLIT_SIZE 40
#endif
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Private Types
+3 -3
View File
@@ -71,11 +71,11 @@
#include "socket/socket.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Private Types
+2 -1
View File
@@ -358,7 +358,8 @@ FAR struct tcp_conn_s *tcp_listener(uint16_t portno);
*
****************************************************************************/
FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct tcp_iphdr_s *buf);
FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev,
FAR struct tcp_iphdr_s *buf);
/****************************************************************************
* Name: tcp_bind()
+9 -4
View File
@@ -508,7 +508,8 @@ FAR struct tcp_conn_s *tcp_listener(uint16_t portno)
*
****************************************************************************/
FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct tcp_iphdr_s *buf)
FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev,
FAR struct tcp_iphdr_s *buf)
{
FAR struct tcp_conn_s *conn = tcp_alloc();
if (conn)
@@ -522,7 +523,7 @@ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct tcp_iphdr_s *buf)
conn->nrtx = 0;
conn->lport = buf->destport;
conn->rport = buf->srcport;
conn->mss = TCP_INITIAL_MSS;
conn->mss = TCP_INITIAL_MSS(dev);
net_ipaddr_copy(conn->ripaddr, net_ip4addr_conv32(buf->srcipaddr));
conn->tcpstateflags = TCP_SYN_RCVD;
@@ -670,12 +671,16 @@ int tcp_connect(FAR struct tcp_conn_s *conn,
return port;
}
/* Initialize and return the connection structure, bind it to the port number */
/* Initialize and return the connection structure, bind it to the port
* number. At this point, we do not know the size of the initial MSS We
* know the total size of the packet buffer, but we don't yet know the
* size of link layer header.
*/
conn->tcpstateflags = TCP_SYN_SENT;
tcp_initsequence(conn->sndseq);
conn->mss = TCP_INITIAL_MSS;
conn->mss = MIN_TCP_INITIAL_MSS;
conn->unacked = 1; /* TCP length of the SYN is one. */
conn->nrtx = 0;
conn->timer = 1; /* Send the SYN next time around. */
+20 -20
View File
@@ -64,7 +64,7 @@
* Pre-processor Definitions
****************************************************************************/
#define BUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define BUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Public Variables
@@ -110,8 +110,8 @@ void tcp_input(FAR struct net_driver_s *dev)
int len;
int i;
dev->d_snddata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
dev->d_appdata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
dev->d_snddata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev)];
dev->d_appdata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev)];
#ifdef CONFIG_NET_STATISTICS
g_netstats.tcp.recv++;
@@ -177,7 +177,7 @@ void tcp_input(FAR struct net_driver_s *dev)
* user application to accept it.
*/
conn = tcp_alloc_accept(pbuf);
conn = tcp_alloc_accept(dev, pbuf);
if (conn)
{
/* The connection structure was successfully allocated. Now see if
@@ -219,7 +219,7 @@ void tcp_input(FAR struct net_driver_s *dev)
{
for (i = 0; i < ((pbuf->tcpoffset >> 4) - 5) << 2 ;)
{
opt = dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + i];
opt = dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + i];
if (opt == TCP_OPT_END)
{
/* End of options. */
@@ -233,13 +233,13 @@ void tcp_input(FAR struct net_driver_s *dev)
++i;
}
else if (opt == TCP_OPT_MSS &&
dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i] == TCP_OPT_MSS_LEN)
dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + 1 + i] == TCP_OPT_MSS_LEN)
{
/* An MSS option with the right option length. */
tmp16 = ((uint16_t)dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 2 + i] << 8) |
(uint16_t)dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 3 + i];
conn->mss = tmp16 > TCP_MSS ? TCP_MSS : tmp16;
tmp16 = ((uint16_t)dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + 2 + i] << 8) |
(uint16_t)dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + 3 + i];
conn->mss = tmp16 > TCP_MSS(dev) ? TCP_MSS(dev) : tmp16;
/* And we are done processing options. */
@@ -251,7 +251,7 @@ void tcp_input(FAR struct net_driver_s *dev)
* can skip past them.
*/
if (dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i] == 0)
if (dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + 1 + i] == 0)
{
/* If the length field is zero, the options are malformed
* and we don't process them further.
@@ -259,7 +259,7 @@ void tcp_input(FAR struct net_driver_s *dev)
break;
}
i += dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i];
i += dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + 1 + i];
}
}
}
@@ -509,7 +509,7 @@ found:
{
for (i = 0; i < ((pbuf->tcpoffset >> 4) - 5) << 2 ;)
{
opt = dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + i];
opt = dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + i];
if (opt == TCP_OPT_END)
{
/* End of options. */
@@ -523,14 +523,14 @@ found:
++i;
}
else if (opt == TCP_OPT_MSS &&
dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i] == TCP_OPT_MSS_LEN)
dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + 1 + i] == TCP_OPT_MSS_LEN)
{
/* An MSS option with the right option length. */
tmp16 =
(dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 2 + i] << 8) |
dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 3 + i];
conn->mss = tmp16 > TCP_MSS ? TCP_MSS : tmp16;
(dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + 2 + i] << 8) |
dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + 3 + i];
conn->mss = tmp16 > TCP_MSS(dev) ? TCP_MSS(dev) : tmp16;
/* And we are done processing options. */
@@ -542,7 +542,7 @@ found:
* easily can skip past them.
*/
if (dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i] == 0)
if (dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + 1 + i] == 0)
{
/* If the length field is zero, the options are
* malformed and we don't process them further.
@@ -550,7 +550,7 @@ found:
break;
}
i += dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i];
i += dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev) + 1 + i];
}
}
}
@@ -692,8 +692,8 @@ found:
* When the application is called, the d_len field
* contains the length of the incoming data. The application can
* access the incoming data through the global pointer
* d_appdata, which usually points IPTCP_HDRLEN + NET_LL_HDRLEN
* bytes into the d_buf array.
* d_appdata, which usually points IPTCP_HDRLEN + NET_LL_HDRLEN(dev)
* bytes into the d_buf array.
*
* If the application wishes to send any data, this data should be
* put into the d_appdata and the length of the data should be
+2 -2
View File
@@ -103,8 +103,8 @@ void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn)
{
/* Set up for the callback */
dev->d_snddata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
dev->d_appdata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
dev->d_snddata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev)];
dev->d_appdata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev)];
dev->d_len = 0;
dev->d_sndlen = 0;
+3 -3
View File
@@ -62,7 +62,7 @@
* Pre-processor Definitions
****************************************************************************/
#define BUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define BUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Public Variables
@@ -360,8 +360,8 @@ void tcp_ack(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
pbuf->optdata[0] = TCP_OPT_MSS;
pbuf->optdata[1] = TCP_OPT_MSS_LEN;
pbuf->optdata[2] = (TCP_MSS) / 256;
pbuf->optdata[3] = (TCP_MSS) & 255;
pbuf->optdata[2] = TCP_MSS(dev) / 256;
pbuf->optdata[3] = TCP_MSS(dev) & 255;
dev->d_len = IPTCP_HDRLEN + TCP_OPT_MSS_LEN;
pbuf->tcpoffset = ((TCP_HDRLEN + TCP_OPT_MSS_LEN) / 4) << 4;
+1 -1
View File
@@ -79,7 +79,7 @@
* Pre-processor Definitions
****************************************************************************/
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/* Debug */
+1 -1
View File
@@ -71,7 +71,7 @@
# define CONFIG_NET_TCP_SPLIT_SIZE 40
#endif
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Private Types
+2 -2
View File
@@ -100,8 +100,8 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
{
uint8_t result;
dev->d_snddata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
dev->d_appdata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
dev->d_snddata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev)];
dev->d_appdata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN(dev)];
/* Increase the TCP sequence number */
+4 -4
View File
@@ -60,7 +60,7 @@
* Pre-processor Definitions
****************************************************************************/
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Public Variables
@@ -114,7 +114,7 @@ int udp_input(FAR struct net_driver_s *dev)
dev->d_len -= IPUDP_HDRLEN;
#ifdef CONFIG_NET_UDP_CHECKSUMS
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPUDP_HDRLEN];
if (pbuf->udpchksum != 0 && udp_chksum(dev) != 0xffff)
{
#ifdef CONFIG_NET_STATISTICS
@@ -136,8 +136,8 @@ int udp_input(FAR struct net_driver_s *dev)
/* Set-up for the application callback */
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPUDP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPUDP_HDRLEN];
dev->d_sndlen = 0;
/* Perform the application callback */
+2 -2
View File
@@ -100,8 +100,8 @@ void udp_poll(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn)
{
/* Set-up for the application callback */
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPUDP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPUDP_HDRLEN];
dev->d_len = 0;
dev->d_sndlen = 0;
+1 -1
View File
@@ -62,7 +62,7 @@
* Pre-processor Definitions
****************************************************************************/
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Public Variables
+4 -4
View File
@@ -54,8 +54,8 @@
* Pre-processor Definitions
****************************************************************************/
#define BUF ((struct net_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define BUF ((struct net_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
/****************************************************************************
* Private Data
@@ -145,7 +145,7 @@ static uint16_t upper_layer_chksum(FAR struct net_driver_s *dev, uint8_t proto)
/* Sum TCP header and data. */
sum = chksum(sum, &dev->d_buf[IP_HDRLEN + NET_LL_HDRLEN], upper_layer_len);
sum = chksum(sum, &dev->d_buf[IP_HDRLEN + NET_LL_HDRLEN(dev)], upper_layer_len);
return (sum == 0) ? 0xffff : htons(sum);
}
@@ -285,7 +285,7 @@ uint16_t ip_chksum(FAR struct net_driver_s *dev)
{
uint16_t sum;
sum = chksum(0, &dev->d_buf[NET_LL_HDRLEN], IP_HDRLEN);
sum = chksum(0, &dev->d_buf[NET_LL_HDRLEN(dev)], IP_HDRLEN);
return (sum == 0) ? 0xffff : htons(sum);
}
#endif /* CONFIG_NET_ARCH_CHKSUM */