add warning about IPV6_V6ONLY=false not working on FreeBSD

This commit is contained in:
Lion Kortlepel 2024-07-16 17:25:29 +02:00
parent a0040d8c57
commit 0d848fda7c

View File

@ -174,6 +174,10 @@ void TNetwork::TCPServerMain() {
if (ec) { if (ec) {
beammp_warnf("Failed to unset IP_V6ONLY on TCP, only IPv6 will work: {}", ec.message()); beammp_warnf("Failed to unset IP_V6ONLY on TCP, only IPv6 will work: {}", ec.message());
} }
#if defined(BEAMMP_FREEBSD)
beammp_warnf("WARNING: On FreeBSD, for IPv4 to work, you must run `sysctl net.inet6.ip6.v6only=0`!");
beammp_debugf("This is due to an annoying detail in the *BSDs: In the name of security, unsetting the IPV6_V6ONLY option does not work by default (but does not fail???), as it allows IPv4 mapped IPv6 like ::ffff:127.0.0.1, which they deem a security issue.");
#endif
socket_base::linger LingerOpt {}; socket_base::linger LingerOpt {};
LingerOpt.enabled(false); LingerOpt.enabled(false);
Listener.set_option(LingerOpt, ec); Listener.set_option(LingerOpt, ec);