winsock: Add check for sin6_scope_id.

This commit is contained in:
Vitaly Lipatov 2006-02-20 15:33:09 +03:00 committed by Alexandre Julliard
parent 334e191175
commit 40a6a74ac8
4 changed files with 145 additions and 26 deletions

121
configure vendored
View File

@ -18550,6 +18550,127 @@ _ACEOF
fi fi
echo "$as_me:$LINENO: checking for struct sockaddr_in6.sin6_scope_id" >&5
echo $ECHO_N "checking for struct sockaddr_in6.sin6_scope_id... $ECHO_C" >&6
if test "${ac_cv_member_struct_sockaddr_in6_sin6_scope_id+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
int
main ()
{
static struct sockaddr_in6 ac_aggr;
if (ac_aggr.sin6_scope_id)
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_member_struct_sockaddr_in6_sin6_scope_id=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
int
main ()
{
static struct sockaddr_in6 ac_aggr;
if (sizeof ac_aggr.sin6_scope_id)
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_member_struct_sockaddr_in6_sin6_scope_id=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_member_struct_sockaddr_in6_sin6_scope_id=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_in6_sin6_scope_id" >&5
echo "${ECHO_T}$ac_cv_member_struct_sockaddr_in6_sin6_scope_id" >&6
if test $ac_cv_member_struct_sockaddr_in6_sin6_scope_id = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for timezone variable" >&5 echo "$as_me:$LINENO: checking for timezone variable" >&5
echo $ECHO_N "checking for timezone variable... $ECHO_C" >&6 echo $ECHO_N "checking for timezone variable... $ECHO_C" >&6
if test "${ac_cv_have_timezone+set}" = set; then if test "${ac_cv_have_timezone+set}" = set; then

View File

@ -1367,6 +1367,15 @@ AC_CHECK_MEMBERS([struct option.name],,,
dnl Check for stat.st_blocks dnl Check for stat.st_blocks
AC_CHECK_MEMBERS([struct stat.st_blocks]) AC_CHECK_MEMBERS([struct stat.st_blocks])
dnl Check for sin6_scope_id
AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif])
dnl Check for the external timezone variables timezone and daylight dnl Check for the external timezone variables timezone and daylight
AC_CACHE_CHECK([for timezone variable], ac_cv_have_timezone, AC_CACHE_CHECK([for timezone variable], ac_cv_have_timezone,
AC_TRY_LINK([#include <time.h>],[timezone;], AC_TRY_LINK([#include <time.h>],[timezone;],

View File

@ -930,28 +930,20 @@ static struct sockaddr* ws_sockaddr_ws2u(const struct WS_sockaddr* wsaddr, int w
case WS_AF_INET6: { case WS_AF_INET6: {
struct sockaddr_in6* uin6; struct sockaddr_in6* uin6;
const struct WS_sockaddr_in6* win6 = (struct WS_sockaddr_in6*)wsaddr; const struct WS_sockaddr_in6* win6 = (struct WS_sockaddr_in6*)wsaddr;
const struct WS_sockaddr_in6_old* win6old = (struct WS_sockaddr_in6_old*)wsaddr;
/* Note: Windows has 2 versions of the sockaddr_in6 struct, one with /* Note: Windows has 2 versions of the sockaddr_in6 struct, one with
* scope_id, one without. Check: * scope_id, one without. Check:
* http://msdn.microsoft.com/library/en-us/winsock/winsock/sockaddr_2.asp * http://msdn.microsoft.com/library/en-us/winsock/winsock/sockaddr_2.asp
*/ */
if (wsaddrlen==sizeof(struct WS_sockaddr_in6_old)) { if (wsaddrlen >= sizeof(struct WS_sockaddr_in6_old)) {
*uaddrlen=sizeof(struct sockaddr_in6);
uin6=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *uaddrlen);
uin6->sin6_family = AF_INET6;
uin6->sin6_port = win6old->sin6_port;
uin6->sin6_flowinfo = win6old->sin6_flowinfo;
memcpy(&uin6->sin6_addr,&win6old->sin6_addr,16); /* 16 bytes = 128 address bits */
return (struct sockaddr*)uin6;
}
if (wsaddrlen>=sizeof(struct WS_sockaddr_in6)) {
*uaddrlen=sizeof(struct sockaddr_in6); *uaddrlen=sizeof(struct sockaddr_in6);
uin6=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *uaddrlen); uin6=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *uaddrlen);
uin6->sin6_family = AF_INET6; uin6->sin6_family = AF_INET6;
uin6->sin6_port = win6->sin6_port; uin6->sin6_port = win6->sin6_port;
uin6->sin6_flowinfo = win6->sin6_flowinfo; uin6->sin6_flowinfo = win6->sin6_flowinfo;
uin6->sin6_scope_id = win6->sin6_scope_id; #ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
if (wsaddrlen >= sizeof(struct WS_sockaddr_in6)) uin6->sin6_scope_id = win6->sin6_scope_id;
#endif
memcpy(&uin6->sin6_addr,&win6->sin6_addr,16); /* 16 bytes = 128 address bits */ memcpy(&uin6->sin6_addr,&win6->sin6_addr,16); /* 16 bytes = 128 address bits */
return (struct sockaddr*)uin6; return (struct sockaddr*)uin6;
} }
@ -1066,28 +1058,22 @@ static int ws_sockaddr_u2ws(const struct sockaddr* uaddr, int uaddrlen, struct W
#endif #endif
case AF_INET6: { case AF_INET6: {
const struct sockaddr_in6* uin6 = (struct sockaddr_in6*)uaddr; const struct sockaddr_in6* uin6 = (struct sockaddr_in6*)uaddr;
struct WS_sockaddr_in6* win6 = (struct WS_sockaddr_in6*)wsaddr;
struct WS_sockaddr_in6_old* win6old = (struct WS_sockaddr_in6_old*)wsaddr; struct WS_sockaddr_in6_old* win6old = (struct WS_sockaddr_in6_old*)wsaddr;
if (*wsaddrlen < sizeof(struct WS_sockaddr_in6_old)) if (*wsaddrlen < sizeof(struct WS_sockaddr_in6_old))
return -1; return -1;
if (*wsaddrlen == sizeof(struct WS_sockaddr_in6_old)) {
win6old->sin6_family = WS_AF_INET6; win6old->sin6_family = WS_AF_INET6;
win6old->sin6_port = uin6->sin6_port; win6old->sin6_port = uin6->sin6_port;
win6old->sin6_flowinfo = uin6->sin6_flowinfo; win6old->sin6_flowinfo = uin6->sin6_flowinfo;
memcpy(&win6old->sin6_addr,&uin6->sin6_addr,16); /* 16 bytes = 128 address bits */ memcpy(&win6old->sin6_addr,&uin6->sin6_addr,16); /* 16 bytes = 128 address bits */
*wsaddrlen = sizeof(struct WS_sockaddr_in6_old); *wsaddrlen = sizeof(struct WS_sockaddr_in6_old);
return 0; #ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
}
if (*wsaddrlen >= sizeof(struct WS_sockaddr_in6)) { if (*wsaddrlen >= sizeof(struct WS_sockaddr_in6)) {
win6->sin6_family = WS_AF_INET6; struct WS_sockaddr_in6* win6 = (struct WS_sockaddr_in6*)wsaddr;
win6->sin6_port = uin6->sin6_port;
win6->sin6_flowinfo = uin6->sin6_flowinfo;
memcpy(&win6->sin6_addr,&uin6->sin6_addr,16); /* 16 bytes = 128 address bits */
win6->sin6_scope_id = uin6->sin6_scope_id; win6->sin6_scope_id = uin6->sin6_scope_id;
*wsaddrlen = sizeof(struct WS_sockaddr_in6); *wsaddrlen = sizeof(struct WS_sockaddr_in6);
return 0;
} }
#endif
return 0; return 0;
} }
case AF_INET: { case AF_INET: {

View File

@ -629,6 +629,9 @@
/* Define to 1 if `name' is member of `struct option'. */ /* Define to 1 if `name' is member of `struct option'. */
#undef HAVE_STRUCT_OPTION_NAME #undef HAVE_STRUCT_OPTION_NAME
/* Define to 1 if `sin6_scope_id' is member of `struct sockaddr_in6'. */
#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
/* Define to 1 if `sa_len' is member of `struct sockaddr'. */ /* Define to 1 if `sa_len' is member of `struct sockaddr'. */
#undef HAVE_STRUCT_SOCKADDR_SA_LEN #undef HAVE_STRUCT_SOCKADDR_SA_LEN