34 #if !defined(WIN32) && !defined(__BEOS__) && !defined(__CYGWIN32__) && \
35 !defined(__riscos__) && !defined(__INTERIX) && !defined(NETWARE)
37 #ifdef HAVE_SYS_SOCKET_H
38 #include <sys/socket.h>
40 #ifdef HAVE_NETINET_IN_H
41 #include <netinet/in.h>
43 #ifdef HAVE_ARPA_INET_H
44 #include <arpa/inet.h>
47 #ifdef HAVE_SYS_TIME_H
54 #ifdef HAVE_SYS_IOCTL_H
55 #include <sys/ioctl.h>
63 #ifdef HAVE_SYS_SOCKIO_H
64 #include <sys/sockio.h>
67 #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
84 char *
Curl_if2ip(
char *interface,
char *buf,
int buf_size)
92 dummy = socket(AF_INET, SOCK_STREAM, 0);
98 memset(&req, 0,
sizeof(req));
99 strcpy(req.ifr_name, interface);
100 req.ifr_addr.sa_family = AF_INET;
112 struct sockaddr_in *
s = (
struct sockaddr_in *)&req.ifr_dstaddr;
113 memcpy(&in, &(s->sin_addr.s_addr),
sizeof(
in));
114 #if defined(HAVE_INET_NTOA_R)
117 ip = strncpy(buf,
inet_ntoa(in),buf_size);
118 ip[buf_size - 1] = 0;
128 char *
Curl_if2ip(
char *interface,
char *buf,
int buf_size)
#define ioctl(a, b, c, d)
char * inet_ntoa_r(const struct in_addr in, char *buffer, int buflen)
char * Curl_if2ip(char *interface, char *buf, int buf_size)