[Bugs] [Bug 1739320] The result (hostname) of getnameinfo for all bricks (ipv6 addresses) are the same, while they are not.

bugzilla at redhat.com bugzilla at redhat.com
Fri Aug 16 20:52:30 UTC 2019


https://bugzilla.redhat.com/show_bug.cgi?id=1739320



--- Comment #8 from Amgad <amgad.saleh at nokia.com> ---
dig more in the glusterd-volume-ops.c file where the
"glusterd_compare_addrinfo" function is called by "glusterd_check_brick_order",
The following code which prepares what is passed to
"glusterd_compare_addrinfo", "getaddrinfo" doesn't seem to return the right
address.


    brick_list_dup = brick_list_ptr = gf_strdup(brick_list);
    /* Resolve hostnames and get addrinfo */
    while (i < brick_count) {
        ++i;
        brick = strtok_r(brick_list_dup, " \n", &tmpptr);
        brick_list_dup = tmpptr;
        if (brick == NULL)
            goto check_failed;
        brick = strtok_r(brick, ":", &tmpptr);
        if (brick == NULL)
            goto check_failed;
        ret = getaddrinfo(brick, NULL, NULL, &ai_info);
        if (ret != 0) {
            ret = 0;
            gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_HOSTNAME_RESOLVE_FAIL,
                   "unable to resolve "
                   "host name");
            goto out;
        }
        ai_list_tmp1 = MALLOC(sizeof(addrinfo_list_t));
        if (ai_list_tmp1 == NULL) {
            ret = 0;
            gf_msg(this->name, GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY,
                   "failed to allocate "
                   "memory");
            freeaddrinfo(ai_info);
            goto out;
        }
        ai_list_tmp1->info = ai_info;
        cds_list_add_tail(&ai_list_tmp1->list, &ai_list->list);
        ai_list_tmp1 = NULL;
    }

I wrote a small program to call it and it always returns --> "0.0.0.0", so
maybe that's why later the code assumes it's the same host.
It works though for IPv4. Also, have to loop thru the list to get the right
address.


I'll dig more, but I hope that gives some direction to other developers to
check

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list