diff options
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | src/common/address.c | 4 | ||||
-rw-r--r-- | src/or/eventdns.c | 6 |
3 files changed, 11 insertions, 1 deletions
diff --git a/configure.in b/configure.in index 58ea9484eb..395c09984a 100644 --- a/configure.in +++ b/configure.in @@ -446,7 +446,7 @@ AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t], , , #endif #endif ]) -AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16], , , +AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct sockaddr_in.sin_len, struct sockaddr_in6.sin6_len], , , [#ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif diff --git a/src/common/address.c b/src/common/address.c index 1abd1a7dfb..2dd763da99 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -69,7 +69,9 @@ tor_addr_to_sockaddr(const tor_addr_t *a, return -1; sin = (struct sockaddr_in *)sa_out; memset(sin, 0, sizeof(struct sockaddr_in)); +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN sin->sin_len = sizeof(struct sockaddr_in); +#endif sin->sin_family = AF_INET; sin->sin_port = htons(port); sin->sin_addr.s_addr = tor_addr_to_ipv4n(a); @@ -80,7 +82,9 @@ tor_addr_to_sockaddr(const tor_addr_t *a, return -1; sin6 = (struct sockaddr_in6 *)sa_out; memset(sin6, 0, sizeof(struct sockaddr_in6)); +#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN sin6->sin6_len = sizeof(struct sockaddr_in6); +#endif sin6->sin6_family = AF_INET6; sin6->sin6_port = htons(port); memcpy(&sin6->sin6_addr, tor_addr_to_in6(a), sizeof(struct in6_addr)); diff --git a/src/or/eventdns.c b/src/or/eventdns.c index 248422d22a..6b61758210 100644 --- a/src/or/eventdns.c +++ b/src/or/eventdns.c @@ -2302,7 +2302,9 @@ evdns_nameserver_add(unsigned long int address) { struct sockaddr_in sin; memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN sin.sin_len = sizeof(sin); +#endif sin.sin_addr.s_addr = htonl(address); sin.sin_port = 53; return _evdns_nameserver_add_impl((struct sockaddr*) &sin, sizeof(sin)); @@ -2381,7 +2383,9 @@ evdns_nameserver_ip_add(const char *ip_as_string) { if (is_ipv6) { struct sockaddr_in6 sin6; memset(&sin6, 0, sizeof(sin6)); +#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN sin6.sin6_len = sizeof(sin6); +#endif sin6.sin6_family = AF_INET6; sin6.sin6_port = htons(port); if (1 != tor_inet_pton(AF_INET6, addr_part, &sin6.sin6_addr)) { @@ -2393,7 +2397,9 @@ evdns_nameserver_ip_add(const char *ip_as_string) { } else { struct sockaddr_in sin; memset(&sin, 0, sizeof(sin)); +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN sin.sin_len = sizeof(sin); +#endif sin.sin_family = AF_INET; sin.sin_port = htons(port); if (!inet_aton(addr_part, &sin.sin_addr)) { |