From f3989ced4fc3f16ba3724a2360cd61b793168cb4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 25 Oct 2012 09:16:27 +0300 Subject: [PATCH] P2P: Add secondary device types into p2p_peer output This allows the P2P_PEER command to be used to fetch the list of secondary device types that each P2P peer has advertised. Signed-hostap: Jouni Malinen --- wpa_supplicant/ctrl_iface.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 8038b9c28..083543ded 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -3790,6 +3790,7 @@ static int p2p_ctrl_peer(struct wpa_supplicant *wpa_s, char *cmd, char *pos, *end; char devtype[WPS_DEV_TYPE_BUFSIZE]; struct wpa_ssid *ssid; + size_t i; if (!wpa_s->global->p2p) return -1; @@ -3843,6 +3844,18 @@ static int p2p_ctrl_peer(struct wpa_supplicant *wpa_s, char *cmd, return pos - buf; pos += res; + for (i = 0; i < info->wps_sec_dev_type_list_len / WPS_DEV_TYPE_LEN; i++) + { + const u8 *t; + t = &info->wps_sec_dev_type_list[i * WPS_DEV_TYPE_LEN]; + res = os_snprintf(pos, end - pos, "sec_dev_type=%s\n", + wps_dev_type_bin2str(t, devtype, + sizeof(devtype))); + if (res < 0 || res >= end - pos) + return pos - buf; + pos += res; + } + ssid = wpas_p2p_get_persistent(wpa_s, info->p2p_device_addr, NULL, 0); if (ssid) { res = os_snprintf(pos, end - pos, "persistent=%d\n", ssid->id);