From 799a6ba377743e23efafc244f30f75dc6b6e1397 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sun, 22 Jul 2012 23:38:02 +0200 Subject: [PATCH] corrections for OpenEmbedded, especially termios SHIFT values andISPEED/OSPEED --- CHANGES | 25 ++++++++++++++----------- configure.in | 5 ++++- xio-termios.c | 6 +++++- xioinitialize.c | 6 +++++- xioopts.c | 4 ++-- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index 20a502f..a25a489 100644 --- a/CHANGES +++ b/CHANGES @@ -37,7 +37,7 @@ corrections: fixed a bug where socat might crash when connecting to a unix domain socket using address GOPEN. Thanks to Martin Forssen for bug report and patch. - + UDP-LISTEN would alway set SO_REUSEADDR even without fork option and when user set it to 0. Thanks to Michal Svoboda for reporting this bug. @@ -46,17 +46,17 @@ corrections: TCP-CONNECT with option nonblock reported successful connect even when it was still pending - + address option ioctl-intp failed with "unimplemented type 26". Thanks to Jeremy W. Sherman for reporting and fixing that bug - + socat option -x did not print packet direction, timestamp etc; thanks to Anthony Sharobaiko for sending a patch Marcus Meissner provided a patch that fixes invalid output and possible process crash when socat prints info about an unnamed unix domain socket - + Michal Soltys reported the following problem and provided an initial patch: when socat was interrupted, e.g. by SIGSTOP, and resumed during data transfer only parts of the data might have been written. @@ -64,25 +64,25 @@ corrections: Option o-nonblock in combination with large transfer block sizes may result in partial writes and/or EAGAIN errors that were not handled properly but resulted in data loss or process termination. - + Fixed a bug that could freeze socat when during assembly of a log message a signal was handled that also printed a log message. socat development had been aware that localtime() is not thread safe but had only expected broken messages, not corrupted stack (glibc 2.11.1, Ubuntu 10.4) - + an internal store for child pids was susceptible to pid reuse which could lead to sporadic data loss when both fork option and exec address were used. Thanks to Tetsuya Sodo for reporting this problem and sending a patch - + OpenSSL server failed with "no shared cipher" when using cipher aNULL. Fixed by providing temporary DH parameters. Thanks to Philip Rowlands for drawing my attention to this issue. - + UDP-LISTEN slept 1s after accepting a connection. This is not required. Thanks to Peter Valdemar Morch for reporting this issue - + fixed a bug that could lead to error or socat crash after a client connection with option retry had been established @@ -104,7 +104,7 @@ porting: Cedril Priscal ported socat to Android (using Googles cross compiler). The port includes the socat_buildscript_for_android.sh script - + added check for component ipi_spec_dst in struct in_pktinfo so compilation does not fail on Cygwin (thanks to Peter Wagemans for reporting this problem) @@ -112,7 +112,7 @@ porting: build failed on RHEL6 due to presence of fips.h; configure now checks for fipsld too. Thanks to Andreas Gruenbacher for reporting this problem - + check for netinet6/in6.h only when IPv6 is available and enabled don't fail to compile when the following defines are missing: @@ -126,6 +126,9 @@ porting: fixed compiler warnings on Mac OS X 64bit. Thanks to Guy Harris for providing the patch. + corrections for OpenEmbedded, especially termios SHIFT values and + ISPEED/OSPEED. Thanks to John Faith for providing the patch + ####################### V 2.0.0-b7: security: diff --git a/configure.in b/configure.in index 569c0e6..ded7833 100644 --- a/configure.in +++ b/configure.in @@ -1341,10 +1341,13 @@ AC_CACHE_CHECK(shift offset of $1, $2, ], [$2=`cat $conftestoffset`], [$2=-1], - [AC_MSG_RESULT(please determine $1_SHIFT manually)] + [$2=-1] ) LIBS="$LIBS1"]) AC_DEFINE_UNQUOTED($1_SHIFT, ${$2}) +if test "$2" = -1; then +AC_MSG_WARN(please determine $1_SHIFT manually) +fi ]) AC_SHIFT_OFFSET(CRDLY, sc_cv_sys_crdly_shift) diff --git a/xio-termios.c b/xio-termios.c index 4cddaf9..77a001c 100644 --- a/xio-termios.c +++ b/xio-termios.c @@ -1,5 +1,5 @@ /* source: xio-termios.c */ -/* Copyright Gerhard Rieger 2001-2008 */ +/* Copyright Gerhard Rieger 2001-2012 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this file contains the source for terminal I/O options */ @@ -270,8 +270,12 @@ const struct optdesc opt_raw = { "raw", NULL, OPT_RAW, GROUP_TER const struct optdesc opt_sane = { "sane", NULL, OPT_SANE, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_SPEC }; #ifdef HAVE_TERMIOS_ISPEED +#if defined(ISPEED_OFFSET) && (ISPEED_OFFSET != -1) +#if defined(OSPEED_OFFSET) && (OSPEED_OFFSET != -1) const struct optdesc opt_ispeed = { "ispeed", NULL, OPT_ISPEED, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_SPEED, ISPEED_OFFSET }; const struct optdesc opt_ospeed = { "ospeed", NULL, OPT_OSPEED, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_SPEED, OSPEED_OFFSET }; +#endif +#endif #endif /* HAVE_TERMIOS_ISPEED */ diff --git a/xioinitialize.c b/xioinitialize.c index 35d258f..d821343 100644 --- a/xioinitialize.c +++ b/xioinitialize.c @@ -68,11 +68,15 @@ int xioinitialize(int xioflags) { assert(tdata.termarg.c_oflag == tdata.flags[1]); assert(tdata.termarg.c_cflag == tdata.flags[2]); assert(tdata.termarg.c_lflag == tdata.flags[3]); -#if HAVE_TERMIOS_ISPEED +#if HAVE_TERMIOS_ISPEED && (ISPEED_OFFSET != -1) && (OSPEED_OFFSET != -1) +#if defined(ISPEED_OFFSET) && (ISPEED_OFFSET != -1) +#if defined(OSPEED_OFFSET) && (OSPEED_OFFSET != -1) tdata.termarg.c_ispeed = 0x56789abc; tdata.termarg.c_ospeed = 0x6789abcd; assert(tdata.termarg.c_ispeed == tdata.speeds[ISPEED_OFFSET]); assert(tdata.termarg.c_ospeed == tdata.speeds[OSPEED_OFFSET]); +#endif +#endif #endif } #endif /* WITH_TERMIOS */ diff --git a/xioopts.c b/xioopts.c index b767e81..8284c0d 100644 --- a/xioopts.c +++ b/xioopts.c @@ -786,7 +786,7 @@ const struct optname optionnames[] = { IF_IP6 ("ipv6only", &opt_ipv6_v6only) #endif IF_TERMIOS("isig", &opt_isig) -#ifdef HAVE_TERMIOS_ISPEED +#if defined(HAVE_TERMIOS_ISPEED) && defined(ISPEED_OFFSET) && (ISPEED_OFFSET != -1) IF_TERMIOS("ispeed", &opt_ispeed) #endif IF_TERMIOS("istrip", &opt_istrip) @@ -1057,7 +1057,7 @@ const struct optname optionnames[] = { IF_OPENSSL("openssl-pseudo", &opt_openssl_pseudo) IF_OPENSSL("openssl-verify", &opt_openssl_verify) IF_TERMIOS("opost", &opt_opost) -#ifdef HAVE_TERMIOS_ISPEED +#if defined(HAVE_TERMIOS_ISPEED) && defined(OSPEED_OFFSET) && (OSPEED_OFFSET != -1) IF_TERMIOS("ospeed", &opt_ospeed) #endif IF_ANY ("owner", &opt_user)