diff --git a/configure.ac b/configure.ac index 92b295ac4da2d4869c71c4140092ef755dcad11d..62712d0d35bbf6311c6ac3747878ba72eab1cc96 100644 --- a/configure.ac +++ b/configure.ac @@ -826,10 +826,10 @@ if test "$ipv6" = yes; then #include <netinet/in.h>] , struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes) if test "$have_sin6_scope_id" = yes; then - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member]) + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member]) else - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) fi fi diff --git a/lib/Makefile.netware b/lib/Makefile.netware index 546086796d78e3818917ebabd61361be00b2eb98..658b97996312d92b34c9e59e03141a7a9fbdc3bf 100644 --- a/lib/Makefile.netware +++ b/lib/Makefile.netware @@ -454,7 +454,7 @@ ifdef ENABLE_IPV6 @echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@ @echo $(DL)#define HAVE_FREEADDRINFO 1$(DL) >> $@ @echo $(DL)#define HAVE_GETADDRINFO 1$(DL) >> $@ - @echo $(DL)#define HAVE_SIN6_SCOPE_ID 1$(DL) >> $@ + @echo $(DL)#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1$(DL) >> $@ endif endif @echo $(DL)#define USE_MANUAL 1$(DL) >> $@ diff --git a/lib/config-os400.h b/lib/config-os400.h index dccf8a869e4bc61b2a0fa721bb949652b3e0691d..efb0195518dceaf6e564b722273f191a854d21be 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -43,7 +43,7 @@ #define ENABLE_IPV6 /* Define if struct sockaddr_in6 has the sin6_scope_id member */ -#define HAVE_SIN6_SCOPE_ID 1 +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 /* Define this to 'int' if ssize_t is not an available typedefed type */ #undef ssize_t diff --git a/lib/config-riscos.h b/lib/config-riscos.h index 25097fb0bcfdb75b4df04232ff8b57ab7e189399..e525c6a60ff806ae9c1d92552d9585bbb3d74e7b 100644 --- a/lib/config-riscos.h +++ b/lib/config-riscos.h @@ -39,7 +39,7 @@ #undef ENABLE_IPV6 /* Define if struct sockaddr_in6 has the sin6_scope_id member */ -#define HAVE_SIN6_SCOPE_ID 1 +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 /* Define this to 'int' if ssize_t is not an available typedefed type */ #undef ssize_t diff --git a/lib/config-symbian.h b/lib/config-symbian.h index cc9b03cb956db0a141db3ac5f312fa5e216a4a66..5f8296addc16494358415ab6fcbfbdb0de6ea044 100644 --- a/lib/config-symbian.h +++ b/lib/config-symbian.h @@ -67,7 +67,7 @@ #define ENABLE_IPV6 1 /* Define if struct sockaddr_in6 has the sin6_scope_id member */ -#define HAVE_SIN6_SCOPE_ID 1 +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 /* Define to the type qualifier of arg 1 for getnameinfo. */ #define GETNAMEINFO_QUAL_ARG1 const diff --git a/lib/config-tpf.h b/lib/config-tpf.h index 8524cda190689c55f743bc4faf60f7cbcaa3701e..107158ca8d1de8a1fbd2758d010f51a5a26ceda8 100644 --- a/lib/config-tpf.h +++ b/lib/config-tpf.h @@ -63,7 +63,7 @@ /* #undef ENABLE_IPV6 */ /* Define if struct sockaddr_in6 has the sin6_scope_id member */ -/* #undef HAVE_SIN6_SCOPE_ID */ +/* #undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID */ /* Define to the type of arg 1 for getnameinfo. */ /* #undef GETNAMEINFO_TYPE_ARG1 */ diff --git a/lib/config-win32ce.h b/lib/config-win32ce.h index 65b00a10447f6fa75f3928eb6dc87cd7358a2484..69caa46669999a18bf860e6f410bc84c3cfa52ac 100644 --- a/lib/config-win32ce.h +++ b/lib/config-win32ce.h @@ -324,7 +324,7 @@ #define HAVE_STRUCT_TIMEVAL 1 /* Define this if struct sockaddr_in6 has the sin6_scope_id member */ -#define HAVE_SIN6_SCOPE_ID 1 +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 /* ---------------------------------------------------------------- */ /* COMPILER SPECIFIC */ diff --git a/lib/connect.c b/lib/connect.c index 569142d3efa6d0ee2be3d694112bea640525402e..47e8681c5603d9e4bf9fe4f37832c890b3ef980b 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -769,7 +769,7 @@ singleipconnect(struct connectdata *conn, /* no socket, no connection */ return CURL_SOCKET_BAD; -#ifdef ENABLE_IPV6 +#if defined(ENABLE_IPV6) && defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID) if (conn->scope && (addr.family == AF_INET6)) sa6->sin6_scope_id = conn->scope; #endif diff --git a/lib/if2ip.c b/lib/if2ip.c index 74cd5266ebcde0e53a3d37252ed4b1d50fe0bc28..0e74042d23a29e8209c3edc7d9c6e884ea1cd191 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -86,10 +86,12 @@ char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size) char scope[12]=""; #ifdef ENABLE_IPV6 if (af == AF_INET6) { - unsigned int scopeid; + unsigned int scopeid = 0; addr = &((struct sockaddr_in6 *)iface->ifa_addr)->sin6_addr; +#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID /* Include the scope of this interface as part of the address */ scopeid = ((struct sockaddr_in6 *)iface->ifa_addr)->sin6_scope_id; +#endif if (scopeid) snprintf(scope, sizeof(scope), "%%%u", scopeid); } diff --git a/src/Makefile.netware b/src/Makefile.netware index 6be299cf805bf3cf2603da6321decef6891cada6..1fd503a1f5f1d8299ac5b3fac3095c816edc0a09 100644 --- a/src/Makefile.netware +++ b/src/Makefile.netware @@ -442,7 +442,7 @@ ifdef ENABLE_IPV6 @echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@ @echo $(DL)#define HAVE_FREEADDRINFO 1$(DL) >> $@ @echo $(DL)#define HAVE_GETADDRINFO 1$(DL) >> $@ - @echo $(DL)#define HAVE_SIN6_SCOPE_ID 1$(DL) >> $@ + @echo $(DL)#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1$(DL) >> $@ endif endif @echo $(DL)#define USE_MANUAL 1$(DL) >> $@ diff --git a/src/config-riscos.h b/src/config-riscos.h index 0e6b3a19be7b703821f51075b9fb08b9b1003f3a..72ef674dc26f8576fcdb51b8d59dcf09ce88b6a9 100644 --- a/src/config-riscos.h +++ b/src/config-riscos.h @@ -42,7 +42,7 @@ #undef ENABLE_IPV6 /* Define if struct sockaddr_in6 has the sin6_scope_id member */ -#define HAVE_SIN6_SCOPE_ID 1 +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 /* Define this to 'int' if ssize_t is not an available typedefed type */ #undef ssize_t diff --git a/src/config-win32.h b/src/config-win32.h index 3b7dc58e8a9b2c9aeee75dc53657ab0466534296..dfca7b2733744e3fdf036f1ffc87317b321e049d 100644 --- a/src/config-win32.h +++ b/src/config-win32.h @@ -201,7 +201,7 @@ #define HAVE_STRUCT_TIMEVAL 1 /* Define this if struct sockaddr_in6 has the sin6_scope_id member */ -#define HAVE_SIN6_SCOPE_ID 1 +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 /* ---------------------------------------------------------------- */ /* Watt-32 tcp/ip SPECIFIC */