[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luasocket unstable IPV6_V6ONLY undefined in mingw
- From: Ross Bencina <rossb-lists@...>
- Date: Wed, 10 Apr 2013 05:50:29 +1000
Hi Paul,
> Thank you for the details; I've seen some of these resources, but for
> some reason I thought that this is a boolean value. In fact, Microsoft
> documentation seems to point to that (from the first resource you
> referenced):
>
> IPV6_V6ONLY yes yes DWORD (boolean)
Yes the *value* is a boolean (0 or non-zero)
IPV6_V6ONLY is the optname parameter for setsocketopt. Level must be
IPPROTO_IPV6
from
http://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx
:
int setsockopt(
_In_ SOCKET s,
_In_ int level,
_In_ int optname,
_In_ const char *optval,
_In_ int optlen
);
So:
DWORD value = 1; // or 0
setsocketopt( fd, IPPROTO_IPV6, IPV6_V6ONLY, &value, sizeof(DWORD) );
(Note that the fd *must* be created with AF_INET6 address familily.)
Sorry if I'm just telling you what you already know -- just trying to
clarify.
Thanks,
Ross
On 10/04/2013 2:24 AM, Paul K wrote:
Ross, William:
> Just to confirm, on Windows IPV6_V6ONLY is also 27. From Ws2ipdef.h
in the Windows SDK:
Thank you for the details; I've seen some of these resources, but for
some reason I thought that this is a boolean value. In fact, Microsoft
documentation seems to point to that (from the first resource you
referenced):
IPV6_V6ONLY yes yes DWORD (boolean)
The RFC seems to describe a boolean value as well. I'm not sure where
the number 27 comes from (I haven't checked the header files), but will
update to match the number (and it shouldn't make any difference if it's
a boolean value).
Paul.
On Tue, Apr 9, 2013 at 1:56 AM, Ross Bencina <rossb-lists@audiomulch.com
<mailto:rossb-lists@audiomulch.com>> wrote:
On 8/04/2013 7:02 AM, William Ahern wrote:
IPV6_V6ONLY is a socket option (setsockopt(3)) originating with the
Basic Socket Interface Extensions for IPv6 (RFC 3493).
http://tools.ietf.org/html/__rfc3493.html#page-22
<http://tools.ietf.org/html/rfc3493.html#page-22>
On BSDs the value of this option is `27'. Defining it to `1' is
probably
wrong. It may do the right thing with #ifdef guarded code, but
it may result
in weird things happening if the option is actually used.
Just to confirm, on Windows IPV6_V6ONLY is also 27. From Ws2ipdef.h
in the Windows SDK:
#define IPV6_V6ONLY 27 // Treat wildcard bind as
AF_INET6-only.
Note that Windows XP doesn't support dual stack sockets, and this
flag has the opposite default than on most Unices.
http://msdn.microsoft.com/en-__us/library/windows/desktop/__ms738574(v=vs.85).aspx
<http://msdn.microsoft.com/en-us/library/windows/desktop/ms738574(v=vs.85).aspx>
See also the note here:
http://msdn.microsoft.com/en-__us/library/windows/desktop/__ms737937(v=vs.85).aspx
<http://msdn.microsoft.com/en-us/library/windows/desktop/ms737937(v=vs.85).aspx>
http://stackoverflow.com/__questions/2693709/what-was-__the-motivation-for-adding-the-__ipv6-v6only-flag
<http://stackoverflow.com/questions/2693709/what-was-the-motivation-for-adding-the-ipv6-v6only-flag>
Not that I know more than that, but I was curious so looked it up.
Ross.