NET: Standardize naming of all protocal header lengths

This commit is contained in:
Gregory Nutt
2014-07-05 13:04:48 -06:00
parent c2fc299332
commit c5fc24e110
38 changed files with 127 additions and 128 deletions
+2 -2
View File
@@ -515,7 +515,7 @@ static int tiva_transmit(struct tiva_driver_s *priv)
pktlen = priv->ld_dev.d_len; pktlen = priv->ld_dev.d_len;
nllvdbg("Sending packet, pktlen: %d\n", pktlen); nllvdbg("Sending packet, pktlen: %d\n", pktlen);
DEBUGASSERT(pktlen > NET_LLH_LEN); DEBUGASSERT(pktlen > NET_LL_HDRLEN);
dbuf = priv->ld_dev.d_buf; dbuf = priv->ld_dev.d_buf;
regval = (uint32_t)(pktlen - 14); regval = (uint32_t)(pktlen - 14);
@@ -677,7 +677,7 @@ static void tiva_receive(struct tiva_driver_s *priv)
* and 4 byte FCS that are not copied into the uIP packet. * and 4 byte FCS that are not copied into the uIP packet.
*/ */
if (pktlen > (CONFIG_NET_BUFSIZE + 6) || pktlen <= (NET_LLH_LEN + 6)) if (pktlen > (CONFIG_NET_BUFSIZE + 6) || pktlen <= (NET_LL_HDRLEN + 6))
{ {
int wordlen; int wordlen;
+1 -1
View File
@@ -155,7 +155,7 @@ void netdriver_loop(void)
* MAC address * MAC address
*/ */
if (g_sim_dev.d_len > NET_LLH_LEN && up_comparemac(BUF->ether_dhost, &g_sim_dev.d_mac) == 0) if (g_sim_dev.d_len > NET_LL_HDRLEN && up_comparemac(BUF->ether_dhost, &g_sim_dev.d_mac) == 0)
{ {
/* We only accept IP packets of the configured type and ARP packets */ /* We only accept IP packets of the configured type and ARP packets */
+1 -1
View File
@@ -963,7 +963,7 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
/* Also check if the packet is a valid size for the uIP configuration */ /* Also check if the packet is a valid size for the uIP configuration */
else if (rx.desc.rx_len < NET_LLH_LEN || rx.desc.rx_len > (CONFIG_NET_BUFSIZE + 2)) else if (rx.desc.rx_len < NET_LL_HDRLEN || rx.desc.rx_len > (CONFIG_NET_BUFSIZE + 2))
{ {
#if defined(CONFIG_DM9X_STATS) #if defined(CONFIG_DM9X_STATS)
dm9x->dm_nrxlengtherrors++; dm9x->dm_nrxlengtherrors++;
+1 -1
View File
@@ -1483,7 +1483,7 @@ static void enc_pktif(FAR struct enc_driver_s *priv)
/* Check for a usable packet length (4 added for the CRC) */ /* Check for a usable packet length (4 added for the CRC) */
else if (pktlen > (CONFIG_NET_BUFSIZE + 4) || pktlen <= (NET_LLH_LEN + 4)) else if (pktlen > (CONFIG_NET_BUFSIZE + 4) || pktlen <= (NET_LL_HDRLEN + 4))
{ {
nlldbg("Bad packet size dropped (%d)\n", pktlen); nlldbg("Bad packet size dropped (%d)\n", pktlen);
#ifdef CONFIG_ENC28J60_STATS #ifdef CONFIG_ENC28J60_STATS
+1 -1
View File
@@ -1650,7 +1650,7 @@ static void enc_pktif(FAR struct enc_driver_s *priv)
/* Check for a usable packet length (4 added for the CRC) */ /* Check for a usable packet length (4 added for the CRC) */
else if (pktlen > (CONFIG_NET_BUFSIZE + 4) || pktlen <= (NET_LLH_LEN + 4)) else if (pktlen > (CONFIG_NET_BUFSIZE + 4) || pktlen <= (NET_LL_HDRLEN + 4))
{ {
nlldbg("Bad packet size dropped (%d)\n", pktlen); nlldbg("Bad packet size dropped (%d)\n", pktlen);
+3 -3
View File
@@ -73,8 +73,8 @@
/* Configuration ************************************************************/ /* Configuration ************************************************************/
#if NET_LLH_LEN > 0 #if NET_LL_HDRLEN > 0
# error "NET_LLH_LEN must be set to zero" # error "NET_LL_HDRLEN must be set to zero"
#endif #endif
#ifndef CONFIG_NET_NOINTS #ifndef CONFIG_NET_NOINTS
@@ -708,7 +708,7 @@ static int slip_rxtask(int argc, char *argv[])
* enough to hold an IP header. * enough to hold an IP header.
*/ */
if (priv->rxlen >= IPHDR_LEN) if (priv->rxlen >= IP_HDRLEN)
{ {
/* Handle the IP input. Get exclusive access to uIP. */ /* Handle the IP input. Get exclusive access to uIP. */
+1 -1
View File
@@ -67,7 +67,7 @@
/* Size of the Ethernet header */ /* Size of the Ethernet header */
#define ETHHDR_LEN 14 /* Minimum size: 2*6 + 2 */ #define ETH_HDRLEN 14 /* Minimum size: 2*6 + 2 */
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
+2 -2
View File
@@ -103,8 +103,8 @@
/* Header sizes */ /* Header sizes */
#define UIP_ICMPH_LEN 4 /* Size of ICMP header */ #define ICMP_HDRLEN 4 /* Size of ICMP header */
#define UIP_IPICMPH_LEN (UIP_ICMPH_LEN + IPHDR_LEN) /* Size of IP + ICMP header */ #define IPICMP_HDRLEN (ICMP_HDRLEN + IP_HDRLEN) /* Size of IP + ICMP header */
/**************************************************************************** /****************************************************************************
* Public Type Definitions * Public Type Definitions
+4 -4
View File
@@ -78,12 +78,12 @@
/* Header sizes: /* Header sizes:
* *
* UIP_IGMPH_LEN - Size of IGMP header in bytes * IGMP_HDRLEN - Size of IGMP header in bytes
* UIP_IPIGMPH_LEN - Size of IP + Size of IGMP header + Size of router alert * IPIGMP_HDRLEN - Size of IP + Size of IGMP header + Size of router alert
*/ */
#define UIP_IGMPH_LEN 8 #define IGMP_HDRLEN 8
#define UIP_IPIGMPH_LEN (UIP_IGMPH_LEN + IPHDR_LEN + 4) #define IPIGMP_HDRLEN (IGMP_HDRLEN + IP_HDRLEN + 4)
/* Group flags */ /* Group flags */
+2 -2
View File
@@ -73,9 +73,9 @@
/* Header sizes */ /* Header sizes */
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
# define IPHDR_LEN 40 /* Size of IP header */ # define IP_HDRLEN 40 /* Size of IP header */
#else #else
# define IPHDR_LEN 20 /* Size of IP header */ # define IP_HDRLEN 20 /* Size of IP header */
#endif #endif
/**************************************************************************** /****************************************************************************
+6 -6
View File
@@ -89,11 +89,11 @@
# ifdef CONFIG_NET_IPv6 # ifdef CONFIG_NET_IPv6
# error "SLIP is not implemented for IPv6" # error "SLIP is not implemented for IPv6"
# endif # endif
# define NET_LLH_LEN 0 # define NET_LL_HDRLEN 0
#else #else
# define CONFIG_NET_ETHERNET 1 # define CONFIG_NET_ETHERNET 1
# define CONFIG_NET_ARP 1 # define CONFIG_NET_ARP 1
# define NET_LLH_LEN 14 # define NET_LL_HDRLEN 14
#endif #endif
/* Layer 3/4 Configuration Options ******************************************/ /* Layer 3/4 Configuration Options ******************************************/
@@ -158,10 +158,10 @@
#endif #endif
/* The UDP maximum packet size. This is should not be to set to more /* The UDP maximum packet size. This is should not be to set to more
* than CONFIG_NET_BUFSIZE - NET_LLH_LEN - UIP_IPUDPH_LEN. * than CONFIG_NET_BUFSIZE - NET_LL_HDRLEN - IPUDP_HDRLEN.
*/ */
#define UDP_MSS (CONFIG_NET_BUFSIZE - NET_LLH_LEN - UIP_IPUDPH_LEN) #define UDP_MSS (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN - IPUDP_HDRLEN)
/* TCP configuration options */ /* TCP configuration options */
@@ -223,10 +223,10 @@
#define UIP_MAXSYNRTX 5 #define UIP_MAXSYNRTX 5
/* The TCP maximum segment size. This is should not be set to more /* The TCP maximum segment size. This is should not be set to more
* than CONFIG_NET_BUFSIZE - NET_LLH_LEN - UIP_TCPIP_HLEN. * than CONFIG_NET_BUFSIZE - NET_LL_HDRLEN - IPTCP_HDRLEN.
*/ */
#define TCP_MSS (CONFIG_NET_BUFSIZE - NET_LLH_LEN - UIP_TCPIP_HLEN) #define TCP_MSS (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN - IPTCP_HDRLEN)
/* The size of the advertised receiver's window. /* The size of the advertised receiver's window.
* *
+1 -1
View File
@@ -112,7 +112,7 @@ struct net_driver_s
* driver should place incoming data into this buffer. When sending data, * driver should place incoming data into this buffer. When sending data,
* the device driver should read the link level headers and the TCP/IP * 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 * headers from this buffer. The size of the link level headers is
* configured by the NET_LLH_LEN define. * configured by the NET_LL_HDRLEN define.
* *
* uIP will handle only a single buffer for both incoming and outgoing * uIP will handle only a single buffer for both incoming and outgoing
* packets. However, the drive design may be concurrently send and * packets. However, the drive design may be concurrently send and
+4 -5
View File
@@ -104,9 +104,8 @@
/* TCP header sizes */ /* TCP header sizes */
#define UIP_TCPH_LEN 20 /* Size of TCP header */ #define TCP_HDRLEN 20 /* Size of TCP header */
#define UIP_IPTCPH_LEN (UIP_TCPH_LEN + IPHDR_LEN) /* Size of IP + TCP header */ #define IPTCP_HDRLEN (TCP_HDRLEN + IP_HDRLEN) /* Size of IP + TCP header */
#define UIP_TCPIP_HLEN UIP_IPTCPH_LEN
/* Initial minimum MSS according to RFC 879 /* Initial minimum MSS according to RFC 879
* *
@@ -121,9 +120,9 @@
*/ */
#if TCP_MSS > 576 #if TCP_MSS > 576
# define UIP_TCP_INITIAL_MSS 576 # define TCP_INITIAL_MSS 576
#else #else
# define UIP_TCP_INITIAL_MSS TCP_MSS # define TCP_INITIAL_MSS TCP_MSS
#endif #endif
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS #ifdef CONFIG_NET_TCP_WRITE_BUFFERS
+2 -2
View File
@@ -62,8 +62,8 @@
/* Header sizes */ /* Header sizes */
#define UIP_UDPH_LEN 8 /* Size of UDP header */ #define UDP_HDRLEN 8 /* Size of UDP header */
#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + IPHDR_LEN) /* Size of IP + UDP header */ #define IPUDP_HDRLEN (UDP_HDRLEN + IP_HDRLEN) /* Size of IP + UDP header */
/**************************************************************************** /****************************************************************************
* Public Type Definitions * Public Type Definitions
+6 -6
View File
@@ -86,8 +86,8 @@
#define RASIZE 4 /* Size of ROUTER ALERT */ #define RASIZE 4 /* Size of ROUTER ALERT */
#define ETHBUF ((struct eth_hdr_s *)&dev->d_buf[0]) #define ETHBUF ((struct eth_hdr_s *)&dev->d_buf[0])
#define ARPBUF ((struct arp_hdr_s *)&dev->d_buf[NET_LLH_LEN]) #define ARPBUF ((struct arp_hdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define IPBUF ((struct arp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define IPBUF ((struct arp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
@@ -239,7 +239,7 @@ void arp_arpin(struct net_driver_s *dev)
struct arp_hdr_s *parp = ARPBUF; struct arp_hdr_s *parp = ARPBUF;
in_addr_t ipaddr; in_addr_t ipaddr;
if (dev->d_len < (sizeof(struct arp_hdr_s) + NET_LLH_LEN)) if (dev->d_len < (sizeof(struct arp_hdr_s) + NET_LL_HDRLEN))
{ {
nlldbg("Too small\n"); nlldbg("Too small\n");
dev->d_len = 0; dev->d_len = 0;
@@ -279,7 +279,7 @@ void arp_arpin(struct net_driver_s *dev)
arp_dump(parp); arp_dump(parp);
peth->type = HTONS(ETHTYPE_ARP); peth->type = HTONS(ETHTYPE_ARP);
dev->d_len = sizeof(struct arp_hdr_s) + NET_LLH_LEN; dev->d_len = sizeof(struct arp_hdr_s) + NET_LL_HDRLEN;
} }
break; break;
@@ -440,7 +440,7 @@ void arp_out(struct net_driver_s *dev)
arp_dump(parp); arp_dump(parp);
peth->type = HTONS(ETHTYPE_ARP); peth->type = HTONS(ETHTYPE_ARP);
dev->d_len = sizeof(struct arp_hdr_s) + NET_LLH_LEN; dev->d_len = sizeof(struct arp_hdr_s) + NET_LL_HDRLEN;
return; return;
} }
@@ -453,7 +453,7 @@ void arp_out(struct net_driver_s *dev)
memcpy(peth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(peth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN);
peth->type = HTONS(ETHTYPE_IP); peth->type = HTONS(ETHTYPE_IP);
dev->d_len += NET_LLH_LEN; dev->d_len += NET_LL_HDRLEN;
} }
#endif /* CONFIG_NET_ARP */ #endif /* CONFIG_NET_ARP */
+5 -5
View File
@@ -107,13 +107,13 @@
/* Macros. */ /* Macros. */
#define BUF ((FAR struct net_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define BUF ((FAR struct net_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define FBUF ((FAR struct net_iphdr_s *)&g_reassembly_buffer[0]) #define FBUF ((FAR struct net_iphdr_s *)&g_reassembly_buffer[0])
/* IP fragment re-assembly */ /* IP fragment re-assembly */
#define IP_MF 0x20 #define IP_MF 0x20
#define UIP_REASS_BUFSIZE (CONFIG_NET_BUFSIZE - NET_LLH_LEN) #define UIP_REASS_BUFSIZE (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN)
#define UIP_REASS_FLAG_LASTFRAG 0x01 #define UIP_REASS_FLAG_LASTFRAG 0x01
/**************************************************************************** /****************************************************************************
@@ -162,7 +162,7 @@ static uint8_t devif_reassembly(void)
if (!g_reassembly_timer) if (!g_reassembly_timer)
{ {
memcpy(g_reassembly_buffer, &pbuf->vhl, IPHDR_LEN); memcpy(g_reassembly_buffer, &pbuf->vhl, IP_HDRLEN);
g_reassembly_timer = UIP_REASS_MAXAGE; g_reassembly_timer = UIP_REASS_MAXAGE;
g_reassembly_flags = 0; g_reassembly_flags = 0;
@@ -195,7 +195,7 @@ static uint8_t devif_reassembly(void)
/* Copy the fragment into the reassembly buffer, at the right offset. */ /* Copy the fragment into the reassembly buffer, at the right offset. */
memcpy(&g_reassembly_buffer[IPHDR_LEN + offset], (char *)pbuf + (int)((pbuf->vhl & 0x0f) * 4), len); memcpy(&g_reassembly_buffer[IP_HDRLEN + offset], (char *)pbuf + (int)((pbuf->vhl & 0x0f) * 4), len);
/* Update the bitmap. */ /* Update the bitmap. */
@@ -367,7 +367,7 @@ int devif_input(FAR struct net_driver_s *dev)
* the size of the IPv6 header (40 bytes). * the size of the IPv6 header (40 bytes).
*/ */
iplen = (pbuf->len[0] << 8) + pbuf->len[1] + IPHDR_LEN; iplen = (pbuf->len[0] << 8) + pbuf->len[1] + IP_HDRLEN;
#else #else
iplen = (pbuf->len[0] << 8) + pbuf->len[1]; iplen = (pbuf->len[0] << 8) + pbuf->len[1];
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 */
+2 -2
View File
@@ -66,7 +66,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Public Variables * Public Variables
@@ -151,7 +151,7 @@ void icmp_input(FAR struct net_driver_s *dev)
/* The slow way... sum over the ICMP message */ /* The slow way... sum over the ICMP message */
picmp->icmpchksum = 0; picmp->icmpchksum = 0;
picmp->icmpchksum = ~icmp_chksum(dev, (((uint16_t)picmp->len[0] << 8) | (uint16_t)picmp->len[1]) - IPHDR_LEN); picmp->icmpchksum = ~icmp_chksum(dev, (((uint16_t)picmp->len[0] << 8) | (uint16_t)picmp->len[1]) - IP_HDRLEN);
if (picmp->icmpchksum == 0) if (picmp->icmpchksum == 0)
{ {
picmp->icmpchksum = 0xffff; picmp->icmpchksum = 0xffff;
+2 -2
View File
@@ -64,8 +64,8 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define ICMPDAT (&dev->d_buf[NET_LLH_LEN + sizeof(struct icmp_iphdr_s)]) #define ICMPDAT (&dev->d_buf[NET_LL_HDRLEN + sizeof(struct icmp_iphdr_s)])
/* Allocate a new ICMP data callback */ /* 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 */ /* Setup for the application callback */
dev->d_appdata = &dev->d_buf[NET_LLH_LEN + UIP_IPICMPH_LEN]; dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPICMP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LLH_LEN + UIP_IPICMPH_LEN]; dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN + IPICMP_HDRLEN];
dev->d_len = 0; dev->d_len = 0;
dev->d_sndlen = 0; dev->d_sndlen = 0;
+3 -3
View File
@@ -57,7 +57,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Public Variables * Public Variables
@@ -102,13 +102,13 @@ void icmp_send(FAR struct net_driver_s *dev, FAR net_ipaddr_t *destaddr)
* the IP and ICMP headers (and, eventually, the Ethernet header) * the IP and ICMP headers (and, eventually, the Ethernet header)
*/ */
dev->d_len = dev->d_sndlen + UIP_IPICMPH_LEN; dev->d_len = dev->d_sndlen + IPICMP_HDRLEN;
/* The total size of the data (for ICMP checksum calculation) includes /* The total size of the data (for ICMP checksum calculation) includes
* the size of the ICMP header * the size of the ICMP header
*/ */
dev->d_sndlen += UIP_ICMPH_LEN; dev->d_sndlen += ICMP_HDRLEN;
/* Initialize the IP header. Note that for IPv6, the IP length field /* Initialize the IP header. Note that for IPv6, the IP length field
* does not include the IPv6 IP header length. * does not include the IPv6 IP header length.
+3 -3
View File
@@ -61,7 +61,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define IGMPBUF ((struct igmp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define IGMPBUF ((struct igmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
@@ -124,7 +124,7 @@ void igmp_input(struct net_driver_s *dev)
/* Verify the message length */ /* Verify the message length */
if (dev->d_len < NET_LLH_LEN+UIP_IPIGMPH_LEN) if (dev->d_len < NET_LL_HDRLEN+IPIGMP_HDRLEN)
{ {
IGMP_STATINCR(g_netstats.igmp.length_errors); IGMP_STATINCR(g_netstats.igmp.length_errors);
nlldbg("Length error\n"); nlldbg("Length error\n");
@@ -133,7 +133,7 @@ void igmp_input(struct net_driver_s *dev)
/* Calculate and check the IGMP checksum */ /* Calculate and check the IGMP checksum */
if (net_chksum((uint16_t*)&IGMPBUF->type, UIP_IGMPH_LEN) != 0) if (net_chksum((uint16_t*)&IGMPBUF->type, IGMP_HDRLEN) != 0)
{ {
IGMP_STATINCR(g_netstats.igmp.chksum_errors); IGMP_STATINCR(g_netstats.igmp.chksum_errors);
nlldbg("Checksum error\n"); nlldbg("Checksum error\n");
+2 -2
View File
@@ -151,8 +151,8 @@ void igmp_poll(FAR struct net_driver_s *dev)
/* Setup the poll operation */ /* Setup the poll operation */
dev->d_appdata = &dev->d_buf[NET_LLH_LEN + UIP_IPIGMPH_LEN]; dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPIGMP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LLH_LEN + UIP_IPIGMPH_LEN]; dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN + IPIGMP_HDRLEN];
dev->d_len = 0; dev->d_len = 0;
dev->d_sndlen = 0; dev->d_sndlen = 0;
+6 -6
View File
@@ -75,7 +75,7 @@
/* Buffer layout */ /* Buffer layout */
#define RASIZE (4) #define RASIZE (4)
#define IGMPBUF ((struct igmp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define IGMPBUF ((struct igmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Public Variables * Public Variables
@@ -129,11 +129,11 @@ void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group,
* bytes for the ROUTER ALERT (and, eventually, the Ethernet header) * bytes for the ROUTER ALERT (and, eventually, the Ethernet header)
*/ */
dev->d_len = UIP_IPIGMPH_LEN; dev->d_len = IPIGMP_HDRLEN;
/* The total size of the data is the size of the IGMP header */ /* The total size of the data is the size of the IGMP header */
dev->d_sndlen = UIP_IGMPH_LEN; dev->d_sndlen = IGMP_HDRLEN;
/* Add the router alert option */ /* Add the router alert option */
@@ -160,7 +160,7 @@ void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group,
/* Calculate IP checksum. */ /* Calculate IP checksum. */
IGMPBUF->ipchksum = 0; IGMPBUF->ipchksum = 0;
IGMPBUF->ipchksum = ~igmp_chksum((FAR uint8_t *)IGMPBUF, IPHDR_LEN + RASIZE); IGMPBUF->ipchksum = ~igmp_chksum((FAR uint8_t *)IGMPBUF, IP_HDRLEN + RASIZE);
/* Set up the IGMP message */ /* Set up the IGMP message */
@@ -171,14 +171,14 @@ void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group,
/* Calculate the IGMP checksum. */ /* Calculate the IGMP checksum. */
IGMPBUF->chksum = 0; IGMPBUF->chksum = 0;
IGMPBUF->chksum = ~igmp_chksum(&IGMPBUF->type, UIP_IPIGMPH_LEN); IGMPBUF->chksum = ~igmp_chksum(&IGMPBUF->type, IPIGMP_HDRLEN);
IGMP_STATINCR(g_netstats.igmp.poll_send); IGMP_STATINCR(g_netstats.igmp.poll_send);
IGMP_STATINCR(g_netstats.ip.sent); IGMP_STATINCR(g_netstats.ip.sent);
nllvdbg("Outgoing IGMP packet length: %d (%d)\n", nllvdbg("Outgoing IGMP packet length: %d (%d)\n",
dev->d_len, (IGMPBUF->len[0] << 8) | IGMPBUF->len[1]); dev->d_len, (IGMPBUF->len[0] << 8) | IGMPBUF->len[1]);
igmp_dumppkt(RA, UIP_IPIGMPH_LEN + RASIZE); igmp_dumppkt(RA, IPIGMP_HDRLEN + RASIZE);
} }
#endif /* CONFIG_NET_IGMP */ #endif /* CONFIG_NET_IGMP */
+2 -2
View File
@@ -103,8 +103,8 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn)
{ {
/* Setup for the application callback */ /* Setup for the application callback */
dev->d_appdata = &dev->d_buf[NET_LLH_LEN + UIP_IPUDPH_LEN]; dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LLH_LEN + UIP_IPUDPH_LEN]; dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_len = 0; dev->d_len = 0;
dev->d_sndlen = 0; dev->d_sndlen = 0;
+1 -1
View File
@@ -77,7 +77,7 @@
# define CONFIG_NET_TCP_SPLIT_SIZE 40 # define CONFIG_NET_TCP_SPLIT_SIZE 40
#endif #endif
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
+2 -2
View File
@@ -75,8 +75,8 @@
* Definitions * Definitions
****************************************************************************/ ****************************************************************************/
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
+4 -4
View File
@@ -112,7 +112,7 @@ void tcp_appsend(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
conn->tcpstateflags = UIP_CLOSED; conn->tcpstateflags = UIP_CLOSED;
nllvdbg("TCP state: UIP_CLOSED\n"); nllvdbg("TCP state: UIP_CLOSED\n");
tcp_send(dev, conn, TCP_RST | TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_RST | TCP_ACK, IPTCP_HDRLEN);
} }
/* Check for connection closed */ /* Check for connection closed */
@@ -125,7 +125,7 @@ void tcp_appsend(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
nllvdbg("TCP state: UIP_FIN_WAIT_1\n"); nllvdbg("TCP state: UIP_FIN_WAIT_1\n");
dev->d_sndlen = 0; dev->d_sndlen = 0;
tcp_send(dev, conn, TCP_FIN | TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_FIN | TCP_ACK, IPTCP_HDRLEN);
} }
/* None of the above */ /* None of the above */
@@ -204,14 +204,14 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
* the IP and TCP headers. * the IP and TCP headers.
*/ */
tcp_send(dev, conn, TCP_ACK | TCP_PSH, dev->d_sndlen + UIP_TCPIP_HLEN); tcp_send(dev, conn, TCP_ACK | TCP_PSH, dev->d_sndlen + IPTCP_HDRLEN);
} }
/* If there is no data to send, just send out a pure ACK if one is requested`. */ /* If there is no data to send, just send out a pure ACK if one is requested`. */
else if ((result & UIP_SNDACK) != 0) else if ((result & UIP_SNDACK) != 0)
{ {
tcp_send(dev, conn, TCP_ACK, UIP_TCPIP_HLEN); tcp_send(dev, conn, TCP_ACK, IPTCP_HDRLEN);
} }
/* There is nothing to do -- drop the packet */ /* There is nothing to do -- drop the packet */
+2 -2
View File
@@ -522,7 +522,7 @@ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct tcp_iphdr_s *buf)
conn->nrtx = 0; conn->nrtx = 0;
conn->lport = buf->destport; conn->lport = buf->destport;
conn->rport = buf->srcport; conn->rport = buf->srcport;
conn->mss = UIP_TCP_INITIAL_MSS; conn->mss = TCP_INITIAL_MSS;
net_ipaddr_copy(conn->ripaddr, net_ip4addr_conv32(buf->srcipaddr)); net_ipaddr_copy(conn->ripaddr, net_ip4addr_conv32(buf->srcipaddr));
conn->tcpstateflags = UIP_SYN_RCVD; conn->tcpstateflags = UIP_SYN_RCVD;
@@ -675,7 +675,7 @@ int tcp_connect(FAR struct tcp_conn_s *conn,
conn->tcpstateflags = UIP_SYN_SENT; conn->tcpstateflags = UIP_SYN_SENT;
tcp_initsequence(conn->sndseq); tcp_initsequence(conn->sndseq);
conn->mss = UIP_TCP_INITIAL_MSS; conn->mss = TCP_INITIAL_MSS;
conn->unacked = 1; /* TCP length of the SYN is one. */ conn->unacked = 1; /* TCP length of the SYN is one. */
conn->nrtx = 0; conn->nrtx = 0;
conn->timer = 1; /* Send the SYN next time around. */ conn->timer = 1; /* Send the SYN next time around. */
+24 -24
View File
@@ -64,7 +64,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define BUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define BUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Public Variables * Public Variables
@@ -110,8 +110,8 @@ void tcp_input(struct net_driver_s *dev)
int len; int len;
int i; int i;
dev->d_snddata = &dev->d_buf[UIP_IPTCPH_LEN + NET_LLH_LEN]; dev->d_snddata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
dev->d_appdata = &dev->d_buf[UIP_IPTCPH_LEN + NET_LLH_LEN]; dev->d_appdata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
g_netstats.tcp.recv++; g_netstats.tcp.recv++;
@@ -219,7 +219,7 @@ void tcp_input(struct net_driver_s *dev)
{ {
for (i = 0; i < ((pbuf->tcpoffset >> 4) - 5) << 2 ;) for (i = 0; i < ((pbuf->tcpoffset >> 4) - 5) << 2 ;)
{ {
opt = dev->d_buf[UIP_TCPIP_HLEN + NET_LLH_LEN + i]; opt = dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + i];
if (opt == TCP_OPT_END) if (opt == TCP_OPT_END)
{ {
/* End of options. */ /* End of options. */
@@ -233,12 +233,12 @@ void tcp_input(struct net_driver_s *dev)
++i; ++i;
} }
else if (opt == TCP_OPT_MSS && else if (opt == TCP_OPT_MSS &&
dev->d_buf[UIP_TCPIP_HLEN + NET_LLH_LEN + 1 + i] == TCP_OPT_MSS_LEN) dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i] == TCP_OPT_MSS_LEN)
{ {
/* An MSS option with the right option length. */ /* An MSS option with the right option length. */
tmp16 = ((uint16_t)dev->d_buf[UIP_TCPIP_HLEN + NET_LLH_LEN + 2 + i] << 8) | tmp16 = ((uint16_t)dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 2 + i] << 8) |
(uint16_t)dev->d_buf[UIP_IPTCPH_LEN + NET_LLH_LEN + 3 + i]; (uint16_t)dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 3 + i];
conn->mss = tmp16 > TCP_MSS ? TCP_MSS : tmp16; conn->mss = tmp16 > TCP_MSS ? TCP_MSS : tmp16;
/* And we are done processing options. */ /* And we are done processing options. */
@@ -251,7 +251,7 @@ void tcp_input(struct net_driver_s *dev)
* can skip past them. * can skip past them.
*/ */
if (dev->d_buf[UIP_TCPIP_HLEN + NET_LLH_LEN + 1 + i] == 0) if (dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i] == 0)
{ {
/* If the length field is zero, the options are malformed /* If the length field is zero, the options are malformed
* and we don't process them further. * and we don't process them further.
@@ -259,7 +259,7 @@ void tcp_input(struct net_driver_s *dev)
break; break;
} }
i += dev->d_buf[UIP_TCPIP_HLEN + NET_LLH_LEN + 1 + i]; i += dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i];
} }
} }
} }
@@ -324,7 +324,7 @@ found:
* len) and the length of the IP header (20 bytes). * len) and the length of the IP header (20 bytes).
*/ */
dev->d_len -= (len + IPHDR_LEN); dev->d_len -= (len + IP_HDRLEN);
/* First, check if the sequence number of the incoming packet is /* First, check if the sequence number of the incoming packet is
* what we're expecting next. If not, we send out an ACK with the * what we're expecting next. If not, we send out an ACK with the
@@ -341,7 +341,7 @@ found:
if ((dev->d_len > 0 || ((pbuf->flags & (TCP_SYN | TCP_FIN)) != 0)) && if ((dev->d_len > 0 || ((pbuf->flags & (TCP_SYN | TCP_FIN)) != 0)) &&
memcmp(pbuf->seqno, conn->rcvseq, 4) != 0) memcmp(pbuf->seqno, conn->rcvseq, 4) != 0)
{ {
tcp_send(dev, conn, TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_ACK, IPTCP_HDRLEN);
return; return;
} }
} }
@@ -509,7 +509,7 @@ found:
{ {
for (i = 0; i < ((pbuf->tcpoffset >> 4) - 5) << 2 ;) for (i = 0; i < ((pbuf->tcpoffset >> 4) - 5) << 2 ;)
{ {
opt = dev->d_buf[UIP_IPTCPH_LEN + NET_LLH_LEN + i]; opt = dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + i];
if (opt == TCP_OPT_END) if (opt == TCP_OPT_END)
{ {
/* End of options. */ /* End of options. */
@@ -523,13 +523,13 @@ found:
++i; ++i;
} }
else if (opt == TCP_OPT_MSS && else if (opt == TCP_OPT_MSS &&
dev->d_buf[UIP_TCPIP_HLEN + NET_LLH_LEN + 1 + i] == TCP_OPT_MSS_LEN) dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i] == TCP_OPT_MSS_LEN)
{ {
/* An MSS option with the right option length. */ /* An MSS option with the right option length. */
tmp16 = tmp16 =
(dev->d_buf[UIP_TCPIP_HLEN + NET_LLH_LEN + 2 + i] << 8) | (dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 2 + i] << 8) |
dev->d_buf[UIP_TCPIP_HLEN + NET_LLH_LEN + 3 + i]; dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 3 + i];
conn->mss = tmp16 > TCP_MSS ? TCP_MSS : tmp16; conn->mss = tmp16 > TCP_MSS ? TCP_MSS : tmp16;
/* And we are done processing options. */ /* And we are done processing options. */
@@ -542,7 +542,7 @@ found:
* easily can skip past them. * easily can skip past them.
*/ */
if (dev->d_buf[UIP_TCPIP_HLEN + NET_LLH_LEN + 1 + i] == 0) if (dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i] == 0)
{ {
/* If the length field is zero, the options are /* If the length field is zero, the options are
* malformed and we don't process them further. * malformed and we don't process them further.
@@ -550,7 +550,7 @@ found:
break; break;
} }
i += dev->d_buf[UIP_TCPIP_HLEN + NET_LLH_LEN + 1 + i]; i += dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN + 1 + i];
} }
} }
} }
@@ -639,7 +639,7 @@ found:
conn->nrtx = 0; conn->nrtx = 0;
nllvdbg("TCP state: UIP_LAST_ACK\n"); nllvdbg("TCP state: UIP_LAST_ACK\n");
tcp_send(dev, conn, TCP_FIN | TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_FIN | TCP_ACK, IPTCP_HDRLEN);
return; return;
} }
@@ -692,7 +692,7 @@ found:
* When the application is called, the d_len field * When the application is called, the d_len field
* contains the length of the incoming data. The application can * contains the length of the incoming data. The application can
* access the incoming data through the global pointer * access the incoming data through the global pointer
* d_appdata, which usually points UIP_IPTCPH_LEN + NET_LLH_LEN * d_appdata, which usually points IPTCP_HDRLEN + NET_LL_HDRLEN
* bytes into the d_buf array. * bytes into the d_buf array.
* *
* If the application wishes to send any data, this data should be * If the application wishes to send any data, this data should be
@@ -778,7 +778,7 @@ found:
net_incr32(conn->rcvseq, 1); net_incr32(conn->rcvseq, 1);
(void)tcp_callback(dev, conn, UIP_CLOSE); (void)tcp_callback(dev, conn, UIP_CLOSE);
tcp_send(dev, conn, TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_ACK, IPTCP_HDRLEN);
return; return;
} }
else if ((flags & UIP_ACKDATA) != 0) else if ((flags & UIP_ACKDATA) != 0)
@@ -791,7 +791,7 @@ found:
if (dev->d_len > 0) if (dev->d_len > 0)
{ {
tcp_send(dev, conn, TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_ACK, IPTCP_HDRLEN);
return; return;
} }
@@ -811,20 +811,20 @@ found:
net_incr32(conn->rcvseq, 1); net_incr32(conn->rcvseq, 1);
(void)tcp_callback(dev, conn, UIP_CLOSE); (void)tcp_callback(dev, conn, UIP_CLOSE);
tcp_send(dev, conn, TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_ACK, IPTCP_HDRLEN);
return; return;
} }
if (dev->d_len > 0) if (dev->d_len > 0)
{ {
tcp_send(dev, conn, TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_ACK, IPTCP_HDRLEN);
return; return;
} }
goto drop; goto drop;
case UIP_TIME_WAIT: case UIP_TIME_WAIT:
tcp_send(dev, conn, TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_ACK, IPTCP_HDRLEN);
return; return;
case UIP_CLOSING: case UIP_CLOSING:
+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 */ /* Set up for the callback */
dev->d_snddata = &dev->d_buf[UIP_IPTCPH_LEN + NET_LLH_LEN]; dev->d_snddata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
dev->d_appdata = &dev->d_buf[UIP_IPTCPH_LEN + NET_LLH_LEN]; dev->d_appdata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
dev->d_len = 0; dev->d_len = 0;
dev->d_sndlen = 0; dev->d_sndlen = 0;
+7 -7
View File
@@ -60,7 +60,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define BUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define BUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Public Variables * Public Variables
@@ -104,8 +104,8 @@ static void tcp_sendcomplete(FAR struct net_driver_s *dev)
* length. * length.
*/ */
pbuf->len[0] = ((dev->d_len - IPHDR_LEN) >> 8); pbuf->len[0] = ((dev->d_len - IP_HDRLEN) >> 8);
pbuf->len[1] = ((dev->d_len - IPHDR_LEN) & 0xff); pbuf->len[1] = ((dev->d_len - IP_HDRLEN) & 0xff);
#else /* CONFIG_NET_IPv6 */ #else /* CONFIG_NET_IPv6 */
@@ -241,7 +241,7 @@ void tcp_send(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
pbuf->flags = flags; pbuf->flags = flags;
dev->d_len = len; dev->d_len = len;
pbuf->tcpoffset = (UIP_TCPH_LEN / 4) << 4; pbuf->tcpoffset = (TCP_HDRLEN / 4) << 4;
tcp_sendcommon(dev, conn); tcp_sendcommon(dev, conn);
} }
@@ -273,7 +273,7 @@ void tcp_reset(FAR struct net_driver_s *dev)
#endif #endif
pbuf->flags = TCP_RST | TCP_ACK; pbuf->flags = TCP_RST | TCP_ACK;
dev->d_len = UIP_IPTCPH_LEN; dev->d_len = IPTCP_HDRLEN;
pbuf->tcpoffset = 5 << 4; pbuf->tcpoffset = 5 << 4;
/* Flip the seqno and ackno fields in the TCP header. */ /* Flip the seqno and ackno fields in the TCP header. */
@@ -360,8 +360,8 @@ void tcp_ack(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
pbuf->optdata[1] = TCP_OPT_MSS_LEN; pbuf->optdata[1] = TCP_OPT_MSS_LEN;
pbuf->optdata[2] = (TCP_MSS) / 256; pbuf->optdata[2] = (TCP_MSS) / 256;
pbuf->optdata[3] = (TCP_MSS) & 255; pbuf->optdata[3] = (TCP_MSS) & 255;
dev->d_len = UIP_IPTCPH_LEN + TCP_OPT_MSS_LEN; dev->d_len = IPTCP_HDRLEN + TCP_OPT_MSS_LEN;
pbuf->tcpoffset = ((UIP_TCPH_LEN + TCP_OPT_MSS_LEN) / 4) << 4; pbuf->tcpoffset = ((TCP_HDRLEN + TCP_OPT_MSS_LEN) / 4) << 4;
/* Complete the common portions of the TCP message */ /* Complete the common portions of the TCP message */
+1 -1
View File
@@ -78,7 +78,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/* Debug */ /* Debug */
+1 -1
View File
@@ -70,7 +70,7 @@
# define CONFIG_NET_TCP_SPLIT_SIZE 40 # define CONFIG_NET_TCP_SPLIT_SIZE 40
#endif #endif
#define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define TCPBUF ((struct tcp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
+4 -4
View File
@@ -100,8 +100,8 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
{ {
uint8_t result; uint8_t result;
dev->d_snddata = &dev->d_buf[UIP_IPTCPH_LEN + NET_LLH_LEN]; dev->d_snddata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
dev->d_appdata = &dev->d_buf[UIP_IPTCPH_LEN + NET_LLH_LEN]; dev->d_appdata = &dev->d_buf[IPTCP_HDRLEN + NET_LL_HDRLEN];
/* Increase the TCP sequence number */ /* Increase the TCP sequence number */
@@ -183,7 +183,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
/* We also send a reset packet to the remote host. */ /* We also send a reset packet to the remote host. */
tcp_send(dev, conn, TCP_RST | TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_RST | TCP_ACK, IPTCP_HDRLEN);
goto done; goto done;
} }
@@ -234,7 +234,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
case UIP_LAST_ACK: case UIP_LAST_ACK:
/* In all these states we should retransmit a FINACK. */ /* In all these states we should retransmit a FINACK. */
tcp_send(dev, conn, TCP_FIN | TCP_ACK, UIP_IPTCPH_LEN); tcp_send(dev, conn, TCP_FIN | TCP_ACK, IPTCP_HDRLEN);
goto done; goto done;
} }
} }
+5 -5
View File
@@ -60,7 +60,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Public Variables * Public Variables
@@ -112,9 +112,9 @@ int udp_input(FAR struct net_driver_s *dev)
* application sets d_sndlen, it has a packet to send. * application sets d_sndlen, it has a packet to send.
*/ */
dev->d_len -= UIP_IPUDPH_LEN; dev->d_len -= IPUDP_HDRLEN;
#ifdef CONFIG_NET_UDP_CHECKSUMS #ifdef CONFIG_NET_UDP_CHECKSUMS
dev->d_appdata = &dev->d_buf[NET_LLH_LEN + UIP_IPUDPH_LEN]; dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
if (pbuf->udpchksum != 0 && udp_chksum(dev) != 0xffff) if (pbuf->udpchksum != 0 && udp_chksum(dev) != 0xffff)
{ {
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
@@ -136,8 +136,8 @@ int udp_input(FAR struct net_driver_s *dev)
/* Set-up for the application callback */ /* Set-up for the application callback */
dev->d_appdata = &dev->d_buf[NET_LLH_LEN + UIP_IPUDPH_LEN]; dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LLH_LEN + UIP_IPUDPH_LEN]; dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_sndlen = 0; dev->d_sndlen = 0;
/* Perform the application callback */ /* 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 */ /* Set-up for the application callback */
dev->d_appdata = &dev->d_buf[NET_LLH_LEN + UIP_IPUDPH_LEN]; dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_snddata = &dev->d_buf[NET_LLH_LEN + UIP_IPUDPH_LEN]; dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN + IPUDP_HDRLEN];
dev->d_len = 0; dev->d_len = 0;
dev->d_sndlen = 0; dev->d_sndlen = 0;
+3 -3
View File
@@ -62,7 +62,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define UDPBUF ((struct udp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Public Variables * Public Variables
@@ -108,7 +108,7 @@ void udp_send(struct net_driver_s *dev, struct udp_conn_s *conn)
* the IP and UDP headers (and, eventually, the Ethernet header) * the IP and UDP headers (and, eventually, the Ethernet header)
*/ */
dev->d_len = dev->d_sndlen + UIP_IPUDPH_LEN; dev->d_len = dev->d_sndlen + IPUDP_HDRLEN;
/* Initialize the IP header. Note that for IPv6, the IP length field /* Initialize the IP header. Note that for IPv6, the IP length field
* does not include the IPv6 IP header length. * does not include the IPv6 IP header length.
@@ -155,7 +155,7 @@ void udp_send(struct net_driver_s *dev, struct udp_conn_s *conn)
pudpbuf->srcport = conn->lport; pudpbuf->srcport = conn->lport;
pudpbuf->destport = conn->rport; pudpbuf->destport = conn->rport;
pudpbuf->udplen = HTONS(dev->d_sndlen + UIP_UDPH_LEN); pudpbuf->udplen = HTONS(dev->d_sndlen + UDP_HDRLEN);
#ifdef CONFIG_NET_UDP_CHECKSUMS #ifdef CONFIG_NET_UDP_CHECKSUMS
/* Calculate UDP checksum. */ /* Calculate UDP checksum. */
+5 -5
View File
@@ -54,8 +54,8 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define BUF ((struct net_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define BUF ((struct net_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LLH_LEN]) #define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@@ -123,7 +123,7 @@ static uint16_t upper_layer_chksum(FAR struct net_driver_s *dev, uint8_t proto)
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
upper_layer_len = (((uint16_t)(pbuf->len[0]) << 8) + pbuf->len[1]); upper_layer_len = (((uint16_t)(pbuf->len[0]) << 8) + pbuf->len[1]);
#else /* CONFIG_NET_IPv6 */ #else /* CONFIG_NET_IPv6 */
upper_layer_len = (((uint16_t)(pbuf->len[0]) << 8) + pbuf->len[1]) - IPHDR_LEN; upper_layer_len = (((uint16_t)(pbuf->len[0]) << 8) + pbuf->len[1]) - IP_HDRLEN;
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 */
/* Verify some minimal assumptions */ /* Verify some minimal assumptions */
@@ -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 TCP header and data. */
sum = chksum(sum, &dev->d_buf[IPHDR_LEN + NET_LLH_LEN], upper_layer_len); sum = chksum(sum, &dev->d_buf[IP_HDRLEN + NET_LL_HDRLEN], upper_layer_len);
return (sum == 0) ? 0xffff : htons(sum); return (sum == 0) ? 0xffff : htons(sum);
} }
@@ -285,7 +285,7 @@ uint16_t ip_chksum(FAR struct net_driver_s *dev)
{ {
uint16_t sum; uint16_t sum;
sum = chksum(0, &dev->d_buf[NET_LLH_LEN], IPHDR_LEN); sum = chksum(0, &dev->d_buf[NET_LL_HDRLEN], IP_HDRLEN);
return (sum == 0) ? 0xffff : htons(sum); return (sum == 0) ? 0xffff : htons(sum);
} }
#endif /* CONFIG_NET_ARCH_CHKSUM */ #endif /* CONFIG_NET_ARCH_CHKSUM */