diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-06-11 11:25:00 +0200 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-06-11 11:25:02 +0200 |
commit | 2fdc58e5ef190fb6586382302f54b06ca38b4735 (patch) | |
tree | 43457c9440b0fbdcbe10c7dbce6c820138034fc6 | |
parent | 679049a610f7e0e5b1b9c44afc9a62df77023860 (diff) | |
download | microcom-2fdc58e5ef190fb6586382302f54b06ca38b4735.tar.gz microcom-2fdc58e5ef190fb6586382302f54b06ca38b4735.tar.xz |
telnet: DO and WILL BINARY_TRANSMISSION
microcom doesn't treat 8bit data special, so let it announce being able
to send and receive binary data. In practise the absense of this
negotiated option didn't make a relevant difference, the communication
with both ser2net and moxa devices still included 8bit data. So there is
no urgent need to properly handle the comport side refusing the
BINARY_TRANSMISSION option.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r-- | telnet.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -235,6 +235,13 @@ static int do_com_port_option(struct ios_ops *ios, unsigned char *buf, int len) return -EINVAL; } +/* This is called with buf[-2:0] being IAC SB COM_PORT_OPTION */ +static int do_binary_transmission_option(struct ios_ops *ios, unsigned char *buf, int len) +{ + /* There are no subcommands for the BINARY_TRANSMISSION option (rfc856) */ + return -EINVAL; +} + struct telnet_option { unsigned char id; const char *name; @@ -251,6 +258,8 @@ static const struct telnet_option telnet_options[] = { .sent_will = true, }, { TELNET_OPTION(BINARY_TRANSMISSION), + .subneg_handler = do_binary_transmission_option, + .sent_will = true, }, { TELNET_OPTION(ECHO), }, { @@ -601,6 +610,10 @@ struct ios_ops *telnet_init(char *hostport) dprintf(sock, "%c%c%c", IAC, WILL, TELNET_OPTION_COM_PORT_CONTROL); dbg_printf("-> DO COM_PORT_CONTROL\n"); dprintf(sock, "%c%c%c", IAC, DO, TELNET_OPTION_COM_PORT_CONTROL); + dbg_printf("-> DO BINARY_TRANSMISSION\n"); + dprintf(sock, "%c%c%c", IAC, DO, TELNET_OPTION_BINARY_TRANSMISSION); + dbg_printf("-> WILL BINARY_TRANSMISSION\n"); + dprintf(sock, "%c%c%c", IAC, WILL, TELNET_OPTION_BINARY_TRANSMISSION); goto out; } |