aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/notify.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-02-07 14:17:11 (GMT)
committerJouni Malinen <j@w1.fi>2015-02-07 14:19:08 (GMT)
commit1e529832a800768c77cd586e29ccb69c17384580 (patch)
treef75e3f079d7e2f2686644219d65c173f9bfbe533 /wpa_supplicant/notify.c
parentc62bd5e44d61e7d093bee49297444ef70f3a7545 (diff)
downloadhostap-1e529832a800768c77cd586e29ccb69c17384580.zip
hostap-1e529832a800768c77cd586e29ccb69c17384580.tar.gz
hostap-1e529832a800768c77cd586e29ccb69c17384580.tar.bz2
D-Bus: Fix network block type change
It is possible for a network profile to change its type from P2P persistent group to a normal network and back. The D-Bus interface uses different types of objects for those, so the object needs to re-registered in case of type change. This fixes issues in leaving behind an incorrect type of object and leaking memory when freeing such a network block that has had its disabled parameter changed. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/notify.c')
-rw-r--r--wpa_supplicant/notify.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index bf1836a..ea7dbdb 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -764,3 +764,22 @@ void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
wpa_drv_roaming(wpa_s, !ssid->bssid_set,
ssid->bssid_set ? ssid->bssid : NULL);
}
+
+
+void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid)
+{
+#ifdef CONFIG_P2P
+ if (ssid->disabled == 2) {
+ /* Changed from normal network profile to persistent group */
+ ssid->disabled = 0;
+ wpas_dbus_unregister_network(wpa_s, ssid->id);
+ ssid->disabled = 2;
+ wpas_dbus_register_persistent_group(wpa_s, ssid);
+ } else {
+ /* Changed from persistent group to normal network profile */
+ wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
+ wpas_dbus_register_network(wpa_s, ssid);
+ }
+#endif /* CONFIG_P2P */
+}