]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Allow specifying dialog token for BSS transition request
authorDavid Bauer <mail@david-bauer.net>
Wed, 6 Oct 2021 00:21:46 +0000 (02:21 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 22 Oct 2021 14:11:36 +0000 (17:11 +0300)
Adds the ability to specify the dialog token of a WNM BSS Transition
Management Request frame via the hostapd control interface.

For this, the new 'dialog_token' option can be used with the BSS_TM_REQ
command. It accepts values as an 8 bit unsigned integer. If not
specified, the dialog token is set to 1 like before.

Signed-off-by: David Bauer <mail@david-bauer.net>
hostapd/ctrl_iface.c
src/ap/wnm_ap.c
src/ap/wnm_ap.h

index 280e94fec66bc7b767015099d86e9fc0c24f7c73..128fa9538f981f64fb7130ffdf8b6a68c220a2ea 100644 (file)
@@ -840,7 +840,7 @@ static int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
        const char *pos, *end;
        int disassoc_timer = 0;
        struct sta_info *sta;
-       u8 req_mode = 0, valid_int = 0x01;
+       u8 req_mode = 0, valid_int = 0x01, dialog_token = 0x01;
        u8 bss_term_dur[12];
        char *url = NULL;
        int ret;
@@ -878,6 +878,12 @@ static int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
                valid_int = atoi(pos);
        }
 
+       pos = os_strstr(cmd, " dialog_token=");
+       if (pos) {
+               pos += 14;
+               dialog_token = atoi(pos);
+       }
+
        pos = os_strstr(cmd, " bss_term=");
        if (pos) {
                pos += 10;
@@ -984,7 +990,7 @@ static int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
 #endif /* CONFIG_MBO */
 
        ret = wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer,
-                                 valid_int, bss_term_dur, url,
+                                 valid_int, bss_term_dur, dialog_token, url,
                                  nei_len ? nei_rep : NULL, nei_len,
                                  mbo_len ? mbo : NULL, mbo_len);
 #ifdef CONFIG_MBO
index d32967e6cef66322bf726e818ab9952d8c262570..0042ed6a115a233af7e62e73b6264f6bd518d998 100644 (file)
@@ -788,8 +788,8 @@ int wnm_send_ess_disassoc_imminent(struct hostapd_data *hapd,
 
 int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta,
                        u8 req_mode, int disassoc_timer, u8 valid_int,
-                       const u8 *bss_term_dur, const char *url,
-                       const u8 *nei_rep, size_t nei_rep_len,
+                       const u8 *bss_term_dur, u8 dialog_token,
+                       const char *url, const u8 *nei_rep, size_t nei_rep_len,
                        const u8 *mbo_attrs, size_t mbo_len)
 {
        u8 *buf, *pos;
@@ -797,8 +797,10 @@ int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta,
        size_t url_len;
 
        wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request to "
-                  MACSTR " req_mode=0x%x disassoc_timer=%d valid_int=0x%x",
-                  MAC2STR(sta->addr), req_mode, disassoc_timer, valid_int);
+                  MACSTR
+                  " req_mode=0x%x disassoc_timer=%d valid_int=0x%x dialog_token=%u",
+                  MAC2STR(sta->addr), req_mode, disassoc_timer, valid_int,
+                  dialog_token);
        buf = os_zalloc(1000 + nei_rep_len + mbo_len);
        if (buf == NULL)
                return -1;
@@ -810,7 +812,7 @@ int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta,
        os_memcpy(mgmt->bssid, hapd->own_addr, ETH_ALEN);
        mgmt->u.action.category = WLAN_ACTION_WNM;
        mgmt->u.action.u.bss_tm_req.action = WNM_BSS_TRANS_MGMT_REQ;
-       mgmt->u.action.u.bss_tm_req.dialog_token = 1;
+       mgmt->u.action.u.bss_tm_req.dialog_token = dialog_token;
        mgmt->u.action.u.bss_tm_req.req_mode = req_mode;
        mgmt->u.action.u.bss_tm_req.disassoc_timer =
                host_to_le16(disassoc_timer);
index 1806ba0e0525b20a6b521e93545eaf8ae66a3266..f86c6b2afabfb3115582a0127e933858c2c2ea18 100644 (file)
@@ -20,8 +20,8 @@ int wnm_send_ess_disassoc_imminent(struct hostapd_data *hapd,
                                   int disassoc_timer);
 int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta,
                        u8 req_mode, int disassoc_timer, u8 valid_int,
-                       const u8 *bss_term_dur, const char *url,
-                       const u8 *nei_rep, size_t nei_rep_len,
+                       const u8 *bss_term_dur, u8 dialog_token,
+                       const char *url, const u8 *nei_rep, size_t nei_rep_len,
                        const u8 *mbo_attrs, size_t mbo_len);
 void ap_sta_reset_steer_flag_timer(void *eloop_ctx, void *timeout_ctx);
 int wnm_send_coloc_intf_req(struct hostapd_data *hapd, struct sta_info *sta,