summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2023-02-22 09:51:56 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2023-03-02 16:57:08 +0100
commit220189b9e67199f75d55d648a5d86bfaa07d79ae (patch)
treef261cc8f0b2929d0d9e3e488499d12f8f3b04af5
parent16f491eb13abde201d14b85513e20b61c4db8203 (diff)
device: manually update link properties for ovs interfacesbg/link-setting
OVS interfaces are special: the kernel link is created only after the device is attached to the ovs-port, and as with all ports this happens during stage3(ip-config). That means that the link doesn't exist during stage2(config); therefore, explicitly update link properties once the link appears.
-rw-r--r--src/core/devices/nm-device-private.h2
-rw-r--r--src/core/devices/nm-device.c8
-rw-r--r--src/core/devices/ovs/nm-device-ovs-interface.c4
3 files changed, 10 insertions, 4 deletions
diff --git a/src/core/devices/nm-device-private.h b/src/core/devices/nm-device-private.h
index 6f3a1c3e42..013bc7fd86 100644
--- a/src/core/devices/nm-device-private.h
+++ b/src/core/devices/nm-device-private.h
@@ -176,4 +176,6 @@ void nm_device_auth_request(NMDevice *self,
NMManagerDeviceAuthRequestFunc callback,
gpointer user_data);
+void nm_device_link_properties_set(NMDevice *self, gboolean reapply);
+
#endif /* NM_DEVICE_PRIVATE_H */
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c
index a558aef026..300c958743 100644
--- a/src/core/devices/nm-device.c
+++ b/src/core/devices/nm-device.c
@@ -2796,8 +2796,8 @@ link_properties_fill_from_setting(NMDevice *self, NMPlatformLinkProps *props)
return flags;
}
-static void
-link_properties_set(NMDevice *self, gboolean reapply)
+void
+nm_device_link_properties_set(NMDevice *self, gboolean reapply)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
NMPlatformLinkProps props;
@@ -9913,7 +9913,7 @@ activate_stage2_device_config(NMDevice *self)
if (!nm_device_sys_iface_state_is_external(self)) {
_ethtool_state_set(self);
- link_properties_set(self, FALSE);
+ nm_device_link_properties_set(self, FALSE);
}
if (!nm_device_sys_iface_state_is_external(self)) {
@@ -13178,7 +13178,7 @@ check_and_reapply_connection(NMDevice *self,
*************************************************************************/
klass->reapply_connection(self, con_old, con_new);
- link_properties_set(self, TRUE);
+ nm_device_link_properties_set(self, TRUE);
if (priv->state >= NM_DEVICE_STATE_CONFIG)
lldp_setup(self, NM_TERNARY_DEFAULT);
diff --git a/src/core/devices/ovs/nm-device-ovs-interface.c b/src/core/devices/ovs/nm-device-ovs-interface.c
index 711f65cb5b..3ff52c4645 100644
--- a/src/core/devices/ovs/nm-device-ovs-interface.c
+++ b/src/core/devices/ovs/nm-device-ovs-interface.c
@@ -132,6 +132,8 @@ link_changed(NMDevice *device, const NMPlatformLink *pllink)
nm_device_devip_set_failed(device, AF_INET6, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
return;
}
+
+ nm_device_link_properties_set(device, FALSE);
nm_device_bring_up(device);
nm_device_devip_set_state(device, AF_INET, NM_DEVICE_IP_STATE_PENDING, NULL);
@@ -214,6 +216,7 @@ _set_ip_ifindex_tun(gpointer user_data)
priv->wait_link_is_waiting = FALSE;
nm_device_set_ip_ifindex(device, priv->wait_link_ifindex);
+ nm_device_link_properties_set(device, FALSE);
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);
@@ -303,6 +306,7 @@ act_stage3_ip_config(NMDevice *device, int addr_family)
return;
}
+ nm_device_link_properties_set(device, FALSE);
nm_device_devip_set_state(device, addr_family, NM_DEVICE_IP_STATE_READY, NULL);
}