From c74d13b6ebc14d5673d1bcae5d0574b2dcbf7519 Mon Sep 17 00:00:00 2001 From: Sebastien Vincent Date: Mon, 23 Mar 2020 20:36:29 +0100 Subject: [PATCH] Fixes webserver binding socket in IPv6 (#215). --- libs/mongooseplus/SConscript | 2 +- libs/mongooseplus/src/mongoose.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/mongooseplus/SConscript b/libs/mongooseplus/SConscript index a9954add..5ccbe08b 100644 --- a/libs/mongooseplus/SConscript +++ b/libs/mongooseplus/SConscript @@ -6,7 +6,7 @@ env = env.Clone() local_include_dir = Dir(os.path.join('include', name)) env.Prepend(CPPPATH=[local_include_dir]) -env.Append(CCFLAGS=['-DMONGOOSE_NO_FILESYSTEM', '-DNS_ENABLE_SSL']) +env.Append(CCFLAGS=['-DMONGOOSE_NO_FILESYSTEM', '-DNS_ENABLE_SSL', '-DNS_ENABLE_IPV6']) includes = env.RInstall(dirs['root'], local_include_dir, ['*.hpp']) library = env.StaticLibrary(target=os.path.join(str(dirs['lib']), name), source=env.RGlob('src', ['*.cpp', '*.c'])) diff --git a/libs/mongooseplus/src/mongoose.c b/libs/mongooseplus/src/mongoose.c index c8010a90..73d75c0d 100644 --- a/libs/mongooseplus/src/mongoose.c +++ b/libs/mongooseplus/src/mongoose.c @@ -513,7 +513,7 @@ static sock_t ns_open_listening_socket(union socket_address *sa) { if ((sock = socket(sa->sa.sa_family, SOCK_STREAM, 6)) != INVALID_SOCKET && !setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &on, sizeof(on)) && !bind(sock, &sa->sa, sa->sa.sa_family == AF_INET ? - sizeof(sa->sin) : sizeof(sa->sa)) && + sizeof(sa->sin) : sizeof(struct sockaddr_in6)) && !listen(sock, SOMAXCONN)) { ns_set_non_blocking_mode(sock); // In case port was set to 0, get the real port number