1 Star 0 Fork 32

吴昌盛/gazelle-tar

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0195-adapt-unsupport-sock-optname.patch 1.91 KB
一键复制 编辑 原始数据 按行查看 历史
From 7a03877d6838498d82f0e506e02d4507efd047ac Mon Sep 17 00:00:00 2001
From: jiangheng12 <jiangheng14@huawei.com>
Date: Wed, 22 Feb 2023 21:38:32 +0800
Subject: [PATCH] adapt unsupport sock optname
---
src/lstack/api/lstack_wrap.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index d976f74..77d2442 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -19,11 +19,11 @@
#include <sys/socket.h>
#include <stdarg.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <sys/epoll.h>
#include <unistd.h>
#include <lwip/posix_api.h>
-#include <lwip/api.h>
#include <lwip/lwipsock.h>
#include "posix/lstack_epoll.h"
@@ -273,9 +273,21 @@ static inline int32_t do_getsockname(int32_t s, struct sockaddr *name, socklen_t
return posix_api->getsockname_fn(s, name, namelen);
}
+static bool unsupport_optname(int32_t optname)
+{
+ if (optname == SO_BROADCAST ||
+ optname == SO_PROTOCOL ||
+ optname == TCP_QUICKACK ||
+ optname == SO_SNDTIMEO ||
+ optname == SO_RCVTIMEO) {
+ return true;
+ }
+ return false;
+}
+
static inline int32_t do_getsockopt(int32_t s, int32_t level, int32_t optname, void *optval, socklen_t *optlen)
{
- if (select_path(s) == PATH_LWIP) {
+ if (select_path(s) == PATH_LWIP && !unsupport_optname(optname)) {
return rpc_call_getsockopt(s, level, optname, optval, optlen);
}
@@ -284,7 +296,7 @@ static inline int32_t do_getsockopt(int32_t s, int32_t level, int32_t optname, v
static inline int32_t do_setsockopt(int32_t s, int32_t level, int32_t optname, const void *optval, socklen_t optlen)
{
- if (select_path(s) == PATH_KERNEL) {
+ if (select_path(s) == PATH_KERNEL || unsupport_optname(optname)) {
return posix_api->setsockopt_fn(s, level, optname, optval, optlen);
}
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wu-changsheng/gazelle-tar.git
git@gitee.com:wu-changsheng/gazelle-tar.git
wu-changsheng
gazelle-tar
gazelle-tar
master

搜索帮助