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

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

commit 06e7c23088a3b7d715e8c2ad358534a3d0257ecf
Author: raiden00pl <[email protected]>
AuthorDate: Tue Oct 13 19:18:46 2026 +0200

    net/tcp: Do not send more than the MSS when IOBs run low.
    
    When no IOB was free, the send size was set to CONFIG_IOB_BUFSIZE even
    if that is larger than the MSS and the send window, which trips the
    DEBUGASSERT in tcp_appsend() or sends an oversized segment.  Only ever
    lower the send size.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 net/tcp/tcp_send_buffered.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c
index e07c8810b20..b32076731a4 100644
--- a/net/tcp/tcp_send_buffered.c
+++ b/net/tcp/tcp_send_buffered.c
@@ -1082,10 +1082,12 @@ static uint32_t psock_send_eventhandler(FAR struct 
net_driver_s *dev,
            * packet gets refused by devif_iob_send(). Detect this situation
            * and send tiny TCP packets until we manage to free up some space.
            * We do not want to exhaust all of the remaining iobs by sending
-           * the maximum size packet that would fit.
+           * the maximum size packet that would fit.  Never send more than
+           * sndlen, which is limited by the MSS and the send window.
            */
 
-          if (sndlen > iob_navail(false) * CONFIG_IOB_BUFSIZE)
+          if (sndlen > iob_navail(false) * CONFIG_IOB_BUFSIZE &&
+              sndlen > CONFIG_IOB_BUFSIZE)
             {
               nwarn("Running low on iobs, limiting packet size\n");
               sndlen = CONFIG_IOB_BUFSIZE;

Reply via email to