]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp6-client: stop IO event source when client entered bound state
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 6 Feb 2022 20:21:31 +0000 (05:21 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 14 Feb 2022 05:58:49 +0000 (14:58 +0900)
Also when the client receives a reply when running in information
requesting mode.

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

index f90e81f85a8973b1729c17ebad6b8d369e54888a..e6eecbbe368d6409c71acac24c3bb91a3eb65e3f 100644 (file)
@@ -1051,6 +1051,7 @@ static int client_enter_bound_state(sd_dhcp6_client *client) {
                       DHCP6_STATE_RENEW,
                       DHCP6_STATE_REBIND));
 
+        (void) event_source_disable(client->receive_message);
         (void) event_source_disable(client->timeout_resend);
 
         r = dhcp6_lease_get_lifetime(client->lease, &lifetime_t1, &lifetime_t2, &lifetime_valid);
@@ -1152,6 +1153,8 @@ static int client_process_information(
         sd_dhcp6_lease_unref(client->lease);
         client->lease = TAKE_PTR(lease);
 
+        /* Do not call client_stop() here, as it frees the acquired lease. */
+        (void) event_source_disable(client->receive_message);
         (void) event_source_disable(client->timeout_resend);
         client_set_state(client, DHCP6_STATE_STOPPED);
 
@@ -1346,8 +1349,6 @@ static int client_receive_message(
 
         case DHCP6_STATE_BOUND:
         case DHCP6_STATE_STOPPED:
-                return 0;
-
         default:
                 assert_not_reached();
         }