summaryrefslogtreecommitdiff
path: root/libgssdp/gssdp-net-posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgssdp/gssdp-net-posix.c')
-rw-r--r--libgssdp/gssdp-net-posix.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libgssdp/gssdp-net-posix.c b/libgssdp/gssdp-net-posix.c
index 3350b06..1dc1ae7 100644
--- a/libgssdp/gssdp-net-posix.c
+++ b/libgssdp/gssdp-net-posix.c
@@ -510,8 +510,16 @@ gssdp_net_get_host_ip (GSSDPNetworkDevice *device, GError **error)
if (!equal)
continue;
- device->host_mask = get_netmask (ifa->ifa_addr,
- ifa->ifa_netmask);
+ if (device->host_mask != NULL &&
+ !g_inet_address_mask_matches (device->host_mask,
+ device->host_addr)) {
+ g_clear_object (&device->host_mask);
+ }
+
+ if (device->host_mask == NULL) {
+ device->host_mask =
+ get_netmask (ifa->ifa_addr, ifa->ifa_netmask);
+ }
if (device->iface_name == NULL)
device->iface_name = g_strdup (ifa->ifa_name);