server: portable option for setsockopt

From linux ipv6(7) manual (section `Note`):

        SOL_IP, SOL_IPV6, SOL_ICMPV6 and other SOL_* socket options are
        nonportable variants of IPPROTO_*.  See also ip(7).

Ref: http://man7.org/linux/man-pages/man7/ipv6.7.html
This commit is contained in:
Iblis Lin 2016-11-23 23:02:13 +08:00 committed by Andy Green
parent 0bef3a8b01
commit c8bb24cf57

View file

@ -110,7 +110,7 @@ lws_context_init_server(struct lws_context_creation_info *info,
if (LWS_IPV6_ENABLED(vhost)) {
if (vhost->options & LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY) {
int value = (vhost->options & LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE) ? 1 : 0;
if (setsockopt(sockfd, SOL_IPV6, IPV6_V6ONLY,
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY,
(const void*)&value, sizeof(value)) < 0) {
compatible_close(sockfd);
return 1;