From f5ff2b6ca38d003971d4e6c8bb1b142e37b27787 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 15 Aug 2007 19:55:04 +0000 Subject: [PATCH] 2007-08-15 Dan Williams * src/supplicant-manager/nm-supplicant-interface.c - (try_remove_iface): new function, ask wpa_supplicant to remove an interface - (nm_supplicant_interface_dispose): call try_remove_iface() when disposing of the NMSupplicantInterface. Otherwise weird stuff happens on hotplug if wpa_supplicant doesn't tear down and readd the interface internally git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2699 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 10 ++++++ .../nm-supplicant-interface.c | 32 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8ff6fa777c..21946850b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-08-15 Dan Williams + + * src/supplicant-manager/nm-supplicant-interface.c + - (try_remove_iface): new function, ask wpa_supplicant to remove + an interface + - (nm_supplicant_interface_dispose): call try_remove_iface() when + disposing of the NMSupplicantInterface. Otherwise weird stuff + happens on hotplug if wpa_supplicant doesn't tear down and readd + the interface internally + 2007-08-15 Dan Williams * src/nm-device-802-11-wireless.c diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c index 58af5dd2b6..a1f09505c2 100644 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ b/src/supplicant-manager/nm-supplicant-interface.c @@ -102,6 +102,7 @@ typedef struct char * dev; gboolean is_wireless; + char * object_path; guint32 state; NMCallStore * assoc_pcalls; NMCallStore * other_pcalls; @@ -279,10 +280,30 @@ nm_supplicant_interface_get_property (GObject * object, } } +static void +try_remove_iface (DBusGConnection * g_connection, + const char * path) +{ + DBusGProxy * proxy; + + proxy = dbus_g_proxy_new_for_name (g_connection, + WPAS_DBUS_SERVICE, + WPAS_DBUS_PATH, + WPAS_DBUS_INTERFACE); + if (!proxy) + return; + + dbus_g_proxy_call_no_reply (proxy, "removeInterface", + DBUS_TYPE_G_OBJECT_PATH, path, + G_TYPE_INVALID); + g_object_unref (proxy); +} + static void nm_supplicant_interface_dispose (GObject *object) { NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (object); + guint32 sm_state; if (priv->dispose_has_run) { /* If dispose did already run, return. */ @@ -299,6 +320,13 @@ nm_supplicant_interface_dispose (GObject *object) * reference. */ + /* Ask wpa_supplicant to remove this interface */ + sm_state = nm_supplicant_manager_get_state (priv->smgr); + if (sm_state == NM_SUPPLICANT_MANAGER_STATE_IDLE) { + try_remove_iface (nm_dbus_manager_get_connection (priv->dbus_mgr), + priv->object_path); + } + if (priv->iface_proxy) g_object_unref (priv->iface_proxy); @@ -329,6 +357,8 @@ nm_supplicant_interface_dispose (GObject *object) if (priv->cfg) g_object_unref (priv->cfg); + g_free (priv->object_path); + /* Chain up to the parent class */ G_OBJECT_CLASS (nm_supplicant_interface_parent_class)->dispose (object); } @@ -677,6 +707,8 @@ nm_supplicant_interface_add_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpoi } else { NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (info->interface); + priv->object_path = g_strdup (path); + priv->iface_proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr), WPAS_DBUS_SERVICE, path,