summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorGerald (Jerry) Carter <jerry@samba.org>2007-10-19 08:14:12 -0500
committerJeremy Allison <jra@samba.org>2007-10-19 13:09:26 -0700
commit620785df4e57b72471ff0315e22e0d2f28a2b1a5 (patch)
tree2b75d54ccbeec93e67a5a5b6ad77d84e69fbf7a3 /source
parent641d0968da73dca24a3ddaf93451de1200d3c09b (diff)
downloadsamba-620785df4e57b72471ff0315e22e0d2f28a2b1a5.tar.gz
samba-620785df4e57b72471ff0315e22e0d2f28a2b1a5.tar.xz
samba-620785df4e57b72471ff0315e22e0d2f28a2b1a5.zip
Add test for "struct in6_addr" to the HAVE_IPV6 configure test.
Also make use of "if defined(HAVE_IPV6)" rather than testing for AF_INET6 since this is not sufficient on HP-UX 11.11 to ensure a working IPv6 implementation.
Diffstat (limited to 'source')
-rw-r--r--source/configure.in1
-rw-r--r--source/lib/interface.c4
-rw-r--r--source/lib/interfaces.c4
-rw-r--r--source/lib/util_sock.c16
-rw-r--r--source/smbd/utmp.c2
5 files changed, 14 insertions, 13 deletions
diff --git a/source/configure.in b/source/configure.in
index 5d236237a19..a96e2d91f67 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -3038,6 +3038,7 @@ AC_TRY_COMPILE([
[
struct sockaddr_storage sa_store;
struct addrinfo *ai = NULL;
+struct in6_addr in6addr;
int s = socket(AF_INET6, SOCK_STREAM, 0);
int ret = getaddrinfo(NULL, NULL, NULL, &ai);
if (ret != 0) {
diff --git a/source/lib/interface.c b/source/lib/interface.c
index 4892ec12486..0696329fd66 100644
--- a/source/lib/interface.c
+++ b/source/lib/interface.c
@@ -339,7 +339,7 @@ bool make_netmask(struct sockaddr_storage *pss_out,
{
*pss_out = *pss_in;
/* Now apply masklen bits of mask. */
-#if defined(AF_INET6)
+#if defined(HAVE_IPV6)
if (pss_in->ss_family == AF_INET6) {
char *p = (char *)&((struct sockaddr_in6 *)pss_out)->sin6_addr;
unsigned int i;
@@ -386,7 +386,7 @@ static void make_bcast_or_net(struct sockaddr_storage *pss_out,
*pss_out = *pss_in;
/* Set all zero netmask bits to 1. */
-#if defined(AF_INET6)
+#if defined(HAVE_IPV6)
if (pss_in->ss_family == AF_INET6) {
p = (char *)&((struct sockaddr_in6 *)pss_out)->sin6_addr;
pmask = (char *)&((struct sockaddr_in6 *)nmask)->sin6_addr;
diff --git a/source/lib/interfaces.c b/source/lib/interfaces.c
index 2b93a5ba391..3b15e3e87b9 100644
--- a/source/lib/interfaces.c
+++ b/source/lib/interfaces.c
@@ -128,7 +128,7 @@ static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces)
continue;
}
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
if (ifptr->ifa_addr->sa_family == AF_INET6) {
copy_size = sizeof(struct sockaddr_in6);
}
@@ -496,7 +496,7 @@ static int iface_comp(struct iface_struct *i1, struct iface_struct *i2)
{
int r;
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
/*
* If we have IPv6 - sort these interfaces lower
* than any IPv4 ones.
diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c
index eb3b35339c1..c6b1311cf5b 100644
--- a/source/lib/util_sock.c
+++ b/source/lib/util_sock.c
@@ -52,7 +52,7 @@ bool is_ipaddress(const char *str)
{
int ret = -1;
-#if defined(AF_INET6)
+#if defined(HAVE_IPV6)
struct in6_addr dest6;
ret = inet_pton(AF_INET6, str, &dest6);
@@ -212,7 +212,7 @@ bool is_loopback_ip_v4(struct in_addr ip)
bool is_loopback_addr(const struct sockaddr_storage *pss)
{
-#if defined(AF_INET6)
+#if defined(HAVE_IPV6)
if (pss->ss_family == AF_INET) {
struct in6_addr *pin6 =
&((struct sockaddr_in6 *)pss)->sin6_addr;
@@ -243,7 +243,7 @@ bool is_zero_ip_v4(struct in_addr ip)
bool is_zero_addr(const struct sockaddr_storage *pss)
{
-#if defined(AF_INET6)
+#if defined(HAVE_IPV6)
if (pss->ss_family == AF_INET) {
struct in6_addr *pin6 =
&((struct sockaddr_in6 *)pss)->sin6_addr;
@@ -302,7 +302,7 @@ void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
sa->sin_addr = ip;
}
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
/*******************************************************************
Convert an IPv6 struct in_addr to a struct sockaddr_storage.
********************************************************************/
@@ -330,7 +330,7 @@ bool same_net(const struct sockaddr_storage *ip1,
return false;
}
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
if (ip1->ss_family == AF_INET6) {
struct sockaddr_in6 ip1_6 = *(struct sockaddr_in6 *)ip1;
struct sockaddr_in6 ip2_6 = *(struct sockaddr_in6 *)ip2;
@@ -370,7 +370,7 @@ bool addr_equal(const struct sockaddr_storage *ip1,
return false;
}
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
if (ip1->ss_family == AF_INET6) {
return (memcmp(&((const struct sockaddr_in6 *)ip1)->sin6_addr,
&((const struct sockaddr_in6 *)ip2)->sin6_addr,
@@ -392,7 +392,7 @@ bool addr_equal(const struct sockaddr_storage *ip1,
bool is_address_any(const struct sockaddr_storage *psa)
{
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
if (psa->ss_family == AF_INET6) {
struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)psa;
if (memcmp(&in6addr_any,
@@ -494,7 +494,7 @@ static int get_socket_port(int fd)
return -1;
}
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
if (sa.ss_family == AF_INET6) {
return ntohs(((struct sockaddr_in6 *)&sa)->sin6_port);
}
diff --git a/source/smbd/utmp.c b/source/smbd/utmp.c
index e36e2aa042b..c2908e33cc1 100644
--- a/source/smbd/utmp.c
+++ b/source/smbd/utmp.c
@@ -525,7 +525,7 @@ static bool sys_utmp_fill(struct utmp *u,
#if defined(HAVE_UT_UT_HOST)
utmp_strcpy(u->ut_host, hostname, sizeof(u->ut_host));
#endif
-#if defined(AF_INET6) && defined(HAVE_UT_UT_ADDR_V6)
+#if defined(HAVE_IPV6) && defined(HAVE_UT_UT_ADDR_V6)
memset(&u->ut_addr_v6, '\0', sizeof(u->ut_addr_v6));
if (ip_addr_str) {
struct in6_addr addr;