firewall4: update to latest Git HEAD
[openwrt/staging/mkresin.git] / package / network / services / hostapd / patches / 550-WNM-allow-specifying-dialog-token.patch
1 From 1b26807938815d0b0b266caf31d8ef0019607e64 Mon Sep 17 00:00:00 2001
2 From: David Bauer <mail@david-bauer.net>
3 Date: Mon, 27 Sep 2021 15:41:48 +0200
4 Subject: [PATCH] WNM: allow specifying dialog-token
5
6 This commit adds the ability to specify the dialog token of a WNM BSS
7 Transition request frame via the hostapd control socket.
8
9 FOr this, the new 'dialog_token' option can be used. It accepts values
10 as a 8 bit unsigned integer. If not specified, the dialog token is set
11 to 1 like before.
12
13 Signed-off-by: David Bauer <mail@david-bauer.net>
14 ---
15 hostapd/ctrl_iface.c | 10 ++++++++--
16 src/ap/wnm_ap.c | 11 ++++++-----
17 src/ap/wnm_ap.h | 4 ++--
18 3 files changed, 16 insertions(+), 9 deletions(-)
19
20 --- a/hostapd/ctrl_iface.c
21 +++ b/hostapd/ctrl_iface.c
22 @@ -897,7 +897,7 @@ static int hostapd_ctrl_iface_bss_tm_req
23 const char *pos, *end;
24 int disassoc_timer = 0;
25 struct sta_info *sta;
26 - u8 req_mode = 0, valid_int = 0x01;
27 + u8 req_mode = 0, valid_int = 0x01, dialog_token = 0x01;
28 u8 bss_term_dur[12];
29 char *url = NULL;
30 int ret;
31 @@ -935,6 +935,12 @@ static int hostapd_ctrl_iface_bss_tm_req
32 valid_int = atoi(pos);
33 }
34
35 + pos = os_strstr(cmd, " dialog_token=");
36 + if (pos) {
37 + pos += 14;
38 + dialog_token = atoi(pos);
39 + }
40 +
41 pos = os_strstr(cmd, " bss_term=");
42 if (pos) {
43 pos += 10;
44 @@ -1041,7 +1047,7 @@ static int hostapd_ctrl_iface_bss_tm_req
45 #endif /* CONFIG_MBO */
46
47 ret = wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer,
48 - valid_int, bss_term_dur, url,
49 + valid_int, bss_term_dur, dialog_token, url,
50 nei_len ? nei_rep : NULL, nei_len,
51 mbo_len ? mbo : NULL, mbo_len);
52 #ifdef CONFIG_MBO
53 --- a/src/ap/wnm_ap.c
54 +++ b/src/ap/wnm_ap.c
55 @@ -788,8 +788,8 @@ int wnm_send_ess_disassoc_imminent(struc
56
57 int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta,
58 u8 req_mode, int disassoc_timer, u8 valid_int,
59 - const u8 *bss_term_dur, const char *url,
60 - const u8 *nei_rep, size_t nei_rep_len,
61 + const u8 *bss_term_dur, u8 dialog_token,
62 + const char *url, const u8 *nei_rep, size_t nei_rep_len,
63 const u8 *mbo_attrs, size_t mbo_len)
64 {
65 u8 *buf, *pos;
66 @@ -797,8 +797,9 @@ int wnm_send_bss_tm_req(struct hostapd_d
67 size_t url_len;
68
69 wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request to "
70 - MACSTR " req_mode=0x%x disassoc_timer=%d valid_int=0x%x",
71 - MAC2STR(sta->addr), req_mode, disassoc_timer, valid_int);
72 + MACSTR " req_mode=0x%x disassoc_timer=%d valid_int=0x%x "
73 + "dialog_token=%x",
74 + MAC2STR(sta->addr), req_mode, disassoc_timer, valid_int, dialog_token);
75 buf = os_zalloc(1000 + nei_rep_len + mbo_len);
76 if (buf == NULL)
77 return -1;
78 @@ -810,7 +811,7 @@ int wnm_send_bss_tm_req(struct hostapd_d
79 os_memcpy(mgmt->bssid, hapd->own_addr, ETH_ALEN);
80 mgmt->u.action.category = WLAN_ACTION_WNM;
81 mgmt->u.action.u.bss_tm_req.action = WNM_BSS_TRANS_MGMT_REQ;
82 - mgmt->u.action.u.bss_tm_req.dialog_token = 1;
83 + mgmt->u.action.u.bss_tm_req.dialog_token = dialog_token;
84 mgmt->u.action.u.bss_tm_req.req_mode = req_mode;
85 mgmt->u.action.u.bss_tm_req.disassoc_timer =
86 host_to_le16(disassoc_timer);
87 --- a/src/ap/wnm_ap.h
88 +++ b/src/ap/wnm_ap.h
89 @@ -20,8 +20,8 @@ int wnm_send_ess_disassoc_imminent(struc
90 int disassoc_timer);
91 int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta,
92 u8 req_mode, int disassoc_timer, u8 valid_int,
93 - const u8 *bss_term_dur, const char *url,
94 - const u8 *nei_rep, size_t nei_rep_len,
95 + const u8 *bss_term_dur, u8 dialog_token,
96 + const char *url, const u8 *nei_rep, size_t nei_rep_len,
97 const u8 *mbo_attrs, size_t mbo_len);
98 void ap_sta_reset_steer_flag_timer(void *eloop_ctx, void *timeout_ctx);
99 int wnm_send_coloc_intf_req(struct hostapd_data *hapd, struct sta_info *sta,