diff --git a/CHANGES b/CHANGES index c465073..63945da 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/config.h.in b/config.h.in index 414379b..a3be40d 100644 --- a/config.h.in +++ b/config.h.in @@ -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 diff --git a/configure.in b/configure.in index 6db8709..0c8d5fa 100644 --- a/configure.in +++ b/configure.in @@ -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 ],[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, diff --git a/xioread.c b/xioread.c index f4dd8e6..24f3c88 100644 --- a/xioread.c +++ b/xioread.c @@ -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