From eb28779d716453ecb0518fe6fafaa1d8241dea90 Mon Sep 17 00:00:00 2001 From: jiangheng Date: Fri, 15 Sep 2023 09:40:30 +0800 Subject: [PATCH] pbuf: fix pbuf->tot_len incorrect after pbuf_split_64k is called (cherry picked from commit 4e6ef43965ad3ca2f87dca41d08fd506fa82c642) --- ...-incorrect-after-pbuf_split_64k-is-c.patch | 35 +++++++++++++++++++ lwip.spec | 6 +++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 0071-fix-pbuf-tot_len-incorrect-after-pbuf_split_64k-is-c.patch diff --git a/0071-fix-pbuf-tot_len-incorrect-after-pbuf_split_64k-is-c.patch b/0071-fix-pbuf-tot_len-incorrect-after-pbuf_split_64k-is-c.patch new file mode 100644 index 0000000..7bf4711 --- /dev/null +++ b/0071-fix-pbuf-tot_len-incorrect-after-pbuf_split_64k-is-c.patch @@ -0,0 +1,35 @@ +From 339ad47548236f2b11ee6161a419db8aa664138c Mon Sep 17 00:00:00 2001 +From: jiangheng +Date: Fri, 15 Sep 2023 09:33:56 +0800 +Subject: [PATCH] fix pbuf->tot_len incorrect after pbuf_split_64k is called + +--- + src/core/pbuf.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/src/core/pbuf.c b/src/core/pbuf.c +index 2385e57..8a55463 100644 +--- a/src/core/pbuf.c ++++ b/src/core/pbuf.c +@@ -1194,7 +1194,7 @@ void pbuf_split_64k(struct pbuf *p, struct pbuf **rest) + if (r != NULL) { + /* Update the tot_len field in the first part */ + for (i = p; i != NULL; i = i->next) { +- i->tot_len = tot_len_front; ++ i->tot_len = (u16_t)(i->tot_len - r->tot_len); + LWIP_ASSERT("tot_len/len mismatch in last pbuf", + (i->next != NULL) || (i->tot_len == i->len)); + } +@@ -1205,9 +1205,6 @@ void pbuf_split_64k(struct pbuf *p, struct pbuf **rest) + /* tot_len field in rest does not need modifications */ + /* reference counters do not need modifications */ + *rest = r; +- r->tot_len = r->len; +- }else{ +- p->tot_len = tot_len_front; + } + } + } +-- +2.27.0 + diff --git a/lwip.spec b/lwip.spec index 6438ae0..f530171 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: 75 +Release: 76 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -82,6 +82,7 @@ Patch9066: 0067-fix-null-pointer-when-all-zero-address-listen.patch Patch9067: 0068-enable-UDP-CKSUM-in-lwip.patch Patch9068: 0069-add-error-check-in-hugepage_init-and-sys_mbox_free.patch Patch9069: 0070-add-CHECKSUM_UDP-when-not-support-OFFLOAD_UDP_CHECKS.patch +Patch9070: 0071-fix-pbuf-tot_len-incorrect-after-pbuf_split_64k-is-c.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -112,6 +113,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Fri Sep 15 2023 jiangheng - 2.1.3-76 +- fix pbuf->tot_len incorrect after pbuf_split_64k is called + * Tue Jun 27 2023 kircher - 2.1.3-75 - add CHECKSUM_UDP when not support OFFLOAD_UDP_CHECKS -- Gitee