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