]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-dhcp-client: simplify dhcp4 t1/t2 parsing
authorDan Streetman <ddstreet@canonical.com>
Tue, 8 Dec 2020 20:36:19 +0000 (15:36 -0500)
committerDan Streetman <ddstreet@canonical.com>
Mon, 14 Dec 2020 23:19:07 +0000 (18:19 -0500)
commitb0d7d8063cb61bb204523f02fd45fb671a1f4d43
treec99870bed874c3bc69821b03f0d20d9f89303237
parent3d75a443ee819c4b2df8bfd8caee5c3ebc76fae3
sd-dhcp-client: simplify dhcp4 t1/t2 parsing

The parsing of the dhcpv4 lease lifetime, as well as the t1/t2
times, is simplified by this commit.

This differs from previous behavior; previously, the lease lifetime and
t1/t2 values were modified by random 'fuzz' by subtracting 3, then adding
a random number between 0 and (slightly over) 2 seconds. The resulting
values were therefore always between 1-3 seconds shorter than the value
provided by the server (or the default, in case of t1/t2). Now, as
described in RFC2131, the random 'fuzz' is between -1 and +1 seconds,
meaning the actual t1 and t2 value will be up to 1 second earlier or
later than the server-provided (or default) t1/t2 value.

This also differs in handling the lease lifetime, as described above it
previously was adjusted by the random 'fuzz', but the RFC does not state
that the lease expiration time should be adjusted, so now the code uses
exactly the lease lifetime as provided by the server with no adjustment.
src/libsystemd-network/sd-dhcp-client.c