diff options
author | Nithin D <nithind1988@yahoo.in> | 2015-11-15 22:14:43 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-02-20 09:16:42 -0800 |
commit | 46bd29e0f2a7fc9278068a06d12066d614f365ec (patch) | |
tree | 52cbc91d42b513d9d128dc23ac7d47fa1cb5211e /libglusterfs/src/common-utils.c | |
parent | 759b63536c676f4b4fa135ea62d74dff021778e4 (diff) |
glusterd: Bug fixes for IPv6 support
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: Ran manually till tests/basic/rpm.t .
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
Unit Tests using Ipv6
peer probe
add-bricks
remove-bricks
create volume
replace-bricks
start volume
stop volume
delete volume
Change-Id: Iebc96e6cce748b5924ce5da17b0114600ec70a6e
BUG: 1117886
Signed-off-by: Nithin D <nithind1988@yahoo.in>
Reviewed-on: http://review.gluster.org/11988
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>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r-- | libglusterfs/src/common-utils.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index cf5b524dc12..a1b67596c6e 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -55,11 +55,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) { @@ -288,9 +283,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) { @@ -2321,6 +2313,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; @@ -3247,9 +3247,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, @@ -3289,15 +3298,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)); |