mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-22 05:40:09 +01:00
device: postpone updates of IP configuration when a commit is pending
When a new dynamic configuration is received, it is stored in a member of private structure (e.g. @dhcp6_ip6_config) and a commit is scheduled. Before the commit is executed, an update_ipx_config() could be called and it would change the configuration before it is committed. This race condition causes failures in assigning the addresses received through DHCPv6 when the internal client is used (but potentially other clients and methods are affected). To fix it, postpone updates of IP configurations when a commit is already pending.
This commit is contained in:
parent
69863204e2
commit
a47c13a7a2
1 changed files with 33 additions and 0 deletions
|
|
@ -3425,6 +3425,15 @@ activation_source_schedule (NMDevice *self, ActivationHandleFunc func, int famil
|
|||
act_data->id = new_id;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
activation_source_is_scheduled (NMDevice *self, ActivationHandleFunc func, int family)
|
||||
{
|
||||
ActivationHandleData *act_data;
|
||||
|
||||
act_data = activation_source_get_by_family (self, family, NULL);
|
||||
return act_data->func == func;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
|
|
@ -8823,6 +8832,18 @@ update_ip4_config (NMDevice *self, gboolean initial)
|
|||
int ifindex;
|
||||
gboolean capture_resolv_conf;
|
||||
|
||||
/* If a commit is scheduled, this function would potentially interfere with
|
||||
* it changing IP configurations before they are applied. Postpone the
|
||||
* update in such case.
|
||||
*/
|
||||
if (activation_source_is_scheduled (self,
|
||||
activate_stage5_ip4_config_commit,
|
||||
AF_INET)) {
|
||||
priv->queued_ip4_config_id = g_idle_add (queued_ip4_config_change, self);
|
||||
_LOGT (LOGD_DEVICE, "IP4 update was postponed");
|
||||
return;
|
||||
}
|
||||
|
||||
ifindex = nm_device_get_ip_ifindex (self);
|
||||
if (!ifindex)
|
||||
return;
|
||||
|
|
@ -8900,6 +8921,18 @@ update_ip6_config (NMDevice *self, gboolean initial)
|
|||
int ifindex;
|
||||
gboolean capture_resolv_conf;
|
||||
|
||||
/* If a commit is scheduled, this function would potentially interfere with
|
||||
* it changing IP configurations before they are applied. Postpone the
|
||||
* update in such case.
|
||||
*/
|
||||
if (activation_source_is_scheduled (self,
|
||||
activate_stage5_ip6_config_commit,
|
||||
AF_INET6)) {
|
||||
priv->queued_ip6_config_id = g_idle_add (queued_ip6_config_change, self);
|
||||
_LOGT (LOGD_DEVICE, "IP6 update was postponed");
|
||||
return;
|
||||
}
|
||||
|
||||
ifindex = nm_device_get_ip_ifindex (self);
|
||||
if (!ifindex)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue