diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-09-07 11:48:57 +0200 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-09-07 11:48:57 +0200 |
commit | 0cb882af7fdb4b714c394757368d0204edd78d27 (patch) | |
tree | 6f6cc0fc856230b88f3f8fb7e5e5a940ce4b5004 | |
parent | c41d017f22ae440388a3694483cae1a031d439af (diff) | |
parent | 2fdc58e5ef190fb6586382302f54b06ca38b4735 (diff) | |
download | microcom-0cb882af7fdb4b714c394757368d0204edd78d27.tar.gz microcom-0cb882af7fdb4b714c394757368d0204edd78d27.tar.xz |
Merge branch 'negotiate-binary-transmission' of https://github.com/ukleinek/microcom
-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), }, { @@ -599,6 +608,10 @@ struct ios_ops *telnet_init(char *hostport) /* send intent we WILL do COM_PORT stuff */ dbg_printf("-> WILL COM_PORT_CONTROL\n"); dprintf(sock, "%c%c%c", IAC, WILL, 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; } |