chiark / gitweb /
Upgrade licence to GPLv3+.
[tripe] / uslip / tripe-uslip.1.in
CommitLineData
49f86fe4
MW
1.\" -*-nroff-*-
2.\"
3.\" Documentation for uslip
4.\"
5.\" (c) 2008 Straylight/Edgeware.
6.\"
11ad66c2 7.
49f86fe4
MW
8.\"----- Licensing notice ---------------------------------------------------
9.\"
10.\" This file is part of Trivial IP Encryption (TrIPE).
11.\"
11ad66c2
MW
12.\" TrIPE is free software: you can redistribute it and/or modify it under
13.\" the terms of the GNU General Public License as published by the Free
14.\" Software Foundation; either version 3 of the License, or (at your
15.\" option) any later version.
49f86fe4 16.\"
11ad66c2
MW
17.\" TrIPE is distributed in the hope that it will be useful, but WITHOUT
18.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20.\" for more details.
49f86fe4
MW
21.\"
22.\" You should have received a copy of the GNU General Public License
11ad66c2 23.\" along with TrIPE. If not, see <https://www.gnu.org/licenses/>.
49f86fe4
MW
24.
25.\"--------------------------------------------------------------------------
e99aedcf 26.so ../common/defs.man \" @@@PRE@@@
49f86fe4
MW
27.
28.\"--------------------------------------------------------------------------
0647ba7c 29.TH tripe-uslip 1tripe "7 April 2008" "Straylight/Edgeware" "TrIPE: Trivial IP Encryption"
49f86fe4
MW
30.
31.\"--------------------------------------------------------------------------
32.SH "NAME"
33.
34tripe-uslip \- fake SLIP interface for testing tripe
35.
36.\"--------------------------------------------------------------------------
37.SH "SYNOPSIS"
38.
39.B tripe-uslip
1e14551a 40.RB [ \-fgps ]
49f86fe4
MW
41.I socket
42.
43.\"--------------------------------------------------------------------------
44.SH "DESCRIPTION"
45.
46The
47.B tripe-uslip
48provides a mechanism for pushing packets of data into a
49.BR tripe (8)
50server, and extracting them. This is useful for testing the server; it
51isn't useful in a production environment.
52.SS "Overview and theory of operation"
53Testing the
54.BR tripe (8)
55server is difficult: configuring network interfaces and creating tunnels
56requires root privileges (undesirable for a program under development!)
57and testing that it successfully transports network packets needs two
58separate instances running on separate machines. (If both ends of a
59tunnel are on the same host then the packets won't actually go over the
60tunnel: the kernel will just loop them back internally.)
61.PP
62The
63.B tripe-uslip
64program implements the interface required of a dynamic allocation script
65(see the
66.BR tripe (8)
67manual for details). However, it doesn't actually make a network
68interface.
69.PP
70You use it by setting
71.IP
72.BI TRIPE_SLIPIF= dir /tripe-uslip
73.PP
74in the environment passed to the
75.BR tripe (8)
76server (and, typically, passing it the
77.B \-tslip
78command-line option). When you add a new peer with the
79.B ADD
80.I peer
81.IR address ...
82administration command, the server runs
83.IB dir /tripe-uslip
84.IR peer ,
85which in turn creates a Unix-domain socket called
86.I peer
87in the server's current directory. If you run
88.IP
89.B tripe-uslip
90.B \-p
91.I peer
92.BI < file
93.PP
94in this directory, then the contents of
95.I file
96are sent to
97.B tripe
98as if they were a network packet to be encrypted and transmitted over
99its tunnel. (Any method of providing the data on standard input is
100acceptable: it doesn't have to be a regular file. In particular, pipes
101are fine. Note also that
102.B tripe
103doesn't actually care that the data it receives is actually network
104packets: it can be absolutely anything you like.)
105.PP
106If you run
107.IP
108.B tripe-uslip
109.B \-g
110.I peer
111.BI > file
112.PP
113then the contents of the next network packet the server decrypts will be
114written to the
115.IR file .
116(Again, you can use pipes or whatever.)
117.PP
118The
119.B tripe-uslip
120program is fully nonblocking. This means that you won't deadlock the
121server by attaching duff scripts to it via
122.BR tripe-uslip .
123.SS "Technical details"
124Without options,
125.B tripe-uslip
126performs the following actions.
127.hP \*o
128It creates a Unix-domain socket with name
129.I socket
130(which will typically be the name of the peer that
131.BR tripe (8)
132created this interface for).
133.hP \*o
134It writes the string
135.BI tripe-uslip- socket
136to its standard output, followed by a newline.
137.hP \*o
138It reads and discards up to two bytes with value 192 (SLIP
139.BR END )
140on stdin.
141.hP \*o
142It enters its main loop, during which it accepts and processes client
143connections, and reads and writes SLIP-encoded packets on standard input
144and output. Unless a fatal error occurs, the main loop continues until
145it (a) has no connected clients, (b) has no packets queued for output to
146clients or to standard output, and (c) has seen end-of-file on its
147standard input.
148.PP
149The main loop works as follows. When a SLIP-encoded packet arrives on
150standard input, it is decoded and placed on a queue waiting to be read
151from a client. If a client connects and writes a packet, the packet is
152SLIP-encoded and written to standard output.
153.PP
154Clients connecting to the
155Unix-domain socket send an initial character
156.RB ` < '
157to read a packet or
158.RB ` > '
159to write. Packets, as far as clients are concerned, consist of
160uninterpreted strings of octets and continue until end-of-file. It is
161not possible to read or write more than one packet in a single connection.
162.PP
163The command-line options allow
164.B tripe-uslip
165to be used from scripts to inject or collect packets. They are as follows.
166.TP
167.B \-g, \-\-get
168Connect to
169.IR socket ,
170read a packet from the socket and write it to standard output.
171.TP
172.B \-p, \-\-put
173Connect to
174.IR socket ,
175read a packet from standard input and write it to the socket.
1e14551a
MW
176.TP
177.B \-f, \-\-flood
178Connect to
179.IR socket ,
180and send packets as fast as possible. The packets sent aren't very
181interesting, and there's no way to configure their contents.
182.TP
183.B \-s, \-\-sink
184Connect to
185.IR socket
186and read packets as the become available. The packets are discarded,
187though if stdout is a terminal, a simple spinning-baton animation is
188updated once for each group of packets. If you are flooding one end of
189a TrIPE connection, it's advisable to attach a sink to the other:
190otherwise the destination
191.B tripe-uslip
192will attempt to consume all available memory, storing incoming packets
193until someone retrieves them.
49f86fe4
MW
194.
195.\"--------------------------------------------------------------------------
196.SH "BUGS"
197.
198The
199.B tripe-uslip
200program is intended as a tool for testing the
201.BR tripe (8)
202server. It is not expected to be useful in production environments. In
203particular, it intentionally imposes no limits on queue lengths or
204packet sizes, and its internals and interface (one packet per client
1e14551a
MW
205connection) are not well-suited for high performance. That said, the
206flood option has worked well enough to expose bugs in
207.BR tripe 's
208behaviour under heavy loads.
49f86fe4
MW
209.PP
210If
211.B tripe-uslip
212turns out to be useful in other contexts then it might be improved.
213Patches are, of course, welcome.
214.PP
215The initial ignoring of
216.B END
217bytes is unpleasant but necessary to cope with the
218.BR tripe (8)
219server, which sends this sequence in order to ensure that it's properly
220synchronized with the SLIP interface.
221.
222.\"--------------------------------------------------------------------------
223.SH "SEE ALSO"
224.
225.BR tripe (8).
226.
227.\"--------------------------------------------------------------------------
228.SH "AUTHOR"
229.
230Mark Wooding, <mdw@distorted.org.uk>
231.
232.\"----- That's all, folks --------------------------------------------------