summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorNithin D <nithind1988@yahoo.in>2016-02-28 21:45:48 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-03-21 10:52:50 -0700
commitb33f3c95ec9c8112e6677e09cea05c4c462040d0 (patch)
tree969d994858a49fc3d2fa32ff68b5e71909045918 /libglusterfs
parent3e5445ae7d1dbbcc138374b6d2e5f95ffc556f4b (diff)
glusterd: Bug fixes for IPv6 support
Backport of http://review.gluster.org/#/c/11988/ Problem: Glusterd not working using ipv6 transport. The idea is with proper glusterd.vol configuration, 1. glusterd needs to listen on default port (240007) as IPv6 TCP listner. 2. Volume creation/deletion/mounting/add-bricks/delete-bricks/peer-probe needs to work using ipv6 addresses. 3. Bricks needs to listen on ipv6 addresses. All the above functionality is needed to say that glusterd supports ipv6 transport and this is broken. Fix: When "option transport.address-family inet6" option is present in glusterd.vol file, it is made sure that glusterd creates listeners using ipv6 sockets only and also the same information is saved inside brick volume files used by glusterfsd brick process when they are starting. Tests Run: Regression tests using ./run-tests.sh IPv4: Regression tests using ./run-tests.sh for release-3.7 branch verified by comparing with clean repo. IPv6: (Need to add the above mentioned config and also add an entry for "hostname ::1" in /etc/hosts) Started failing at ./tests/basic/glusterd/arbiter-volume-probe.t and ran successfully till here Change-Id: Idd7513aa2347ce0de2b1f68daeecce1b7a39a7af BUG: 1310445 Signed-off-by: Nithin D <nithind1988@yahoo.in> Reviewed-on: http://review.gluster.org/13787 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c35
-rw-r--r--libglusterfs/src/common-utils.h6
2 files changed, 30 insertions, 11 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 81e01bf..e3293dc 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -59,11 +59,6 @@
typedef int32_t (*rw_op_t)(int32_t fd, char *buf, int32_t size);
typedef int32_t (*rwv_op_t)(int32_t fd, const struct iovec *buf, int32_t size);
-struct dnscache6 {
- struct addrinfo *first;
- struct addrinfo *next;
-};
-
void
md5_wrapper(const unsigned char *data, size_t len, char *md5)
{
@@ -292,9 +287,6 @@ gf_resolve_ip6 (const char *hostname,
memset(&hints, 0, sizeof(hints));
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
-#ifndef __NetBSD__
- hints.ai_flags = AI_ADDRCONFIG;
-#endif
ret = gf_asprintf (&port_str, "%d", port);
if (-1 == ret) {
@@ -2193,6 +2185,14 @@ valid_ipv6_address (char *address, int length, gf_boolean_t wildcard_acc)
tmp = gf_strdup (address);
+ /* Check for '%' for link local addresses */
+ endptr = strchr(tmp, '%');
+ if (endptr) {
+ *endptr = '\0';
+ length = strlen(tmp);
+ endptr = NULL;
+ }
+
/* Check for compressed form */
if (length <= 0 || tmp[length - 1] == ':') {
ret = 0;
@@ -3118,9 +3118,18 @@ gf_is_local_addr (char *hostname)
gf_boolean_t found = _gf_false;
char *ip = NULL;
xlator_t *this = NULL;
+ struct addrinfo hints;
this = THIS;
- ret = getaddrinfo (hostname, NULL, NULL, &result);
+
+ memset (&hints, 0, sizeof (hints));
+ /*
+ * Removing AI_ADDRCONFIG from default_hints
+ * for being able to use link local ipv6 addresses
+ */
+ hints.ai_family = AF_UNSPEC;
+
+ ret = getaddrinfo (hostname, NULL, &hints, &result);
if (ret != 0) {
gf_msg (this->name, GF_LOG_ERROR, 0, LG_MSG_GETADDRINFO_FAILED,
@@ -3160,15 +3169,19 @@ gf_is_same_address (char *name1, char *name2)
struct addrinfo *q = NULL;
gf_boolean_t ret = _gf_false;
int gai_err = 0;
+ struct addrinfo hints;
+
+ memset (&hints, 0, sizeof (hints));
+ hints.ai_family = AF_UNSPEC;
- gai_err = getaddrinfo(name1,NULL,NULL,&addr1);
+ gai_err = getaddrinfo(name1, NULL, &hints, &addr1);
if (gai_err != 0) {
gf_msg (name1, GF_LOG_WARNING, 0, LG_MSG_GETADDRINFO_FAILED,
"error in getaddrinfo: %s\n", gai_strerror(gai_err));
goto out;
}
- gai_err = getaddrinfo(name2,NULL,NULL,&addr2);
+ gai_err = getaddrinfo(name2, NULL, &hints, &addr2);
if (gai_err != 0) {
gf_msg (name2, GF_LOG_WARNING, 0, LG_MSG_GETADDRINFO_FAILED,
"error in getaddrinfo: %s\n", gai_strerror(gai_err));
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index e374285..c152540 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -165,6 +165,12 @@ typedef struct dht_changelog_rename_info {
char buffer[1];
} dht_changelog_rename_info_t;
+struct dnscache6 {
+ struct addrinfo *first;
+ struct addrinfo *next;
+};
+
+
typedef int (*gf_cmp) (void *, void *);