platform: minor cleanup in nm_platform_ip_address_sync()

The known address must not have a zero lifetime,
because we filter those addresses out first.
This commit is contained in:
Thomas Haller
2020-07-29 13:30:08 +02:00
parent dca62c06fd
commit 0acb577320

View File

@@ -3577,8 +3577,11 @@ _addr_array_clean_expired (int addr_family, int ifindex, GPtrArray *array, guint
goto clear_and_next; goto clear_and_next;
} }
if (!nm_utils_lifetime_get (a->timestamp, a->lifetime, a->preferred, if (!nm_utils_lifetime_get (a->timestamp,
now, NULL)) a->lifetime,
a->preferred,
now,
NULL))
goto clear_and_next; goto clear_and_next;
if (idx) { if (idx) {
@@ -4061,9 +4064,9 @@ next_plat:
known_address->ax.preferred, known_address->ax.preferred,
now, now,
&preferred); &preferred);
nm_assert (lifetime > 0);
if (IS_IPv4) { if (IS_IPv4) {
if (lifetime <= 0)
goto delete_and_next2;
if (!nm_platform_ip4_address_add (self, if (!nm_platform_ip4_address_add (self,
ifindex, ifindex,
known_address->a4.address, known_address->a4.address,
@@ -4073,8 +4076,9 @@ next_plat:
lifetime, lifetime,
preferred, preferred,
ifa_flags, ifa_flags,
known_address->a4.label)) known_address->a4.label)) {
goto delete_and_next2; /* ignore error, for unclear reasons. */
}
} else { } else {
if (!nm_platform_ip6_address_add (self, if (!nm_platform_ip6_address_add (self,
ifindex, ifindex,
@@ -4087,11 +4091,6 @@ next_plat:
| known_address->a6.n_ifa_flags)) | known_address->a6.n_ifa_flags))
return FALSE; return FALSE;
} }
continue;
delete_and_next2:
nmp_object_unref (o);
known_addresses->pdata[i_know] = NULL;
} }
return TRUE; return TRUE;