summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2005-03-15 22:41:02 +0000
committerpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2005-03-15 22:41:02 +0000
commite6604430e0de6cc9215d205f6b1502728b6b8da1 (patch)
tree5e24b47f61e1cd51e15e3b62c10b5b23ed661241
parent50c113d3e75648f5560849ca9a5ae682f5787015 (diff)
downloadlibapr-e6604430e0de6cc9215d205f6b1502728b6b8da1.tar.gz
Backport r153917 and r153932 from trunk. Build fixes for multicast on Tru64 and HP-UX.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.1.x@157601 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES2
-rw-r--r--build/apr_network.m416
-rw-r--r--configure.in1
-rw-r--r--include/apr_network_io.h4
-rw-r--r--network_io/unix/multicast.c16
5 files changed, 30 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index 201507917..4030d06c4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
Changes for APR 1.1.1
+ *) Build fix for Multicast support on HP-UX 11.00 and Tru64 [Joe Orton]
+
*) Fix libapr.rc for Win32 builds [William Rowe]
*) Rewrite apr_file_writev_full using apr_file_write_full. [Paul Querna]
diff --git a/build/apr_network.m4 b/build/apr_network.m4
index a16cf7930..0e1b09614 100644
--- a/build/apr_network.m4
+++ b/build/apr_network.m4
@@ -667,6 +667,22 @@ else
fi
])
+dnl APR_CHECK_MCAST: check for multicast interfaces
+AC_DEFUN([APR_CHECK_MCAST], [
+AC_CACHE_CHECK([for struct ip_mreq], [apr_cv_struct_ipmreq], [
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <netinet/in.h>
+], [
+ struct ip_mreq mip;
+ mip.imr_interface.s_addr = INADDR_ANY;
+], [apr_cv_struct_ipmreq=yes], [apr_cv_struct_ipmreq=no], [apr_cv_struct_ipmreq=yes])])
+
+if test $apr_cv_struct_ipmreq = yes; then
+ AC_DEFINE([HAVE_STRUCT_IPMREQ], 1, [Define if struct impreq was found])
+fi
+])
+
dnl
dnl APR_CHECK_H_ERRNO_FLAG
dnl
diff --git a/configure.in b/configure.in
index 72ced022e..1ed4f7d1c 100644
--- a/configure.in
+++ b/configure.in
@@ -1902,6 +1902,7 @@ else
fi
APR_CHECK_SCTP
+APR_CHECK_MCAST
AC_SUBST(apr_tcp_nopush_flag)
AC_SUBST(have_corkable_tcp)
diff --git a/include/apr_network_io.h b/include/apr_network_io.h
index 9df0ec29c..c7575d74f 100644
--- a/include/apr_network_io.h
+++ b/include/apr_network_io.h
@@ -770,14 +770,14 @@ APR_DECLARE(apr_status_t) apr_mcast_join(apr_socket_t *sock,
* Leave a Multicast Group. All arguments must be the same as
* apr_mcast_join.
* @param sock The socket to leave a multicast group
- * @param leave The address of the multicast group to leave
+ * @param addr The address of the multicast group to leave
* @param iface Address of the interface to use. If NULL is passed, the
* default multicast interface will be used. (OS Dependent)
* @param source Source Address to accept transmissions from (non-NULL
* implies Source-Specific Multicast)
*/
APR_DECLARE(apr_status_t) apr_mcast_leave(apr_socket_t *sock,
- apr_sockaddr_t *leave,
+ apr_sockaddr_t *addr,
apr_sockaddr_t *iface,
apr_sockaddr_t *source);
diff --git a/network_io/unix/multicast.c b/network_io/unix/multicast.c
index 695500f19..eb4304f07 100644
--- a/network_io/unix/multicast.c
+++ b/network_io/unix/multicast.c
@@ -24,6 +24,7 @@
#include <ifaddrs.h>
#endif
+#ifdef HAVE_STRUCT_IPMREQ
/* Only UDP and Raw Sockets can be used for Multicast */
static apr_status_t mcast_check_type(apr_socket_t *sock)
{
@@ -254,13 +255,14 @@ static apr_status_t do_mcast_opt(int type, apr_socket_t *sock,
return rv;
}
+#endif
APR_DECLARE(apr_status_t) apr_mcast_join(apr_socket_t *sock,
apr_sockaddr_t *join,
apr_sockaddr_t *iface,
apr_sockaddr_t *source)
{
-#ifdef IP_ADD_MEMBERSHIP
+#if defined(IP_ADD_MEMBERSHIP) && defined(HAVE_STRUCT_IPMREQ)
return do_mcast(IP_ADD_MEMBERSHIP, sock, join, iface, source);
#else
return APR_ENOTIMPL;
@@ -268,12 +270,12 @@ APR_DECLARE(apr_status_t) apr_mcast_join(apr_socket_t *sock,
}
APR_DECLARE(apr_status_t) apr_mcast_leave(apr_socket_t *sock,
- apr_sockaddr_t *leave,
+ apr_sockaddr_t *addr,
apr_sockaddr_t *iface,
apr_sockaddr_t *source)
{
-#ifdef IP_DROP_MEMBERSHIP
- return do_mcast(IP_DROP_MEMBERSHIP, sock, leave, iface, source);
+#if defined(IP_DROP_MEMBERSHIP) && defined(HAVE_STRUCT_IPMREQ)
+ return do_mcast(IP_DROP_MEMBERSHIP, sock, addr, iface, source);
#else
return APR_ENOTIMPL;
#endif
@@ -281,7 +283,7 @@ APR_DECLARE(apr_status_t) apr_mcast_leave(apr_socket_t *sock,
APR_DECLARE(apr_status_t) apr_mcast_hops(apr_socket_t *sock, apr_byte_t ttl)
{
-#ifdef IP_MULTICAST_TTL
+#if defined(IP_MULTICAST_TTL) && defined(HAVE_STRUCT_IPMREQ)
return do_mcast_opt(IP_MULTICAST_TTL, sock, ttl);
#else
return APR_ENOTIMPL;
@@ -291,7 +293,7 @@ APR_DECLARE(apr_status_t) apr_mcast_hops(apr_socket_t *sock, apr_byte_t ttl)
APR_DECLARE(apr_status_t) apr_mcast_loopback(apr_socket_t *sock,
apr_byte_t opt)
{
-#ifdef IP_MULTICAST_LOOP
+#if defined(IP_MULTICAST_LOOP) && defined(HAVE_STRUCT_IPMREQ)
return do_mcast_opt(IP_MULTICAST_LOOP, sock, opt);
#else
return APR_ENOTIMPL;
@@ -301,7 +303,7 @@ APR_DECLARE(apr_status_t) apr_mcast_loopback(apr_socket_t *sock,
APR_DECLARE(apr_status_t) apr_mcast_interface(apr_socket_t *sock,
apr_sockaddr_t *iface)
{
-#ifdef IP_MULTICAST_IF
+#if defined(IP_MULTICAST_IF) && defined(HAVE_STRUCT_IPMREQ)
apr_status_t rv = APR_SUCCESS;
if (sock_is_ipv4(sock)) {