For NuttX OS: Made struct ip subject to configure

This commit is contained in:
Gerhard Rieger 2016-12-10 21:08:37 +01:00
parent 35590e3cdb
commit de80846643
4 changed files with 26 additions and 0 deletions

View file

@ -37,6 +37,10 @@ porting:
DTLSv1_client_method or DTLSv1_server_method.
Thanks to Simon Matter for sending a patch.
NuttX OS headers do not provide struct ip, thus socat did not compile.
Made struct ip subject to configure.
Thanks to SP for reporting this issue.
testing:
socks4echo.sh and socks4a-echo.sh hung with new bash with read -n

View file

@ -359,6 +359,9 @@
/* Define if you have struct linger */
#undef HAVE_STRUCT_LINGER
/* Define if you have struct ip */
#undef HAVE_STRUCT_IP
/* Define if you have struct ip_mreq */
#undef HAVE_STRUCT_IP_MREQ

View file

@ -1118,6 +1118,17 @@ fi
AC_MSG_RESULT($sc_cv_struct_linger)
# struct ip (for IPv4 header info)
AC_MSG_CHECKING(for struct ip)
AC_CACHE_VAL(sc_cv_struct_ip,
[AC_TRY_COMPILE([#include <netinet/ip.h>],[struct ip s;],
[sc_cv_struct_ip=yes],
[sc_cv_struct_ip=no])])
if test $sc_cv_struct_ip = yes; then
AC_DEFINE(HAVE_STRUCT_IP)
fi
AC_MSG_RESULT($sc_cv_struct_ip)
# struct ip_mreq (for multicasting options)
AC_MSG_CHECKING(for struct ip_mreq)
AC_CACHE_VAL(sc_cv_struct_ip_mreq,

View file

@ -221,9 +221,12 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) {
}
switch(from.soa.sa_family) {
#if HAVE_STRUCT_IP
int headlen;
#endif /* HAVE_STRUCT_IP */
#if WITH_IP4
case AF_INET:
#if HAVE_STRUCT_IP
if (pipe->dtype & XIOREAD_RECV_SKIPIP) {
/* IP4 raw sockets include the header when passing a packet to the
application - we don't need it here. */
@ -240,6 +243,7 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) {
bytes -= headlen;
}
}
#endif /* HAVE_STRUCT_IP */
break;
#endif
#if WITH_IP6
@ -357,9 +361,12 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) {
}
switch(from.soa.sa_family) {
#if HAVE_STRUCT_IP
int headlen;
#endif /* HAVE_STRUCT_IP */
#if WITH_IP4
case AF_INET:
#if HAVE_STRUCT_IP
if (pipe->dtype & XIOREAD_RECV_SKIPIP) {
/* IP4 raw sockets include the header when passing a packet to the
application - we don't need it here. */
@ -376,6 +383,7 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) {
bytes -= headlen;
}
}
#endif /* HAVE_STRUCT_IP */
break;
#endif
#if WITH_IP6