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

@ -319,6 +319,19 @@ SListener listener_find(const std::string& name);
*/
std::vector<SListener> listener_find_by_service(const SERVICE* service);
/**
* Find listener by configuration
*
* @param socket Optional path to a socket file
* @param address Address where the listener listens
* @param port The port on which the listener listens
*
* @return The matching listener if one was found
*/
SListener listener_find_by_config(const std::string& socket,
const std::string& address,
unsigned short port);
int listener_set_ssl_version(SSL_LISTENER* ssl_listener, const char* version);
void listener_set_certificates(SSL_LISTENER* ssl_listener, const std::string& cert,
const std::string& key, const std::string& ca_cert);