|
@@ -52,6 +52,7 @@
|
|
|
#include <ifaddrs.h>
|
|
#include <ifaddrs.h>
|
|
|
|
|
|
|
|
#include <corosync/totem/totemip.h>
|
|
#include <corosync/totem/totemip.h>
|
|
|
|
|
+#include <corosync/logsys.h>
|
|
|
#include <corosync/swab.h>
|
|
#include <corosync/swab.h>
|
|
|
|
|
|
|
|
#define LOCALHOST_IPV4 "127.0.0.1"
|
|
#define LOCALHOST_IPV4 "127.0.0.1"
|
|
@@ -289,6 +290,7 @@ int totemip_parse(struct totem_ip_address *totemip, const char *addr, int family
|
|
|
struct sockaddr_in *sa;
|
|
struct sockaddr_in *sa;
|
|
|
struct sockaddr_in6 *sa6;
|
|
struct sockaddr_in6 *sa6;
|
|
|
int ret;
|
|
int ret;
|
|
|
|
|
+ int debug_ip_family;
|
|
|
|
|
|
|
|
memset(&ahints, 0, sizeof(ahints));
|
|
memset(&ahints, 0, sizeof(ahints));
|
|
|
ahints.ai_socktype = SOCK_DGRAM;
|
|
ahints.ai_socktype = SOCK_DGRAM;
|
|
@@ -306,8 +308,18 @@ int totemip_parse(struct totem_ip_address *totemip, const char *addr, int family
|
|
|
} else {
|
|
} else {
|
|
|
ret = getaddrinfo(addr, NULL, &ahints, &ainfo);
|
|
ret = getaddrinfo(addr, NULL, &ahints, &ainfo);
|
|
|
}
|
|
}
|
|
|
- if (ret)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ debug_ip_family = 4;
|
|
|
|
|
+ if (ahints.ai_family == AF_INET6) {
|
|
|
|
|
+ debug_ip_family = 6;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (ret) {
|
|
|
|
|
+ log_printf (LOGSYS_LEVEL_DEBUG, "totemip_parse: IPv%u address of %s not resolvable",
|
|
|
|
|
+ debug_ip_family, addr);
|
|
|
|
|
+
|
|
|
return -1;
|
|
return -1;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
sa = (struct sockaddr_in *)ainfo->ai_addr;
|
|
sa = (struct sockaddr_in *)ainfo->ai_addr;
|
|
|
sa6 = (struct sockaddr_in6 *)ainfo->ai_addr;
|
|
sa6 = (struct sockaddr_in6 *)ainfo->ai_addr;
|
|
@@ -318,6 +330,9 @@ int totemip_parse(struct totem_ip_address *totemip, const char *addr, int family
|
|
|
else
|
|
else
|
|
|
memcpy(totemip->addr, &sa6->sin6_addr, sizeof(struct in6_addr));
|
|
memcpy(totemip->addr, &sa6->sin6_addr, sizeof(struct in6_addr));
|
|
|
|
|
|
|
|
|
|
+ log_printf (LOGSYS_LEVEL_DEBUG, "totemip_parse: IPv%u address of %s resolved as %s",
|
|
|
|
|
+ debug_ip_family, addr, totemip_print(totemip));
|
|
|
|
|
+
|
|
|
freeaddrinfo(ainfo);
|
|
freeaddrinfo(ainfo);
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|