From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx> Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx> --- :100644 100644 884055a... 4bd9ca4... M configure.ac :100644 100644 2f9203a... e0c7317... M exec/totemip.c configure.ac | 10 +++++++++- exec/totemip.c | 34 ++++++++++++++-------------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 884055a..4bd9ca4 100644 --- a/configure.ac +++ b/configure.ac @@ -94,7 +94,15 @@ AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdint.h \ stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h \ sys/time.h syslog.h unistd.h sys/types.h getopt.h malloc.h \ - sys/sockio.h utmpx.h ifaddrs.h stddef.h sys/file.h]) + sys/sockio.h utmpx.h ifaddrs.h stddef.h sys/file.h \ + net/if_var.h netinet/in_var.h netinet/in.h]) + +AC_CHECK_MEMBER([struct sockaddr_in.sin_len], + [AC_DEFINE_UNQUOTED([HAVE_SOCK_SIN_LEN], [1], [sockaddr_in needs sin_len])], + [], [[#include <netinet/in.h>]]) +AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len], + [AC_DEFINE_UNQUOTED([HAVE_SOCK_SIN6_LEN], [1], [sockaddr_in6 needs sin6_len])], + [], [[#include <netinet/in.h>]]) # Checks for typedefs. AC_TYPE_UID_T diff --git a/exec/totemip.c b/exec/totemip.c index 2f9203a..e0c7317 100644 --- a/exec/totemip.c +++ b/exec/totemip.c @@ -43,32 +43,26 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> -#if defined(COROSYNC_SOLARIS) #include <net/if.h> -#include <sys/sockio.h> -#endif -#if defined(COROSYNC_BSD) || defined(COROSYNC_DARWIN) -#include <sys/sockio.h> -#include <net/if.h> -#include <net/if_var.h> -#include <netinet/in_var.h> -#include <netinet/in.h> -#include <ifaddrs.h> -#endif #include <string.h> #include <stdio.h> #include <errno.h> #include <assert.h> #include <stdlib.h> #include <unistd.h> - -#if defined(COROSYNC_LINUX) -#include <net/if.h> -#include <asm/types.h> -#include <linux/rtnetlink.h> +#ifdef HAVE_SYS_SOCKIO_H +#include <sys/sockio.h> #endif - -#ifdef HAVE_GETIFADDRS +#ifdef HAVE_NET_IF_VAR_H +#include <net/if_var.h> +#endif +#ifdef HAVE_NETINET_IN_VAR_H +#include <netinet/in_var.h> +#endif +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#ifdef HAVE_IFADDRS_H #include <ifaddrs.h> #endif @@ -249,7 +243,7 @@ int totemip_totemip_to_sockaddr_convert(struct totem_ip_address *ip_addr, struct sockaddr_in *sin = (struct sockaddr_in *)saddr; memset(sin, 0, sizeof(struct sockaddr_in)); -#if defined(COROSYNC_BSD) || defined(COROSYNC_DARWIN) +#ifdef HAVE_SOCK_SIN_LEN sin->sin_len = sizeof(struct sockaddr_in); #endif sin->sin_family = ip_addr->family; @@ -263,7 +257,7 @@ int totemip_totemip_to_sockaddr_convert(struct totem_ip_address *ip_addr, struct sockaddr_in6 *sin = (struct sockaddr_in6 *)saddr; memset(sin, 0, sizeof(struct sockaddr_in6)); -#if defined(COROSYNC_BSD) || defined(COROSYNC_DARWIN) +#ifdef HAVE_SOCK_SIN6_LEN sin->sin6_len = sizeof(struct sockaddr_in6); #endif sin->sin6_family = ip_addr->family; -- 1.7.7.6 _______________________________________________ discuss mailing list discuss@xxxxxxxxxxxx http://lists.corosync.org/mailman/listinfo/discuss