Skip to contentSkip to conversation

socket.c issues when building snapshots on windows...

Openvpn-devel Gert Doering 3 participants 4 messages Apr 26, 2014 – Oct 3, 2014

lore
Share & tools
lore
#0 lore raw

Hiya,

with some arm-twisting, I managed to convince build-snapshot to actually do that (it would prefer to do a git clone, autoconf, tarball, copy tarball, ignore the tarball, fetch 2.3.3 source, extract 2.3.3 and build that, thus never showing compilation errors...), and here we go...

socket.c: In function 'socket_bind':
socket.c:1124:40: error: 'IPV6_V6ONLY' undeclared (first use in this function)
socket.c:1124:40: note: each undeclared identifier is reported only once for each function it appears in
socket.c:1124:7: warning: passing argument 4 of 'setsockopt' from incompatible pointer type [enabled by default] /usr/lib/gcc/i686-w64-mingw32/4.6/../../../../i686-w64-mingw32/include/winsock2.h:1016:34: note: expected 'const char *' but argument is of type 'int *' socket.c: In function 'openvpn_connect':
socket.c:1218:32: error: 'const struct sockaddr' has no member named 'addr'
socket.c:1218:62: error: 'const struct sockaddr' has no member named 'addr'
socket.c: In function 'socket_recv_queue':
socket.c:3135:45: error: 'struct link_socket_addr' has no member named 'local'

... I'm posting this here so whoever has time can take a stab at it (I won't be able to work on this for the next couple of days, will focus on 2.3.4 release items).

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#1 lore raw
Quoted 18 lines · Gert Doering

Hiya,

with some arm-twisting, I managed to convince build-snapshot to actually do that (it would prefer to do a git clone, autoconf, tarball, copy tarball, ignore the tarball, fetch 2.3.3 source, extract 2.3.3 and build that, thus never showing compilation errors...), and here we go...

socket.c: In function 'socket_bind':
socket.c:1124:40: error: 'IPV6_V6ONLY' undeclared (first use in this function)
socket.c:1124:40: note: each undeclared identifier is reported only once for each function it appears in
socket.c:1124:7: warning: passing argument 4 of 'setsockopt' from incompatible pointer type [enabled by default] /usr/lib/gcc/i686-w64-mingw32/4.6/../../../../i686-w64-mingw32/include/winsock2.h:1016:34: note: expected 'const char *' but argument is of type 'int *' socket.c: In function 'openvpn_connect':
socket.c:1218:32: error: 'const struct sockaddr' has no member named 'addr'
socket.c:1218:62: error: 'const struct sockaddr' has no member named 'addr'
socket.c: In function 'socket_recv_queue':
socket.c:3135:45: error: 'struct link_socket_addr' has no member named 'local'

Quoted 5 lines

... I'm posting this here so whoever has time can take a stab at it (I won't be able to work on this for the next couple of days, will focus on 2.3.4 release items).

The option seems to be supported since Windows Vista. I think we should add something like this to the windows ifdefs (copied from http://marc.info/?l=apr-dev&m=121392734329754&w=2):

+/* Ugly solution - only the Windows 2008 SDK or later have this symbol defined.
+ * The symbol doesn't guarantee that the socket option is supported on
+ * the runtime version of Windows, so we define it here (for build systems)
+ * and always check at runtime if it is supported.
+ */
+#ifndef IPV6_V6ONLY
+#define IPV6_V6ONLY 27
+#endif

#2 lore raw

Hi,

Quoted 11 lines · Arne Schwabe

The option seems to be supported since Windows Vista. I think we should add something like this to the windows ifdefs (copied from
http://marc.info/?l=apr-dev&m=121392734329754&w=2):

+/* Ugly solution - only the Windows 2008 SDK or later have this symbol defined.
+ * The symbol doesn't guarantee that the socket option is supported on
+ * the runtime version of Windows, so we define it here (for build systems)
+ * and always check at runtime if it is supported.
+ */

Review

Quoted 3 lines
(quoted diff) +3 -0
+#ifndef IPV6_V6ONLY
+#define IPV6_V6ONLY 27
+#endif

That's an interesting twist. I wonder why MinGW does not have it (or maybe my MinGW installation is too old).

And then we'll see whether it will blow up at run-time on XP or not - having setsockopt() return an error is something our code will handle ("report, go on"), but on Windows, I wouldn't be surprised to see "it fails with OS error" translate to "crash"...

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#3 lore raw
In reply to Arne Schwabe

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 5 lines · Gert Doering
Quoted 4 lines

Hiya,

with some arm-twisting, I managed to convince build-snapshot to actually do that (it would prefer to do a git clone, autoconf, tarball, copy

tarball,

Quoted 1 line
Quoted 1 line

ignore the tarball, fetch 2.3.3 source, extract 2.3.3 and build that,

thus

Quoted 4 lines
Quoted 4 lines

never showing compilation errors...), and here we go...

socket.c: In function 'socket_bind':
socket.c:1124:40: error: 'IPV6_V6ONLY' undeclared (first use in this

function)

Quoted 1 line
Quoted 1 line

socket.c:1124:40: note: each undeclared identifier is reported only

once for each function it appears in

Quoted 1 line
Quoted 1 line

socket.c:1124:7: warning: passing argument 4 of 'setsockopt' from

incompatible pointer type [enabled by default]

Quoted 1 line
Quoted 1 line

/usr/lib/gcc/i686-w64-mingw32/4.6/../../../../i686-w64-mingw32/include/winsock2.h:1016:34:
note: expected 'const char *' but argument is of type 'int *'

Quoted 2 lines
Quoted 2 lines

socket.c: In function 'openvpn_connect':
socket.c:1218:32: error: 'const struct sockaddr' has no member named

'addr'

Quoted 1 line
Quoted 1 line

socket.c:1218:62: error: 'const struct sockaddr' has no member named

'addr'

Quoted 2 lines
Quoted 2 lines

socket.c: In function 'socket_recv_queue':
socket.c:3135:45: error: 'struct link_socket_addr' has no member

named 'local'

Quoted 19 lines
Quoted 6 lines

... I'm posting this here so whoever has time can take a stab at it (I won't be able to work on this for the next couple of days, will focus on 2.3.4 release items).

The option seems to be supported since Windows Vista. I think we should add something like this to the windows ifdefs (copied from
http://marc.info/?l=apr-dev&m=121392734329754&w=2):

+/* Ugly solution - only the Windows 2008 SDK or later have this symbol defined.
+ * The symbol doesn't guarantee that the socket option is supported on
+ * the runtime version of Windows, so we define it here (for build systems)
+ * and always check at runtime if it is supported.
+ */

Review

Quoted 3 lines
(quoted diff) +3 -0
+#ifndef IPV6_V6ONLY
+#define IPV6_V6ONLY 27
+#endif

I'll revive this old thread because the problem seems to persist. It seems we have two issues here. First there's this:

"socket.c:1124:40: error: 'IPV6_V6ONLY' undeclared (first use in this function)"

The above error can be fixed by using mingw-w64 that is recent enough - version 2.23 seems to work fine.

However, that will not fix this error:

socket.c: In function ‘socket_bind’:
socket.c:1120:7: warning: passing argument 4 of ‘setsockopt’ from incompatible pointer type [enabled by default]
if (setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &v6only,
sizeof(v6only)))

       ^
In file included from ../../src/compat/compat.h:29:0,
                 from syshead.h:28,
                 from socket.c:31:
/usr/share/mingw-w64/include/winsock2.h:999:34: note: expected ‘const
char *’ but argument is of type ‘int *’
   WINSOCK_API_LINKAGE int WSAAPI setsockopt(SOCKET s,int level,int
optname,const char *optval,int optlen);
                                  ^
socket.c: In function ‘socket_recv_queue’:
socket.c:3098:45: error: ‘struct link_socket_addr’ has no member named
‘local’
    int addrlen = af_addr_size(sock->info.lsa->local.addr.sa.sa_family);
                                             ^

make[4]: *** [socket.o] Error 1

- ---

The above can be reproduced using latest Git sources and Ubuntu 14.04. Any ideas how to fix this?

Samuli

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlQuh70ACgkQwp2X7RmNIqPqOgCfS9dM5gG2ONr8qZEngqTMOjGf V2UAoKq/E0K46tNFjXkuFt6uxCZWw5EO
=4XgJ
-----END PGP SIGNATURE-----