device: manually update link properties for ovs interfaces

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.
This commit is contained in:
Beniamino Galvani 2023-02-22 09:51:56 +01:00
parent 16f491eb13
commit 220189b9e6
3 changed files with 10 additions and 4 deletions

View file

@ -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 */

View file

@ -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);

View file

@ -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);
}