[Bug] Returning Wrong IP Address For IPv6?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

hieubui149
Posts: 7
Joined: 20 Mar 2017, 14:33

[Bug] Returning Wrong IP Address For IPv6?

Postby hieubui149 » 20 Mar 2017, 14:48

We provided a feature to know player IP address and prevent player in the same network can't play together and it work well by call

Code: Select all

user.getIpAddress()

from Java.
This morning, we decided to support IPv6 to our customer on my server and we found the problem with players who are using IPv6.
For client Ipv4, this function returned full of ip. Eg: "115.79.219.152"
For client Ipv6, this function returned just the first part of the string: Eg: "2a01" (while there are more of it ":aaaa:bbbb:cccc"). :shock:. Because we have plenty of Ip begin with 2a01, so our server detect that they're in the same Ip and stop them from playing together.

More information: they connect to my server normally without any errors, so I think I have configured my server correctly.
I don't know what is going on. Let me know please. Thanks. :)
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby Lapo » 20 Mar 2017, 15:20

Are you running the latest 2.12.x? Or and older version?
Before 2.12 IPv6 was not handled correctly, in terms of formatting/output.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
hieubui149
Posts: 7
Joined: 20 Mar 2017, 14:33

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby hieubui149 » 20 Mar 2017, 15:29

Hi Lapo, I'm using 2.12.3 on server - the last update.
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby Lapo » 20 Mar 2017, 16:05

What connection is the client using?
TCP? Websocket? BlueBox?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
hieubui149
Posts: 7
Joined: 20 Mar 2017, 14:33

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby hieubui149 » 21 Mar 2017, 00:42

I supports both TCP and BlueBox. Currently they're online (from players around the world) so it's a little bit hard to know which is the one cause error. Can you guys test both of them? I don't have Ipv6 environment for testing. Thanks
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby Lapo » 21 Mar 2017, 10:09

We don't either. It's relatively easy to setup a server with IPv6 as most providers support it, but from home/office connections it's unlikely.
In any case I've double checked the code that handles IPv6 addresses and I can't find or reproduce any issues.

Can you show me an extract of your log files where IPv6 clients have connected to the server?
They look like this:

Code: Select all

08 mar 2017 | 10:56:25,348 | INFO  | SocketReader | bitswarm.sessions.DefaultSessionManager |     | Session created: { Id: 98, Type: DEFAULT, Logged: No, IP: 127.0.0.1:54072 } on Server port: 9933 <---> 54072


Basically any "Session created" line.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
hieubui149
Posts: 7
Joined: 20 Mar 2017, 14:33

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby hieubui149 » 21 Mar 2017, 12:21

Hi Lapo,
My game is online now and I have disabled INFO on session/login. That's why I can give you that log (I don't have testing environment too). Is there another way to detect or maybe find the reason for that weird error.
My configuration for Ipv6 is [img]
Screen%20Shot%202017-03-21%20at%2019.23.58.jpg
[/img]
Attachments
Screen Shot 2017-03-21 at 19.23.58.jpg
(49.62 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby Lapo » 21 Mar 2017, 14:20

If you need this quickly, the logs are the only way to go. Otherwise I will add your report in our bug database, without any evidence/logs and we'll have to reproduce it ourselves setting up two different IPv6 enable environments to test this out. Which will take a while.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
hieubui149
Posts: 7
Joined: 20 Mar 2017, 14:33

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby hieubui149 » 21 Mar 2017, 15:17

Ok Lapo, let's wait. By the way, I will try something to know exactly what it is. Let me know if you have more information about it. Thank you! :wink:
hieubui149
Posts: 7
Joined: 20 Mar 2017, 14:33

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby hieubui149 » 21 Mar 2017, 18:14

Hi Lapo,
I did some trick by use my servers connect to a test smartfox server to create ipv6 environment and found that log with ipv6, check it out please:

Code: Select all

18:15:01,068 INFO  [SocketReader] sessions.DefaultSessionManager     - Session created: { Id: 2, Type: DEFAULT, Logged: No, IP: 2a01 } on Server port: 9933 <---> 0
18:15:01,429 INFO  [SFSWorker:Ext:8] api.SFSApi     - User login: { Zone: Gateway }, ( User Name: 1, Id: 1, Priv: 0, Sess: 2a01 ) , Type: Android
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby Lapo » 21 Mar 2017, 19:32

Thanks, this will probably help.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby Lapo » 23 Mar 2017, 14:23

We've done a few tests and fixed what we think should be the cause.
Would you please test it on your side?

You can download the patch from here.
Lapo

--

gotoAndPlay()

...addicted to flash games
hieubui149
Posts: 7
Joined: 20 Mar 2017, 14:33

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby hieubui149 » 24 Mar 2017, 15:36

Thank Lapo, this bug have already fixed. Here are the log from my test:

Code: Select all

15:40:09,728 INFO  [SocketReader] sessions.DefaultSessionManager     - Session created: { Id: 3, Type: DEFAULT, Logged: No, IP: 2a01:0:0:0:f03c:91ff:fee7:4e53:29930 } on Server port: 9933 <---> 29930
15:40:10,097 INFO  [SFSWorker:Ext:8] api.SFSApi     - User login: { Zone: Gateway }, ( User Name: 1, Id: 2, Priv: 0, Sess: 2a01:0:0:0:f03c:91ff:fee7:4e53:29930 ) , Type: Android
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby Lapo » 24 Mar 2017, 20:23

Thanks for your feedback.
Lapo

--

gotoAndPlay()

...addicted to flash games
creat326
Posts: 87
Joined: 13 Jun 2010, 09:50

Re: [Bug] Returning Wrong IP Address For IPv6?

Postby creat326 » 12 Apr 2017, 18:58

hi
it doesn't work here with latest patch, if using udp instead of tcp
it seems all udp packages bounce back as soon as it's on ipv6 network

not sure if it's the same but my server log is full of these for many of these players reporting problems
12 Apr 2017 | 19:59:59,868 | WARN | SFSWorker:Sys:2 | v2.protocol.SFSIoHandler | | Discard UDP packet from 162.250.152.155:45032, reason: Sender UDP Port doesn't match current session port: 45032 != 53727

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 54 guests