]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
dbus: Expose P2P group's GO device address
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 16 Aug 2025 19:12:29 +0000 (21:12 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 29 Sep 2025 16:45:15 +0000 (19:45 +0300)
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@crisal.io>
doc/dbus.doxygen
wpa_supplicant/dbus/dbus_new.c
wpa_supplicant/dbus/dbus_new_handlers_p2p.c
wpa_supplicant/dbus/dbus_new_handlers_p2p.h

index 2af405f2c7a91b00d65355cf2cf7f24231e1b67e..7ca89918d5d1e208f42be27152bd43312798f5a7 100644 (file)
@@ -2629,6 +2629,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
index 0c5cfdf44dd3ba3070231900ecdb7e8ca25000e2..508c4842cbcee88ef053b40e2e297bcd37630e7c 100644 (file)
@@ -5119,6 +5119,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 }
 };
 
index 129f359341f7d0dde9796656db2fee6979d6236d..6e40ffc4cf2d3d6da96e486f11255a5c68d25b36 100644 (file)
@@ -2580,6 +2580,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)
index b3c45c11012c4d836ab3f31f1bc5b265d39aea18..3bcf8679e2ab887d4ca79c39f1745b95f0173f18 100644 (file)
@@ -127,6 +127,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