1195972f6Sopenharmony_ciFrom 339ad47548236f2b11ee6161a419db8aa664138c Mon Sep 17 00:00:00 2001
2195972f6Sopenharmony_ciFrom: jiangheng <jiangheng14@huawei.com>
3195972f6Sopenharmony_ciDate: Fri, 15 Sep 2023 09:33:56 +0800
4195972f6Sopenharmony_ciSubject: [PATCH] fix pbuf->tot_len incorrect after pbuf_split_64k is called
5195972f6Sopenharmony_ci
6195972f6Sopenharmony_ci---
7195972f6Sopenharmony_ci src/core/pbuf.c | 5 +----
8195972f6Sopenharmony_ci 1 file changed, 1 insertion(+), 4 deletions(-)
9195972f6Sopenharmony_ci
10195972f6Sopenharmony_cidiff --git a/src/core/pbuf.c b/src/core/pbuf.c
11195972f6Sopenharmony_ciindex 2385e57..8a55463 100644
12195972f6Sopenharmony_ci--- a/src/core/pbuf.c
13195972f6Sopenharmony_ci+++ b/src/core/pbuf.c
14195972f6Sopenharmony_ci@@ -1194,7 +1194,7 @@ void pbuf_split_64k(struct pbuf *p, struct pbuf **rest)
15195972f6Sopenharmony_ci     if (r != NULL) {
16195972f6Sopenharmony_ci       /* Update the tot_len field in the first part */
17195972f6Sopenharmony_ci       for (i = p; i != NULL; i = i->next) {
18195972f6Sopenharmony_ci-        i->tot_len = tot_len_front;
19195972f6Sopenharmony_ci+        i->tot_len = (u16_t)(i->tot_len - r->tot_len);
20195972f6Sopenharmony_ci         LWIP_ASSERT("tot_len/len mismatch in last pbuf",
21195972f6Sopenharmony_ci                     (i->next != NULL) || (i->tot_len == i->len));
22195972f6Sopenharmony_ci       }
23195972f6Sopenharmony_ci@@ -1205,9 +1205,6 @@ void pbuf_split_64k(struct pbuf *p, struct pbuf **rest)
24195972f6Sopenharmony_ci       /* tot_len field in rest does not need modifications */
25195972f6Sopenharmony_ci       /* reference counters do not need modifications */
26195972f6Sopenharmony_ci       *rest = r;
27195972f6Sopenharmony_ci-      r->tot_len = r->len;
28195972f6Sopenharmony_ci-    }else{
29195972f6Sopenharmony_ci-      p->tot_len = tot_len_front;
30195972f6Sopenharmony_ci     }
31195972f6Sopenharmony_ci   }
32195972f6Sopenharmony_ci }
33195972f6Sopenharmony_ci-- 
34195972f6Sopenharmony_ci2.27.0
35195972f6Sopenharmony_ci
36