1 Star 0 Fork 32

yc555/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0240-WRAP-fix-bind-log-error.patch 1.94 KB
一键复制 编辑 原始数据 按行查看 历史
From 7601cb5b7f384750bb08c15179c43b8e4417d9c6 Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Mon, 12 Aug 2024 14:32:08 +0800
Subject: [PATCH] WRAP: fix bind log error
---
src/lstack/api/lstack_wrap.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 73281e9..8c3c731 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -201,12 +201,13 @@ static int32_t do_accept4(int32_t s, struct sockaddr *addr, socklen_t *addrlen,
static int kernel_bind_process(int32_t s, const struct sockaddr *name, socklen_t namelen)
{
- struct lwip_sock *sock = NULL;
+ struct lwip_sock *sock = lwip_get_socket(s);
int times = 10;
int ret = 0;
/* lstack not sense if ltran enable kni, so only checks use_ltran. */
if (!get_global_cfg_params()->use_ltran && !get_global_cfg_params()->kni_switch &&
!get_global_cfg_params()->flow_bifurcation) {
+ POSIX_SET_TYPE(sock, POSIX_LWIP);
return 0;
}
ret = posix_api->bind_fn(s, name, namelen);
@@ -232,7 +233,6 @@ static int kernel_bind_process(int32_t s, const struct sockaddr *name, socklen_t
}
/* not sure POSIX_LWIP or POSIX_KERNEL */
} else {
- sock = lwip_get_socket(s);
POSIX_SET_TYPE(sock, POSIX_LWIP);
LSTACK_LOG(ERR, LSTACK, "kernel bind failed ret %d errno %d sa_family %u times %u\n",
ret, errno, name->sa_family, times);
@@ -266,7 +266,8 @@ static int32_t do_bind(int32_t s, const struct sockaddr *name, socklen_t namelen
memcpy_s(sock_addr.u_addr.ip6.addr, IPV6_ADDR_LEN,
((struct sockaddr_in6 *)name)->sin6_addr.s6_addr, IPV6_ADDR_LEN);
}
-
+
+ /* TODO: if addr == 127.0.0.1, try kernel and lwip */
if (!match_host_addr(&sock_addr)) {
POSIX_SET_TYPE(sock, POSIX_KERNEL);
return posix_api->bind_fn(s, name, namelen);
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangchen555/gazelle_1.git
git@gitee.com:yangchen555/gazelle_1.git
yangchen555
gazelle_1
gazelle_1
master

搜索帮助