mirror of
https://repo.or.cz/socat.git
synced 2024-12-23 07:52:32 +00:00
minor corrections of docu and test.sh; o-append
This commit is contained in:
parent
50be6b25cf
commit
209ff84a07
12 changed files with 128 additions and 118 deletions
3
CHANGES
3
CHANGES
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
corrected some typos and improved some comments
|
||||||
|
|
||||||
####################### V 1.7.0.1:
|
####################### V 1.7.0.1:
|
||||||
|
|
||||||
corrections:
|
corrections:
|
||||||
|
|
2
EXAMPLES
2
EXAMPLES
|
@ -230,7 +230,7 @@ $ socat -d -d tcp:localhost:25,crlf,nodelay exec:'/usr/sbin/chat -v -s "\"220 \"
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// IP6
|
// IP6
|
||||||
|
|
||||||
# socat readline TCP6:::1:21 # if your inetd/ftp is listening on ip6
|
# socat readline TCP6:[::1]:21 # if your inetd/ftp is listening on ip6
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
2
README
2
README
|
@ -50,7 +50,7 @@ following operating systems:
|
||||||
|
|
||||||
Debian lenny/sid on x86, kernel 2.6.24
|
Debian lenny/sid on x86, kernel 2.6.24
|
||||||
FreeBSD 6.1 on x86
|
FreeBSD 6.1 on x86
|
||||||
NetBSD4.0 on x86
|
NetBSD 4.0 on x86
|
||||||
OpenBSD 4.3 on x86
|
OpenBSD 4.3 on x86
|
||||||
OpenSolaris 10 on x86 with gcc
|
OpenSolaris 10 on x86 with gcc
|
||||||
Mac OS X 10.5.5 on iMac G5, with libreadline
|
Mac OS X 10.5.5 on iMac G5, with libreadline
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
"1.7.0.1"
|
"1.7.0.1+"
|
||||||
|
|
|
@ -41,8 +41,8 @@ requirements.
|
||||||
All the following examples work bidirectionally except when otherwise noticed.
|
All the following examples work bidirectionally except when otherwise noticed.
|
||||||
For "clients" we just use <tt>STDIO</tt>, and for "servers" we use <tt>EXEC:hostname</tt> which
|
For "clients" we just use <tt>STDIO</tt>, and for "servers" we use <tt>EXEC:hostname</tt> which
|
||||||
ingores its input but shows us which host the reply comes from. Replace these
|
ingores its input but shows us which host the reply comes from. Replace these
|
||||||
addresses with what is appropriate for you (e.g. shell script
|
socat addresses with what is appropriate for your needs (e.g. shell script
|
||||||
invokations). Port 6666 can be replaced with any other port (but for ports <
|
invocations). Port 6666 can be replaced with any other port (but for ports <
|
||||||
1024 root privilege might be required).
|
1024 root privilege might be required).
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
@ -85,7 +85,7 @@ direction the first data is passed.
|
||||||
A packet from the network is accepted by the IP stack for our socket if:
|
A packet from the network is accepted by the IP stack for our socket if:
|
||||||
<ul>
|
<ul>
|
||||||
<li>it is an incoming UDP/IPv4 packet</li>
|
<li>it is an incoming UDP/IPv4 packet</li>
|
||||||
<li>its target port matches the local port assigned to the socket (6666)</li>
|
<li>its target port matches the local port assigned to the socket (random)</li>
|
||||||
<li>its target address matches one of the hosts local addresses or the any-host
|
<li>its target address matches one of the hosts local addresses or the any-host
|
||||||
multicast address</li>
|
multicast address</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -226,9 +226,10 @@ Set a multicast/broadcast route with the following command:</p>
|
||||||
route add -net 224.0.0.0/3 gw 192.168.10.2
|
route add -net 224.0.0.0/3 gw 192.168.10.2
|
||||||
</span></span>
|
</span></span>
|
||||||
|
|
||||||
|
<a name="ALLSYSTEMS">
|
||||||
<h3>ALL-SYSTEMS multicast address</h3>
|
<h3>ALL-SYSTEMS multicast address</h3>
|
||||||
<p>
|
<p>
|
||||||
<a name="ALLSYSTEMS"><tt>224.0.0.1</tt></a> is the all-systems multicast address: all
|
<tt>224.0.0.1</tt></a> is the all-systems multicast address: all
|
||||||
datagram sockets appear to be automatically member of this group on all
|
datagram sockets appear to be automatically member of this group on all
|
||||||
interfaces. This membership cannot be dropped on Linux.
|
interfaces. This membership cannot be dropped on Linux.
|
||||||
</p>
|
</p>
|
||||||
|
@ -237,10 +238,14 @@ interfaces. This membership cannot be dropped on Linux.
|
||||||
<h2>(In)Security</h2>
|
<h2>(In)Security</h2>
|
||||||
|
|
||||||
<p>When you use the above examples you should understand that all datagram
|
<p>When you use the above examples you should understand that all datagram
|
||||||
sockets without exception accept packets that are directly addressed to them;
|
sockets without exception accept all packets that are directly addressed to
|
||||||
|
them;
|
||||||
the multi- and broadcast receiving features are just extensions to the normal
|
the multi- and broadcast receiving features are just extensions to the normal
|
||||||
functionality. socat has no way to find out if an incoming packet is addressed
|
functionality. socat currently has no means to handle incoming packets
|
||||||
to a unicast, multicast, or broadcast address.</p>
|
differently when it is addressed to a unicast, multicast, or broadcast
|
||||||
|
address. However, for EXEC'd scripts socat can provide this info in environment
|
||||||
|
variables.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>Authentication or encryption are not available.</p>
|
<p>Authentication or encryption are not available.</p>
|
||||||
|
|
||||||
|
@ -296,13 +301,13 @@ Please note that the new features could not be successfully tested on IPv6;
|
||||||
these sections thus apply to IPv4 only.
|
these sections thus apply to IPv4 only.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>This document was last modified in March 2007.</p>
|
<p>This document was last modified in July 2008.</p>
|
||||||
|
|
||||||
<h2>More info about socat datagrams</h2>
|
<h2>More info about socat datagrams</h2>
|
||||||
|
|
||||||
<h3>Links regarding this tutorial</h3>
|
<h3>Links regarding this tutorial</h3>
|
||||||
<a href="socat.html#ADDRESS_UDP4_DATAGRAM">address udp4-datagram</a><br>
|
<a href="socat.html#ADDRESS_UDP4_DATAGRAM">address UDP4-DATAGRAM</a><br>
|
||||||
<a href="socat.html#ADDRESS_UDP4_RECVFROM">address udp4-recvfrom</a><br>
|
<a href="socat.html#ADDRESS_UDP4_RECVFROM">address UDP4-RECVFROM</a><br>
|
||||||
<a href="socat.html#OPTION_RANGE">option range</a><br>
|
<a href="socat.html#OPTION_RANGE">option range</a><br>
|
||||||
<a href="socat.html#OPTION_SO_BROADCAST">option broadcast</a><br>
|
<a href="socat.html#OPTION_SO_BROADCAST">option broadcast</a><br>
|
||||||
<a href="socat.html#OPTION_IP_ADD_MEMBERSHIP">option ip-add-membership</a><br>
|
<a href="socat.html#OPTION_IP_ADD_MEMBERSHIP">option ip-add-membership</a><br>
|
||||||
|
@ -310,11 +315,11 @@ these sections thus apply to IPv4 only.
|
||||||
<a href="socat.html#OPTION_BIND">option bind</a><br>
|
<a href="socat.html#OPTION_BIND">option bind</a><br>
|
||||||
|
|
||||||
<h3>Other datagram addresses</h3>
|
<h3>Other datagram addresses</h3>
|
||||||
<a href="socat.html#ADDRESS_UDP4_RECV">address udp4-recv</a>: pure datagram receiver<br>
|
<a href="socat.html#ADDRESS_UDP4_RECV">address UDP4-RECV</a>: pure datagram receiver<br>
|
||||||
<a href="socat.html#ADDRESS_UDP4_SENDTO">address udp4-sendto</a>: communicate
|
<a href="socat.html#ADDRESS_UDP4_SENDTO">address UDP4-SENDTO</a>: communicate
|
||||||
with one peer address<br>
|
with one peer address<br>
|
||||||
<a href="socat.html#ADDRESS_UDP4_LISTEN">address udp4-listen</a>: pseudo stream server<br>
|
<a href="socat.html#ADDRESS_UDP4_LISTEN">address UDP4-LISTEN</a>: pseudo stream server<br>
|
||||||
<a href="socat.html#ADDRESS_UDP4_CONNECT">address udp4-connect</a>: pseudo stream client<br>
|
<a href="socat.html#ADDRESS_UDP4_CONNECT">address UDP4-CONNECT</a>: pseudo stream client<br>
|
||||||
|
|
||||||
<h3>Related socat option groups</h3>
|
<h3>Related socat option groups</h3>
|
||||||
<a href="socat.html#GROUP_IP">IP options</a><br>
|
<a href="socat.html#GROUP_IP">IP options</a><br>
|
||||||
|
@ -331,7 +336,7 @@ with one peer address<br>
|
||||||
<a href="http://en.wikipedia.org/wiki/Broadcast_address">broadcasting on Wikipedia</a><br>
|
<a href="http://en.wikipedia.org/wiki/Broadcast_address">broadcasting on Wikipedia</a><br>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<small>Copyright: Gerhard Rieger 2007</small><br>
|
<small>Copyright: Gerhard Rieger 2007-2008</small><br>
|
||||||
<small>License: <a href="http://www.fsf.org/licensing/licenses/fdl.html">GNU Free Documentation License (FDL)</a></small>
|
<small>License: <a href="http://www.fsf.org/licensing/licenses/fdl.html">GNU Free Documentation License (FDL)</a></small>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ these devices are called TUN or TAP.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
socat provides an address type that creates a TUN device on Linux; the other
|
socat provides an address type that creates a TUN device on Linux; the other
|
||||||
socat address can be any type; it transfer the "wire" data as desired.
|
socat address can be any type; it transfers the "wire" data as desired.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
This document shows how a simple virtual network can be created between
|
This document shows how a simple virtual network can be created between
|
||||||
|
@ -31,7 +31,7 @@ following commands with the requirements of your situation:</p>
|
||||||
<table border="1">
|
<table border="1">
|
||||||
<tr><th>host</th><th>address</th><th>mask</th></tr>
|
<tr><th>host</th><th>address</th><th>mask</th></tr>
|
||||||
<tr><td>physical "server" address</td><td>1.2.3.4</td><td>n/a</td></tr>
|
<tr><td>physical "server" address</td><td>1.2.3.4</td><td>n/a</td></tr>
|
||||||
<tr><td>physical "client" address</td><td>223.2.3.4</td><td>n/a</td></tr>
|
<tr><td>physical "client" address</td><td>n/a</td><td>n/a</td></tr>
|
||||||
<tr><td>TUN on "server"</td><td>192.168.255.1</td><td>255.255.255.0</td></tr>
|
<tr><td>TUN on "server"</td><td>192.168.255.1</td><td>255.255.255.0</td></tr>
|
||||||
<tr><td>TUN on "client"</td><td>192.168.255.2</td><td>255.255.255.0</td></tr>
|
<tr><td>TUN on "client"</td><td>192.168.255.2</td><td>255.255.255.0</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
121
doc/socat.yo
121
doc/socat.yo
|
@ -340,21 +340,21 @@ label(ADDRESS_IP_SENDTO)dit(bf(tt(IP-SENDTO:<host>:<protocol>)))
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6) nl()
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6) nl()
|
||||||
Useful options:
|
Useful options:
|
||||||
link(pf)(OPTION_PROTOCOL_FAMILY),
|
link(pf)(OPTION_PROTOCOL_FAMILY),
|
||||||
link(ttl)(OPTION_TTL)
|
link(ttl)(OPTION_TTL) nl()
|
||||||
See also:
|
See also:
|
||||||
link(IP4-SENDTO)(ADDRESS_IP4_SENDTO),
|
link(IP4-SENDTO)(ADDRESS_IP4_SENDTO),
|
||||||
link(IP6-SENDTO)(ADDRESS_IP6_SENDTO),
|
link(IP6-SENDTO)(ADDRESS_IP6_SENDTO),
|
||||||
link(IP-RECVFROM)(ADDRESS_IP_RECVFROM),
|
link(IP-RECVFROM)(ADDRESS_IP_RECVFROM),
|
||||||
link(IP-RECV)(ADDRESS_IP_RECV),
|
link(IP-RECV)(ADDRESS_IP_RECV),
|
||||||
link(UDP-SENDTO)(ADDRESS_UDP_SENDTO)
|
link(UDP-SENDTO)(ADDRESS_UDP_SENDTO),
|
||||||
link(UNIX-SENDTO)(ADDRESS_UNIX_SENDTO)
|
link(UNIX-SENDTO)(ADDRESS_UNIX_SENDTO)
|
||||||
label(ADDRESS_INTERFACE)dit(bf(tt(INTERFACE:<interface>)))
|
label(ADDRESS_INTERFACE)dit(bf(tt(INTERFACE:<interface>)))
|
||||||
Communicate with a network connected on an interface using raw packets
|
Communicates with a network connected on an interface using raw packets
|
||||||
including link level data. link(<interface>)(TYPE_INTERFACE) is the name of
|
including link level data. link(<interface>)(TYPE_INTERFACE) is the name of
|
||||||
the network interface. Currently only available on Linux.
|
the network interface. Currently only available on Linux.
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET) nl()
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET) nl()
|
||||||
Useful options:
|
Useful options:
|
||||||
link(pf)(OPTION_PROTOCOL_FAMILY)
|
link(pf)(OPTION_PROTOCOL_FAMILY),
|
||||||
link(type)(OPTION_SO_TYPE)nl()
|
link(type)(OPTION_SO_TYPE)nl()
|
||||||
See also: link(ip-recv)(ADDRESS_IP_RECV)
|
See also: link(ip-recv)(ADDRESS_IP_RECV)
|
||||||
label(ADDRESS_IP4_SENDTO)dit(bf(tt(IP4-SENDTO:<host>:<protocol>)))
|
label(ADDRESS_IP4_SENDTO)dit(bf(tt(IP4-SENDTO:<host>:<protocol>)))
|
||||||
|
@ -368,7 +368,7 @@ label(ADDRESS_IP_DATAGRAM)dit(bf(tt(IP-DATAGRAM:<address>:<protocol>)))
|
||||||
Sends outgoing data to the specified address which may in particular be a
|
Sends outgoing data to the specified address which may in particular be a
|
||||||
broadcast or multicast address. Packets arriving on the local socket are
|
broadcast or multicast address. Packets arriving on the local socket are
|
||||||
checked if their source addresses match
|
checked if their source addresses match
|
||||||
eventual link(RANGE)(OPTION_RANGE) or link(TCPWRAP)(OPTION_TCPWRAPPERS)
|
link(RANGE)(OPTION_RANGE) or link(TCPWRAP)(OPTION_TCPWRAPPERS)
|
||||||
options. This address type can for example be used for implementing
|
options. This address type can for example be used for implementing
|
||||||
symmetric or asymmetric broadcast or multicast communications.nl()
|
symmetric or asymmetric broadcast or multicast communications.nl()
|
||||||
Option groups: link(FD)(GROUP_FD), link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD), link(SOCKET)(GROUP_SOCKET),
|
||||||
|
@ -395,19 +395,21 @@ label(ADDRESS_IP_DATAGRAM)dit(bf(tt(IP-DATAGRAM:<address>:<protocol>)))
|
||||||
label(ADDRESS_IP4_DATAGRAM)dit(bf(tt(IP4-DATAGRAM:<host>:<protocol>)))
|
label(ADDRESS_IP4_DATAGRAM)dit(bf(tt(IP4-DATAGRAM:<host>:<protocol>)))
|
||||||
Like link(IP-DATAGRAM)(ADDRESS_IP_DATAGRAM), but always uses IPv4.
|
Like link(IP-DATAGRAM)(ADDRESS_IP_DATAGRAM), but always uses IPv4.
|
||||||
(link(example)(EXAMPLE_ADDRESS_IP4_BROADCAST_CLIENT))nl()
|
(link(example)(EXAMPLE_ADDRESS_IP4_BROADCAST_CLIENT))nl()
|
||||||
Option groups: link(FD)(GROUP_FD), link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(RANGE)(GROUP_RANGE) nl()
|
||||||
link(IP4)(GROUP_IP4), link(RANGE)(GROUP_RANGE) nl()
|
|
||||||
label(ADDRESS_IP6_DATAGRAM)dit(bf(tt(IP6-DATAGRAM:<host>:<protocol>)))
|
label(ADDRESS_IP6_DATAGRAM)dit(bf(tt(IP6-DATAGRAM:<host>:<protocol>)))
|
||||||
Like link(IP-DATAGRAM)(ADDRESS_IP_DATAGRAM), but always uses IPv6. Please
|
Like link(IP-DATAGRAM)(ADDRESS_IP_DATAGRAM), but always uses IPv6. Please
|
||||||
note that IPv6 does not know broadcasts.nl()
|
note that IPv6 does not know broadcasts.nl()
|
||||||
Option groups: link(FD)(GROUP_FD), link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP6)(GROUP_IP6),link(RANGE)(GROUP_RANGE) nl()
|
||||||
link(IP6)(GROUP_IP6), link(RANGE)(GROUP_RANGE) nl()
|
|
||||||
|
|
||||||
label(ADDRESS_IP_RECVFROM)dit(bf(tt(IP-RECVFROM:<protocol>)))
|
label(ADDRESS_IP_RECVFROM)dit(bf(tt(IP-RECVFROM:<protocol>)))
|
||||||
Opens a raw IP socket of link(<protocol>)(TYPE_PROTOCOL). Depending on option link(pf)(OPTION_PROTOCOL_FAMILY), IP procotol version
|
Opens a raw IP socket of link(<protocol>)(TYPE_PROTOCOL). Depending on option link(pf)(OPTION_PROTOCOL_FAMILY), IP procotol version
|
||||||
4 or 6 is used. It receives one packet from an unspecified peer and may send one or more answer packets to that peer.
|
4 or 6 is used. It receives one packet from an unspecified peer and may send one or more answer packets to that peer.
|
||||||
This mode is particularly useful with fork option where each arriving packet - from arbitrary peers - is handled by its own sub process.
|
This mode is particularly useful with fork option where each arriving packet - from arbitrary peers - is handled by its own sub process.
|
||||||
This allows a behaviour similar to typical UDP based servers like ntpd or named.
|
This allows a behaviour similar to typical UDP based servers like ntpd or
|
||||||
|
named.nl()
|
||||||
|
Please note that the reply packets might be fetched as incoming traffic when
|
||||||
|
sender and receiver IP address are identical because there is no port number
|
||||||
|
to distinguish the sockets.nl()
|
||||||
This address works well with IP-SENDTO address peers (see above).
|
This address works well with IP-SENDTO address peers (see above).
|
||||||
Protocol 255 uses the raw socket with the IP header being part of the
|
Protocol 255 uses the raw socket with the IP header being part of the
|
||||||
data.nl()
|
data.nl()
|
||||||
|
@ -675,7 +677,7 @@ label(ADDRESS_SCTP6_LISTEN)dit(bf(tt(SCTP6-LISTEN:<port>)))
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(LISTEN)(GROUP_LISTEN),link(CHILD)(GROUP_CHILD),link(RANGE)(GROUP_RANGE),link(IP6)(GROUP_IP6),link(SCTP)(GROUP_SCTP),link(RETRY)(GROUP_RETRY) nl()
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(LISTEN)(GROUP_LISTEN),link(CHILD)(GROUP_CHILD),link(RANGE)(GROUP_RANGE),link(IP6)(GROUP_IP6),link(SCTP)(GROUP_SCTP),link(RETRY)(GROUP_RETRY) nl()
|
||||||
label(ADDRESS_SOCKET_CONNECT)dit(bf(tt(SOCKET-CONNECT:<domain>:<protocol>:<remote-address>)))
|
label(ADDRESS_SOCKET_CONNECT)dit(bf(tt(SOCKET-CONNECT:<domain>:<protocol>:<remote-address>)))
|
||||||
Creates a stream socket using the first and second given socket parameters
|
Creates a stream socket using the first and second given socket parameters
|
||||||
and tt(SOCK_STREAM) (see man socket(2)) and connects to the remote-address.
|
and tt(SOCK_STREAM) (see man socket\(2)) and connects to the remote-address.
|
||||||
The two socket parameters have to be specified by link(int)(TYPE_INT)
|
The two socket parameters have to be specified by link(int)(TYPE_INT)
|
||||||
numbers. Consult your OS documentation and include files to find the
|
numbers. Consult your OS documentation and include files to find the
|
||||||
appropriate values. The remote-address must be the link(data)(TYPE_DATA)
|
appropriate values. The remote-address must be the link(data)(TYPE_DATA)
|
||||||
|
@ -699,7 +701,7 @@ label(ADDRESS_SOCKET_CONNECT)dit(bf(tt(SOCKET-CONNECT:<domain>:<protocol>:<remot
|
||||||
link(SOCKET-SENDTO)(ADDRESS_SOCKET_SENDTO)
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_SENDTO)
|
||||||
label(ADDRESS_SOCKET_DATAGRAM)dit(bf(tt(SOCKET-DATAGRAM:<domain>:<type>:<protocol>:<remote-address>)))
|
label(ADDRESS_SOCKET_DATAGRAM)dit(bf(tt(SOCKET-DATAGRAM:<domain>:<type>:<protocol>:<remote-address>)))
|
||||||
Creates a datagram socket using the first three given socket parameters (see
|
Creates a datagram socket using the first three given socket parameters (see
|
||||||
man socket(2)) and sends outgoing data to the remote-address. The three
|
man socket\(2)) and sends outgoing data to the remote-address. The three
|
||||||
socket parameters have to be specified by link(int)(TYPE_INT)
|
socket parameters have to be specified by link(int)(TYPE_INT)
|
||||||
numbers. Consult your OS documentation and include files to find the
|
numbers. Consult your OS documentation and include files to find the
|
||||||
appropriate values. The remote-address must be the link(data)(TYPE_DATA)
|
appropriate values. The remote-address must be the link(data)(TYPE_DATA)
|
||||||
|
@ -724,7 +726,7 @@ label(ADDRESS_SOCKET_DATAGRAM)dit(bf(tt(SOCKET-DATAGRAM:<domain>:<type>:<protoco
|
||||||
link(SOCKET-RECVFROM)(ADDRESS_SOCKET_RECVFROM)
|
link(SOCKET-RECVFROM)(ADDRESS_SOCKET_RECVFROM)
|
||||||
label(ADDRESS_SOCKET_LISTEN)dit(bf(tt(SOCKET-LISTEN:<domain>:<protocol>:<local-address>)))
|
label(ADDRESS_SOCKET_LISTEN)dit(bf(tt(SOCKET-LISTEN:<domain>:<protocol>:<local-address>)))
|
||||||
Creates a stream socket using the first and second given socket parameters
|
Creates a stream socket using the first and second given socket parameters
|
||||||
and tt(SOCK_STREAM) (see man socket(2)) and waits for incoming connections
|
and tt(SOCK_STREAM) (see man socket\(2)) and waits for incoming connections
|
||||||
on local-address. The two socket parameters have to be specified by
|
on local-address. The two socket parameters have to be specified by
|
||||||
link(int)(TYPE_INT) numbers. Consult your OS documentation and include files
|
link(int)(TYPE_INT) numbers. Consult your OS documentation and include files
|
||||||
to find the appropriate values. The local-address must be the
|
to find the appropriate values. The local-address must be the
|
||||||
|
@ -746,8 +748,8 @@ label(ADDRESS_SOCKET_LISTEN)dit(bf(tt(SOCKET-LISTEN:<domain>:<protocol>:<local-a
|
||||||
link(SOCKET-LISTEN)(ADDRESS_SOCKET_CONNECT),
|
link(SOCKET-LISTEN)(ADDRESS_SOCKET_CONNECT),
|
||||||
link(SOCKET-SENDTO)(ADDRESS_SOCKET_RECVFROM),
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_RECVFROM),
|
||||||
link(SOCKET-SENDTO)(ADDRESS_SOCKET_RECV)
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_RECV)
|
||||||
label(ADDRESS_SOCKET_RECV)dit(bf(tt(SOCKET_RECV:<domain>:<type>:<protocol>:<local-address>)))
|
label(ADDRESS_SOCKET_RECV)dit(bf(tt(SOCKET-RECV:<domain>:<type>:<protocol>:<local-address>)))
|
||||||
Creates a socket using the three given socket parameters (see man socket(2))
|
Creates a socket using the three given socket parameters (see man socket\(2))
|
||||||
and binds it to <local-address>. Receives arriving data. The three
|
and binds it to <local-address>. Receives arriving data. The three
|
||||||
parameters have to be specified by link(int)(TYPE_INT) numbers. Consult your
|
parameters have to be specified by link(int)(TYPE_INT) numbers. Consult your
|
||||||
OS documentation and include files to find the appropriate values. The
|
OS documentation and include files to find the appropriate values. The
|
||||||
|
@ -767,8 +769,8 @@ label(ADDRESS_SOCKET_RECV)dit(bf(tt(SOCKET_RECV:<domain>:<type>:<protocol>:<loca
|
||||||
link(SOCKET-DATAGRAM)(ADDRESS_SOCKET_DATAGRAM),
|
link(SOCKET-DATAGRAM)(ADDRESS_SOCKET_DATAGRAM),
|
||||||
link(SOCKET-SENDTO)(ADDRESS_SOCKET_SENDTO),
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_SENDTO),
|
||||||
link(SOCKET-RECVFROM)(ADDRESS_SOCKET_RECVFROM)
|
link(SOCKET-RECVFROM)(ADDRESS_SOCKET_RECVFROM)
|
||||||
label(ADDRESS_SOCKET_RECVFROM)dit(bf(tt(SOCKET_RECVFROM:<domain>:<type>:<protocol>:<local-address>)))
|
label(ADDRESS_SOCKET_RECVFROM)dit(bf(tt(SOCKET-RECVFROM:<domain>:<type>:<protocol>:<local-address>)))
|
||||||
Creates a socket using the three given socket parameters (see man socket(2))
|
Creates a socket using the three given socket parameters (see man socket\(2))
|
||||||
and binds it to <local-address>. Receives arriving data and sends replies
|
and binds it to <local-address>. Receives arriving data and sends replies
|
||||||
back to the sender. The first three parameters have to be specified as
|
back to the sender. The first three parameters have to be specified as
|
||||||
link(int)(TYPE_INT) numbers. Consult your OS documentation and include files
|
link(int)(TYPE_INT) numbers. Consult your OS documentation and include files
|
||||||
|
@ -790,9 +792,9 @@ label(ADDRESS_SOCKET_RECVFROM)dit(bf(tt(SOCKET_RECVFROM:<domain>:<type>:<protoco
|
||||||
link(SOCKET-DATAGRAM)(ADDRESS_SOCKET_DATAGRAM),
|
link(SOCKET-DATAGRAM)(ADDRESS_SOCKET_DATAGRAM),
|
||||||
link(SOCKET-SENDTO)(ADDRESS_SOCKET_SENDTO),
|
link(SOCKET-SENDTO)(ADDRESS_SOCKET_SENDTO),
|
||||||
link(SOCKET-RECV)(ADDRESS_SOCKET_RECV)
|
link(SOCKET-RECV)(ADDRESS_SOCKET_RECV)
|
||||||
label(ADDRESS_SOCKET_SENDTO)dit(bf(tt(SOCKET_SENDTO:<domain>:<type>:<protocol>:<remote-address>)))
|
label(ADDRESS_SOCKET_SENDTO)dit(bf(tt(SOCKET-SENDTO:<domain>:<type>:<protocol>:<remote-address>)))
|
||||||
Creates a socket using the three given socket parameters (see man
|
Creates a socket using the three given socket parameters (see man
|
||||||
socket(2)). Sends outgoing data to the given address and receives replies.
|
socket\(2)). Sends outgoing data to the given address and receives replies.
|
||||||
The three parameters have to be specified as link(int)(TYPE_INT)
|
The three parameters have to be specified as link(int)(TYPE_INT)
|
||||||
numbers. Consult your OS documentation and include files to find the
|
numbers. Consult your OS documentation and include files to find the
|
||||||
appropriate values. The remote-address must be the link(data)(TYPE_DATA)
|
appropriate values. The remote-address must be the link(data)(TYPE_DATA)
|
||||||
|
@ -996,7 +998,7 @@ label(ADDRESS_UDP_DATAGRAM)dit(bf(tt(UDP-DATAGRAM:<address>:<port>)))
|
||||||
Sends outgoing data to the specified address which may in particular be a
|
Sends outgoing data to the specified address which may in particular be a
|
||||||
broadcast or multicast address. Packets arriving on the local socket are
|
broadcast or multicast address. Packets arriving on the local socket are
|
||||||
checked for the correct remote port and if their source addresses match
|
checked for the correct remote port and if their source addresses match
|
||||||
eventual link(RANGE)(OPTION_RANGE) or link(TCPWRAP)(OPTION_TCPWRAPPERS)
|
link(RANGE)(OPTION_RANGE) or link(TCPWRAP)(OPTION_TCPWRAPPERS)
|
||||||
options. This address type can for example be used for implementing
|
options. This address type can for example be used for implementing
|
||||||
symmetric or asymmetric broadcast or multicast communications.nl()
|
symmetric or asymmetric broadcast or multicast communications.nl()
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(RANGE)(GROUP_RANGE) nl()
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(RANGE)(GROUP_RANGE) nl()
|
||||||
|
@ -1026,13 +1028,11 @@ label(ADDRESS_UDP4_DATAGRAM)dit(bf(tt(UDP4-DATAGRAM:<address>:<port>)))
|
||||||
Like link(UDP-DATAGRAM)(ADDRESS_UDP_DATAGRAM), but only supports IPv4
|
Like link(UDP-DATAGRAM)(ADDRESS_UDP_DATAGRAM), but only supports IPv4
|
||||||
protocol (link(example1)(EXAMPLE_ADDRESS_UDP4_BROADCAST_CLIENT),
|
protocol (link(example1)(EXAMPLE_ADDRESS_UDP4_BROADCAST_CLIENT),
|
||||||
link(example2)(EXAMPLE_ADDRESS_UDP4_MULTICAST)).nl()
|
link(example2)(EXAMPLE_ADDRESS_UDP4_MULTICAST)).nl()
|
||||||
Option groups: link(FD)(GROUP_FD), link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4), link(RANGE)(GROUP_RANGE)
|
||||||
link(IP4)(GROUP_IP4), link(RANGE)(GROUP_RANGE)
|
|
||||||
label(ADDRESS_UDP6_DATAGRAM)dit(bf(tt(UDP6-DATAGRAM:<address>:<port>)))
|
label(ADDRESS_UDP6_DATAGRAM)dit(bf(tt(UDP6-DATAGRAM:<address>:<port>)))
|
||||||
Like link(UDP-DATAGRAM)(ADDRESS_UDP_DATAGRAM), but only supports IPv6
|
Like link(UDP-DATAGRAM)(ADDRESS_UDP_DATAGRAM), but only supports IPv6
|
||||||
protocol.nl()
|
protocol.nl()
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP6)(GROUP_IP6),link(RANGE)(GROUP_RANGE)
|
||||||
link(IP6)(GROUP_IP6),link(RANGE)(GROUP_RANGE)
|
|
||||||
label(ADDRESS_UDP_LISTEN)dit(bf(tt(UDP-LISTEN:<port>)))
|
label(ADDRESS_UDP_LISTEN)dit(bf(tt(UDP-LISTEN:<port>)))
|
||||||
Waits for a UDP/IP packet arriving on <port>
|
Waits for a UDP/IP packet arriving on <port>
|
||||||
[link(UDP service)(TYPE_UDP_SERVICE)] and `connects' back to sender.
|
[link(UDP service)(TYPE_UDP_SERVICE)] and `connects' back to sender.
|
||||||
|
@ -1104,7 +1104,7 @@ label(ADDRESS_UDP_RECVFROM)dit(bf(tt(UDP-RECVFROM:<port>)))
|
||||||
option
|
option
|
||||||
where each arriving packet - from arbitrary peers - is handled by its own sub
|
where each arriving packet - from arbitrary peers - is handled by its own sub
|
||||||
process. This allows a behaviour similar to typical UDP based servers like ntpd
|
process. This allows a behaviour similar to typical UDP based servers like ntpd
|
||||||
or named. This address works well with socat SENDTO address peers.nl()
|
or named. This address works well with socat UDP-SENDTO address peers.nl()
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(CHILD)(GROUP_CHILD),link(RANGE)(GROUP_RANGE) nl()
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(CHILD)(GROUP_CHILD),link(RANGE)(GROUP_RANGE) nl()
|
||||||
Useful options:
|
Useful options:
|
||||||
link(fork)(OPTION_FORK),
|
link(fork)(OPTION_FORK),
|
||||||
|
@ -1165,9 +1165,7 @@ label(ADDRESS_UNIX_CONNECT)dit(bf(tt(UNIX-CONNECT:<filename>)))
|
||||||
if <filename> is not a unixdomain() socket, this is an error;
|
if <filename> is not a unixdomain() socket, this is an error;
|
||||||
if <filename> is a unixdomain() socket, but no process is listening, this is
|
if <filename> is a unixdomain() socket, but no process is listening, this is
|
||||||
an error.nl()
|
an error.nl()
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(NAMED)(GROUP_NAMED),link(RETRY)(GROUP_RETRY),link(UNIX)(GROUP_SOCK_UNIX) nl())
|
||||||
link(NAMED)(GROUP_NAMED),link(RETRY)(GROUP_RETRY),
|
|
||||||
link(UNIX)(GROUP_SOCK_UNIX) nl())
|
|
||||||
Useful options:
|
Useful options:
|
||||||
link(bind)(OPTION_BIND)nl()
|
link(bind)(OPTION_BIND)nl()
|
||||||
See also:
|
See also:
|
||||||
|
@ -1184,10 +1182,7 @@ label(ADDRESS_UNIX_LISTEN)dit(bf(tt(UNIX-LISTEN:<filename>)))
|
||||||
Note that opening this address usually blocks until a client connects.
|
Note that opening this address usually blocks until a client connects.
|
||||||
Beginning with socat version 1.4.3, the file system entry is removed when
|
Beginning with socat version 1.4.3, the file system entry is removed when
|
||||||
this address is closed (but see option link(unlink-close)(OPTION_UNLINK_CLOSE)) (link(example)(EXAMPLE_ADDRESS_UNIX_LISTEN)).nl()
|
this address is closed (but see option link(unlink-close)(OPTION_UNLINK_CLOSE)) (link(example)(EXAMPLE_ADDRESS_UNIX_LISTEN)).nl()
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(NAMED)(GROUP_NAMED),link(LISTEN)(GROUP_LISTEN),link(CHILD)(GROUP_CHILD),link(RETRY)(GROUP_RETRY),link(UNIX)(GROUP_SOCK_UNIX) nl()
|
||||||
link(NAMED)(GROUP_NAMED),link(LISTEN)(GROUP_LISTEN),
|
|
||||||
link(CHILD)(GROUP_CHILD),link(RETRY)(GROUP_RETRY),
|
|
||||||
link(UNIX)(GROUP_SOCK_UNIX) nl()
|
|
||||||
Useful options:
|
Useful options:
|
||||||
link(fork)(OPTION_FORK),
|
link(fork)(OPTION_FORK),
|
||||||
link(umask)(OPTION_UMASK),
|
link(umask)(OPTION_UMASK),
|
||||||
|
@ -1204,9 +1199,12 @@ label(ADDRESS_UNIX_LISTEN)dit(bf(tt(UNIX-LISTEN:<filename>)))
|
||||||
label(ADDRESS_UNIX_SENDTO)dit(bf(tt(UNIX-SENDTO:<filename>)))
|
label(ADDRESS_UNIX_SENDTO)dit(bf(tt(UNIX-SENDTO:<filename>)))
|
||||||
Communicates with the specified peer socket, defined by [link(<filename>)(TYPE_FILENAME)] assuming it is a unixdomain() datagram socket.
|
Communicates with the specified peer socket, defined by [link(<filename>)(TYPE_FILENAME)] assuming it is a unixdomain() datagram socket.
|
||||||
It sends packets to and receives packets from that peer socket only.
|
It sends packets to and receives packets from that peer socket only.
|
||||||
It works well with socat UNIX-RECVFROM and UNIX-RECV address peers.nl()
|
Please note that it might be neccessary to link(bind)(OPTION_BIND) the
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),
|
local socket to an address (e.g. tt(/tmp/sock1), which must not exist
|
||||||
link(NAMED)(GROUP_NAMED),link(UNIX)(GROUP_SOCK_UNIX)nl()
|
before).
|
||||||
|
This address type works well with socat UNIX-RECVFROM and UNIX-RECV address
|
||||||
|
peers.nl()
|
||||||
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(NAMED)(GROUP_NAMED),link(UNIX)(GROUP_SOCK_UNIX)nl()
|
||||||
Useful options:
|
Useful options:
|
||||||
link(bind)(OPTION_BIND)nl()
|
link(bind)(OPTION_BIND)nl()
|
||||||
See also:
|
See also:
|
||||||
|
@ -1221,9 +1219,7 @@ label(ADDRESS_UNIX_RECVFROM)dit(bf(tt(UNIX-RECVFROM:<filename>)))
|
||||||
Receives one packet and may send one or more answer packets to that peer.
|
Receives one packet and may send one or more answer packets to that peer.
|
||||||
This mode is particularly useful with fork option where each arriving packet - from arbitrary peers - is handled by its own sub process.
|
This mode is particularly useful with fork option where each arriving packet - from arbitrary peers - is handled by its own sub process.
|
||||||
This address works well with socat UNIX-SENDTO address peers.nl()
|
This address works well with socat UNIX-SENDTO address peers.nl()
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(NAMED)(GROUP_NAMED),link(CHILD)(GROUP_CHILD),link(UNIX)(GROUP_SOCK_UNIX) nl()
|
||||||
link(NAMED)(GROUP_NAMED),link(CHILD)(GROUP_CHILD),
|
|
||||||
link(UNIX)(GROUP_SOCK_UNIX) nl()
|
|
||||||
Useful options:
|
Useful options:
|
||||||
link(fork)(OPTION_FORK)nl()
|
link(fork)(OPTION_FORK)nl()
|
||||||
See also:
|
See also:
|
||||||
|
@ -1238,8 +1234,7 @@ label(ADDRESS_UNIX_RECV)dit(bf(tt(UNIX-RECV:<filename>)))
|
||||||
Receives packets from multiple unspecified peers and merges the data.
|
Receives packets from multiple unspecified peers and merges the data.
|
||||||
No replies are possible. It can be, e.g., addressed by socat UNIX-SENDTO address peers.
|
No replies are possible. It can be, e.g., addressed by socat UNIX-SENDTO address peers.
|
||||||
It behaves similar to a syslog server.
|
It behaves similar to a syslog server.
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(NAMED)(GROUP_NAMED),link(UNIX)(GROUP_SOCK_UNIX) nl()
|
||||||
link(NAMED)(GROUP_NAMED),link(UNIX)(GROUP_SOCK_UNIX) nl()
|
|
||||||
See also:
|
See also:
|
||||||
link(UNIX-SENDTO)(ADDRESS_UNIX_SENDTO),
|
link(UNIX-SENDTO)(ADDRESS_UNIX_SENDTO),
|
||||||
link(UNIX-RECVFROM)(ADDRESS_UNIX_RECVFROM),
|
link(UNIX-RECVFROM)(ADDRESS_UNIX_RECVFROM),
|
||||||
|
@ -1252,8 +1247,7 @@ label(ADDRESS_UNIX_CLIENT)dit(bf(tt(UNIX-CLIENT:<filename>)))
|
||||||
[link(<filename>)(TYPE_FILENAME)] assuming it is a unixdomain() socket.
|
[link(<filename>)(TYPE_FILENAME)] assuming it is a unixdomain() socket.
|
||||||
It first tries to connect and, if that fails, assumes it is a datagram
|
It first tries to connect and, if that fails, assumes it is a datagram
|
||||||
socket, thus supporting both types.nl()
|
socket, thus supporting both types.nl()
|
||||||
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),
|
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(NAMED)(GROUP_NAMED),link(UNIX)(GROUP_SOCK_UNIX) nl()
|
||||||
link(NAMED)(GROUP_NAMED),link(UNIX)(GROUP_SOCK_UNIX) nl()
|
|
||||||
Useful options:
|
Useful options:
|
||||||
link(bind)(OPTION_BIND)nl()
|
link(bind)(OPTION_BIND)nl()
|
||||||
See also:
|
See also:
|
||||||
|
@ -1610,21 +1604,24 @@ startdit()
|
||||||
label(OPTION_SEEK)dit(bf(tt(seek=<offset>)))
|
label(OPTION_SEEK)dit(bf(tt(seek=<offset>)))
|
||||||
Applies the code(lseek(fd, <offset>, SEEK_SET)) (or code(lseek64)) system
|
Applies the code(lseek(fd, <offset>, SEEK_SET)) (or code(lseek64)) system
|
||||||
call, thus positioning the file pointer absolutely to <offset>
|
call, thus positioning the file pointer absolutely to <offset>
|
||||||
[link(off_t)(TYPE_OFF) or link(off64_t)(TYPE_OFF64)].
|
[link(off_t)(TYPE_OFF) or link(off64_t)(TYPE_OFF64)]. Please note that a
|
||||||
|
missing value defaults to 1, not 0.
|
||||||
label(OPTION_SEEK_CUR)dit(bf(tt(seek-cur=<offset>)))
|
label(OPTION_SEEK_CUR)dit(bf(tt(seek-cur=<offset>)))
|
||||||
Applies the code(lseek(fd, <offset>, SEEK_CUR)) (or code(lseek64)) system
|
Applies the code(lseek(fd, <offset>, SEEK_CUR)) (or code(lseek64)) system
|
||||||
call, thus positioning the file pointer <offset> [link(off_t)(TYPE_OFF) or
|
call, thus positioning the file pointer <offset> [link(off_t)(TYPE_OFF) or
|
||||||
link(off64_t)(TYPE_OFF64)] bytes relatively to its current position (which
|
link(off64_t)(TYPE_OFF64)] bytes relatively to its current position (which
|
||||||
is usually 0).
|
is usually 0). Please note that a missing value defaults to 1, not 0.
|
||||||
label(OPTION_SEEK_END)dit(bf(tt(seek-end=<offset>)))
|
label(OPTION_SEEK_END)dit(bf(tt(seek-end=<offset>)))
|
||||||
Applies the code(lseek(fd, <offset>, SEEK_END)) (or code(lseek64)) system
|
Applies the code(lseek(fd, <offset>, SEEK_END)) (or code(lseek64)) system
|
||||||
call, thus positioning the file pointer <offset> [link(off_t)(TYPE_OFF) or
|
call, thus positioning the file pointer <offset> [link(off_t)(TYPE_OFF) or
|
||||||
link(off64_t)(TYPE_OFF64)] bytes relatively to the files current end.
|
link(off64_t)(TYPE_OFF64)] bytes relatively to the files current end. Please
|
||||||
|
note that a missing value defaults to 1, not 0.
|
||||||
label(OPTION_FTRUNCATE)dit(bf(tt(ftruncate=<offset>)))
|
label(OPTION_FTRUNCATE)dit(bf(tt(ftruncate=<offset>)))
|
||||||
Applies the code(ftruncate(fd, <offset>))
|
Applies the code(ftruncate(fd, <offset>))
|
||||||
(or code(ftruncate64) if available) system call, thus
|
(or code(ftruncate64) if available) system call, thus
|
||||||
truncating the file at the position <offset> [link(off_t)(TYPE_OFF) or
|
truncating the file at the position <offset> [link(off_t)(TYPE_OFF) or
|
||||||
link(off64_t)(TYPE_OFF64)].
|
link(off64_t)(TYPE_OFF64)]. Please note that a missing value defaults to 1,
|
||||||
|
not 0.
|
||||||
|
|
||||||
label(OPTION_EXT2_SECRM_FL)dit(bf(tt(secrm=<bool>)))
|
label(OPTION_EXT2_SECRM_FL)dit(bf(tt(secrm=<bool>)))
|
||||||
label(OPTION_EXT2_UNRM)dit(bf(tt(unrm=<bool>)))
|
label(OPTION_EXT2_UNRM)dit(bf(tt(unrm=<bool>)))
|
||||||
|
@ -1712,7 +1709,7 @@ label(OPTION_NOECHO)dit(bf(tt(noecho=<pattern>)))
|
||||||
The prompt is defined as the text that was output to the readline address
|
The prompt is defined as the text that was output to the readline address
|
||||||
after the lastest newline character and before an input character was
|
after the lastest newline character and before an input character was
|
||||||
typed. The pattern is a regular expression, e.g.
|
typed. The pattern is a regular expression, e.g.
|
||||||
"^[Pp]assword:.*$" or "([Uu]ser:|[Pp]assword:)". See regex(7) for details.
|
"^[Pp]assword:.*$" or "([Uu]ser:|[Pp]assword:)". See regex\(7) for details.
|
||||||
(link(example)(EXAMPLE_OPTION_NOECHO))
|
(link(example)(EXAMPLE_OPTION_NOECHO))
|
||||||
label(OPTION_PROMPT)dit(bf(tt(prompt=<string>)))
|
label(OPTION_PROMPT)dit(bf(tt(prompt=<string>)))
|
||||||
Passes the string as prompt to the readline function. readline prints this
|
Passes the string as prompt to the readline function. readline prints this
|
||||||
|
@ -1772,7 +1769,7 @@ label(OPTION_BIND)dit(bf(tt(bind=<sockname>)))
|
||||||
label(OPTION_CONNECT_TIMEOUT)dit(bf(tt(connect-timeout=<seconds>)))
|
label(OPTION_CONNECT_TIMEOUT)dit(bf(tt(connect-timeout=<seconds>)))
|
||||||
Abort the connection attempt after <seconds> [link(timeval)(TYPE_TIMEVAL)]
|
Abort the connection attempt after <seconds> [link(timeval)(TYPE_TIMEVAL)]
|
||||||
with error status.
|
with error status.
|
||||||
label(OPTION_INTERFACE)dit(bf(tt(interface=<interface>)))
|
label(OPTION_SO_BINDTODEV)dit(bf(tt(so-bindtodev=<interface>)))
|
||||||
Binds the socket to the given link(<interface>)(TYPE_INTERFACE).
|
Binds the socket to the given link(<interface>)(TYPE_INTERFACE).
|
||||||
This option might require root privilege.
|
This option might require root privilege.
|
||||||
label(OPTION_SO_BROADCAST)dit(bf(tt(broadcast)))
|
label(OPTION_SO_BROADCAST)dit(bf(tt(broadcast)))
|
||||||
|
@ -1893,7 +1890,7 @@ label(OPTION_SETSOCKOPT_INT)dit(bf(tt(setsockopt-int=<level>:<optname>:<optval>)
|
||||||
set. For the actual numbers you might have to look up the appropriate include
|
set. For the actual numbers you might have to look up the appropriate include
|
||||||
files of your system. The 4th tt(setsockopt()) parameter, tt(value)
|
files of your system. The 4th tt(setsockopt()) parameter, tt(value)
|
||||||
[link(int)(TYPE_INT)], is passed to the function per pointer, and for the
|
[link(int)(TYPE_INT)], is passed to the function per pointer, and for the
|
||||||
length parameter sizeof(int) is taken implicitely.
|
length parameter sizeof\(int) is taken implicitely.
|
||||||
label(OPTION_SETSOCKOPT_BIN)dit(bf(tt(setsockopt-bin=<level>:<optname>:<optval>)))
|
label(OPTION_SETSOCKOPT_BIN)dit(bf(tt(setsockopt-bin=<level>:<optname>:<optval>)))
|
||||||
Like tt(setsockopt-int), but <optval> must be provided in
|
Like tt(setsockopt-int), but <optval> must be provided in
|
||||||
link(dalan)(TYPE_DATA) format and specifies an arbitrary sequence of bytes;
|
link(dalan)(TYPE_DATA) format and specifies an arbitrary sequence of bytes;
|
||||||
|
@ -2015,7 +2012,7 @@ label(OPTION_RES_DEFNAMES)dit(bf(tt(res-defnames)))
|
||||||
label(OPTION_RES_STAYOPEN)dit(bf(tt(res-stayopen)))
|
label(OPTION_RES_STAYOPEN)dit(bf(tt(res-stayopen)))
|
||||||
label(OPTION_RES_DNSRCH)dit(bf(tt(res-dnsrch)))
|
label(OPTION_RES_DNSRCH)dit(bf(tt(res-dnsrch)))
|
||||||
These options set the corresponding resolver (name resolution) option flags.
|
These options set the corresponding resolver (name resolution) option flags.
|
||||||
Append "=0" to clear a default option. See man resolver(5) for more
|
Append "=0" to clear a default option. See man resolver\(5) for more
|
||||||
information on these options. Note: these options are valid only for the
|
information on these options. Note: these options are valid only for the
|
||||||
address they are applied to.
|
address they are applied to.
|
||||||
|
|
||||||
|
@ -2122,7 +2119,7 @@ label(OPTION_TCP_CONN_ABORT_THRESHOLD)dit(bf(tt(conn-abort-threshold=<millisecon
|
||||||
Sets the time to wait for an answer of the server during the initial connect
|
Sets the time to wait for an answer of the server during the initial connect
|
||||||
(HP-UX).
|
(HP-UX).
|
||||||
label(OPTION_TCP_KEEPINIT)dit(bf(tt(keepinit)))
|
label(OPTION_TCP_KEEPINIT)dit(bf(tt(keepinit)))
|
||||||
Sets the time to wait for an answer of the server during connect() before
|
Sets the time to wait for an answer of the server during connect\() before
|
||||||
giving up. Value in half seconds, default is 150 (75s) (Tru64).
|
giving up. Value in half seconds, default is 150 (75s) (Tru64).
|
||||||
label(OPTION_TCP_PAWS)dit(bf(tt(paws)))
|
label(OPTION_TCP_PAWS)dit(bf(tt(paws)))
|
||||||
Enables the "protect against wrapped sequence numbers" feature (Tru64).
|
Enables the "protect against wrapped sequence numbers" feature (Tru64).
|
||||||
|
@ -2306,8 +2303,8 @@ child process uses file descriptors 0 and 1 for communicating with the main
|
||||||
socat process.
|
socat process.
|
||||||
startdit()
|
startdit()
|
||||||
label(OPTION_NOFORK)dit(bf(tt(nofork)))
|
label(OPTION_NOFORK)dit(bf(tt(nofork)))
|
||||||
Does not fork a subprocess for executing the program, instead calls execvp()
|
Does not fork a subprocess for executing the program, instead calls execvp\()
|
||||||
or system() directly from the actual socat instance. This avoids the
|
or system\() directly from the actual socat instance. This avoids the
|
||||||
overhead of another process between the program and its peer,
|
overhead of another process between the program and its peer,
|
||||||
but introduces a lot of restrictions:
|
but introduces a lot of restrictions:
|
||||||
startit()
|
startit()
|
||||||
|
@ -2352,7 +2349,7 @@ label(OPTION_FDOUT)dit(bf(tt(fdout=<fdnum>)))
|
||||||
instead of stdout (1). The program started from the subprocess has to use
|
instead of stdout (1). The program started from the subprocess has to use
|
||||||
this fd for writing data to socat() (link(example)(EXAMPLE_OPTION_FDOUT)).
|
this fd for writing data to socat() (link(example)(EXAMPLE_OPTION_FDOUT)).
|
||||||
label(OPTION_SIGHUP)label(OPTION_SIGINT)label(OPTION_SIGQUIT)dit(bf(tt(sighup)), bf(tt(sigint)), bf(tt(sigquit)))
|
label(OPTION_SIGHUP)label(OPTION_SIGINT)label(OPTION_SIGQUIT)dit(bf(tt(sighup)), bf(tt(sigint)), bf(tt(sigquit)))
|
||||||
Has socat() pass an eventual signal of this type to the sub process.
|
Has socat() pass signals of this type to the sub process.
|
||||||
If no address has this option, socat terminates on these signals.
|
If no address has this option, socat terminates on these signals.
|
||||||
enddit()
|
enddit()
|
||||||
|
|
||||||
|
@ -2629,7 +2626,7 @@ label(OPTION_OPENSSL_PSEUDO)dit(bf(tt(pseudo)))
|
||||||
gathering daemon can be utilized, this option activates a mechanism for
|
gathering daemon can be utilized, this option activates a mechanism for
|
||||||
providing pseudo entropy. This is archieved by taking the current time in
|
providing pseudo entropy. This is archieved by taking the current time in
|
||||||
microseconds for feeding the libc pseudo random number generator with an
|
microseconds for feeding the libc pseudo random number generator with an
|
||||||
initial value. openssl is then feeded with output from random() calls.nl()
|
initial value. openssl is then feeded with output from random\() calls.nl()
|
||||||
NOTE:This mechanism is not sufficient for generation of secure keys!
|
NOTE:This mechanism is not sufficient for generation of secure keys!
|
||||||
label(OPTION_OPENSSL_FIPS)dit(bf(tt(fips)))
|
label(OPTION_OPENSSL_FIPS)dit(bf(tt(fips)))
|
||||||
Enables FIPS mode if compiled in. For info about the FIPS encryption
|
Enables FIPS mode if compiled in. For info about the FIPS encryption
|
||||||
|
@ -3171,8 +3168,8 @@ dit(bf(tt(socat -U TCP:target:9999,end-close TCP-L:8888,reuseaddr,fork)))
|
||||||
merges data arriving from different TCP streams on port 8888 to just one stream
|
merges data arriving from different TCP streams on port 8888 to just one stream
|
||||||
to target:9999. The link(end-close)(OPTION_END_CLOSE) option prevents the child
|
to target:9999. The link(end-close)(OPTION_END_CLOSE) option prevents the child
|
||||||
processes forked off by the second address from terminating the shared
|
processes forked off by the second address from terminating the shared
|
||||||
connection to 9999 (close(2) just unlinks the inode which stays active as long
|
connection to 9999 (close\(2) just unlinks the inode which stays active as long
|
||||||
as the parent process lives; shutdown(2) would actively terminate the
|
as the parent process lives; shutdown\(2) would actively terminate the
|
||||||
connection).
|
connection).
|
||||||
|
|
||||||
|
|
||||||
|
@ -3195,7 +3192,7 @@ tt(SO_BROADCAST).
|
||||||
label(EXAMPLE_ADDRESS_IP4_BROADCAST_CLIENT)
|
label(EXAMPLE_ADDRESS_IP4_BROADCAST_CLIENT)
|
||||||
dit(bf(tt(socat - IP4-DATAGRAM:255.255.255.255:44,broadcast,range=10.0.0.0/8)))
|
dit(bf(tt(socat - IP4-DATAGRAM:255.255.255.255:44,broadcast,range=10.0.0.0/8)))
|
||||||
|
|
||||||
sends a broadcast to the local network(s) using protocol 44. Accepts replies
|
sends a broadcast to the local network\(s) using protocol 44. Accepts replies
|
||||||
from the private address range only.
|
from the private address range only.
|
||||||
|
|
||||||
|
|
||||||
|
@ -3245,7 +3242,7 @@ servers), and the original client request.
|
||||||
label(EXAMPLE_ANCILLARY)
|
label(EXAMPLE_ANCILLARY)
|
||||||
dit(bf(tt(socat -d -d UDP4-RECVFROM:9999,so-broadcast,so-timestamp,ip-pktinfo,ip-recverr,ip-recvopts,ip-recvtos,ip-recvttl!!- SYSTEM:'export; sleep 1' |grep SOCAT)))
|
dit(bf(tt(socat -d -d UDP4-RECVFROM:9999,so-broadcast,so-timestamp,ip-pktinfo,ip-recverr,ip-recvopts,ip-recvtos,ip-recvttl!!- SYSTEM:'export; sleep 1' |grep SOCAT)))
|
||||||
|
|
||||||
waits for incoming UDP packets on port 9999 and prints the environment
|
waits for an incoming UDP packets on port 9999 and prints the environment
|
||||||
variables provided by socat. On BSD based systems you have to replace
|
variables provided by socat. On BSD based systems you have to replace
|
||||||
link(tt(ip-pktinfo))(OPTION_IP_PKTINFO) with link(tt(ip-recvdstaddr))(OPTION_IP_RECVDSTADDR),link(tt(ip-recvif))(OPTION_IP_RECVIF). Especially interesting is
|
link(tt(ip-pktinfo))(OPTION_IP_PKTINFO) with link(tt(ip-recvdstaddr))(OPTION_IP_RECVDSTADDR),link(tt(ip-recvif))(OPTION_IP_RECVIF). Especially interesting is
|
||||||
SOCAT_IP_DSTADDR: it contains the target address of the packet which may be a
|
SOCAT_IP_DSTADDR: it contains the target address of the packet which may be a
|
||||||
|
@ -3323,7 +3320,7 @@ result (with differing IP version) is taken. With value 0, socat always selects
|
||||||
the first record and its IP version.
|
the first record and its IP version.
|
||||||
|
|
||||||
dit(bf(SOCAT_FORK_WAIT) (input)) Specifies the time (seconds) to sleep the
|
dit(bf(SOCAT_FORK_WAIT) (input)) Specifies the time (seconds) to sleep the
|
||||||
parent and child processes after successful fork(). Useful for debugging.
|
parent and child processes after successful fork\(). Useful for debugging.
|
||||||
|
|
||||||
dit(bf(SOCAT_VERSION) (output)) Socat sets this variable to its version string,
|
dit(bf(SOCAT_VERSION) (output)) Socat sets this variable to its version string,
|
||||||
e.g. tt("1.7.0.0") for released versions or e.g. tt("1.6.0.1+envvar") for
|
e.g. tt("1.7.0.0") for released versions or e.g. tt("1.6.0.1+envvar") for
|
||||||
|
@ -3472,8 +3469,8 @@ label(SEEALSO)
|
||||||
manpageseealso()
|
manpageseealso()
|
||||||
|
|
||||||
COMMENT(procan\(1), filan\(1), )
|
COMMENT(procan\(1), filan\(1), )
|
||||||
nc(1), netcat6(1), sock(1), rinetd(8), cage(1), socks.conf(5), openssl(1),
|
nc\(1), netcat6\(1), sock\(1), rinetd\(8), cage\(1), socks.conf\(5), openssl\(1),
|
||||||
stunnel(8), pty(1), rlwrap(1), setsid(1)
|
stunnel\(8), pty\(1), rlwrap\(1), setsid\(1)
|
||||||
|
|
||||||
Socat() home page lurl(http://www.dest-unreach.org/socat/)
|
Socat() home page lurl(http://www.dest-unreach.org/socat/)
|
||||||
|
|
||||||
|
|
4
mail.sh
4
mail.sh
|
@ -8,7 +8,9 @@
|
||||||
# This is an example for a shell script that can be fed to socat with exec.
|
# This is an example for a shell script that can be fed to socat with exec.
|
||||||
# Its clue is that it does not use stdin/stdout for communication with socat,
|
# Its clue is that it does not use stdin/stdout for communication with socat,
|
||||||
# so you may feed the mail message via stdin to the script. The message should
|
# so you may feed the mail message via stdin to the script. The message should
|
||||||
# contain appropriate mail headers.
|
# contain appropriate mail headers without continuation lines.
|
||||||
|
# socat establishes the connection to the SMTP server; the script performs the
|
||||||
|
# SMTP dialog and afterwards transfers the message body to the server.
|
||||||
# Lines with only a dot are not permitted - use two dots as escape.
|
# Lines with only a dot are not permitted - use two dots as escape.
|
||||||
# This script supports multiline answers from server, but not much more yet.
|
# This script supports multiline answers from server, but not much more yet.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
# source: proxyecho.sh
|
# source: proxyecho.sh
|
||||||
# Copyright Gerhard Rieger 2003
|
# Copyright Gerhard Rieger 2003-2009
|
||||||
# Published under the GNU General Public License V.2, see file COPYING
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
# perform primitive simulation of a proxy server with echo function via stdio.
|
# perform primitive simulation of a proxy server with echo function via stdio.
|
||||||
|
@ -56,4 +56,4 @@ echo "HTTP/1.0${SPACES}200 OK"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# perform echo function
|
# perform echo function
|
||||||
$CAT
|
exec $CAT
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: sysincludes.h */
|
/* source: sysincludes.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2008 */
|
/* Copyright Gerhard Rieger 2001-2009 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __sysincludes_h_included
|
#ifndef __sysincludes_h_included
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
#if HAVE_GRP_H
|
#if HAVE_GRP_H
|
||||||
#include <grp.h> /* getgrnam() */
|
#include <grp.h> /* getgrnam() */
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_PTY_H && _WITH_TERMIOS
|
#if HAVE_PTY_H && (_WITH_TERMIOS || HAVE_OPENPTY)
|
||||||
#include <pty.h>
|
#include <pty.h>
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
|
|
62
test.sh
62
test.sh
|
@ -2054,7 +2054,7 @@ waitfile () {
|
||||||
# generate a test certificate and key
|
# generate a test certificate and key
|
||||||
gentestcert () {
|
gentestcert () {
|
||||||
local name="$1"
|
local name="$1"
|
||||||
if [ -f $name.key -a -f $name.crt -a -f $name.pem ]; then return; fi
|
if [ -s $name.key -a -s $name.crt -a -s $name.pem ]; then return; fi
|
||||||
openssl genrsa $OPENSSL_RAND -out $name.key 768 >/dev/null 2>&1
|
openssl genrsa $OPENSSL_RAND -out $name.key 768 >/dev/null 2>&1
|
||||||
openssl req -new -config testcert.conf -key $name.key -x509 -out $name.crt -days 3653 >/dev/null 2>&1
|
openssl req -new -config testcert.conf -key $name.key -x509 -out $name.crt -days 3653 >/dev/null 2>&1
|
||||||
cat $name.key $name.crt >$name.pem
|
cat $name.key $name.crt >$name.pem
|
||||||
|
@ -2063,7 +2063,7 @@ gentestcert () {
|
||||||
# generate a test DSA key and certificate
|
# generate a test DSA key and certificate
|
||||||
gentestdsacert () {
|
gentestdsacert () {
|
||||||
local name="$1"
|
local name="$1"
|
||||||
if [ -f $name.key -a -f $name.crt -a -f $name.pem ]; then return; fi
|
if [ -s $name.key -a -s $name.crt -a -s $name.pem ]; then return; fi
|
||||||
openssl dsaparam -out $name-dsa.pem 512 >/dev/null 2>&1
|
openssl dsaparam -out $name-dsa.pem 512 >/dev/null 2>&1
|
||||||
openssl dhparam -dsaparam -out $name-dh.pem 512 >/dev/null 2>&1
|
openssl dhparam -dsaparam -out $name-dh.pem 512 >/dev/null 2>&1
|
||||||
openssl req -newkey dsa:$name-dsa.pem -keyout $name.key -nodes -x509 -config testcert.conf -out $name.crt -days 3653 >/dev/null 2>&1
|
openssl req -newkey dsa:$name-dsa.pem -keyout $name.key -nodes -x509 -config testcert.conf -out $name.crt -days 3653 >/dev/null 2>&1
|
||||||
|
@ -4564,7 +4564,7 @@ case "$TESTS" in
|
||||||
TEST="$NAME: readline with password and sigint"
|
TEST="$NAME: readline with password and sigint"
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! feat=$(testaddrs readline pty); then
|
elif ! feat=$(testaddrs readline pty); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
SAVETERM="$TERM"; TERM= # 'cause konsole might print controls even in raw
|
SAVETERM="$TERM"; TERM= # 'cause konsole might print controls even in raw
|
||||||
|
@ -4708,7 +4708,7 @@ case "$TESTS" in
|
||||||
TEST="$NAME: gender changer via SSL through HTTP proxy, oneshot"
|
TEST="$NAME: gender changer via SSL through HTTP proxy, oneshot"
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! feat=$(testaddrs openssl proxy); then
|
elif ! feat=$(testaddrs openssl proxy); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat |tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat" |tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
gentestcert testsrv
|
gentestcert testsrv
|
||||||
|
@ -4793,7 +4793,7 @@ case "$TESTS" in
|
||||||
TEST="$NAME: gender changer via SSL through HTTP proxy, daemons"
|
TEST="$NAME: gender changer via SSL through HTTP proxy, daemons"
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! feat=$(testaddrs openssl proxy); then
|
elif ! feat=$(testaddrs openssl proxy); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
gentestcert testsrv
|
gentestcert testsrv
|
||||||
|
@ -5661,10 +5661,10 @@ case "$TESTS" in
|
||||||
TEST="$NAME: test if master pty ($PTYTYPE) waits for slave connection"
|
TEST="$NAME: test if master pty ($PTYTYPE) waits for slave connection"
|
||||||
if ! eval $NUMCOND; then :; else
|
if ! eval $NUMCOND; then :; else
|
||||||
if ! feat=$(testaddrs pty); then
|
if ! feat=$(testaddrs pty); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
elif ! feat=$(testoptions "$PTYTYPE" pty-wait-slave); then
|
elif ! feat=$(testoptions "$PTYTYPE" pty-wait-slave); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}option $(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}option $(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
testptywaitslave "$N" "$TEST" "$PTYTYPE" "$opts"
|
testptywaitslave "$N" "$TEST" "$PTYTYPE" "$opts"
|
||||||
|
@ -5680,10 +5680,10 @@ case "$TESTS" in
|
||||||
TEST="$NAME: test if master pty ($PTYTYPE) waits for slave connection"
|
TEST="$NAME: test if master pty ($PTYTYPE) waits for slave connection"
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! feat=$(testaddrs pty); then
|
elif ! feat=$(testaddrs pty); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
elif ! feat=$(testoptions "$PTYTYPE" pty-wait-slave); then
|
elif ! feat=$(testoptions "$PTYTYPE" pty-wait-slave); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}option $(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}option $(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
testptywaitslave "$N" "$TEST" "$PTYTYPE" "$opts"
|
testptywaitslave "$N" "$TEST" "$PTYTYPE" "$opts"
|
||||||
|
@ -5698,10 +5698,10 @@ case "$TESTS" in
|
||||||
TEST="$NAME: test the connect-timeout option"
|
TEST="$NAME: test the connect-timeout option"
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! feat=$(testaddrs tcp); then
|
elif ! feat=$(testaddrs tcp); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
elif ! feat=$(testoptions connect-timeout); then
|
elif ! feat=$(testoptions connect-timeout); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
# we need a hanging connection attempt, guess an address for this
|
# we need a hanging connection attempt, guess an address for this
|
||||||
|
@ -5840,7 +5840,7 @@ N=$((N+1))
|
||||||
signum () {
|
signum () {
|
||||||
if [ ! "$BASH_VERSION" -o -o posix ]; then
|
if [ ! "$BASH_VERSION" -o -o posix ]; then
|
||||||
# we expect:
|
# we expect:
|
||||||
for i in $(POSIXLY_CORRECT=1 kill -l); do echo $i; done |grep -n -i "^$1$" |cut -d: -f1
|
for i in $(POSIXLY_CORRECT=1 kill -l); do echo "$i"; done |grep -n -i "^$1$" |cut -d: -f1
|
||||||
else
|
else
|
||||||
# expect:
|
# expect:
|
||||||
# " 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL"
|
# " 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL"
|
||||||
|
@ -5860,7 +5860,7 @@ case "$TESTS" in
|
||||||
TEST="$NAME: exit status when dying on SIG$signam"
|
TEST="$NAME: exit status when dying on SIG$signam"
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! feat=$(testaddrs pty); then
|
elif ! feat=$(testaddrs pty); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat |tr a-z A-Z) not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat" |tr a-z A-Z) not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
SIG="$(signum $signam)"
|
SIG="$(signum $signam)"
|
||||||
|
@ -5904,7 +5904,7 @@ case "$TESTS" in
|
||||||
TEST="$NAME: restrict reading from file with bytes option"
|
TEST="$NAME: restrict reading from file with bytes option"
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif false; then
|
elif false; then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
tr="$td/test$N.ref"
|
tr="$td/test$N.ref"
|
||||||
|
@ -7902,7 +7902,8 @@ waitip4proto $ts1p 1
|
||||||
usleep $MICROS
|
usleep $MICROS
|
||||||
echo "$da" |$CMD2 2>>"${te}2"
|
echo "$da" |$CMD2 2>>"${te}2"
|
||||||
rc2="$?"
|
rc2="$?"
|
||||||
usleep $MICROS
|
#usleep $MICROS
|
||||||
|
sleep 1
|
||||||
kill "$pid1" 2>/dev/null; wait;
|
kill "$pid1" 2>/dev/null; wait;
|
||||||
if [ "$rc2" -ne 0 ]; then
|
if [ "$rc2" -ne 0 ]; then
|
||||||
$PRINTF "$FAILED: $SOCAT:\n"
|
$PRINTF "$FAILED: $SOCAT:\n"
|
||||||
|
@ -8353,7 +8354,7 @@ TEST="$NAME: socat handles data buffered by openssl"
|
||||||
# transferred, the test has failed.
|
# transferred, the test has failed.
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! feat=$(testaddrs openssl) >/dev/null; then
|
elif ! feat=$(testaddrs openssl) >/dev/null; then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
tf="$td/test$N.out"
|
tf="$td/test$N.out"
|
||||||
|
@ -8405,7 +8406,7 @@ TEST="$NAME: trigger EOF after that many bytes, even when socket idle"
|
||||||
# the process did not terminate and the bug is still there.
|
# the process did not terminate and the bug is still there.
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif false; then
|
elif false; then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat"| tr 'a-z' 'A-Z') not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
tr="$td/test$N.ref"
|
tr="$td/test$N.ref"
|
||||||
|
@ -8992,8 +8993,8 @@ while read PF KEYW ADDR IPPORT SCM_ENABLE SCM_RECV SCM_TYPE SCM_NAME ROOT SCM_VA
|
||||||
do
|
do
|
||||||
if [ -z "$PF" ] || [[ "$PF" == \#* ]]; then continue; fi
|
if [ -z "$PF" ] || [[ "$PF" == \#* ]]; then continue; fi
|
||||||
#
|
#
|
||||||
pf="$(echo $PF |tr A-Z a-z)"
|
pf="$(echo "$PF" |tr A-Z a-z)"
|
||||||
proto="$(echo $KEYW |tr A-Z a-z)"
|
proto="$(echo "$KEYW" |tr A-Z a-z)"
|
||||||
NAME=${KEYW}SCM_$SCM_TYPE
|
NAME=${KEYW}SCM_$SCM_TYPE
|
||||||
case "$TESTS" in
|
case "$TESTS" in
|
||||||
*%functions%*|*%$pf%*|*%dgram%*|*%udp%*|*%$proto%*|*%recv%*|*%ancillary%*|*%$ROOT%*|*%$NAME%*)
|
*%functions%*|*%$pf%*|*%dgram%*|*%udp%*|*%$proto%*|*%recv%*|*%ancillary%*|*%$ROOT%*|*%$NAME%*)
|
||||||
|
@ -9113,7 +9114,7 @@ IP6 IP6 [::1] PROTO ipv6-tclass=0xaa ipv6-recvtclass IPV6_TCLASS
|
||||||
while read KEYW FEAT TEST_SOCKADDR TEST_PEERADDR TEST_SOCKPORT TEST_PEERPORT; do
|
while read KEYW FEAT TEST_SOCKADDR TEST_PEERADDR TEST_SOCKPORT TEST_PEERPORT; do
|
||||||
if [ -z "$KEYW" ] || [[ "$KEYW" == \#* ]]; then continue; fi
|
if [ -z "$KEYW" ] || [[ "$KEYW" == \#* ]]; then continue; fi
|
||||||
#
|
#
|
||||||
test_proto="$(echo $KEYW |tr A-Z a-z)"
|
test_proto="$(echo "$KEYW" |tr A-Z a-z)"
|
||||||
NAME=${KEYW}LISTENENV
|
NAME=${KEYW}LISTENENV
|
||||||
case "$TESTS" in
|
case "$TESTS" in
|
||||||
*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$test_proto%*|*%envvar%*|*%$NAME%*)
|
*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$test_proto%*|*%envvar%*|*%$NAME%*)
|
||||||
|
@ -9124,12 +9125,12 @@ TEST="$NAME: $KEYW-LISTEN fills environment variables with socket addresses"
|
||||||
# describing the peer and local sockets.
|
# describing the peer and local sockets.
|
||||||
if ! eval $NUMCOND; then :;
|
if ! eval $NUMCOND; then :;
|
||||||
elif ! feat=$(testaddrs $FEAT); then
|
elif ! feat=$(testaddrs $FEAT); then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo $feat |tr a-z A-Z) not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat" |tr a-z A-Z) not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
tf="$td/test$N.stdout"
|
tf="$td/test$N.stdout"
|
||||||
te="$td/test$N.stderr"
|
te="$td/test$N.stderr"
|
||||||
TEST_SOCKADDR="$(echo $TEST_SOCKADDR |sed "s/\$N/$N/g")" # actual vars
|
TEST_SOCKADDR="$(echo "$TEST_SOCKADDR" |sed "s/\$N/$N/g")" # actual vars
|
||||||
tsa="$TEST_SOCKADDR" # test server address
|
tsa="$TEST_SOCKADDR" # test server address
|
||||||
tsp="$TEST_SOCKPORT" # test server port
|
tsp="$TEST_SOCKPORT" # test server port
|
||||||
if [ "$tsp" != ',' ]; then
|
if [ "$tsp" != ',' ]; then
|
||||||
|
@ -9137,7 +9138,7 @@ if [ "$tsp" != ',' ]; then
|
||||||
else
|
else
|
||||||
tsa1="$tsa"; tsa2= # tsa1 used for addr parameter
|
tsa1="$tsa"; tsa2= # tsa1 used for addr parameter
|
||||||
fi
|
fi
|
||||||
TEST_PEERADDR="$(echo $TEST_PEERADDR |sed "s/\$N/$N/g")" # actual vars
|
TEST_PEERADDR="$(echo "$TEST_PEERADDR" |sed "s/\$N/$N/g")" # actual vars
|
||||||
tca="$TEST_PEERADDR" # test client address
|
tca="$TEST_PEERADDR" # test client address
|
||||||
tcp="$TEST_PEERPORT" # test client port
|
tcp="$TEST_PEERPORT" # test client port
|
||||||
if [ "$tcp" != ',' ]; then
|
if [ "$tcp" != ',' ]; then
|
||||||
|
@ -9183,11 +9184,11 @@ else
|
||||||
cat "${te}1"
|
cat "${te}1"
|
||||||
numFAIL=$((numFAIL+1))
|
numFAIL=$((numFAIL+1))
|
||||||
fi
|
fi
|
||||||
set +xv
|
|
||||||
fi # NUMCOND, feats
|
fi # NUMCOND, feats
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
N=$((N+1))
|
N=$((N+1))
|
||||||
|
set +xv
|
||||||
#
|
#
|
||||||
done <<<"
|
done <<<"
|
||||||
TCP4 TCP $LOCALHOST $SECONDADDR $PORT $((PORT+1))
|
TCP4 TCP $LOCALHOST $SECONDADDR $PORT $((PORT+1))
|
||||||
|
@ -9206,8 +9207,8 @@ while read PF KEYW ADDR IPPORT SCM_ENABLE SCM_RECV SCM_ENVNAME ROOT SCM_VALUE
|
||||||
do
|
do
|
||||||
if [ -z "$PF" ] || [[ "$PF" == \#* ]]; then continue; fi
|
if [ -z "$PF" ] || [[ "$PF" == \#* ]]; then continue; fi
|
||||||
#
|
#
|
||||||
pf="$(echo $PF |tr A-Z a-z)"
|
pf="$(echo "$PF" |tr A-Z a-z)"
|
||||||
proto="$(echo $KEYW |tr A-Z a-z)"
|
proto="$(echo "$KEYW" |tr A-Z a-z)"
|
||||||
NAME=${KEYW}ENV_$SCM_ENVNAME
|
NAME=${KEYW}ENV_$SCM_ENVNAME
|
||||||
case "$TESTS" in
|
case "$TESTS" in
|
||||||
*%functions%*|*%$pf%*|*%dgram%*|*%udp%*|*%$proto%*|*%recv%*|*%ancillary%*|*%envvar%*|*%$ROOT%*|*%$NAME%*)
|
*%functions%*|*%$pf%*|*%dgram%*|*%udp%*|*%$proto%*|*%recv%*|*%ancillary%*|*%envvar%*|*%$ROOT%*|*%$NAME%*)
|
||||||
|
@ -9918,7 +9919,7 @@ printf "test $F_n $TEST... " $N
|
||||||
$CMD1 >"$tf" 2>"${te}1" &
|
$CMD1 >"$tf" 2>"${te}1" &
|
||||||
pid1=$!
|
pid1=$!
|
||||||
waitsctp4port $tsl 1
|
waitsctp4port $tsl 1
|
||||||
# SCTP does not seem to support half close, so we let it 1s to finish
|
# SCTP does not seem to support half close, so we give it 1s to finish
|
||||||
(echo "$da"; sleep 1) |$CMD2 >>"$tf" 2>>"${te}2"
|
(echo "$da"; sleep 1) |$CMD2 >>"$tf" 2>>"${te}2"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
$PRINTF "$FAILED: $SOCAT:\n"
|
$PRINTF "$FAILED: $SOCAT:\n"
|
||||||
|
@ -9974,8 +9975,9 @@ waitsctp6port $tsl 1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
$PRINTF "$FAILED: $SOCAT:\n"
|
$PRINTF "$FAILED: $SOCAT:\n"
|
||||||
echo "$CMD1 &"
|
echo "$CMD1 &"
|
||||||
|
cat "${te}1"
|
||||||
echo "$CMD2"
|
echo "$CMD2"
|
||||||
cat "$te"
|
cat "${te}2"
|
||||||
numFAIL=$((numFAIL+1))
|
numFAIL=$((numFAIL+1))
|
||||||
elif ! echo "$da" |diff - "$tf" >"$tdiff"; then
|
elif ! echo "$da" |diff - "$tf" >"$tdiff"; then
|
||||||
$PRINTF "$FAILED: diff:\n"
|
$PRINTF "$FAILED: diff:\n"
|
||||||
|
@ -10025,12 +10027,12 @@ case "$TESTS" in
|
||||||
TEST="$NAME: give a one line description of test"
|
TEST="$NAME: give a one line description of test"
|
||||||
# describe how the test is performed, and what's the success criteria
|
# describe how the test is performed, and what's the success criteria
|
||||||
if ! eval $NUMCOND; then :; else
|
if ! eval $NUMCOND; then :; else
|
||||||
tf="$td/test$N.stout"
|
tf="$td/test$N.stdout"
|
||||||
te="$td/test$N.stderr"
|
te="$td/test$N.stderr"
|
||||||
tdiff="$td/test$N.diff"
|
tdiff="$td/test$N.diff"
|
||||||
da="test$N $(date) $RANDOM"
|
da="test$N $(date) $RANDOM"
|
||||||
CMD0="$SOCAT $opts server-address PIPE"
|
CMD0="$SOCAT $opts server-address PIPE"
|
||||||
CMD1="$SOCAT - client-address"
|
CMD1="$SOCAT $opts - client-address"
|
||||||
printf "test $F_n $TEST... " $N
|
printf "test $F_n $TEST... " $N
|
||||||
$CMD0 >/dev/null 2>"${te}0" &
|
$CMD0 >/dev/null 2>"${te}0" &
|
||||||
pid0=$!
|
pid0=$!
|
||||||
|
|
|
@ -926,6 +926,7 @@ const struct optname optionnames[] = {
|
||||||
#ifdef O_NSHARE
|
#ifdef O_NSHARE
|
||||||
IF_OPEN ("nshare", &opt_o_nshare)
|
IF_OPEN ("nshare", &opt_o_nshare)
|
||||||
#endif
|
#endif
|
||||||
|
IF_ANY ("o-append", &opt_append)
|
||||||
#ifdef O_ASYNC
|
#ifdef O_ASYNC
|
||||||
IF_ANY ("o-async", &opt_async)
|
IF_ANY ("o-async", &opt_async)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue