ovs-interface: fix state change in link_changed()

The function checks that priv->wait_link.waiting is set. Since the
flag is only set in stage3, it is wrong to schedule stage2 again.

(cherry picked from commit 01a6a2dc15)
(cherry picked from commit 08ffcf2278)
This commit is contained in:
Beniamino Galvani 2023-10-18 17:12:14 +02:00 committed by Fernando Fernandez Mancera
parent b28f8aa616
commit df465c5794

View file

@ -130,28 +130,24 @@ link_changed(NMDevice *device, const NMPlatformLink *pllink)
if (!pllink || !priv->wait_link.waiting)
return;
if (nm_device_get_state(device) != NM_DEVICE_STATE_IP_CONFIG)
return;
priv->wait_link.waiting = FALSE;
if (nm_device_get_state(device) == NM_DEVICE_STATE_IP_CONFIG) {
if (!nm_device_hw_addr_set_cloned(device,
nm_device_get_applied_connection(device),
FALSE)) {
nm_device_devip_set_failed(device, AF_INET, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
nm_device_devip_set_failed(device, AF_INET6, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
return;
}
_LOGT(LOGD_CORE, "ovs-wait-link: link is ready after link changed event");
nm_device_bring_up(device);
nm_device_devip_set_state(device, AF_INET, NM_DEVICE_IP_STATE_PENDING, NULL);
nm_device_devip_set_state(device, AF_INET6, NM_DEVICE_IP_STATE_PENDING, NULL);
nm_device_activate_schedule_stage3_ip_config(device, FALSE);
if (!nm_device_hw_addr_set_cloned(device, nm_device_get_applied_connection(device), FALSE)) {
nm_device_devip_set_failed(device, AF_INET, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
nm_device_devip_set_failed(device, AF_INET6, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
return;
}
nm_device_activate_schedule_stage2_device_config(device, FALSE);
_LOGT(LOGD_CORE, "ovs-wait-link: link is ready after link changed event");
nm_device_bring_up(device);
nm_device_devip_set_state(device, AF_INET, NM_DEVICE_IP_STATE_PENDING, NULL);
nm_device_devip_set_state(device, AF_INET6, NM_DEVICE_IP_STATE_PENDING, NULL);
nm_device_activate_schedule_stage3_ip_config(device, FALSE);
}
static gboolean