]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp6-client: log message is processed before state is changed
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 6 Feb 2022 18:42:07 +0000 (03:42 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 14 Feb 2022 05:57:34 +0000 (14:57 +0900)
src/libsystemd-network/sd-dhcp6-client.c

index 2cfa7623e9f1cfd3ed8539c6813b1a756ea1de50..00574911624713618da3a6e3b8e10a0cf18178c0 100644 (file)
@@ -1132,6 +1132,8 @@ static int client_process_information(
         if (r < 0)
                 return log_dhcp6_client_errno(client, r, "Failed to process received reply message, ignoring: %m");
 
+        log_dhcp6_client(client, "Processed %s message", dhcp6_message_type_to_string(message->type));
+
         sd_dhcp6_lease_unref(client->lease);
         client->lease = TAKE_PTR(lease);
 
@@ -1162,6 +1164,8 @@ static int client_process_reply(
         if (r < 0)
                 return log_dhcp6_client_errno(client, r, "Failed to process received reply message, ignoring: %m");
 
+        log_dhcp6_client(client, "Processed %s message", dhcp6_message_type_to_string(message->type));
+
         sd_dhcp6_lease_unref(client->lease);
         client->lease = TAKE_PTR(lease);
 
@@ -1201,6 +1205,8 @@ static int client_process_advertise_or_rapid_commit_reply(
                         return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL),
                                                       "Received reply message without rapid commit flag, ignoring.");
 
+                log_dhcp6_client(client, "Processed %s message", dhcp6_message_type_to_string(message->type));
+
                 sd_dhcp6_lease_unref(client->lease);
                 client->lease = TAKE_PTR(lease);
 
@@ -1217,17 +1223,16 @@ static int client_process_advertise_or_rapid_commit_reply(
                         return r;
         }
 
+        log_dhcp6_client(client, "Processed %s message", dhcp6_message_type_to_string(message->type));
+
         if (!client->lease || pref_advertise > pref_lease) {
                 /* If this is the first advertise message or has higher preference, then save the lease. */
                 sd_dhcp6_lease_unref(client->lease);
                 client->lease = TAKE_PTR(lease);
         }
 
-        if (pref_advertise == 255 || client->retransmit_count > 1) {
-                r = client_set_state(client, DHCP6_STATE_REQUEST);
-                if (r < 0)
-                        return r;
-        }
+        if (pref_advertise == 255 || client->retransmit_count > 1)
+                (void) client_set_state(client, DHCP6_STATE_REQUEST);
 
         return 0;
 }
@@ -1336,9 +1341,6 @@ static int client_receive_message(
                 assert_not_reached();
         }
 
-        log_dhcp6_client(client, "Recv %s",
-                         dhcp6_message_type_to_string(message->type));
-
         return 0;
 }