From 5780783c0c97d7fd3d938c4a42aa49d3c64e78e2 Mon Sep 17 00:00:00 2001 From: Denis Osvald Date: Sat, 4 Jun 2016 08:37:50 +0800 Subject: [PATCH] ipv6 don't ignore info.iface Signed-off-by: Denis Osvald --- lib/libwebsockets.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index d3a06709..acd11452 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -1628,7 +1628,12 @@ lws_socket_bind(struct lws_vhost *vhost, int sockfd, int port, v = (struct sockaddr *)&serv_addr6; n = sizeof(struct sockaddr_in6); bzero((char *) &serv_addr6, sizeof(serv_addr6)); - serv_addr6.sin6_addr = in6addr_any; + if (iface && + interface_to_sa(vhost, iface, + (struct sockaddr_in *)v, n) < 0) { + lwsl_err("Unable to find interface %s\n", iface); + return -1; + } serv_addr6.sin6_family = AF_INET6; serv_addr6.sin6_port = htons(port); } else