From owner-freebsd-emulation@freebsd.org Thu Mar 3 10:10:51 2016 Return-Path: Delivered-To: freebsd-emulation@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7618A9382A for ; Thu, 3 Mar 2016 10:10:51 +0000 (UTC) (envelope-from rb@gid.co.uk) Received: from mx0.gid.co.uk (mx0.gid.co.uk [194.32.164.250]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98920D74 for ; Thu, 3 Mar 2016 10:10:51 +0000 (UTC) (envelope-from rb@gid.co.uk) Received: from [194.32.164.30] ([194.32.164.30]) by mx0.gid.co.uk (8.14.2/8.14.2) with ESMTP id u23A9oIv029099; Thu, 3 Mar 2016 10:09:50 GMT (envelope-from rb@gid.co.uk) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: linux(64)-compat and ipv6 setsockopt From: Bob Bishop In-Reply-To: <7B0DAB1F-3C71-4E20-BC50-8EF4541B8D91@getsomewhere.net> Date: Thu, 3 Mar 2016 10:09:49 +0000 Cc: freebsd-emulation@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <25BBA52E-B402-496E-AD03-DB68468BD55D@gid.co.uk> References: <7B0DAB1F-3C71-4E20-BC50-8EF4541B8D91@getsomewhere.net> To: Joe Love X-Mailer: Apple Mail (2.3112) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2016 10:10:52 -0000 Hi, > On 2 Mar 2016, at 23:27, Joe Love wrote: >=20 > [=E2=80=A6]It seems that a piece of code related to setting a = particular socket option for IPv6 sockets fails under the linux compat = layer: >=20 > int ipv6only =3D 1; > setsockopt(this->fd6, IPPROTO_IPV6, IPV6_V6ONLY, &ipv6only, = sizeof(ipv6only)); >=20 > 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=E2=80=9D [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 =3D 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=E2=80= =99t 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@gid.co.uk