1diff -Nur lwip-2.1.3-org/src/core/init.c lwip-2.1.3/src/core/init.c 2--- lwip-2.1.3-org/src/core/init.c 2022-12-06 14:40:45.280000000 +0000 3+++ lwip-2.1.3/src/core/init.c 2022-12-06 14:41:01.452000000 +0000 4@@ -306,7 +306,7 @@ 5 #if TCP_SNDLOWAT >= TCP_SND_BUF 6 #error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." 7 #endif 8-#if TCP_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS)) 9+#if TCP_SNDLOWAT >= (0xFFFFFFFF - (4 * TCP_MSS)) 10 #error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must at least be 4*MSS below u16_t overflow!" 11 #endif 12 #if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN 13diff -Nur lwip-2.1.3-org/src/core/pbuf.c lwip-2.1.3/src/core/pbuf.c 14--- lwip-2.1.3-org/src/core/pbuf.c 2022-12-06 14:40:45.280000000 +0000 15+++ lwip-2.1.3/src/core/pbuf.c 2022-12-06 14:46:04.860000000 +0000 16@@ -869,13 +869,13 @@ 17 /* proceed to last pbuf of chain */ 18 for (p = h; p->next != NULL; p = p->next) { 19 /* add total length of second chain to all totals of first chain */ 20- p->tot_len = (u16_t)(p->tot_len + t->tot_len); 21+ p->tot_len = p->tot_len + t->tot_len; 22 } 23 /* { p is last pbuf of first h chain, p->next == NULL } */ 24 LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len); 25 LWIP_ASSERT("p->next == NULL", p->next == NULL); 26 /* add total length of second chain to last pbuf total of first chain */ 27- p->tot_len = (u16_t)(p->tot_len + t->tot_len); 28+ p->tot_len = p->tot_len + t->tot_len; 29 /* chain last pbuf of head (p) with first of tail (t) */ 30 p->next = t; 31 /* p->next now references t, but the caller will drop its reference to t, 32@@ -1181,7 +1181,7 @@ 33 if (r != NULL) { 34 /* Update the tot_len field in the first part */ 35 for (i = p; i != NULL; i = i->next) { 36- i->tot_len = (u16_t)(i->tot_len - r->tot_len); 37+ i->tot_len = tot_len_front; 38 LWIP_ASSERT("tot_len/len mismatch in last pbuf", 39 (i->next != NULL) || (i->tot_len == i->len)); 40 } 41@@ -1192,6 +1192,9 @@ 42 /* tot_len field in rest does not need modifications */ 43 /* reference counters do not need modifications */ 44 *rest = r; 45+ r->tot_len = r->len; 46+ }else{ 47+ p->tot_len = tot_len_front; 48 } 49 } 50 } 51diff -Nur lwip-2.1.3-org/src/include/lwip/opt.h lwip-2.1.3/src/include/lwip/opt.h 52--- lwip-2.1.3-org/src/include/lwip/opt.h 2022-12-06 14:40:45.292000000 +0000 53+++ lwip-2.1.3/src/include/lwip/opt.h 2022-12-06 14:41:01.456000000 +0000 54@@ -1482,7 +1482,7 @@ 55 * send window while having a small receive window only. 56 */ 57 #if !defined LWIP_WND_SCALE || defined __DOXYGEN__ 58-#define LWIP_WND_SCALE 0 59+#define LWIP_WND_SCALE 1 60 #define TCP_RCV_SCALE 0 61 #endif 62 63diff -Nur lwip-2.1.3-org/src/include/lwip/pbuf.h lwip-2.1.3/src/include/lwip/pbuf.h 64--- lwip-2.1.3-org/src/include/lwip/pbuf.h 2022-12-06 14:40:45.284000000 +0000 65+++ lwip-2.1.3/src/include/lwip/pbuf.h 2022-12-06 14:46:36.720000000 +0000 66@@ -197,7 +197,7 @@ 67 * For non-queue packet chains this is the invariant: 68 * p->tot_len == p->len + (p->next? p->next->tot_len: 0) 69 */ 70- u16_t tot_len; 71+ u32_t tot_len; 72 73 /** length of this buffer */ 74 u16_t len; 75diff -Nur lwip-2.1.3-org/src/include/lwipopts.h lwip-2.1.3/src/include/lwipopts.h 76--- lwip-2.1.3-org/src/include/lwipopts.h 2022-12-06 14:40:45.292000000 +0000 77+++ lwip-2.1.3/src/include/lwipopts.h 2022-12-06 14:41:01.456000000 +0000 78@@ -97,7 +97,7 @@ 79 80 #define TCP_WND (40 * TCP_MSS) 81 82-#define TCP_SND_BUF (40 * TCP_MSS) 83+#define TCP_SND_BUF (2500 * TCP_MSS) 84 85 #define TCP_SND_QUEUELEN (8191) 86 87