Fix inconsistency in master server listing
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:
Here's what happens with this patch:
The severity of the issue is based on numerous factors though, like server state and UDP packet order, so the results are wildly inconsistent.
Merge request reports
Activity
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 to127.0.0.1
. Connecting tolocalhost
by name isn't too important, it's just easier to type (for me at least) than127.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;
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
tohints.ai_family
instead of what you did, since it actually tellsgetaddrinfo
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.
Yup, IPv6 is now fully supported with the upcoming 2.2.14, so no need to worry about that stuff anymore. :)
Edited by Hanicef
added Bug label
changed milestone to %2.2.14
added Netcode label
mentioned in commit 5b4b1211