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

[Bug]: IP allocation issue #118

Closed
1 task done
alekseikulik opened this issue Jan 22, 2025 · 2 comments · Fixed by #121
Closed
1 task done

[Bug]: IP allocation issue #118

alekseikulik opened this issue Jan 22, 2025 · 2 comments · Fixed by #121
Assignees
Labels
bug Something isn't working

Comments

@alekseikulik
Copy link

What happened?

Dear @leonovk! First of all, thank you for this great API server!

I have wg-rest-api deployed on a server as Docker container with default IP settings:

WG_DEFAULT_ADDRESS=10.8.0.x
CONNECTING_CLIENT_LIMIT=24

Issue 1: The API allowed me to create more than 254 clients. The CONNECTING_CLIENT_LIMIT does not actually limit this. For a `/24' network, there should be 256 total addresses and 254 allocable addresses (addresses we can assign to server and clients). API should raise an error when user reaches limit. Current behaviour: API continues to create clients.

Issue 2: API does not release IP addresses of deleted users. I created 254 clients, then deleted 250 and created 5 more. Instead of freeing IP addresses from 10.8.0.0/24, the API continues to lease addresses from the following /24 network 10.8.1.0/24. It caused newly created users with 10.8.1.0/24 addresses to be unable to communicate properly.

Also I would suggest to deprecate CONNECTING_CLIENT_LIMIT variable and include it in WG_DEFAULT_ADDRESS.
The value of WG_DEFAULT_ADDRESS should look like network in format 10.8.0.0/24 from which we can calculate server IP and the maximum number of clients.

Version

v2.2.3

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct
@alekseikulik alekseikulik added the bug Something isn't working label Jan 22, 2025
@leonovk
Copy link
Owner

leonovk commented Jan 22, 2025

@alekseikulik thanks for the issue, I'll take this to work soon

@leonovk leonovk linked a pull request Jan 23, 2025 that will close this issue
@leonovk
Copy link
Owner

leonovk commented Jan 24, 2025

@alekseikulik The fix will be included in the next release. When the limit is reached, the server will return a 500 error. It is not processed by the application in case you want to connect sentry for such cases. Also, when clients are deleted, their addresses become free for new clients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants