28 lines
896 B
Diff
28 lines
896 B
Diff
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
|
|
|