8 Star 0 Fork 5

src-anolis-os/glusterfs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0294-eventsapi-Set-IPv4-IPv6-family-based-on-input-IP.patch 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:34 . import glusterfs-6.0-20.el8.src.rpm
From 2fa5476b95d4547bdde50f2281bf58b7db24e37a Mon Sep 17 00:00:00 2001
From: Aravinda VK <[email protected]>
Date: Mon, 16 Sep 2019 10:04:26 +0530
Subject: [PATCH 294/297] eventsapi: Set IPv4/IPv6 family based on input IP
server.sin_family was set to AF_INET while creating socket connection,
this was failing if the input address is IPv6(`::1`).
With this patch, sin_family is set by reading the ai_family of
`getaddrinfo` result.
> upstream patch : https://review.gluster.org/#/c/glusterfs/+/23423/
>Fixes: bz#1752330
>Change-Id: I499f957b432842fa989c698f6e5b25b7016084eb
>Signed-off-by: Aravinda VK <[email protected]>
BUG: 1732443
Change-Id: I499f957b432842fa989c698f6e5b25b7016084eb
Signed-off-by: Aravinda VK <[email protected]>
Reviewed-on: https://code.engineering.redhat.com/gerrit/181197
Tested-by: RHGS Build Bot <[email protected]>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <[email protected]>
---
libglusterfs/src/events.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libglusterfs/src/events.c b/libglusterfs/src/events.c
index 2509767..9d33783 100644
--- a/libglusterfs/src/events.c
+++ b/libglusterfs/src/events.c
@@ -42,6 +42,7 @@ _gf_event(eventtypes_t event, const char *fmt, ...)
struct addrinfo hints;
struct addrinfo *result = NULL;
xlator_t *this = THIS;
+ int sin_family = AF_INET;
/* Global context */
ctx = THIS->ctx;
@@ -75,13 +76,15 @@ _gf_event(eventtypes_t event, const char *fmt, ...)
ret = EVENT_ERROR_RESOLVE;
goto out;
}
+
+ sin_family = result->ai_family;
} else {
/* Localhost, Use the defined IP for localhost */
host = gf_strdup(EVENT_HOST);
}
/* Socket Configurations */
- server.sin_family = AF_INET;
+ server.sin_family = sin_family;
server.sin_port = htons(EVENT_PORT);
ret = inet_pton(server.sin_family, host, &server.sin_addr);
if (ret <= 0) {
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/glusterfs.git
[email protected]:src-anolis-os/glusterfs.git
src-anolis-os
glusterfs
glusterfs
a8

搜索帮助