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

[fix/nat_multiplayer] Fix for multiple users behind a NAT #77

Merged
merged 2 commits into from Jun 30, 2015

Conversation

chief1983
Copy link
Member

Vestigare's submitted patch for allowing multiple users behind a NAT to connect to a remote standalone. See http://www.hard-light.net/forums/index.php?topic=88971.0 for more detail. Just putting this out to hopefully get a little more review, I had the patch sitting on my desktop and it's been purged from the thread since, don't want it to disappear forever.

@Echelon9
Copy link
Contributor

Echelon9 commented May 7, 2015

I'll give this a test too with my OS X and Linux standalones. Am keen to get the multiplayer code improved a tad.

@chief1983
Copy link
Member Author

Unfortunately I don't think I can get standalone running on my VPS due to restricted hard drive space, so I can run one in my basement, but then I only have one computer available outside of the basement to test connecting to that standalone...if you set up a standalone I can get several clients connecting to it from my house behind my NAT probably.

@chief1983
Copy link
Member Author

Hmm, just realized that with a second router I could set up a second NAT in my house for FS2 testing. And I have a router I've been meaning to test anyway.

@chief1983
Copy link
Member Author

I will run this on my home standalone server, if someone could attempt to connect to it with two computers behind the same NAT and see if it works? I think the code only needs to be applied to the standalone side but it couldn't hurt to make sure it's on the clients too.

@chief1983
Copy link
Member Author

Actually since I have two macbooks at work while I transfer my old files to my new one, I might be able to pull off this test myself. But anyone else is welcome to try in case they can beat me to it.

@chief1983
Copy link
Member Author

Verified, that this appears to have fixed this issue. Both my Macbooks on my office NAT were able to connect to my standalone running at home. Still can't join the lobby chat together, but they do both seem to be able to find the games on FS2NetD. The lobby chat should probably remove the IP restriction at some point, but for now this definitely fixes the bug in the standalone.

@Goober5000
Copy link
Contributor

I was about to merge this, since chief1983 verified the fix and I reviewed the patch just now. It's perfectly merge-able as-is. However, the psnet_same function is unnecessarily clunky. This version would accomplish the same thing:

return !memcmp(a1->addr, a2->addr, 6) && a1->port == a2->port;

@chief1983
Copy link
Member Author

Updated with the simplified return line.

@Goober5000
Copy link
Contributor

Cool cool cool.

Goober5000 added a commit that referenced this pull request Jun 30, 2015
[fix/nat_multiplayer] Fix for multiple users behind a NAT
@Goober5000 Goober5000 merged commit bd18c88 into scp-fs2open:master Jun 30, 2015
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

Successfully merging this pull request may close these issues.

None yet

3 participants