1 Star 0 Fork 32

LemmyHuang/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0112-listen_shadow-support-ipv6.patch 1.87 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2024-01-20 14:40 . sync adpat dpdk 23.11
From 0fddaa74aa71ec25ee9cb1db141dd8a778e6e76d Mon Sep 17 00:00:00 2001
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
Date: Mon, 8 Jan 2024 15:08:24 +0800
Subject: [PATCH] listen_shadow support ipv6
---
src/lstack/core/lstack_protocol_stack.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index f849bcd..e7b541e 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -1128,9 +1128,15 @@ int32_t stack_single_listen(int32_t fd, int32_t backlog)
/* listen sync to all protocol stack thread, so that any protocol stack thread can build connect */
int32_t stack_broadcast_listen(int32_t fd, int32_t backlog)
{
+ typedef union sockaddr_union {
+ struct sockaddr sa;
+ struct sockaddr_in in;
+ struct sockaddr_in6 in6;
+ } sockaddr_t;
+
struct protocol_stack *cur_stack = get_protocol_stack_by_fd(fd);
struct protocol_stack *stack = NULL;
- struct sockaddr addr;
+ sockaddr_t addr;
socklen_t addr_len = sizeof(addr);
int32_t ret, clone_fd;
@@ -1140,7 +1146,7 @@ int32_t stack_broadcast_listen(int32_t fd, int32_t backlog)
GAZELLE_RETURN(EINVAL);
}
- ret = rpc_call_getsockname(fd, &addr, &addr_len);
+ ret = rpc_call_getsockname(fd, (struct sockaddr *)&addr, &addr_len);
if (ret != 0) {
return ret;
}
@@ -1154,7 +1160,7 @@ int32_t stack_broadcast_listen(int32_t fd, int32_t backlog)
continue;
}
if (stack != cur_stack) {
- clone_fd = rpc_call_shadow_fd(stack, fd, &addr, sizeof(addr));
+ clone_fd = rpc_call_shadow_fd(stack, fd, (struct sockaddr *)&addr, addr_len);
if (clone_fd < 0) {
stack_broadcast_close(fd);
return clone_fd;
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/LemmyHuang/gazelle_1.git
git@gitee.com:LemmyHuang/gazelle_1.git
LemmyHuang
gazelle_1
gazelle_1
master

搜索帮助