mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-06 13:37:34 +08:00
Setting off IPV6_V6ONLY for USE_IPV6 case
This commit is contained in:
parent
4505b00733
commit
fb5e2b8c2f
@ -4474,6 +4474,9 @@ static int parse_port_string(const struct vec *vec, struct socket *so) {
|
||||
static int set_ports_option(struct mg_context *ctx) {
|
||||
const char *list = ctx->config[LISTENING_PORTS];
|
||||
int on = 1, success = 1;
|
||||
#if defined(USE_IPV6)
|
||||
int off = 0;
|
||||
#endif
|
||||
struct vec vec;
|
||||
struct socket so;
|
||||
|
||||
@ -4491,6 +4494,10 @@ static int set_ports_option(struct mg_context *ctx) {
|
||||
// broadcast UDP sockets
|
||||
setsockopt(so.sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *) &on, sizeof(on)) != 0 ||
|
||||
#if defined(USE_IPV6)
|
||||
setsockopt(so.sock, IPPROTO_IPV6, IPV6_V6ONLY, (void *) &off,
|
||||
sizeof(off)) != 0 ||
|
||||
#endif
|
||||
bind(so.sock, &so.lsa.sa, sizeof(so.lsa)) != 0 ||
|
||||
listen(so.sock, SOMAXCONN) != 0) {
|
||||
cry(fc(ctx), "%s: cannot bind to %.*s: %s", __func__,
|
||||
|
Loading…
Reference in New Issue
Block a user