1 Star 0 Fork 32

Ren Zhijie/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0003-set-localhost-ip-when-bind-ip-is-same-as-ip-in-lstac.patch 896 Bytes
一键复制 编辑 原始数据 按行查看 历史
From c13dd0c6ae71dd7547b9c1c6240585ae0f5c7c6b Mon Sep 17 00:00:00 2001
From: chengyechun <chengyechun1@huawei.com>
Date: Tue, 11 Jul 2023 10:57:35 +0800
Subject: [PATCH] set localhost ip when bind ip is same as ip in lstack.conf
---
src/lstack/api/lstack_wrap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 6a1a2c4..956d661 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -245,6 +245,10 @@ bool is_dst_ip_localhost(const struct sockaddr *addr)
char *p;
size_t linel = 0;
int linenum = 0;
+ if (get_global_cfg_params()->host_addr.addr == servaddr->sin_addr.s_addr) {
+ return true;
+ }
+
FILE *ifh = fopen("/proc/net/dev", "r");
if (ifh == NULL) {
LSTACK_LOG(ERR, LSTACK, "failed to open /proc/net/dev, errno is %d\n", errno);
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/byterzj/gazelle.git
git@gitee.com:byterzj/gazelle.git
byterzj
gazelle
gazelle
master

搜索帮助