core: unblock autoconnect when master profile changes
When a port cannot activate because the controller is not ready, it gets blocked from autoconnect (see commit725fed01cf
('policy: block connection from autoconnect in case of failed dependency')). Later, when the master activates we call activate_slave_connections() (see commit32efb87d4d
('core: unblock failed connections when the master is available')), which unblocks those port profiles so they can autoconnect. However, imagine you add a port profile with autoconnect enabled. The profile tries to autoconnect, finds no master and gets blocked. Then, add the controller profile with autoconnect disabled. The controller is not autoactivating, not calling activate_slave_connections() and the profiles stay down. Fix that by unblocking autoconnect of the ports when the controller profile changes.
This commit is contained in:
@@ -1833,6 +1833,26 @@ unblock_autoconnect_for_ports(NMPolicy *self,
|
||||
nm_policy_device_recheck_auto_activate_all_schedule(self);
|
||||
}
|
||||
|
||||
static void
|
||||
unblock_autoconnect_for_ports_for_sett_conn(NMPolicy *self, NMSettingsConnection *sett_conn)
|
||||
{
|
||||
const char *master_device;
|
||||
const char *master_uuid_settings;
|
||||
NMSettingConnection *s_con;
|
||||
|
||||
nm_assert(NM_IS_POLICY(self));
|
||||
nm_assert(NM_IS_SETTINGS_CONNECTION(sett_conn));
|
||||
|
||||
s_con = nm_settings_connection_get_setting(sett_conn, NM_META_SETTING_TYPE_CONNECTION);
|
||||
|
||||
nm_assert(NM_IS_SETTING_CONNECTION(s_con));
|
||||
|
||||
master_uuid_settings = nm_setting_connection_get_uuid(s_con);
|
||||
master_device = nm_setting_connection_get_interface_name(s_con);
|
||||
|
||||
unblock_autoconnect_for_ports(self, master_device, master_uuid_settings, NULL, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_slave_connections(NMPolicy *self, NMDevice *device)
|
||||
{
|
||||
@@ -2573,6 +2593,8 @@ connection_added(NMSettings *settings, NMSettingsConnection *connection, gpointe
|
||||
NMPolicyPrivate *priv = user_data;
|
||||
NMPolicy *self = _PRIV_TO_SELF(priv);
|
||||
|
||||
unblock_autoconnect_for_ports_for_sett_conn(self, connection);
|
||||
|
||||
nm_policy_device_recheck_auto_activate_all_schedule(self);
|
||||
}
|
||||
|
||||
@@ -2630,6 +2652,8 @@ connection_updated(NMSettings *settings,
|
||||
NMPolicy *self = _PRIV_TO_SELF(priv);
|
||||
NMSettingsConnectionUpdateReason update_reason = update_reason_u;
|
||||
|
||||
unblock_autoconnect_for_ports_for_sett_conn(self, connection);
|
||||
|
||||
if (NM_FLAGS_HAS(update_reason, NM_SETTINGS_CONNECTION_UPDATE_REASON_REAPPLY_PARTIAL)) {
|
||||
const CList *tmp_lst;
|
||||
NMDevice *device;
|
||||
|
Reference in New Issue
Block a user