diff options
author | Thomas Haller <thaller@redhat.com> | 2018-09-07 15:19:52 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-09-07 15:19:52 +0200 |
commit | d45e0b6558f6fd170432226ed5107536ca24e1b1 (patch) | |
tree | 8278699efdf7f6e24863bb83b0fd29eed71c936e | |
parent | 1df7ed0cbe9cd9d4a7f3a39e23d482850e68f725 (diff) | |
parent | 618568366de7d92cb849e4b2353fadfaeb43a365 (diff) | |
download | NetworkManager-d45e0b6558f6fd170432226ed5107536ca24e1b1.tar.gz |
wifi/iwd: merge branch 'balrog-kun/iwd-fixes' (partial)
https://github.com/NetworkManager/NetworkManager/pull/194
-rw-r--r-- | src/devices/wifi/nm-device-iwd.c | 2 | ||||
-rw-r--r-- | src/devices/wifi/nm-iwd-manager.c | 53 | ||||
-rw-r--r-- | src/devices/wifi/nm-iwd-manager.h | 3 |
3 files changed, 35 insertions, 23 deletions
diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c index 5781bf9a0c..a942883708 100644 --- a/src/devices/wifi/nm-device-iwd.c +++ b/src/devices/wifi/nm-device-iwd.c @@ -554,7 +554,7 @@ check_connection_available (NMDevice *device, /* Only Infrastrusture mode at this time */ mode = nm_setting_wireless_get_mode (s_wifi); - if (!NM_IN_SET (mode, NULL, NM_SETTING_WIRELESS_MODE_INFRA)) { + if (!NM_IN_STRSET (mode, NULL, NM_SETTING_WIRELESS_MODE_INFRA)) { nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY, "iwd only supports infrastructure mode connections"); return FALSE; diff --git a/src/devices/wifi/nm-iwd-manager.c b/src/devices/wifi/nm-iwd-manager.c index 2f7bd16091..1f28d2637c 100644 --- a/src/devices/wifi/nm-iwd-manager.c +++ b/src/devices/wifi/nm-iwd-manager.c @@ -611,6 +611,34 @@ object_added (NMIwdManager *self, GDBusObject *object) g_list_free_full (interfaces, g_object_unref); } +static void +release_object_manager (NMIwdManager *self) +{ + NMIwdManagerPrivate *priv = NM_IWD_MANAGER_GET_PRIVATE (self); + + if (!priv->object_manager) + return; + + g_signal_handlers_disconnect_by_data (priv->object_manager, self); + + if (priv->agent_id) { + GDBusConnection *agent_connection; + GDBusObjectManagerClient *omc = G_DBUS_OBJECT_MANAGER_CLIENT (priv->object_manager); + + agent_connection = g_dbus_object_manager_client_get_connection (omc); + + /* We're is called when we're shutting down (i.e. our DBus connection + * is being closed, and IWD will detect this) or IWD was stopped so + * in either case calling UnregisterAgent will not do anything. + */ + g_dbus_connection_unregister_object (agent_connection, priv->agent_id); + priv->agent_id = 0; + nm_clear_g_free (&priv->agent_path); + } + + g_clear_object (&priv->object_manager); +} + static void prepare_object_manager (NMIwdManager *self); static void @@ -623,8 +651,7 @@ name_owner_changed (GObject *object, GParamSpec *pspec, gpointer user_data) nm_assert (object_manager == priv->object_manager); if (_om_has_name_owner (object_manager)) { - g_signal_handlers_disconnect_by_data (object_manager, self); - g_clear_object (&priv->object_manager); + release_object_manager (self); prepare_object_manager (self); } else { const CList *tmp_lst; @@ -708,7 +735,7 @@ got_object_manager (GObject *object, GAsyncResult *result, gpointer user_data) &priv->agent_path, &error); if (!priv->agent_id) { - _LOGE ("failed to export the IWD Agent: PSK/8021x WiFi networks will not work: %s", + _LOGE ("failed to export the IWD Agent: PSK/8021x WiFi networks may not work: %s", error->message); g_clear_error (&error); } @@ -789,25 +816,7 @@ dispose (GObject *object) NMIwdManager *self = (NMIwdManager *) object; NMIwdManagerPrivate *priv = NM_IWD_MANAGER_GET_PRIVATE (self); - if (priv->object_manager) { - if (priv->agent_id) { - GDBusConnection *connection; - GDBusObjectManagerClient *omc = G_DBUS_OBJECT_MANAGER_CLIENT (priv->object_manager); - - /* No need to unregister the agent as IWD will detect - * our DBus connection being closed. - */ - - connection = g_dbus_object_manager_client_get_connection (omc); - - g_dbus_connection_unregister_object (connection, priv->agent_id); - priv->agent_id = 0; - } - - g_clear_object (&priv->object_manager); - } - - nm_clear_g_free (&priv->agent_path); + release_object_manager (self); nm_clear_g_cancellable (&priv->cancellable); diff --git a/src/devices/wifi/nm-iwd-manager.h b/src/devices/wifi/nm-iwd-manager.h index 59b70f6e36..cf0e7262cf 100644 --- a/src/devices/wifi/nm-iwd-manager.h +++ b/src/devices/wifi/nm-iwd-manager.h @@ -36,6 +36,9 @@ "net.connman.iwd.WiFiSimpleConfiguration" #define NM_IWD_KNOWN_NETWORK_INTERFACE "net.connman.iwd.KnownNetwork" #define NM_IWD_SIGNAL_AGENT_INTERFACE "net.connman.iwd.SignalLevelAgent" +#define NM_IWD_AP_INTERFACE "net.connman.iwd.AccessPoint" +#define NM_IWD_ADHOC_INTERFACE "net.connman.iwd.AdHoc" +#define NM_IWD_STATION_INTERFACE "net.connman.iwd.Station" #define NM_TYPE_IWD_MANAGER (nm_iwd_manager_get_type ()) #define NM_IWD_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_IWD_MANAGER, NMIwdManager)) |