P2P: Add test mode for SD to force fragmented response
authorJouni Malinen <jouni.malinen@atheros.com>
Tue, 29 Jun 2010 03:44:01 +0000 (20:44 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 14:17:19 +0000 (07:17 -0700)
wpa_supplicant/ctrl_iface.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 3d604f3..e330ed6 100644 (file)
@@ -2457,6 +2457,11 @@ static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd)
                return 0;
        }
 
+       if (os_strcmp(cmd, "force_long_sd") == 0) {
+               wpa_s->force_long_sd = atoi(param);
+               return 0;
+       }
+
        wpa_printf(MSG_DEBUG, "CTRL_IFACE: Unknown P2P_SET field value '%s'",
                   cmd);
 
@@ -2718,6 +2723,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
                        reply_len = -1;
        } else if (os_strcmp(buf, "P2P_FLUSH") == 0) {
                os_memset(wpa_s->p2p_auth_invite, 0, ETH_ALEN);
+               wpa_s->force_long_sd = 0;
                p2p_flush(wpa_s->global->p2p);
        } else if (os_strncmp(buf, "P2P_PRESENCE_REQ ", 17) == 0) {
                if (p2p_ctrl_presence_req(wpa_s, buf + 17) < 0)
index b5a7ab8..60e3baf 100644 (file)
@@ -1359,6 +1359,15 @@ void wpas_sd_request(void *ctx, int freq, const u8 *sa, u8 dialog_token,
                wpa_hexdump(MSG_MSGDUMP, "P2P: Query Data",
                            pos, tlv_end - pos);
 
+
+               if (wpa_s->force_long_sd) {
+                       wpa_printf(MSG_DEBUG, "P2P: SD test - force long "
+                                  "response");
+                       wpas_sd_all_bonjour(wpa_s, resp, srv_trans_id);
+                       wpas_sd_all_upnp(wpa_s, resp, srv_trans_id);
+                       goto done;
+               }
+
                switch (srv_proto) {
                case P2P_SERV_ALL_SERVICES:
                        wpa_printf(MSG_DEBUG, "P2P: Service Discovery Request "
@@ -1394,6 +1403,7 @@ void wpas_sd_request(void *ctx, int freq, const u8 *sa, u8 dialog_token,
                pos = tlv_end;
        }
 
+done:
        wpas_p2p_sd_response(wpa_s, freq, sa, dialog_token, resp);
 
        wpabuf_free(resp);
index f272a60..534ce94 100644 (file)
@@ -485,6 +485,7 @@ struct wpa_supplicant {
        u8 pending_join_dev_addr[ETH_ALEN];
        int pending_join_wps_method;
        unsigned int roc_waiting_drv_freq;
+       int force_long_sd;
 #endif /* CONFIG_P2P */
 
        struct wpa_ssid *bgscan_ssid;