From ee435adb7ca05e2fd8d3a9b1cc24f99b77d82f48 Mon Sep 17 00:00:00 2001 From: Yusuke Ishiguro Date: Tue, 8 Dec 2015 19:57:19 +0900 Subject: [PATCH] fixed to initialize sockaddr_in6 by zero Some environment has field of sin6_scope_id inside sockaddr_in6 and it should be set to zero. --- lib/client-handshake.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/client-handshake.c b/lib/client-handshake.c index 094ebfaf..9e4bd764 100644 --- a/lib/client-handshake.c +++ b/lib/client-handshake.c @@ -37,18 +37,20 @@ lws_client_connect_2(struct lws_context *context, struct lws *wsi) ads = context->http_proxy_address; #ifdef LWS_USE_IPV6 - if (LWS_IPV6_ENABLED(context)) + if (LWS_IPV6_ENABLED(context)) { + memset(&server_addr6, 0, sizeof(struct sockaddr_in6)); server_addr6.sin6_port = htons(context->http_proxy_port); - else + } else #endif server_addr4.sin_port = htons(context->http_proxy_port); } else { ads = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS); #ifdef LWS_USE_IPV6 - if (LWS_IPV6_ENABLED(context)) + if (LWS_IPV6_ENABLED(context)) { + memset(&server_addr6, 0, sizeof(struct sockaddr_in6)); server_addr6.sin6_port = htons(wsi->u.hdr.ah->c_port); - else + } else #endif server_addr4.sin_port = htons(wsi->u.hdr.ah->c_port); }