[PATCH] [PATCH] P2P D-Bus: Use Persistent Group instead of Network object

Jean-Michel Bachot jean-michelx.bachot
Mon Jan 16 02:41:07 PST 2012


Fix the follwing issue in P2P D-Bus API :
When a persistent group is started, wpa_supplicant does not create a
network object but a persistent group object instead.
Hence, emit the network oject wihtin the group started signal
in this case does not make sense and is an error.
Fix is to emit the persistent group object registered instead of
network object in case of persistent group started.

Signed-off-by: Jean-Michel Bachot <jean-michelx.bachot at intel.com>
---
 wpa_supplicant/dbus/dbus_new.c |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 2bf9be8..6fd86ba 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -984,6 +984,8 @@ void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
 	struct wpas_dbus_priv *iface;
 	char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
 	char group_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
+	char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
+	dbus_bool_t persistent_group = FALSE;
 
 	iface = wpa_s->parent->global->dbus;
 
@@ -1020,14 +1022,27 @@ void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
 					 client ? "client" : "GO"))
 		goto nomem;
 
-	os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
-		    "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
-		    wpa_s->parent->dbus_new_path, network_id);
+	/*
+	 * If it is a persistent group register it as such.
+	 * This is to handle cases where an interface is being initialized
+	 * with a list of networks read from config.
+	 */
+	if (network_is_persistent_group((struct wpa_ssid *)ssid)) {
+		persistent_group = TRUE;
+		os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
+			    "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u",
+			    wpa_s->parent->dbus_new_path, network_id);
+	} else {
+		os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
+			    "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
+			    wpa_s->parent->dbus_new_path, network_id);
+	}
 
 	if (!wpa_dbus_dict_append_object_path(&dict_iter, "group_object",
 					     group_obj_path) ||
-	   !wpa_dbus_dict_append_object_path(&dict_iter, "network_object",
-					     net_obj_path) ||
+	   !wpa_dbus_dict_append_object_path(&dict_iter,
+		persistent_group ? "persistent_group_object" : "network_object",
+		persistent_group ? pgrp_obj_path : net_obj_path) ||
 	   !wpa_dbus_dict_close_write(&iter, &dict_iter))
 		goto nomem;
 
-- 
1.7.0.4

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.




More information about the Hostap mailing list