added the check for struct ip_mreqn

This commit is contained in:
hyung-hwan 2021-08-17 17:49:09 +00:00
parent 914a0c3905
commit 6767e34768
4 changed files with 29 additions and 1 deletions

14
hio/configure vendored
View File

@ -16307,6 +16307,20 @@ _ACEOF
fi
ac_fn_c_check_type "$LINENO" "struct ip_mreqn" "ac_cv_type_struct_ip_mreqn" "#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
"
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

View File

@ -352,6 +352,11 @@ AC_CHECK_TYPES([struct timespec], [], [],
#include <sys/time.h>
#endif])
AC_CHECK_TYPES([struct ip_mreqn], [], [],
[#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>])
AC_MSG_CHECKING([for va_copy])
AC_TRY_LINK(
[#include <stdarg.h>],

View File

@ -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

View File

@ -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;
}