port to Cygwin - struct pktinfo.ipi_spec_dst

This commit is contained in:
Gerhard Rieger 2011-11-22 11:24:35 +01:00
parent 26801266f2
commit 7a3ed71270
4 changed files with 34 additions and 5 deletions

View File

@ -57,6 +57,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 1.7.1.3:
security:

View File

@ -1,5 +1,5 @@
/* source: config.h.in */
/* Copyright Gerhard Rieger 2001-2009 */
/* Copyright Gerhard Rieger 2001-2011 */
/* Published under the GNU General Public License V.2, see file COPYING */
#ifndef __config_h_included
@ -364,6 +364,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

View File

@ -1,5 +1,5 @@
nl source: configure.in
dnl Copyright Gerhard Rieger 2001-2009
dnl Copyright Gerhard Rieger 2001-2011
dnl Published under the GNU General Public License V.2, see file COPYING
dnl Process this file with autoconf to produce a configure script.
@ -1161,6 +1161,21 @@ if test $sc_cv_struct_in_pktinfo = yes; then
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 <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],[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)
AC_CACHE_VAL(sc_cv_struct_ip_ip_hl,

View File

@ -1,5 +1,5 @@
/* source: xio-ip.c */
/* Copyright Gerhard Rieger 2001-2009 */
/* Copyright Gerhard Rieger 2001-2011 */
/* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the source for IP related functions */
@ -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 */