Categories

Great Success!

I successfully ported the Minix telnetd server to run under Linux.

The majority of changes had to do with pty and tty handling. Specifically, it is important to note that gettyent() and associated files and functions are not used in Linux and there were some minor changes with pathing for getty and login

Once the port was done and I had a working telnetd, I began greenifiying it.

The nice thing about the Minix telnetd implementation, and the reason I chose to port it to Linux, is that the inbound and outbound data is read and written at a single point.

Since I am currently only concerned with queuing data that is to be written to the client, I only had to change a single line:

(void) write(fdout, buf, len); was substituted with (void) g_write(fdout, buf, len);

A few other things to note:

A specialized queue node type was created to help us mimic the call to write(3):


struct gqnode {
int fd;
char buf[BUF_SIZE];
size_t nbytes;
};

I also had to change some of the code that caused the telnetd server to terminate if we were unable to read from a socket. Now, only the fork that was handling the reads from the client terminates and a new process is forked off for additional reconnects.

A (hard to follow) demo video is available.

So, I now have a telnet server that is aware that a client may want to disconnect but not terminate its session.

A new problem has arisen however: the server can only properly handle an explicit disconnect. I.e. if the connection just goes away (client goes to sleep, network cable is yanked from client or server, &c) things break.

No comments yet to Great Success!