diff options
author | Max Kellermann <max@duempel.org> | 2009-03-06 10:09:10 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-06 10:09:10 +0100 |
commit | 4c3ce9ef1cfb2125a7f8efec4735cc0181cb5b75 (patch) | |
tree | 46d9824b7b7db8cc9dcc91813002234b860c55c7 /src/socket_util.c | |
parent | 38ead091f9b80bb325a8042688031beb91fbad02 (diff) | |
download | mpd-4c3ce9ef1cfb2125a7f8efec4735cc0181cb5b75.tar.gz mpd-4c3ce9ef1cfb2125a7f8efec4735cc0181cb5b75.tar.xz mpd-4c3ce9ef1cfb2125a7f8efec4735cc0181cb5b75.zip |
socket_util: check if IN6_IS_ADDR_V4MAPPED is defined
On some systems, the macro IN6_IS_ADDR_V4MAPPED() is not available.
Don't try to convert IPv6 to their IPV4 equivalents in this case.
Diffstat (limited to '')
-rw-r--r-- | src/socket_util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/socket_util.c b/src/socket_util.c index 0fea281f0..0b38a1468 100644 --- a/src/socket_util.c +++ b/src/socket_util.c @@ -33,14 +33,14 @@ char * sockaddr_to_string(const struct sockaddr *sa, size_t length, GError **error) { -#ifdef HAVE_IPV6 +#if defined(HAVE_IPV6) && defined(IN6_IS_ADDR_V4MAPPED) const struct sockaddr_in6 *a6 = (const struct sockaddr_in6 *)sa; struct sockaddr_in a4; #endif int ret; char host[NI_MAXHOST], serv[NI_MAXSERV]; -#ifdef HAVE_IPV6 +#if defined(HAVE_IPV6) && defined(IN6_IS_ADDR_V4MAPPED) if (sa->sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&a6->sin6_addr)) { /* convert "::ffff:127.0.0.1" to "127.0.0.1" */ |