|
@@ -13809,6 +13809,7 @@ set_ports_option(struct mg_context *phys_ctx)
|
|
|
#endif
|
|
|
|
|
|
if (ip_version > 4) {
|
|
|
+/* Could be 6 for IPv6 onlyor 10 (4+6) for IPv4+IPv6 */
|
|
|
#if defined(USE_IPV6)
|
|
|
if (ip_version > 6) {
|
|
|
if (so.lsa.sa.sa_family == AF_INET6
|
|
@@ -13821,7 +13822,21 @@ set_ports_option(struct mg_context *phys_ctx)
|
|
|
/* Set IPv6 only option, but don't abort on errors. */
|
|
|
mg_cry_internal(
|
|
|
fc(phys_ctx),
|
|
|
- "cannot set socket option IPV6_V6ONLY (entry %i)",
|
|
|
+ "cannot set socket option IPV6_V6ONLY=off (entry %i)",
|
|
|
+ portsTotal);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (so.lsa.sa.sa_family == AF_INET6
|
|
|
+ && setsockopt(so.sock,
|
|
|
+ IPPROTO_IPV6,
|
|
|
+ IPV6_V6ONLY,
|
|
|
+ (void *)&on,
|
|
|
+ sizeof(on)) != 0) {
|
|
|
+
|
|
|
+ /* Set IPv6 only option, but don't abort on errors. */
|
|
|
+ mg_cry_internal(
|
|
|
+ fc(phys_ctx),
|
|
|
+ "cannot set socket option IPV6_V6ONLY=on (entry %i)",
|
|
|
portsTotal);
|
|
|
}
|
|
|
}
|