TribesNext

Welcome, Guest. Please login or register.
Did you miss your activation email?


TribesNext >  TribesNext.com Forums >  Tribes 2 >  Mods and Customization >  Server Problem - Man in the middle « previous next »
Pages: [1] Print
Author Topic: Server Problem - Man in the middle
robertom2002
Seņor Nugget

Posts: 185

View Profile
September 16, 2018, 01:43:19 PM »
First, let me say that I'm very happy to see someone host a server using Classic Bots. Because when you wanna play a quick match or two against competent bots without hosting the server yourself, you can just quickly join for some fun. I am talking about the server named Classic Bots Server.

The problem is that I have no way of contacting the owner. It seems that for about a week or more, I get the 'Man in the middle attack...' error when I join the server, and it doesn't let me join. I suspect this happens to anyone connecting. If the owner reads this, please reset the server. And do message me if you want updated scripts that show player records for each map, every time you join or press a key Smiley

And out of curiosity, I also wanna ask, what causes this error in the first place? How can it be prevented?
« Last Edit: September 16, 2018, 01:56:05 PM by robertom2002 »

Krash
Administrator
Posts: 264

View Profile
1: September 16, 2018, 11:53:38 PM »
This can occur if the server's public address changes from what it was when the server started, such as if the host's router was reset and received a new dynamic IP.
Restarting the server should resolve it.  If it happens regularly, having the server automatically restart at intervals would avoid this (as well as a few other peculiarities which can occur when the game runs for more than a few weeks), and would probably be the simplest fix without digging into detecting the change and resetting the appropriate variables.

robertom2002
Seņor Nugget

Posts: 185

View Profile
2: September 17, 2018, 05:13:04 AM »
Thanks for the info. Good to know it's something easily solvable.

rom42
Nugget
Posts: 2

View Profile
3: October 07, 2018, 01:13:17 AM »
Thanks for the heads up and your work on Classic Bots Roberto!
(And everyone involved in keeping this game alive all the time!)

As you said, the mod is perfect for a quick game that feels as close to playing on a server with random people as I can remember from back in the days.
Even as the only human in the game, it's fun to play against the bots.
So I thought I'll leave the server running in case someone is still around and wants to have a bit of fun.

The server is running on a small box where the connection gets a new IP assigned by the ISP every day.
Since I get the error as well, I tried setting $Host::ClassicAutoRestartServer = 1 and $Host::ClassicRestartTime = 24 in ClassicBots/prefs/ServerPrefs.cs, but as far as I can tell that doesn't really restart the server.
Unfortunately due to work, I didn't have time to look much further into it yet.

Since the server gets a new IP every day, it would be nice to be able to just set the appropriate variables that you mentioned Krash, in case someone is currently playing and having an automatic hard reset every few days when no one is using the server.

I never got into the scripting part of Tribes back in the days and with the game being that old I seem to have a hard time getting much info on the topic now.
As I'm a sofware dev by trade, If someone could give me some pointers on how to set those variables when the IP changes (can those be set from outside, or does it all have to be a game script?), I'm confident I can cobble something together to get the server accessible
robertom2002
Seņor Nugget

Posts: 185

View Profile
4: October 07, 2018, 09:16:41 AM »
Thanks, rom, glad to see you like it. I want to mention, I did encounter the server auto-restart one time when I was playing there right before a map was switched. But I think that's also the problem. I think the server auto-restarts only when someone joins and before switching the map. If no one can join because of that man in the middle error, the server can't restart, IF the auto-restart works in this way.

So I don't know how to make it auto-restart after you get a new IP for the server, unless it would be done by outside programs. Maybe someone more knowledgeable could help you here.

Krash
Administrator
Posts: 264

View Profile
5: October 07, 2018, 01:24:07 PM »
I expect they figured servers using it would be cycling through missions regularly; if not it wouldn't appear to be working from the outside. For the Classic auto-restart to actively shut down, you could open up GameData/classic/scripts/server.cs, find function AutoRestart(), and add the following block before its other actions:
Code:
if ((ClientGroup.getCount() - $HostGameBotCount) == 0)
{
logEcho("Auto-restarting the server.");
quit();
}

This should quit the server if empty, and otherwise fall through to the default behaviour (notice the players of a restart on mission change) if not.

Alternatively, you could try dropping the attached script in scripts/autoexec/ and setting $Host::TN::resetIPv4 = true; in your serverprefs.  This will cause the server to use the public address as seen by the master server every time a heartbeat is confirmed -- though even if this works for you, I would still recommend keeping the server auto-restarting once in a while.
Attached files
* t2csri_list.cs (6.02 KB - downloaded 6 times.)
« Last Edit: October 07, 2018, 01:27:00 PM by Krash »

rom42
Nugget
Posts: 2

View Profile
6: October 07, 2018, 06:48:27 PM »
Thanks for the pointers, will have a look at how this works.

Had a bit of time today and threw together a quick external restart script in node that gets notified by the router via a dyndns call (the router can use an internal LAN IP for its dyndns calls - who knew). Node then checks the status of the game server over UDP and schedules to check again in a few minutes if there are players.
Otherwise just reboots the game server right away.

Been trying to figure out the UDP status protocol by looking at GameQ (http://gameq.sourceforge.net), but some parts are missing there.
Hacking it together to identify bots and human players was ok, but if anyone has a (more) complete description of the UDP status protocol, please let me know.
Would love to put together a nice and small node lib for this.

Still need to add binding the game server threads to specific cores, but so far it seems to be working ok enough so that I don't have to do the reboot by hand anymore.
Seen a few people connect and play, so it seems to be working from outside now as well.
If someone encounters other problems, please feel free to give me a shout here on PM or email.
Will test a bit more during the week when I get time
Pages: [1] Print 
« previous next »
Jump to:  

irc.quakenet.org / #TribesNext Powered by SMF  © Simple Machines
anything