From 6dc9f3fff798e2c03a726192d4ec07190f7b9cd4 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sat, 21 Jul 2012 15:31:23 +0200 Subject: [PATCH] so-bindtodevice in doc, minor corrections in doc; added environment example to doc/socat-multicast.html --- CHANGES | 5 +++ doc/socat-multicast.html | 70 +++++++++++++++++++++++++++++++++------- doc/socat.yo | 2 +- 3 files changed, 65 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index d018be8..2b23ad0 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,11 @@ corrections: fixed a compile problem caused by size_t/socklen_t mismatch on 64bit systems + docu mentions option so-bindtodev but correct name is so-bindtodevice. + Thanks to Jim Zimmerman for reporting. + + minor corrections in doc + ####################### V 2.0.0-b7: security: diff --git a/doc/socat-multicast.html b/doc/socat-multicast.html index a4caedd..8bf9fcb 100644 --- a/doc/socat-multicast.html +++ b/doc/socat-multicast.html @@ -216,22 +216,25 @@ When you receive an error like:

... E sendto(3, 0x80c2e44, 4, 0, AF=2 224.1.0.1:6666, 16): Network is unreachable

you have a routing problem. The (Linux) IP stack seems to handle multicast -addresses just like unicast addresses when determining their route (interface and gateway).

+addresses just like unicast addresses when determining their route (interface + and gateway), i.e. the routing table needs an entry that somehow matches the + target address.

For the same reason, multicast packets will probably leave your host on the -interface with the default route.

+interface with the default route if it is specified.

-Set a multicast/broadcast route with the following command:

+Set a multicast/broadcast route with the following command (Linux):

route add -net 224.0.0.0/3 gw 192.168.10.2 - +

ALL-SYSTEMS multicast address

-224.0.0.1 is the all-systems multicast address: all +224.0.0.1 is the all-systems multicast address: 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 (you need iptables to +filter packets).

@@ -240,11 +243,11 @@ interfaces. This membership cannot be dropped on Linux.

When you use the above examples you should understand that all datagram 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 this functionality. socat currently has no means to handle incoming packets -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. +differently whether they are addressed to unicast, multicast, or broadcast +addresses. However, for EXEC'd scripts socat can provide this info in +environment variables.

Authentication or encryption are not available.

@@ -301,7 +304,51 @@ Please note that the new features could not be successfully tested on IPv6; these sections thus apply to IPv4 only.

-

This document was last modified in April 2009.

+

New Features in socat 1.7.0

+ +

+socat version 1.7.0 helps to find more information about incoming packets in +environment variables that can be used in scripts or programs invoked by +socat. The option ip-pktinfo (on non-BSD systems) +or ip-recvdstaddr (on BSD systems) is required to get basic +information about incoming packets. +

+ +

+Example: Start a receiver of the following form (tried on Linux): +

+ + +socat -u UDP-RECVFROM:8888,reuseaddr,ip-add-membership=224.1.0.1:192.168.10.2,ip-pktinfo,fork SYSTEM:export + + +

+Then send a multicast packet from the client: +

+ + +echo |socat -u STDIO UDP-DATAGRAM:224.1.0.1:8888 + + +

+On the server the following text should appear (only interesting lines shown): +

+ +
+export SOCAT_IP_DSTADDR="224.1.0.1"
+export SOCAT_IP_IF="eth0"
+export SOCAT_IP_LOCADDR="192.168.10.2"
+export SOCAT_PEERADDR="192.168.10.1"
+export SOCAT_PEERPORT="41159"
+
+ +

+SOCAT_IP_IF shows the interface where the packet entered the server; +SOCAT_IP_LOCADDR shows the IP address of this interface; +SOCAT_IP_DSTADDR shows the target address of the packet; +SOCAT_PEERADDR and SOCAT_PEERPORT are the client socket +values. +

More info about socat datagrams

@@ -336,6 +383,7 @@ with one peer address
broadcasting on Wikipedia

+This document was last modified in May 2009.
Copyright: Gerhard Rieger 2007-2009
License: GNU Free Documentation License (FDL)

diff --git a/doc/socat.yo b/doc/socat.yo index dc83081..22a334a 100644 --- a/doc/socat.yo +++ b/doc/socat.yo @@ -1858,7 +1858,7 @@ label(OPTION_BIND)dit(bf(tt(bind=))) label(OPTION_CONNECT_TIMEOUT)dit(bf(tt(connect-timeout=))) Abort the connection attempt after [link(timeval)(TYPE_TIMEVAL)] with error status. -label(OPTION_SO_BINDTODEV)dit(bf(tt(so-bindtodev=))) +label(OPTION_SO_BINDTODEVICE)dit(bf(tt(so-bindtodev=))) Binds the socket to the given link()(TYPE_INTERFACE). This option might require root privilege. label(OPTION_SO_BROADCAST)dit(bf(tt(broadcast)))