You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/08/07 04:17:32 UTC

[incubator-nuttx] branch master updated (87c5cc1 -> b815a2c)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 87c5cc1  adc: add IOCTL commands ANIOC_RESET_FIFO and ANIOC_SAMPLES_ON_READ
     new e53f989  tcp_rexmit: advance conn->sndseq
     new b815a2c  tcp_input: Don't put back sndseq on an old ack

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 net/tcp/tcp_appsend.c |  7 +++++++
 net/tcp/tcp_input.c   | 15 ++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)

[incubator-nuttx] 01/02: tcp_rexmit: advance conn->sndseq

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit e53f98999714047a035d43c35cc3ebd50d2c9fa2
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Jul 27 13:47:18 2021 +0900

    tcp_rexmit: advance conn->sndseq
    
    Otherwise, we use an old sequence number when sending
    non-data segment. (eg. window update)
    The peer might consider such a segment stale and ignore.
---
 net/tcp/tcp_appsend.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/tcp/tcp_appsend.c b/net/tcp/tcp_appsend.c
index d2a05bd..c31a942 100644
--- a/net/tcp/tcp_appsend.c
+++ b/net/tcp/tcp_appsend.c
@@ -319,11 +319,18 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
   if (dev->d_sndlen > 0 && conn->tx_unacked > 0)
 #endif
     {
+      uint32_t seq;
+
       /* We always set the ACK flag in response packets adding the length of
        * the IP and TCP headers.
        */
 
       tcp_send(dev, conn, TCP_ACK | TCP_PSH, dev->d_sndlen + hdrlen);
+
+      /* Advance sndseq */
+
+      seq = tcp_getsequence(conn->sndseq);
+      tcp_setsequence(conn->sndseq, seq + dev->d_sndlen);
     }
 
   /* If there is no data to send, just send out a pure ACK if one is

[incubator-nuttx] 02/02: tcp_input: Don't put back sndseq on an old ack

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit b815a2c3a83f3b01a11e65ae9ea8aaa0f7787018
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Jul 27 13:55:04 2021 +0900

    tcp_input: Don't put back sndseq on an old ack
---
 net/tcp/tcp_input.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c
index 96eeb5a..56edd7c 100644
--- a/net/tcp/tcp_input.c
+++ b/net/tcp/tcp_input.c
@@ -582,6 +582,7 @@ found:
     {
       uint32_t unackseq;
       uint32_t ackseq;
+      uint32_t sndseq;
 
       /* The next sequence number is equal to the current sequence
        * number (sndseq) plus the size of the outstanding, unacknowledged
@@ -639,11 +640,15 @@ found:
        * be beyond ackseq.
        */
 
-      ninfo("sndseq: %08" PRIx32 "->%08" PRIx32
-            " unackseq: %08" PRIx32 " new tx_unacked: %" PRId32 "\n",
-            tcp_getsequence(conn->sndseq), ackseq, unackseq,
-            (uint32_t)conn->tx_unacked);
-      tcp_setsequence(conn->sndseq, ackseq);
+      sndseq = tcp_getsequence(conn->sndseq);
+      if (TCP_SEQ_LT(sndseq, ackseq))
+        {
+          ninfo("sndseq: %08" PRIx32 "->%08" PRIx32
+                " unackseq: %08" PRIx32 " new tx_unacked: %" PRId32 "\n",
+                tcp_getsequence(conn->sndseq), ackseq, unackseq,
+                (uint32_t)conn->tx_unacked);
+          tcp_setsequence(conn->sndseq, ackseq);
+        }
 
       /* Do RTT estimation, unless we have done retransmissions. */