From 81b184789d394d53bdf41c48775058a0c618bd1c Mon Sep 17 00:00:00 2001 From: wu-changsheng Date: Tue, 11 Oct 2022 21:59:43 +0800 Subject: [PATCH] alloc socket fail clean sock (cherry picked from commit 29c01c6dfa0eb3829d286db6f487794ffcdee2d1) --- 0032-alloc-socket-fail-clean-sock.patch | 39 +++++++++++++++++++++++++ lwip.spec | 7 ++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 0032-alloc-socket-fail-clean-sock.patch diff --git a/0032-alloc-socket-fail-clean-sock.patch b/0032-alloc-socket-fail-clean-sock.patch new file mode 100644 index 0000000..0a932dd --- /dev/null +++ b/0032-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 447fca0..1f04778 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.2 -Release: 11 +Release: 12 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -45,6 +45,7 @@ Patch9028: 0028-fix-EISCONN-err-and-remove-same-customized-modificat.patch Patch9029: 0029-refactor-tcp-new-port.patch Patch9030: 0030-refactor-add-event-limit-send-pkts-num.patch Patch9031: 0031-fix-free-pbuf-miss-data.patch +Patch9032: 0032-alloc-socket-fail-clean-sock.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -94,6 +95,7 @@ find %{_builddir}/%{name}-%{version} -type f -exec dos2unix -q {} \; %patch9029 -p1 %patch9030 -p1 %patch9031 -p1 +%patch9032 -p1 %build cd %{_builddir}/%{name}-%{version}/src @@ -109,6 +111,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Tue Oct 11 2022 wuchangsheng - 2.1.2-11 +- alloc socket fail clean sock + * Thu Oct 6 2022 wuchangsheng - 2.1.2-10 - fix miss data due to free pbuf close debug -- Gitee