You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/07/05 10:21:50 UTC

[GitHub] [incubator-nuttx] yamt commented on a change in pull request #4070: net/tcp: add window scale support

yamt commented on a change in pull request #4070:
URL: https://github.com/apache/incubator-nuttx/pull/4070#discussion_r663806067



##########
File path: net/tcp/tcp_send.c
##########
@@ -365,6 +365,13 @@ static void tcp_sendcommon(FAR struct net_driver_s *dev,
       uint32_t rcvseq = tcp_getsequence(conn->rcvseq);
       uint16_t recvwndo = tcp_get_recvwindow(dev, conn);
 
+#ifdef CONFIG_NET_TCP_WINDOW_SCALE
+      if (recvwndo > 0 && conn->rcv_scale > 0)
+        {
+          recvwndo >>= conn->rcv_scale;
+        }
+#endif

Review comment:
       rcv_adv update below should use the unscaled value

##########
File path: net/tcp/tcp_send.c
##########
@@ -669,11 +677,24 @@ void tcp_synack(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
 
   /* We send out the TCP Maximum Segment Size option with our ACK. */
 
-  tcp->optdata[0] = TCP_OPT_MSS;
-  tcp->optdata[1] = TCP_OPT_MSS_LEN;
-  tcp->optdata[2] = tcp_mss >> 8;
-  tcp->optdata[3] = tcp_mss & 0xff;
-  tcp->tcpoffset  = ((TCP_HDRLEN + TCP_OPT_MSS_LEN) / 4) << 4;
+  tcp->optdata[optlen++] = TCP_OPT_MSS;
+  tcp->optdata[optlen++] = TCP_OPT_MSS_LEN;
+  tcp->optdata[optlen++] = tcp_mss >> 8;
+  tcp->optdata[optlen++] = tcp_mss & 0xff;
+
+#ifdef CONFIG_NET_TCP_WINDOW_SCALE
+  if (tcp->flags == TCP_SYN ||
+      ((tcp->flags == (TCP_ACK | TCP_SYN)) && conn->snd_scale))

Review comment:
       0 is a valid value for the window scaling option.
   i guess you need a separate bit to record "window scaling option received".




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org