74b1de
From 2fa5476b95d4547bdde50f2281bf58b7db24e37a Mon Sep 17 00:00:00 2001
74b1de
From: Aravinda VK <avishwan@redhat.com>
74b1de
Date: Mon, 16 Sep 2019 10:04:26 +0530
74b1de
Subject: [PATCH 294/297] eventsapi: Set IPv4/IPv6 family based on input IP
74b1de
74b1de
server.sin_family was set to AF_INET while creating socket connection,
74b1de
this was failing if the input address is IPv6(`::1`).
74b1de
74b1de
With this patch, sin_family is set by reading the ai_family of
74b1de
`getaddrinfo` result.
74b1de
74b1de
> upstream patch : https://review.gluster.org/#/c/glusterfs/+/23423/
74b1de
74b1de
>Fixes: bz#1752330
74b1de
>Change-Id: I499f957b432842fa989c698f6e5b25b7016084eb
74b1de
>Signed-off-by: Aravinda VK <avishwan@redhat.com>
74b1de
74b1de
BUG: 1732443
74b1de
Change-Id: I499f957b432842fa989c698f6e5b25b7016084eb
74b1de
Signed-off-by: Aravinda VK <avishwan@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/181197
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
74b1de
---
74b1de
 libglusterfs/src/events.c | 5 ++++-
74b1de
 1 file changed, 4 insertions(+), 1 deletion(-)
74b1de
74b1de
diff --git a/libglusterfs/src/events.c b/libglusterfs/src/events.c
74b1de
index 2509767..9d33783 100644
74b1de
--- a/libglusterfs/src/events.c
74b1de
+++ b/libglusterfs/src/events.c
74b1de
@@ -42,6 +42,7 @@ _gf_event(eventtypes_t event, const char *fmt, ...)
74b1de
     struct addrinfo hints;
74b1de
     struct addrinfo *result = NULL;
74b1de
     xlator_t *this = THIS;
74b1de
+    int sin_family = AF_INET;
74b1de
 
74b1de
     /* Global context */
74b1de
     ctx = THIS->ctx;
74b1de
@@ -75,13 +76,15 @@ _gf_event(eventtypes_t event, const char *fmt, ...)
74b1de
             ret = EVENT_ERROR_RESOLVE;
74b1de
             goto out;
74b1de
         }
74b1de
+
74b1de
+        sin_family = result->ai_family;
74b1de
     } else {
74b1de
         /* Localhost, Use the defined IP for localhost */
74b1de
         host = gf_strdup(EVENT_HOST);
74b1de
     }
74b1de
 
74b1de
     /* Socket Configurations */
74b1de
-    server.sin_family = AF_INET;
74b1de
+    server.sin_family = sin_family;
74b1de
     server.sin_port = htons(EVENT_PORT);
74b1de
     ret = inet_pton(server.sin_family, host, &server.sin_addr);
74b1de
     if (ret <= 0) {
74b1de
-- 
74b1de
1.8.3.1
74b1de