Skip to content

Commit a94d4b8

Browse files
author
Uwe Kleine-König
committed
telnet: make rfc2217 handling more correct
This implements several things that were missing before: - Send initial DO and WILL for COM_PORT option. - Handle a IAC IAC sequence as single in-band '\xff'. - Reply WILL/DO for non-COM_PORT options with DONT/WONT. - Stop interpreting escape sequences at their end. - Add necessary bound checks. This closes #5. It's still not optimal though. Missing bits include for example: - tracking of WILL/WONT/DO/DONT - Only start with COM_PORT subnegotiation once the other side acked. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
1 parent c173be2 commit a94d4b8

File tree

3 files changed

+280
-148
lines changed

3 files changed

+280
-148
lines changed

microcom.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,17 @@ int do_script(char *script);
120120

121121
#define dbg_printf(fmt,args...) ({ if (debug) printf(fmt ,##args); })
122122

123+
/*
124+
* Some telnet options according to
125+
* https://www.iana.org/assignments/telnet-options/telnet-options.xhtmls
126+
*/
127+
128+
#define TELNET_OPTION_BINARY_TRANSMISSION 0
129+
#define TELNET_OPTION_ECHO 1
130+
#define TELNET_OPTION_SUPPRESS_GO_AHEAD 3
131+
#define TELNET_OPTION_COM_PORT_CONTROL 44
132+
123133
/* RFC2217 */
124-
#define COM_PORT_OPTION 44
125134
#define SET_BAUDRATE_CS 1
126135
#define SET_DATASIZE_CS 2
127136
#define SET_PARITY_CS 3

0 commit comments

Comments
 (0)