-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
320 lines (231 loc) · 12.3 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
sredird: RFC 2217 compliant serial port redirector
Version 2.2.1, 20 February 2004
Copyright (C) 1999-2003 InfoTecna s.r.l.
Copyright (C) 2001, 2002 Trustees of Columbia University
in the City of New York
1 - Disclaimer
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
675 Mass Ave, Cambridge, MA 02139, USA.
To contact the authors:
Denis Sbragion
InfoTecna
Tel, Fax: +39 0362 805396
URL: http://www.infotecna.it
E-Mail: [email protected]
Jeffrey Altman
Columbia University
URL: http://www.columbia.edu/kermit/
E-mail: [email protected]
2 - Introduction
Sredird is a serial port redirector that is compliant with the RFC 2217
"Telnet Com Port Control Option" protocol. This protocol lets you share
a serial port through the network. RFC 2217 was originally implemented
in Cisco Terminal Servers in IOS version 11.x.
RFC 2217 clients include:
. C-Kermit 8.0 for Unix,VMS,QNX,...
<http://www.columbia.edu/kermit/ckermit.html>
. DialOut/IP V2, a commercial Windows 95/98/NT client.
<www.tacticalsoftware.com>
Information on RFC 2217 and the Telnet Protocol is available at www.ietf.org.
3 - Compilation
Just compile the sredird.c file with your favorite compiler and your
favorite optimizations options. Under Linux a line like:
gcc -O3 -m486 -pipe -fomit-frame-pointer
should do the job. Rename the output (usually a.out) to sredird.
You can also try the supplied Makefile. Check it for compiler option
before running the make command.
4 - Command line parameters
Sredird takes three mandatory parameters and two optional parameters,
one at the beginning and one at the end of the command line.
The mandatory parameters are:
Log level: 0 to 7, 0 being no log and 7 being debug log. Sredird uses
the standard syslog facility for logging. Look at the syslog(3) man page
for further information on the syslog facility and log levels.
Device: the device complete path. Something like /dev/ttyS0 or /dev/modem.
The optional parameters are:
- At the beginning of the command line:
A -i option enables compatibility with the Cisco IOS which has a small
bug in the handling of the inbound flow control.
- At the end of the command line:
Poll interval: sredird checks for line state changes (DSR/CTS/DCD/RNG)
on every single char sent on the serial line. To prevent losing state
change when there's no traffic on the serial port, sredird also polls
the line state when there's no traffic on the line for more than the
poll interval. The value is in milliseconds and the default is 100
milliseconds. Setting it to 0 disables the polling feature. This is
also the maximum time data is left in the output buffer before sending
it, even if the buffer isn't completely full, so the polling interval
globally sets the maximum latency of any sredird action.
5 - Installation
Put the executable in a suitable directory (/usr/sbin or /usr/local/sbin).
Sredird is designed to run under inetd control. The line in the inetd
configuration file (usually /etc/inetd.conf) should look like this:
sredir stream tcp nowait root /usr/sbin/tcpd /usr/sbin/sredird -i 5 /dev/modem
Of course, "sredir" should be defined in the services file (usually
/etc/services, usual values start at port 7000) and "/dev/modem" should
be substituted by the appropriate device. The lock and the device name
must match for correct interlocking with other programs. The tcpd program
is the usual tcp wrapper that's not needed for correct operation but
is useful for security purposes. Don't forget to send a SIGHUP to the
inetd daemon in order to force reload of the configuration file. The
initial -i parameter is optional and enables compatibility with the
Cisco IOS.
6 - Bugs
Patches, bug reports, comments, improvements and anything else are welcome.
7 - Outstanding issues
The RFC 2217 protocol is a rather complete protocol that provides a lot
of features. Most of them are implemented in sredird but some seldom
used options are missing:
. does not properly check implement BREAK handling. Need to figure
out how to turn a BREAK on and then off based upon receipt of
COM-PORT Subnegotiations
. does not properly use select to handle input, output and
errors on all devices.
. Lack of login processing
. Lack of Telnet START_TLS to protect the data stream
. Lack of Telnet AUTHENTICATION
. LineState processing is not implemented
. The code probably won't compile on most versions of Unix due to the
highly platform dependent nature of the serial apis.
The program has been tested only under Linux 2.0.36, gcc 2.7.2.1,
libc5 and RedHat 5.2/7.1 but should work on any POSIX compliant
operating system.
. Use of polling to notify change on the serial control lines is not
desirable. Anyone know of an event driven mechanism for discovering
modem and line signal changes?
. Better documentation and a man page would be useful.
8 - Implementation Notes
. Setting the port to 1.5 stop bits isn't supported. When requested,
1 stop bit is set and returned as the response value.
. Setting the parity to mark or space isn't supported. When requested,
Parity is set to None and returned as the response value.
. DTR, DSR and DCD flow control isn't supported. When requested,
flow control is disabled and "no flow control" is returned as the
response value.
. RFC 2217 supports the ability for the Input and Output Parity and
Flow control settings to be independent of each other. This is not
supported by the majority of serial port UARTs available on the market
and is not supported by sredird. Sredird ignores all requests to set
the Input Parity and Flow control. The Output values are used for
both input and output as specified in the RFC.
. DialOut/IP V2 version 2.0.0 has a known bug that prevent it from
running at 115200 baud. If you ask for 115200 baud it sets the serial
line at 9600 baud. It also has some other small bugs that cause it to
crash or fail under some rare circumstances. Use Version 2.0.2 or
higher to avoid this problem.
9 - Credits
Thanks to David Yon and Mike Krueger of Tactical Software for their help
in the sredird developing process. Thanks also to Tactical Software for
its wonderful DialOut/IP package and for choosing an open standard for it.
Tactical Software provides also some other useful communication tools
and an RFC 2217 compliant server for the Windows environment. Browse
http://www.tacticalsoftware.com for more information.
Nordic Messaging Tech. AB provides a complete commercial RFC 2217
compliant server for various operating systems including Linux. See
http://www.nordicmessaging.com for more information.
Implementation of the Telnet State Machines, corrections to RFC 2217,
testing against various clients and comparison to hardware implementations
in Cisco IOS software was performed by the Kermit Project at Columbia
University. The Kermit Project provides the only known client implementation
of RFC 2217 for Unix in its C-Kermit and Kermit 95 Telnet clients. See
http://www.columbia.edu/kermit/ for further details.
Thanks to Mario Viara for fixing some long lasting small bugs.
Thanks to Russell Coker for providing a man page, a better makefile and
some other small patches.
10 - Commercial support
InfoTecna (http://www.infotecna.it) is a commercial company and
provides commercial support for the sredird package. Sorry, but we really
have no time to provide free support apart for bug correction.
The Kermit Project provides support for C-Kermit and will provide support
for sredird when used in conjunction with Kermit software.
11 - History
01 June 1999 - Version 1.0.0: First stable release.
02 June 1999 - Version 1.0.1: Corrected a bug on the stop size detection
function. Corrections and exstensions to the documentation. Added credits
to Tactical Software and Nordic Messaging.
07 June 1999 - Version 1.1.0: Added errno.h to the list of the
include files. Thanks to Federico Bianchi ([email protected])
for this. Added an internal buffering scheme, along with handling of the
RFC 2217 FLOWCONTROL-SUSPEND and FLOWCONTROL-RESUME, to reduce network
latency caused by TCP and socket buffering. Added also some socket options
to further reduce network latency. Fixed a bug on the polling feature.
09 June 1999 - Version 1.1.3: Added an output buffer scheme that provides
both low latency, depending on the polling interval, and reasonable cpu
consumption without limiting the global throughput. Some other minor
bug fixing.
11 June 1999 - Version 1.1.4: Fixed compilation under SCO OpenServer
and SCO like distributions (Red Hat). Thanks to Anthony Veale
([email protected]) and Harri Vartiainen ([email protected]) for reporting
the problem and testing the fixed version. Fixed some other minor bugs.
18 June 1999 - Version 1.1.5: SCO support abandoned. Providing SCO
support would require huge changes to the code. Minor cosmetic and
documentation changes.
04 September 1999 - Version 1.1.6: Corrected an important bug where
bytes directed to the socket were sent to the modem, then read back
through the modem device and finally sent to the socket macking things
apparently working. Many thanks to Ayman Akt ([email protected])
from UniWare (www.uniware.com.au) for discovering this nasty bug.
20 September 1999 - Version 1.1.7: Improved handling of the clocal
tty flag.
09 November 2000 - Version 1.1.8: Corrected a bug in the telnet option
negotiation code. Many options were always incorrectly negotiated as
TN_TRANSMIT_BINARY. Thanks to David Yon ([email protected]) for his
bug report. Changed the default speed to 9600 baud instead of 38400 when
an unknown baud rate is asked by the client. Furthermore now SRedird try
to serve anyway when the client refuse the Com Port Control option. Added
a simple makefile. Thanks to Kevin Bertram ([email protected]) for
suggesting this improvements and supplying the makefile. Changed e-mail
and web references everywere.
14 January 2002 - Version 2.0.0, fixes the following bugs:
. Cisco IOS returns 0 to the client when INBOUND flow control is SET but
not supported separately from OUTBOUND.
. Telnet negotiations are used alter the states of both the client
and the server. sredird did not implement a Telnet state machine
as required by RFC 854. Version 2.0 adds support for a state
machine.
. Version 1.1.8 corrected the negotiation of Telnet Binary mode
(RFC 856). However, it never implemented it. This is now
corrected.
. Telnet DO ECHO should not be refused. The modem handles the echoing
if necessary.
. RFC 2217 allows the server (sredird) to give control over a serial
port to the client (server in DO mode). It also allows the client
to give control over a serial port to the server (server in WILL mode).
sredird required both modes even though sredird only offers control
over a serial port.
. sredird did not properly implement flow control. Buffering was only
implemented when writing data to the serial port. Data was not
buffered when reading data from the serial port. This could have
resulted in inadvertent blocking. Proper select() driven reads
and writes are now implemented.
14 November 2002 - Version 2.1.0:
. GetPortFlowControl should return 1 to indicate NO FLOW CONTROL
instead of 0.
. The Cisco IOS hack should become activated only if set by command-
line option [-i].
. Changed the order of checks in the EscWriteChar function for slightly
better performance
09 July 2003 - Version 2.2.0
. Applied the patch provided by Marco Viaria
. Applied the patch supplied by Russell Coker
20 February 2004 - Version 2.2.1
. Minor bug correction, reported by Peter Astrand
--
Denis Sbragion
InfoTecna
Tel, Fax: +39 0362 805396
URL: http://www.infotecna.it
E-Mail: [email protected]
Jeffrey Altman
Columbia University
URL: http://www.columbia.edu/kermit/
E-mail: [email protected]