diff --git a/hio/configure b/hio/configure index b41a0d0..0d24aeb 100755 --- a/hio/configure +++ b/hio/configure @@ -16307,6 +16307,20 @@ _ACEOF fi +ac_fn_c_check_type "$LINENO" "struct ip_mreqn" "ac_cv_type_struct_ip_mreqn" "#include + #include + #include +" +if test "x$ac_cv_type_struct_ip_mreqn" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IP_MREQN 1 +_ACEOF + + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5 $as_echo_n "checking for va_copy... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/hio/configure.ac b/hio/configure.ac index 779d657..16d7ce9 100644 --- a/hio/configure.ac +++ b/hio/configure.ac @@ -352,6 +352,11 @@ AC_CHECK_TYPES([struct timespec], [], [], #include #endif]) +AC_CHECK_TYPES([struct ip_mreqn], [], [], + [#include + #include + #include ]) + AC_MSG_CHECKING([for va_copy]) AC_TRY_LINK( [#include ], diff --git a/hio/lib/hio-cfg.h.in b/hio/lib/hio-cfg.h.in index 27fc13d..c4e8ded 100644 --- a/hio/lib/hio-cfg.h.in +++ b/hio/lib/hio-cfg.h.in @@ -352,6 +352,9 @@ /* Define to 1 if the system has the type `struct if_laddrreq'. */ #undef HAVE_STRUCT_IF_LADDRREQ +/* Define to 1 if the system has the type `struct ip_mreqn'. */ +#undef HAVE_STRUCT_IP_MREQN + /* Define to 1 if the system has the type `struct lifconf'. */ #undef HAVE_STRUCT_LIFCONF diff --git a/hio/lib/sck.c b/hio/lib/sck.c index 4677f06..960405c 100644 --- a/hio/lib/sck.c +++ b/hio/lib/sck.c @@ -2518,11 +2518,17 @@ static int update_mcast_group (hio_dev_sck_t* dev, int join, const hio_skad_t* m case HIO_AF_INET: { /* TODO: if ip_mreqn doesn't exist, get the ip address of the index and set to imr_address */ + #if defined(HAVE_STRUCT_IP_MREQN) struct ip_mreqn mreq; + #else + struct ip_mreq mreq; + #endif HIO_MEMSET (&mreq, 0, HIO_SIZEOF(mreq)); hio_skad_get_ipad_bytes (mcast_skad, &mreq.imr_multiaddr, HIO_SIZEOF(mreq.imr_multiaddr)); + /*mreq.imr_address = TODO: fill it will the ifindex's ip address */ + #if defined(HAVE_STRUCT_IP_MREQN) mreq.imr_ifindex = ifindex; - /*mreq.imr_address = */ + #endif if (hio_dev_sck_setsockopt(dev, IPPROTO_IP, (join? IP_ADD_MEMBERSHIP: IP_DROP_MEMBERSHIP), &mreq, HIO_SIZEOF(mreq)) <= -1) return -1; return 0; }