mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 15:32:35 +00:00
Renewed port to OpenBSD
This commit is contained in:
parent
5034b941bf
commit
8641344c73
8 changed files with 53 additions and 24 deletions
3
CHANGES
3
CHANGES
|
@ -223,6 +223,9 @@ Porting:
|
|||
PACKET_IGNORE_OUTGOING socket options when available.
|
||||
Test: INTERFACE_IGNOREOUTGOING
|
||||
|
||||
Renewed port to OpenBSD:
|
||||
Guard OPENSSL_INIT_SETTINGS; and minor changes.
|
||||
|
||||
Testing:
|
||||
Removed obselete parts from test.sh
|
||||
|
||||
|
|
|
@ -468,6 +468,9 @@
|
|||
/* Define if you have the OPENSSL_init_ssl function */
|
||||
#undef HAVE_OPENSSL_INIT_SSL
|
||||
|
||||
/* Define if you have the OPENSSL_INIT_SETTINGS type (guarded for OpenBSD) */
|
||||
#undef HAVE_OPENSSL_INIT_SETTINGS
|
||||
|
||||
/* Define if you have the SSL_library_init function */
|
||||
#undef HAVE_SSL_library_init
|
||||
|
||||
|
|
|
@ -687,7 +687,9 @@ if test -n "$WITH_OPENSSL"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# Guarded for OpenBSD
|
||||
AC_CHECK_FUNCS(OPENSSL_init_ssl SSL_library_init OPENSSL_INIT_new)
|
||||
AC_CHECK_TYPE(OPENSSL_INIT_SETTINGS, AC_DEFINE(HAVE_TYPE_OPENSSL_INIT_SETTINGS),,[#include "openssl.h"])
|
||||
|
||||
#; sc_cv_have_SSL_library_init='yes'; AC_DEFINE(HAVE_SSL_library_init)
|
||||
#if test -n "$WITH_OPENSSL"; then
|
||||
|
|
6
fdname.c
6
fdname.c
|
@ -236,7 +236,7 @@ int sockname(int fd, FILE *outfile, char style) {
|
|||
#endif
|
||||
int opttype;
|
||||
#ifdef SO_ACCEPTCONN
|
||||
int optacceptconn;
|
||||
int optacceptconn = 0; /* OpenBSD does not give value on unix dgram */
|
||||
#endif
|
||||
int result /*0, i*/;
|
||||
char socknamebuff[FDNAME_NAMELEN];
|
||||
|
@ -293,9 +293,9 @@ int sockname(int fd, FILE *outfile, char style) {
|
|||
protoentp = getprotobynumber_r(proto, &protoent, buffer, FILAN_GETPROTOBYNUMBER_R_BUFLEN);
|
||||
strncpy(protoname, protoentp->p_name, sizeof(protoname));
|
||||
}
|
||||
#elif HAVE_GETPROTOBYNUMBER_R==3 /* AIX */
|
||||
#elif HAVE_GETPROTOBYNUMBER_R==3 /* AIX, OpenBSD */
|
||||
{
|
||||
struct protoent_data proto_data;
|
||||
struct protoent_data proto_data = { 0 }; /* OpenBSD might SIGSEGV */
|
||||
rc = getprotobynumber_r(proto, &protoent, &proto_data);
|
||||
if (rc == 0) {
|
||||
strncpy(protoname, protoent.p_name, sizeof(protoname));
|
||||
|
|
3
sslcls.c
3
sslcls.c
|
@ -22,7 +22,8 @@
|
|||
#include "sycls.h"
|
||||
|
||||
#if HAVE_OPENSSL_INIT_SSL
|
||||
int sycOPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) {
|
||||
/* OpenBSD 7.2 does not know OPENSSL_INIT_SETTING */
|
||||
int sycOPENSSL_init_ssl(uint64_t opts, const void *settings) {
|
||||
int result;
|
||||
Debug2("OPENSSL_init_ssl("F_uint64_t", %p)", opts, settings);
|
||||
result = OPENSSL_init_ssl(opts, settings);
|
||||
|
|
2
sslcls.h
2
sslcls.h
|
@ -9,7 +9,7 @@
|
|||
#if WITH_OPENSSL
|
||||
|
||||
#if HAVE_OPENSSL_INIT_SSL
|
||||
int sycOPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
|
||||
int sycOPENSSL_init_ssl(uint64_t opts, const void *settings);
|
||||
#endif
|
||||
void sycSSL_load_error_strings(void);
|
||||
int sycSSL_library_init(void);
|
||||
|
|
54
test.sh
54
test.sh
|
@ -6672,22 +6672,30 @@ echo "$da" |$CMD2 >>"$tf" 2>>"${te}2"
|
|||
rc2=$?
|
||||
kill "$pid1" 2>/dev/null; wait
|
||||
if [ $rc2 -ne 0 ]; then
|
||||
$PRINTF "$FAILED: $TRACE $SOCAT:\n"
|
||||
echo "$CMD1 &"
|
||||
cat "${te}1"
|
||||
echo "$CMD2"
|
||||
cat "${te}2"
|
||||
$PRINTF "$FAILED (rc=$rc2)\n"
|
||||
echo "$CMD1 &"
|
||||
cat "${te}1" >&2
|
||||
echo "$CMD2"
|
||||
cat "${te}2" >&2
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
elif ! echo "$da" |diff - "$tf" >"$tdiff"; then
|
||||
$PRINTF "$FAILED\n"
|
||||
cat "$tdiff"
|
||||
$PRINTF "$FAILED (diff)\n"
|
||||
echo "$CMD1 &"
|
||||
cat "${te}1" >&2
|
||||
echo "$CMD2"
|
||||
cat "${te}2" >&2
|
||||
echo "// diff:" >&2
|
||||
cat "$tdiff" >&2
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
else
|
||||
$PRINTF "$OK\n"
|
||||
if [ -n "$debug" ]; then cat $te; fi
|
||||
numOK=$((numOK+1))
|
||||
$PRINTF "$OK\n"
|
||||
if [ "$VERBOSE" ]; then echo "$CMD1 &"; fi
|
||||
if [ "$DEBUG" ]; then cat "${te}1" >&2; fi
|
||||
if [ "$VERBOSE" ]; then echo "$CMD2"; fi
|
||||
if [ "$DEBUG" ]; then cat "${te}2" >&2; fi
|
||||
numOK=$((numOK+1))
|
||||
fi
|
||||
fi # NUMCOND
|
||||
;;
|
||||
|
@ -10525,7 +10533,7 @@ case "$TESTS" in
|
|||
*%$N%*|*%functions%*|*%ip4%*|*%tcp%*|*%generic%*|*%listen%*|*%fork%*|*%$NAME%*)
|
||||
TEST="$NAME: test the setsockopt option"
|
||||
# Set the TCP_MAXSEG (MSS) option with a reasonable value, this should succeed.
|
||||
# The try again with TCP_MAXSEG=1, this fails at least on Linux.
|
||||
# Then try again with TCP_MAXSEG=1, this fails at least on Linux.
|
||||
# Thus:
|
||||
# process 0 provides a tcp listening,forking socket
|
||||
# process 1 connects to this port using reasonably MSS, data transfer should
|
||||
|
@ -11608,7 +11616,7 @@ NAME=LISTEN_KEEPALIVE
|
|||
case "$TESTS" in
|
||||
*%$N%*|*%functions%*|*%bugs%*|*%listen%*|*%keepalive%*|*%socket%*|*%listen%*|*%fork%*|*%$NAME%*)
|
||||
TEST="$NAME: keepalive option is applied to connection socket"
|
||||
# instance 0 has TCP-LISTEN with option so-keepalive and invokes filan after
|
||||
# Instance 0 has TCP-LISTEN with option so-keepalive and invokes filan after
|
||||
# accept(). filan writes its output to the socket. instance 1 connects to
|
||||
# instance 0. The value of the sockets so-keepalive option is checked, it must
|
||||
# be 1
|
||||
|
@ -11631,22 +11639,28 @@ kill $pid0 2>/dev/null; wait
|
|||
if [ -z "$KEEPALIVE" ]; then
|
||||
$PRINTF "$NO_RESULT\n"
|
||||
echo "$CMD0 &"
|
||||
cat "${te}0" >&2
|
||||
echo "$CMD1"
|
||||
cat "${te}0"
|
||||
cat "${te}1"
|
||||
cat "${te}1" >&2
|
||||
numCANT=$((numCANT+1))
|
||||
listCANT="$listCANT $N"
|
||||
namesCANT="$namesCANT $NAME"
|
||||
elif [ "$KEEPALIVE" = "1" ]; then
|
||||
$PRINTF "$OK\n";
|
||||
if [ "$VERBOSE" ]; then echo "$CMD0 &"; fi
|
||||
if [ "$DEBUG" ]; then cat "${te}0" >&2; fi
|
||||
if [ "$VERBOSE" ]; then echo "$CMD1"; fi
|
||||
if [ "$DEBUG" ]; then cat "${te}1" >&2; fi
|
||||
numOK=$((numOK+1))
|
||||
else
|
||||
$PRINTF "$FAILED\n"
|
||||
$PRINTF "$FAILED (KEEPALIVE=$KEEPALIVE)\n"
|
||||
echo "$CMD0 &"
|
||||
cat "${te}0" >&2
|
||||
echo "$CMD1"
|
||||
cat "${te}0"
|
||||
cat "${te}1"
|
||||
cat "${te}1" >&2
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
namesFAIL="$namesFAIL $NAME"
|
||||
fi
|
||||
fi # NUMCOND
|
||||
;;
|
||||
|
@ -17871,7 +17885,7 @@ echo "$da" |$CMD1 >"${tf}1" 2>"${te}1"
|
|||
rc1=$?
|
||||
kill $pid0 2>/dev/null; wait
|
||||
if [ "$rc1" -ne 0 ]; then
|
||||
$PRINTF "$FAILED\n"
|
||||
$PRINTF "$FAILED (rc=$rc1)\n"
|
||||
echo "$CMD0 &"
|
||||
cat "${te}0" >&2
|
||||
echo "$CMD1"
|
||||
|
@ -17880,11 +17894,13 @@ if [ "$rc1" -ne 0 ]; then
|
|||
listFAIL="$listFAIL $N"
|
||||
namesFAIL="$namesFAIL $NAME"
|
||||
elif ! echo "$da" |diff "${tf}1" - >$tdiff; then
|
||||
$PRINTF "$FAILED\n"
|
||||
$PRINTF "$FAILED (diff)\n"
|
||||
echo "$CMD0 &"
|
||||
cat "${te}0" >&2
|
||||
echo "$CMD1"
|
||||
cat "${te}1" >&2
|
||||
echo "// diff:" >&2
|
||||
cat "$tdiff" >&2
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
namesFAIL="$namesFAIL $NAME"
|
||||
|
|
|
@ -1025,7 +1025,11 @@ int
|
|||
#if defined(HAVE_OPENSSL_INIT_SSL) && defined(HAVE_OPENSSL_INIT_new)
|
||||
{
|
||||
uint64_t opts = 0;
|
||||
#if defined(OPENSSL_INIT_SETTINGS)
|
||||
OPENSSL_INIT_SETTINGS *settings;
|
||||
#else
|
||||
void *settings;
|
||||
#endif
|
||||
settings = OPENSSL_INIT_new();
|
||||
#ifdef OPENSSL_INIT_NO_ATEXIT
|
||||
opts |= OPENSSL_INIT_NO_ATEXIT;
|
||||
|
|
Loading…
Reference in a new issue