]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Add secondary device types into p2p_peer output
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 25 Oct 2012 06:16:27 +0000 (09:16 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 25 Oct 2012 06:16:27 +0000 (09:16 +0300)
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 <jouni@qca.qualcomm.com>

wpa_supplicant/ctrl_iface.c

index 8038b9c28ba45807ca17c3972139b1a1578806c1..083543ded4a15c19ad572e0bea7a247109a15d64 100644 (file)
@@ -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);