luasocket unstable IPV6_V6ONLY undefined in mingw

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

luasocket unstable IPV6_V6ONLY undefined in mingw

Victor Bombi
Hello,

I am trying to compile luasocket-unstable for lua5.2 with mingw but
IPV6_V6ONLY is undefined.
It seems that a definition was added by may be in other branch

Best
Victor Bombi

Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

Matthew Wild
On 7 April 2013 19:51, Victor Bombi <[hidden email]> wrote:
> Hello,
>
> I am trying to compile luasocket-unstable for lua5.2 with mingw but
> IPV6_V6ONLY is undefined.
> It seems that a definition was added by may be in other branch
>
> Best
> Victor Bombi
>

See this issue: https://github.com/diegonehab/luasocket/issues/5

Regards,
Matthew

Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

Victor Bombi
I saw it and added
#ifndef IPV6_V6ONLY
#define IPV6_V6ONLY 27
#endif
to tcp.c options.c and udp.c
but in the linking

CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x9c): undefined
reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x156): undefined
reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x19a): undefined
reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x25e): undefined
reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x2e2): undefined
reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x36e): undefined
reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x3e2): undefined
reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x4db): undefined
reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x590): undefined
reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x91d): undefined
reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x9c1): undefined
reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xaf5): undefined
reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xb99): undefined
reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xd5b): undefined
reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xd79): undefined
reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xe79): undefined
reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xe97): undefined
reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xf34): undefined
reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(tcp.c.obj):tcp.c:(.text+0x201): undefined
reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(tcp.c.obj):tcp.c:(.text+0x223): undefined
reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(tcp.c.obj):tcp.c:(.text+0x308): undefined
reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0x990): undefined
reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0xa08): undefined
reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0xb5d): undefined
reference to `_inet_pton'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0xc39): undefined
reference to `_inet_pton'

I cant find how to solve it
Best
victor
>


Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

Paul K
Hi Victor,

> but in the linking
> CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x9c): undefined reference to `_getaddrinfo'

I remember running into some similar issues (although I didn't use CMake); since I wanted to compile with mingw for Lua52, I patched luasocket to add inet_pton and inet_ntop support on Windows. I just pushed it to github as it was sitting locally for couple of months: https://github.com/pkulchenko/luasocket/tree/lua52-mingw

I also added build-mingw.sh script that compiles both luasocket DLLs. Just make Lua52 available or tweak the path in the script to point to your Lua52 sources and see if this works for you.

Not sure why IPV6_V6ONLY should be 27, I compile it with the following parameters:

-Wl,-s -O2 -shared -D LUA_COMPAT_MODULE -D IPV6_V6ONLY=1 -D WINVER=0x0501 -s -I src -I $LUA -L $LUA

Paul.


On Sun, Apr 7, 2013 at 12:11 PM, Victor Bombi <[hidden email]> wrote:
I saw it and added
#ifndef IPV6_V6ONLY
#define IPV6_V6ONLY 27
#endif
to tcp.c options.c and udp.c
but in the linking

CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x9c): undefined reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x156): undefined reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x19a): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x25e): undefined reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x2e2): undefined reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x36e): undefined reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x3e2): undefined reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x4db): undefined reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x590): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x91d): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x9c1): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xaf5): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xb99): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xd5b): undefined reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xd79): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xe79): undefined reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xe97): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xf34): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(tcp.c.obj):tcp.c:(.text+0x201): undefined reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(tcp.c.obj):tcp.c:(.text+0x223): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(tcp.c.obj):tcp.c:(.text+0x308): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0x990): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0xa08): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0xb5d): undefined reference to `_inet_pton'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0xc39): undefined reference to `_inet_pton'

I cant find how to solve it
Best
victor




Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

William Ahern
On Sun, Apr 07, 2013 at 12:49:23PM -0700, Paul K wrote:

> Hi Victor,
>
> > but in the linking
> > CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x9c):
> undefined reference to `_getaddrinfo'
>
> I remember running into some similar issues (although I didn't use CMake);
> since I wanted to compile with mingw for Lua52, I patched luasocket to add
> inet_pton and inet_ntop support on Windows. I just pushed it to github as
> it was sitting locally for couple of months:
> https://github.com/pkulchenko/luasocket/tree/lua52-mingw
>
> I also added build-mingw.sh script that compiles both luasocket DLLs. Just
> make Lua52 available or tweak the path in the script to point to your Lua52
> sources and see if this works for you.
>
> Not sure why IPV6_V6ONLY should be 27, I compile it with the following
> parameters:
>
> -Wl,-s -O2 -shared -D LUA_COMPAT_MODULE -D IPV6_V6ONLY=1 -D WINVER=0x0501
> -s -I src -I $LUA -L $LUA

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

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.


Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

Victor Bombi
In reply to this post by Paul K
Paul,
 
Thank you. I managed to build with my CMAKE file after definning IPV6_V6ONLY=27 -D WINVER=0x0501 with the branch you added.
It would be good to incorporate it to the main branch or perhaps leave IPV6 support as a configurable option in the main branch
 
victor
----- Original Message -----
Sent: Sunday, April 07, 2013 9:49 PM
Subject: Re: luasocket unstable IPV6_V6ONLY undefined in mingw

Hi Victor,

> but in the linking
> CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x9c): undefined reference to `_getaddrinfo'

I remember running into some similar issues (although I didn't use CMake); since I wanted to compile with mingw for Lua52, I patched luasocket to add inet_pton and inet_ntop support on Windows. I just pushed it to github as it was sitting locally for couple of months: https://github.com/pkulchenko/luasocket/tree/lua52-mingw

I also added build-mingw.sh script that compiles both luasocket DLLs. Just make Lua52 available or tweak the path in the script to point to your Lua52 sources and see if this works for you.

Not sure why IPV6_V6ONLY should be 27, I compile it with the following parameters:

-Wl,-s -O2 -shared -D LUA_COMPAT_MODULE -D IPV6_V6ONLY=1 -D WINVER=0x0501 -s -I src -I $LUA -L $LUA

Paul.


On Sun, Apr 7, 2013 at 12:11 PM, Victor Bombi <[hidden email]> wrote:
I saw it and added
#ifndef IPV6_V6ONLY
#define IPV6_V6ONLY 27
#endif
to tcp.c options.c and udp.c
but in the linking

CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x9c): undefined reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x156): undefined reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x19a): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x25e): undefined reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x2e2): undefined reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x36e): undefined reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x3e2): undefined reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x4db): undefined reference to `_getnameinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x590): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x91d): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0x9c1): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xaf5): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xb99): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xd5b): undefined reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xd79): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xe79): undefined reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xe97): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(inet.c.obj):inet.c:(.text+0xf34): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(tcp.c.obj):tcp.c:(.text+0x201): undefined reference to `_getaddrinfo'
CMakeFiles\socket.dir/objects.a(tcp.c.obj):tcp.c:(.text+0x223): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(tcp.c.obj):tcp.c:(.text+0x308): undefined reference to `_freeaddrinfo'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0x990): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0xa08): undefined reference to `_inet_ntop'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0xb5d): undefined reference to `_inet_pton'
CMakeFiles\socket.dir/objects.a(udp.c.obj):udp.c:(.text+0xc39): undefined reference to `_inet_pton'

I cant find how to solve it
Best
victor




Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

steve donovan
In reply to this post by Paul K
On Sun, Apr 7, 2013 at 9:49 PM, Paul K <[hidden email]> wrote:
Thanks, Paul. That was a useful piece of the puzzle, since new LuaSocket is building everywhere else fine (except for failing the reconnect-when-not-reusing-address test consistently).  However, the result (also 5.2, XP SP3) seems broken; it cannot do a simple localhost server/client connection reliably, but can do an explicit ip address.

Since XP still has another year before it is dustbinned, and assuming that LuaSocket is actually released this year, we do have to sort this out.


Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

Ross Bencina
In reply to this post by William Ahern
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
>
> 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

See also the note here:
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

Not that I know more than that, but I was curious so looked it up.

Ross.

Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

steve donovan
In reply to this post by steve donovan
On Tue, Apr 9, 2013 at 10:29 AM, steve donovan <[hidden email]> wrote:
Since XP still has another year before it is dustbinned, and assuming that LuaSocket is actually released this year, we do have to sort this out.

OK, sorted by the old expedient of a special case in luasocket.lua - adding this to the first lines of bind()
    --if host == "*" then host = "0.0.0.0" end
    if host == "localhost" or host == "*" then
        sock, err = socket.tcp()
        if not sock then return nil, err end
        sock:setoption("reuseaddr",true)
        res, err = sock:bind(host,port)
        if not res then return nil, err end
        res, err = sock:listen(backlog)
        if not res then sock:close(); return nil,err end
        return sock
    end

That is, use old IPV4 logic for local servers, and then the tests pass. Now to work out when this special case kicks in...



 

Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

Paul K
In reply to this post by Ross Bencina
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_V6ONLYyesyesDWORD (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 <[hidden email]> 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

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

See also the note here:
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

Not that I know more than that, but I was curious so looked it up.

Ross.


Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

Paul K
In reply to this post by steve donovan
Steve:

> Thanks, Paul. That was a useful piece of the puzzle, since new LuaSocket is building
> everywhere else fine (except for failing the reconnect-when-not-reusing-address test
> consistently).  However, the result (also 5.2, XP SP3) seems broken; it cannot do a
> simple localhost server/client connection reliably, but can do an explicit ip address.

I noticed one strange thing when I was testing Lua52/luasocket with mobdebug: I couldn't get socket.connect to work between two Lua52/luasocket nodes running locally. I could connect from Lua51/old-luasocket to Lua52/luasocket or vice versa, but not between two Lua52/luasocket instances. socket.connect4 worked correctly though (this is the new method in "unstable" luasocket).

I tried to trace the code, but couldn't figure out what was causing the issue.

So, I ended up using "(socket.connect4 or socket.connect)(connect parameters.....)" as this works fine in all the combinations I've tested.

> Since XP still has another year before it is dustbinned, and assuming that LuaSocket is
> actually released this year, we do have to sort this out.

Most definitely. From your description it seems like it may be the same issue. It would be good to figure it out. I've been testing this on Windows Vista, but I do have an old XP I can test whatever solution you can come up with on.

I pushed IPV6_V6ONLY update to the same branch: https://github.com/pkulchenko/luasocket/tree/lua52-mingw (based on the discussion in this thread).

Paul.
Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

Ross Bencina
In reply to this post by Paul K
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 <[hidden email]
> <mailto:[hidden email]>> 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.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

Paul K
In reply to this post by Paul K
Hi Steve,

>> Thanks, Paul. That was a useful piece of the puzzle, since new LuaSocket is building
>> everywhere else fine (except for failing the reconnect-when-not-reusing-address test
>> consistently).  However, the result (also 5.2, XP SP3) seems broken; it cannot do a
>> simple localhost server/client connection reliably, but can do an explicit ip address.

> I noticed one strange thing when I was testing Lua52/luasocket with mobdebug: I couldn't
> get socket.connect to work between two Lua52/luasocket nodes running locally. I could
> connect from Lua51/old-luasocket to Lua52/luasocket or vice versa, but not between two
> Lua52/luasocket instances. socket.connect4 worked correctly though (this is the new
> method in "unstable" luasocket).

Have you had a chance to test this further?

Paul.

Reply | Threaded
Open this post in threaded view
|

Re: luasocket unstable IPV6_V6ONLY undefined in mingw

steve donovan
On Thu, Apr 11, 2013 at 7:12 AM, Paul K <[hidden email]> wrote:
Have you had a chance to test this further?

Absolutely - the workaround needed is in the latest luabuild commit:

https://github.com/stevedonovan/luabuild/commit/59e5bbc86060d727a456b50d3161ef20e6597ec1

This workaround (those extra defines needed and extra implementations) only applies to XP, at least with mingw. For Win7 mingw is fine without them, so I'll start by putting in a test for XP.  I'll also see how the Windows SDK handles this case on XP.

With this patch, passes all tests (except the reuseaddr one, but that applies to all platforms I've tested)

Not pretty, but we're coping with an old OS with patched-on IPV6 here ;)