mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-08 12:03:18 +01:00
gresolver: Fix loopback detection of IPv6 addresses
Previously the len passed to g_socket_address_new_from_native() was only
for IPv4 addresses and the constructor would fail.
This was reported and discussed here:
fe0139ee98 (note_2581394)
This commit is contained in:
committed by
Michael Catanzaro
parent
7b2afbd420
commit
90c29b7fb2
@@ -292,11 +292,19 @@ check_only_has_loopback_interfaces (void)
|
||||
for (struct ifaddrs *addr = addrs; addr; addr = addr->ifa_next)
|
||||
{
|
||||
struct sockaddr *sa = addr->ifa_addr;
|
||||
size_t addrlen;
|
||||
GSocketAddress *saddr;
|
||||
if (!sa)
|
||||
continue;
|
||||
|
||||
saddr = g_socket_address_new_from_native (sa, sizeof (struct sockaddr));
|
||||
if (sa->sa_family == AF_INET)
|
||||
addrlen = sizeof (struct sockaddr_in);
|
||||
else if (sa->sa_family == AF_INET6)
|
||||
addrlen = sizeof (struct sockaddr_in6);
|
||||
else
|
||||
continue;
|
||||
|
||||
saddr = g_socket_address_new_from_native (sa, addrlen);
|
||||
if (!saddr)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user