diff options
| author | Thomas Haller <thaller@redhat.com> | 2023-04-05 10:57:57 +0200 |
|---|---|---|
| committer | Thomas Haller <thaller@redhat.com> | 2023-04-27 08:35:27 +0200 |
| commit | f1c15f0ae79cee417766f31eb94e004f52971f05 (patch) | |
| tree | 0861ded7916ee41129a13a87ac94ca4fedac0c22 | |
| parent | 49c1e0151900c2c3dea0ed8a8aab57bd91f28c5e (diff) | |
| download | NetworkManager-f1c15f0ae79cee417766f31eb94e004f52971f05.tar.gz | |
core: expose and rename nm_policy_device_recheck_auto_activate_schedule()
Let's simplify this part of the code. This is the first step.
| -rw-r--r-- | src/core/nm-policy.c | 25 | ||||
| -rw-r--r-- | src/core/nm-policy.h | 2 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c index b2ccb16478..e31ac222ab 100644 --- a/src/core/nm-policy.c +++ b/src/core/nm-policy.c @@ -136,7 +136,6 @@ _PRIV_TO_SELF(NMPolicyPrivate *priv) static void update_system_hostname(NMPolicy *self, const char *msg); static void schedule_activate_all(NMPolicy *self); -static void schedule_activate_check(NMPolicy *self, NMDevice *device); static NMDevice *get_default_device(NMPolicy *self, int addr_family); /*****************************************************************************/ @@ -1335,7 +1334,8 @@ pending_ac_state_changed(NMActiveConnection *ac, guint state, guint reason, NMPo con, NM_SETTINGS_AUTOCONNECT_BLOCKED_REASON_FAILED, TRUE); - schedule_activate_check(self, nm_active_connection_get_device(ac)); + nm_policy_device_recheck_auto_activate_schedule(self, + nm_active_connection_get_device(ac)); } /* Cleanup */ @@ -1444,7 +1444,7 @@ auto_activate_device(NMPolicy *self, NMDevice *device) best_connection, NM_SETTINGS_AUTOCONNECT_BLOCKED_REASON_FAILED, TRUE); - schedule_activate_check(self, device); + nm_policy_device_recheck_auto_activate_schedule(self, device); return; } @@ -1669,14 +1669,19 @@ sleeping_changed(NMManager *manager, GParamSpec *pspec, gpointer user_data) reset_autoconnect_all(self, NULL, FALSE); } -static void -schedule_activate_check(NMPolicy *self, NMDevice *device) +void +nm_policy_device_recheck_auto_activate_schedule(NMPolicy *self, NMDevice *device) { - NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self); + NMPolicyPrivate *priv; ActivateData *data; NMActiveConnection *ac; const CList *tmp_list; + g_return_if_fail(NM_IS_POLICY(self)); + g_return_if_fail(NM_IS_DEVICE(device)); + + priv = NM_POLICY_GET_PRIVATE(self); + if (nm_manager_get_state(priv->manager) == NM_STATE_ASLEEP) return; @@ -2138,7 +2143,7 @@ device_state_changed(NMDevice *device, update_routing_and_dns(self, FALSE, device); /* Device is now available for auto-activation */ - schedule_activate_check(self, device); + nm_policy_device_recheck_auto_activate_schedule(self, device); break; case NM_DEVICE_STATE_PREPARE: @@ -2262,7 +2267,7 @@ device_autoconnect_changed(NMDevice *device, GParamSpec *pspec, gpointer user_da NMPolicyPrivate *priv = user_data; NMPolicy *self = _PRIV_TO_SELF(priv); - schedule_activate_check(self, device); + nm_policy_device_recheck_auto_activate_schedule(self, device); } static void @@ -2271,7 +2276,7 @@ device_recheck_auto_activate(NMDevice *device, gpointer user_data) NMPolicyPrivate *priv = user_data; NMPolicy *self = _PRIV_TO_SELF(priv); - schedule_activate_check(self, device); + nm_policy_device_recheck_auto_activate_schedule(self, device); } static void @@ -2532,7 +2537,7 @@ schedule_activate_all_cb(gpointer user_data) priv->schedule_activate_all_id = 0; nm_manager_for_each_device (priv->manager, device, tmp_lst) - schedule_activate_check(self, device); + nm_policy_device_recheck_auto_activate_schedule(self, device); return G_SOURCE_REMOVE; } diff --git a/src/core/nm-policy.h b/src/core/nm-policy.h index f2b98dbd34..9cfb0b2448 100644 --- a/src/core/nm-policy.h +++ b/src/core/nm-policy.h @@ -34,6 +34,8 @@ NMActiveConnection *nm_policy_get_activating_ip6_ac(NMPolicy *policy); void nm_policy_unblock_failed_ovs_interfaces(NMPolicy *self); +void nm_policy_device_recheck_auto_activate_schedule(NMPolicy *self, NMDevice *device); + /** * NMPolicyHostnameMode * @NM_POLICY_HOSTNAME_MODE_NONE: never update the transient hostname. |
