perara / wg-manager

A easy to use WireGuard dashboard and management tool
MIT License
592 stars 74 forks source link

Unable to add peer #99

Open Cyber-Ard opened 3 years ago

Cyber-Ard commented 3 years ago

Describe the bug

Unable to add peer

To Reproduce Steps to reproduce the behavior:

Click on 'Add peer to wg0'

Platform:

Screenshot:

Screenshot 2021-05-13 192304

Stacktrace/error output:

today at 7:15:58 PM Exception in ASGI application today at 7:15:58 PM Traceback (most recent call last): today at 7:15:58 PM File "/usr/lib/python3/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 385, in run_asgi today at 7:15:58 PM result = await app(self.scope, self.receive, self.send) today at 7:15:58 PM File "/usr/lib/python3/dist-packages/uvicorn/middleware/proxy_headers.py", line 45, in call today at 7:15:58 PM return await self.app(scope, receive, send) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 199, in call today at 7:15:58 PM await super().call(scope, receive, send) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 111, in call today at 7:15:58 PM await self.middleware_stack(scope, receive, send) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 181, in call today at 7:15:58 PM raise exc from None today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call today at 7:15:58 PM await self.app(scope, receive, _send) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 25, in call today at 7:15:58 PM response = await self.dispatch_func(request, self.call_next) today at 7:15:58 PM File "/app/middleware.py", line 35, in db_session_middleware today at 7:15:58 PM response = await call_next(request) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 45, in call_next today at 7:15:58 PM task.result() today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 38, in coro today at 7:15:58 PM await self.app(scope, receive, send) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call today at 7:15:58 PM raise exc from None today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call today at 7:15:58 PM await self.app(scope, receive, sender) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 566, in call today at 7:15:58 PM await route.handle(scope, receive, send) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 227, in handle today at 7:15:58 PM await self.app(scope, receive, send) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 41, in app today at 7:15:58 PM response = await func(request) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 201, in app today at 7:15:58 PM raw_response = await run_endpoint_function( today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 150, in run_endpoint_function today at 7:15:58 PM return await run_in_threadpool(dependant.call, values) today at 7:15:58 PM File "/usr/local/lib/python3.8/dist-packages/starlette/concurrency.py", line 34, in run_in_threadpool today at 7:15:58 PM return await loop.run_in_executor(None, func, args) today at 7:15:58 PM File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run today at 7:15:58 PM result = self.fn(self.args, self.kwargs) today at 7:15:58 PM File "/app/routers/v1/peer.py", line 60, in add_peer today at 7:15:58 PM peer.address = generate_ip_address(server, v6=False) today at 7:15:58 PM File "/app/routers/v1/peer.py", line 43, in generate_ip_address today at 7:15:58 PM return str(list(sorted(address_space)).pop(0)) today at 7:15:58 PM IndexError: pop from empty list

alotofshit commented 3 years ago

can you show server config?

perara commented 3 years ago

Which IP address are you trying to assign. If the server has the /32 subnet, I would imagine that this error can occur. Surely this is something that we should improve!