NethServer / dev

NethServer issue tracker
https://github.com/NethServer/dev/issues
63 stars 20 forks source link

Reuse and reallocate TCP/UDP port range #6974

Open DavidePrincipi opened 2 months ago

DavidePrincipi commented 2 months ago

The current implementation of TCP and UDP ports allocation has two limitations:

  1. Modules like NethVoice allocates a wide range of port numbers, leading to possible node port exhaustion. When an instance is removed, used ports must be reclaimed by the node agent.
  2. By time, the number of ports required by a module may change. For instance, Mattermost received an additional TCP port for the Calls plugin. As the ports are allocated by the add-module action, the only way to require more ports is with backup/restore or instance clone.

Proposed solution

Alternative solutions

This feature is required. Keeping things as they are makes difficult to install NethVoice and manage the update of applications that increase their port requirements.

See also

Discussion https://mattermost.nethesis.it/nethesis/pl/5s131bmj7jdwzj7gaogukb5z6a

DavidePrincipi commented 4 days ago

Acceptance tests

Useful commands

Dump the ports.sqlite DB with

podman run -i --rm --volume /var/lib/nethserver/node/state/ports.sqlite:/srv/ports.sqlite:z alpine ash -c 'apk add sqlite ; sqlite3 /srv/ports.sqlite' <<<"SELECT *, 'tcp' FROM TCP_PORTS UNION SELECT *, 'udp' FROM UDP_PORTS;"