From c73b45e14d66ab3d4937d8bec03f5d3bf1f3106f Mon Sep 17 00:00:00 2001 From: jiangheng12 Date: Wed, 14 Jun 2023 23:39:08 +0800 Subject: [PATCH] sync set sock when select path is PATH_UNKNOW (cherry picked from commit bbd206dcc76d124c74413ee46934c302c42aa1a9) --- ...sock-when-select-path-is-PATH_UNKNOW.patch | 60 +++++++++++++++++++ gazelle.spec | 6 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 0247-set-sock-when-select-path-is-PATH_UNKNOW.patch diff --git a/0247-set-sock-when-select-path-is-PATH_UNKNOW.patch b/0247-set-sock-when-select-path-is-PATH_UNKNOW.patch new file mode 100644 index 0000000..5cf3475 --- /dev/null +++ b/0247-set-sock-when-select-path-is-PATH_UNKNOW.patch @@ -0,0 +1,60 @@ +From 046d0963dc5d00430897ee2ffdb27dcae6b4693c Mon Sep 17 00:00:00 2001 +From: jiangheng +Date: Mon, 5 Sep 2022 12:20:17 +0800 +Subject: [PATCH] set sock when select path is PATH_UNKNOW + +--- + src/lstack/api/lstack_wrap.c | 19 +++++++------------ + 1 file changed, 7 insertions(+), 12 deletions(-) + +diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c +index 1f33e13..096fcf7 100644 +--- a/src/lstack/api/lstack_wrap.c ++++ b/src/lstack/api/lstack_wrap.c +@@ -54,9 +54,9 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd, struct lwip_sock **socke + { + if (unlikely(posix_api == NULL)) { + /* +- * posix api maybe call before gazelle init +- * So, we must call posix_api_init at the head of select_path +- */ ++ * posix api maybe call before gazelle init ++ * So, we must call posix_api_init at the head of select_path ++ */ + if (posix_api_init() != 0) { + LSTACK_PRE_LOG(LSTACK_ERR, "posix_api_init failed\n"); + } +@@ -74,26 +74,21 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd, struct lwip_sock **socke + return PATH_KERNEL; + } + ++ if (socket) { ++ *socket = sock; ++ } ++ + if (likely(CONN_TYPE_IS_LIBOS(sock->conn))) { +- if (socket) { +- *socket = sock; +- } + return PATH_LWIP; + } + + if (NETCONN_IS_UDP(sock)) { +- if (socket) { +- *socket = sock; +- } + return PATH_LWIP; + } else { + struct tcp_pcb *pcb = sock->conn->pcb.tcp; + /* after lwip connect, call send immediately, pcb->state is SYN_SENT, need return PATH_LWIP */ + /* pcb->state default value is CLOSED when call socket, need return PATH_UNKNOW */ + if (pcb != NULL && pcb->state <= ESTABLISHED && pcb->state >= LISTEN) { +- if (socket) { +- *socket = sock; +- } + return PATH_LWIP; + } + } +-- +2.23.0 + diff --git a/gazelle.spec b/gazelle.spec index 113b8d8..7dcfe7f 100644 --- a/gazelle.spec +++ b/gazelle.spec @@ -2,7 +2,7 @@ Name: gazelle Version: 1.0.1 -Release: 62 +Release: 63 Summary: gazelle is a high performance user-mode stack License: MulanPSL-2.0 URL: https://gitee.com/openeuler/gazelle @@ -261,6 +261,7 @@ Patch9243: 0243-fix-change-low-power-mod-invalid.patch Patch9244: 0244-add-exception-handling-for-is_dst_ip_localhost.patch Patch9245: 0245-fix-gazellectl-block-before-lstack-registration-is-c.patch Patch9246: 0246-fix-udp-send-recv-in-muliple-queue.patch +Patch9247: 0247-set-sock-when-select-path-is-PATH_UNKNOW.patch %description %{name} is a high performance user-mode stack. @@ -301,6 +302,9 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b %config(noreplace) %{conf_path}/ltran.conf %changelog +* Wed Jun 14 2023 jiangheng12 - 1.0.1-63 +- set sock when select path is PATH_UNKNOW + * Wed Jun 14 2023 jiangheng12 - 1.0.1-62 - fix udp send/recv in muliple queue - fix gazellectl block before lstack registration is complete