1SOCKET_WRAPPER(1) SOCKET_WRAPPER(1)
2
3
4
6 socket_wrapper - A library passing all socket communications through
7 unix sockets.
8
10 LD_PRELOAD=libsocket_wrapper.so SOCKET_WRAPPER_DIR=/tmp/tmp.bQRELqDrhM
11 SOCKET_WRAPPER_DEFAULT_IFACE=10 ./myapplication
12
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
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
93 # Open a console and create a directory for the unix sockets.
94 $ mktemp -d
95 /tmp/tmp.bQRELqDrhM
96
97 # Then start nc to listen for network traffic using the temporary directory.
98 $ LD_PRELOAD=libsocket_wrapper.so \
99 SOCKET_WRAPPER_DIR=/tmp/tmp.bQRELqDrhM \
100 SOCKET_WRAPPER_DEFAULT_IFACE=10 nc -v -l 127.0.0.10 7
101
102 # (If nc, listens on 0.0.0.0 then listener will be open on 127.0.0.10 because
103 # it is the default interface)
104
105 # Now open another console and start 'nc' as a client to connect to the server:
106 $ LD_PRELOAD=libsocket_wrapper.so \
107 SOCKET_WRAPPER_DIR=/tmp/tmp.bQRELqDrhM \
108 SOCKET_WRAPPER_DEFAULT_IFACE=100 nc -v 127.0.0.10 7
109
110 # (The client will use the address 127.0.0.100 when connecting to the server)
111 # Now you can type 'Hello!' which will be sent to the server and should appear
112 # in the console output of the server.
113
115 Samba Team
116 Author.
117
118
119
120 2018-11-28 SOCKET_WRAPPER(1)