Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probem with 2 computer with same IP. #20

Closed
rt-2 opened this issue Feb 27, 2017 · 26 comments
Closed

Probem with 2 computer with same IP. #20

rt-2 opened this issue Feb 27, 2017 · 26 comments

Comments

@rt-2
Copy link
Contributor

rt-2 commented Feb 27, 2017

Hi,
I normally test my server with 2 computer at the same time, a laptop, and my desktop.
I obviously deactivated "40 Protection from the sandbox".
Once including Nex-AC, I started having problems when using more than one player. Notably, when I connect a character from computer 1, then I connect another character with computer 2, when I disconnect computer 2, both loses connection.

Thank you,
rt-2

@NexiusTailer
Copy link
Owner

How do you disable this protection?

@rt-2
Copy link
Contributor Author

rt-2 commented Feb 28, 2017

I didn't think it was related because I disabled any kicks just to test the anticheat at first.
I used ac_ACAllow to disable the things I didn't want/need...

Thank you,
rt-2

@NexiusTailer
Copy link
Owner

Array ac_ACAllow keeps the default settings, which apply only if not found nex-ac_settings.cfg in scriptfiles folder. Edit this file or use EnableAntiCheat function (which can also be used during the game) to enable/disable the desired anticheats.

@rt-2
Copy link
Contributor Author

rt-2 commented Feb 28, 2017

I will try, even tho I think it wont change a thing..
Where should I put EnableAntiCheat? I have one Gamemode and 8 Filterscript.
Should I put it only in my Gamemode or in every script?

Thank you,
rt-2

@NexiusTailer
Copy link
Owner

NexiusTailer commented Feb 28, 2017

I will try, even tho I think it wont change a thing..

This array just wasn't designed for that

So you don't need to declare this function in filterscripts, one time in gamemode would be enough

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 2, 2017

It didn't worked.
I re-downloaded a fresh version of Nex-Ac, tried including it and added:

	EnableAntiCheat(40, 0);

in OnGameModeInit()

Still the same problem: when I connect 2 PC from the same IP to the server, whatever computer I /q with, the other computer will lose connection, then display a "Server restarted" message, and will try to reconnect to the server.
I reverted to my backup and everything works fine.

Thank you,
rt-2

@NexiusTailer
Copy link
Owner

NexiusTailer commented Mar 2, 2017

Is a kick message appears for the player in the console or in the chat in moment of reconnect?
If not, possible disconnection occurs in some other way, so connect CrashDetect.
Also try to use .cfg file...

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 2, 2017

I already have crashdetects, there is nothing printed.
As I said the connection get lost, the only message displayed in the console is that both players disconnected.
There is no kick no errors, the connection just unsync for some reason.
In my experience, it seems like an unintentional bug, no messages nothing.

It is very important, some building may have 100'000 computers with the same IP, Its not correct to limit to one connection by IPs.

Have you tested it yourself, on your side? Can you connect 2 players from the same house and disconnect just one? Does your AC have been tested working with multiple connections from the same IP?

Thank you,
rt-2

@NexiusTailer
Copy link
Owner

Of course it has been tested and works perfectly.
The number of connections from a single IP address can be configured using the macro "AC_MAX_CONNECTS_FROM_IP", which by default is equal to 1

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 2, 2017

Yes, in my previous test I changed the value of AC_MAX_CONNECTS_FROM_IP to 99 but with no different result.
I will try with a blank gamemode and see.

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 2, 2017

C:\Users\rt-2\Desktop\SAARP\SAMP\gamemodes\next-ac.pwn(22) : error 026: no matching "#if..."
C:\Users\rt-2\Desktop\SAARP\SAMP\gamemodes\next-ac.pwn(31) : error 026: no matching "#if..."
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.

I clicked 'new' in Pawno, then included your AC just after a_samp and got this.
For some reason it works in my main Gamemode, but with a fresh new one I got this, I wasn't able to find the bug.

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 2, 2017

My bad, I had a corrupted new file, ignore the previous message.

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 2, 2017

Your AC doesn't seem to be compatible with multiple connections from the same IP.
How did you succeeded in your tests?
I created a new bare gamemode and only included your AC, I also removed every filterscripts, then started a test server.
In the script I included:

public OnGameModeInit()
{
	EnableAntiCheat(40, 0);
	return 1;
}

I also set AC_MAX_CONNECTS_FROM_IP to 99 in your include.
After I spawned with both my player in CJ skin in LV, I /q one, the other one's chat is already unresponsive and 10 second later the disconnection is confirmed by the server, and 20 second after that, the player has reconnected to the server. It's like the server drops every connection when one is closed from a particular IP, it just drops them, it doesn't close them.

server_log.txt (I /q with player 'Rajouid_Patouille') :

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team

[10:04:37] filterscripts = ""  (string)
[10:04:37] 
[10:04:37] Server Plugins
[10:04:37] --------------
[10:04:37]  Loaded 0 plugins.

[10:04:37] 
[10:04:37] Filterscripts
[10:04:37] ---------------
[10:04:37]   Loaded 0 filterscripts.

[10:04:37]  
[10:04:37] --------------------------------------
[10:04:37]  Anticheat Nex-AC loaded!
[10:04:37]  Anticheat version: 1.9.20
[10:04:37]  Author: Nexius
[10:04:37] --------------------------------------

[10:04:37] 
----------------------------------
[10:04:37]  Blank Gamemode by your name here
[10:04:37] ----------------------------------

[10:04:37] Number of vehicle models: 0
[10:05:58] [connection] 70.81.134.206:59179 requests connection cookie.
[10:05:59] [connection] incoming connection: 70.81.134.206:59179 id: 0
[10:05:59] [join] Rajouid_Patouille has joined the server (0:70.81.134.206)
[10:06:01] [connection] 70.81.134.206:1048 requests connection cookie.
[10:06:03] [connection] incoming connection: 70.81.134.206:1048 id: 1
[10:06:03] [join] Hubert_Contant has joined the server (1:70.81.134.206)
[10:06:20] [part] Rajouid_Patouille has left the server (0:1)
[10:06:30] [part] Hubert_Contant has left the server (1:0)
[10:06:34] [connection] incoming connection: 70.81.134.206:1049 id: 0
[10:06:50] [connection] incoming connection: 70.81.134.206:1050 id: 0
[10:06:50] [join] Hubert_Contant has joined the server (0:70.81.134.206)

This is the gamemode, nothing else is loaded, only 1 gamemode :

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#include <nex-ac>

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}


public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	EnableAntiCheat(40, 0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}

Thank you,
rt-2

@NexiusTailer
Copy link
Owner

So I checked it again. I have both players that have successfully connected to the server and can fully play with the same IP (if anti-sandbox is disabled).
sa-mp-000

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 3, 2017

Yes I can do that too,
The problem is when I /q with one, both disconnects.

Thank you,
rt-2

@NexiusTailer
Copy link
Owner

NexiusTailer commented Mar 3, 2017

This also works well for me

I paid attention to your log, namely:

[10:06:30] [part] Hubert_Contant has left the server (1:0)

0 after the : indicates that the player has crashed, so check possible problem in your client or in some code on the server

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 3, 2017

I tested it on a Windows 7 Desktop AND on a laptop Windows XP, with the bare script I showed, both do the same.
0 after the : doesn't indicate a crash, the player hasn't crash, it indicates that the player has 'timed out' that is not the same thing.
The connection is dropped like I said, my client receive the message 'the server is restarting' and then tries to reconnect automatically, that mean it's not a crash if the client hasn't crashed, SAMP stay opened, only the connection drop.

[10:06:30] [part] Hubert_Contant has left the server (1:0)
[10:06:34] [connection] incoming connection: 70.81.134.206:1049 id: 0

If the client would have crash, it would take more than 4 second to reconnect.
I repeated everything 3 times now, did you try /q with a player and keeping the second player connected after, and trying to chat, if THAT works, then i'm gonna do some more test but I am out of possibility, I included your script in an empty game mode, and it doesn't work, I never had this problem in 7 years with my SAMP server.
I am 99.999999% sure your script doesn't allow 2 player to stay connected if one of them type "/q" in the chat or quit the game,, the other player will desync from the server, (and time out because of this).

@NexiusTailer
Copy link
Owner

0 after the : doesn't indicate a crash, the player hasn't crash, it indicates that the player has 'timed out' that is not the same thing.
The connection is dropped like I said, my client receive the message 'the server is restarting' and then tries to reconnect automatically, that mean it's not a crash if the client hasn't crashed, SAMP stay opened, only the connection drop.

Yes, I am a little mistake (perhaps more because of the language barrier). Nevertheless, I was referring to something that is not the server closes the connection with the player (ie it's not kick). The player closes the connection with the server. Respectively, my anticheat unlikely could do something like that.

did you try /q with a player and keeping the second player connected after, and trying to chat

Yes, as previously I said, I did it, all that you say. And there are no such problems were observed. I don't question any of your and my words, so I will try to check on any other computer with other people, but as long as everything works well.

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 14, 2017

On what server have you tested it, I tested on a Windows 2008 Server.
Maybe the server OS has something to do?

@NexiusTailer
Copy link
Owner

I do not think so. However try to start the server on hosting/dedicated server (on linux), maybe something will change...

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 14, 2017

My server IS a dedicated/hosted server,
If I understand correctly, you only tested it on Linux is that correct?

rt-2

@NexiusTailer
Copy link
Owner

NexiusTailer commented Mar 14, 2017

No, I tested it on Windows (10) too, and also many more people who haven't seen this on their servers (which as I understand mostly on Linux). Thus most likely the problem not in a specific operating system

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 14, 2017

Yes I understand, but it seems like one of the last possible cause, I tested it on a BLANK gamemode, and the bug happened, do you have any other idea than the OS?
I haven't seen any proofs that it works on your side neither, all you showed me was 2 players on the same server, what I did too.
I would like to try and find the bug, but I did all I can, I tested it on a blank game mode and it still bugs, this problem never happened before to me.. What do you want me to do more.
Programming is my job, I do nothing else this is how I live.,. My experience tells me your plugin is bugged, because it doesn't work on a default environment, and all the tests are pointing towards your include.
It never happened before, and when I include your AC in my game mode or in a blank gamemode, the same thing happens, there is some errors in the TCP or IPV4 layer where the IP get mixed up!!!
Next step I think we can cross test.
I will host and you will test, then you will host and I will test. We will be able to find if it is my server or one of my clients that creates this problem when mixed with your Anti-Cheat.
Would you be interested in doing that?
rt-2

@NexiusTailer
Copy link
Owner

NexiusTailer commented Mar 14, 2017

Yes, good idea! I think this will be the quickest and easiest way to find out where the problem is.
When you will ready, send me some requisites to start the test

@rt-2
Copy link
Contributor Author

rt-2 commented Mar 17, 2017

I know what happened during the test, you hosted a server In your local network, so when you connected to your own server, your 2 players has a different IP because they used yoir local network IPs like 192.168.0.1 and 168.192.0.2,, today I will demonstrate to you,, if you want again on discord, you will understand what mistake we made during the tests!

@NexiusTailer
Copy link
Owner

The problem was found: anti-reconnect blocked the IP address of the disconnected player, so all players with the same IP forcibly left the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants