chiark / gitweb /
sd-dhcp-client: rebind raw socket when resetting transaction id
[elogind.git] / src / libsystemd-network / sd-dhcp-client.c
index afad776d1c6ac840999c41ebab37668d35c9abaf..4be37a2389fef27912004f17a141df3c87ced973 100644 (file)
@@ -473,7 +473,13 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
                 /* start over as we did not receive a timely ack or nak */
                 client->state = DHCP_STATE_INIT;
                 client->attempt = 1;
+
+                client->fd = safe_close(client->fd);
                 client->xid = random_u32();
+                r = dhcp_network_bind_raw_socket(client->index, &client->link, client->xid);
+                if (r < 0)
+                        goto error;
+                client->fd = r;
 
                 /* fall through */
         case DHCP_STATE_INIT: