From 08b7b50dfeab81ba9289ae401b082e1edb27dfa2 Mon Sep 17 00:00:00 2001 From: jiangheng Date: Tue, 2 Jan 2024 09:58:08 +0800 Subject: [PATCH] tcp_in: fix ooseq update error --- backport-tcp_in-fix-ooseq-update-error.patch | 39 ++++++++++++++++++++ lwip.spec | 7 +++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 backport-tcp_in-fix-ooseq-update-error.patch diff --git a/backport-tcp_in-fix-ooseq-update-error.patch b/backport-tcp_in-fix-ooseq-update-error.patch new file mode 100644 index 0000000..ff575a8 --- /dev/null +++ b/backport-tcp_in-fix-ooseq-update-error.patch @@ -0,0 +1,39 @@ +From 574bd6e5aa57b971db7b347b8ad761342be9a02c Mon Sep 17 00:00:00 2001 +From: duckpowerMB +Date: Thu, 9 Sep 2021 16:52:55 +0800 +Subject: [PATCH] tcp_in : fix ooseq update error + +if a pbuf received with the same seqno in ooseq , +we then check the size and replace the existing one +with the larger one,but if the existing one is the +last segment in ooseq ,it might has been trimed before. +the replacing action will overrun our receive windows + +see patch #10106 and bug #56397 +--- + src/core/tcp_in.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c +index c7a1f7b7..de64464d 100644 +--- a/src/core/tcp_in.c ++++ b/src/core/tcp_in.c +@@ -1687,6 +1687,15 @@ tcp_receive(struct tcp_pcb *pcb) + ->ooseq. We check the lengths to see which one to + discard. */ + if (inseg.len > next->len) { ++ ++ /* If next segment is the last segment in ooseq ++ and smaller than inseg, that means it has been ++ trimmed before to fit our window, so we just ++ break here. */ ++ if (next->next == NULL) { ++ break; ++ } ++ + /* The incoming segment is larger than the old + segment. We replace some segments with the new + one. */ +-- +2.27.0 + diff --git a/lwip.spec b/lwip.spec index a7c3376..643bd4e 100644 --- a/lwip.spec +++ b/lwip.spec @@ -4,7 +4,7 @@ Summary: lwip is a small independent implementation of the TCP/IP protocol suite Name: lwip Version: 2.1.3 -Release: 103 +Release: 104 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -114,6 +114,8 @@ Patch9096: 0097-Mod-the-issue-that-2w-connection-unable-to-establish.patch Patch9097: 0098-remove-duplicate-lwip-log.patch Patch9098: 0099-fix-rte_ring_create-time-consuming.patch +Patch6005: backport-tcp_in-fix-ooseq-update-error.patch + BuildRequires: gcc-c++ dos2unix dpdk-devel #Requires: @@ -143,6 +145,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Tue Jan 02 2024 jiangheng - 2.1.3-104 +- tcp_in: fix ooseq update error + * Fri Dec 29 2023 jiangheng - 2.1.3-103 - rte_ring_get_memsize adapt dpdk 19.11