]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp6-client: add log about Information Refresh Time
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 7 Feb 2022 12:04:50 +0000 (21:04 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 14 Feb 2022 06:01:02 +0000 (15:01 +0900)
And store IRT only when the client is running in information
requesting mode.

src/libsystemd-network/sd-dhcp6-lease.c

index 5617e85212f7856de76cbd67f67df11a5197dbbd..8b8c2312ea1bd4c3f80cc0e7039409ae0143b77c 100644 (file)
@@ -630,7 +630,12 @@ static int dhcp6_lease_parse_message(
                                               "The client ID in %s message does not match. Ignoring.",
                                               dhcp6_message_type_to_string(message->type));
 
-        if (client->state != DHCP6_STATE_INFORMATION_REQUEST) {
+        if (client->state == DHCP6_STATE_INFORMATION_REQUEST) {
+                client->information_refresh_time_usec = MAX(irt, IRT_MINIMUM);
+                log_dhcp6_client(client, "New information request will be refused in %s.",
+                                 FORMAT_TIMESPAN(client->information_refresh_time_usec, USEC_PER_SEC));
+
+        } else {
                 r = dhcp6_lease_get_serverid(lease, NULL, NULL);
                 if (r < 0)
                         return log_dhcp6_client_errno(client, r, "%s has no server id",
@@ -643,8 +648,6 @@ static int dhcp6_lease_parse_message(
                 dhcp6_lease_set_lifetime(lease);
         }
 
-        client->information_refresh_time_usec = MAX(irt, IRT_MINIMUM);
-
         return 0;
 }