MXS-1951: Fix port conflict detection

With the addition of SO_REUSEPORT support, it is no longer possible to
rely on the network stack to prevent multiple listeners from listening on
the same port. Without explicitly checking for the ports it would be
possible for two listeners from two different services to listen on the
same port in which case the service would be almost randomly chosen.
This commit is contained in:
Markus Mäkelä
2019-03-20 12:34:59 +02:00
parent df3b501563
commit 388e952c5f
4 changed files with 43 additions and 2 deletions

View File

@ -1154,7 +1154,7 @@ bool runtime_create_listener(Service* service,
{
config_runtime_error("Listener '%s' already exists", name);
}
else if (SListener l = service_find_listener(service, "", addr, u_port))
else if (SListener l = listener_find_by_config("", addr, u_port))
{
config_runtime_error("Listener '%s' already listens on [%s]:%u", l->name(), addr, u_port);
}