summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 27493a53928..156e262ab16 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -87,6 +87,7 @@ glusterd_is_local_addr (char *hostname)
struct addrinfo *res = NULL;
int32_t found = 0;
struct ifconf buf = {0,};
+ char nodename[256] = {0,};
if ((!strcmp (hostname, "localhost")) ||
(!strcmp (hostname, "127.0.0.1"))) {
@@ -94,6 +95,15 @@ glusterd_is_local_addr (char *hostname)
goto out;
}
+ ret = gethostname (nodename, 256);
+ if (ret)
+ goto out;
+
+ if ((!strcmp (nodename, hostname))) {
+ found = 1;
+ goto out;
+ }
+
ret = getaddrinfo (hostname, NULL, NULL, &result);
if (ret != 0) {