sctp-echo - SCTP-over-UDP echo server/client for creating reliable tunnels over UDP.

git clone https://benconnors.ca/git-repos/sctp-echo

About | Log | Files | Refs

commit 47f6e696683ea7e0c7e10801a2a2d3519bf986be
parent e122530f6635546ceb00701c61c41af1e1d03ddf
Author: Ben Connors <benconnors@outlook.com>
Date:   Thu, 30 Jul 2026 12:59:23 -0400

Minor fixes

- Missing (unused) variable name
- Autoconf

Diffstat:
Mconfigure | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mconfigure.ac | 4++++
Msrc/sctp_echo.c | 2+-
3 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/configure b/configure @@ -2359,6 +2359,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3513,6 +3514,65 @@ then : fi +ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes +then : + printf '%s\n' "#define HAVE_PTHREAD_H 1" >>confdefs.h + +fi + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 +printf %s "checking for pthread_self in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_self+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_self (void); +int +main (void) +{ +return pthread_self (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_self=yes +else case e in #( + e) ac_cv_lib_pthread_pthread_self=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_self" >&5 +printf '%s\n' "$ac_cv_lib_pthread_pthread_self" >&6; } +if test "x$ac_cv_lib_pthread_pthread_self" = xyes +then : + printf '%s\n' "#define HAVE_LIBPTHREAD 1" >>confdefs.h + + LIBS="-lpthread $LIBS" + +fi + + ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF diff --git a/configure.ac b/configure.ac @@ -1,8 +1,12 @@ AC_INIT([SCTPEcho],[1.0]) AC_LANG(C) + AC_CHECK_HEADERS(usrsctp.h) AC_CHECK_LIB(usrsctp, usrsctp_init) +AC_CHECK_HEADERS(pthread.h) +AC_CHECK_LIB(pthread, pthread_self) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/src/sctp_echo.c b/src/sctp_echo.c @@ -11,7 +11,7 @@ int done = 0; -int receive_cb(struct socket *sock, union sctp_sockstore addr, void *data, size_t datalen, struct sctp_rcvinfo, int flags, void *ulp_info) { +int receive_cb(struct socket *sock, union sctp_sockstore addr, void *data, size_t datalen, struct sctp_rcvinfo info, int flags, void *ulp_info) { // Read data from SCTP and write to stdout if (data == NULL) { // Closed connection