Skip to content

Commit

Permalink
telnet: make rfc2217 handling more correct
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Uwe Kleine-König committed Jul 11, 2018
1 parent c173be2 commit a94d4b8
Show file tree
Hide file tree
Showing 3 changed files with 280 additions and 148 deletions.
11 changes: 10 additions & 1 deletion microcom.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,17 @@ int do_script(char *script);

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

/*
* Some telnet options according to
* https://www.iana.org/assignments/telnet-options/telnet-options.xhtmls
*/

#define TELNET_OPTION_BINARY_TRANSMISSION 0
#define TELNET_OPTION_ECHO 1
#define TELNET_OPTION_SUPPRESS_GO_AHEAD 3
#define TELNET_OPTION_COM_PORT_CONTROL 44

/* RFC2217 */
#define COM_PORT_OPTION 44
#define SET_BAUDRATE_CS 1
#define SET_DATASIZE_CS 2
#define SET_PARITY_CS 3
Expand Down
Loading

0 comments on commit a94d4b8

Please sign in to comment.