Skip to content

Commit

Permalink
Merge branch 'negotiate-binary-transmission' of https://github.com/uk…
Browse files Browse the repository at this point in the history
  • Loading branch information
Uwe Kleine-König committed Sep 7, 2023
2 parents c41d017 + 2fdc58e commit 0cb882a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions telnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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),
}, {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 0cb882a

Please sign in to comment.