Skip to content
Snippets Groups Projects

Fix inconsistency in master server listing

Merged Hanicef requested to merge Hanicef/SRB2Classic:fix-server-list-inconsistency into next
1 unresolved thread

This patch fixes an issue with server listing where empty packets were sent to a server, interfering with it's response and blocking the SERVERINFO packet that the server replies with. I was originally under the assumption that it was harmless considering that empty packets would be ignored server-side, but it wasn't, and the server instead actually responded to it, thus responding with a bad packet and causing the server to not appear on the master server.

Here's the current behavior:

srb20034

Here's what happens with this patch:

srb20033

The severity of the issue is based on numerous factors though, like server state and UDP packet order, so the results are wildly inconsistent.

Edited by Hanicef

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
    • Just looking at it alone makes you wonder what the fuck is the point of it even is, and it's pretty fucking obvious that no-one has even bothered testing it considering that it breaks the server list.

      It does have a purpose. I added this code to fix connecting to localhost by hostname a long time ago. I did this at the same time as fixing connecting to 127.0.0.1. Connecting to localhost by name isn't too important, it's just easier to type (for me at least) than 127.0.0.1.

      commit ed0f8fd96765fec8ac9b6407db7118669b07ddde
      Author: James R <justsomejames2@gmail.com>
      Date:   Wed Mar 20 20:05:45 2019 -0700
      
          Actually allow connecting to "localhost"
          
          Because IPv6 doesn't seem to work anyway.
      
      diff --git a/src/i_tcp.c b/src/i_tcp.c
      index 37e355579..11a84ceba 100644
      --- a/src/i_tcp.c
      +++ b/src/i_tcp.c
      @@ -1340,8 +1340,12 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port)
              while (runp != NULL)
              {
                      // find ip of the server
      -               memcpy(&clientaddress[newnode], runp->ai_addr, runp->ai_addrlen);
      -               runp = NULL;
      +               if (sendto(mysockets[0], NULL, 0, 0, runp->ai_addr, runp->ai_addrlen) == 0)
      +               {
      +                       memcpy(&clientaddress[newnode], runp->ai_addr, runp->ai_addrlen);
      +                       break;
      +               }
      +               runp = runp->ai_next;
              }
              I_freeaddrinfo(ai);
              return newnode;
    • Author Contributor

      Yeah, sorry for the tone of the message, it's just stuff like this gets on my nerves. But as it stands right now, that's not true anymore, and regardless of how things were back then, a much better solution would've been to pass AF_INET to hints.ai_family instead of what you did, since it actually tells getaddrinfo to only poll IPv4 addresses. What you did was hacky and it broke stuff badly.

      I'll edit the commit message to be in a better tone.

    • Oh, I'm glad to hear that everything works without the old code.

    • Author Contributor

      Yup, IPv6 is now fully supported with the upcoming 2.2.14, so no need to worry about that stuff anymore. :)

      Edited by Hanicef
    • Please register or sign in to reply
  • Hanicef changed the description

    changed the description

  • SteelT added Bug label

    added Bug label

  • SteelT changed milestone to %2.2.14

    changed milestone to %2.2.14

  • added Netcode label

  • merged

  • Lactozilla mentioned in commit 5b4b1211

    mentioned in commit 5b4b1211

Please register or sign in to reply
Loading