Fix reloading of listeners where multiple listeners have the same port.

This is only possible where they have different bind addresses.

Closes #2029. Thanks to Simon Aldrich.
pull/2064/head
Roger A. Light 5 years ago
parent c9a4ef402e
commit 4165224885

@ -7,6 +7,8 @@ Broker:
- Add notes that libsystemd-dev or similar is needed if building with systemd
support. Closes #2019.
- Improve logging in obscure cases when a client disconnects. Closes #2017.
- Fix reloading of listeners where multiple listeners have been defined with
the same port but different bind addresses. Closes #2029.
Apps:
- Allow command line arguments to override config file options in

@ -1417,8 +1417,21 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
{
for(i=0; i<config->listener_count; i++){
if(config->listeners[i].port == tmp_int){
cur_listener = &config->listeners[i];
break;
/* Now check we have a matching bind address, if defined */
if(config->listeners[i].host){
if(token && !strcmp(config->listeners[i].host, token)){
/* They both have a bind address, and they match */
cur_listener = &config->listeners[i];
break;
}
}else{
if(token == NULL){
/* Neither this config nor the new config have a bind address,
* so they match. */
cur_listener = &config->listeners[i];
break;
}
}
}
}
}

Loading…
Cancel
Save