linux(64)-compat and ipv6 setsockopt

Bob Bishop rb at gid.co.uk
Thu Mar 3 10:10:52 UTC 2016


Hi,

> On 2 Mar 2016, at 23:27, Joe Love <joe at getsomewhere.net> wrote:
> 
> […]It seems that a piece of code related to setting a particular socket option for IPv6 sockets fails under the linux compat layer:
> 
> int ipv6only = 1;
> setsockopt(this->fd6, IPPROTO_IPV6, IPV6_V6ONLY, &ipv6only, sizeof(ipv6only));
> 
> Both Steamcmd and Factorio would spit out error messages like this (this one being from Factorio):
> 1.132 Error MultiplayerManager.cpp:108: MultiplayerManager failed: "Setsockopt failed: Protocol not available” [etc]

This is most likely related to the fact that linux has IP4-mapped addressing turned on by default, ie IPv4 connexions appear at the socket as IPv6 with v4 addresses mapped into the designated IPv6 address range (prefix ::ffff:0:0/96). FreeBSD has this turned off by default (sysctl net.inet6.ip6.v6only = 1), ie you have to set up separate sockets for v4 and v6.

The above socket option is trying to do the same thing, ie turn off mapping so that the socket is strictly IPv6 only, and either (a) isn’t implemented in the linuxulator, or (b) fails because mapping is already turned off.

Running on FreeBSD it may be safe to comment out the setsockopt(). I have never tried the alternative of setting sysctl net.inet6.ip6.v6only to 0 because that could break almost anything.

--
Bob Bishop
rb at gid.co.uk






More information about the freebsd-emulation mailing list