[PATCH 1/7] dbus: Provide the interface address of the peer

Tomasz Bursztyka tomasz.bursztyka
Tue May 20 04:51:08 PDT 2014


This info will be useful once paired with the peer.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka at linux.intel.com>
---
 wpa_supplicant/dbus/dbus_new.c              |  4 ++++
 wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 23 +++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers_p2p.h |  4 ++++
 3 files changed, 31 insertions(+)

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 6bd2a40..881082a 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3271,6 +3271,10 @@ static const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = {
 	  wpas_dbus_getter_p2p_peer_device_address,
 	  NULL
 	},
+	{ "InterfaceAddress", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
+	  wpas_dbus_getter_p2p_peer_interface_address,
+	  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 20cbeed..f76e2b6 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -1520,6 +1520,29 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_device_address(DBusMessageIter *iter,
 		ETH_ALEN, error);
 }
 
+dbus_bool_t wpas_dbus_getter_p2p_peer_interface_address(DBusMessageIter *iter,
+							DBusError *error,
+							void *user_data)
+{
+	struct peer_handler_args *peer_args = user_data;
+	const struct p2p_peer_info *info;
+	u8 iface_addr[ETH_ALEN] = {};
+
+	info = p2p_get_peer_info(peer_args->wpa_s->global->p2p,
+				 peer_args->p2p_device_addr, 0);
+	if (info == NULL) {
+		dbus_set_error(error, DBUS_ERROR_FAILED,
+			       "failed to find peer");
+		return FALSE;
+	}
+
+	p2p_get_interface_addr(peer_args->wpa_s->global->p2p,
+			       info->p2p_device_addr, iface_addr);
+
+	return wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
+						      (char *) iface_addr,
+						      ETH_ALEN, error);
+}
 
 /**
  * wpas_dbus_getter_persistent_groups - Get array of persistent group objects
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
index 67e0e9d..3f1b577 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
@@ -151,6 +151,10 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_device_address(DBusMessageIter *iter,
 						     DBusError *error,
 						     void *user_data);
 
+dbus_bool_t wpas_dbus_getter_p2p_peer_interface_address(DBusMessageIter *iter,
+							DBusError *error,
+							void *user_data);
+
 /*
  * P2P Group properties
  */
-- 
1.8.3.2




More information about the Hostap mailing list