[PATCH] dbus: Expose group's GO device address

Emilio Cobos Álvarez emilio at crisal.io
Sat Aug 16 12:12:29 PDT 2025


This is already exposed, in a round-about way, via the "PeerGO" property
of the P2PDevice interface.

However, that is rather broken, in the sense that it logically doesn't
belong there, (see the docs which already point it out), and also in the
sense that wpa_supplicant doesn't notify when the property changes,
which confuses clients which cache DBus properties (all of them?).

Instead, expose the GO dev address directly. This is useful to be able
to map back from the group to the GO's peer object (or self).

I didn't manage to get the hwsim tests running on my machine, though
testing this should be trivial-ish. I did test this manually, too...

Signed-off-by: Emilio Cobos Álvarez <emilio at crisal.io>
---
 doc/dbus.doxygen                            |  5 +++++
 wpa_supplicant/dbus/dbus_new.c              |  5 +++++
 wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 11 +++++++++++
 wpa_supplicant/dbus/dbus_new_handlers_p2p.h |  1 +
 4 files changed, 22 insertions(+)

diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index 8c0c45ab1..68c3cb784 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -2633,6 +2633,11 @@ Interface implemented by objects representing active P2P groups.
     <h3>WPSVendorExtensions - aay - (read/write)</h3>
     <p>WPS vendor extension attributes used on the GO. This is valid only the in the GO role. An empty array is returned in P2P Client role. At maximum, 10 separate vendor extension byte arrays can be configured. The GO device will include the configured attributes in WPS exchanges.</p>
   </li>
+
+  <li>
+    <h3>GODeviceAddress - ay - (read)</h3>
+    <p>Returns the device address of the GO of the group. This is available for both client and GO roles.</p>
+  </li>
 </ul>
 
 \subsection dbus_group_signals Signals
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index fa81c61cf..2d623fe8d 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -5124,6 +5124,11 @@ static const struct wpa_dbus_property_desc wpas_dbus_p2p_group_properties[] = {
 	  wpas_dbus_setter_p2p_group_vendor_ext,
 	  NULL
 	},
+	{ "GODeviceAddress", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "o",
+	  wpas_dbus_getter_p2p_group_go_device_address,
+	  NULL,
+	  NULL
+	},
 	{ NULL, NULL, NULL, NULL, NULL, NULL }
 };
 
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index fec16b4cc..8e04284ab 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -2595,6 +2595,17 @@ dbus_bool_t wpas_dbus_getter_p2p_group_vendor_ext(
 }
 
 
+dbus_bool_t wpas_dbus_getter_p2p_group_go_device_address(
+	const struct wpa_dbus_property_desc *property_desc,
+	DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	return wpas_dbus_simple_array_property_getter(
+		iter, DBUS_TYPE_BYTE, wpa_s->go_dev_addr,
+		ETH_ALEN, error);
+}
+
+
 dbus_bool_t wpas_dbus_setter_p2p_group_vendor_ext(
 	const struct wpa_dbus_property_desc *property_desc,
 	DBusMessageIter *iter, DBusError *error, void *user_data)
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
index 4644812cf..6d37078c7 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
@@ -128,6 +128,7 @@ DECLARE_ACCESSOR(wpas_dbus_getter_p2p_group_passphrase);
 DECLARE_ACCESSOR(wpas_dbus_getter_p2p_group_psk);
 DECLARE_ACCESSOR(wpas_dbus_getter_p2p_group_vendor_ext);
 DECLARE_ACCESSOR(wpas_dbus_setter_p2p_group_vendor_ext);
+DECLARE_ACCESSOR(wpas_dbus_getter_p2p_group_go_device_address);
 
 /*
  * P2P Persistent Groups and properties
-- 
2.50.1




More information about the Hostap mailing list