From 225b4b92865f1ce0ceb59fc99b77596a72b1ff0b Mon Sep 17 00:00:00 2001 From: wu-changsheng Date: Tue, 11 Oct 2022 21:50:01 +0800 Subject: [PATCH] alloc socket fail clean sock (cherry picked from commit c34dcb43f15962e15b3ce6263a3d5776f88d7f9a) --- 0033-alloc-socket-fail-clean-sock.patch | 39 +++++++++++++++++++++++++ lwip.spec | 6 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 0033-alloc-socket-fail-clean-sock.patch diff --git a/0033-alloc-socket-fail-clean-sock.patch b/0033-alloc-socket-fail-clean-sock.patch new file mode 100644 index 0000000..0a932dd --- /dev/null +++ b/0033-alloc-socket-fail-clean-sock.patch @@ -0,0 +1,39 @@ +From fc2a5b52f7d9f02eb43931414767635e5cf4c8c1 Mon Sep 17 00:00:00 2001 +From: jiangheng +Date: Tue, 11 Oct 2022 21:47:24 +0800 +Subject: [PATCH] alloc socket fail clean sock + +--- + src/api/sockets.c | 3 +++ + src/include/lwipsock.h | 1 + + 2 files changed, 4 insertions(+) + +diff --git a/src/api/sockets.c b/src/api/sockets.c +index 14f2b35..3552599 100644 +--- a/src/api/sockets.c ++++ b/src/api/sockets.c +@@ -598,6 +598,9 @@ alloc_socket(struct netconn *newconn, int accepted) + sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1); + sockets[i].errevent = 0; + return i + LWIP_SOCKET_OFFSET; ++ } else { ++ lwip_close(i); ++ gazelle_clean_sock(i); + } + + err: +diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h +index 912d471..2ffb077 100644 +--- a/src/include/lwipsock.h ++++ b/src/include/lwipsock.h +@@ -130,6 +130,7 @@ extern void add_recv_list(int32_t fd); + extern ssize_t read_lwip_data(struct lwip_sock *sock, int32_t flags, u8_t apiflags); + extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8_t *apiflags); + extern void gazelle_init_sock(int32_t fd); ++extern void gazelle_clean_sock(int32_t fd); + extern void write_lwip_over(struct lwip_sock *sock, uint32_t n); + #endif /* USE_LIBOS */ + +-- +2.23.0 + diff --git a/lwip.spec b/lwip.spec index 145c1ed..245af57 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.1.3 -Release: 20 +Release: 21 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.tar.gz @@ -44,6 +44,7 @@ Patch9028: 0029-fix-EISCONN-err-and-remove-same-customized-modificat.patch Patch9029: 0030-refactor-tcp-new-port.patch Patch9030: 0031-refactor-add-event-limit-send-pkts-num.patch Patch9031: 0032-fix-free-pbuf-miss-data.patch +Patch9032: 0033-alloc-socket-fail-clean-sock.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -72,6 +73,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Tue Oct 11 2022 wuchangsheng - 2.1.3-21 +- alloc socket fail clean sock + * Thu Oct 6 2022 wuchangsheng - 2.1.3-20 - fix miss data due to free pbuf close debug -- Gitee