mirror of
https://github.com/moparisthebest/curl
synced 2024-11-16 06:25:03 -05:00
parent
6dc1780ea5
commit
db9776ea00
34
lib/if2ip.c
34
lib/if2ip.c
@ -96,24 +96,6 @@ unsigned int Curl_ipv6_scope(const struct sockaddr *sa)
|
|||||||
|
|
||||||
#if defined(HAVE_GETIFADDRS)
|
#if defined(HAVE_GETIFADDRS)
|
||||||
|
|
||||||
bool Curl_if_is_interface_name(const char *interf)
|
|
||||||
{
|
|
||||||
bool result = FALSE;
|
|
||||||
|
|
||||||
struct ifaddrs *iface, *head;
|
|
||||||
|
|
||||||
if(getifaddrs(&head) >= 0) {
|
|
||||||
for(iface = head; iface != NULL; iface = iface->ifa_next) {
|
|
||||||
if(strcasecompare(iface->ifa_name, interf)) {
|
|
||||||
result = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
freeifaddrs(head);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
||||||
unsigned int remote_scope_id, const char *interf,
|
unsigned int remote_scope_id, const char *interf,
|
||||||
char *buf, int buf_size)
|
char *buf, int buf_size)
|
||||||
@ -196,15 +178,6 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
|||||||
|
|
||||||
#elif defined(HAVE_IOCTL_SIOCGIFADDR)
|
#elif defined(HAVE_IOCTL_SIOCGIFADDR)
|
||||||
|
|
||||||
bool Curl_if_is_interface_name(const char *interf)
|
|
||||||
{
|
|
||||||
/* This is here just to support the old interfaces */
|
|
||||||
char buf[256];
|
|
||||||
|
|
||||||
return (Curl_if2ip(AF_INET, 0 /* unused */, 0, interf, buf, sizeof(buf)) ==
|
|
||||||
IF2IP_NOT_FOUND) ? FALSE : TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
||||||
unsigned int remote_scope_id, const char *interf,
|
unsigned int remote_scope_id, const char *interf,
|
||||||
char *buf, int buf_size)
|
char *buf, int buf_size)
|
||||||
@ -251,13 +224,6 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
bool Curl_if_is_interface_name(const char *interf)
|
|
||||||
{
|
|
||||||
(void) interf;
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
||||||
unsigned int remote_scope_id, const char *interf,
|
unsigned int remote_scope_id, const char *interf,
|
||||||
char *buf, int buf_size)
|
char *buf, int buf_size)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
unsigned int Curl_ipv6_scope(const struct sockaddr *sa);
|
unsigned int Curl_ipv6_scope(const struct sockaddr *sa);
|
||||||
|
|
||||||
bool Curl_if_is_interface_name(const char *interf);
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
IF2IP_NOT_FOUND = 0, /* Interface not found */
|
IF2IP_NOT_FOUND = 0, /* Interface not found */
|
||||||
IF2IP_AF_NOT_SUPPORTED = 1, /* Int. exists but has no address for this af */
|
IF2IP_AF_NOT_SUPPORTED = 1, /* Int. exists but has no address for this af */
|
||||||
|
Loading…
Reference in New Issue
Block a user