Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > Advanced MUD Concepts
Click here to Register

Reply
 
Thread Tools
Old 03-19-2009, 10:51 AM   #21
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

Quote:
Originally Posted by scandum View Post
Seems to be sending out the requests now, but it's not answering.

Other muds haven't had any issues adding mth, so I guess you'll need to do some debugging and figure out what goes wrong.
Code:
      char bufin[MAX_INPUT_LENGTH];
      int nRead;

      nRead = read( d->descriptor, bufin, sizeof( bufin ) - 10 - iStart );
      if( nRead > 0 )
      {
         iStart += translate_telopts(d, bufin, nRead, d->inbuf + iStart);

         if( d->inbuf[iStart - 1] == '\n' )
            break;
      }
The thing is, you are reading into a static buffer and I don't use a static buffer. I will install this feature, but I have a feeling it will cause crashes when someone overtly spams a connection with > MAX_INPUT_LENGTH characters, possibly causing memory corruption or a crash.

Is there an easy way to modify this so that it doesn't use a static buffer?

EDIT:

The following code was used:

Code:
    for ( ; ; )
    {
        char bufin[MIL];
        int nRead;

        nRead = read( d->connection, bufin,//d->inbuf + iStart,
           sizeof(bufin)-10-iStart ); // sizeof(d->inbuf) - 10 - iStart );
        if ( nRead > 0 )
        {
            d->showing=iStart;
//            iStart += nRead;
            iStart += translate_telopts(d, bufin, nRead, d->inbuf+iStart );
            if( d->inbuf[iStart - 1] == '\n'
             || d->inbuf[iStart - 1] == '\r' )
               break;
        }
The result was I could not press <enter> after a hotboot, but the other characters made it through. Upon reboot, it would crash the mud upon connection.

Code:
    for ( ; ; )
    {
        char buf_discard[MIL];
        int nRead;

        nRead = read( d->connection, /* bufin, */ d->inbuf + iStart,
          /* sizeof(bufin)-10-iStart ); */ sizeof(d->inbuf) - 10 - iStart );
        if ( nRead > 0 )
        {
            d->showing=iStart;
            iStart += nRead;
            translate_telopts(d, d->inbuf+iStart, nRead, buf_discard );
            if( d->inbuf[iStart - 1] == '\n'
             || d->inbuf[iStart - 1] == '\r' )
               break;
        }
Try it now, the above should translate the telopts, but it should be discarding any resulting buffer since it is running parallel (sort of) to the main networking.

UPDATE: Spoke too soon, it's causing crashes. I'm trying to figure out why, but I'm inside translate_telopts() at this point. I don't see anything, so I'm left to wonder what exactly I should do next. I've tried this several ways.

Last edited by locke : 03-19-2009 at 11:21 AM.
locke is offline   Reply With Quote
Old 03-19-2009, 12:26 PM   #22
scandum
Senior Member
 
scandum's Avatar
 
Join Date: Jun 2004
Posts: 308
scandum will become famous soon enough
Re: MSSP (Mud Server Status Protocol)

Remove the stripping of \\r in telopt.c and see if that makes a difference, it's the lines:
Code:
                        case '\r':
                                pti++;
                                srclen--;
                                break;
Just remove the entire thing.

Try the following after that:
Code:
    for ( ; ; )
    {
        char bufin[MIL];
        int nRead;

        nRead = read( d->connection, bufin, sizeof(bufin)-10-iStart );
        if ( nRead > 0 )
        {
            d->showing=iStart;

            iStart += translate_telopts(d, bufin, nRead, d->inbuf+iStart );

            if( d->inbuf[iStart - 1] == '\n'
             || d->inbuf[iStart - 1] == '\r' )
               break;
scandum is offline   Reply With Quote
Old 03-19-2009, 02:08 PM   #23
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

Quote:
Originally Posted by scandum View Post
Remove the stripping of \\r in telopt.c and see if that makes a difference, it's the lines:
Code:
                        case '\r':
                                pti++;
                                srclen--;
                                break;
Just remove the entire thing.

Try the following after that:
Code:
    for ( ; ; )
    {
        char bufin[MIL];
        int nRead;

        nRead = read( d->connection, bufin, sizeof(bufin)-10-iStart );
        if ( nRead > 0 )
        {
            d->showing=iStart;

            iStart += translate_telopts(d, bufin, nRead, d->inbuf+iStart );

            if( d->inbuf[iStart - 1] == '\n'
             || d->inbuf[iStart - 1] == '\r' )
               break;
This results with an immediate crash upon connection.
locke is offline   Reply With Quote
Old 03-19-2009, 08:21 PM   #24
scandum
Senior Member
 
scandum's Avatar
 
Join Date: Jun 2004
Posts: 308
scandum will become famous soon enough
Re: MSSP (Mud Server Status Protocol)

Odd, I'm at a loss.
scandum is offline   Reply With Quote
Old 03-19-2009, 10:33 PM   #25
scandum
Senior Member
 
scandum's Avatar
 
Join Date: Jun 2004
Posts: 308
scandum will become famous soon enough
Re: MSSP (Mud Server Status Protocol)

You're using calloc instead of malloc, right?

Calloc automatically zeroes the memory, otherwise odd things might happen.

Regardless, I added a non telnet version to the MSSP specification which should be easier to implement.


MSSP Plaintext

Since it's not feasible for every mud to implement telopt negotiations a plaintext alternative is available. Whenever a new connection enters the command: MSSP-REQUEST a Mud supporting MSSP Plaintext should send the following:

\r\nMSSP-REPLY-START\r\nvariable\tvalue\r\nvariable\tvalue\r\nMSS P-REPLY-END\r\n

If a variable has multiple values you can use multiple tabs:

\r\nMSSP-REPLY-START\r\nvariable\tvalue\tvalue\r\nMSSP-REPLY-END\r\n
scandum is offline   Reply With Quote
Old 03-20-2009, 11:31 AM   #26
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

Quote:
Originally Posted by scandum View Post
You're using calloc instead of malloc, right?

Calloc automatically zeroes the memory, otherwise odd things might happen.

Regardless, I added a non telnet version to the MSSP specification which should be easier to implement.


MSSP Plaintext

Since it's not feasible for every mud to implement telopt negotiations a plaintext alternative is available. Whenever a new connection enters the command: MSSP-REQUEST a Mud supporting MSSP Plaintext should send the following:

\r\nMSSP-REPLY-START\r\nvariable\tvalue\r\nvariable\tvalue\r\nMSS P-REPLY-END\r\n

If a variable has multiple values you can use multiple tabs:

\r\nMSSP-REPLY-START\r\nvariable\tvalue\tvalue\r\nMSSP-REPLY-END\r\n

I use malloc()

Maybe you could write a little piece of code that checks for the request in a string and a variant of the MSSP send routine that maps to mud_data, so I can install that.

I manually assign or use memset() to init variables to 0.

Last edited by locke : 03-20-2009 at 11:42 AM.
locke is offline   Reply With Quote
Old 03-20-2009, 12:23 PM   #27
scandum
Senior Member
 
scandum's Avatar
 
Join Date: Jun 2004
Posts: 308
scandum will become famous soon enough
Re: MSSP (Mud Server Status Protocol)

You'd want to set everything to NULL, notably d->mccp and d->teltop. Also make sure that d->terminal_type is handled correctly.

What you can do as well is to disable negotiating anything but MSSP in tables.c just in case the crash is in one of the other negotiations.
scandum is offline   Reply With Quote
Old 03-20-2009, 03:04 PM   #28
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

Quote:
Originally Posted by scandum View Post
You'd want to set everything to NULL, notably d->mccp and d->teltop. Also make sure that d->terminal_type is handled correctly.

What you can do as well is to disable negotiating anything but MSSP in tables.c just in case the crash is in one of the other negotiations.
I'll try this and let you know. I don't think I'm setting those variables to anything right now.

What do you mean by "disable negotiating anything but MSSP"?
locke is offline   Reply With Quote
Old 03-20-2009, 05:36 PM   #29
scandum
Senior Member
 
scandum's Avatar
 
Join Date: Jun 2004
Posts: 308
scandum will become famous soon enough
Re: MSSP (Mud Server Status Protocol)

The announce_support function looks through the telnet table in tables.c for entries that are flagged to send a WILL or DO request, setting the flag to 0 will disable the auto announce.
scandum is offline   Reply With Quote
Old 03-20-2009, 09:35 PM   #30
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

Quote:
Originally Posted by scandum View Post
The announce_support function looks through the telnet table in tables.c for entries that are flagged to send a WILL or DO request, setting the flag to 0 will disable the auto announce.
I tried it by reverting to using translate_telopts() after setting the pointers to NULL and it kicked in my sigsegv monitor, reporting this through the telnet port when I connected:

Code:
** glibc detected *** nimud: free(): invalid pointer: 0x08974840 ***
            ======= Backtrace: =========
          /lib/libc.so.6[0xb7df8a00]
          /lib/libc.so.6(cfree+0x89)[0xb7dfa6f9]
          nimud[0x80d63d0]
          nimud[0x80d65d6]
          nimud[0x80a54bf]
          nimud[0x80a5d42]
          nimud[0x80a61f0]
          nimud[0x80a6579]
          /lib/libc.so.6(__libc_start_main+0xdc)[0xb7da8fdc]
          nimud[0x80493d1]
            ======= Memory map: ========
          08048000-080fe000 r-xp 00000000 fd:02 699939     /home/locke/NiM5/area/nimud
          080fe000-080ff000 r--p 000b5000 fd:02 699939     /home/locke/NiM5/area/nimud
          080ff000-08100000 rw-p 000b6000 fd:02 699939     /home/locke/NiM5/area/nimud
          08100000-08b7f000 rw-p 08100000 00:00 0          [heap]
          b7600000-b7621000 rw-p b7600000 00:00 0
          b7621000-b7700000 ---p b7621000 00:00 0
          b778f000-b7798000 r-xp 00000000 03:03 551806     /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1
          b7798000-b7799000 r--p 00008000 03:03 551806     /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1
          b7799000-b779a000 rw-p 00009000 03:03 551806     /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1
          b779a000-b77a2000 r-xp 00000000 03:03 471790     /lib/libnss_files-2.6.1.so
          b77a2000-b77a3000 r--p 00007000 03:03 471790     /lib/libnss_files-2.6.1.so
          b77a3000-b77a4000 rw-p 00008000 03:03 471790     /lib/libnss_files-2.6.1.so
          b77a4000-b77cd000 rw-p b77a4000 00:00 0
          b77ce000-b7d93000 rw-p b77ce000 00:00 0
          b7d93000-b7ebd000 r-xp 00000000 03:03 471810     /lib/libc-2.6.1.so
          b7ebd000-b7ebf000 r--p 0012a000 03:03 471810     /lib/libc-2.6.1.so
          b7ebf000-b7ec0000 rw-p 0012c000 03:03 471810     /lib/libc-2.6.1.so
          b7ec0000-b7ec3000 rw-p b7ec0000 00:00 0
          b7ec3000-b7ed4000 r-xp 00000000 03:03 423374     /lib/libz.so.1.2.3
          b7ed4000-b7ed5000 r--p 00010000 03:03 423374     /lib/libz.so.1.2.3
          b7ed5000-b7ed6000 rw-p 00011000 03:03 423374     /lib/libz.so.1.2.3
          b7ed6000-b7edb000 r-xp 00000000 03:03 472037     /lib/libcrypt-2.6.1.so
          b7edb000-b7edc000 r--p 00004000 03:03 472037     /lib/libcrypt-2.6.1.so
          b7edc000-b7edd000 rw-p 00005000 03:03 472037     /lib/libcrypt-2.6.1.so
          b7edd000-b7f05000 rw-p b7edd000 00:00 0
          b7f0b000-b7f25000 r-xp 00000000 03:03 471982     /lib/ld-2.6.1.so
          b7f25000-b7f26000 r--p 00019000 03:03 471982     /lib/ld-2.6.1.so
          b7f26000-b7f27000 rw-p 0001a000 03:03 471982     /lib/ld-2.6.1.so
          bf2e8000-bfa6c000 rw-p bf87c000 00:00 0          [stack]
          ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
locke is offline   Reply With Quote
Old 03-20-2009, 10:34 PM   #31
scandum
Senior Member
 
scandum's Avatar
 
Join Date: Jun 2004
Posts: 308
scandum will become famous soon enough
Re: MSSP (Mud Server Status Protocol)

Might be the RESTRING macro call on d->terminal_type while it's NULL. Not sure what you're doing, but if you use it "as is" you'd want to use: d->terminal_type = strdup("");

Should be more obvious if you execute:

telnet
set options
open nimud.divineright.org 5333
scandum is offline   Reply With Quote
Old 03-21-2009, 12:24 AM   #32
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

While using gdb it hung in select() instead of crashing.
locke is offline   Reply With Quote
Old 03-21-2009, 12:28 AM   #33
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

Quote:
Originally Posted by scandum View Post
Might be the RESTRING macro call on d->terminal_type while it's NULL. Not sure what you're doing, but if you use it "as is" you'd want to use: d->terminal_type = strdup("");

Should be more obvious if you execute:

telnet
set options
open nimud.divineright.org 5333
This was already done as d->terminal_type = &str_empty[0];
locke is offline   Reply With Quote
Old 03-21-2009, 04:13 PM   #34
scandum
Senior Member
 
scandum's Avatar
 
Join Date: Jun 2004
Posts: 308
scandum will become famous soon enough
Re: MSSP (Mud Server Status Protocol)

Quote:
Originally Posted by locke View Post
This was already done as d->terminal_type = &str_empty[0];
You should use d->terminal_type = strdup(""); if you're gonna use the macro provided with mth.
scandum is offline   Reply With Quote
Old 03-21-2009, 06:48 PM   #35
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

Quote:
Originally Posted by scandum View Post
You should use d->terminal_type = strdup(""); if you're gonna use the macro provided with mth.
This fixed the problem, and I am now using translate_telopts with no wierdness. Undefined Behavior beware.

So, please try connecting us to your network. Once connected I will release NiMUD with an announcement at the top of the README about contacting you should someone want to start a NiMUD and join your network.

The specific copy of NiMUD I run is at nimud.divineright.org 5333, but others may join your network someday.

Tintin was the first client I ever used, but I later switched to TinyFugue. Now I just use PuTTy. It would be interesting to see a "lite" version written for use with the standard telnet port instead of stdin, that was easily added to existing MUDs -- one with the ability only to connect with multiple sessions to a default mud address -- as a proxy service. That way MUD admins could set up Tintin on their primary port, with some default settings to auto connect to the MUD, plus the ability to allow players to manage multiple sessions with Tintin on MUDs (like mine) that allow multiplaying.

You know .. it could activate when another client isn't detected, otherwise merely forwarding to the port like tcpxd.

Regards,
Locke

Last edited by locke : 03-21-2009 at 07:07 PM.
locke is offline   Reply With Quote
Old 03-21-2009, 08:28 PM   #36
scandum
Senior Member
 
scandum's Avatar
 
Join Date: Jun 2004
Posts: 308
scandum will become famous soon enough
Re: MSSP (Mud Server Status Protocol)

It's not working as of yet, I get:

RCVD IAC 0 0
NiM5 Build 12773

<the greeting screen>

What is thy name?
RCVD IAC IAC
RCVD IAC SE 253
 ˙
RCVD IAC IAC
RCVD IAC SE 32
 ˙FNAMEThe Isles: Lands of KltaraPLAYERS62UPTIME24CODEBASENiMUDCONTACT<etc>

Looks like it tries to send out the actual MSSP data, but it gets mangled somewhere.

The debug output in tintin is supposed to look something like the following:
Code:
RCVD IAC SB MSSP (725)
############################################################
PLAYERS              5
UPTIME               1237444142
CODEBASE             CircleMUD 3.1
CONTACT              
CREATED              2000
HOSTNAME             azereth.game-host.org
ICON                 http://azereth.game-host.org:6400/icon.gif
IP                   68.103.0.241
LANGUAGE             English
LOCATION             United States
MINIMUM AGE          0
NAME                 AzerethMUD
PORT                 6464
FAMILY               DikuMud
WEBSITE              http://azereth.game-host.org:6400
GENRE                Fantasy
GAMEPLAY             Hack and Slash
GAMESYSTEM           Custom
INTERMUD             I3
INTERMUD             IMC2
STATUS               LIVE
SUBGENRE             Medieval Mythical
AREAS                213
HELPFILES            797
MOBILES              2705
OBJECTS              3552
ROOMS                11552
RESETS               0
MUDPROGS             0
MUDTRIGS             1122
CLASSES              7
LEVELS               0
RACES                10
SKILLS               150
WORLDS               1
ANSI                 1
MCCP                 1
MCP                  0
MSP                  0
MXP                  0
PUEBLO               0
VT100                0
XTERM 256 COLORS     0
PAY TO PLAY          0
PAY FOR PERKS        0
HIRING BUILDERS      1
HIRING CODERS        0
############################################################

Last edited by scandum : 03-21-2009 at 08:34 PM.
scandum is offline   Reply With Quote
Old 03-21-2009, 09:44 PM   #37
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

Quote:
Originally Posted by scandum View Post
It's not working as of yet, I get:

RCVD IAC 0 0
NiM5 Build 12773

<the greeting screen>

What is thy name?
RCVD IAC IAC
RCVD IAC SE 253
 ˙
RCVD IAC IAC
RCVD IAC SE 32
 ˙FNAMEThe Isles: Lands of KltaraPLAYERS62UPTIME24CODEBASENiMUDCONTACT<etc>

Looks like it tries to send out the actual MSSP data, but it gets mangled somewhere.

The debug output in tintin is supposed to look something like the following:
There's that wierd character combination,  ˙ !!! I have no idea but I will switch to your write_to_descriptor and see if that helps.

Are you related to 121.149.104.1 ? This bot seems to be repeatedly connecting, maybe it's your crawler?
locke is offline   Reply With Quote
Old 03-23-2009, 02:59 PM   #38
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

Quote:
Originally Posted by locke View Post
There's that wierd character combination,  ˙ !!! I have no idea but I will switch to your write_to_descriptor and see if that helps.

Are you related to 121.149.104.1 ? This bot seems to be repeatedly connecting, maybe it's your crawler?
I have done this. Please retry.
locke is offline   Reply With Quote
Old 03-23-2009, 03:48 PM   #39
scandum
Senior Member
 
scandum's Avatar
 
Join Date: Jun 2004
Posts: 308
scandum will become famous soon enough
Re: MSSP (Mud Server Status Protocol)

That's a korean IP, not sure who it is.

MSSP is still not working, nor is the mud announcing MSSP support.

I suggest you use tintin++ for debugging it with the following line to connect:

#config debug on;#ses x nimud.divineright.org 5333

If MSSP works you'll automatically get a formatted display of MSSP variables and values as I pasted earlier on.
scandum is offline   Reply With Quote
Old 03-24-2009, 06:14 PM   #40
locke
Banned
 
Join Date: Jan 2009
Home MUD: nimud.divineright.org 5333
Posts: 195
locke is an unknown quantity at this point
Re: MSSP (Mud Server Status Protocol)

Scandum,


Code:
Notify> LOG: Sock.sinaddr:  204.209.44.14
Notify>  New connection: 204.209.44.14
Notify> LOG: D7@mudconnector.com RCVD IAC WILL SUPPRESS GA
Notify> LOG: D7@mudconnector.com RCVD IAC DO TERMINAL TYPE
Notify> LOG: D7@mudconnector.com RCVD IAC DO NAWS
Notify> LOG: D7@mudconnector.com RCVD IAC DO NEW_ENVIRON
Notify> LOG: D7@mudconnector.com RCVD IAC WILL MSSP
Notify> LOG: D7@mudconnector.com RCVD IAC WILL MCCP2
Yet it still does not work. Why?
locke is offline   Reply With Quote
Reply


Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 05:29 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2014