Added the --experimental option

This commit is contained in:
Gerhard Rieger 2023-09-30 09:26:13 +02:00
parent f0ca732bd9
commit dc777a00bb
8 changed files with 33 additions and 16 deletions

View file

@ -1,5 +1,9 @@
 
####################### V 1.7.4.5: Features:
Added the --experimental option that enables use of features that might
change in the future.
####################### V 1.7.4.5 (not released):
Corrections: Corrections:
On connect() failure and in some other situations Socat tries to get On connect() failure and in some other situations Socat tries to get

View file

@ -1 +1 @@
"1.7.4.5" "1.7.4.5+"

View file

@ -472,8 +472,8 @@ if test -n "$WITH_READLINE"; then
CFLAGS_ORIG=$CFLAGS CFLAGS_ORIG=$CFLAGS
LIBS_ORIG=$LIBS LIBS_ORIG=$LIBS
sc_usable_readline_found= sc_usable_readline_found=
for D in "" "/usr/local" "/opt/local" "/sw" "/opt/freeware" "/usr/sfw"; do for D in "" "/usr/local" "/opt/local" "/sw" "/opt/freeware" "/usr/sfw"; do
if test -n "$D" ; then if test -n "$D" ; then
CPPFLAGS="$CPPFLAGS -I$D/include" CPPFLAGS="$CPPFLAGS -I$D/include"
CFLAGS="$CFLAGS -L$D/lib" CFLAGS="$CFLAGS -L$D/lib"
@ -482,12 +482,12 @@ if test -n "$WITH_READLINE"; then
DLOC="in default location" DLOC="in default location"
fi fi
AC_MSG_CHECKING(for usable readline $DLOC) AC_MSG_CHECKING(for usable readline $DLOC)
# Some systems require -lcurses, some require -lncurses. # Some systems require -lcurses, some require -lncurses.
# Mac OS X 10.4 (and others) ships with libedit masquerading as readline, # Mac OS X 10.4 (and others) ships with libedit masquerading as readline,
# but it doesn't work well with socat. It can be recognized by the absence # but it doesn't work well with socat. It can be recognized by the absence
# of append_history. # of append_history.
for L in "" "-lcurses" "-lncurses"; do for L in "" "-lcurses" "-lncurses"; do
LIBS="$LIBS_ORIG -lreadline $L" LIBS="$LIBS_ORIG -lreadline $L"
AC_TRY_LINK( AC_TRY_LINK(
@ -499,7 +499,7 @@ if test -n "$WITH_READLINE"; then
[ sc_usable_readline_found=1 [ sc_usable_readline_found=1
break ]) break ])
done done
if test -n "$sc_usable_readline_found"; then if test -n "$sc_usable_readline_found"; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_READLINE_READLINE_H,1) AC_DEFINE(HAVE_READLINE_READLINE_H,1)
@ -514,7 +514,7 @@ if test -n "$WITH_READLINE"; then
LIBS=$LIBS_ORIG LIBS=$LIBS_ORIG
fi fi
done done
if test -z "$sc_usable_readline_found"; then if test -z "$sc_usable_readline_found"; then
AC_MSG_WARN([no suitable version of readline found; perhaps you need to install a newer version]) AC_MSG_WARN([no suitable version of readline found; perhaps you need to install a newer version])
fi fi
@ -1161,7 +1161,7 @@ if test "$ac_cv___extensions__" = yes; then
AC_MSG_RESULT($ac_cv__posix_pthread_semantics) AC_MSG_RESULT($ac_cv__posix_pthread_semantics)
fi fi
# struct timespec # struct timespec
AC_MSG_CHECKING(for struct timespec) AC_MSG_CHECKING(for struct timespec)
AC_CACHE_VAL(sc_cv_struct_timespec, AC_CACHE_VAL(sc_cv_struct_timespec,
@ -1540,7 +1540,7 @@ if test -n "$WITH_OPENSSL_METHOD" -o -z "$ac_cv_have_tls_client_method" -o -z "$
dnl Search for SSLv2_client_method, SSLv2_server_method dnl Search for SSLv2_client_method, SSLv2_server_method
AC_CHECK_FUNC(SSLv2_client_method, AC_DEFINE(HAVE_SSLv2_client_method), AC_CHECK_LIB(crypt, SSLv2_client_method, [LIBS=-lcrypt $LIBS])) AC_CHECK_FUNC(SSLv2_client_method, AC_DEFINE(HAVE_SSLv2_client_method), AC_CHECK_LIB(crypt, SSLv2_client_method, [LIBS=-lcrypt $LIBS]))
AC_CHECK_FUNC(SSLv2_server_method, AC_DEFINE(HAVE_SSLv2_server_method), AC_CHECK_LIB(crypt, SSLv2_server_method, [LIBS=-lcrypt $LIBS])) AC_CHECK_FUNC(SSLv2_server_method, AC_DEFINE(HAVE_SSLv2_server_method), AC_CHECK_LIB(crypt, SSLv2_server_method, [LIBS=-lcrypt $LIBS]))
dnl dnl
AC_CHECK_FUNC(SSLv3_client_method, AC_DEFINE(HAVE_SSLv3_client_method), AC_CHECK_LIB(crypt, SSLv3_client_method, [LIBS=-lcrypt $LIBS])) AC_CHECK_FUNC(SSLv3_client_method, AC_DEFINE(HAVE_SSLv3_client_method), AC_CHECK_LIB(crypt, SSLv3_client_method, [LIBS=-lcrypt $LIBS]))
AC_CHECK_FUNC(SSLv3_server_method, AC_DEFINE(HAVE_SSLv3_server_method), AC_CHECK_LIB(crypt, SSLv3_server_method, [LIBS=-lcrypt $LIBS])) AC_CHECK_FUNC(SSLv3_server_method, AC_DEFINE(HAVE_SSLv3_server_method), AC_CHECK_LIB(crypt, SSLv3_server_method, [LIBS=-lcrypt $LIBS]))
AC_CHECK_FUNC(SSLv23_client_method, AC_DEFINE(HAVE_SSLv23_client_method), AC_CHECK_LIB(crypt, SSLv23_client_method, [LIBS=-lcrypt $LIBS])) AC_CHECK_FUNC(SSLv23_client_method, AC_DEFINE(HAVE_SSLv23_client_method), AC_CHECK_LIB(crypt, SSLv23_client_method, [LIBS=-lcrypt $LIBS]))
@ -1675,7 +1675,7 @@ dnl the matching type.
dnl If this method does not seem to work we run test programs that print the dnl If this method does not seem to work we run test programs that print the
dnl length and signedness of the type. dnl length and signedness of the type.
dnl do we have a -Werror option? dnl do we have a -Werror option?
dnl Does the test code compile with -Werror when types fit? dnl Does the test code compile with -Werror when types fit?
CHANCE_TO_TYPECHECK=1 CHANCE_TO_TYPECHECK=1
CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')" CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')"
@ -2089,7 +2089,7 @@ if test -n "$WITH_LIBWRAP"; then
fi fi
AC_MSG_RESULT($sc_cv_have_hosts_allow_table) AC_MSG_RESULT($sc_cv_have_hosts_allow_table)
fi # test -n "$WITH_LIBWRAP" fi # test -n "$WITH_LIBWRAP"
if test "$GCC" = yes; then if test "$GCC" = yes; then
CFLAGS="$CFLAGS" CFLAGS="$CFLAGS"

View file

@ -118,6 +118,9 @@ dit(bf(tt(-d -d -d -d))) Prints fatal, error, warning, notice, info, and debug
messages. messages.
dit(bf(tt(-D))) dit(bf(tt(-D)))
Logs information about file descriptors before starting the transfer phase. Logs information about file descriptors before starting the transfer phase.
dit(bf(tt(--experimental)))
New features that are not well tested or are subject to change in the future
must me explicitely enabled using this option.
dit(bf(tt(-ly[<facility>]))) dit(bf(tt(-ly[<facility>])))
Writes messages to syslog instead of stderr; severity as defined with -d Writes messages to syslog instead of stderr; severity as defined with -d
option. With optional link(<facility>)(TYPE_FACILITY), the syslog type can option. With optional link(<facility>)(TYPE_FACILITY), the syslog type can

11
socat.c
View file

@ -264,8 +264,9 @@ int main(int argc, const char *argv[]) {
} }
} }
break; break;
case 'W': if (socat_opts.lock.lockfile) case 'W': if (socat_opts.lock.lockfile) {
Error("only one -L and -W option allowed"); Error("only one -L and -W option allowed");
}
if (arg1[0][2]) { if (arg1[0][2]) {
socat_opts.lock.lockfile = *arg1+2; socat_opts.lock.lockfile = *arg1+2;
} else { } else {
@ -291,6 +292,13 @@ int main(int argc, const char *argv[]) {
xioopts.preferred_ip = arg1[0][1]; xioopts.preferred_ip = arg1[0][1];
break; break;
#endif /* WITH_IP4 || WITH_IP6 */ #endif /* WITH_IP4 || WITH_IP6 */
case '-':
if (!strcmp("experimental", &arg1[0][2])) {
xioopts.experimental = true;
} else {
Error1("unknown option \"%s\"; use option \"-h\" for help", arg1[0]);
}
break;
case '\0': case '\0':
case ',': case ',':
case ':': case ':':
@ -389,6 +397,7 @@ void socat_usage(FILE *fd) {
#if WITH_FILAN #if WITH_FILAN
fputs(" -D analyze file descriptors before loop\n", fd); fputs(" -D analyze file descriptors before loop\n", fd);
#endif #endif
fputs(" --experimental enable experimental features\n", fd);
fputs(" -ly[facility] log to syslog, using facility (default is daemon)\n", fd); fputs(" -ly[facility] log to syslog, using facility (default is daemon)\n", fd);
fputs(" -lf<logfile> log to file\n", fd); fputs(" -lf<logfile> log to file\n", fd);
fputs(" -ls log to stderr (default if no other log)\n", fd); fputs(" -ls log to stderr (default if no other log)\n", fd);

View file

@ -30,8 +30,7 @@ static int xioopen_readline(int argc, const char *argv[], struct opt *opts,
int dummy1, int dummy2, int dummy3); int dummy1, int dummy2, int dummy3);
const struct addrdesc addr_readline = { const struct addrdesc addr_readline = { "readline", 3, xioopen_readline, GROUP_FD|GROUP_TERMIOS|GROUP_READLINE, 0, 0, 0 HELP(NULL) };
"readline", 3, xioopen_readline, GROUP_FD|GROUP_TERMIOS|GROUP_READLINE, 0, 0, 0 HELP(NULL) };
const struct optdesc opt_history_file = { "history-file", "history", OPT_HISTORY_FILE, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_OFFSET, XIO_OFFSETOF(para.readline.history_file) }; const struct optdesc opt_history_file = { "history-file", "history", OPT_HISTORY_FILE, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_OFFSET, XIO_OFFSETOF(para.readline.history_file) };
const struct optdesc opt_prompt = { "prompt", NULL, OPT_PROMPT, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_OFFSET, XIO_OFFSETOF(para.readline.prompt) }; const struct optdesc opt_prompt = { "prompt", NULL, OPT_PROMPT, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_OFFSET, XIO_OFFSETOF(para.readline.prompt) };

1
xio.h
View file

@ -102,6 +102,7 @@ typedef struct {
char default_ip; /* default prot.fam for IP based listen ('4' or '6') */ char default_ip; /* default prot.fam for IP based listen ('4' or '6') */
char preferred_ip; /* preferred prot.fam. for name resolution ('0' for char preferred_ip; /* preferred prot.fam. for name resolution ('0' for
unspecified, '4', or '6') */ unspecified, '4', or '6') */
bool experimental; /* enable some features */
} xioopts_t; } xioopts_t;
/* pack the description of a lock file */ /* pack the description of a lock file */

View file

@ -20,7 +20,8 @@ xioopts_t xioopts = {
'\0', /* logopt */ '\0', /* logopt */
NULL, /* syslogfac */ NULL, /* syslogfac */
'4', /* default_ip */ '4', /* default_ip */
'4' /* preferred_ip */ '4', /* preferred_ip */
false /* experimental */
} ; } ;