mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-01 00:10:11 +01:00
platform: use gint32 for monotonic-timestamp seconds
@now is obtained via nm_utils_get_monotonic_timestamp_s(), which is gint32 (although it will never be negative). Use the correct type.
This commit is contained in:
parent
6cb7322465
commit
c7aea6b620
3 changed files with 13 additions and 9 deletions
|
|
@ -2976,10 +2976,12 @@ nm_utils_ip4_address_is_link_local (in_addr_t addr)
|
|||
guint32
|
||||
nm_utils_lifetime_rebase_relative_time_on_now (guint32 timestamp,
|
||||
guint32 duration,
|
||||
guint32 now)
|
||||
gint32 now)
|
||||
{
|
||||
gint64 t;
|
||||
|
||||
nm_assert (now >= 0);
|
||||
|
||||
if (duration == NM_PLATFORM_LIFETIME_PERMANENT)
|
||||
return NM_PLATFORM_LIFETIME_PERMANENT;
|
||||
|
||||
|
|
@ -3008,12 +3010,14 @@ gboolean
|
|||
nm_utils_lifetime_get (guint32 timestamp,
|
||||
guint32 lifetime,
|
||||
guint32 preferred,
|
||||
guint32 now,
|
||||
gint32 now,
|
||||
guint32 *out_lifetime,
|
||||
guint32 *out_preferred)
|
||||
{
|
||||
guint32 t_lifetime, t_preferred;
|
||||
|
||||
nm_assert (now >= 0);
|
||||
|
||||
if (lifetime == 0) {
|
||||
*out_lifetime = NM_PLATFORM_LIFETIME_PERMANENT;
|
||||
*out_preferred = NM_PLATFORM_LIFETIME_PERMANENT;
|
||||
|
|
@ -3023,7 +3027,7 @@ nm_utils_lifetime_get (guint32 timestamp,
|
|||
* In that case we also expect that the other fields (timestamp and preferred) are left unset. */
|
||||
g_return_val_if_fail (timestamp == 0 && preferred == 0, TRUE);
|
||||
} else {
|
||||
if (!now)
|
||||
if (now <= 0)
|
||||
now = nm_utils_get_monotonic_timestamp_s ();
|
||||
t_lifetime = nm_utils_lifetime_rebase_relative_time_on_now (timestamp, lifetime, now);
|
||||
if (!t_lifetime) {
|
||||
|
|
|
|||
|
|
@ -402,12 +402,12 @@ void nm_utils_ifname_cpy (char *dst, const char *name);
|
|||
|
||||
guint32 nm_utils_lifetime_rebase_relative_time_on_now (guint32 timestamp,
|
||||
guint32 duration,
|
||||
guint32 now);
|
||||
gint32 now);
|
||||
|
||||
gboolean nm_utils_lifetime_get (guint32 timestamp,
|
||||
guint32 lifetime,
|
||||
guint32 preferred,
|
||||
guint32 now,
|
||||
gint32 now,
|
||||
guint32 *out_lifetime,
|
||||
guint32 *out_preferred);
|
||||
|
||||
|
|
|
|||
|
|
@ -2613,7 +2613,7 @@ nm_platform_ip6_address_get (NMPlatform *self, int ifindex, struct in6_addr addr
|
|||
}
|
||||
|
||||
static gboolean
|
||||
array_contains_ip4_address (const GArray *addresses, const NMPlatformIP4Address *address, gint64 now)
|
||||
array_contains_ip4_address (const GArray *addresses, const NMPlatformIP4Address *address, gint32 now)
|
||||
{
|
||||
guint len = addresses ? addresses->len : 0;
|
||||
guint i;
|
||||
|
|
@ -2636,7 +2636,7 @@ array_contains_ip4_address (const GArray *addresses, const NMPlatformIP4Address
|
|||
}
|
||||
|
||||
static gboolean
|
||||
array_contains_ip6_address (const GArray *addresses, const NMPlatformIP6Address *address, gint64 now)
|
||||
array_contains_ip6_address (const GArray *addresses, const NMPlatformIP6Address *address, gint32 now)
|
||||
{
|
||||
guint len = addresses ? addresses->len : 0;
|
||||
guint i;
|
||||
|
|
@ -2677,7 +2677,7 @@ nm_platform_ip4_address_sync (NMPlatform *self, int ifindex, const GArray *known
|
|||
{
|
||||
GArray *addresses;
|
||||
NMPlatformIP4Address *address;
|
||||
guint32 now = nm_utils_get_monotonic_timestamp_s ();
|
||||
gint32 now = nm_utils_get_monotonic_timestamp_s ();
|
||||
int i;
|
||||
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
|
|
@ -2740,7 +2740,7 @@ nm_platform_ip6_address_sync (NMPlatform *self, int ifindex, const GArray *known
|
|||
{
|
||||
GArray *addresses;
|
||||
NMPlatformIP6Address *address;
|
||||
guint32 now = nm_utils_get_monotonic_timestamp_s ();
|
||||
gint32 now = nm_utils_get_monotonic_timestamp_s ();
|
||||
int i;
|
||||
|
||||
/* Delete unknown addresses */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue