Skip to content

Commit

Permalink
[170] Fix WS listeners not being able to bind to an IP.
Browse files Browse the repository at this point in the history
Closes eclipse-mosquitto#170. Thanks to minghuadev.

Bug: eclipse-mosquitto#170
  • Loading branch information
ralight committed May 26, 2016
1 parent afc2c99 commit 7761218
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 12 additions & 6 deletions man/mosquitto.conf.5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -629,17 +629,23 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>listener</option> <replaceable>port</replaceable></term>
<term><option>listener</option> <replaceable>port</replaceable> <replaceable><optional>bind address/host</optional></replaceable></term>
<listitem>
<para>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 <option>bind_address</option> nor
<option>port</option> are used then the default
listener will not be started. This option may be
specified multiple times. See also the
<option>mount_point</option> option.</para>
neither the global <option>bind_address</option>
nor <option>port</option> options are used then the
default listener will not be started.</para>
<para>The <option>bind address/host</option> 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.</para>
<para>This option may be specified multiple times. See
also the <option>mount_point</option>
option.</para>
<para>Not reloaded on reload signal.</para>
</listitem>
</varlistentry>
Expand Down
2 changes: 2 additions & 0 deletions mosquitto.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/websockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7761218

Please sign in to comment.