!406 [sync] PR-405: sync set sock when select path is PATH_UNKNOW

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2023-06-14 16:16:09 +00:00 committed by Gitee
commit 46bf405ff0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,60 @@
From 046d0963dc5d00430897ee2ffdb27dcae6b4693c Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
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

View File

@ -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 <jiangheng14@huawei.com> - 1.0.1-63
- set sock when select path is PATH_UNKNOW
* Wed Jun 14 2023 jiangheng12 <jiangheng14@huawei.com> - 1.0.1-62
- fix udp send/recv in muliple queue
- fix gazellectl block before lstack registration is complete