[PATCH] expose peer interface address in P2P peer dbus property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Expose peer interface address in the dbus property so that platform can
correlate this value with the IP address assigned to the clients.

Signed-off-by: Jintao Lin <jintaolin@xxxxxxxxxxxx>
---
 doc/dbus.doxygen                            |  5 +++++
 wpa_supplicant/dbus/dbus_new.c              |  5 +++++
 wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 19 +++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers_p2p.h |  1 +
 4 files changed, 30 insertions(+)

diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index ee3b0ca2c..76ff51117 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -2296,6 +2296,11 @@ Interface implemented by objects representing P2P peer devices.
     <p>The P2P Device Address of the peer.</p>
   </li>
 
+  <li>
+    <h3>InterfaceAddress - ay - (read)</h3>
+    <p>The P2P Interface Address of the peer.</p>
+  </li>
+
   <li>
     <h3>Groups - ao - (read)</h3>
     <p>The current groups in which this peer is connected.</p>
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 8fc29b398..4e6780ce0 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -4545,6 +4545,11 @@ static const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = {
 	  NULL,
 	  NULL
 	},
+	{ "InterfaceAddress", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
+	  wpas_dbus_getter_p2p_peer_interface_address,
+	  NULL,
+	  NULL
+	},
 	{ "Groups", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ao",
 	  wpas_dbus_getter_p2p_peer_groups,
 	  NULL,
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index ad5d47462..4bd754095 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -1898,6 +1898,25 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_ies(
 }
 
 
+dbus_bool_t wpas_dbus_getter_p2p_peer_interface_address(
+	const struct wpa_dbus_property_desc *property_desc,
+	DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+	struct peer_handler_args *peer_args = user_data;
+	u8 iface_addr[ETH_ALEN];
+
+	if (p2p_get_interface_addr(peer_args->wpa_s->global->p2p,
+				   peer_args->p2p_device_addr, iface_addr) < 0) {
+		dbus_set_error(error, DBUS_ERROR_FAILED,
+			       "failed to find peer");
+		return FALSE;
+	}
+
+	return wpas_dbus_simple_array_property_getter(
+		iter, DBUS_TYPE_BYTE, iface_addr, ETH_ALEN, error);
+}
+
+
 dbus_bool_t wpas_dbus_getter_p2p_peer_device_address(
 	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 b3c45c110..beddc8e7a 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
@@ -113,6 +113,7 @@ DECLARE_ACCESSOR(wpas_dbus_getter_p2p_peer_secondary_device_types);
 DECLARE_ACCESSOR(wpas_dbus_getter_p2p_peer_vendor_extension);
 DECLARE_ACCESSOR(wpas_dbus_getter_p2p_peer_ies);
 DECLARE_ACCESSOR(wpas_dbus_getter_p2p_peer_device_address);
+DECLARE_ACCESSOR(wpas_dbus_getter_p2p_peer_interface_address);
 DECLARE_ACCESSOR(wpas_dbus_getter_p2p_peer_groups);
 DECLARE_ACCESSOR(wpas_dbus_getter_p2p_peer_vsie);
 
-- 
2.43.0.472.g3155946c3a-goog


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux