if2ip: make Curl_ipv6_scope a blank macro when IPv6-disabled

Closes #8439
This commit is contained in:
Daniel Stenberg 2022-02-11 12:43:00 +01:00
parent 186340c9cd
commit 7e65d91071
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -60,12 +60,10 @@
/* ------------------------------------------------------------------ */
#ifdef ENABLE_IPV6
/* Return the scope of the given address. */
unsigned int Curl_ipv6_scope(const struct sockaddr *sa)
{
#ifndef ENABLE_IPV6
(void) sa;
#else
if(sa->sa_family == AF_INET6) {
const struct sockaddr_in6 * sa6 = (const struct sockaddr_in6 *)(void *) sa;
const unsigned char *b = sa6->sin6_addr.s6_addr;
@ -88,11 +86,9 @@ unsigned int Curl_ipv6_scope(const struct sockaddr *sa)
break;
}
}
#endif
return IPV6_SCOPE_GLOBAL;
}
#endif
#if defined(HAVE_GETIFADDRS)

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -30,7 +30,11 @@
#define IPV6_SCOPE_UNIQUELOCAL 3 /* Unique local */
#define IPV6_SCOPE_NODELOCAL 4 /* Loopback. */
#ifdef ENABLE_IPV6
unsigned int Curl_ipv6_scope(const struct sockaddr *sa);
#else
#define Curl_ipv6_scope(x) 0
#endif
typedef enum {
IF2IP_NOT_FOUND = 0, /* Interface not found */