diff --git a/0115-udp-muticast-loop.patch b/0115-udp-muticast-loop.patch new file mode 100644 index 0000000000000000000000000000000000000000..daf8a2e03ba11e738755a0a83849b92dbea5e0b0 --- /dev/null +++ b/0115-udp-muticast-loop.patch @@ -0,0 +1,96 @@ +From 74d87ad663f013e792a9ea5d004eae139cd2e0a0 Mon Sep 17 00:00:00 2001 +From: compile_success <980965867@qq.com> +Date: Sat, 9 Mar 2024 06:45:25 +0000 +Subject: [PATCH] support loop mode + +--- + src/api/netbuf.c | 3 +++ + src/core/netif.c | 14 +++++++++++--- + src/include/lwip/netif.h | 4 ++++ + 3 files changed, 18 insertions(+), 3 deletions(-) + +diff --git a/src/api/netbuf.c b/src/api/netbuf.c +index 3b910de..385dfcb 100644 +--- a/src/api/netbuf.c ++++ b/src/api/netbuf.c +@@ -128,6 +128,9 @@ netbuf_free(struct netbuf *buf) + { + LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return;); + if (buf->p != NULL) { ++ if((buf->p->flags & PBUF_FLAG_MCASTLOOP) != 0) { ++ return; ++ } + pbuf_free(buf->p); + } + buf->p = buf->ptr = NULL; +diff --git a/src/core/netif.c b/src/core/netif.c +index 8302bd5..79f2317 100644 +--- a/src/core/netif.c ++++ b/src/core/netif.c +@@ -1117,6 +1117,10 @@ netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callb + */ + err_t + netif_loop_output(struct netif *netif, struct pbuf *p) ++#else ++err_t ++udp_netif_loop_output(struct netif *netif, struct pbuf *p) ++#endif + { + struct pbuf *r; + err_t err; +@@ -1171,7 +1175,9 @@ netif_loop_output(struct netif *netif, struct pbuf *p) + MIB2_STATS_NETIF_INC(stats_if, ifoutdiscards); + return err; + } +- ++#if GAZELLE_ENABLE ++ r->flags |= PBUF_FLAG_MCASTLOOP; ++#endif + /* Put the packet on a linked list which gets emptied through calling + netif_poll(). */ + +@@ -1218,7 +1224,6 @@ netif_loop_output(struct netif *netif, struct pbuf *p) + + return ERR_OK; + } +-#endif + + #if LWIP_HAVE_LOOPIF + #if LWIP_IPV4 +@@ -1249,6 +1254,10 @@ netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ad + */ + void + netif_poll(struct netif *netif) ++#else ++void ++udp_netif_poll(struct netif *netif) ++#endif + { + /* If we have a loopif, SNMP counters are adjusted for it, + * if not they are adjusted for 'netif'. */ +@@ -1312,7 +1321,6 @@ netif_poll(struct netif *netif) + } + SYS_ARCH_UNPROTECT(lev); + } +-#endif + + #if !LWIP_NETIF_LOOPBACK_MULTITHREADING + /** +diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h +index d10d4e8..d8f1f45 100644 +--- a/src/include/lwip/netif.h ++++ b/src/include/lwip/netif.h +@@ -538,6 +538,10 @@ void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_ + #if ENABLE_LOOPBACK + err_t netif_loop_output(struct netif *netif, struct pbuf *p); + void netif_poll(struct netif *netif); ++#if GAZELLE_ENABLE ++err_t udp_netif_loop_output(struct netif *netif, struct pbuf *p); ++void udp_netif_poll(struct netif *netif); ++#endif + #if !LWIP_NETIF_LOOPBACK_MULTITHREADING + void netif_poll_all(void); + #endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ +-- +2.33.0 + diff --git a/lwip.spec b/lwip.spec index 6707b2deb4a6a098ea9d7f02105a963e44108e61..a80be1a1cc4cb04984160db4d508ad8903358e18 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: 7 +Release: 8 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -126,6 +126,7 @@ Patch9110: 0111-support-udp-pkglen-mtu-modify-IP_REASS_MAX_PBUFS.patch Patch9111: 0112-support-udp-pkglen-mtu-modify-netbuf_alloc-size.patch Patch9112: 0113-fix-duplicate-pbuf_free-in-udp_sendto.patch Patch9113: 0114-sync-recv-flags-with-linux-kernel.patch +Patch9114: 0115-udp-muticast-loop.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -155,6 +156,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Tue Mar 12 2024 zhujunhao - 2.2.0-8 +- support udp muticast loop + * Mon Mar 11 2024 liyunqing - 2.2.0-7 - sync macros with kernel defined which use in recv and send