diff --git a/configure.in b/configure.in index 53b83ace..4715295c 100644 --- a/configure.in +++ b/configure.in @@ -343,6 +343,25 @@ AC_MSG_RESULT([$sctp_connectx_new]) if [[ "x$sctp_connectx_new" = "xyes" ]]; then SCTP_FLAGS="$SCTP_FLAGS -DHAVE_SCTP_CONNECTX_4" fi +AC_MSG_CHECKING([whether sctp_sack_info struct is present]) +AC_TRY_COMPILE([#include +#include +#include +#include ],[struct sctp_sack_info assoc_value;],[sctp_sack_info=yes]) +AC_MSG_RESULT([$sctp_sack_info]) +if [[ "x$sctp_sack_info" = "xyes" ]]; then +SCTP_FLAGS="$SCTP_FLAGS -DHAVE_SACK_INFO_STRUCT" +else +AC_MSG_CHECKING([whether sctp_assoc_value struct is present]) +AC_TRY_COMPILE([#include +#include +#include +#include ],[struct sctp_assoc_value assoc_value;],[sctp_assoc_value=yes]) +AC_MSG_RESULT([$sctp_assoc_value]) +if [[ "x$sctp_assoc_value" = "xyes" ]]; then +SCTP_FLAGS="$SCTP_FLAGS -DHAVE_ASSOC_VALUE_STRUCT" +fi +fi else if [[ "x$HAVE_SCTP" != "xno" ]]; then SCTP_FLAGS="-DHAVE_SCTP" diff --git a/modules/server/lksctp.cpp b/modules/server/lksctp.cpp index a5524874..4048084f 100644 --- a/modules/server/lksctp.cpp +++ b/modules/server/lksctp.cpp @@ -257,8 +257,9 @@ bool LKSocket::setParams(const NamedList& params) if (!aux) Debug(&plugin,DebugNote,"Failed to set SCTP paddr params! Reason: %s",strerror(errno)); #ifdef SCTP_DELAYED_ACK_TIME +#ifdef HAVE_SACK_INFO_STRUCT struct sctp_sack_info sack_info; - bzero(&paddr_params, sizeof(paddr_params)); + bzero(&sack_info, sizeof(sack_info)); if (params.getParam(YSTRING("sack_delay"))) { sack_info.sack_delay = params.getIntValue(YSTRING("sack_delay")); if (sack_info.sack_delay > 500) @@ -270,6 +271,25 @@ bool LKSocket::setParams(const NamedList& params) ret |= aux; if (!aux) Debug(&plugin,DebugNote,"Failed to set SCTP sack params! Reason: %s",strerror(errno)); +#elif HAVE_ASSOC_VALUE_STRUCT + struct sctp_assoc_value sassoc_value; + bzero(&sassoc_value, sizeof(sassoc_value)); + if (params.getParam(YSTRING("sack_delay"))) { + sassoc_value.assoc_value = params.getIntValue(YSTRING("sack_delay")); + if (sassoc_value.assoc_value > 500) + sassoc_value.assoc_value = 500; + } + if (params.getParam(YSTRING("sack_freq"))) + Debug(&plugin,DebugConf,"Unable to set sack_freq param! sack_info struct is missing!"); + aux = setOption(IPPROTO_SCTP,SCTP_DELAYED_ACK_TIME, &sassoc_value, sizeof(sassoc_value)); + ret |= aux; + if (!aux) + Debug(&plugin,DebugNote,"Failed to set SCTP sack params! Reason: %s",strerror(errno)); +#else // HAVE_SACK_INFO_STRUCT + Debug(&plugin,DebugConf,"SCTP delayed ack time is unavailable no struct present!!"); +#endif +#else // SCTP_DELAYED_ACK_TIME + Debug(&plugin,DebugConf,"SCTP delayed ack time is unavailable"); #endif aux = Socket::setParams(params); return ret || aux;