From eac4ea7ae53d84fff2c75f39142b4086e1f60ec9 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 22 Jan 2015 12:10:16 -0600 Subject: [PATCH] Networking: Back out a previous change. It is incorrect --- net/tcp/tcp_appsend.c | 4 ++-- net/tcp/tcp_send.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/net/tcp/tcp_appsend.c b/net/tcp/tcp_appsend.c index 18f8b74276..a8f93fdd61 100644 --- a/net/tcp/tcp_appsend.c +++ b/net/tcp/tcp_appsend.c @@ -226,7 +226,7 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, #endif { DEBUGASSERT(IFF_IS_IPv4(dev->d_flags)); - hdrlen = IPv4_HDRLEN; + hdrlen = IPv4TCP_HDRLEN; } #endif /* CONFIG_NET_IPv4 */ @@ -236,7 +236,7 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, #endif { DEBUGASSERT(IFF_IS_IPv6(dev->d_flags)); - hdrlen = IPv6_HDRLEN; + hdrlen = IPv6TCP_HDRLEN; } #endif /* CONFIG_NET_IPv6 */ diff --git a/net/tcp/tcp_send.c b/net/tcp/tcp_send.c index a2ec76e3a9..4d96dc4c0a 100644 --- a/net/tcp/tcp_send.c +++ b/net/tcp/tcp_send.c @@ -145,6 +145,10 @@ static inline void tcp_ipv4_sendcomplete(FAR struct net_driver_s *dev, ipv4->proto = IP_PROTO_TCP; ipv4->ttl = IP_TTL; + /* At this point the TCP header holds the size of the payload, the + * TCP header, and the IP header. + */ + ipv4->len[0] = (dev->d_len >> 8); ipv4->len[1] = (dev->d_len & 0xff); @@ -207,8 +211,9 @@ static inline void tcp_ipv6_sendcomplete(FAR struct net_driver_s *dev, ipv6->proto = IP_PROTO_TCP; ipv6->ttl = IP_TTL; - /* For IPv6, the IP length field does not include the IPv6 IP header - * length. + /* At this point the TCP header holds the size of the payload, the + * TCP header, and the IP header. For IPv6, the IP length field does + * not include the size of IPv6 IP header length. */ iplen = dev->d_len - IPv6_HDRLEN; @@ -372,7 +377,8 @@ static void tcp_sendcommon(FAR struct net_driver_s *dev, * dev - The device driver structure to use in the send operation * conn - The TCP connection structure holding connection information * flags - flags to apply to the TCP header - * len - length of the message + * len - length of the message (includes the length of the IP and TCP + * headers) * * Return: * None