chiark / gitweb /
sd-dhcp-client: clean up raw socket sd_event_source when creating new UDP socket
authorDan Williams <dcbw@redhat.com>
Thu, 30 Oct 2014 19:23:00 +0000 (14:23 -0500)
committerTom Gundersen <teg@jklm.no>
Fri, 31 Oct 2014 08:26:27 +0000 (09:26 +0100)
The raw socket sd_event_source used for DHCP server solicitations
was simply dropped on the floor when creating the new UDP socket
after a lease has been acquired.  Clean it up properly so we're
not still listening and responding to events on it.

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

index 0eba4c3..1f7f238 100644 (file)
@@ -1269,6 +1269,9 @@ static int client_handle_message(sd_dhcp_client *client, DHCPMessage *message,
                 if (r >= 0) {
                         client->timeout_resend =
                                 sd_event_source_unref(client->timeout_resend);
+                        client->receive_message =
+                                sd_event_source_unref(client->receive_message);
+                        client->fd = asynchronous_close(client->fd);
 
                         if (IN_SET(client->state, DHCP_STATE_REQUESTING,
                                    DHCP_STATE_REBOOTING))