diff --git a/0125-add-udp-loop-support-pbuf-line.patch b/0125-add-udp-loop-support-pbuf-line.patch new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c836b0e3008d50fabe85e098f41bd893b106 --- /dev/null +++ b/0125-add-udp-loop-support-pbuf-line.patch @@ -0,0 +1,44 @@ +From f28df378e820af31151c1572becd142d376024e3 Mon Sep 17 00:00:00 2001 +From: compile_success <980965867@qq.com> +Date: Tue, 23 Apr 2024 02:58:21 +0000 +Subject: [PATCH] add udp loop support pbuf line + +--- + src/core/netif.c | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/src/core/netif.c b/src/core/netif.c +index 2fc8945..339aaad 100644 +--- a/src/core/netif.c ++++ b/src/core/netif.c +@@ -1182,13 +1182,21 @@ udp_netif_loop_output(struct netif *netif, struct pbuf *p) + LWIP_ASSERT("netif_loop_output: invalid pbuf", p != NULL); + + /* Allocate a new pbuf */ +- r = pbuf_alloc(PBUF_LINK, p->tot_len, PBUF_RAM); +- if (r == NULL) { +- LINK_STATS_INC(link.memerr); +- LINK_STATS_INC(link.drop); +- MIB2_STATS_NETIF_INC(stats_if, ifoutdiscards); +- return ERR_MEM; ++ u16_t p_clen = pbuf_clen(p); ++ struct pbuf *tmp[2048]; ++ for(int num = 0; num < p_clen; num++){ ++ tmp[num]= pbuf_alloc(PBUF_LINK, p->len, PBUF_RAM); ++ if (tmp[num] == NULL) { ++ LINK_STATS_INC(link.memerr); ++ LINK_STATS_INC(link.drop); ++ MIB2_STATS_NETIF_INC(stats_if, ifoutdiscards); ++ return ERR_MEM; ++ } ++ if(num > 0){ ++ pbuf_cat(tmp[0], tmp[num]); ++ } + } ++ r = tmp[0]; + #if LWIP_LOOPBACK_MAX_PBUFS + clen = pbuf_clen(r); + /* check for overflow or too many pbuf on queue */ +-- +2.33.0 + diff --git a/lwip.spec b/lwip.spec index 1a19d093e6000cdcea357a96c0b2bdede37f02fc..87f77849cdaae213f5ef425d37e845a9b4627cc3 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.2.0 -Release: 17 +Release: 18 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -136,6 +136,7 @@ Patch9120: 0121-add-vlan-filter.patch Patch9121: 0122-support-mldv2.patch Patch9122: 0123-opts-modify-MEMP_NUM_UDP_PCB.patch Patch9123: 0124-fix-udp-recv-memleak.patch +Patch9124: 0125-add-udp-loop-support-pbuf-line.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -165,6 +166,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Tue Apr 23 2024 zhujunhao - 2.2.0-18 +- add udp loop mod support package exceeds the MTU + * Mon Apr 22 2024 zhujunhao - 2.2.0-17 - fix udp recv memleak