Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions can.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ struct ios_ops *can_init(char *interface_id)
ios->set_flow = can_set_flow;
ios->send_break = can_send_break;
ios->exit = can_exit;
ios->istelnet = false;

/*
* the string is supposed to be formated this way:
Expand Down
2 changes: 2 additions & 0 deletions microcom.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <signal.h>
#include <string.h>
#include <termios.h>
Expand All @@ -48,6 +49,7 @@ struct ios_ops {
int (*set_handshake_line)(struct ios_ops *, int pin, int enable);
int (*send_break)(struct ios_ops *);
void (*exit)(struct ios_ops *);
bool istelnet;
int fd;
};

Expand Down
24 changes: 13 additions & 11 deletions mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,17 +308,6 @@ static int handle_receive_buf(struct ios_ops *ios, unsigned char *buf, int len)

while (len) {
switch (*buf) {
case IAC:
/* BUG: this is telnet specific */
write_receive_buf(sendbuf, buf - sendbuf);
i = handle_command(ios, buf, len);
if (i < 0)
return i;

buf += i;
len -= i;
sendbuf = buf;
break;
case 5:
write_receive_buf(sendbuf, buf - sendbuf);
if (answerback)
Expand All @@ -330,6 +319,19 @@ static int handle_receive_buf(struct ios_ops *ios, unsigned char *buf, int len)
len -= 1;
sendbuf = buf;
break;
case IAC:
if (ios->istelnet) {
write_receive_buf(sendbuf, buf - sendbuf);
i = handle_command(ios, buf, len);
if (i < 0)
return i;

buf += i;
len -= i;
sendbuf = buf;
break;
}
/* fall through */
default:
buf += 1;
len -= 1;
Expand Down
1 change: 1 addition & 0 deletions serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ struct ios_ops * serial_init(char *device)
ops->set_handshake_line = serial_set_handshake_line;
ops->send_break = serial_send_break;
ops->exit = serial_exit;
ops->istelnet = false;

/* check lockfile */
substring = strrchr(device, '/');
Expand Down
1 change: 1 addition & 0 deletions telnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct ios_ops *telnet_init(char *hostport)
ios->set_flow = telnet_set_flow;
ios->send_break = telnet_send_break;
ios->exit = telnet_exit;
ios->istelnet = true;

memset(&hints, '\0', sizeof(hints));
hints.ai_flags = AI_ADDRCONFIG;
Expand Down