diff --git a/CHANGES b/CHANGES index c6cb959..67e91da 100644 --- a/CHANGES +++ b/CHANGES @@ -104,6 +104,10 @@ porting: Cedril Priscal ported socat to Android (using Googles cross compiler). The port includes the socat_buildscript_for_android.sh script + + added check for component ipi_spec_dst in struct in_pktinfo so + compilation does not fail on Cygwin (thanks to Peter Wagemans for + reporting this problem) ####################### V 2.0.0-b7: diff --git a/config.h.in b/config.h.in index f299dff..978328f 100644 --- a/config.h.in +++ b/config.h.in @@ -363,6 +363,9 @@ /* define if you have struct in_pktinfo */ #undef HAVE_STRUCT_IN_PKTINFO + +/* define if your struct in_pktinfo has component ipi_spec_dst */ +#undef HAVE_PKTINFO_IPI_SPEC_DST /* define if your struct ip has ip_hl; otherwise assume ip_vhl */ #undef HAVE_STRUCT_IP_IP_HL diff --git a/configure.in b/configure.in index b15dcf3..f9f0206 100644 --- a/configure.in +++ b/configure.in @@ -1176,6 +1176,21 @@ if test $sc_cv_struct_in_pktinfo = yes; then AC_DEFINE(HAVE_STRUCT_IN_PKTINFO) fi AC_MSG_RESULT($sc_cv_struct_in_pktinfo) + +if test $sc_cv_struct_in_pktinfo = 'yes'; then + dnl check for component ipi_spec_dst in struct in_pktinfo + AC_MSG_CHECKING(for ipi_spec_dst in struct in_pktinfo) + AC_CACHE_VAL(sc_cv_pktinfo_ipi_spec_dst, + [AC_TRY_COMPILE([#include + #include + #include ],[struct in_pktinfo s; s.ipi_spec_dst], + [sc_cv_pktinfo_ipi_spec_dst=yes], + [sc_cv_pktinfo_ipi_spec_dst=no])]) + if test $sc_cv_pktinfo_ipi_spec_dst = yes; then + AC_DEFINE(HAVE_PKTINFO_IPI_SPEC_DST) + fi + AC_MSG_RESULT($sc_cv_pktinfo_ipi_spec_dst) +fi dnl check for ip_hl in struct ip AC_MSG_CHECKING(for struct ip.ip_hl) diff --git a/xio-ip.c b/xio-ip.c index 58b98c2..bc2da84 100644 --- a/xio-ip.c +++ b/xio-ip.c @@ -477,8 +477,15 @@ int xiolog_ancillary_ip(struct cmsghdr *cmsg, int *num, "IP_LOCADDR", '\0', "IP_DSTADDR"); snprintf(valbuff, vallen, "%s%c%s%c%s", xiogetifname(pktinfo->ipi_ifindex, scratch1, -1), '\0', - inet4addr_info(ntohl(pktinfo->ipi_spec_dst.s_addr), scratch2, sizeof(scratch2)), '\0', - inet4addr_info(ntohl(pktinfo->ipi_addr.s_addr), scratch3, sizeof(scratch3))); +#if HAVE_PKTINFO_IPI_SPEC_DST + inet4addr_info(ntohl(pktinfo->ipi_spec_dst.s_addr), + scratch2, sizeof(scratch2)), +#else + "", +#endif + '\0', + inet4addr_info(ntohl(pktinfo->ipi_addr.s_addr), + scratch3, sizeof(scratch3))); } return STAT_OK; #endif /* defined(IP_PKTINFO) && HAVE_STRUCT_IN_PKTINFO */ diff --git a/xioopts.h b/xioopts.h index b52056a..6a9f006 100644 --- a/xioopts.h +++ b/xioopts.h @@ -712,7 +712,9 @@ enum e_optcode { # undef ENABLE_OPTCODE OPT_SUBSTUSER_EARLY, OPT_SUBSTUSER, +#if defined(HAVE_SETGRENT) && defined(HAVE_GETGRENT) && defined(HAVE_ENDGRENT) OPT_SUBSTUSER_DELAYED, +#endif OPT_SYMBOLIC_LINK, /* with pty */ #ifdef TABDLY # ifdef TAB0