policy: always reset retries when unblocking children or ports
When calling activate_port_or_children_connections() we are unblocking the ports and children but we are not resetting the number of retries if it is an internal activation. This is wrong as even if it's an internal activation the number of retries should be reset. It won't interferfe with other blocking reasons like USER_REQUESTED or MISSING_SECRETS.
This commit is contained in:
@@ -1873,8 +1873,7 @@ unblock_autoconnect_for_children(NMPolicy *self,
|
|||||||
const char *parent_device,
|
const char *parent_device,
|
||||||
const char *parent_uuid_settings,
|
const char *parent_uuid_settings,
|
||||||
const char *parent_uuid_applied,
|
const char *parent_uuid_applied,
|
||||||
const char *parent_mac_addr,
|
const char *parent_mac_addr)
|
||||||
gboolean reset_devcon_autoconnect)
|
|
||||||
{
|
{
|
||||||
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
|
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
|
||||||
NMSettingsConnection *const *connections;
|
NMSettingsConnection *const *connections;
|
||||||
@@ -1915,10 +1914,8 @@ unblock_autoconnect_for_children(NMPolicy *self,
|
|||||||
parent_mac_addr))
|
parent_mac_addr))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (reset_devcon_autoconnect) {
|
if (nm_manager_devcon_autoconnect_retries_reset(priv->manager, NULL, sett_conn))
|
||||||
if (nm_manager_devcon_autoconnect_retries_reset(priv->manager, NULL, sett_conn))
|
changed = TRUE;
|
||||||
changed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* unblock the devices associated with that connection */
|
/* unblock the devices associated with that connection */
|
||||||
if (nm_manager_devcon_autoconnect_blocked_reason_set(
|
if (nm_manager_devcon_autoconnect_blocked_reason_set(
|
||||||
@@ -1940,8 +1937,7 @@ static void
|
|||||||
unblock_autoconnect_for_ports(NMPolicy *self,
|
unblock_autoconnect_for_ports(NMPolicy *self,
|
||||||
const char *controller_device,
|
const char *controller_device,
|
||||||
const char *controller_uuid_settings,
|
const char *controller_uuid_settings,
|
||||||
const char *controller_uuid_applied,
|
const char *controller_uuid_applied)
|
||||||
gboolean reset_devcon_autoconnect)
|
|
||||||
{
|
{
|
||||||
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
|
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
|
||||||
NMSettingsConnection *const *connections;
|
NMSettingsConnection *const *connections;
|
||||||
@@ -1959,7 +1955,6 @@ unblock_autoconnect_for_ports(NMPolicy *self,
|
|||||||
"\"",
|
"\"",
|
||||||
""));
|
""));
|
||||||
|
|
||||||
changed = FALSE;
|
|
||||||
connections = nm_settings_get_connections(priv->settings, NULL);
|
connections = nm_settings_get_connections(priv->settings, NULL);
|
||||||
for (i = 0; connections[i]; i++) {
|
for (i = 0; connections[i]; i++) {
|
||||||
NMSettingsConnection *sett_conn = connections[i];
|
NMSettingsConnection *sett_conn = connections[i];
|
||||||
@@ -1977,10 +1972,8 @@ unblock_autoconnect_for_ports(NMPolicy *self,
|
|||||||
controller_uuid_settings))
|
controller_uuid_settings))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (reset_devcon_autoconnect) {
|
if (nm_manager_devcon_autoconnect_retries_reset(priv->manager, NULL, sett_conn))
|
||||||
if (nm_manager_devcon_autoconnect_retries_reset(priv->manager, NULL, sett_conn))
|
changed = TRUE;
|
||||||
changed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* unblock the devices associated with that connection */
|
/* unblock the devices associated with that connection */
|
||||||
if (nm_manager_devcon_autoconnect_blocked_reason_set(
|
if (nm_manager_devcon_autoconnect_blocked_reason_set(
|
||||||
@@ -2015,7 +2008,7 @@ unblock_autoconnect_for_ports_for_sett_conn(NMPolicy *self, NMSettingsConnection
|
|||||||
controller_uuid_settings = nm_setting_connection_get_uuid(s_con);
|
controller_uuid_settings = nm_setting_connection_get_uuid(s_con);
|
||||||
controller_device = nm_setting_connection_get_interface_name(s_con);
|
controller_device = nm_setting_connection_get_interface_name(s_con);
|
||||||
|
|
||||||
unblock_autoconnect_for_ports(self, controller_device, controller_uuid_settings, NULL, TRUE);
|
unblock_autoconnect_for_ports(self, controller_device, controller_uuid_settings, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2028,7 +2021,6 @@ activate_port_or_children_connections(NMPolicy *self,
|
|||||||
const char *controller_uuid_applied = NULL;
|
const char *controller_uuid_applied = NULL;
|
||||||
const char *parent_mac_addr = NULL;
|
const char *parent_mac_addr = NULL;
|
||||||
NMActRequest *req;
|
NMActRequest *req;
|
||||||
gboolean internal_activation = FALSE;
|
|
||||||
|
|
||||||
controller_device = nm_device_get_iface(device);
|
controller_device = nm_device_get_iface(device);
|
||||||
nm_assert(controller_device);
|
nm_assert(controller_device);
|
||||||
@@ -2039,7 +2031,6 @@ activate_port_or_children_connections(NMPolicy *self,
|
|||||||
if (req) {
|
if (req) {
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
NMSettingsConnection *sett_conn;
|
NMSettingsConnection *sett_conn;
|
||||||
NMAuthSubject *subject;
|
|
||||||
|
|
||||||
sett_conn = nm_active_connection_get_settings_connection(NM_ACTIVE_CONNECTION(req));
|
sett_conn = nm_active_connection_get_settings_connection(NM_ACTIVE_CONNECTION(req));
|
||||||
if (sett_conn)
|
if (sett_conn)
|
||||||
@@ -2051,25 +2042,19 @@ activate_port_or_children_connections(NMPolicy *self,
|
|||||||
|
|
||||||
if (nm_streq0(controller_uuid_settings, controller_uuid_applied))
|
if (nm_streq0(controller_uuid_settings, controller_uuid_applied))
|
||||||
controller_uuid_applied = NULL;
|
controller_uuid_applied = NULL;
|
||||||
|
|
||||||
subject = nm_active_connection_get_subject(NM_ACTIVE_CONNECTION(req));
|
|
||||||
internal_activation =
|
|
||||||
subject && (nm_auth_subject_get_subject_type(subject) == NM_AUTH_SUBJECT_TYPE_INTERNAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!activate_children_connections_only) {
|
if (!activate_children_connections_only) {
|
||||||
unblock_autoconnect_for_ports(self,
|
unblock_autoconnect_for_ports(self,
|
||||||
controller_device,
|
controller_device,
|
||||||
controller_uuid_settings,
|
controller_uuid_settings,
|
||||||
controller_uuid_applied,
|
controller_uuid_applied);
|
||||||
!internal_activation);
|
|
||||||
}
|
}
|
||||||
unblock_autoconnect_for_children(self,
|
unblock_autoconnect_for_children(self,
|
||||||
controller_device,
|
controller_device,
|
||||||
controller_uuid_settings,
|
controller_uuid_settings,
|
||||||
controller_uuid_applied,
|
controller_uuid_applied,
|
||||||
parent_mac_addr,
|
parent_mac_addr);
|
||||||
!internal_activation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Reference in New Issue
Block a user