aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2021-09-27 15:53:25 +0200
committerDavid Bauer <mail@david-bauer.net>2021-12-20 00:15:03 +0100
commitdd39249f086e1428f68c6f9f435daa641eecf6e8 (patch)
treee72740f8118a2afe04012a2670633dbe421dbed3 /package/network/services
parentb1d483b865d0a6110d95a0638903a73c7354865a (diff)
downloadupstream-dd39249f086e1428f68c6f9f435daa641eecf6e8.tar.gz
upstream-dd39249f086e1428f68c6f9f435daa641eecf6e8.tar.bz2
upstream-dd39249f086e1428f68c6f9f435daa641eecf6e8.zip
hostapd: WNM: allow specifying dialog-token
Backport a patch to allow extending the ubus BSS-transition method for specifying individual dialog tokens for BSS transition management requests. This is required for handling BSS transition queries in the future. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'package/network/services')
-rw-r--r--package/network/services/hostapd/patches/550-WNM-allow-specifying-dialog-token.patch99
-rw-r--r--package/network/services/hostapd/src/src/ap/ubus.c15
2 files changed, 110 insertions, 4 deletions
diff --git a/package/network/services/hostapd/patches/550-WNM-allow-specifying-dialog-token.patch b/package/network/services/hostapd/patches/550-WNM-allow-specifying-dialog-token.patch
new file mode 100644
index 0000000000..6c080adc0e
--- /dev/null
+++ b/package/network/services/hostapd/patches/550-WNM-allow-specifying-dialog-token.patch
@@ -0,0 +1,99 @@
+From 1b26807938815d0b0b266caf31d8ef0019607e64 Mon Sep 17 00:00:00 2001
+From: David Bauer <mail@david-bauer.net>
+Date: Mon, 27 Sep 2021 15:41:48 +0200
+Subject: [PATCH] WNM: allow specifying dialog-token
+
+This commit adds the ability to specify the dialog token of a WNM BSS
+Transition request frame via the hostapd control socket.
+
+FOr this, the new 'dialog_token' option can be used. It accepts values
+as a 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 | 10 ++++++++--
+ src/ap/wnm_ap.c | 11 ++++++-----
+ src/ap/wnm_ap.h | 4 ++--
+ 3 files changed, 16 insertions(+), 9 deletions(-)
+
+--- a/hostapd/ctrl_iface.c
++++ b/hostapd/ctrl_iface.c
+@@ -897,7 +897,7 @@ static int hostapd_ctrl_iface_bss_tm_req
+ 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;
+@@ -935,6 +935,12 @@ static int hostapd_ctrl_iface_bss_tm_req
+ 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;
+@@ -1041,7 +1047,7 @@ static int hostapd_ctrl_iface_bss_tm_req
+ #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
+--- a/src/ap/wnm_ap.c
++++ b/src/ap/wnm_ap.c
+@@ -788,8 +788,8 @@ int wnm_send_ess_disassoc_imminent(struc
+
+ 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,9 @@ int wnm_send_bss_tm_req(struct hostapd_d
+ 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=%x",
++ 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 +811,7 @@ int wnm_send_bss_tm_req(struct hostapd_d
+ 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);
+--- a/src/ap/wnm_ap.h
++++ b/src/ap/wnm_ap.h
+@@ -20,8 +20,8 @@ int wnm_send_ess_disassoc_imminent(struc
+ 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,
diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
index db38ed2941..3e5456e695 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -1291,7 +1291,8 @@ hostapd_rrm_beacon_req(struct ubus_context *ctx, struct ubus_object *obj,
static int
hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent, bool abridged,
- u16 disassoc_timer, u8 validity_period, struct blob_attr *neighbors)
+ u16 disassoc_timer, u8 validity_period, u8 dialog_token,
+ struct blob_attr *neighbors)
{
struct blob_attr *cur;
struct sta_info *sta;
@@ -1351,7 +1352,7 @@ hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent,
req_mode |= WNM_BSS_TM_REQ_DISASSOC_IMMINENT;
if (wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, validity_period, NULL,
- NULL, nr, nr_len, NULL, 0))
+ dialog_token, NULL, nr, nr_len, NULL, 0))
return UBUS_STATUS_UNKNOWN_ERROR;
return 0;
@@ -1364,6 +1365,7 @@ enum {
BSS_TR_VALID_PERIOD,
BSS_TR_NEIGHBORS,
BSS_TR_ABRIDGED,
+ BSS_TR_DIALOG_TOKEN,
__BSS_TR_DISASSOC_MAX
};
@@ -1374,6 +1376,7 @@ static const struct blobmsg_policy bss_tr_policy[__BSS_TR_DISASSOC_MAX] = {
[BSS_TR_VALID_PERIOD] = { "validity_period", BLOBMSG_TYPE_INT32 },
[BSS_TR_NEIGHBORS] = { "neighbors", BLOBMSG_TYPE_ARRAY },
[BSS_TR_ABRIDGED] = { "abridged", BLOBMSG_TYPE_BOOL },
+ [BSS_TR_DIALOG_TOKEN] = { "dialog_token", BLOBMSG_TYPE_INT32 },
};
static int
@@ -1387,6 +1390,7 @@ hostapd_bss_transition_request(struct ubus_context *ctx, struct ubus_object *obj
u32 da_timer = 0;
u32 valid_period = 0;
u8 addr[ETH_ALEN];
+ u32 dialog_token = 1;
bool abridged;
bool da_imminent;
@@ -1404,11 +1408,14 @@ hostapd_bss_transition_request(struct ubus_context *ctx, struct ubus_object *obj
if (tb[BSS_TR_VALID_PERIOD])
valid_period = blobmsg_get_u32(tb[BSS_TR_VALID_PERIOD]);
+ if (tb[BSS_TR_DIALOG_TOKEN])
+ dialog_token = blobmsg_get_u32(tb[BSS_TR_DIALOG_TOKEN]);
+
da_imminent = !!(tb[BSS_TR_DA_IMMINENT] && blobmsg_get_bool(tb[BSS_TR_DA_IMMINENT]));
abridged = !!(tb[BSS_TR_ABRIDGED] && blobmsg_get_bool(tb[BSS_TR_ABRIDGED]));
return hostapd_bss_tr_send(hapd, addr, da_imminent, abridged, da_timer, valid_period,
- tb[BSS_TR_NEIGHBORS]);
+ dialog_token, tb[BSS_TR_NEIGHBORS]);
}
enum {
@@ -1452,7 +1459,7 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj,
abridged = !!(tb[WNM_DISASSOC_ABRIDGED] && blobmsg_get_bool(tb[WNM_DISASSOC_ABRIDGED]));
return hostapd_bss_tr_send(hapd, addr, true, abridged, duration, duration,
- tb[WNM_DISASSOC_NEIGHBORS]);
+ 1, tb[WNM_DISASSOC_NEIGHBORS]);
}
#endif