diff options
author | Thomas Haller <thaller@redhat.com> | 2014-11-12 13:37:30 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-11-12 15:58:47 +0100 |
commit | 66b05c94c0f5f6dcf72c3256ff7f4f7d7845eb68 (patch) | |
tree | caa5815d13afa596547e091ece8dcdb8b3b5f40b | |
parent | 0391c8b161a029150c0a0b6f3b9803be4e3724b3 (diff) | |
download | NetworkManager-66b05c94c0f5f6dcf72c3256ff7f4f7d7845eb68.tar.gz |
platform: assert against expected lifetime values of NMPlatformIPAddress
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/platform/nm-platform.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 8edf46f75c..b4d09ca073 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -1704,6 +1704,11 @@ _address_get_lifetime (const NMPlatformIPAddress *address, guint32 now, guint32 if (address->lifetime == 0) { *out_lifetime = NM_PLATFORM_LIFETIME_PERMANENT; *out_preferred = NM_PLATFORM_LIFETIME_PERMANENT; + + /* We treat lifetime==0 as permanent addresses to allow easy creation of such addresses + * (without requiring to set the lifetime fields to NM_PLATFORM_LIFETIME_PERMANENT). + * In that case we also expect that the other fields (timestamp and preferred) are left unset. */ + g_return_val_if_fail (address->timestamp == 0 && address->preferred == 0, TRUE); } else { lifetime = _rebase_relative_time_on_now (address->timestamp, address->lifetime, now, padding); if (!lifetime) |