From 55d5006462c7750637107ebead157a52ced84a07 Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Tue, 19 Sep 2023 10:24:06 +0800 Subject: [PATCH] tcp_ofosegs: prepare iob to reset io_offset The previous iob_trimhead added dev->iob->io_offset, so if the input frame is not merged into the ofo segment, we need to reset dev->iob->io_offset so that the subsequent tcp_send can properly assemble packets. Signed-off-by: zhanghongyu --- net/tcp/tcp_input.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index 733e3663ff..77b1b06d08 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -456,10 +456,9 @@ static void tcp_input_ofosegs(FAR struct net_driver_s *dev, dev->d_iob = iob_trimhead(dev->d_iob, len); if (dev->d_iob == NULL || dev->d_iob->io_pktlen == 0) { - /* No available data, clear device buffer */ + /* No available data, prepare device iob */ - iob_free_chain(dev->d_iob); - goto clear; + goto prepare; } ofoseg.data = dev->d_iob; @@ -517,10 +516,11 @@ static void tcp_input_ofosegs(FAR struct net_driver_s *dev, if (rebuild) { -clear: netdev_iob_clear(dev); - netdev_iob_prepare(dev, false, 0); } + +prepare: + netdev_iob_prepare(dev, false, 0); } #endif /* CONFIG_NET_TCP_OUT_OF_ORDER */