]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Add sending of BSS Transition Management Query
authorVinayak Kamath <vkamat@codeaurora.org>
Thu, 16 May 2013 14:50:31 +0000 (17:50 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 16 May 2013 14:50:31 +0000 (17:50 +0300)
The new control interface command can be used to send a
BSS Transition Management Query frame to the current AP.

Signed-hostap: Vinayak Kamath <vkamat@codeaurora.org>

src/common/ieee802_11_defs.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/wnm_sta.c
wpa_supplicant/wnm_sta.h
wpa_supplicant/wpa_cli.c

index ba057b627a624fe232091a9ccfdd419c111e1eaf..0848590258b4b6a2032c728513eebdfa25956cd9 100644 (file)
@@ -549,6 +549,14 @@ struct ieee80211_mgmt {
                                         * Entries (optional) */
                                        u8 variable[0];
                                } STRUCT_PACKED bss_tm_resp;
+                               struct {
+                                       u8 action; /* 6 */
+                                       u8 dialog_token;
+                                       u8 query_reason;
+                                       /* BSS Transition Candidate List
+                                        * Entries (optional) */
+                                       u8 variable[0];
+                               } STRUCT_PACKED bss_tm_query;
                        } u;
                } STRUCT_PACKED action;
        } u;
index a422a7bcfd2f33e53e6210c3dbeac309be6860f5..1bfdb02de75153ea68a0f86d8222e0dc143065bc 100644 (file)
@@ -4975,6 +4975,19 @@ static int wpas_ctrl_iface_wnm_sleep(struct wpa_supplicant *wpa_s, char *cmd)
        return ret;
 }
 
+
+static int wpas_ctrl_iface_wnm_bss_query(struct wpa_supplicant *wpa_s, char *cmd)
+{
+       int query_reason;
+
+       query_reason = atoi(cmd);
+
+       wpa_printf(MSG_DEBUG, "CTRL_IFACE: WNM_BSS_QUERY query_reason=%d",
+                  query_reason);
+
+       return wnm_send_bss_transition_mgmt_query(wpa_s, query_reason);
+}
+
 #endif /* CONFIG_WNM */
 
 
@@ -5589,6 +5602,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
        } else if (os_strncmp(buf, "WNM_SLEEP ", 10) == 0) {
                if (wpas_ctrl_iface_wnm_sleep(wpa_s, buf + 10))
                        reply_len = -1;
+       } else if (os_strncmp(buf, "WNM_BSS_QUERY ", 10) == 0) {
+               if (wpas_ctrl_iface_wnm_bss_query(wpa_s, buf + 10))
+                               reply_len = -1;
 #endif /* CONFIG_WNM */
        } else if (os_strcmp(buf, "FLUSH") == 0) {
                wpa_supplicant_ctrl_iface_flush(wpa_s);
index 53afcdaa7162c917988187bd90bf4a3157212dd4..7de96c541c2778d1ebd4da770ef347f70879586a 100644 (file)
@@ -681,6 +681,41 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
 }
 
 
+int wnm_send_bss_transition_mgmt_query(struct wpa_supplicant *wpa_s,
+                                      u8 query_reason)
+{
+       u8 buf[1000], *pos;
+       struct ieee80211_mgmt *mgmt;
+       size_t len;
+       int ret;
+
+       wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Query to "
+                  MACSTR " query_reason=%u",
+                  MAC2STR(wpa_s->bssid), query_reason);
+
+       mgmt = (struct ieee80211_mgmt *) buf;
+       os_memset(&buf, 0, sizeof(buf));
+       os_memcpy(mgmt->da, wpa_s->bssid, ETH_ALEN);
+       os_memcpy(mgmt->sa, wpa_s->own_addr, ETH_ALEN);
+       os_memcpy(mgmt->bssid, wpa_s->bssid, ETH_ALEN);
+       mgmt->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
+                                          WLAN_FC_STYPE_ACTION);
+       mgmt->u.action.category = WLAN_ACTION_WNM;
+       mgmt->u.action.u.bss_tm_query.action = WNM_BSS_TRANS_MGMT_QUERY;
+       mgmt->u.action.u.bss_tm_query.dialog_token = 0;
+       mgmt->u.action.u.bss_tm_query.query_reason = query_reason;
+       pos = mgmt->u.action.u.bss_tm_query.variable;
+
+       len = pos - (u8 *) &mgmt->u.action.category;
+
+       ret = wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid,
+                                 wpa_s->own_addr, wpa_s->bssid,
+                                 &mgmt->u.action.category, len, 0);
+
+       return ret;
+}
+
+
 void ieee802_11_rx_wnm_action(struct wpa_supplicant *wpa_s,
                              struct rx_action *action)
 {
index e3d17dca5b6d0a9f91fb82382a75758a4b493c7b..2933926c0908d003d02ac1bb262a7a9460ab6151 100644 (file)
@@ -83,6 +83,8 @@ void ieee802_11_rx_wnm_action(struct wpa_supplicant *wpa_s,
 void wnm_scan_response(struct wpa_supplicant *wpa_s,
                       struct wpa_scan_results *scan_res);
 
+int wnm_send_bss_transition_mgmt_query(struct wpa_supplicant *wpa_s,
+                                      u8 query_reason);
 void wnm_deallocate_memory(struct wpa_supplicant *wpa_s);
 
 #endif /* WNM_STA_H */
index d2d5dd9f93507973841404b5f1ddcbae44aec55a..0727e921b2c7dd210ea0992996f754c6622cbfd8 100644 (file)
@@ -2293,6 +2293,12 @@ static int wpa_cli_cmd_wnm_sleep(struct wpa_ctrl *ctrl, int argc, char *argv[])
        return wpa_cli_cmd(ctrl, "WNM_SLEEP", 0, argc, argv);
 }
 
+
+static int wpa_cli_cmd_wnm_bss_query(struct wpa_ctrl *ctrl, int argc, char *argv[])
+{
+       return wpa_cli_cmd(ctrl, "WNM_BSS_QUERY", 1, argc, argv);
+}
+
 #endif /* CONFIG_WNM */
 
 
@@ -2754,6 +2760,8 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
 #ifdef CONFIG_WNM
        { "wnm_sleep", wpa_cli_cmd_wnm_sleep, NULL, cli_cmd_flag_none,
          "<enter/exit> [interval=#] = enter/exit WNM-Sleep mode" },
+       { "wnm_bss_query", wpa_cli_cmd_wnm_bss_query, NULL, cli_cmd_flag_none,
+         "<query reason> = Send BSS Transition Management Query" },
 #endif /* CONFIG_WNM */
        { "raw", wpa_cli_cmd_raw, NULL, cli_cmd_flag_sensitive,
          "<params..> = Sent unprocessed command" },