Commit 5d868c74 authored by Ole André Vadla Ravnås's avatar Ole André Vadla Ravnås Committed by Olivier Crête

interfaces: Skip special interfaces on Apple OSes

Including unused utun devices.
parent 8eba6b35
...@@ -405,6 +405,12 @@ nice_interfaces_get_local_ips (gboolean include_loopback) ...@@ -405,6 +405,12 @@ nice_interfaces_get_local_ips (gboolean include_loopback)
ifa->ifa_addr->sa_family != AF_INET6) ifa->ifa_addr->sa_family != AF_INET6)
continue; continue;
#ifdef __APPLE__
if (g_str_has_prefix (ifa->ifa_name, "awdl") ||
g_str_has_prefix (ifa->ifa_name, "llw"))
continue;
#endif
/* Convert to a string. */ /* Convert to a string. */
addr_string = sockaddr_to_string (ifa->ifa_addr); addr_string = sockaddr_to_string (ifa->ifa_addr);
if (addr_string == NULL) { if (addr_string == NULL) {
...@@ -413,6 +419,18 @@ nice_interfaces_get_local_ips (gboolean include_loopback) ...@@ -413,6 +419,18 @@ nice_interfaces_get_local_ips (gboolean include_loopback)
continue; continue;
} }
#ifdef __APPLE__
{
gboolean is_unused_utun_device =
g_str_has_prefix (ifa->ifa_name, "utun") &&
g_str_has_prefix (addr_string, "fe80::");
if (is_unused_utun_device) {
g_free (addr_string);
continue;
}
}
#endif
nice_debug ("Interface: %s", ifa->ifa_name); nice_debug ("Interface: %s", ifa->ifa_name);
nice_debug ("IP Address: %s", addr_string); nice_debug ("IP Address: %s", addr_string);
if ((ifa->ifa_flags & IFF_LOOPBACK) == IFF_LOOPBACK) { if ((ifa->ifa_flags & IFF_LOOPBACK) == IFF_LOOPBACK) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment