1SOCKET_WRAPPER(1)                                            SOCKET_WRAPPER(1)
2
3
4

NAME

6       socket_wrapper - A library passing all socket communications through
7       unix sockets.
8

SYNOPSIS

10       LD_PRELOAD=libsocket_wrapper.so SOCKET_WRAPPER_DIR=/tmp/tmp.bQRELqDrhM
11       SOCKET_WRAPPER_DEFAULT_IFACE=10 ./myapplication
12

DESCRIPTION

14       socket_wrapper aims to help client/server software development teams
15       willing to gain full functional test coverage. It makes possible to run
16       several instances of the full software stack on the same machine and
17       perform locally functional testing of complex network configurations.
18
19       ·   Redirects all network communication to happen over Unix sockets.
20
21       ·   Support for IPv4 and IPv6 socket and addressing emulation.
22
23       ·   Ability to capture network traffic in pcap format.
24

ENVIRONMENT VARIABLES

26       SOCKET_WRAPPER_DIR
27           The user defines a directory where to put all the unix sockets
28           using the environment variable
29           "SOCKET_WRAPPER_DIR=/path/to/socket_dir". When a server opens a
30           port or a client wants to connect, socket_wrapper will translate IP
31           addresses to a special socket_wrapper name and look for the
32           relevant Unix socket in the SOCKET_WRAPPER_DIR.
33
34       SOCKET_WRAPPER_IPV4_NETWORK
35           By default the loopback IPv4 network "127.0.0.0/8" and the
36           "127.0.0.x" can be used. In order to make more realistic testing
37           possible it is possible to use the "10.0.0.0/8" IPv4 network
38           instead. But note within "10.0.0.0/8" only "10.53.57.<ID>" can be
39           used, but the broadcast address is "10.255.255.255". The following
40           two value are allowed: SOCKET_WRAPPER_IPV4_NETWORK="127.0.0.0" (the
41           default) and SOCKET_WRAPPER_IPV4_NETWORK="10.53.57.0".
42
43       SOCKET_WRAPPER_DEFAULT_IFACE
44           Additionally, the default interface to be used by an application is
45           defined with "SOCKET_WRAPPER_DEFAULT_IFACE=<ID>" where the valid
46           range for <ID> starts with 1 (the default) and ends with 64. This
47           is analogous to use the IPv4 addresses
48           "127.0.0.<ID>"/"10.53.57.<ID>" or IPv6 addresses
49           "fd00::5357:5f<IDx>" (where <IDx> is a hexadecimal presentation of
50           <ID>). You should always set the default interface. If you listen
51           on INADDR_ANY then it will use the default interface to listen on.
52
53       SOCKET_WRAPPER_PCAP_FILE
54           When debugging, it is often interesting to investigate the network
55           traffic between the client and server within your application. If
56           you define SOCKET_WRAPPER_PCAP_FILE=/path/to/file.pcap,
57           socket_wrapper will dump all your network traffic to the specified
58           file. After the test has been finished you’re able to open the file
59           for example with Wireshark.
60
61       SOCKET_WRAPPER_MTU
62           With this variable you can change the MTU size. However we do not
63           recomment to do that as the default size of 1500 byte is best for
64           formatting PCAP files.
65
66       The minimum value you can set is 512 and the maximum 32768.
67
68       SOCKET_WRAPPER_MAX_SOCKETS
69           This variable can be used to set the maximum number of sockets to
70           be used by an application.
71
72       The default value is set to 65535 and the maximum 256000.
73
74       SOCKET_WRAPPER_DEBUGLEVEL
75           If you need to see what is going on in socket_wrapper itself or try
76           to find a bug, you can enable logging support in socket_wrapper if
77           you built it with debug symbols.
78
79           ·   0 = ERROR
80
81           ·   1 = WARNING
82
83           ·   2 = DEBUG
84
85           ·   3 = TRACE
86
87       SOCKET_WRAPPER_DISABLE_DEEPBIND
88           This allows you to disable deep binding in socket_wrapper. This is
89           useful for running valgrind tools or sanitizers like (address,
90           undefined, thread).
91
92       SOCKET_WRAPPER_DIR_ALLOW_ORIG
93           SOCKET_WRAPPER_DIR is resolved by socket_wrapper using realpath(3).
94           Given that Unix sockets are constructed relative to this directory,
95           the resulting path can sometimes be too long to allow valid socket
96           paths to be constructed due to length restrictions. Setting this
97           variable (to any value) allows socket_wrapper to fall back to the
98           original value of SOCKET_WRAPPER_DIR if realpath(3) makes it too
99           long to be usable.
100

EXAMPLE

102           # Open a console and create a directory for the unix sockets.
103           $ mktemp -d
104           /tmp/tmp.bQRELqDrhM
105
106           # Then start nc to listen for network traffic using the temporary directory.
107           $ LD_PRELOAD=libsocket_wrapper.so \
108             SOCKET_WRAPPER_DIR=/tmp/tmp.bQRELqDrhM \
109             SOCKET_WRAPPER_DEFAULT_IFACE=10 nc -v -l 127.0.0.10 7
110
111           # (If nc, listens on 0.0.0.0 then listener will be open on 127.0.0.10 because
112           #  it is the default interface)
113
114           # Now open another console and start 'nc' as a client to connect to the server:
115           $ LD_PRELOAD=libsocket_wrapper.so \
116             SOCKET_WRAPPER_DIR=/tmp/tmp.bQRELqDrhM \
117             SOCKET_WRAPPER_DEFAULT_IFACE=100 nc -v 127.0.0.10 7
118
119           # (The client will use the address 127.0.0.100 when connecting to the server)
120           # Now you can type 'Hello!' which will be sent to the server and should appear
121           # in the console output of the server.
122

AUTHOR

124       Samba Team
125           Author.
126
127
128
129                                  2018-11-28                 SOCKET_WRAPPER(1)
Impressum