mirror of
https://repo.or.cz/socat.git
synced 2025-06-18 14:56:51 +00:00
Small fixes with tests, logs, comments, and doc
This commit is contained in:
parent
9269897bab
commit
436d764029
6 changed files with 36 additions and 31 deletions
6
CHANGES
6
CHANGES
|
@ -159,6 +159,8 @@ Testing:
|
||||||
|
|
||||||
Newer Linux distributions now deprecate usleep; replaced it in test.sh
|
Newer Linux distributions now deprecate usleep; replaced it in test.sh
|
||||||
|
|
||||||
|
UDPLITE4STREAM was trice, changed one of them to UDPLITE6STREAM.
|
||||||
|
|
||||||
Documentation:
|
Documentation:
|
||||||
Removed obsolete CHANGES.ISO-8859-1 file.
|
Removed obsolete CHANGES.ISO-8859-1 file.
|
||||||
|
|
||||||
|
@ -1035,11 +1037,11 @@ Corrections:
|
||||||
|
|
||||||
Under certain conditions OpenSSL stream connections, in particular bulk
|
Under certain conditions OpenSSL stream connections, in particular bulk
|
||||||
data transfer in unidirectional mode, failed during transfer or near
|
data transfer in unidirectional mode, failed during transfer or near
|
||||||
its with Connection reset by peer on receiver side.
|
its end with Connection reset by peer on receiver side.
|
||||||
This happened with Socat versions 1.7.3.3 to 1.7.4.0. Reasons were
|
This happened with Socat versions 1.7.3.3 to 1.7.4.0. Reasons were
|
||||||
lazy SSL shutdown handling on the sender side in combination with
|
lazy SSL shutdown handling on the sender side in combination with
|
||||||
SSL_MODE_AUTO_RETRY turned off.
|
SSL_MODE_AUTO_RETRY turned off.
|
||||||
Fix: After SSH_shutdown but before socket shutdown call SSL_read()
|
Fix: After SSL_shutdown() but before socket shutdown call SSL_read()
|
||||||
Test: OPENSSL_STREAM_TO_SERVER
|
Test: OPENSSL_STREAM_TO_SERVER
|
||||||
Fixes Red Hat issue 1870279.
|
Fixes Red Hat issue 1870279.
|
||||||
|
|
||||||
|
|
26
doc/socat.yo
26
doc/socat.yo
|
@ -774,8 +774,8 @@ label(ADDRESS_SOCKETPAIR)dit(bf(tt(SOCKETPAIR)))
|
||||||
See also: link(unnamed pipe)(ADDRESS_UNNAMED_PIPE)
|
See also: link(unnamed pipe)(ADDRESS_UNNAMED_PIPE)
|
||||||
|
|
||||||
label(ADDRESS_POSIXMQ_READ)dit(bf(tt(POSIXMQ-READ:/<mqueue>)))
|
label(ADDRESS_POSIXMQ_READ)dit(bf(tt(POSIXMQ-READ:/<mqueue>)))
|
||||||
Opens the specified POSIX message queue and reads messages (packets). It
|
Opens or creates the specified POSIX message queue and reads messages
|
||||||
keeps the boundaries.nl()
|
(packets). It keeps the packet boundaries.nl()
|
||||||
This is a read-only address, see options link(-u)(option_u) and
|
This is a read-only address, see options link(-u)(option_u) and
|
||||||
link(-U)(option_U) and link(dual addresses)(ADDRESS_DUAL).nl()
|
link(-U)(option_U) and link(dual addresses)(ADDRESS_DUAL).nl()
|
||||||
Socat() provides this address type only on Linux because POSIX MQ is based
|
Socat() provides this address type only on Linux because POSIX MQ is based
|
||||||
|
@ -791,7 +791,8 @@ label(ADDRESS_POSIXMQ_READ)dit(bf(tt(POSIXMQ-READ:/<mqueue>)))
|
||||||
|
|
||||||
label(ADDRESS_POSIXMQ_RECEIVE)dit(bf(tt(POSIXMQ-RECEIVE:/<mqueue>)))
|
label(ADDRESS_POSIXMQ_RECEIVE)dit(bf(tt(POSIXMQ-RECEIVE:/<mqueue>)))
|
||||||
dit(bf(tt(POSIXMQ-RECV:/<mqueue>)))
|
dit(bf(tt(POSIXMQ-RECV:/<mqueue>)))
|
||||||
Opens the specified POSIX message queue and reads one message (packet).nl()
|
Opens or creates the specified POSIX message queue and reads one message
|
||||||
|
(packet).nl()
|
||||||
This is a read-only address. See link(POSIXMQ-READ)(ADDRESS_POSIXMQ_READ)
|
This is a read-only address. See link(POSIXMQ-READ)(ADDRESS_POSIXMQ_READ)
|
||||||
for more info.nl()
|
for more info.nl()
|
||||||
Example: link(POSIX MQ recv with fork)(EXAMPLE_POSIXMQ_RECV_FORK)nl()
|
Example: link(POSIX MQ recv with fork)(EXAMPLE_POSIXMQ_RECV_FORK)nl()
|
||||||
|
@ -806,12 +807,14 @@ dit(bf(tt(POSIXMQ-RECV:/<mqueue>)))
|
||||||
link(umask)(OPTION_UMASK)
|
link(umask)(OPTION_UMASK)
|
||||||
|
|
||||||
label(ADDRESS_POSIXMQ_SEND)dit(bf(tt(POSIXMQ-SEND:/<mqueue>)))
|
label(ADDRESS_POSIXMQ_SEND)dit(bf(tt(POSIXMQ-SEND:/<mqueue>)))
|
||||||
Opens the specified POSIX message queue and writes messages (packets).nl()
|
Opens or creates the specified POSIX message queue and writes messages
|
||||||
|
(packets).nl()
|
||||||
This is a write-only address. See link(POSIXMQ-READ)(ADDRESS_POSIXMQ_READ)
|
This is a write-only address. See link(POSIXMQ-READ)(ADDRESS_POSIXMQ_READ)
|
||||||
for more info.nl()
|
for more info.nl()
|
||||||
(link(Example)(EXAMPLE_POSIXMQ_SEND))nl()
|
(link(Example)(EXAMPLE_POSIXMQ_SEND))nl()
|
||||||
Useful options:
|
Useful options:
|
||||||
link(posixmq-priority)(OPTION_POSIXMQ_PRIORITY),
|
link(posixmq-priority)(OPTION_POSIXMQ_PRIORITY),
|
||||||
|
link(posixmq-flush)(OPTION_POSIXMQ_FLUSH),
|
||||||
link(fork)(OPTION_FORK),
|
link(fork)(OPTION_FORK),
|
||||||
link(max-children)(OPTION_MAX_CHILDREN),
|
link(max-children)(OPTION_MAX_CHILDREN),
|
||||||
link(unlink-early)(OPTION_UNLINK_EARLY),
|
link(unlink-early)(OPTION_UNLINK_EARLY),
|
||||||
|
@ -822,8 +825,8 @@ label(ADDRESS_POSIXMQ_SEND)dit(bf(tt(POSIXMQ-SEND:/<mqueue>)))
|
||||||
|
|
||||||
label(ADDRESS_POSIXMQ_BIDIRECTIONAL)dit(bf(tt(POSIXMQ-BIDIRECTIONAL:/mqueue)))
|
label(ADDRESS_POSIXMQ_BIDIRECTIONAL)dit(bf(tt(POSIXMQ-BIDIRECTIONAL:/mqueue)))
|
||||||
dit(bf(tt(POSIXMQ:/mqueue)))
|
dit(bf(tt(POSIXMQ:/mqueue)))
|
||||||
Opens the specified POSIX message queue in read and/or write mode depending
|
Opens or creates the specified POSIX message queue in read and/or write mode
|
||||||
on context, then reads and/or writes messages (packets).
|
depending on context, then reads and/or writes messages (packets).
|
||||||
In bidirectional mode this is just another echo service.nl()
|
In bidirectional mode this is just another echo service.nl()
|
||||||
See link(POSIXMQ-READ)(ADDRESS_POSIXMQ_READ) and
|
See link(POSIXMQ-READ)(ADDRESS_POSIXMQ_READ) and
|
||||||
link(POSIXMQ-SEND)(ADDRESS_POSIXMQ_SEND) for more info.
|
link(POSIXMQ-SEND)(ADDRESS_POSIXMQ_SEND) for more info.
|
||||||
|
@ -2180,8 +2183,8 @@ label(OPTION_SETSID)dit(bf(tt(setsid)))
|
||||||
Makes the process the leader of a new session (link(example)(EXAMPLE_OPTION_SETSID)).
|
Makes the process the leader of a new session (link(example)(EXAMPLE_OPTION_SETSID)).
|
||||||
label(OPTION_NETNS)dit(bf(tt(netns=<net-namespace-name>)))
|
label(OPTION_NETNS)dit(bf(tt(netns=<net-namespace-name>)))
|
||||||
Before opening the address it tries to switch to the named network namespace.
|
Before opening the address it tries to switch to the named network namespace.
|
||||||
After opening the address it switches back to the previous namespace.
|
After opening the address it switches back to the previous namespace
|
||||||
(link(Example with TCP forwarder)(EXAMPLE_OPTION_NETNS),
|
(link(example with TCP forwarder)(EXAMPLE_OPTION_NETNS),
|
||||||
link(example with virtual network connection)(EXAMPLE_TUN_NETNS)).nl()
|
link(example with virtual network connection)(EXAMPLE_TUN_NETNS)).nl()
|
||||||
Only on Linux; requires root; use option tt(--experimental).nl()
|
Only on Linux; requires root; use option tt(--experimental).nl()
|
||||||
enddit()
|
enddit()
|
||||||
|
@ -2547,7 +2550,8 @@ dit(bf(tt(ipv6-join-source-group=<multicast-address:interface-index:source-addre
|
||||||
IPv4 variant. The option takes the IP address of the multicast group,
|
IPv4 variant. The option takes the IP address of the multicast group,
|
||||||
info about the desired network interface and the source IP address of the
|
info about the desired network interface and the source IP address of the
|
||||||
multicast traffic. The indices of active network interfaces can be shown
|
multicast traffic. The indices of active network interfaces can be shown
|
||||||
using the utility procan().
|
using the utility procan().nl()
|
||||||
|
This feature is experimental.
|
||||||
label(OPTION_IP_MULTICAST_IF)
|
label(OPTION_IP_MULTICAST_IF)
|
||||||
dit(bf(tt(ip-multicast-if=<hostname>)))
|
dit(bf(tt(ip-multicast-if=<hostname>)))
|
||||||
Specifies hostname or address of the network interface to be used for
|
Specifies hostname or address of the network interface to be used for
|
||||||
|
@ -3520,11 +3524,11 @@ label(OPTION_POSIXMQ_FLUSH)dit(bf(tt(posixmq-flush (mq-flush))))
|
||||||
label(OPTION_POSIXMQ_MAXMSG)dit(bf(tt(posixmq-maxmsg (mq-maxmsg))))
|
label(OPTION_POSIXMQ_MAXMSG)dit(bf(tt(posixmq-maxmsg (mq-maxmsg))))
|
||||||
Sets the maxmsg parameter of the POSIX message queue when creating it.
|
Sets the maxmsg parameter of the POSIX message queue when creating it.
|
||||||
Note: You need root or CAP_SYS_RESOURCE to exceed the default value
|
Note: You need root or CAP_SYS_RESOURCE to exceed the default value
|
||||||
(<tt>/proc/sys/fs/mqueue/msg_default</tt>).
|
(code(/proc/sys/fs/mqueue/msg_default)).
|
||||||
label(OPTION_POSIXMQ_MSGSIZE)dit(bf(tt(posixmq-msgsize (mq-msgsize))))
|
label(OPTION_POSIXMQ_MSGSIZE)dit(bf(tt(posixmq-msgsize (mq-msgsize))))
|
||||||
Sets the msgsize parameter of the POSIX message queue when creating it.
|
Sets the msgsize parameter of the POSIX message queue when creating it.
|
||||||
Note: You need root or CAP_SYS_RESOURCE to exceed the default value
|
Note: You need root or CAP_SYS_RESOURCE to exceed the default value
|
||||||
(<tt>/proc/sys/fs/mqueue/msgsize_default</tt>).
|
(code(/proc/sys/fs/mqueue/msgsize_default)).
|
||||||
enddit()
|
enddit()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
||||||
# Published under the GNU General Public License V.2, see file COPYING
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
# Shell script to build a many-to-one, one-to-all communication
|
# Shell script to establish many-to-one, one-to-all communications.
|
||||||
# It starts two Socat instances that communicate via IPv4 broadcast,
|
# It starts two Socat instances that communicate via IPv4 broadcast,
|
||||||
# the first of which forks a child process for each connected client.
|
# the first of which forks a child process for each connected client.
|
||||||
|
|
||||||
|
|
29
test.sh
29
test.sh
|
@ -296,7 +296,7 @@ FOPEN_MAX=$($PROCAN -c 2>/dev/null |grep '^#define[ ][ ]*FOPEN_MAX' |awk '{print
|
||||||
[ "$DEFS" ] && echo "FOPEN_MAX=\"$FOPEN_MAX\"" >&2
|
[ "$DEFS" ] && echo "FOPEN_MAX=\"$FOPEN_MAX\"" >&2
|
||||||
PF_INET6="$($PROCAN -c |grep "^#define[[:space:]]*PF_INET6[[:space:]]" |cut -d' ' -f3)"
|
PF_INET6="$($PROCAN -c |grep "^#define[[:space:]]*PF_INET6[[:space:]]" |cut -d' ' -f3)"
|
||||||
[ "$DEFS" ] && echo "PF_INET6=\"$PF_INET6\"" >&2
|
[ "$DEFS" ] && echo "PF_INET6=\"$PF_INET6\"" >&2
|
||||||
TIOCEXCL="$($PROCAN -c |grep "^#define[[:space:]]*TIOCEXCL[[:space:]]" |cut -d' ' -f3)"
|
TIOCEXCL="$($PROCAN -c |grep "^#define[[:space:]]*TIOCEXCL[[:space:]]" |{ read _ _ v; echo "$v"; })"
|
||||||
[ "$DEFS" ] && echo "TIOCEXCL=\"$TIOCEXCL\"" >&2
|
[ "$DEFS" ] && echo "TIOCEXCL=\"$TIOCEXCL\"" >&2
|
||||||
SOL_SOCKET="$($PROCAN -c |grep "^#define[[:space:]]*SOL_SOCKET[[:space:]]" |cut -d' ' -f3)"
|
SOL_SOCKET="$($PROCAN -c |grep "^#define[[:space:]]*SOL_SOCKET[[:space:]]" |cut -d' ' -f3)"
|
||||||
[ "$DEFS" ] && echo "SOL_SOCKET=\"$SOL_SOCKET\"" >&2
|
[ "$DEFS" ] && echo "SOL_SOCKET=\"$SOL_SOCKET\"" >&2
|
||||||
|
@ -715,7 +715,6 @@ numCANT=0
|
||||||
listOK=
|
listOK=
|
||||||
listFAIL=
|
listFAIL=
|
||||||
listCANT=
|
listCANT=
|
||||||
namesFAIL=
|
|
||||||
|
|
||||||
ok () {
|
ok () {
|
||||||
numOK=$((numOK+1))
|
numOK=$((numOK+1))
|
||||||
|
@ -762,7 +761,7 @@ testecho () {
|
||||||
#echo "$da" |$cmd >"$tf" 2>"$te"
|
#echo "$da" |$cmd >"$tf" 2>"$te"
|
||||||
{ sleep $T; echo "$da"; sleep $T; } | { $TRACE $SOCAT $opts "$arg1" "$arg2" >"$tf" 2>"$te"; echo $? >"$td/test$N.rc"; } &
|
{ sleep $T; echo "$da"; sleep $T; } | { $TRACE $SOCAT $opts "$arg1" "$arg2" >"$tf" 2>"$te"; echo $? >"$td/test$N.rc"; } &
|
||||||
pid1=$!
|
pid1=$!
|
||||||
#sleep 5 && kill $rc1 2>/dev/null &
|
#sleep 5 && kill $pid1 2>/dev/null &
|
||||||
# rc2=$!
|
# rc2=$!
|
||||||
wait $pid1
|
wait $pid1
|
||||||
# kill $rc2 2>/dev/null
|
# kill $rc2 2>/dev/null
|
||||||
|
@ -17969,7 +17968,7 @@ N=$((N+1))
|
||||||
NAME=UDPLITE4STREAM
|
NAME=UDPLITE4STREAM
|
||||||
case "$TESTS" in
|
case "$TESTS" in
|
||||||
*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%udplite%*|*%$NAME%*)
|
*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%udplite%*|*%$NAME%*)
|
||||||
TEST="$NAME: echo via connection to UDP-Lite V4 socket"
|
TEST="$NAME: echo via connection to UDP-Lite IPv4 socket"
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! cond=$(checkconds \
|
elif ! cond=$(checkconds \
|
||||||
"" \
|
"" \
|
||||||
|
@ -18029,7 +18028,7 @@ N=$((N+1))
|
||||||
NAME=UDPLITE4STREAM
|
NAME=UDPLITE4STREAM
|
||||||
case "$TESTS" in
|
case "$TESTS" in
|
||||||
*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%udplite%*|*%$NAME%*)
|
*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%udplite%*|*%$NAME%*)
|
||||||
TEST="$NAME: echo via connection to UDP-Lite V4 socket"
|
TEST="$NAME: echo via connection to UDP-Lite IPv4 socket"
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! cond=$(checkconds \
|
elif ! cond=$(checkconds \
|
||||||
"" \
|
"" \
|
||||||
|
@ -18086,19 +18085,19 @@ esac
|
||||||
N=$((N+1))
|
N=$((N+1))
|
||||||
|
|
||||||
|
|
||||||
NAME=UDPLITE4STREAM
|
NAME=UDPLITE6STREAM
|
||||||
case "$TESTS" in
|
case "$TESTS" in
|
||||||
*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%udplite%*|*%$NAME%*)
|
*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%udplite%*|*%$NAME%*)
|
||||||
TEST="$NAME: echo via connection to UDP-Lite V4 socket"
|
TEST="$NAME: echo via connection to UDP-Lite IPv6 socket"
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! cond=$(checkconds \
|
elif ! cond=$(checkconds \
|
||||||
"" \
|
"" \
|
||||||
"" \
|
"" \
|
||||||
"" \
|
"" \
|
||||||
"IP4 UDPLITE LISTEN STDIO PIPE" \
|
"IP6 UDPLITE LISTEN STDIO PIPE" \
|
||||||
"UDPLITE4-LISTEN PIPE STDIO UDPLITE4" \
|
"UDPLITE6-LISTEN PIPE STDIO UDPLITE6" \
|
||||||
"so-reuseaddr" \
|
"so-reuseaddr" \
|
||||||
"udplite4" ); then
|
"udplite6" ); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$cond${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$cond${NORMAL}\n" $N
|
||||||
cant
|
cant
|
||||||
else
|
else
|
||||||
|
@ -18106,14 +18105,14 @@ else
|
||||||
te="$td/test$N.stderr"
|
te="$td/test$N.stderr"
|
||||||
tdiff="$td/test$N.diff"
|
tdiff="$td/test$N.diff"
|
||||||
tsl=$PORT
|
tsl=$PORT
|
||||||
ts="$LOCALHOST:$tsl"
|
ts="$LOCALHOST6:$tsl"
|
||||||
da="test$N $(date) $RANDOM"
|
da="test$N $(date) $RANDOM"
|
||||||
CMD1="$TRACE $SOCAT $opts UDPLITE4-LISTEN:$tsl,$REUSEADDR PIPE"
|
CMD1="$TRACE $SOCAT $opts UDPLITE6-LISTEN:$tsl,$REUSEADDR PIPE"
|
||||||
CMD2="$TRACE $SOCAT $opts - UDPLITE4:$ts"
|
CMD2="$TRACE $SOCAT $opts - UDPLITE6:$ts"
|
||||||
printf "test $F_n $TEST... " $N
|
printf "test $F_n $TEST... " $N
|
||||||
$CMD1 >"$tf" 2>"${te}1" &
|
$CMD1 >"$tf" 2>"${te}1" &
|
||||||
pid1=$!
|
pid1=$!
|
||||||
waitudplite4port $tsl 1
|
waitudplite6port $tsl 1
|
||||||
echo "$da" |$CMD2 >>"$tf" 2>>"${te}2"
|
echo "$da" |$CMD2 >>"$tf" 2>>"${te}2"
|
||||||
rc2=$?
|
rc2=$?
|
||||||
kill $pid1 2>/dev/null; wait
|
kill $pid1 2>/dev/null; wait
|
||||||
|
|
|
@ -81,7 +81,7 @@ static int xioopen_shell(
|
||||||
Setenv("SHELL", shellpath, 1);
|
Setenv("SHELL", shellpath, 1);
|
||||||
|
|
||||||
Info1("executing shell command \"%s\"", string);
|
Info1("executing shell command \"%s\"", string);
|
||||||
Debug3("execl(\"%s\", \"%s\", \"-c\", \"%s\", NULL",
|
Debug3("execl(\"%s\", \"%s\", \"-c\", \"%s\", NULL)",
|
||||||
shellpath, shellname, string);
|
shellpath, shellname, string);
|
||||||
result = execl(shellpath, shellname, "-c", string, (char *)NULL);
|
result = execl(shellpath, shellname, "-c", string, (char *)NULL);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
|
|
|
@ -731,7 +731,7 @@ int xioopen_single(xiofile_t *xfd, int xioflags) {
|
||||||
if (applyopts_single(sfd, sfd->opts, PH_OFFSET) < 0)
|
if (applyopts_single(sfd, sfd->opts, PH_OFFSET) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
#if WITH_NAMESPACES
|
#if WITH_NAMESPACES /* netns */
|
||||||
if ((save_netfd = xio_apply_namespace(sfd->opts)) < 0)
|
if ((save_netfd = xio_apply_namespace(sfd->opts)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* WITH_NAMESPACES */
|
#endif /* WITH_NAMESPACES */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue