Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 09-09-2008, 06:36 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Feel free to submit some code for a better way to do it

I am not much of a coder, but this was a pretty easy way to do something that I needed on my own server. I figured other servers might be able to use it as well, which is why I submitted it. Most servers probably wouldn't need more than 1 or 2 levels of IP limiting. But I do agree that your idea is probably a little better way of handling it to allow more options. And I like having more options

After thinking more about it, the whole IP limiting code is slightly flawed in 1 major way. The problem is that it only checks the status of the current account trying to log in instead of checking the status of all accounts logged in from the same IP. So, even if you have an exempt account, if you don't log the exempt account in last after the others are all in, you won't be able to have more than whatever the IP Limit is set to. As long as you log in the exempt accounts after the others are logged in, you can log in more than the IP Limit.

So, what really needs to be done is there needs to be a check of the status of all accounts logged in from the same IP. Then, it needs to subtract the exempt accounts from the total IP Connections before doing the IP Limit restriction.

Here is an example of how it should work:

Account 1 = Status 0
Account 2 = Status 1
Account 3 = Status 2
Account 4 = Status 3
Account 5 = Status 4
Account 6 = Status 5

IP Limiting set to 2 for all status 0 accounts.
AddMaxClientStatus (for additional accounts) IP limiting set to status 1
IP Limiting Exempt set to status 5

Any account with higher than the AddMaxClientStatus would have 1 more connection allowed added to their total IP Limit. Anything between status 1 and 4 will increment the total accounts allowed by 1. So, status 1 would be limited to 3 accounts per IP, status 2 would be limited to 4 accounts per IP and so on.

When an account is logged in, it would pull all of the accounts connected on that IP. The first thing it would do would be to subtract any exempt accounts from the total IP Connections. Next, it would go down the list of other statuses and run a check:

(Account Status - AddMaxClientStatus + 1) = Total Additional Accounts Per IP. Of course you would have to check to make sure this is >= 0 otherwise any account below AddMaxClientStatus - 1 will go into the negative.

Now that we have the total additional accounts that should be allowed per IP for this account, we can just do (total accounts + MaxClientsPerIP) to get the total for this connection.

The last part would just need to be able to pull the next highest account status below the exempt setting for all accounts connected on that same IP. And that status is what would be used for all connections (other than the exempt ones) to decide how many connections are allowed.

This makes my head hurt a little to think about and to make sure it would word exactly the way that it should. But, I am fairly certain that this way would work. If someone can write some code that can check the status of all accounts connected per IP and then select the highest status that is below the exempt status, I am pretty sure I can write the rest of it. The rest is mostly just adding and subtracting and should be fairly simple.

If this was made, I think it would finalize the IP limiting feature options.

The only other issue with IP Limiting is for Windows Servers. Due to player ghosting on Windows, the IP Limiting feature can lock out players from being able to connect at all if they have a ghost in the world already. The best solution for this would obviously be to fix the player ghosting issue on Windows Servers (it doesn't happen on Linux). But, another solution would be to limit it so that only 1 character can be logged in per account like they do on EQLive. Then, if the same account is logged in again, it will boot any characters currently logged in or even at at character select on that same account. This would cause any ghosted characters to be booted from the world as soon as the same account hit "connect" from the server select. And this check would need to be done before the IP Limiting check to make sure that it boots the character being being IP blocked.

I am definitely learning alot about coding just reading through the source and making minor changes. But, I am still very much of a noob at it, so anything that can't be done by example from somewhere else in the code is above me. That is why I would need someone else to write code that would check the status of all accounts on the same IP connection and select the next highest status below the exempt status. But again, if someone does that, I should be able to do the rest to get this feature working 100% as it should.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 09-09-2008, 11:06 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I edited the original code I submitted here a little. It wasn't working exactly as it was supposed to. But now it seems to be working as it is intended. I will report back if there are any other issues I see from testing it.

And, I wouldn't mind making the IP limiting code even better, but as I already said, I will need someone who would be able to write code that checks the status of all accounts logged in. Then that code would need to do 2 things. It would need to be able to get the highest account status, and if the highest status was >= to the exempt status setting, then it would also need to get the next highest account status.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 09-10-2008, 12:31 AM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

If I had any skill in C, I certainly would write some code submissions, alas, I dont. I can read most of it though.

As for fixing the character lockout issue caused by the IP limiter, I sent a email to Jibbawalker just this morning on how to fix that too, which Ill share here.

On the line where if checks if theres currently a character logged in at IPs from the logging in IP and then increments IPInstances, add a check to NOT increment that counter if the logging in character is currently in the world. When the new character logs in, the server should kick the already logged in character of the same name.

This should fix that issue.

PS I would have copied the code line I was talking about, but for some reason I cant select and copy text inside /code section on my Nokia 770 and Im just to lazy to scroll back and forth to copy it by hand on my 5 inch screen.
Reply With Quote
  #4  
Old 09-10-2008, 12:56 AM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

Was just thinking that if you called the routine that boots a character whos is already in world and is now logging in before the IP limiter routine, it would solve that issue too.
Reply With Quote
  #5  
Old 09-10-2008, 05:09 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Ya, Jibba sent me your idea for the code fix for it. But, that wouldn't really work. The problem with it is that in the emu you can play more than 1 character per account at a time. So, if it was making you exempt from IP limiting if you have a character already logged in on that account, you could just get around it by playing multiple characters on the same account.

Though, your idea is close to a solution. The best way would be for it to check if the account is already logged in and then kick any character on that account so it can log in again. I already mentioned that idea in this thread:

Quote:
But, another solution would be to limit it so that only 1 character can be logged in per account like they do on EQLive. Then, if the same account is logged in again, it will boot any characters currently logged in or even at at character select on that same account.
That is something I already suggested as a feature request in an earlier post as well here as well:
http://www.eqemulator.net/forums/showthread.php?t=25832

Ideally, it would be best if the account check and player kick was done before the IP Limiting check happened. I don't think it would work otherwise.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #6  
Old 09-11-2008, 01:53 AM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

I think you misundersteed what I was saying. What I am saying will work.

Im saying dont increment the IP counter if the character that is logging in is considered already logged in, thus allowing characters who are ghosted to be logged back in and not locked out by the IP limiter. This will not allow any bypassing of the IP limiter because people are logging in multiple characters from the same account.

Because of the bugs related to zoning multiple toons on that same account, you might as well make it so only one character per account can be logged in though.

Quote:
Originally Posted by trevius View Post
Ideally, it would be best if the account check and player kick was done before the IP Limiting check happened. I don't think it would work otherwise.
Yup. But either way should work.
Reply With Quote
  #7  
Old 09-24-2008, 02:03 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Unstuck this one because it caused a world crash. Is there newer code available that works?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:23 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3