mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 14:20:17 +01:00
dhcp: allow the plugin to be restarted
In the next commit, a mechanism will be added to stop the DHCP plugin and restart it without destroying the NMDhcpClient object. For this to work, we must reset some members of the object when stopping or starting the plugin.
This commit is contained in:
parent
b6676aa8ef
commit
1db882ca63
2 changed files with 4 additions and 3 deletions
|
|
@ -1360,6 +1360,8 @@ nm_dhcp_client_start(NMDhcpClient *self, GError **error)
|
|||
g_return_val_if_fail(priv->config.uuid, FALSE);
|
||||
nm_assert(!priv->effective_client_id);
|
||||
|
||||
priv->is_stopped = FALSE;
|
||||
|
||||
IS_IPv4 = NM_IS_IPv4(priv->config.addr_family);
|
||||
|
||||
if (!IS_IPv4) {
|
||||
|
|
@ -1473,6 +1475,7 @@ nm_dhcp_client_stop(NMDhcpClient *self, gboolean release)
|
|||
if (priv->is_stopped)
|
||||
return;
|
||||
|
||||
nm_clear_pointer(&priv->effective_client_id, g_bytes_unref);
|
||||
nm_clear_g_source_inst(&priv->previous_lease_timeout_source);
|
||||
|
||||
priv->is_stopped = TRUE;
|
||||
|
|
@ -1980,8 +1983,6 @@ dispose(GObject *object)
|
|||
nm_clear_g_source_inst(&priv->v6.dad_timeout_source);
|
||||
}
|
||||
|
||||
nm_clear_pointer(&priv->effective_client_id, g_bytes_unref);
|
||||
|
||||
nm_assert(!priv->watch_source);
|
||||
nm_assert(!priv->l3cd_next);
|
||||
nm_assert(!priv->l3cd_curr);
|
||||
|
|
|
|||
|
|
@ -1323,7 +1323,7 @@ ip4_start(NMDhcpClient *client, GError **error)
|
|||
g_return_val_if_fail(!priv->probe, FALSE);
|
||||
g_return_val_if_fail(client_config, FALSE);
|
||||
|
||||
if (!nettools_create(self, &effective_client_id, error))
|
||||
if (!priv->client && !nettools_create(self, &effective_client_id, error))
|
||||
return FALSE;
|
||||
|
||||
r = n_dhcp4_client_probe_config_new(&config);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue