allow modifying ipv4 mapping option (IPV6_V6ONLY)
Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
This commit is contained in:
parent
33403a474e
commit
326c91b966
2 changed files with 16 additions and 0 deletions
|
@ -354,6 +354,8 @@ enum lws_context_options {
|
|||
LWS_SERVER_OPTION_EXPLICIT_VHOSTS = (1 << 13),
|
||||
LWS_SERVER_OPTION_UNIX_SOCK = (1 << 14),
|
||||
LWS_SERVER_OPTION_STS = (1 << 15),
|
||||
LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY = (1 << 16),
|
||||
LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE = (1 << 17),
|
||||
|
||||
/****** add new things just above ---^ ******/
|
||||
};
|
||||
|
|
14
lib/server.c
14
lib/server.c
|
@ -91,6 +91,20 @@ lws_context_init_server(struct lws_context_creation_info *info,
|
|||
compatible_close(sockfd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(LWS_USE_IPV6) && defined(IPV6_V6ONLY)
|
||||
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,
|
||||
(const void*)&value, sizeof(value)) < 0) {
|
||||
compatible_close(sockfd);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && defined(SO_REUSEPORT) && LWS_MAX_SMP > 1
|
||||
if (vhost->context->count_threads > 1)
|
||||
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT,
|
||||
|
|
Loading…
Add table
Reference in a new issue