diff --git a/ChangeLog.txt b/ChangeLog.txt index 8981c600..2b4a93bf 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -16,6 +16,8 @@ Broker: - Fix reconnecting for bridges that use TLS on Windows. Closes #154. - Broker and bridges can now cope with unknown incoming PUBACK, PUBREC, PUBREL, PUBCOMP without disconnecting. Closes #57. +- Fix websockets listeners not being able to bind to an IP address. Closes + #170. Client library: - Fix the case where a message received just before the keepalive timer diff --git a/man/mosquitto.conf.5.xml b/man/mosquitto.conf.5.xml index e27fb589..d2b1fc52 100644 --- a/man/mosquitto.conf.5.xml +++ b/man/mosquitto.conf.5.xml @@ -629,17 +629,23 @@ - port + port bind address/host Listen for incoming network connection on the specified port. A second optional argument allows the listener to be bound to a specific ip address/hostname. If this variable is used and - neither nor - are used then the default - listener will not be started. This option may be - specified multiple times. See also the - option. + neither the global + nor options are used then the + default listener will not be started. + The option + allows this listener to be bound to a specific IP + address by passing an IP address or hostname. For + websockets listeners, it is only possible to pass + an IP address here. + This option may be specified multiple times. See + also the + option. Not reloaded on reload signal. diff --git a/mosquitto.conf b/mosquitto.conf index df1aa8ba..f0e14023 100644 --- a/mosquitto.conf +++ b/mosquitto.conf @@ -271,6 +271,8 @@ # this case, mosquitto will attempt to bind the listener to that # address and so restrict access to the associated network and # interface. By default, mosquitto will listen on all interfaces. +# Note that for a websockets listener it is not possible to bind to a host +# name. # listener port-number [ip address/host name] #listener diff --git a/src/websockets.c b/src/websockets.c index 0be2ea1b..ee7c5a25 100644 --- a/src/websockets.c +++ b/src/websockets.c @@ -584,6 +584,7 @@ struct libwebsocket_context *mosq_websockets_init(struct _mqtt3_listener *listen } memset(&info, 0, sizeof(info)); + info.iface = listener->host; info.port = listener->port; info.protocols = p; info.gid = -1;