Server on telnet port (23) now works with Linux client

A mini pandemic project: I sat down and figured out what
was required to have the modem code work with the the
telnet options that the Linux telnet client sent. It was
always one of those "one day" things, and today turned
out to be the day.
This commit is contained in:
mecparts
2021-03-22 03:47:39 -06:00
parent 74b22825f6
commit 93f0301f3f
3 changed files with 18 additions and 4 deletions

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ kicad/*bak
kicad/*.svg
kicad/RetroWiFiModem_rotated.kicad_pcb
telnet.txt
RetroWiFiModem/*.gch

View File

@@ -47,8 +47,10 @@
#define TTYPE ((uint8_t)24)
#define NAWS ((uint8_t)31)
#define TSPEED ((uint8_t)32)
#define LFLOW ((uint8_t)33)
#define LINEMODE ((uint8_t)34)
#define XLOC ((uint8_t)35)
#define XDISPLOC ((uint8_t)35)
#define NEW_ENVIRON ((uint8_t)39)
#define BINARY ((uint8_t)0)
#define ECHO ((uint8_t)1)
#define SUP_GA ((uint8_t)3)

View File

@@ -173,9 +173,20 @@ int receiveTcpData() {
}
break;
case WILL:
// Server wants to do any option, allow it
// Server wants to do option, allow most
bytesOut += tcpClient.write(IAC);
bytesOut += tcpClient.write(DO);
switch( cmdByte2 ) {
case LINEMODE:
case NAWS:
case LFLOW:
case NEW_ENVIRON:
case XDISPLOC:
bytesOut += tcpClient.write(DONT);
break;
default:
bytesOut += tcpClient.write(DO);
break;
}
bytesOut += tcpClient.write(cmdByte2);
break;
case SB:
@@ -306,7 +317,7 @@ void sendResult(int resultCode) {
} else if( resultCode == R_ERROR ) {
lastCmd[0] = NUL;
memset(atCmd, 0, sizeof atCmd);
}
}
if( resultCode == R_NO_CARRIER || resultCode == R_NO_ANSWER ) {
sessionTelnetType = settings.telnet;
}