diff options
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -277,9 +277,14 @@ packet_connection_is_ipv4(void) | |||
277 | memset(&to, 0, sizeof(to)); | 277 | memset(&to, 0, sizeof(to)); |
278 | if (getsockname(connection_out, (struct sockaddr *)&to, &tolen) < 0) | 278 | if (getsockname(connection_out, (struct sockaddr *)&to, &tolen) < 0) |
279 | return 0; | 279 | return 0; |
280 | if (to.ss_family != AF_INET) | 280 | if (to.ss_family == AF_INET) |
281 | return 0; | 281 | return 1; |
282 | return 1; | 282 | #ifdef IPV4_IN_IPV6 |
283 | if (to.ss_family == AF_INET6 && | ||
284 | IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&to)->sin6_addr)) | ||
285 | return 1; | ||
286 | #endif | ||
287 | return 0; | ||
283 | } | 288 | } |
284 | 289 | ||
285 | /* Sets the connection into non-blocking mode. */ | 290 | /* Sets the connection into non-blocking mode. */ |