mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Add latest and patched mac80211 ans hostapd packages
This commit is contained in:
parent
e5395f65eb
commit
bdff38dfc4
321 changed files with 36273 additions and 0 deletions
|
@ -0,0 +1,211 @@
|
|||
From 02ae4382f45f772e3630460459eb4e5af64e71b4 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:05 -0700
|
||||
Subject: [PATCH 01/18] mesh: factor out mesh join function
|
||||
|
||||
mesh join function consitss of 2 parts which are preparing
|
||||
configurations and sending join event to driver.
|
||||
Since physical mesh join event could happen either right
|
||||
after mesh configuration is done or after CAC is done
|
||||
in case of DFS channel is used, factor out the function
|
||||
into 2 parts to reduce redundant calls.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 119 ++++++++++++++++--------------
|
||||
wpa_supplicant/mesh.h | 1 +
|
||||
wpa_supplicant/wpa_supplicant_i.h | 1 +
|
||||
3 files changed, 67 insertions(+), 54 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -364,13 +364,48 @@ void wpa_supplicant_mesh_add_scan_ie(str
|
||||
}
|
||||
|
||||
|
||||
+void wpas_join_mesh(struct wpa_supplicant *wpa_s)
|
||||
+{
|
||||
+ struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
|
||||
+ struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
|
||||
+ wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher;
|
||||
+ wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher;
|
||||
+ wpa_s->mgmt_group_cipher = wpa_s->mesh_rsn->mgmt_group_cipher;
|
||||
+ }
|
||||
+
|
||||
+ if (wpa_s->ifmsh) {
|
||||
+ params->ies = wpa_s->ifmsh->mconf->rsn_ie;
|
||||
+ params->ie_len = wpa_s->ifmsh->mconf->rsn_ie_len;
|
||||
+ params->basic_rates = wpa_s->ifmsh->basic_rates;
|
||||
+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE;
|
||||
+ params->conf.ht_opmode = wpa_s->ifmsh->bss[0]->iface->ht_op_mode;
|
||||
+ }
|
||||
+
|
||||
+ ret = wpa_drv_join_mesh(wpa_s, params);
|
||||
+ if (ret)
|
||||
+ wpa_msg(wpa_s, MSG_ERROR, "mesh join error=%d\n", ret);
|
||||
+
|
||||
+ /* hostapd sets the interface down until we associate */
|
||||
+ wpa_drv_set_operstate(wpa_s, 1);
|
||||
+
|
||||
+ if (!ret)
|
||||
+ wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+
|
||||
int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid)
|
||||
{
|
||||
- struct wpa_driver_mesh_join_params params;
|
||||
+ struct wpa_driver_mesh_join_params *params =
|
||||
+ os_zalloc(sizeof(struct wpa_driver_mesh_join_params));
|
||||
int ret = 0;
|
||||
|
||||
- if (!ssid || !ssid->ssid || !ssid->ssid_len || !ssid->frequency) {
|
||||
+ if (!ssid || !ssid->ssid || !ssid->ssid_len || !ssid->frequency || !params) {
|
||||
ret = -ENOENT;
|
||||
goto out;
|
||||
}
|
||||
@@ -381,22 +416,22 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
wpa_s->group_cipher = WPA_CIPHER_NONE;
|
||||
wpa_s->mgmt_group_cipher = 0;
|
||||
|
||||
- os_memset(¶ms, 0, sizeof(params));
|
||||
- params.meshid = ssid->ssid;
|
||||
- params.meshid_len = ssid->ssid_len;
|
||||
- ibss_mesh_setup_freq(wpa_s, ssid, ¶ms.freq);
|
||||
- wpa_s->mesh_ht_enabled = !!params.freq.ht_enabled;
|
||||
- wpa_s->mesh_vht_enabled = !!params.freq.vht_enabled;
|
||||
- if (params.freq.ht_enabled && params.freq.sec_channel_offset)
|
||||
- ssid->ht40 = params.freq.sec_channel_offset;
|
||||
+ params->meshid = ssid->ssid;
|
||||
+ params->meshid_len = ssid->ssid_len;
|
||||
+ ibss_mesh_setup_freq(wpa_s, ssid, ¶ms->freq);
|
||||
+ wpa_s->mesh_ht_enabled = !!params->freq.ht_enabled;
|
||||
+ wpa_s->mesh_vht_enabled = !!params->freq.vht_enabled;
|
||||
+ if (params->freq.ht_enabled && params->freq.sec_channel_offset)
|
||||
+ ssid->ht40 = params->freq.sec_channel_offset;
|
||||
+
|
||||
if (wpa_s->mesh_vht_enabled) {
|
||||
ssid->vht = 1;
|
||||
- switch (params.freq.bandwidth) {
|
||||
+ switch (params->freq.bandwidth) {
|
||||
case 80:
|
||||
- if (params.freq.center_freq2) {
|
||||
+ if (params->freq.center_freq2) {
|
||||
ssid->max_oper_chwidth = VHT_CHANWIDTH_80P80MHZ;
|
||||
ssid->vht_center_freq2 =
|
||||
- params.freq.center_freq2;
|
||||
+ params->freq.center_freq2;
|
||||
} else {
|
||||
ssid->max_oper_chwidth = VHT_CHANWIDTH_80MHZ;
|
||||
}
|
||||
@@ -410,67 +445,43 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
}
|
||||
}
|
||||
if (ssid->beacon_int > 0)
|
||||
- params.beacon_int = ssid->beacon_int;
|
||||
+ params->beacon_int = ssid->beacon_int;
|
||||
else if (wpa_s->conf->beacon_int > 0)
|
||||
- params.beacon_int = wpa_s->conf->beacon_int;
|
||||
+ params->beacon_int = wpa_s->conf->beacon_int;
|
||||
if (ssid->dtim_period > 0)
|
||||
- params.dtim_period = ssid->dtim_period;
|
||||
+ params->dtim_period = ssid->dtim_period;
|
||||
else if (wpa_s->conf->dtim_period > 0)
|
||||
- params.dtim_period = wpa_s->conf->dtim_period;
|
||||
- params.conf.max_peer_links = wpa_s->conf->max_peer_links;
|
||||
+ params->dtim_period = wpa_s->conf->dtim_period;
|
||||
+ params->conf.max_peer_links = wpa_s->conf->max_peer_links;
|
||||
if (ssid->mesh_rssi_threshold < DEFAULT_MESH_RSSI_THRESHOLD) {
|
||||
- params.conf.rssi_threshold = ssid->mesh_rssi_threshold;
|
||||
- params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD;
|
||||
+ params->conf.rssi_threshold = ssid->mesh_rssi_threshold;
|
||||
+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD;
|
||||
}
|
||||
|
||||
if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
|
||||
- params.flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH;
|
||||
- params.flags |= WPA_DRIVER_MESH_FLAG_AMPE;
|
||||
+ params->flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH;
|
||||
+ params->flags |= WPA_DRIVER_MESH_FLAG_AMPE;
|
||||
wpa_s->conf->user_mpm = 1;
|
||||
}
|
||||
|
||||
if (wpa_s->conf->user_mpm) {
|
||||
- params.flags |= WPA_DRIVER_MESH_FLAG_USER_MPM;
|
||||
- params.conf.auto_plinks = 0;
|
||||
+ params->flags |= WPA_DRIVER_MESH_FLAG_USER_MPM;
|
||||
+ params->conf.auto_plinks = 0;
|
||||
} else {
|
||||
- params.flags |= WPA_DRIVER_MESH_FLAG_DRIVER_MPM;
|
||||
- params.conf.auto_plinks = 1;
|
||||
+ params->flags |= WPA_DRIVER_MESH_FLAG_DRIVER_MPM;
|
||||
+ params->conf.auto_plinks = 1;
|
||||
}
|
||||
- params.conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity;
|
||||
+ params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity;
|
||||
|
||||
- if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms.freq)) {
|
||||
+ wpa_s->mesh_params = params;
|
||||
+ if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) {
|
||||
wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh");
|
||||
wpa_drv_leave_mesh(wpa_s);
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
|
||||
- wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher;
|
||||
- wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher;
|
||||
- wpa_s->mgmt_group_cipher = wpa_s->mesh_rsn->mgmt_group_cipher;
|
||||
- }
|
||||
-
|
||||
- if (wpa_s->ifmsh) {
|
||||
- params.ies = wpa_s->ifmsh->mconf->rsn_ie;
|
||||
- params.ie_len = wpa_s->ifmsh->mconf->rsn_ie_len;
|
||||
- params.basic_rates = wpa_s->ifmsh->basic_rates;
|
||||
- params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE;
|
||||
- params.conf.ht_opmode = wpa_s->ifmsh->bss[0]->iface->ht_op_mode;
|
||||
- }
|
||||
-
|
||||
- wpa_msg(wpa_s, MSG_INFO, "joining mesh %s",
|
||||
- wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
|
||||
- ret = wpa_drv_join_mesh(wpa_s, ¶ms);
|
||||
- if (ret)
|
||||
- wpa_msg(wpa_s, MSG_ERROR, "mesh join error=%d", ret);
|
||||
-
|
||||
- /* hostapd sets the interface down until we associate */
|
||||
- wpa_drv_set_operstate(wpa_s, 1);
|
||||
-
|
||||
- if (!ret)
|
||||
- wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
|
||||
-
|
||||
+ wpas_join_mesh(wpa_s);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
--- a/wpa_supplicant/mesh.h
|
||||
+++ b/wpa_supplicant/mesh.h
|
||||
@@ -21,6 +21,7 @@ int wpas_mesh_add_interface(struct wpa_s
|
||||
int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr);
|
||||
int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr,
|
||||
int duration);
|
||||
+void wpas_join_mesh(struct wpa_supplicant *wpa_s);
|
||||
|
||||
#ifdef CONFIG_MESH
|
||||
|
||||
--- a/wpa_supplicant/wpa_supplicant_i.h
|
||||
+++ b/wpa_supplicant/wpa_supplicant_i.h
|
||||
@@ -810,6 +810,7 @@ struct wpa_supplicant {
|
||||
unsigned int mesh_if_created:1;
|
||||
unsigned int mesh_ht_enabled:1;
|
||||
unsigned int mesh_vht_enabled:1;
|
||||
+ struct wpa_driver_mesh_join_params *mesh_params;
|
||||
#ifdef CONFIG_PMKSA_CACHE_EXTERNAL
|
||||
/* struct external_pmksa_cache::list */
|
||||
struct dl_list mesh_external_pmksa_cache;
|
|
@ -0,0 +1,133 @@
|
|||
From 89db76eeff6502dfa39b011962ec9d560ed4c2ee Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:06 -0700
|
||||
Subject: [PATCH 02/18] mesh: factor out rsn initialization
|
||||
|
||||
RSN initialization can be used in different phases
|
||||
if mesh initialization and mesh join don't happen
|
||||
in sequence such as DFS CAC is done in between,
|
||||
hence factor it out to help convering the case.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 84 +++++++++++++++++++++++++------------------
|
||||
wpa_supplicant/mesh.h | 1 +
|
||||
2 files changed, 50 insertions(+), 35 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -147,6 +147,53 @@ static void wpas_mesh_copy_groups(struct
|
||||
}
|
||||
|
||||
|
||||
+int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s)
|
||||
+{
|
||||
+ struct hostapd_iface *ifmsh = wpa_s->ifmsh;
|
||||
+ struct mesh_conf *mconf = wpa_s->ifmsh->mconf;
|
||||
+ struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
+ struct hostapd_data *bss = ifmsh->bss[0];
|
||||
+ static int default_groups[] = { 19, 20, 21, 25, 26, -1 };
|
||||
+ const char *password;
|
||||
+ size_t len;
|
||||
+
|
||||
+ if (mconf->security != MESH_CONF_SEC_NONE) {
|
||||
+ password = ssid->sae_password;
|
||||
+ if (!password)
|
||||
+ password = ssid->passphrase;
|
||||
+ if (!password) {
|
||||
+ wpa_printf(MSG_ERROR,
|
||||
+ "mesh: Passphrase for SAE not configured");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ bss->conf->wpa = ssid->proto;
|
||||
+ bss->conf->wpa_key_mgmt = ssid->key_mgmt;
|
||||
+
|
||||
+ if (wpa_s->conf->sae_groups &&
|
||||
+ wpa_s->conf->sae_groups[0] > 0) {
|
||||
+ wpas_mesh_copy_groups(bss, wpa_s);
|
||||
+ } else {
|
||||
+ bss->conf->sae_groups =
|
||||
+ os_memdup(default_groups,
|
||||
+ sizeof(default_groups));
|
||||
+ if (!bss->conf->sae_groups)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ len = os_strlen(password);
|
||||
+ bss->conf->ssid.wpa_passphrase =
|
||||
+ dup_binstr(password, len);
|
||||
+
|
||||
+ wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf);
|
||||
+ if (!wpa_s->mesh_rsn)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
struct hostapd_freq_params *freq)
|
||||
@@ -156,9 +203,6 @@ static int wpa_supplicant_mesh_init(stru
|
||||
struct hostapd_config *conf;
|
||||
struct mesh_conf *mconf;
|
||||
int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 };
|
||||
- static int default_groups[] = { 19, 20, 21, 25, 26, -1 };
|
||||
- const char *password;
|
||||
- size_t len;
|
||||
int rate_len;
|
||||
int frequency;
|
||||
|
||||
@@ -292,38 +336,8 @@ static int wpa_supplicant_mesh_init(stru
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (mconf->security != MESH_CONF_SEC_NONE) {
|
||||
- password = ssid->sae_password;
|
||||
- if (!password)
|
||||
- password = ssid->passphrase;
|
||||
- if (!password) {
|
||||
- wpa_printf(MSG_ERROR,
|
||||
- "mesh: Passphrase for SAE not configured");
|
||||
- goto out_free;
|
||||
- }
|
||||
-
|
||||
- bss->conf->wpa = ssid->proto;
|
||||
- bss->conf->wpa_key_mgmt = ssid->key_mgmt;
|
||||
-
|
||||
- if (wpa_s->conf->sae_groups &&
|
||||
- wpa_s->conf->sae_groups[0] > 0) {
|
||||
- wpas_mesh_copy_groups(bss, wpa_s);
|
||||
- } else {
|
||||
- bss->conf->sae_groups =
|
||||
- os_memdup(default_groups,
|
||||
- sizeof(default_groups));
|
||||
- if (!bss->conf->sae_groups)
|
||||
- goto out_free;
|
||||
- }
|
||||
-
|
||||
- len = os_strlen(password);
|
||||
- bss->conf->ssid.wpa_passphrase =
|
||||
- dup_binstr(password, len);
|
||||
-
|
||||
- wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf);
|
||||
- if (!wpa_s->mesh_rsn)
|
||||
- goto out_free;
|
||||
- }
|
||||
+ if (wpas_mesh_init_rsn(wpa_s))
|
||||
+ goto out_free;
|
||||
|
||||
wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
|
||||
--- a/wpa_supplicant/mesh.h
|
||||
+++ b/wpa_supplicant/mesh.h
|
||||
@@ -22,6 +22,7 @@ int wpas_mesh_peer_remove(struct wpa_sup
|
||||
int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr,
|
||||
int duration);
|
||||
void wpas_join_mesh(struct wpa_supplicant *wpa_s);
|
||||
+int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s);
|
||||
|
||||
#ifdef CONFIG_MESH
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
From 07bad5f256cbe8a4b45d32c5b43b870ee815fb42 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:07 -0700
|
||||
Subject: [PATCH 03/18] mesh: relocate RSN init function
|
||||
|
||||
RSN init function should work together with mesh join
|
||||
when it's used. Since mesh join could be called at different stage
|
||||
if DFS channel is used, relocate the function to mesh join.
|
||||
It is still the same call flows of mesh join before this changes
|
||||
if non-DFS channels are used, hence no side effect will occur.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -336,9 +336,6 @@ static int wpa_supplicant_mesh_init(stru
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (wpas_mesh_init_rsn(wpa_s))
|
||||
- goto out_free;
|
||||
-
|
||||
wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
|
||||
return 0;
|
||||
@@ -384,6 +381,12 @@ void wpas_join_mesh(struct wpa_supplican
|
||||
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
int ret = 0;
|
||||
|
||||
+ if (wpas_mesh_init_rsn(wpa_s)) {
|
||||
+ wpa_printf(MSG_ERROR, "Init RSN failed. Deinit mesh...");
|
||||
+ wpa_supplicant_mesh_deinit(wpa_s);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
|
||||
wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher;
|
||||
wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher;
|
|
@ -0,0 +1,73 @@
|
|||
From bd05de484bfa61def530d717c7234381f6b33cf7 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:08 -0700
|
||||
Subject: [PATCH 04/18] mesh: use setup completion callback to complete mesh
|
||||
join
|
||||
|
||||
mesh join function is the last function to be called during
|
||||
mesh join process, but it's been called a bit earlier than
|
||||
it's supposed to be, so that some mesh parameter values
|
||||
such as VHT capabilities not applied correct when mesh join
|
||||
is in process. Moreover current design of mesh join that is called
|
||||
directly after mesh initialization is not suitable for DFS channels
|
||||
to use, since mesh join process should be paused until DFS CAC is
|
||||
done and resumed once it's done.
|
||||
Using setup completion callback is how AP mode is using for DFS channels
|
||||
and mesh can use the same way.
|
||||
The callback will be called by hostapd_setup_interface_complete_sync.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 7 +++++--
|
||||
wpa_supplicant/mesh.h | 2 +-
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -217,6 +217,7 @@ static int wpa_supplicant_mesh_init(stru
|
||||
if (!ifmsh)
|
||||
return -ENOMEM;
|
||||
|
||||
+ ifmsh->owner = wpa_s;
|
||||
ifmsh->drv_flags = wpa_s->drv_flags;
|
||||
ifmsh->num_bss = 1;
|
||||
ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss,
|
||||
@@ -234,6 +235,8 @@ static int wpa_supplicant_mesh_init(stru
|
||||
bss->drv_priv = wpa_s->drv_priv;
|
||||
bss->iface = ifmsh;
|
||||
bss->mesh_sta_free_cb = mesh_mpm_free_sta;
|
||||
+ bss->setup_complete_cb = wpas_mesh_complete_cb;
|
||||
+ bss->setup_complete_cb_ctx = wpa_s;
|
||||
frequency = ssid->frequency;
|
||||
if (frequency != freq->freq &&
|
||||
frequency == freq->freq + freq->sec_channel_offset * 20) {
|
||||
@@ -375,8 +378,9 @@ void wpa_supplicant_mesh_add_scan_ie(str
|
||||
}
|
||||
|
||||
|
||||
-void wpas_join_mesh(struct wpa_supplicant *wpa_s)
|
||||
+void wpas_mesh_complete_cb(void *ctx)
|
||||
{
|
||||
+ struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)ctx;
|
||||
struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
|
||||
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
int ret = 0;
|
||||
@@ -498,7 +502,6 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
goto out;
|
||||
}
|
||||
|
||||
- wpas_join_mesh(wpa_s);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
--- a/wpa_supplicant/mesh.h
|
||||
+++ b/wpa_supplicant/mesh.h
|
||||
@@ -21,7 +21,7 @@ int wpas_mesh_add_interface(struct wpa_s
|
||||
int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr);
|
||||
int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr,
|
||||
int duration);
|
||||
-void wpas_join_mesh(struct wpa_supplicant *wpa_s);
|
||||
+void wpas_mesh_complete_cb(void *ctx);
|
||||
int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s);
|
||||
|
||||
#ifdef CONFIG_MESH
|
|
@ -0,0 +1,35 @@
|
|||
From dbe9afab3b2dceb35d478ac43dfcf8fdc5e23a22 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:09 -0700
|
||||
Subject: [PATCH 05/18] mesh: reflect country setting to mesh configuration
|
||||
|
||||
wpa_supplicant configuration has country parameter that is
|
||||
supposed to be used in AP mode to indicate supporting 802.11h
|
||||
and 802.11d. Reflect this configuration to Mesh also since Mesh
|
||||
is required to support 802.11h and 802.11d to use DFS channels.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
[daniel@makrotopia.org: adapted to changed ieee80211_is_dfs prototype]
|
||||
---
|
||||
wpa_supplicant/mesh.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -255,6 +255,15 @@ static int wpa_supplicant_mesh_init(stru
|
||||
bss->conf->start_disabled = 1;
|
||||
bss->conf->mesh = MESH_ENABLED;
|
||||
bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity;
|
||||
+
|
||||
+ if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes,
|
||||
+ wpa_s->hw.num_modes) && wpa_s->conf->country[0]) {
|
||||
+ conf->ieee80211h = 1;
|
||||
+ conf->ieee80211d = 1;
|
||||
+ conf->country[0] = wpa_s->conf->country[0];
|
||||
+ conf->country[1] = wpa_s->conf->country[1];
|
||||
+ }
|
||||
+
|
||||
bss->iconf = conf;
|
||||
ifmsh->conf = conf;
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
From 51e759da5026b3e64f801135b5d53f2198bbd2f0 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:10 -0700
|
||||
Subject: [PATCH 06/18] mesh: inform kernel driver DFS handler in userspace
|
||||
|
||||
NL80211_ATTR_HANDLE_DFS is required by kerenel space
|
||||
to enable DFS channels that indicates DFS handler
|
||||
resides in userspace.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
src/drivers/driver.h | 1 +
|
||||
src/drivers/driver_nl80211.c | 3 +++
|
||||
wpa_supplicant/mesh.c | 1 +
|
||||
3 files changed, 5 insertions(+)
|
||||
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -1390,6 +1390,7 @@ struct wpa_driver_mesh_join_params {
|
||||
#define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004
|
||||
#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
|
||||
unsigned int flags;
|
||||
+ u8 handle_dfs;
|
||||
};
|
||||
|
||||
/**
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -9270,6 +9270,9 @@ static int nl80211_join_mesh(struct i802
|
||||
|
||||
wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags);
|
||||
|
||||
+ if (params->handle_dfs)
|
||||
+ if (nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS))
|
||||
+ goto fail;
|
||||
container = nla_nest_start(msg, NL80211_ATTR_MESH_SETUP);
|
||||
if (!container)
|
||||
goto fail;
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -262,6 +262,7 @@ static int wpa_supplicant_mesh_init(stru
|
||||
conf->ieee80211d = 1;
|
||||
conf->country[0] = wpa_s->conf->country[0];
|
||||
conf->country[1] = wpa_s->conf->country[1];
|
||||
+ wpa_s->mesh_params->handle_dfs = 1;
|
||||
}
|
||||
|
||||
bss->iconf = conf;
|
|
@ -0,0 +1,33 @@
|
|||
From bdc77efe681d5b88f3256e2bb6e706d4eaf09518 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:11 -0700
|
||||
Subject: [PATCH 07/18] mesh: apply channel attributes before running Mesh
|
||||
|
||||
This helps mesh interface initializes with correct
|
||||
channel parameters.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -338,6 +338,8 @@ static int wpa_supplicant_mesh_init(stru
|
||||
conf->basic_rates[rate_len] = -1;
|
||||
}
|
||||
|
||||
+ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
+
|
||||
if (hostapd_setup_interface(ifmsh)) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"Failed to initialize hostapd interface for mesh");
|
||||
@@ -349,8 +351,6 @@ static int wpa_supplicant_mesh_init(stru
|
||||
return -1;
|
||||
}
|
||||
|
||||
- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
-
|
||||
return 0;
|
||||
out_free:
|
||||
wpa_supplicant_mesh_deinit(wpa_s);
|
|
@ -0,0 +1,36 @@
|
|||
From eb9888ba41faaeb8fd07392ad46808b7d894cc14 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:12 -0700
|
||||
Subject: [PATCH 08/18] mesh: set interface type to mesh before setting
|
||||
interface
|
||||
|
||||
Correct interface type is required to start DFS CAC that can be
|
||||
triggered during interface setup.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -340,14 +340,14 @@ static int wpa_supplicant_mesh_init(stru
|
||||
|
||||
wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
|
||||
- if (hostapd_setup_interface(ifmsh)) {
|
||||
- wpa_printf(MSG_ERROR,
|
||||
- "Failed to initialize hostapd interface for mesh");
|
||||
+ if (wpa_drv_init_mesh(wpa_s)) {
|
||||
+ wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver");
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (wpa_drv_init_mesh(wpa_s)) {
|
||||
- wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver");
|
||||
+ if (hostapd_setup_interface(ifmsh)) {
|
||||
+ wpa_printf(MSG_ERROR,
|
||||
+ "Failed to initialize hostapd interface for mesh");
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
From fa3af966032267e618b19bbf06a536ddb81ddbdf Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:13 -0700
|
||||
Subject: [PATCH 09/18] mesh: set mesh center frequency
|
||||
|
||||
vht center frequency value is required to compose the correct channel info.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -457,6 +457,7 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
|
||||
if (wpa_s->mesh_vht_enabled) {
|
||||
ssid->vht = 1;
|
||||
+ ssid->vht_center_freq1 = params->freq.center_freq1;
|
||||
switch (params->freq.bandwidth) {
|
||||
case 80:
|
||||
if (params->freq.center_freq2) {
|
|
@ -0,0 +1,176 @@
|
|||
From 9a8ca54a264a2820af614043e7af853166b320b0 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:14 -0700
|
||||
Subject: [PATCH 10/18] mesh: consider mesh interface on dfs event handler
|
||||
|
||||
Once mesh starts supporting DFS channels, it has to handle DFS related events
|
||||
from drivers, hence add mesh interface to the check list.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
|
||||
---
|
||||
wpa_supplicant/ap.c | 71 ++++++++++++++++++++++++++++++-----------
|
||||
wpa_supplicant/events.c | 7 ++--
|
||||
2 files changed, 57 insertions(+), 21 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/ap.c
|
||||
+++ b/wpa_supplicant/ap.c
|
||||
@@ -1337,13 +1337,18 @@ int ap_ctrl_iface_chanswitch(struct wpa_
|
||||
void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
|
||||
int offset, int width, int cf1, int cf2)
|
||||
{
|
||||
- if (!wpa_s->ap_iface)
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
|
||||
+ if (!wpa_s->ap_iface) {
|
||||
+ if (!wpa_s->ifmsh)
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_s->assoc_freq = freq;
|
||||
if (wpa_s->current_ssid)
|
||||
wpa_s->current_ssid->frequency = freq;
|
||||
- hostapd_event_ch_switch(wpa_s->ap_iface->bss[0], freq, ht,
|
||||
+ hostapd_event_ch_switch(iface->bss[0], freq, ht,
|
||||
offset, width, cf1, cf2);
|
||||
}
|
||||
|
||||
@@ -1540,10 +1545,16 @@ int wpas_ap_pmksa_cache_add_external(str
|
||||
void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
+
|
||||
+ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
|
||||
+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
|
||||
- hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq,
|
||||
+ hostapd_dfs_radar_detected(iface, radar->freq,
|
||||
radar->ht_enabled, radar->chan_offset,
|
||||
radar->chan_width,
|
||||
radar->cf1, radar->cf2);
|
||||
@@ -1553,10 +1564,16 @@ void wpas_ap_event_dfs_radar_detected(st
|
||||
void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
+
|
||||
+ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
|
||||
+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq);
|
||||
- hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq,
|
||||
+ hostapd_dfs_start_cac(iface, radar->freq,
|
||||
radar->ht_enabled, radar->chan_offset,
|
||||
radar->chan_width, radar->cf1, radar->cf2);
|
||||
}
|
||||
@@ -1565,10 +1582,16 @@ void wpas_ap_event_dfs_cac_started(struc
|
||||
void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
+
|
||||
+ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
|
||||
+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
|
||||
- hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq,
|
||||
+ hostapd_dfs_complete_cac(iface, 1, radar->freq,
|
||||
radar->ht_enabled, radar->chan_offset,
|
||||
radar->chan_width, radar->cf1, radar->cf2);
|
||||
}
|
||||
@@ -1577,10 +1600,16 @@ void wpas_ap_event_dfs_cac_finished(stru
|
||||
void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
+
|
||||
+ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
|
||||
+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
|
||||
- hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq,
|
||||
+ hostapd_dfs_complete_cac(iface, 0, radar->freq,
|
||||
radar->ht_enabled, radar->chan_offset,
|
||||
radar->chan_width, radar->cf1, radar->cf2);
|
||||
}
|
||||
@@ -1589,10 +1618,16 @@ void wpas_ap_event_dfs_cac_aborted(struc
|
||||
void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
|
||||
- return;
|
||||
+ struct hostapd_iface *iface = wpa_s->ap_iface;
|
||||
+
|
||||
+ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
|
||||
+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
|
||||
+ return;
|
||||
+ else
|
||||
+ iface = wpa_s->ifmsh;
|
||||
+ }
|
||||
wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
|
||||
- hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq,
|
||||
+ hostapd_dfs_nop_finished(iface, radar->freq,
|
||||
radar->ht_enabled, radar->chan_offset,
|
||||
radar->chan_width, radar->cf1, radar->cf2);
|
||||
}
|
||||
--- a/wpa_supplicant/events.c
|
||||
+++ b/wpa_supplicant/events.c
|
||||
@@ -3802,7 +3802,7 @@ static void wpas_event_dfs_cac_started(s
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
|
||||
- if (wpa_s->ap_iface) {
|
||||
+ if (wpa_s->ap_iface || wpa_s->ifmsh) {
|
||||
wpas_ap_event_dfs_cac_started(wpa_s, radar);
|
||||
} else
|
||||
#endif /* NEED_AP_MLME && CONFIG_AP */
|
||||
@@ -3823,7 +3823,7 @@ static void wpas_event_dfs_cac_finished(
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
|
||||
- if (wpa_s->ap_iface) {
|
||||
+ if (wpa_s->ap_iface || wpa_s->ifmsh) {
|
||||
wpas_ap_event_dfs_cac_finished(wpa_s, radar);
|
||||
} else
|
||||
#endif /* NEED_AP_MLME && CONFIG_AP */
|
||||
@@ -3839,7 +3839,7 @@ static void wpas_event_dfs_cac_aborted(s
|
||||
struct dfs_event *radar)
|
||||
{
|
||||
#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
|
||||
- if (wpa_s->ap_iface) {
|
||||
+ if (wpa_s->ap_iface || wpa_s->ifmsh) {
|
||||
wpas_ap_event_dfs_cac_aborted(wpa_s, radar);
|
||||
} else
|
||||
#endif /* NEED_AP_MLME && CONFIG_AP */
|
||||
@@ -4278,6 +4278,7 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
#ifdef CONFIG_AP
|
||||
if (wpa_s->current_ssid->mode == WPAS_MODE_AP ||
|
||||
wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO ||
|
||||
+ wpa_s->current_ssid->mode == WPAS_MODE_MESH ||
|
||||
wpa_s->current_ssid->mode ==
|
||||
WPAS_MODE_P2P_GROUP_FORMATION) {
|
||||
wpas_ap_ch_switch(wpa_s, data->ch_switch.freq,
|
|
@ -0,0 +1,79 @@
|
|||
From bbaa6142eadf229334436fdbf51aa65bb819f771 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:15 -0700
|
||||
Subject: [PATCH 11/18] mesh: Allow DFS channels to be selected if dfs is
|
||||
enabled
|
||||
|
||||
Note: DFS is assumed to be usable if a country code has been set
|
||||
|
||||
Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/wpa_supplicant.c | 24 ++++++++++++++++++------
|
||||
1 file changed, 18 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2060,6 +2060,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
struct hostapd_freq_params vht_freq;
|
||||
int chwidth, seg0, seg1;
|
||||
u32 vht_caps = 0;
|
||||
+ int dfs_enabled = wpa_s->conf->country[0] &&
|
||||
+ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
|
||||
|
||||
freq->freq = ssid->frequency;
|
||||
|
||||
@@ -2136,8 +2138,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
return;
|
||||
|
||||
/* Check primary channel flags */
|
||||
- if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (pri_chan->flag & HOSTAPD_CHAN_DISABLED)
|
||||
return;
|
||||
+ if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (!dfs_enabled)
|
||||
+ return;
|
||||
|
||||
#ifdef CONFIG_HT_OVERRIDES
|
||||
if (ssid->disable_ht40)
|
||||
@@ -2163,8 +2168,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
return;
|
||||
|
||||
/* Check secondary channel flags */
|
||||
- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (sec_chan->flag & HOSTAPD_CHAN_DISABLED)
|
||||
return;
|
||||
+ if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (!dfs_enabled)
|
||||
+ return;
|
||||
|
||||
freq->channel = pri_chan->chan;
|
||||
|
||||
@@ -2254,8 +2262,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
return;
|
||||
|
||||
/* Back to HT configuration if channel not usable */
|
||||
- if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (chan->flag & HOSTAPD_CHAN_DISABLED)
|
||||
return;
|
||||
+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (!dfs_enabled)
|
||||
+ return;
|
||||
}
|
||||
|
||||
chwidth = VHT_CHANWIDTH_80MHZ;
|
||||
@@ -2275,10 +2286,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
if (!chan)
|
||||
continue;
|
||||
|
||||
- if (chan->flag & (HOSTAPD_CHAN_DISABLED |
|
||||
- HOSTAPD_CHAN_NO_IR |
|
||||
- HOSTAPD_CHAN_RADAR))
|
||||
+ if (chan->flag & HOSTAPD_CHAN_DISABLED)
|
||||
continue;
|
||||
+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
|
||||
+ if (!dfs_enabled)
|
||||
+ continue;
|
||||
|
||||
/* Found a suitable second segment for 80+80 */
|
||||
chwidth = VHT_CHANWIDTH_80P80MHZ;
|
|
@ -0,0 +1,25 @@
|
|||
From 4a8245ec2e9d48e464488477a3e7ed234009c216 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:16 -0700
|
||||
Subject: [PATCH 12/18] mesh: allow mesh to send channel switch request
|
||||
|
||||
add mesh type to nl80211 channel switch request,
|
||||
so mesh is able to send the request to kernel drivers.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
src/drivers/driver_nl80211.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -8685,7 +8685,8 @@ static int nl80211_switch_channel(void *
|
||||
}
|
||||
|
||||
if ((drv->nlmode != NL80211_IFTYPE_AP) &&
|
||||
- (drv->nlmode != NL80211_IFTYPE_P2P_GO))
|
||||
+ (drv->nlmode != NL80211_IFTYPE_P2P_GO) &&
|
||||
+ (drv->nlmode != NL80211_IFTYPE_MESH_POINT) )
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
/*
|
|
@ -0,0 +1,27 @@
|
|||
From 267395271c1a36b54ef21070acff2cadce241035 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:17 -0700
|
||||
Subject: [PATCH 13/18] mesh: do not allow pri/sec channel switch
|
||||
|
||||
We don't want mesh to switch the channel from primary to secondary,
|
||||
since mesh points are not able to join each other in that case.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/mesh.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -337,7 +337,10 @@ static int wpa_supplicant_mesh_init(stru
|
||||
rate_len * sizeof(int));
|
||||
conf->basic_rates[rate_len] = -1;
|
||||
}
|
||||
-
|
||||
+ /* Do not allow primary/secondary channel switch in mesh mode,
|
||||
+ * since mesh is not able to establish a physical link for it
|
||||
+ */
|
||||
+ conf->no_pri_sec_switch = 1;
|
||||
wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
||||
|
||||
if (wpa_drv_init_mesh(wpa_s)) {
|
|
@ -0,0 +1,24 @@
|
|||
From f95897cef614fff710c31d9e478eacc85d6312d5 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:18 -0700
|
||||
Subject: [PATCH 14/18] mesh: do not allow scan result to swap pri/sec
|
||||
|
||||
Swapping between primary and secondary channel will break
|
||||
mesh from joining, hence don't allow it.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/wpa_supplicant.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2185,7 +2185,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
}
|
||||
freq->sec_channel_offset = ht40;
|
||||
|
||||
- if (obss_scan) {
|
||||
+ if (ssid->mode != WPAS_MODE_MESH && obss_scan) {
|
||||
struct wpa_scan_results *scan_res;
|
||||
|
||||
scan_res = wpa_supplicant_get_scan_results(wpa_s, NULL, 0);
|
|
@ -0,0 +1,49 @@
|
|||
From 9423e8be0393e82c8622806a0529e47fd5583c0b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:19 -0700
|
||||
Subject: [PATCH 15/18] mesh: do not use offchan mgmt tx on DFS
|
||||
|
||||
Drivers don't allow mesh to use offchannel on management Tx.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
[daniel@makrotopia.org: adapted to changed ieee80211_is_dfs prototype]
|
||||
---
|
||||
src/drivers/driver_nl80211.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -7165,6 +7165,10 @@ static int wpa_driver_nl80211_send_actio
|
||||
struct wpa_driver_nl80211_data *drv = bss->drv;
|
||||
int ret = -1;
|
||||
u8 *buf;
|
||||
+ int offchanok = 1;
|
||||
+ u16 num_modes, flags;
|
||||
+ struct hostapd_hw_modes *modes;
|
||||
+ u8 dfs_domain;
|
||||
struct ieee80211_hdr *hdr;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, "
|
||||
@@ -7189,7 +7193,11 @@ static int wpa_driver_nl80211_send_actio
|
||||
} else {
|
||||
os_memset(bss->rand_addr, 0, ETH_ALEN);
|
||||
}
|
||||
-
|
||||
+ if (is_mesh_interface(drv->nlmode) &&
|
||||
+ (modes = nl80211_get_hw_feature_data(bss, &num_modes, &flags,
|
||||
+ &dfs_domain)) &&
|
||||
+ ieee80211_is_dfs(freq, modes, num_modes))
|
||||
+ offchanok = 0;
|
||||
if (is_ap_interface(drv->nlmode) &&
|
||||
(!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) ||
|
||||
(int) freq == bss->freq || drv->device_ap_sme ||
|
||||
@@ -7201,7 +7209,7 @@ static int wpa_driver_nl80211_send_actio
|
||||
ret = nl80211_send_frame_cmd(bss, freq, wait_time, buf,
|
||||
24 + data_len,
|
||||
&drv->send_action_cookie,
|
||||
- no_cck, 0, 1, NULL, 0);
|
||||
+ no_cck, 0, offchanok, NULL, 0);
|
||||
|
||||
os_free(buf);
|
||||
return ret;
|
|
@ -0,0 +1,64 @@
|
|||
From fa9d565fe8841b288f29137c23a7ab2584dd9510 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:20 -0700
|
||||
Subject: [PATCH 16/18] mesh: fix channel switch error during CAC
|
||||
|
||||
Mesh interface has used its channel parameters that configured
|
||||
during its initialization even after channel switched due to
|
||||
DFS radar detection during CAC which caused channel switch error.
|
||||
This change fixes the error by updating its channel parameters
|
||||
when channel's been changed from initial one.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
[daniel@makrotopia.org: added hw_features_common.h include]
|
||||
---
|
||||
wpa_supplicant/mesh.c | 25 +++++++++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "utils/common.h"
|
||||
#include "utils/eloop.h"
|
||||
#include "utils/uuid.h"
|
||||
+#include "common/hw_features_common.h"
|
||||
#include "common/ieee802_11_defs.h"
|
||||
#include "common/wpa_ctrl.h"
|
||||
#include "ap/sta_info.h"
|
||||
@@ -394,10 +395,35 @@ void wpa_supplicant_mesh_add_scan_ie(str
|
||||
void wpas_mesh_complete_cb(void *ctx)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)ctx;
|
||||
+ struct hostapd_iface *ifmsh = wpa_s->ifmsh;
|
||||
struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
|
||||
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
int ret = 0;
|
||||
|
||||
+ /*
|
||||
+ * inspect if channel's been changed since initialized.
|
||||
+ * i.e. DFS radar detection
|
||||
+ */
|
||||
+ if (ifmsh->freq != params->freq.freq) {
|
||||
+ wpa_s->assoc_freq = ifmsh->freq;
|
||||
+ ssid->frequency = ifmsh->freq;
|
||||
+ if (hostapd_set_freq_params(¶ms->freq,
|
||||
+ ifmsh->conf->hw_mode,
|
||||
+ ifmsh->freq,
|
||||
+ ifmsh->conf->channel,
|
||||
+ ifmsh->conf->ieee80211n,
|
||||
+ ifmsh->conf->ieee80211ac,
|
||||
+ ifmsh->conf->secondary_channel,
|
||||
+ ifmsh->conf->vht_oper_chwidth,
|
||||
+ ifmsh->conf->vht_oper_centr_freq_seg0_idx,
|
||||
+ ifmsh->conf->vht_oper_centr_freq_seg1_idx,
|
||||
+ ifmsh->conf->vht_capab)) {
|
||||
+ wpa_printf(MSG_ERROR, "Error updating mesh frequency params.");
|
||||
+ wpa_supplicant_mesh_deinit(wpa_s);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (wpas_mesh_init_rsn(wpa_s)) {
|
||||
wpa_printf(MSG_ERROR, "Init RSN failed. Deinit mesh...");
|
||||
wpa_supplicant_mesh_deinit(wpa_s);
|
|
@ -0,0 +1,107 @@
|
|||
From d3201adfe7d2219217a07ef16ef365ad59c1a89b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Tue, 29 May 2018 14:39:21 -0700
|
||||
Subject: [PATCH 17/18] mesh: use right interface context to send DFS event
|
||||
messages
|
||||
|
||||
use mesh interface context to send DFS event messages when
|
||||
DFS events are on mesh interface.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
|
||||
---
|
||||
src/ap/dfs.c | 27 +++++++++++++++++++--------
|
||||
1 file changed, 19 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/src/ap/dfs.c
|
||||
+++ b/src/ap/dfs.c
|
||||
@@ -637,6 +637,17 @@ static unsigned int dfs_get_cac_time(str
|
||||
}
|
||||
|
||||
|
||||
+static void *get_message_ctx(struct hostapd_iface *iface)
|
||||
+{
|
||||
+#ifdef CONFIG_MESH
|
||||
+ if (iface->mconf)
|
||||
+ return iface->owner;
|
||||
+#endif /* CONFIG_MESH */
|
||||
+
|
||||
+ return iface->bss[0]->msg_ctx;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/*
|
||||
* Main DFS handler
|
||||
* 1 - continue channel/ap setup
|
||||
@@ -719,7 +730,7 @@ int hostapd_handle_dfs(struct hostapd_if
|
||||
/* Finally start CAC */
|
||||
hostapd_set_state(iface, HAPD_IFACE_DFS);
|
||||
wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq);
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_START
|
||||
"freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds",
|
||||
iface->freq,
|
||||
iface->conf->channel, iface->conf->secondary_channel,
|
||||
@@ -768,7 +779,7 @@ int hostapd_dfs_complete_cac(struct host
|
||||
int ht_enabled, int chan_offset, int chan_width,
|
||||
int cf1, int cf2)
|
||||
{
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_COMPLETED
|
||||
"success=%d freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
|
||||
success, freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
|
||||
|
||||
@@ -810,7 +821,7 @@ int hostapd_dfs_pre_cac_expired(struct h
|
||||
int ht_enabled, int chan_offset, int chan_width,
|
||||
int cf1, int cf2)
|
||||
{
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED
|
||||
"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
|
||||
freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
|
||||
|
||||
@@ -848,7 +859,7 @@ static int hostapd_dfs_start_channel_swi
|
||||
|
||||
wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
|
||||
channel->chan);
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NEW_CHANNEL
|
||||
"freq=%d chan=%d sec_chan=%d", channel->freq,
|
||||
channel->chan, secondary_channel);
|
||||
|
||||
@@ -935,7 +946,7 @@ static int hostapd_dfs_start_channel_swi
|
||||
|
||||
wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
|
||||
channel->chan);
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NEW_CHANNEL
|
||||
"freq=%d chan=%d sec_chan=%d", channel->freq,
|
||||
channel->chan, secondary_channel);
|
||||
|
||||
@@ -997,7 +1008,7 @@ int hostapd_dfs_radar_detected(struct ho
|
||||
{
|
||||
int res;
|
||||
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_RADAR_DETECTED
|
||||
"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
|
||||
freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
|
||||
|
||||
@@ -1028,7 +1039,7 @@ int hostapd_dfs_nop_finished(struct host
|
||||
int ht_enabled, int chan_offset, int chan_width,
|
||||
int cf1, int cf2)
|
||||
{
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NOP_FINISHED
|
||||
"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
|
||||
freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
|
||||
|
||||
@@ -1078,7 +1089,7 @@ int hostapd_dfs_start_cac(struct hostapd
|
||||
int ht_enabled, int chan_offset, int chan_width,
|
||||
int cf1, int cf2)
|
||||
{
|
||||
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
|
||||
+ wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_START
|
||||
"freq=%d chan=%d chan_offset=%d width=%d seg0=%d "
|
||||
"seg1=%d cac_time=%ds",
|
||||
freq, (freq - 5000) / 5, chan_offset, chan_width, cf1, cf2, 60);
|
|
@ -0,0 +1,219 @@
|
|||
From 90fe6429624fc48bc0e5d2d7eeecb7498708b5e3 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Wed, 18 Apr 2018 19:24:31 +0200
|
||||
Subject: [PATCH 18/18] mesh: make forwarding configurable
|
||||
|
||||
Allow mesh_fwding to be specified in a mesh bss config, pass that
|
||||
to the driver (only nl80211 implemented for now) and announce
|
||||
forwarding capability accordingly.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
src/ap/ap_config.h | 2 ++
|
||||
src/drivers/driver.h | 2 ++
|
||||
src/drivers/driver_nl80211.c | 3 +++
|
||||
wpa_supplicant/config.c | 4 ++++
|
||||
wpa_supplicant/config.h | 9 +++++++++
|
||||
wpa_supplicant/config_file.c | 4 ++++
|
||||
wpa_supplicant/config_ssid.h | 5 +++++
|
||||
wpa_supplicant/mesh.c | 6 ++++++
|
||||
wpa_supplicant/mesh_mpm.c | 4 ++--
|
||||
wpa_supplicant/wpa_supplicant.conf | 3 +++
|
||||
10 files changed, 40 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/src/ap/ap_config.h
|
||||
+++ b/src/ap/ap_config.h
|
||||
@@ -49,6 +49,7 @@ struct mesh_conf {
|
||||
int dot11MeshRetryTimeout; /* msec */
|
||||
int dot11MeshConfirmTimeout; /* msec */
|
||||
int dot11MeshHoldingTimeout; /* msec */
|
||||
+ int mesh_fwding;
|
||||
};
|
||||
|
||||
#define MAX_STA_COUNT 2007
|
||||
@@ -624,6 +625,7 @@ struct hostapd_bss_config {
|
||||
|
||||
#define MESH_ENABLED BIT(0)
|
||||
int mesh;
|
||||
+ int mesh_fwding;
|
||||
|
||||
u8 radio_measurements[RRM_CAPABILITIES_IE_LEN];
|
||||
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -1363,6 +1363,7 @@ struct wpa_driver_mesh_bss_params {
|
||||
#define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004
|
||||
#define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008
|
||||
#define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010
|
||||
+#define WPA_DRIVER_MESH_CONF_FLAG_FORWARDING 0x00000020
|
||||
/*
|
||||
* TODO: Other mesh configuration parameters would go here.
|
||||
* See NL80211_MESHCONF_* for all the mesh config parameters.
|
||||
@@ -1372,6 +1373,7 @@ struct wpa_driver_mesh_bss_params {
|
||||
int peer_link_timeout;
|
||||
int max_peer_links;
|
||||
int rssi_threshold;
|
||||
+ int forwarding;
|
||||
u16 ht_opmode;
|
||||
};
|
||||
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -9228,6 +9228,9 @@ static int nl80211_put_mesh_config(struc
|
||||
if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) &&
|
||||
nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS,
|
||||
params->auto_plinks)) ||
|
||||
+ ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_FORWARDING) &&
|
||||
+ nla_put_u8(msg, NL80211_MESHCONF_FORWARDING,
|
||||
+ params->forwarding)) ||
|
||||
((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) &&
|
||||
nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS,
|
||||
params->max_peer_links)) ||
|
||||
--- a/wpa_supplicant/config.c
|
||||
+++ b/wpa_supplicant/config.c
|
||||
@@ -2212,6 +2212,7 @@ static const struct parse_data ssid_fiel
|
||||
#ifdef CONFIG_MESH
|
||||
{ INT_RANGE(mode, 0, 5) },
|
||||
{ INT_RANGE(no_auto_peer, 0, 1) },
|
||||
+ { INT_RANGE(mesh_fwding, 0, 1) },
|
||||
{ INT_RANGE(mesh_rssi_threshold, -255, 1) },
|
||||
#else /* CONFIG_MESH */
|
||||
{ INT_RANGE(mode, 0, 4) },
|
||||
@@ -2763,6 +2764,7 @@ void wpa_config_set_network_defaults(str
|
||||
ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT;
|
||||
ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT;
|
||||
ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT;
|
||||
+ ssid->mesh_fwding = DEFAULT_MESH_FWDING;
|
||||
ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD;
|
||||
#endif /* CONFIG_MESH */
|
||||
#ifdef CONFIG_HT_OVERRIDES
|
||||
@@ -3978,6 +3980,7 @@ struct wpa_config * wpa_config_alloc_emp
|
||||
config->user_mpm = DEFAULT_USER_MPM;
|
||||
config->max_peer_links = DEFAULT_MAX_PEER_LINKS;
|
||||
config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY;
|
||||
+ config->mesh_fwding = DEFAULT_MESH_FWDING;
|
||||
config->dot11RSNASAERetransPeriod =
|
||||
DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD;
|
||||
config->fast_reauth = DEFAULT_FAST_REAUTH;
|
||||
@@ -4600,6 +4603,7 @@ static const struct global_parse_data gl
|
||||
{ INT(user_mpm), 0 },
|
||||
{ INT_RANGE(max_peer_links, 0, 255), 0 },
|
||||
{ INT(mesh_max_inactivity), 0 },
|
||||
+ { INT_RANGE(mesh_fwding, 0, 1), 0 },
|
||||
{ INT(dot11RSNASAERetransPeriod), 0 },
|
||||
#endif /* CONFIG_MESH */
|
||||
{ INT(disable_scan_offload), 0 },
|
||||
--- a/wpa_supplicant/config.h
|
||||
+++ b/wpa_supplicant/config.h
|
||||
@@ -18,6 +18,7 @@
|
||||
#define DEFAULT_USER_MPM 1
|
||||
#define DEFAULT_MAX_PEER_LINKS 99
|
||||
#define DEFAULT_MESH_MAX_INACTIVITY 300
|
||||
+#define DEFAULT_MESH_FWDING 1
|
||||
/*
|
||||
* The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard,
|
||||
* but use 1000 ms in practice to avoid issues on low power CPUs.
|
||||
@@ -1306,6 +1307,14 @@ struct wpa_config {
|
||||
int mesh_max_inactivity;
|
||||
|
||||
/**
|
||||
+ * mesh_fwding - Mesh network layer-2 forwarding
|
||||
+ *
|
||||
+ * This controls whether to enable layer-2 forwarding.
|
||||
+ * By default: 1: enabled
|
||||
+ */
|
||||
+ int mesh_fwding;
|
||||
+
|
||||
+ /**
|
||||
* dot11RSNASAERetransPeriod - Timeout to retransmit SAE Auth frame
|
||||
*
|
||||
* This timeout value is used in mesh STA to retransmit
|
||||
--- a/wpa_supplicant/config_file.c
|
||||
+++ b/wpa_supplicant/config_file.c
|
||||
@@ -818,6 +818,7 @@ static void wpa_config_write_network(FIL
|
||||
#endif /* IEEE8021X_EAPOL */
|
||||
INT(mode);
|
||||
INT(no_auto_peer);
|
||||
+ INT(mesh_fwding);
|
||||
INT(frequency);
|
||||
INT(fixed_freq);
|
||||
#ifdef CONFIG_ACS
|
||||
@@ -1450,6 +1451,9 @@ static void wpa_config_write_global(FILE
|
||||
fprintf(f, "mesh_max_inactivity=%d\n",
|
||||
config->mesh_max_inactivity);
|
||||
|
||||
+ if (config->mesh_fwding != DEFAULT_MESH_FWDING)
|
||||
+ fprintf(f, "mesh_fwding=%d\n", config->mesh_fwding);
|
||||
+
|
||||
if (config->dot11RSNASAERetransPeriod !=
|
||||
DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD)
|
||||
fprintf(f, "dot11RSNASAERetransPeriod=%d\n",
|
||||
--- a/wpa_supplicant/config_ssid.h
|
||||
+++ b/wpa_supplicant/config_ssid.h
|
||||
@@ -500,6 +500,11 @@ struct wpa_ssid {
|
||||
int dot11MeshConfirmTimeout; /* msec */
|
||||
int dot11MeshHoldingTimeout; /* msec */
|
||||
|
||||
+ /**
|
||||
+ * Mesh network layer-2 forwarding
|
||||
+ */
|
||||
+ int mesh_fwding;
|
||||
+
|
||||
int ht;
|
||||
int ht40;
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -121,6 +121,7 @@ static struct mesh_conf * mesh_config_cr
|
||||
conf->mesh_cc_id = 0;
|
||||
conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET;
|
||||
conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0;
|
||||
+ conf->mesh_fwding = ssid->mesh_fwding;
|
||||
conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries;
|
||||
conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout;
|
||||
conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout;
|
||||
@@ -256,6 +257,7 @@ static int wpa_supplicant_mesh_init(stru
|
||||
bss->conf->start_disabled = 1;
|
||||
bss->conf->mesh = MESH_ENABLED;
|
||||
bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity;
|
||||
+ bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding;
|
||||
|
||||
if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes,
|
||||
wpa_s->hw.num_modes) && wpa_s->conf->country[0]) {
|
||||
@@ -534,6 +536,10 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
}
|
||||
params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity;
|
||||
|
||||
+ /* always explicitely set forwarding to on or off for now */
|
||||
+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_FORWARDING;
|
||||
+ params->conf.forwarding = ssid->mesh_fwding;
|
||||
+
|
||||
wpa_s->mesh_params = params;
|
||||
if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) {
|
||||
wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh");
|
||||
--- a/wpa_supplicant/mesh_mpm.c
|
||||
+++ b/wpa_supplicant/mesh_mpm.c
|
||||
@@ -288,9 +288,9 @@ static void mesh_mpm_send_plink_action(s
|
||||
info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1;
|
||||
/* TODO: Add Connected to Mesh Gate/AS subfields */
|
||||
wpabuf_put_u8(buf, info);
|
||||
- /* always forwarding & accepting plinks for now */
|
||||
+ /* set forwarding & always accepting plinks for now */
|
||||
wpabuf_put_u8(buf, MESH_CAP_ACCEPT_ADDITIONAL_PEER |
|
||||
- MESH_CAP_FORWARDING);
|
||||
+ (conf->mesh_fwding ? MESH_CAP_FORWARDING : 0));
|
||||
} else { /* Peer closing frame */
|
||||
/* IE: Mesh ID */
|
||||
wpabuf_put_u8(buf, WLAN_EID_MESH_ID);
|
||||
--- a/wpa_supplicant/wpa_supplicant.conf
|
||||
+++ b/wpa_supplicant/wpa_supplicant.conf
|
||||
@@ -153,6 +153,9 @@ ap_scan=1
|
||||
# This timeout value is used in mesh STA to clean up inactive stations.
|
||||
#mesh_max_inactivity=300
|
||||
|
||||
+# Enable 802.11s layer-2 routing and forwarding
|
||||
+#mesh_fwding=1
|
||||
+
|
||||
# cert_in_cb - Whether to include a peer certificate dump in events
|
||||
# This controls whether peer certificates for authentication server and
|
||||
# its certificate chain are included in EAP peer certificate events. This is
|
|
@ -0,0 +1,23 @@
|
|||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Thu, 3 May 2018 12:34:31 +0200
|
||||
Subject: [PATCH] mesh: fix crash with CONFIG_TAXONOMY enabled
|
||||
|
||||
wpa_s->ifmsh needs to be allocated using hostapd_alloc_iface() instead
|
||||
of a direct call to os_zalloc, otherwise the linked list for station
|
||||
taxonomy items remains uninitialized, leading to a crash on the first
|
||||
attempt to traverse that list
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -215,7 +215,7 @@ static int wpa_supplicant_mesh_init(stru
|
||||
return 0;
|
||||
}
|
||||
|
||||
- wpa_s->ifmsh = ifmsh = os_zalloc(sizeof(*wpa_s->ifmsh));
|
||||
+ wpa_s->ifmsh = ifmsh = hostapd_alloc_iface();
|
||||
if (!ifmsh)
|
||||
return -ENOMEM;
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
From 838225f2319348e430b553fd9bb3680bd7434ae3 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Wed, 18 Apr 2018 14:14:18 -0700
|
||||
Subject: [PATCH 1/2] mesh: add VHT_CHANWIDTH_USE_HT to max_oper_chwidth
|
||||
|
||||
Channel width in VHT mode refers HT capability when
|
||||
the width goes down to below 80MHz, hence add checking
|
||||
HT channel width to its max operation channel width.
|
||||
So that mesh has capable to select bandwidth below 80Mhz.
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/config.c | 1 +
|
||||
wpa_supplicant/config_ssid.h | 1 +
|
||||
wpa_supplicant/wpa_supplicant.c | 3 +++
|
||||
3 files changed, 5 insertions(+)
|
||||
|
||||
--- a/wpa_supplicant/config.c
|
||||
+++ b/wpa_supplicant/config.c
|
||||
@@ -2802,6 +2802,7 @@ void wpa_config_set_network_defaults(str
|
||||
ssid->mka_priority = DEFAULT_PRIO_NOT_KEY_SERVER;
|
||||
#endif /* CONFIG_MACSEC */
|
||||
ssid->mac_addr = -1;
|
||||
+ ssid->max_oper_chwidth = (u8)DEFAULT_MAX_OPER_CHWIDTH;
|
||||
}
|
||||
|
||||
|
||||
--- a/wpa_supplicant/config_ssid.h
|
||||
+++ b/wpa_supplicant/config_ssid.h
|
||||
@@ -37,6 +37,7 @@
|
||||
#define DEFAULT_AMPDU_FACTOR -1 /* no change */
|
||||
#define DEFAULT_AMPDU_DENSITY -1 /* no change */
|
||||
#define DEFAULT_USER_SELECTED_SIM 1
|
||||
+#define DEFAULT_MAX_OPER_CHWIDTH -1
|
||||
|
||||
struct psk_list_entry {
|
||||
struct dl_list list;
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2312,6 +2312,9 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
|
||||
seg0 = 114;
|
||||
}
|
||||
+ } else if (ssid->max_oper_chwidth == VHT_CHANWIDTH_USE_HT) {
|
||||
+ chwidth = VHT_CHANWIDTH_USE_HT;
|
||||
+ seg0 = vht80[j] + 2;
|
||||
}
|
||||
|
||||
if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq,
|
|
@ -0,0 +1,82 @@
|
|||
From 24fc73b2470ff79cd8c92e029ca785c8e95a204c Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
Date: Wed, 18 Apr 2018 14:14:19 -0700
|
||||
Subject: [PATCH 2/2] mesh: implement use of VHT20 config in mesh mode
|
||||
|
||||
mesh in VHT mode is supposed to be able to use any bandwidth
|
||||
that 11ac supports, but we don't have a way to set VHT20
|
||||
although there are parameters that are supposed to be used.
|
||||
This patch along with the patch of
|
||||
"mesh: add VHT_CHANWIDTH_USE_HT to max_oper_chwidth" makes mesh
|
||||
available to use of any bandwidth using combination of
|
||||
existing parameters like below shown.
|
||||
|
||||
VHT80:
|
||||
default
|
||||
do not set any parameters
|
||||
VHT40:
|
||||
max_oper_chwidth = 0
|
||||
VHT20:
|
||||
max_oper_chwidth=0
|
||||
disable_ht40=1
|
||||
HT40:
|
||||
disable_vht = 1
|
||||
HT20:
|
||||
disable_ht40 = 1
|
||||
disable HT:
|
||||
disable_ht = 1
|
||||
|
||||
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
||||
---
|
||||
wpa_supplicant/wpa_supplicant.c | 18 +++++++++++++-----
|
||||
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2144,9 +2144,15 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
if (!dfs_enabled)
|
||||
return;
|
||||
|
||||
+ freq->channel = pri_chan->chan;
|
||||
+
|
||||
#ifdef CONFIG_HT_OVERRIDES
|
||||
- if (ssid->disable_ht40)
|
||||
- return;
|
||||
+ if (ssid->disable_ht40) {
|
||||
+ if (ssid->disable_vht)
|
||||
+ return;
|
||||
+ else
|
||||
+ goto skip_ht40;
|
||||
+ }
|
||||
#endif /* CONFIG_HT_OVERRIDES */
|
||||
|
||||
/* Check/setup HT40+/HT40- */
|
||||
@@ -2174,8 +2180,6 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
if (!dfs_enabled)
|
||||
return;
|
||||
|
||||
- freq->channel = pri_chan->chan;
|
||||
-
|
||||
if (ht40 == -1) {
|
||||
if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS))
|
||||
return;
|
||||
@@ -2219,6 +2223,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
wpa_scan_results_free(scan_res);
|
||||
}
|
||||
|
||||
+skip_ht40:
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"IBSS/mesh: setup freq channel %d, sec_channel_offset %d",
|
||||
freq->channel, freq->sec_channel_offset);
|
||||
@@ -2314,7 +2319,10 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
}
|
||||
} else if (ssid->max_oper_chwidth == VHT_CHANWIDTH_USE_HT) {
|
||||
chwidth = VHT_CHANWIDTH_USE_HT;
|
||||
- seg0 = vht80[j] + 2;
|
||||
+ if (ssid->disable_ht40)
|
||||
+ seg0 = 0;
|
||||
+ else
|
||||
+ seg0 = vht80[j] + 2;
|
||||
}
|
||||
|
||||
if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq,
|
|
@ -0,0 +1,45 @@
|
|||
From 444adf78eeb129e415d53fcb2fa2f05b6a69abdc Mon Sep 17 00:00:00 2001
|
||||
From: Sven Eckelmann <sven.eckelmann@openmesh.com>
|
||||
Date: Mon, 7 May 2018 15:24:29 +0200
|
||||
Subject: wpa_supplicant: Fix parsing of max_oper_chwidth
|
||||
|
||||
The max_oper_chwidth is parsed in wpa_config_set as INT_RANGE (see
|
||||
ssid_fields). The actual parsing for INT_RANGE is done by
|
||||
wpa_config_parse_int which can only store the result as full integer.
|
||||
|
||||
max_oper_chwidth is stored as u8 (a single byte) in wpa_ssid. This means
|
||||
that on little endian systems, the least significant byte of the parsed
|
||||
value are really stored in the max_oper_chwidth. But on big endian system,
|
||||
the only most significant byte is stored as max_oper_chwidth. This means
|
||||
that 0 is always stored because the provided range doesn't allow any other
|
||||
value for systems with multi-byte-wide integers.
|
||||
|
||||
This also means that for common systems with 4-byte-wide integers, the
|
||||
remaining 3 bytes were written after the actual member of the struct. This
|
||||
should not have influenced the behavior of succeeding members because these
|
||||
bytes would have been part of the padding between the members on most
|
||||
systems.
|
||||
|
||||
Increasing its size to a full int fixes the write operations outside of the
|
||||
member and allows to use the max_oper_chwidth setting on big endian
|
||||
systems.
|
||||
|
||||
Fixes: 0f29bc68d18e ("IBSS/mesh: Add support for VHT80P80 configuration")
|
||||
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
|
||||
|
||||
Forwarded: https://patchwork.ozlabs.org/patch/909751/
|
||||
---
|
||||
wpa_supplicant/config_ssid.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/wpa_supplicant/config_ssid.h
|
||||
+++ b/wpa_supplicant/config_ssid.h
|
||||
@@ -511,7 +511,7 @@ struct wpa_ssid {
|
||||
|
||||
int vht;
|
||||
|
||||
- u8 max_oper_chwidth;
|
||||
+ int max_oper_chwidth;
|
||||
|
||||
unsigned int vht_center_freq1;
|
||||
unsigned int vht_center_freq2;
|
|
@ -0,0 +1,97 @@
|
|||
--- a/src/utils/os_unix.c
|
||||
+++ b/src/utils/os_unix.c
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/wait.h>
|
||||
+#include <fcntl.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <sys/capability.h>
|
||||
@@ -182,59 +183,46 @@ int os_gmtime(os_time_t t, struct os_tm
|
||||
return 0;
|
||||
}
|
||||
|
||||
-
|
||||
-#ifdef __APPLE__
|
||||
-#include <fcntl.h>
|
||||
-static int os_daemon(int nochdir, int noclose)
|
||||
+int os_daemonize(const char *pid_file)
|
||||
{
|
||||
- int devnull;
|
||||
+ int pid = 0, i, devnull;
|
||||
|
||||
- if (chdir("/") < 0)
|
||||
- return -1;
|
||||
+#if defined(__uClinux__) || defined(__sun__)
|
||||
+ return -1;
|
||||
+#else /* defined(__uClinux__) || defined(__sun__) */
|
||||
|
||||
- devnull = open("/dev/null", O_RDWR);
|
||||
- if (devnull < 0)
|
||||
+#ifndef __APPLE__
|
||||
+ pid = fork();
|
||||
+ if (pid < 0)
|
||||
return -1;
|
||||
+#endif
|
||||
|
||||
- if (dup2(devnull, STDIN_FILENO) < 0) {
|
||||
- close(devnull);
|
||||
- return -1;
|
||||
+ if (pid > 0) {
|
||||
+ if (pid_file) {
|
||||
+ FILE *f = fopen(pid_file, "w");
|
||||
+ if (f) {
|
||||
+ fprintf(f, "%u\n", pid);
|
||||
+ fclose(f);
|
||||
+ }
|
||||
+ }
|
||||
+ _exit(0);
|
||||
}
|
||||
|
||||
- if (dup2(devnull, STDOUT_FILENO) < 0) {
|
||||
- close(devnull);
|
||||
+ if (setsid() < 0)
|
||||
return -1;
|
||||
- }
|
||||
|
||||
- if (dup2(devnull, STDERR_FILENO) < 0) {
|
||||
- close(devnull);
|
||||
+ if (chdir("/") < 0)
|
||||
return -1;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-#else /* __APPLE__ */
|
||||
-#define os_daemon daemon
|
||||
-#endif /* __APPLE__ */
|
||||
|
||||
-
|
||||
-int os_daemonize(const char *pid_file)
|
||||
-{
|
||||
-#if defined(__uClinux__) || defined(__sun__)
|
||||
- return -1;
|
||||
-#else /* defined(__uClinux__) || defined(__sun__) */
|
||||
- if (os_daemon(0, 0)) {
|
||||
- perror("daemon");
|
||||
+ devnull = open("/dev/null", O_RDWR);
|
||||
+ if (devnull < 0)
|
||||
return -1;
|
||||
- }
|
||||
|
||||
- if (pid_file) {
|
||||
- FILE *f = fopen(pid_file, "w");
|
||||
- if (f) {
|
||||
- fprintf(f, "%u\n", getpid());
|
||||
- fclose(f);
|
||||
- }
|
||||
- }
|
||||
+ for (i = 0; i <= STDERR_FILENO; i++)
|
||||
+ dup2(devnull, i);
|
||||
+
|
||||
+ if (devnull > 2)
|
||||
+ close(devnull);
|
||||
|
||||
return -0;
|
||||
#endif /* defined(__uClinux__) || defined(__sun__) */
|
|
@ -0,0 +1,14 @@
|
|||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -292,9 +292,10 @@ void wpa_supplicant_cancel_auth_timeout(
|
||||
*/
|
||||
void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
+ struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
+
|
||||
#ifdef IEEE8021X_EAPOL
|
||||
struct eapol_config eapol_conf;
|
||||
- struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
|
||||
#ifdef CONFIG_IBSS_RSN
|
||||
if (ssid->mode == WPAS_MODE_IBSS &&
|
|
@ -0,0 +1,12 @@
|
|||
--- a/src/l2_packet/l2_packet_linux.c
|
||||
+++ b/src/l2_packet/l2_packet_linux.c
|
||||
@@ -360,8 +360,7 @@ struct l2_packet_data * l2_packet_init_b
|
||||
|
||||
l2 = l2_packet_init(br_ifname, own_addr, protocol, rx_callback,
|
||||
rx_callback_ctx, l2_hdr);
|
||||
- if (!l2)
|
||||
- return NULL;
|
||||
+ return l2;
|
||||
|
||||
#ifndef CONFIG_NO_LINUX_PACKET_SOCKET_WAR
|
||||
/*
|
|
@ -0,0 +1,355 @@
|
|||
--- a/hostapd/Makefile
|
||||
+++ b/hostapd/Makefile
|
||||
@@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils)
|
||||
export BINDIR ?= /usr/local/bin/
|
||||
|
||||
-include .config
|
||||
+-include $(if $(MULTICALL), ../wpa_supplicant/.config)
|
||||
|
||||
ifndef CONFIG_NO_GITVER
|
||||
# Add VERSION_STR postfix for builds from a git repository
|
||||
@@ -198,7 +199,8 @@ endif
|
||||
|
||||
ifdef CONFIG_NO_VLAN
|
||||
CFLAGS += -DCONFIG_NO_VLAN
|
||||
-else
|
||||
+endif
|
||||
+ifneq ($(findstring CONFIG_NO_VLAN,$(CFLAGS)), CONFIG_NO_VLAN)
|
||||
OBJS += ../src/ap/vlan_init.o
|
||||
OBJS += ../src/ap/vlan_ifconfig.o
|
||||
OBJS += ../src/ap/vlan.o
|
||||
@@ -354,10 +356,14 @@ CFLAGS += -DCONFIG_MBO
|
||||
OBJS += ../src/ap/mbo_ap.o
|
||||
endif
|
||||
|
||||
+ifndef MULTICALL
|
||||
+CFLAGS += -DNO_SUPPLICANT
|
||||
+endif
|
||||
+
|
||||
include ../src/drivers/drivers.mak
|
||||
-OBJS += $(DRV_AP_OBJS)
|
||||
-CFLAGS += $(DRV_AP_CFLAGS)
|
||||
-LDFLAGS += $(DRV_AP_LDFLAGS)
|
||||
+OBJS += $(sort $(DRV_AP_OBJS) $(if $(MULTICALL),$(DRV_WPA_OBJS)))
|
||||
+CFLAGS += $(DRV_AP_CFLAGS) $(if $(MULTICALL),$(DRV_WPA_CFLAGS))
|
||||
+LDFLAGS += $(DRV_AP_LDFLAGS) $(if $(MULTICALL),$(DRV_WPA_LDFLAGS))
|
||||
LIBS += $(DRV_AP_LIBS)
|
||||
|
||||
ifdef CONFIG_L2_PACKET
|
||||
@@ -1274,6 +1280,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
|
||||
|
||||
BCHECK=../src/drivers/build.hostapd
|
||||
|
||||
+hostapd_multi.a: $(BCHECK) $(OBJS)
|
||||
+ $(Q)$(CC) -c -o hostapd_multi.o -Dmain=hostapd_main $(CFLAGS) main.c
|
||||
+ @$(E) " CC " $<
|
||||
+ @rm -f $@
|
||||
+ @$(AR) cr $@ hostapd_multi.o $(OBJS)
|
||||
+
|
||||
hostapd: $(BCHECK) $(OBJS)
|
||||
$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
|
||||
@$(E) " LD " $@
|
||||
@@ -1316,6 +1328,12 @@ ifeq ($(CONFIG_TLS), linux)
|
||||
HOBJS += ../src/crypto/crypto_linux.o
|
||||
endif
|
||||
|
||||
+dump_cflags:
|
||||
+ @printf "%s " "$(CFLAGS)"
|
||||
+
|
||||
+dump_ldflags:
|
||||
+ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
|
||||
+
|
||||
nt_password_hash: $(NOBJS)
|
||||
$(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
|
||||
@$(E) " LD " $@
|
||||
--- a/wpa_supplicant/Makefile
|
||||
+++ b/wpa_supplicant/Makefile
|
||||
@@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src)
|
||||
CFLAGS += -I$(abspath ../src/utils)
|
||||
|
||||
-include .config
|
||||
+-include $(if $(MULTICALL),../hostapd/.config)
|
||||
|
||||
ifndef CONFIG_NO_GITVER
|
||||
# Add VERSION_STR postfix for builds from a git repository
|
||||
@@ -354,7 +355,9 @@ endif
|
||||
ifdef CONFIG_IBSS_RSN
|
||||
NEED_RSN_AUTHENTICATOR=y
|
||||
CFLAGS += -DCONFIG_IBSS_RSN
|
||||
+ifndef MULTICALL
|
||||
CFLAGS += -DCONFIG_NO_VLAN
|
||||
+endif
|
||||
OBJS += ibss_rsn.o
|
||||
endif
|
||||
|
||||
@@ -862,6 +865,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
|
||||
CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
|
||||
LIBS += -ldl -rdynamic
|
||||
endif
|
||||
+else
|
||||
+ ifdef MULTICALL
|
||||
+ OBJS += ../src/eap_common/eap_common.o
|
||||
+ endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_AP
|
||||
@@ -869,9 +876,11 @@ NEED_EAP_COMMON=y
|
||||
NEED_RSN_AUTHENTICATOR=y
|
||||
CFLAGS += -DCONFIG_AP
|
||||
OBJS += ap.o
|
||||
+ifndef MULTICALL
|
||||
CFLAGS += -DCONFIG_NO_RADIUS
|
||||
CFLAGS += -DCONFIG_NO_ACCOUNTING
|
||||
CFLAGS += -DCONFIG_NO_VLAN
|
||||
+endif
|
||||
OBJS += ../src/ap/hostapd.o
|
||||
OBJS += ../src/ap/wpa_auth_glue.o
|
||||
OBJS += ../src/ap/utils.o
|
||||
@@ -953,6 +962,12 @@ endif
|
||||
ifdef CONFIG_HS20
|
||||
OBJS += ../src/ap/hs20.o
|
||||
endif
|
||||
+else
|
||||
+ ifdef MULTICALL
|
||||
+ OBJS += ../src/eap_server/eap_server.o
|
||||
+ OBJS += ../src/eap_server/eap_server_identity.o
|
||||
+ OBJS += ../src/eap_server/eap_server_methods.o
|
||||
+ endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_MBO
|
||||
@@ -961,7 +976,9 @@ CFLAGS += -DCONFIG_MBO
|
||||
endif
|
||||
|
||||
ifdef NEED_RSN_AUTHENTICATOR
|
||||
+ifndef MULTICALL
|
||||
CFLAGS += -DCONFIG_NO_RADIUS
|
||||
+endif
|
||||
NEED_AES_WRAP=y
|
||||
OBJS += ../src/ap/wpa_auth.o
|
||||
OBJS += ../src/ap/wpa_auth_ie.o
|
||||
@@ -1888,6 +1905,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
|
||||
|
||||
$(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
|
||||
|
||||
+wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
|
||||
+ $(Q)$(CC) -c -o wpa_supplicant_multi.o -Dmain=wpa_supplicant_main $(CFLAGS) main.c
|
||||
+ @$(E) " CC " $<
|
||||
+ @rm -f $@
|
||||
+ @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
|
||||
+
|
||||
wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
|
||||
$(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
|
||||
@$(E) " LD " $@
|
||||
@@ -1990,6 +2013,12 @@ endif
|
||||
-e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@
|
||||
@$(E) " sed" $<
|
||||
|
||||
+dump_cflags:
|
||||
+ @printf "%s " "$(CFLAGS)"
|
||||
+
|
||||
+dump_ldflags:
|
||||
+ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
|
||||
+
|
||||
wpa_supplicant.exe: wpa_supplicant
|
||||
mv -f $< $@
|
||||
wpa_cli.exe: wpa_cli
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -5449,8 +5449,8 @@ union wpa_event_data {
|
||||
* Driver wrapper code should call this function whenever an event is received
|
||||
* from the driver.
|
||||
*/
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data);
|
||||
+extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
/**
|
||||
* wpa_supplicant_event_global - Report a driver event for wpa_supplicant
|
||||
@@ -5462,7 +5462,7 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
* Same as wpa_supplicant_event(), but we search for the interface in
|
||||
* wpa_global.
|
||||
*/
|
||||
-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
|
||||
union wpa_event_data *data);
|
||||
|
||||
/*
|
||||
--- a/src/ap/drv_callbacks.c
|
||||
+++ b/src/ap/drv_callbacks.c
|
||||
@@ -1515,8 +1515,8 @@ static void hostapd_event_wds_sta_interf
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data)
|
||||
+void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data)
|
||||
{
|
||||
struct hostapd_data *hapd = ctx;
|
||||
#ifndef CONFIG_NO_STDOUT_DEBUG
|
||||
@@ -1742,7 +1742,7 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
|
||||
union wpa_event_data *data)
|
||||
{
|
||||
struct hapd_interfaces *interfaces = ctx;
|
||||
--- a/wpa_supplicant/wpa_priv.c
|
||||
+++ b/wpa_supplicant/wpa_priv.c
|
||||
@@ -1031,8 +1031,8 @@ static void wpa_priv_send_ft_response(st
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data)
|
||||
+static void supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data)
|
||||
{
|
||||
struct wpa_priv_interface *iface = ctx;
|
||||
|
||||
@@ -1095,7 +1095,7 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+void supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
union wpa_event_data *data)
|
||||
{
|
||||
struct wpa_priv_global *global = ctx;
|
||||
@@ -1207,6 +1207,8 @@ int main(int argc, char *argv[])
|
||||
if (os_program_init())
|
||||
return -1;
|
||||
|
||||
+ wpa_supplicant_event = supplicant_event;
|
||||
+ wpa_supplicant_event_global = supplicant_event_global;
|
||||
wpa_priv_fd_workaround();
|
||||
|
||||
os_memset(&global, 0, sizeof(global));
|
||||
--- a/wpa_supplicant/events.c
|
||||
+++ b/wpa_supplicant/events.c
|
||||
@@ -3976,8 +3976,8 @@ static void wpas_event_assoc_reject(stru
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data)
|
||||
+void supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = ctx;
|
||||
int resched;
|
||||
@@ -4745,7 +4745,7 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+void supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
union wpa_event_data *data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s;
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -5797,7 +5797,6 @@ struct wpa_interface * wpa_supplicant_ma
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-
|
||||
/**
|
||||
* wpa_supplicant_match_existing - Match existing interfaces
|
||||
* @global: Pointer to global data from wpa_supplicant_init()
|
||||
@@ -5834,6 +5833,11 @@ static int wpa_supplicant_match_existing
|
||||
|
||||
#endif /* CONFIG_MATCH_IFACE */
|
||||
|
||||
+extern void supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+
|
||||
+extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
/**
|
||||
* wpa_supplicant_add_iface - Add a new network interface
|
||||
@@ -6090,6 +6094,8 @@ struct wpa_global * wpa_supplicant_init(
|
||||
#ifndef CONFIG_NO_WPA_MSG
|
||||
wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
|
||||
#endif /* CONFIG_NO_WPA_MSG */
|
||||
+ wpa_supplicant_event = supplicant_event;
|
||||
+ wpa_supplicant_event_global = supplicant_event_global;
|
||||
|
||||
if (params->wpa_debug_file_path)
|
||||
wpa_debug_open_file(params->wpa_debug_file_path);
|
||||
--- a/hostapd/main.c
|
||||
+++ b/hostapd/main.c
|
||||
@@ -591,6 +591,11 @@ fail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
+void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+
|
||||
+void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
#ifdef CONFIG_WPS
|
||||
static int gen_uuid(const char *txt_addr)
|
||||
@@ -674,6 +679,8 @@ int main(int argc, char *argv[])
|
||||
hostapd_dpp_init_global(&interfaces);
|
||||
#endif /* CONFIG_DPP */
|
||||
|
||||
+ wpa_supplicant_event = hostapd_wpa_event;
|
||||
+ wpa_supplicant_event_global = hostapd_wpa_event_global;
|
||||
for (;;) {
|
||||
c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:");
|
||||
if (c < 0)
|
||||
--- a/src/drivers/drivers.c
|
||||
+++ b/src/drivers/drivers.c
|
||||
@@ -10,6 +10,10 @@
|
||||
#include "utils/common.h"
|
||||
#include "driver.h"
|
||||
|
||||
+void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
const struct wpa_driver_ops *const wpa_drivers[] =
|
||||
{
|
||||
--- a/wpa_supplicant/eapol_test.c
|
||||
+++ b/wpa_supplicant/eapol_test.c
|
||||
@@ -29,7 +29,12 @@
|
||||
#include "ctrl_iface.h"
|
||||
#include "pcsc_funcs.h"
|
||||
#include "wpas_glue.h"
|
||||
+#include "drivers/driver.h"
|
||||
|
||||
+void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
|
||||
|
||||
@@ -1295,6 +1300,10 @@ static void usage(void)
|
||||
"option several times.\n");
|
||||
}
|
||||
|
||||
+extern void supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -1315,6 +1324,8 @@ int main(int argc, char *argv[])
|
||||
if (os_program_init())
|
||||
return -1;
|
||||
|
||||
+ wpa_supplicant_event = supplicant_event;
|
||||
+ wpa_supplicant_event_global = supplicant_event_global;
|
||||
hostapd_logger_register_cb(hostapd_logger_cb);
|
||||
|
||||
os_memset(&eapol_test, 0, sizeof(eapol_test));
|
|
@ -0,0 +1,58 @@
|
|||
--- a/hostapd/config_file.c
|
||||
+++ b/hostapd/config_file.c
|
||||
@@ -3214,6 +3214,10 @@ static int hostapd_config_fill(struct ho
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
#ifdef CONFIG_IEEE80211N
|
||||
+ } else if (os_strcmp(buf, "noscan") == 0) {
|
||||
+ conf->noscan = atoi(pos);
|
||||
+ } else if (os_strcmp(buf, "ht_coex") == 0) {
|
||||
+ conf->no_ht_coex = !atoi(pos);
|
||||
} else if (os_strcmp(buf, "ieee80211n") == 0) {
|
||||
conf->ieee80211n = atoi(pos);
|
||||
} else if (os_strcmp(buf, "ht_capab") == 0) {
|
||||
--- a/src/ap/ap_config.h
|
||||
+++ b/src/ap/ap_config.h
|
||||
@@ -775,6 +775,8 @@ struct hostapd_config {
|
||||
|
||||
int ht_op_mode_fixed;
|
||||
u16 ht_capab;
|
||||
+ int noscan;
|
||||
+ int no_ht_coex;
|
||||
int ieee80211n;
|
||||
int secondary_channel;
|
||||
int no_pri_sec_switch;
|
||||
--- a/src/ap/hw_features.c
|
||||
+++ b/src/ap/hw_features.c
|
||||
@@ -480,7 +480,8 @@ static int ieee80211n_check_40mhz(struct
|
||||
int ret;
|
||||
|
||||
/* Check that HT40 is used and PRI / SEC switch is allowed */
|
||||
- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
|
||||
+ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch ||
|
||||
+ iface->conf->noscan)
|
||||
return 0;
|
||||
|
||||
hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
|
||||
--- a/src/ap/ieee802_11_ht.c
|
||||
+++ b/src/ap/ieee802_11_ht.c
|
||||
@@ -252,6 +252,9 @@ void hostapd_2040_coex_action(struct hos
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (iface->conf->noscan || iface->conf->no_ht_coex)
|
||||
+ return;
|
||||
+
|
||||
if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"Ignore too short 20/40 BSS Coexistence Management frame");
|
||||
@@ -412,6 +415,9 @@ void ht40_intolerant_add(struct hostapd_
|
||||
if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
|
||||
return;
|
||||
|
||||
+ if (iface->conf->noscan || iface->conf->no_ht_coex)
|
||||
+ return;
|
||||
+
|
||||
wpa_printf(MSG_INFO, "HT: Forty MHz Intolerant is set by STA " MACSTR
|
||||
" in Association Request", MAC2STR(sta->addr));
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
--- a/wpa_supplicant/config.c
|
||||
+++ b/wpa_supplicant/config.c
|
||||
@@ -2217,6 +2217,7 @@ static const struct parse_data ssid_fiel
|
||||
#else /* CONFIG_MESH */
|
||||
{ INT_RANGE(mode, 0, 4) },
|
||||
#endif /* CONFIG_MESH */
|
||||
+ { INT_RANGE(noscan, 0, 1) },
|
||||
{ INT_RANGE(proactive_key_caching, 0, 1) },
|
||||
{ INT_RANGE(disabled, 0, 2) },
|
||||
{ STR(id_str) },
|
||||
--- a/wpa_supplicant/config_file.c
|
||||
+++ b/wpa_supplicant/config_file.c
|
||||
@@ -818,6 +818,7 @@ static void wpa_config_write_network(FIL
|
||||
#endif /* IEEE8021X_EAPOL */
|
||||
INT(mode);
|
||||
INT(no_auto_peer);
|
||||
+ INT(noscan);
|
||||
INT(mesh_fwding);
|
||||
INT(frequency);
|
||||
INT(fixed_freq);
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -288,6 +288,8 @@ static int wpa_supplicant_mesh_init(stru
|
||||
frequency);
|
||||
goto out_free;
|
||||
}
|
||||
+ if (ssid->noscan)
|
||||
+ conf->noscan = 1;
|
||||
if (ssid->ht40)
|
||||
conf->secondary_channel = ssid->ht40;
|
||||
if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) {
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2051,12 +2051,12 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
{
|
||||
enum hostapd_hw_mode hw_mode;
|
||||
struct hostapd_hw_modes *mode = NULL;
|
||||
- int ht40plus[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157,
|
||||
+ int ht40plus[] = { 1, 2, 3, 4, 5, 6, 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157,
|
||||
184, 192 };
|
||||
int vht80[] = { 36, 52, 100, 116, 132, 149 };
|
||||
struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL;
|
||||
u8 channel;
|
||||
- int i, chan_idx, ht40 = -1, res, obss_scan = 1;
|
||||
+ int i, chan_idx, ht40 = -1, res, obss_scan = !(ssid->noscan);
|
||||
unsigned int j, k;
|
||||
struct hostapd_freq_params vht_freq;
|
||||
int chwidth, seg0, seg1;
|
||||
@@ -2126,7 +2126,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
return;
|
||||
|
||||
/* Setup higher BW only for 5 GHz */
|
||||
- if (mode->mode != HOSTAPD_MODE_IEEE80211A)
|
||||
+ if (mode->mode != HOSTAPD_MODE_IEEE80211A && !(ssid->noscan))
|
||||
return;
|
||||
|
||||
for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) {
|
||||
--- a/wpa_supplicant/config_ssid.h
|
||||
+++ b/wpa_supplicant/config_ssid.h
|
||||
@@ -856,6 +856,8 @@ struct wpa_ssid {
|
||||
*/
|
||||
int no_auto_peer;
|
||||
|
||||
+ int noscan;
|
||||
+
|
||||
/**
|
||||
* mesh_rssi_threshold - Set mesh parameter mesh_rssi_threshold (dBm)
|
||||
*
|
|
@ -0,0 +1,11 @@
|
|||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -4248,7 +4248,7 @@ wpa_supplicant_alloc(struct wpa_supplica
|
||||
if (wpa_s == NULL)
|
||||
return NULL;
|
||||
wpa_s->scan_req = INITIAL_SCAN_REQ;
|
||||
- wpa_s->scan_interval = 5;
|
||||
+ wpa_s->scan_interval = 1;
|
||||
wpa_s->new_connection = 1;
|
||||
wpa_s->parent = parent ? parent : wpa_s;
|
||||
wpa_s->p2pdev = wpa_s->parent;
|
|
@ -0,0 +1,61 @@
|
|||
--- a/src/drivers/drivers.mak
|
||||
+++ b/src/drivers/drivers.mak
|
||||
@@ -49,7 +49,6 @@ NEED_SME=y
|
||||
NEED_AP_MLME=y
|
||||
NEED_NETLINK=y
|
||||
NEED_LINUX_IOCTL=y
|
||||
-NEED_RFKILL=y
|
||||
NEED_RADIOTAP=y
|
||||
|
||||
ifdef CONFIG_LIBNL32
|
||||
@@ -136,7 +135,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
|
||||
CONFIG_WIRELESS_EXTENSION=y
|
||||
NEED_NETLINK=y
|
||||
NEED_LINUX_IOCTL=y
|
||||
-NEED_RFKILL=y
|
||||
endif
|
||||
|
||||
ifdef CONFIG_DRIVER_NDIS
|
||||
@@ -162,7 +160,6 @@ endif
|
||||
ifdef CONFIG_WIRELESS_EXTENSION
|
||||
DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
|
||||
DRV_WPA_OBJS += ../src/drivers/driver_wext.o
|
||||
-NEED_RFKILL=y
|
||||
endif
|
||||
|
||||
ifdef NEED_NETLINK
|
||||
@@ -175,6 +172,7 @@ endif
|
||||
|
||||
ifdef NEED_RFKILL
|
||||
DRV_OBJS += ../src/drivers/rfkill.o
|
||||
+DRV_WPA_CFLAGS += -DCONFIG_RFKILL
|
||||
endif
|
||||
|
||||
ifdef NEED_RADIOTAP
|
||||
--- a/src/drivers/rfkill.h
|
||||
+++ b/src/drivers/rfkill.h
|
||||
@@ -18,8 +18,24 @@ struct rfkill_config {
|
||||
void (*unblocked_cb)(void *ctx);
|
||||
};
|
||||
|
||||
+#ifdef CONFIG_RFKILL
|
||||
struct rfkill_data * rfkill_init(struct rfkill_config *cfg);
|
||||
void rfkill_deinit(struct rfkill_data *rfkill);
|
||||
int rfkill_is_blocked(struct rfkill_data *rfkill);
|
||||
+#else
|
||||
+static inline struct rfkill_data * rfkill_init(struct rfkill_config *cfg)
|
||||
+{
|
||||
+ return (void *) 1;
|
||||
+}
|
||||
+
|
||||
+static inline void rfkill_deinit(struct rfkill_data *rfkill)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static inline int rfkill_is_blocked(struct rfkill_data *rfkill)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
|
||||
#endif /* RFKILL_H */
|
|
@ -0,0 +1,11 @@
|
|||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -4234,7 +4234,7 @@ static int nl80211_set_channel(struct i8
|
||||
freq->freq, freq->ht_enabled, freq->vht_enabled,
|
||||
freq->bandwidth, freq->center_freq1, freq->center_freq2);
|
||||
|
||||
- msg = nl80211_drv_msg(drv, 0, set_chan ? NL80211_CMD_SET_CHANNEL :
|
||||
+ msg = nl80211_bss_msg(bss, 0, set_chan ? NL80211_CMD_SET_CHANNEL :
|
||||
NL80211_CMD_SET_WIPHY);
|
||||
if (!msg || nl80211_put_freq_params(msg, freq) < 0) {
|
||||
nlmsg_free(msg);
|
|
@ -0,0 +1,69 @@
|
|||
--- a/src/ap/hostapd.c
|
||||
+++ b/src/ap/hostapd.c
|
||||
@@ -93,6 +93,25 @@ static void hostapd_reload_bss(struct ho
|
||||
#endif /* CONFIG_NO_RADIUS */
|
||||
|
||||
ssid = &hapd->conf->ssid;
|
||||
+
|
||||
+ hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq,
|
||||
+ hapd->iconf->channel,
|
||||
+ hapd->iconf->ieee80211n,
|
||||
+ hapd->iconf->ieee80211ac,
|
||||
+ hapd->iconf->secondary_channel,
|
||||
+ hapd->iconf->vht_oper_chwidth,
|
||||
+ hapd->iconf->vht_oper_centr_freq_seg0_idx,
|
||||
+ hapd->iconf->vht_oper_centr_freq_seg1_idx);
|
||||
+
|
||||
+ if (hapd->iface->current_mode) {
|
||||
+ if (hostapd_prepare_rates(hapd->iface, hapd->iface->current_mode)) {
|
||||
+ wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
|
||||
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
|
||||
+ HOSTAPD_LEVEL_WARNING,
|
||||
+ "Failed to prepare rates table.");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
|
||||
ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
|
||||
/*
|
||||
@@ -171,6 +190,7 @@ int hostapd_reload_config(struct hostapd
|
||||
struct hostapd_data *hapd = iface->bss[0];
|
||||
struct hostapd_config *newconf, *oldconf;
|
||||
size_t j;
|
||||
+ int i;
|
||||
|
||||
if (iface->config_fname == NULL) {
|
||||
/* Only in-memory config in use - assume it has been updated */
|
||||
@@ -192,21 +212,20 @@ int hostapd_reload_config(struct hostapd
|
||||
oldconf = hapd->iconf;
|
||||
iface->conf = newconf;
|
||||
|
||||
+ for (i = 0; i < iface->num_hw_features; i++) {
|
||||
+ struct hostapd_hw_modes *mode = &iface->hw_features[i];
|
||||
+ if (mode->mode == iface->conf->hw_mode) {
|
||||
+ iface->current_mode = mode;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (iface->conf->channel)
|
||||
+ iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel);
|
||||
+
|
||||
for (j = 0; j < iface->num_bss; j++) {
|
||||
hapd = iface->bss[j];
|
||||
hapd->iconf = newconf;
|
||||
- hapd->iconf->channel = oldconf->channel;
|
||||
- hapd->iconf->acs = oldconf->acs;
|
||||
- hapd->iconf->secondary_channel = oldconf->secondary_channel;
|
||||
- hapd->iconf->ieee80211n = oldconf->ieee80211n;
|
||||
- hapd->iconf->ieee80211ac = oldconf->ieee80211ac;
|
||||
- hapd->iconf->ht_capab = oldconf->ht_capab;
|
||||
- hapd->iconf->vht_capab = oldconf->vht_capab;
|
||||
- hapd->iconf->vht_oper_chwidth = oldconf->vht_oper_chwidth;
|
||||
- hapd->iconf->vht_oper_centr_freq_seg0_idx =
|
||||
- oldconf->vht_oper_centr_freq_seg0_idx;
|
||||
- hapd->iconf->vht_oper_centr_freq_seg1_idx =
|
||||
- oldconf->vht_oper_centr_freq_seg1_idx;
|
||||
hapd->conf = newconf->bss[j];
|
||||
hostapd_reload_bss(hapd);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -2566,10 +2566,15 @@ static int wpa_driver_nl80211_del_beacon
|
||||
struct nl_msg *msg;
|
||||
struct wpa_driver_nl80211_data *drv = bss->drv;
|
||||
|
||||
+ if (!bss->beacon_set)
|
||||
+ return 0;
|
||||
+
|
||||
+ bss->beacon_set = 0;
|
||||
+
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Remove beacon (ifindex=%d)",
|
||||
- drv->ifindex);
|
||||
+ bss->ifindex);
|
||||
nl80211_put_wiphy_data_ap(bss);
|
||||
- msg = nl80211_drv_msg(drv, 0, NL80211_CMD_DEL_BEACON);
|
||||
+ msg = nl80211_bss_msg(bss, 0, NL80211_CMD_DEL_BEACON);
|
||||
return send_and_recv_msgs(drv, msg, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -4835,7 +4840,7 @@ static void nl80211_teardown_ap(struct i
|
||||
nl80211_mgmt_unsubscribe(bss, "AP teardown");
|
||||
|
||||
nl80211_put_wiphy_data_ap(bss);
|
||||
- bss->beacon_set = 0;
|
||||
+ wpa_driver_nl80211_del_beacon(bss);
|
||||
}
|
||||
|
||||
|
||||
@@ -7057,8 +7062,6 @@ static int wpa_driver_nl80211_if_remove(
|
||||
} else {
|
||||
wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context");
|
||||
nl80211_teardown_ap(bss);
|
||||
- if (!bss->added_if && !drv->first_bss->next)
|
||||
- wpa_driver_nl80211_del_beacon(bss);
|
||||
nl80211_destroy_bss(bss);
|
||||
if (!bss->added_if)
|
||||
i802_set_iface_flags(bss, 0);
|
||||
@@ -7437,7 +7440,6 @@ static int wpa_driver_nl80211_deinit_ap(
|
||||
if (!is_ap_interface(drv->nlmode))
|
||||
return -1;
|
||||
wpa_driver_nl80211_del_beacon(bss);
|
||||
- bss->beacon_set = 0;
|
||||
|
||||
/*
|
||||
* If the P2P GO interface was dynamically added, then it is
|
||||
@@ -7457,7 +7459,6 @@ static int wpa_driver_nl80211_stop_ap(vo
|
||||
if (!is_ap_interface(drv->nlmode))
|
||||
return -1;
|
||||
wpa_driver_nl80211_del_beacon(bss);
|
||||
- bss->beacon_set = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
--- a/hostapd/ctrl_iface.c
|
||||
+++ b/hostapd/ctrl_iface.c
|
||||
@@ -60,6 +60,7 @@
|
||||
#include "fst/fst_ctrl_iface.h"
|
||||
#include "config_file.h"
|
||||
#include "ctrl_iface.h"
|
||||
+#include "config_file.h"
|
||||
|
||||
|
||||
#define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
|
||||
@@ -78,6 +79,7 @@ static void hostapd_ctrl_iface_send(stru
|
||||
enum wpa_msg_type type,
|
||||
const char *buf, size_t len);
|
||||
|
||||
+static char *reload_opts = NULL;
|
||||
|
||||
static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
|
||||
struct sockaddr_storage *from,
|
||||
@@ -129,6 +131,61 @@ static int hostapd_ctrl_iface_new_sta(st
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static char *get_option(char *opt, char *str)
|
||||
+{
|
||||
+ int len = strlen(str);
|
||||
+
|
||||
+ if (!strncmp(opt, str, len))
|
||||
+ return opt + len;
|
||||
+ else
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname)
|
||||
+{
|
||||
+ struct hostapd_config *conf;
|
||||
+ char *opt, *val;
|
||||
+
|
||||
+ conf = hostapd_config_read(fname);
|
||||
+ if (!conf)
|
||||
+ return NULL;
|
||||
+
|
||||
+ for (opt = strtok(reload_opts, " ");
|
||||
+ opt;
|
||||
+ opt = strtok(NULL, " ")) {
|
||||
+
|
||||
+ if ((val = get_option(opt, "channel=")))
|
||||
+ conf->channel = atoi(val);
|
||||
+ else if ((val = get_option(opt, "ht_capab=")))
|
||||
+ conf->ht_capab = atoi(val);
|
||||
+ else if ((val = get_option(opt, "ht_capab_mask=")))
|
||||
+ conf->ht_capab &= atoi(val);
|
||||
+ else if ((val = get_option(opt, "sec_chan=")))
|
||||
+ conf->secondary_channel = atoi(val);
|
||||
+ else if ((val = get_option(opt, "hw_mode=")))
|
||||
+ conf->hw_mode = atoi(val);
|
||||
+ else if ((val = get_option(opt, "ieee80211n=")))
|
||||
+ conf->ieee80211n = atoi(val);
|
||||
+ else
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return conf;
|
||||
+}
|
||||
+
|
||||
+static int hostapd_ctrl_iface_update(struct hostapd_data *hapd, char *txt)
|
||||
+{
|
||||
+ struct hostapd_config * (*config_read_cb)(const char *config_fname);
|
||||
+ struct hostapd_iface *iface = hapd->iface;
|
||||
+
|
||||
+ config_read_cb = iface->interfaces->config_read_cb;
|
||||
+ iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
|
||||
+ reload_opts = txt;
|
||||
+
|
||||
+ hostapd_reload_config(iface);
|
||||
+
|
||||
+ iface->interfaces->config_read_cb = config_read_cb;
|
||||
+}
|
||||
|
||||
#ifdef CONFIG_IEEE80211W
|
||||
#ifdef NEED_AP_MLME
|
||||
@@ -3031,6 +3088,8 @@ static int hostapd_ctrl_iface_receive_pr
|
||||
} else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
|
||||
reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
|
||||
reply_size);
|
||||
+ } else if (os_strncmp(buf, "UPDATE ", 7) == 0) {
|
||||
+ hostapd_ctrl_iface_update(hapd, buf + 7);
|
||||
} else if (os_strcmp(buf, "ERP_FLUSH") == 0) {
|
||||
ieee802_1x_erp_flush(hapd);
|
||||
#ifdef RADIUS_SERVER
|
||||
--- a/src/ap/ctrl_iface_ap.c
|
||||
+++ b/src/ap/ctrl_iface_ap.c
|
||||
@@ -864,7 +864,13 @@ int hostapd_parse_csa_settings(const cha
|
||||
|
||||
int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
|
||||
{
|
||||
- return hostapd_drv_stop_ap(hapd);
|
||||
+ struct hostapd_iface *iface = hapd->iface;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < iface->num_bss; i++)
|
||||
+ hostapd_drv_stop_ap(iface->bss[i]);
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,246 @@
|
|||
--- a/wpa_supplicant/Makefile
|
||||
+++ b/wpa_supplicant/Makefile
|
||||
@@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS)
|
||||
CFLAGS += -I$(abspath ../src)
|
||||
CFLAGS += -I$(abspath ../src/utils)
|
||||
|
||||
+ifdef MULTICALL
|
||||
+CFLAGS += -DMULTICALL
|
||||
+endif
|
||||
+
|
||||
-include .config
|
||||
-include $(if $(MULTICALL),../hostapd/.config)
|
||||
|
||||
@@ -117,6 +121,8 @@ OBJS_c += ../src/utils/common.o
|
||||
OBJS_c += ../src/common/cli.o
|
||||
OBJS += wmm_ac.o
|
||||
|
||||
+OBJS += ../src/common/wpa_ctrl.o
|
||||
+
|
||||
ifndef CONFIG_OS
|
||||
ifdef CONFIG_NATIVE_WINDOWS
|
||||
CONFIG_OS=win32
|
||||
--- a/wpa_supplicant/bss.c
|
||||
+++ b/wpa_supplicant/bss.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "utils/common.h"
|
||||
#include "utils/eloop.h"
|
||||
#include "common/ieee802_11_defs.h"
|
||||
+#include "common/ieee802_11_common.h"
|
||||
#include "drivers/driver.h"
|
||||
#include "eap_peer/eap.h"
|
||||
#include "wpa_supplicant_i.h"
|
||||
@@ -292,6 +293,10 @@ void calculate_update_time(const struct
|
||||
static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
|
||||
struct os_reltime *fetch_time)
|
||||
{
|
||||
+ struct ieee80211_ht_capabilities *capab;
|
||||
+ struct ieee80211_ht_operation *oper;
|
||||
+ struct ieee802_11_elems elems;
|
||||
+
|
||||
dst->flags = src->flags;
|
||||
os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
|
||||
dst->freq = src->freq;
|
||||
@@ -304,6 +309,15 @@ static void wpa_bss_copy_res(struct wpa_
|
||||
dst->est_throughput = src->est_throughput;
|
||||
dst->snr = src->snr;
|
||||
|
||||
+ memset(&elems, 0, sizeof(elems));
|
||||
+ ieee802_11_parse_elems((u8 *) (src + 1), src->ie_len, &elems, 0);
|
||||
+ capab = (struct ieee80211_ht_capabilities *) elems.ht_capabilities;
|
||||
+ oper = (struct ieee80211_ht_operation *) elems.ht_operation;
|
||||
+ if (capab)
|
||||
+ dst->ht_capab = le_to_host16(capab->ht_capabilities_info);
|
||||
+ if (oper)
|
||||
+ dst->ht_param = oper->ht_param;
|
||||
+
|
||||
calculate_update_time(fetch_time, src->age, &dst->last_update);
|
||||
}
|
||||
|
||||
--- a/wpa_supplicant/bss.h
|
||||
+++ b/wpa_supplicant/bss.h
|
||||
@@ -81,6 +81,10 @@ struct wpa_bss {
|
||||
u8 ssid[SSID_MAX_LEN];
|
||||
/** Length of SSID */
|
||||
size_t ssid_len;
|
||||
+ /** HT capabilities */
|
||||
+ u16 ht_capab;
|
||||
+ /* Five octets of HT Operation Information */
|
||||
+ u8 ht_param;
|
||||
/** Frequency of the channel in MHz (e.g., 2412 = channel 1) */
|
||||
int freq;
|
||||
/** Beacon interval in TUs (host byte order) */
|
||||
--- a/wpa_supplicant/main.c
|
||||
+++ b/wpa_supplicant/main.c
|
||||
@@ -34,7 +34,7 @@ static void usage(void)
|
||||
"vW] [-P<pid file>] "
|
||||
"[-g<global ctrl>] \\\n"
|
||||
" [-G<group>] \\\n"
|
||||
- " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] "
|
||||
+ " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-H<hostapd path>] "
|
||||
"[-p<driver_param>] \\\n"
|
||||
" [-b<br_ifname>] [-e<entropy file>]"
|
||||
#ifdef CONFIG_DEBUG_FILE
|
||||
@@ -74,6 +74,7 @@ static void usage(void)
|
||||
" -g = global ctrl_interface\n"
|
||||
" -G = global ctrl_interface group\n"
|
||||
" -h = show this help text\n"
|
||||
+ " -H = connect to a hostapd instance to manage state changes\n"
|
||||
" -i = interface name\n"
|
||||
" -I = additional configuration file\n"
|
||||
" -K = include keys (passwords, etc.) in debug output\n"
|
||||
@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (;;) {
|
||||
c = getopt(argc, argv,
|
||||
- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
|
||||
+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
|
||||
if (c < 0)
|
||||
break;
|
||||
switch (c) {
|
||||
@@ -248,6 +249,9 @@ int main(int argc, char *argv[])
|
||||
usage();
|
||||
exitcode = 0;
|
||||
goto out;
|
||||
+ case 'H':
|
||||
+ iface->hostapd_ctrl = optarg;
|
||||
+ break;
|
||||
case 'i':
|
||||
iface->ifname = optarg;
|
||||
break;
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -125,6 +125,55 @@ static void wpas_update_fils_connect_par
|
||||
#endif /* CONFIG_FILS && IEEE8021X_EAPOL */
|
||||
|
||||
|
||||
+static int hostapd_stop(struct wpa_supplicant *wpa_s)
|
||||
+{
|
||||
+ const char *cmd = "STOP_AP";
|
||||
+ char buf[256];
|
||||
+ size_t len = sizeof(buf);
|
||||
+
|
||||
+ if (wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL) < 0) {
|
||||
+ wpa_printf(MSG_ERROR, "\nFailed to stop hostapd AP interfaces\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
|
||||
+{
|
||||
+ char *cmd = NULL;
|
||||
+ char buf[256];
|
||||
+ size_t len = sizeof(buf);
|
||||
+ enum hostapd_hw_mode hw_mode;
|
||||
+ u8 channel;
|
||||
+ int sec_chan = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!bss)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) {
|
||||
+ int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
|
||||
+ if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE)
|
||||
+ sec_chan = 1;
|
||||
+ else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW)
|
||||
+ sec_chan = -1;
|
||||
+ }
|
||||
+
|
||||
+ hw_mode = ieee80211_freq_to_chan(bss->freq, &channel);
|
||||
+ if (asprintf(&cmd, "UPDATE channel=%d sec_chan=%d hw_mode=%d",
|
||||
+ channel, sec_chan, hw_mode) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
|
||||
+ free(cmd);
|
||||
+
|
||||
+ if (ret < 0) {
|
||||
+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* Configure default/group WEP keys for static WEP */
|
||||
int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
|
||||
{
|
||||
@@ -913,12 +962,16 @@ void wpa_supplicant_set_state(struct wpa
|
||||
|
||||
sme_sched_obss_scan(wpa_s, 1);
|
||||
|
||||
+ if (wpa_s->hostapd)
|
||||
+ hostapd_reload(wpa_s, wpa_s->current_bss);
|
||||
#if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL)
|
||||
if (!fils_hlp_sent && ssid && ssid->eap.erp)
|
||||
wpas_update_fils_connect_params(wpa_s);
|
||||
#endif /* CONFIG_FILS && IEEE8021X_EAPOL */
|
||||
} else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING ||
|
||||
state == WPA_ASSOCIATED) {
|
||||
+ if (wpa_s->hostapd)
|
||||
+ hostapd_stop(wpa_s);
|
||||
wpa_s->new_connection = 1;
|
||||
wpa_drv_set_operstate(wpa_s, 0);
|
||||
#ifndef IEEE8021X_EAPOL
|
||||
@@ -1947,6 +2000,8 @@ void wpa_supplicant_associate(struct wpa
|
||||
wpa_ssid_txt(ssid->ssid, ssid->ssid_len),
|
||||
ssid->id);
|
||||
wpas_notify_mesh_group_started(wpa_s, ssid);
|
||||
+ if (wpa_s->hostapd)
|
||||
+ hostapd_reload(wpa_s, wpa_s->current_bss);
|
||||
#else /* CONFIG_MESH */
|
||||
wpa_msg(wpa_s, MSG_ERROR,
|
||||
"mesh mode support not included in the build");
|
||||
@@ -5423,6 +5478,16 @@ static int wpa_supplicant_init_iface(str
|
||||
sizeof(wpa_s->bridge_ifname));
|
||||
}
|
||||
|
||||
+ if (iface->hostapd_ctrl) {
|
||||
+ wpa_s->hostapd = wpa_ctrl_open(iface->hostapd_ctrl);
|
||||
+ if (!wpa_s->hostapd) {
|
||||
+ wpa_printf(MSG_ERROR, "\nFailed to connect to hostapd\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (hostapd_stop(wpa_s) < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
/* RSNA Supplicant Key Management - INITIALIZE */
|
||||
eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
|
||||
eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
|
||||
@@ -5744,6 +5809,11 @@ static void wpa_supplicant_deinit_iface(
|
||||
if (terminate)
|
||||
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
|
||||
|
||||
+ if (wpa_s->hostapd) {
|
||||
+ wpa_ctrl_close(wpa_s->hostapd);
|
||||
+ wpa_s->hostapd = NULL;
|
||||
+ }
|
||||
+
|
||||
if (wpa_s->ctrl_iface) {
|
||||
wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface);
|
||||
wpa_s->ctrl_iface = NULL;
|
||||
--- a/wpa_supplicant/wpa_supplicant_i.h
|
||||
+++ b/wpa_supplicant/wpa_supplicant_i.h
|
||||
@@ -101,6 +101,11 @@ struct wpa_interface {
|
||||
const char *ifname;
|
||||
|
||||
/**
|
||||
+ * hostapd_ctrl - path to hostapd control socket for notification
|
||||
+ */
|
||||
+ const char *hostapd_ctrl;
|
||||
+
|
||||
+ /**
|
||||
* bridge_ifname - Optional bridge interface name
|
||||
*
|
||||
* If the driver interface (ifname) is included in a Linux bridge
|
||||
@@ -513,6 +518,8 @@ struct wpa_supplicant {
|
||||
#endif /* CONFIG_CTRL_IFACE_BINDER */
|
||||
char bridge_ifname[16];
|
||||
|
||||
+ struct wpa_ctrl *hostapd;
|
||||
+
|
||||
char *confname;
|
||||
char *confanother;
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
--- a/hostapd/Makefile
|
||||
+++ b/hostapd/Makefile
|
||||
@@ -220,6 +220,9 @@ endif
|
||||
ifdef CONFIG_NO_CTRL_IFACE
|
||||
CFLAGS += -DCONFIG_NO_CTRL_IFACE
|
||||
else
|
||||
+ifdef CONFIG_CTRL_IFACE_MIB
|
||||
+CFLAGS += -DCONFIG_CTRL_IFACE_MIB
|
||||
+endif
|
||||
ifeq ($(CONFIG_CTRL_IFACE), udp)
|
||||
CFLAGS += -DCONFIG_CTRL_IFACE_UDP
|
||||
else
|
||||
--- a/hostapd/ctrl_iface.c
|
||||
+++ b/hostapd/ctrl_iface.c
|
||||
@@ -2857,6 +2857,7 @@ static int hostapd_ctrl_iface_receive_pr
|
||||
reply_size);
|
||||
} else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
|
||||
reply_len = hostapd_drv_status(hapd, reply, reply_size);
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
} else if (os_strcmp(buf, "MIB") == 0) {
|
||||
reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
|
||||
if (reply_len >= 0) {
|
||||
@@ -2898,6 +2899,7 @@ static int hostapd_ctrl_iface_receive_pr
|
||||
} else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
|
||||
reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
|
||||
reply_size);
|
||||
+#endif
|
||||
} else if (os_strcmp(buf, "ATTACH") == 0) {
|
||||
if (hostapd_ctrl_iface_attach(hapd, from, fromlen, NULL))
|
||||
reply_len = -1;
|
||||
--- a/wpa_supplicant/Makefile
|
||||
+++ b/wpa_supplicant/Makefile
|
||||
@@ -927,6 +927,9 @@ ifdef CONFIG_FILS
|
||||
OBJS += ../src/ap/fils_hlp.o
|
||||
endif
|
||||
ifdef CONFIG_CTRL_IFACE
|
||||
+ifdef CONFIG_CTRL_IFACE_MIB
|
||||
+CFLAGS += -DCONFIG_CTRL_IFACE_MIB
|
||||
+endif
|
||||
OBJS += ../src/ap/ctrl_iface_ap.o
|
||||
endif
|
||||
|
||||
--- a/wpa_supplicant/ctrl_iface.c
|
||||
+++ b/wpa_supplicant/ctrl_iface.c
|
||||
@@ -2108,7 +2108,7 @@ static int wpa_supplicant_ctrl_iface_sta
|
||||
pos += ret;
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_AP
|
||||
+#if defined(CONFIG_AP) && defined(CONFIG_CTRL_IFACE_MIB)
|
||||
if (wpa_s->ap_iface) {
|
||||
pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
|
||||
end - pos,
|
||||
@@ -9825,6 +9825,7 @@ char * wpa_supplicant_ctrl_iface_process
|
||||
reply_len = -1;
|
||||
} else if (os_strncmp(buf, "NOTE ", 5) == 0) {
|
||||
wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
} else if (os_strcmp(buf, "MIB") == 0) {
|
||||
reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
|
||||
if (reply_len >= 0) {
|
||||
@@ -9832,6 +9833,7 @@ char * wpa_supplicant_ctrl_iface_process
|
||||
reply + reply_len,
|
||||
reply_size - reply_len);
|
||||
}
|
||||
+#endif
|
||||
} else if (os_strncmp(buf, "STATUS", 6) == 0) {
|
||||
reply_len = wpa_supplicant_ctrl_iface_status(
|
||||
wpa_s, buf + 6, reply, reply_size);
|
||||
@@ -10313,6 +10315,7 @@ char * wpa_supplicant_ctrl_iface_process
|
||||
reply_len = wpa_supplicant_ctrl_iface_bss(
|
||||
wpa_s, buf + 4, reply, reply_size);
|
||||
#ifdef CONFIG_AP
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
} else if (os_strcmp(buf, "STA-FIRST") == 0) {
|
||||
reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
|
||||
} else if (os_strncmp(buf, "STA ", 4) == 0) {
|
||||
@@ -10321,12 +10324,15 @@ char * wpa_supplicant_ctrl_iface_process
|
||||
} else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
|
||||
reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
|
||||
reply_size);
|
||||
+#endif
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
} else if (os_strncmp(buf, "DEAUTHENTICATE ", 15) == 0) {
|
||||
if (ap_ctrl_iface_sta_deauthenticate(wpa_s, buf + 15))
|
||||
reply_len = -1;
|
||||
} else if (os_strncmp(buf, "DISASSOCIATE ", 13) == 0) {
|
||||
if (ap_ctrl_iface_sta_disassociate(wpa_s, buf + 13))
|
||||
reply_len = -1;
|
||||
+#endif
|
||||
} else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) {
|
||||
if (ap_ctrl_iface_chanswitch(wpa_s, buf + 12))
|
||||
reply_len = -1;
|
||||
--- a/src/ap/ctrl_iface_ap.c
|
||||
+++ b/src/ap/ctrl_iface_ap.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "mbo_ap.h"
|
||||
#include "taxonomy.h"
|
||||
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
|
||||
static size_t hostapd_write_ht_mcs_bitmask(char *buf, size_t buflen,
|
||||
size_t curr_len, const u8 *mcs_set)
|
||||
@@ -415,6 +416,7 @@ int hostapd_ctrl_iface_sta_next(struct h
|
||||
return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
|
||||
}
|
||||
|
||||
+#endif
|
||||
|
||||
#ifdef CONFIG_P2P_MANAGER
|
||||
static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
|
||||
@@ -753,12 +755,12 @@ int hostapd_ctrl_iface_status(struct hos
|
||||
return len;
|
||||
len += ret;
|
||||
}
|
||||
-
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
if (iface->conf->ieee80211n && !hapd->conf->disable_11n && mode) {
|
||||
len = hostapd_write_ht_mcs_bitmask(buf, buflen, len,
|
||||
mode->mcs_set);
|
||||
}
|
||||
-
|
||||
+#endif /* CONFIG_CTRL_IFACE_MIB */
|
||||
if (iface->current_rates && iface->num_rates) {
|
||||
ret = os_snprintf(buf + len, buflen - len, "supported_rates=");
|
||||
if (os_snprintf_error(buflen - len, ret))
|
||||
--- a/src/ap/ieee802_1x.c
|
||||
+++ b/src/ap/ieee802_1x.c
|
||||
@@ -2555,6 +2555,7 @@ static const char * bool_txt(Boolean val
|
||||
return val ? "TRUE" : "FALSE";
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
|
||||
int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
|
||||
{
|
||||
@@ -2730,6 +2731,7 @@ int ieee802_1x_get_mib_sta(struct hostap
|
||||
return len;
|
||||
}
|
||||
|
||||
+#endif
|
||||
|
||||
#ifdef CONFIG_HS20
|
||||
static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
|
||||
--- a/src/ap/wpa_auth.c
|
||||
+++ b/src/ap/wpa_auth.c
|
||||
@@ -3772,6 +3772,7 @@ static const char * wpa_bool_txt(int val
|
||||
return val ? "TRUE" : "FALSE";
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
|
||||
#define RSN_SUITE "%02x-%02x-%02x-%d"
|
||||
#define RSN_SUITE_ARG(s) \
|
||||
@@ -3916,7 +3917,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
|
||||
|
||||
return len;
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
|
||||
void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth)
|
||||
{
|
||||
--- a/src/rsn_supp/wpa.c
|
||||
+++ b/src/rsn_supp/wpa.c
|
||||
@@ -2295,6 +2295,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
|
||||
}
|
||||
|
||||
|
||||
+#ifdef CONFIG_CTRL_IFACE_MIB
|
||||
+
|
||||
#define RSN_SUITE "%02x-%02x-%02x-%d"
|
||||
#define RSN_SUITE_ARG(s) \
|
||||
((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
|
||||
@@ -2378,6 +2380,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
|
||||
|
||||
return (int) len;
|
||||
}
|
||||
+#endif
|
||||
#endif /* CONFIG_CTRL_IFACE */
|
||||
|
||||
|
||||
--- a/wpa_supplicant/ap.c
|
||||
+++ b/wpa_supplicant/ap.c
|
||||
@@ -1179,7 +1179,7 @@ int wpas_ap_wps_nfc_report_handover(stru
|
||||
#endif /* CONFIG_WPS */
|
||||
|
||||
|
||||
-#ifdef CONFIG_CTRL_IFACE
|
||||
+#if defined(CONFIG_CTRL_IFACE) && defined(CONFIG_CTRL_IFACE_MIB)
|
||||
|
||||
int ap_ctrl_iface_sta_first(struct wpa_supplicant *wpa_s,
|
||||
char *buf, size_t buflen)
|
|
@ -0,0 +1,13 @@
|
|||
--- a/hostapd/hostapd_cli.c
|
||||
+++ b/hostapd/hostapd_cli.c
|
||||
@@ -743,7 +743,7 @@ static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, const char *cmd,
|
||||
}
|
||||
|
||||
buf[len] = '\0';
|
||||
- if (memcmp(buf, "FAIL", 4) == 0)
|
||||
+ if (memcmp(buf, "FAIL", 4) == 0 || memcmp(buf, "UNKNOWN COMMAND", 15) == 0)
|
||||
return -1;
|
||||
if (print)
|
||||
printf("%s", buf);
|
||||
--
|
||||
2.11.0
|
|
@ -0,0 +1,56 @@
|
|||
--- a/src/common/wpa_common.c
|
||||
+++ b/src/common/wpa_common.c
|
||||
@@ -1849,6 +1849,31 @@ u32 wpa_akm_to_suite(int akm)
|
||||
}
|
||||
|
||||
|
||||
+static void wpa_fixup_wpa_ie_rsn(u8 *assoc_ie, const u8 *wpa_msg_ie,
|
||||
+ size_t rsn_ie_len)
|
||||
+{
|
||||
+ int pos, count;
|
||||
+
|
||||
+ pos = sizeof(struct rsn_ie_hdr) + RSN_SELECTOR_LEN;
|
||||
+ if (rsn_ie_len < pos + 2)
|
||||
+ return;
|
||||
+
|
||||
+ count = WPA_GET_LE16(wpa_msg_ie + pos);
|
||||
+ pos += 2 + count * RSN_SELECTOR_LEN;
|
||||
+ if (rsn_ie_len < pos + 2)
|
||||
+ return;
|
||||
+
|
||||
+ count = WPA_GET_LE16(wpa_msg_ie + pos);
|
||||
+ pos += 2 + count * RSN_SELECTOR_LEN;
|
||||
+ if (rsn_ie_len < pos + 2)
|
||||
+ return;
|
||||
+
|
||||
+ if (!assoc_ie[pos] && !assoc_ie[pos + 1] &&
|
||||
+ (wpa_msg_ie[pos] || wpa_msg_ie[pos + 1]))
|
||||
+ memcpy(&assoc_ie[pos], &wpa_msg_ie[pos], 2);
|
||||
+}
|
||||
+
|
||||
+
|
||||
int wpa_compare_rsn_ie(int ft_initial_assoc,
|
||||
const u8 *ie1, size_t ie1len,
|
||||
const u8 *ie2, size_t ie2len)
|
||||
@@ -1856,8 +1881,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
|
||||
if (ie1 == NULL || ie2 == NULL)
|
||||
return -1;
|
||||
|
||||
- if (ie1len == ie2len && os_memcmp(ie1, ie2, ie1len) == 0)
|
||||
- return 0; /* identical IEs */
|
||||
+ if (ie1len == ie2len) {
|
||||
+ u8 *ie_tmp;
|
||||
+
|
||||
+ if (os_memcmp(ie1, ie2, ie1len) == 0)
|
||||
+ return 0; /* identical IEs */
|
||||
+
|
||||
+ ie_tmp = alloca(ie1len);
|
||||
+ memcpy(ie_tmp, ie1, ie1len);
|
||||
+ wpa_fixup_wpa_ie_rsn(ie_tmp, ie2, ie1len);
|
||||
+
|
||||
+ if (os_memcmp(ie_tmp, ie2, ie1len) == 0)
|
||||
+ return 0; /* only mismatch in RSN capabilties */
|
||||
+ }
|
||||
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
if (ft_initial_assoc) {
|
|
@ -0,0 +1,22 @@
|
|||
--- a/src/ap/wps_hostapd.c
|
||||
+++ b/src/ap/wps_hostapd.c
|
||||
@@ -346,8 +346,7 @@ static int hapd_wps_reconfig_in_memory(s
|
||||
bss->wpa_pairwise |= WPA_CIPHER_GCMP;
|
||||
else
|
||||
bss->wpa_pairwise |= WPA_CIPHER_CCMP;
|
||||
- }
|
||||
- if (cred->encr_type & WPS_ENCR_TKIP)
|
||||
+ } else if (cred->encr_type & WPS_ENCR_TKIP)
|
||||
bss->wpa_pairwise |= WPA_CIPHER_TKIP;
|
||||
bss->rsn_pairwise = bss->wpa_pairwise;
|
||||
bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
|
||||
@@ -1069,8 +1068,7 @@ int hostapd_init_wps(struct hostapd_data
|
||||
WPA_CIPHER_GCMP_256)) {
|
||||
wps->encr_types |= WPS_ENCR_AES;
|
||||
wps->encr_types_rsn |= WPS_ENCR_AES;
|
||||
- }
|
||||
- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
|
||||
+ } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
|
||||
wps->encr_types |= WPS_ENCR_TKIP;
|
||||
wps->encr_types_rsn |= WPS_ENCR_TKIP;
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
--- a/src/utils/wpa_debug.c
|
||||
+++ b/src/utils/wpa_debug.c
|
||||
@@ -201,7 +201,7 @@ void wpa_debug_close_linux_tracing(void)
|
||||
*
|
||||
* Note: New line '\n' is added to the end of the text when printing to stdout.
|
||||
*/
|
||||
-void wpa_printf(int level, const char *fmt, ...)
|
||||
+void _wpa_printf(int level, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -248,8 +248,8 @@ void wpa_printf(int level, const char *f
|
||||
}
|
||||
|
||||
|
||||
-static void _wpa_hexdump(int level, const char *title, const u8 *buf,
|
||||
- size_t len, int show)
|
||||
+void _wpa_hexdump(int level, const char *title, const u8 *buf,
|
||||
+ size_t len, int show)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -375,20 +375,8 @@ static void _wpa_hexdump(int level, cons
|
||||
#endif /* CONFIG_ANDROID_LOG */
|
||||
}
|
||||
|
||||
-void wpa_hexdump(int level, const char *title, const void *buf, size_t len)
|
||||
-{
|
||||
- _wpa_hexdump(level, title, buf, len, 1);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len)
|
||||
-{
|
||||
- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-static void _wpa_hexdump_ascii(int level, const char *title, const void *buf,
|
||||
- size_t len, int show)
|
||||
+void _wpa_hexdump_ascii(int level, const char *title, const void *buf,
|
||||
+ size_t len, int show)
|
||||
{
|
||||
size_t i, llen;
|
||||
const u8 *pos = buf;
|
||||
@@ -495,20 +483,6 @@ static void _wpa_hexdump_ascii(int level
|
||||
}
|
||||
|
||||
|
||||
-void wpa_hexdump_ascii(int level, const char *title, const void *buf,
|
||||
- size_t len)
|
||||
-{
|
||||
- _wpa_hexdump_ascii(level, title, buf, len, 1);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-void wpa_hexdump_ascii_key(int level, const char *title, const void *buf,
|
||||
- size_t len)
|
||||
-{
|
||||
- _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys);
|
||||
-}
|
||||
-
|
||||
-
|
||||
#ifdef CONFIG_DEBUG_FILE
|
||||
static char *last_path = NULL;
|
||||
#endif /* CONFIG_DEBUG_FILE */
|
||||
@@ -604,7 +578,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
|
||||
}
|
||||
|
||||
|
||||
-void wpa_msg(void *ctx, int level, const char *fmt, ...)
|
||||
+void _wpa_msg(void *ctx, int level, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *buf;
|
||||
@@ -642,7 +616,7 @@ void wpa_msg(void *ctx, int level, const
|
||||
}
|
||||
|
||||
|
||||
-void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
|
||||
+void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *buf;
|
||||
--- a/src/utils/wpa_debug.h
|
||||
+++ b/src/utils/wpa_debug.h
|
||||
@@ -52,6 +52,17 @@ int wpa_debug_reopen_file(void);
|
||||
void wpa_debug_close_file(void);
|
||||
void wpa_debug_setup_stdout(void);
|
||||
|
||||
+/* internal */
|
||||
+void _wpa_hexdump(int level, const char *title, const u8 *buf,
|
||||
+ size_t len, int show);
|
||||
+void _wpa_hexdump_ascii(int level, const char *title, const void *buf,
|
||||
+ size_t len, int show);
|
||||
+extern int wpa_debug_show_keys;
|
||||
+
|
||||
+#ifndef CONFIG_MSG_MIN_PRIORITY
|
||||
+#define CONFIG_MSG_MIN_PRIORITY 0
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* wpa_debug_printf_timestamp - Print timestamp for debug output
|
||||
*
|
||||
@@ -72,9 +83,15 @@ void wpa_debug_print_timestamp(void);
|
||||
*
|
||||
* Note: New line '\n' is added to the end of the text when printing to stdout.
|
||||
*/
|
||||
-void wpa_printf(int level, const char *fmt, ...)
|
||||
+void _wpa_printf(int level, const char *fmt, ...)
|
||||
PRINTF_FORMAT(2, 3);
|
||||
|
||||
+#define wpa_printf(level, ...) \
|
||||
+ do { \
|
||||
+ if (level >= CONFIG_MSG_MIN_PRIORITY) \
|
||||
+ _wpa_printf(level, __VA_ARGS__); \
|
||||
+ } while(0)
|
||||
+
|
||||
/**
|
||||
* wpa_hexdump - conditional hex dump
|
||||
* @level: priority level (MSG_*) of the message
|
||||
@@ -86,7 +103,13 @@ PRINTF_FORMAT(2, 3);
|
||||
* output may be directed to stdout, stderr, and/or syslog based on
|
||||
* configuration. The contents of buf is printed out has hex dump.
|
||||
*/
|
||||
-void wpa_hexdump(int level, const char *title, const void *buf, size_t len);
|
||||
+static inline void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len)
|
||||
+{
|
||||
+ if (level < CONFIG_MSG_MIN_PRIORITY)
|
||||
+ return;
|
||||
+
|
||||
+ _wpa_hexdump(level, title, buf, len, 1);
|
||||
+}
|
||||
|
||||
static inline void wpa_hexdump_buf(int level, const char *title,
|
||||
const struct wpabuf *buf)
|
||||
@@ -108,7 +131,13 @@ static inline void wpa_hexdump_buf(int l
|
||||
* like wpa_hexdump(), but by default, does not include secret keys (passwords,
|
||||
* etc.) in debug output.
|
||||
*/
|
||||
-void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len);
|
||||
+static inline void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len)
|
||||
+{
|
||||
+ if (level < CONFIG_MSG_MIN_PRIORITY)
|
||||
+ return;
|
||||
+
|
||||
+ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys);
|
||||
+}
|
||||
|
||||
static inline void wpa_hexdump_buf_key(int level, const char *title,
|
||||
const struct wpabuf *buf)
|
||||
@@ -130,8 +159,14 @@ static inline void wpa_hexdump_buf_key(i
|
||||
* the hex numbers and ASCII characters (for printable range) are shown. 16
|
||||
* bytes per line will be shown.
|
||||
*/
|
||||
-void wpa_hexdump_ascii(int level, const char *title, const void *buf,
|
||||
- size_t len);
|
||||
+static inline void wpa_hexdump_ascii(int level, const char *title,
|
||||
+ const u8 *buf, size_t len)
|
||||
+{
|
||||
+ if (level < CONFIG_MSG_MIN_PRIORITY)
|
||||
+ return;
|
||||
+
|
||||
+ _wpa_hexdump_ascii(level, title, buf, len, 1);
|
||||
+}
|
||||
|
||||
/**
|
||||
* wpa_hexdump_ascii_key - conditional hex dump, hide keys
|
||||
@@ -147,8 +182,14 @@ void wpa_hexdump_ascii(int level, const
|
||||
* bytes per line will be shown. This works like wpa_hexdump_ascii(), but by
|
||||
* default, does not include secret keys (passwords, etc.) in debug output.
|
||||
*/
|
||||
-void wpa_hexdump_ascii_key(int level, const char *title, const void *buf,
|
||||
- size_t len);
|
||||
+static inline void wpa_hexdump_ascii_key(int level, const char *title,
|
||||
+ const u8 *buf, size_t len)
|
||||
+{
|
||||
+ if (level < CONFIG_MSG_MIN_PRIORITY)
|
||||
+ return;
|
||||
+
|
||||
+ _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys);
|
||||
+}
|
||||
|
||||
/*
|
||||
* wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
|
||||
@@ -185,7 +226,12 @@ void wpa_hexdump_ascii_key(int level, co
|
||||
*
|
||||
* Note: New line '\n' is added to the end of the text when printing to stdout.
|
||||
*/
|
||||
-void wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4);
|
||||
+void _wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4);
|
||||
+#define wpa_msg(ctx, level, ...) \
|
||||
+ do { \
|
||||
+ if (level >= CONFIG_MSG_MIN_PRIORITY) \
|
||||
+ _wpa_msg(ctx, level, __VA_ARGS__); \
|
||||
+ } while(0)
|
||||
|
||||
/**
|
||||
* wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
|
||||
@@ -199,8 +245,13 @@ void wpa_msg(void *ctx, int level, const
|
||||
* attached ctrl_iface monitors. In other words, it can be used for frequent
|
||||
* events that do not need to be sent to syslog.
|
||||
*/
|
||||
-void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
|
||||
+void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
|
||||
PRINTF_FORMAT(3, 4);
|
||||
+#define wpa_msg_ctrl(ctx, level, ...) \
|
||||
+ do { \
|
||||
+ if (level >= CONFIG_MSG_MIN_PRIORITY) \
|
||||
+ _wpa_msg_ctrl(ctx, level, __VA_ARGS__); \
|
||||
+ } while(0)
|
||||
|
||||
/**
|
||||
* wpa_msg_global - Global printf for ctrl_iface monitors
|
|
@ -0,0 +1,62 @@
|
|||
--- a/hostapd/main.c
|
||||
+++ b/hostapd/main.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "utils/common.h"
|
||||
#include "utils/eloop.h"
|
||||
#include "utils/uuid.h"
|
||||
+#include "utils/build_features.h"
|
||||
#include "crypto/random.h"
|
||||
#include "crypto/tls.h"
|
||||
#include "common/version.h"
|
||||
@@ -682,7 +683,7 @@ int main(int argc, char *argv[])
|
||||
wpa_supplicant_event = hostapd_wpa_event;
|
||||
wpa_supplicant_event_global = hostapd_wpa_event_global;
|
||||
for (;;) {
|
||||
- c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:");
|
||||
+ c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:g:G:v::");
|
||||
if (c < 0)
|
||||
break;
|
||||
switch (c) {
|
||||
@@ -719,6 +720,8 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
#endif /* CONFIG_DEBUG_LINUX_TRACING */
|
||||
case 'v':
|
||||
+ if (optarg)
|
||||
+ exit(!has_feature(optarg));
|
||||
show_version();
|
||||
exit(1);
|
||||
break;
|
||||
--- a/wpa_supplicant/main.c
|
||||
+++ b/wpa_supplicant/main.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#endif /* __linux__ */
|
||||
|
||||
#include "common.h"
|
||||
+#include "build_features.h"
|
||||
#include "fst/fst.h"
|
||||
#include "wpa_supplicant_i.h"
|
||||
#include "driver_i.h"
|
||||
@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (;;) {
|
||||
c = getopt(argc, argv,
|
||||
- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
|
||||
+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
|
||||
if (c < 0)
|
||||
break;
|
||||
switch (c) {
|
||||
@@ -305,8 +306,12 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
#endif /* CONFIG_DBUS */
|
||||
case 'v':
|
||||
- printf("%s\n", wpa_supplicant_version);
|
||||
- exitcode = 0;
|
||||
+ if (optarg) {
|
||||
+ exitcode = !has_feature(optarg);
|
||||
+ } else {
|
||||
+ printf("%s\n", wpa_supplicant_version);
|
||||
+ exitcode = 0;
|
||||
+ }
|
||||
goto out;
|
||||
case 'W':
|
||||
params.wait_for_monitor++;
|
|
@ -0,0 +1,58 @@
|
|||
--- a/hostapd/hostapd_cli.c
|
||||
+++ b/hostapd/hostapd_cli.c
|
||||
@@ -385,7 +385,6 @@ static int hostapd_cli_cmd_disassociate(
|
||||
}
|
||||
|
||||
|
||||
-#ifdef CONFIG_TAXONOMY
|
||||
static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc,
|
||||
char *argv[])
|
||||
{
|
||||
@@ -398,7 +397,6 @@ static int hostapd_cli_cmd_signature(str
|
||||
os_snprintf(buf, sizeof(buf), "SIGNATURE %s", argv[0]);
|
||||
return wpa_ctrl_command(ctrl, buf);
|
||||
}
|
||||
-#endif /* CONFIG_TAXONOMY */
|
||||
|
||||
|
||||
#ifdef CONFIG_IEEE80211W
|
||||
@@ -417,7 +415,6 @@ static int hostapd_cli_cmd_sa_query(stru
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
|
||||
|
||||
-#ifdef CONFIG_WPS
|
||||
static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
|
||||
char *argv[])
|
||||
{
|
||||
@@ -643,7 +640,6 @@ static int hostapd_cli_cmd_wps_config(st
|
||||
ssid_hex, argv[1]);
|
||||
return wpa_ctrl_command(ctrl, buf);
|
||||
}
|
||||
-#endif /* CONFIG_WPS */
|
||||
|
||||
|
||||
static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
|
||||
@@ -1510,15 +1506,12 @@ static const struct hostapd_cli_cmd host
|
||||
{ "disassociate", hostapd_cli_cmd_disassociate,
|
||||
hostapd_complete_stations,
|
||||
"<addr> = disassociate a station" },
|
||||
-#ifdef CONFIG_TAXONOMY
|
||||
{ "signature", hostapd_cli_cmd_signature, hostapd_complete_stations,
|
||||
"<addr> = get taxonomy signature for a station" },
|
||||
-#endif /* CONFIG_TAXONOMY */
|
||||
#ifdef CONFIG_IEEE80211W
|
||||
{ "sa_query", hostapd_cli_cmd_sa_query, hostapd_complete_stations,
|
||||
"<addr> = send SA Query to a station" },
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
-#ifdef CONFIG_WPS
|
||||
{ "wps_pin", hostapd_cli_cmd_wps_pin, NULL,
|
||||
"<uuid> <pin> [timeout] [addr] = add WPS Enrollee PIN" },
|
||||
{ "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL,
|
||||
@@ -1543,7 +1536,6 @@ static const struct hostapd_cli_cmd host
|
||||
"<SSID> <auth> <encr> <key> = configure AP" },
|
||||
{ "wps_get_status", hostapd_cli_cmd_wps_get_status, NULL,
|
||||
"= show current WPS status" },
|
||||
-#endif /* CONFIG_WPS */
|
||||
{ "disassoc_imminent", hostapd_cli_cmd_disassoc_imminent, NULL,
|
||||
"= send Disassociation Imminent notification" },
|
||||
{ "ess_disassoc", hostapd_cli_cmd_ess_disassoc, NULL,
|
|
@ -0,0 +1,12 @@
|
|||
--- a/wpa_supplicant/wpa_cli.c
|
||||
+++ b/wpa_supplicant/wpa_cli.c
|
||||
@@ -26,6 +26,9 @@
|
||||
#include <cutils/properties.h>
|
||||
#endif /* ANDROID */
|
||||
|
||||
+#ifndef CONFIG_P2P
|
||||
+#define CONFIG_P2P
|
||||
+#endif
|
||||
|
||||
static const char *const wpa_cli_version =
|
||||
"wpa_cli v" VERSION_STR "\n"
|
|
@ -0,0 +1,10 @@
|
|||
--- a/src/drivers/linux_wext.h
|
||||
+++ b/src/drivers/linux_wext.h
|
||||
@@ -26,6 +26,7 @@ typedef int32_t __s32;
|
||||
typedef uint16_t __u16;
|
||||
typedef int16_t __s16;
|
||||
typedef uint8_t __u8;
|
||||
+typedef int8_t __s8;
|
||||
#ifndef __user
|
||||
#define __user
|
||||
#endif /* __user */
|
|
@ -0,0 +1,73 @@
|
|||
--- a/hostapd/main.c
|
||||
+++ b/hostapd/main.c
|
||||
@@ -38,6 +38,8 @@ struct hapd_global {
|
||||
};
|
||||
|
||||
static struct hapd_global global;
|
||||
+static int daemonize = 0;
|
||||
+static char *pid_file = NULL;
|
||||
|
||||
|
||||
#ifndef CONFIG_NO_HOSTAPD_LOGGER
|
||||
@@ -148,6 +150,14 @@ static void hostapd_logger_cb(void *ctx,
|
||||
}
|
||||
#endif /* CONFIG_NO_HOSTAPD_LOGGER */
|
||||
|
||||
+static void hostapd_setup_complete_cb(void *ctx)
|
||||
+{
|
||||
+ if (daemonize && os_daemonize(pid_file)) {
|
||||
+ perror("daemon");
|
||||
+ return;
|
||||
+ }
|
||||
+ daemonize = 0;
|
||||
+}
|
||||
|
||||
/**
|
||||
* hostapd_driver_init - Preparate driver interface
|
||||
@@ -166,6 +176,8 @@ static int hostapd_driver_init(struct ho
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ hapd->setup_complete_cb = hostapd_setup_complete_cb;
|
||||
+
|
||||
/* Initialize the driver interface */
|
||||
if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
|
||||
b = NULL;
|
||||
@@ -406,8 +418,6 @@ static void hostapd_global_deinit(const
|
||||
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||
|
||||
eap_server_unregister_methods();
|
||||
-
|
||||
- os_daemonize_terminate(pid_file);
|
||||
}
|
||||
|
||||
|
||||
@@ -433,18 +443,6 @@ static int hostapd_global_run(struct hap
|
||||
}
|
||||
#endif /* EAP_SERVER_TNC */
|
||||
|
||||
- if (daemonize) {
|
||||
- if (os_daemonize(pid_file)) {
|
||||
- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- if (eloop_sock_requeue()) {
|
||||
- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
|
||||
- strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
eloop_run();
|
||||
|
||||
return 0;
|
||||
@@ -646,8 +644,7 @@ int main(int argc, char *argv[])
|
||||
struct hapd_interfaces interfaces;
|
||||
int ret = 1;
|
||||
size_t i, j;
|
||||
- int c, debug = 0, daemonize = 0;
|
||||
- char *pid_file = NULL;
|
||||
+ int c, debug = 0;
|
||||
const char *log_file = NULL;
|
||||
const char *entropy_file = NULL;
|
||||
char **bss_config = NULL, **tmp_bss;
|
|
@ -0,0 +1,189 @@
|
|||
From 4bb69d15477e0f2b00e166845341dc933de47c58 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Quartulli <ordex@autistici.org>
|
||||
Date: Sun, 3 Jun 2012 18:22:56 +0200
|
||||
Subject: [PATCHv2 601/602] wpa_supplicant: add new config params to be used
|
||||
with the ibss join command
|
||||
|
||||
Signed-hostap: Antonio Quartulli <ordex@autistici.org>
|
||||
---
|
||||
src/drivers/driver.h | 6 +++
|
||||
wpa_supplicant/config.c | 96 +++++++++++++++++++++++++++++++++++++++
|
||||
wpa_supplicant/config_ssid.h | 6 +++
|
||||
wpa_supplicant/wpa_supplicant.c | 23 +++++++---
|
||||
4 files changed, 124 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#define WPA_SUPPLICANT_DRIVER_VERSION 4
|
||||
|
||||
+#include "ap/sta_info.h"
|
||||
#include "common/defs.h"
|
||||
#include "common/ieee802_11_defs.h"
|
||||
#include "common/wpa_common.h"
|
||||
@@ -762,6 +763,9 @@ struct wpa_driver_associate_params {
|
||||
* responsible for selecting with which BSS to associate. */
|
||||
const u8 *bssid;
|
||||
|
||||
+ unsigned char rates[WLAN_SUPP_RATES_MAX];
|
||||
+ int mcast_rate;
|
||||
+
|
||||
/**
|
||||
* bssid_hint - BSSID of a proposed AP
|
||||
*
|
||||
--- a/wpa_supplicant/config.c
|
||||
+++ b/wpa_supplicant/config.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "eap_peer/eap.h"
|
||||
#include "p2p/p2p.h"
|
||||
#include "fst/fst.h"
|
||||
+#include "ap/sta_info.h"
|
||||
#include "config.h"
|
||||
|
||||
|
||||
@@ -2037,6 +2038,97 @@ static char * wpa_config_write_peerkey(c
|
||||
#endif /* NO_CONFIG_WRITE */
|
||||
|
||||
|
||||
+static int wpa_config_parse_mcast_rate(const struct parse_data *data,
|
||||
+ struct wpa_ssid *ssid, int line,
|
||||
+ const char *value)
|
||||
+{
|
||||
+ ssid->mcast_rate = (int)(strtod(value, NULL) * 10);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifndef NO_CONFIG_WRITE
|
||||
+static char * wpa_config_write_mcast_rate(const struct parse_data *data,
|
||||
+ struct wpa_ssid *ssid)
|
||||
+{
|
||||
+ char *value;
|
||||
+ int res;
|
||||
+
|
||||
+ if (!ssid->mcast_rate == 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ value = os_malloc(6); /* longest: 300.0 */
|
||||
+ if (value == NULL)
|
||||
+ return NULL;
|
||||
+ res = os_snprintf(value, 5, "%.1f", (double)ssid->mcast_rate / 10);
|
||||
+ if (res < 0) {
|
||||
+ os_free(value);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ return value;
|
||||
+}
|
||||
+#endif /* NO_CONFIG_WRITE */
|
||||
+
|
||||
+static int wpa_config_parse_rates(const struct parse_data *data,
|
||||
+ struct wpa_ssid *ssid, int line,
|
||||
+ const char *value)
|
||||
+{
|
||||
+ int i;
|
||||
+ char *pos, *r, *sptr, *end;
|
||||
+ double rate;
|
||||
+
|
||||
+ pos = (char *)value;
|
||||
+ r = strtok_r(pos, ",", &sptr);
|
||||
+ i = 0;
|
||||
+ while (pos && i < WLAN_SUPP_RATES_MAX) {
|
||||
+ rate = 0.0;
|
||||
+ if (r)
|
||||
+ rate = strtod(r, &end);
|
||||
+ ssid->rates[i] = rate * 2;
|
||||
+ if (*end != '\0' || rate * 2 != ssid->rates[i])
|
||||
+ return 1;
|
||||
+
|
||||
+ i++;
|
||||
+ r = strtok_r(NULL, ",", &sptr);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifndef NO_CONFIG_WRITE
|
||||
+static char * wpa_config_write_rates(const struct parse_data *data,
|
||||
+ struct wpa_ssid *ssid)
|
||||
+{
|
||||
+ char *value, *pos;
|
||||
+ int res, i;
|
||||
+
|
||||
+ if (ssid->rates[0] <= 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
|
||||
+ if (value == NULL)
|
||||
+ return NULL;
|
||||
+ pos = value;
|
||||
+ for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
|
||||
+ res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
|
||||
+ if (res < 0) {
|
||||
+ os_free(value);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ pos += res;
|
||||
+ }
|
||||
+ res = os_snprintf(pos, 6, "%.1f",
|
||||
+ (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
|
||||
+ if (res < 0) {
|
||||
+ os_free(value);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ value[6 * WLAN_SUPP_RATES_MAX] = '\0';
|
||||
+ return value;
|
||||
+}
|
||||
+#endif /* NO_CONFIG_WRITE */
|
||||
+
|
||||
/* Helper macros for network block parser */
|
||||
|
||||
#ifdef OFFSET
|
||||
@@ -2282,6 +2374,8 @@ static const struct parse_data ssid_fiel
|
||||
{ INT(ap_max_inactivity) },
|
||||
{ INT(dtim_period) },
|
||||
{ INT(beacon_int) },
|
||||
+ { FUNC(rates) },
|
||||
+ { FUNC(mcast_rate) },
|
||||
#ifdef CONFIG_MACSEC
|
||||
{ INT_RANGE(macsec_policy, 0, 1) },
|
||||
{ INT_RANGE(macsec_integ_only, 0, 1) },
|
||||
--- a/wpa_supplicant/config_ssid.h
|
||||
+++ b/wpa_supplicant/config_ssid.h
|
||||
@@ -10,8 +10,10 @@
|
||||
#define CONFIG_SSID_H
|
||||
|
||||
#include "common/defs.h"
|
||||
+#include "ap/sta_info.h"
|
||||
#include "utils/list.h"
|
||||
#include "eap_peer/eap_config.h"
|
||||
+#include "drivers/nl80211_copy.h"
|
||||
|
||||
|
||||
#define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
|
||||
@@ -757,6 +759,9 @@ struct wpa_ssid {
|
||||
*/
|
||||
void *parent_cred;
|
||||
|
||||
+ unsigned char rates[WLAN_SUPP_RATES_MAX];
|
||||
+ double mcast_rate;
|
||||
+
|
||||
#ifdef CONFIG_MACSEC
|
||||
/**
|
||||
* macsec_policy - Determines the policy for MACsec secure session
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -3061,6 +3061,12 @@ static void wpas_start_assoc_cb(struct w
|
||||
params.beacon_int = ssid->beacon_int;
|
||||
else
|
||||
params.beacon_int = wpa_s->conf->beacon_int;
|
||||
+ i = 0;
|
||||
+ while (i < WLAN_SUPP_RATES_MAX) {
|
||||
+ params.rates[i] = ssid->rates[i];
|
||||
+ i++;
|
||||
+ }
|
||||
+ params.mcast_rate = ssid->mcast_rate;
|
||||
}
|
||||
|
||||
params.pairwise_suite = cipher_pairwise;
|
|
@ -0,0 +1,59 @@
|
|||
From ffc4445958a3ed4064f2e1bf73fa478a61c5cf7b Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Quartulli <ordex@autistici.org>
|
||||
Date: Sun, 3 Jun 2012 18:42:25 +0200
|
||||
Subject: [PATCHv2 602/602] driver_nl80211: use new parameters during ibss join
|
||||
|
||||
Signed-hostap: Antonio Quartulli <ordex@autistici.org>
|
||||
---
|
||||
src/drivers/driver_nl80211.c | 33 ++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 32 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -5094,7 +5094,7 @@ static int wpa_driver_nl80211_ibss(struc
|
||||
struct wpa_driver_associate_params *params)
|
||||
{
|
||||
struct nl_msg *msg;
|
||||
- int ret = -1;
|
||||
+ int ret = -1, i;
|
||||
int count = 0;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
|
||||
@@ -5121,6 +5121,37 @@ retry:
|
||||
nl80211_put_beacon_int(msg, params->beacon_int))
|
||||
goto fail;
|
||||
|
||||
+ if (params->fixed_freq) {
|
||||
+ wpa_printf(MSG_DEBUG, " * fixed_freq");
|
||||
+ nla_put_flag(msg, NL80211_ATTR_FREQ_FIXED);
|
||||
+ }
|
||||
+
|
||||
+ if (params->beacon_int > 0) {
|
||||
+ wpa_printf(MSG_DEBUG, " * beacon_int=%d",
|
||||
+ params->beacon_int);
|
||||
+ nla_put_u32(msg, NL80211_ATTR_BEACON_INTERVAL,
|
||||
+ params->beacon_int);
|
||||
+ }
|
||||
+
|
||||
+ if (params->rates[0] > 0) {
|
||||
+ wpa_printf(MSG_DEBUG, " * basic_rates:");
|
||||
+ i = 0;
|
||||
+ while (i < NL80211_MAX_SUPP_RATES &&
|
||||
+ params->rates[i] > 0) {
|
||||
+ wpa_printf(MSG_DEBUG, " %.1f",
|
||||
+ (double)params->rates[i] / 2);
|
||||
+ i++;
|
||||
+ }
|
||||
+ nla_put(msg, NL80211_ATTR_BSS_BASIC_RATES, i,
|
||||
+ params->rates);
|
||||
+ }
|
||||
+
|
||||
+ if (params->mcast_rate > 0) {
|
||||
+ wpa_printf(MSG_DEBUG, " * mcast_rate=%.1f",
|
||||
+ (double)params->mcast_rate / 10);
|
||||
+ nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
|
||||
+ }
|
||||
+
|
||||
ret = nl80211_set_conn_keys(params, msg);
|
||||
if (ret)
|
||||
goto fail;
|
|
@ -0,0 +1,68 @@
|
|||
From: Sven Eckelmann <sven.eckelmann@openmesh.com>
|
||||
Date: Thu, 11 May 2017 08:21:45 +0200
|
||||
Subject: [PATCH] set mcast_rate in mesh mode
|
||||
|
||||
The wpa_supplicant code for IBSS allows to set the mcast rate. It is
|
||||
recommended to increase this value from 1 or 6 Mbit/s to something higher
|
||||
when using a mesh protocol on top which uses the multicast packet loss as
|
||||
indicator for the link quality.
|
||||
|
||||
This setting was unfortunately not applied for mesh mode. But it would be
|
||||
beneficial when wpa_supplicant would behave similar to IBSS mode and set
|
||||
this argument during mesh join like authsae already does. At least it is
|
||||
helpful for companies/projects which are currently switching to 802.11s
|
||||
(without mesh_fwding and with mesh_ttl set to 1) as replacement for IBSS
|
||||
because newer drivers seem to support 802.11s but not IBSS anymore.
|
||||
|
||||
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
|
||||
Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
|
||||
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -1397,6 +1397,7 @@ struct wpa_driver_mesh_join_params {
|
||||
#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
|
||||
unsigned int flags;
|
||||
u8 handle_dfs;
|
||||
+ int mcast_rate;
|
||||
};
|
||||
|
||||
/**
|
||||
--- a/src/drivers/driver_nl80211.c
|
||||
+++ b/src/drivers/driver_nl80211.c
|
||||
@@ -9248,6 +9248,18 @@ static int nl80211_put_mesh_id(struct nl
|
||||
}
|
||||
|
||||
|
||||
+static int nl80211_put_mcast_rate(struct nl_msg *msg, int mcast_rate)
|
||||
+{
|
||||
+ if (mcast_rate > 0) {
|
||||
+ wpa_printf(MSG_DEBUG, " * mcast_rate=%.1f",
|
||||
+ (double)mcast_rate / 10);
|
||||
+ return nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, mcast_rate);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int nl80211_put_mesh_config(struct nl_msg *msg,
|
||||
struct wpa_driver_mesh_bss_params *params)
|
||||
{
|
||||
@@ -9309,6 +9321,7 @@ static int nl80211_join_mesh(struct i802
|
||||
nl80211_put_basic_rates(msg, params->basic_rates) ||
|
||||
nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) ||
|
||||
nl80211_put_beacon_int(msg, params->beacon_int) ||
|
||||
+ nl80211_put_mcast_rate(msg, params->mcast_rate) ||
|
||||
nl80211_put_dtim_period(msg, params->dtim_period))
|
||||
goto fail;
|
||||
|
||||
--- a/wpa_supplicant/mesh.c
|
||||
+++ b/wpa_supplicant/mesh.c
|
||||
@@ -482,6 +482,7 @@ int wpa_supplicant_join_mesh(struct wpa_
|
||||
|
||||
params->meshid = ssid->ssid;
|
||||
params->meshid_len = ssid->ssid_len;
|
||||
+ params->mcast_rate = ssid->mcast_rate;
|
||||
ibss_mesh_setup_freq(wpa_s, ssid, ¶ms->freq);
|
||||
wpa_s->mesh_ht_enabled = !!params->freq.ht_enabled;
|
||||
wpa_s->mesh_vht_enabled = !!params->freq.vht_enabled;
|
|
@ -0,0 +1,19 @@
|
|||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2124,11 +2124,13 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
||||
for (j = 0; j < wpa_s->last_scan_res_used; j++) {
|
||||
struct wpa_bss *bss = wpa_s->last_scan_res[j];
|
||||
|
||||
- if (ssid->mode != WPAS_MODE_IBSS)
|
||||
+ /* Don't adjust control freq in case of fixed_freq */
|
||||
+ if (ssid->fixed_freq) {
|
||||
+ obss_scan = 0;
|
||||
break;
|
||||
+ }
|
||||
|
||||
- /* Don't adjust control freq in case of fixed_freq */
|
||||
- if (ssid->fixed_freq)
|
||||
+ if (ssid->mode != WPAS_MODE_IBSS)
|
||||
break;
|
||||
|
||||
if (!bss_is_ibss(bss))
|
|
@ -0,0 +1,45 @@
|
|||
--- a/src/ap/acs.c
|
||||
+++ b/src/ap/acs.c
|
||||
@@ -292,18 +292,12 @@ static void acs_fail(struct hostapd_ifac
|
||||
static long double
|
||||
acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf)
|
||||
{
|
||||
- long double factor, busy, total;
|
||||
+ long double factor, busy = 0, total;
|
||||
|
||||
if (survey->filled & SURVEY_HAS_CHAN_TIME_BUSY)
|
||||
busy = survey->channel_time_busy;
|
||||
else if (survey->filled & SURVEY_HAS_CHAN_TIME_RX)
|
||||
busy = survey->channel_time_rx;
|
||||
- else {
|
||||
- /* This shouldn't really happen as survey data is checked in
|
||||
- * acs_sanity_check() */
|
||||
- wpa_printf(MSG_ERROR, "ACS: Survey data missing");
|
||||
- return 0;
|
||||
- }
|
||||
|
||||
total = survey->channel_time;
|
||||
|
||||
@@ -392,20 +386,19 @@ static int acs_usable_vht80_chan(struct
|
||||
static int acs_survey_is_sufficient(struct freq_survey *survey)
|
||||
{
|
||||
if (!(survey->filled & SURVEY_HAS_NF)) {
|
||||
+ survey->nf = -95;
|
||||
wpa_printf(MSG_INFO, "ACS: Survey is missing noise floor");
|
||||
- return 0;
|
||||
}
|
||||
|
||||
if (!(survey->filled & SURVEY_HAS_CHAN_TIME)) {
|
||||
+ survey->channel_time = 0;
|
||||
wpa_printf(MSG_INFO, "ACS: Survey is missing channel time");
|
||||
- return 0;
|
||||
}
|
||||
|
||||
if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) &&
|
||||
!(survey->filled & SURVEY_HAS_CHAN_TIME_RX)) {
|
||||
wpa_printf(MSG_INFO,
|
||||
"ACS: Survey is missing RX and busy time (at least one is required)");
|
||||
- return 0;
|
||||
}
|
||||
|
||||
return 1;
|
|
@ -0,0 +1,351 @@
|
|||
--- a/hostapd/Makefile
|
||||
+++ b/hostapd/Makefile
|
||||
@@ -165,6 +165,11 @@ OBJS += ../src/common/hw_features_common
|
||||
|
||||
OBJS += ../src/eapol_auth/eapol_auth_sm.o
|
||||
|
||||
+ifdef CONFIG_UBUS
|
||||
+CFLAGS += -DUBUS_SUPPORT
|
||||
+OBJS += ../src/ap/ubus.o
|
||||
+LIBS += -lubox -lubus
|
||||
+endif
|
||||
|
||||
ifdef CONFIG_CODE_COVERAGE
|
||||
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
|
||||
--- a/src/ap/hostapd.h
|
||||
+++ b/src/ap/hostapd.h
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "utils/list.h"
|
||||
#include "ap_config.h"
|
||||
#include "drivers/driver.h"
|
||||
+#include "ubus.h"
|
||||
|
||||
struct wpa_ctrl_dst;
|
||||
struct radius_server_data;
|
||||
@@ -129,6 +130,7 @@ struct hostapd_data {
|
||||
struct hostapd_iface *iface;
|
||||
struct hostapd_config *iconf;
|
||||
struct hostapd_bss_config *conf;
|
||||
+ struct hostapd_ubus_bss ubus;
|
||||
int interface_added; /* virtual interface added for this BSS */
|
||||
unsigned int started:1;
|
||||
unsigned int disabled:1;
|
||||
@@ -392,6 +394,8 @@ struct hostapd_iface {
|
||||
struct hostapd_config *conf;
|
||||
char phy[16]; /* Name of the PHY (radio) */
|
||||
|
||||
+ struct hostapd_ubus_iface ubus;
|
||||
+
|
||||
enum hostapd_iface_state {
|
||||
HAPD_IFACE_UNINITIALIZED,
|
||||
HAPD_IFACE_DISABLED,
|
||||
@@ -544,6 +548,7 @@ hostapd_alloc_bss_data(struct hostapd_if
|
||||
struct hostapd_bss_config *bss);
|
||||
int hostapd_setup_interface(struct hostapd_iface *iface);
|
||||
int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
|
||||
+void hostapd_set_own_neighbor_report(struct hostapd_data *hapd);
|
||||
void hostapd_interface_deinit(struct hostapd_iface *iface);
|
||||
void hostapd_interface_free(struct hostapd_iface *iface);
|
||||
struct hostapd_iface * hostapd_alloc_iface(void);
|
||||
--- a/src/ap/hostapd.c
|
||||
+++ b/src/ap/hostapd.c
|
||||
@@ -315,6 +315,7 @@ static void hostapd_free_hapd_data(struc
|
||||
hapd->started = 0;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
|
||||
+ hostapd_ubus_free_bss(hapd);
|
||||
iapp_deinit(hapd->iapp);
|
||||
hapd->iapp = NULL;
|
||||
accounting_deinit(hapd);
|
||||
@@ -1237,6 +1238,8 @@ static int hostapd_setup_bss(struct host
|
||||
if (hapd->driver && hapd->driver->set_operstate)
|
||||
hapd->driver->set_operstate(hapd->drv_priv, 1);
|
||||
|
||||
+ hostapd_ubus_add_bss(hapd);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1651,7 +1654,7 @@ static enum nr_chan_width hostapd_get_nr
|
||||
#endif /* NEED_AP_MLME */
|
||||
|
||||
|
||||
-static void hostapd_set_own_neighbor_report(struct hostapd_data *hapd)
|
||||
+void hostapd_set_own_neighbor_report(struct hostapd_data *hapd)
|
||||
{
|
||||
#ifdef NEED_AP_MLME
|
||||
u16 capab = hostapd_own_capab_info(hapd);
|
||||
@@ -1872,6 +1875,7 @@ static int hostapd_setup_interface_compl
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
+ hostapd_ubus_add_iface(iface);
|
||||
wpa_printf(MSG_DEBUG, "Completing interface initialization");
|
||||
if (iface->conf->channel) {
|
||||
#ifdef NEED_AP_MLME
|
||||
@@ -2052,6 +2056,7 @@ dfs_offload:
|
||||
|
||||
fail:
|
||||
wpa_printf(MSG_ERROR, "Interface initialization failed");
|
||||
+ hostapd_ubus_free_iface(iface);
|
||||
hostapd_set_state(iface, HAPD_IFACE_DISABLED);
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
|
||||
#ifdef CONFIG_FST
|
||||
@@ -2517,6 +2522,7 @@ void hostapd_interface_deinit_free(struc
|
||||
(unsigned int) iface->conf->num_bss);
|
||||
driver = iface->bss[0]->driver;
|
||||
drv_priv = iface->bss[0]->drv_priv;
|
||||
+ hostapd_ubus_free_iface(iface);
|
||||
hostapd_interface_deinit(iface);
|
||||
wpa_printf(MSG_DEBUG, "%s: driver=%p drv_priv=%p -> hapd_deinit",
|
||||
__func__, driver, drv_priv);
|
||||
--- a/src/ap/ieee802_11.c
|
||||
+++ b/src/ap/ieee802_11.c
|
||||
@@ -1712,12 +1712,13 @@ ieee802_11_set_radius_info(struct hostap
|
||||
|
||||
|
||||
static void handle_auth(struct hostapd_data *hapd,
|
||||
- const struct ieee80211_mgmt *mgmt, size_t len)
|
||||
+ const struct ieee80211_mgmt *mgmt, size_t len,
|
||||
+ struct hostapd_frame_info *fi)
|
||||
{
|
||||
u16 auth_alg, auth_transaction, status_code;
|
||||
u16 resp = WLAN_STATUS_SUCCESS;
|
||||
struct sta_info *sta = NULL;
|
||||
- int res, reply_res;
|
||||
+ int res, reply_res, ubus_resp;
|
||||
u16 fc;
|
||||
const u8 *challenge = NULL;
|
||||
u32 session_timeout, acct_interim_interval;
|
||||
@@ -1728,6 +1729,11 @@ static void handle_auth(struct hostapd_d
|
||||
char *identity = NULL;
|
||||
char *radius_cui = NULL;
|
||||
u16 seq_ctrl;
|
||||
+ struct hostapd_ubus_request req = {
|
||||
+ .type = HOSTAPD_UBUS_AUTH_REQ,
|
||||
+ .mgmt_frame = mgmt,
|
||||
+ .frame_info = fi,
|
||||
+ };
|
||||
|
||||
if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
|
||||
wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
|
||||
@@ -1888,6 +1894,13 @@ static void handle_auth(struct hostapd_d
|
||||
resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
+ ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
||||
+ if (ubus_resp) {
|
||||
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " rejected by ubus handler.\n",
|
||||
+ MAC2STR(mgmt->sa));
|
||||
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
+ goto fail;
|
||||
+ }
|
||||
if (res == HOSTAPD_ACL_PENDING)
|
||||
return;
|
||||
|
||||
@@ -3167,12 +3180,12 @@ void fils_hlp_timeout(void *eloop_ctx, v
|
||||
|
||||
static void handle_assoc(struct hostapd_data *hapd,
|
||||
const struct ieee80211_mgmt *mgmt, size_t len,
|
||||
- int reassoc)
|
||||
+ int reassoc, struct hostapd_frame_info *fi)
|
||||
{
|
||||
u16 capab_info, listen_interval, seq_ctrl, fc;
|
||||
u16 resp = WLAN_STATUS_SUCCESS, reply_res;
|
||||
const u8 *pos;
|
||||
- int left, i;
|
||||
+ int left, i, ubus_resp;
|
||||
struct sta_info *sta;
|
||||
u8 *tmp = NULL;
|
||||
struct hostapd_sta_wpa_psk_short *psk = NULL;
|
||||
@@ -3181,6 +3194,11 @@ static void handle_assoc(struct hostapd_
|
||||
#ifdef CONFIG_FILS
|
||||
int delay_assoc = 0;
|
||||
#endif /* CONFIG_FILS */
|
||||
+ struct hostapd_ubus_request req = {
|
||||
+ .type = HOSTAPD_UBUS_ASSOC_REQ,
|
||||
+ .mgmt_frame = mgmt,
|
||||
+ .frame_info = fi,
|
||||
+ };
|
||||
|
||||
if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
|
||||
sizeof(mgmt->u.assoc_req))) {
|
||||
@@ -3352,6 +3370,14 @@ static void handle_assoc(struct hostapd_
|
||||
}
|
||||
#endif /* CONFIG_MBO */
|
||||
|
||||
+ ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
||||
+ if (ubus_resp) {
|
||||
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
|
||||
+ MAC2STR(mgmt->sa));
|
||||
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* sta->capability is used in check_assoc_ies() for RRM enabled
|
||||
* capability element.
|
||||
@@ -3565,6 +3591,7 @@ static void handle_disassoc(struct hosta
|
||||
wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d",
|
||||
MAC2STR(mgmt->sa),
|
||||
le_to_host16(mgmt->u.disassoc.reason_code));
|
||||
+ hostapd_ubus_notify(hapd, "disassoc", mgmt->sa);
|
||||
|
||||
sta = ap_get_sta(hapd, mgmt->sa);
|
||||
if (sta == NULL) {
|
||||
@@ -3630,6 +3657,8 @@ static void handle_deauth(struct hostapd
|
||||
" reason_code=%d",
|
||||
MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code));
|
||||
|
||||
+ hostapd_ubus_notify(hapd, "deauth", mgmt->sa);
|
||||
+
|
||||
sta = ap_get_sta(hapd, mgmt->sa);
|
||||
if (sta == NULL) {
|
||||
wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying "
|
||||
@@ -3949,7 +3978,7 @@ int ieee802_11_mgmt(struct hostapd_data
|
||||
|
||||
|
||||
if (stype == WLAN_FC_STYPE_PROBE_REQ) {
|
||||
- handle_probe_req(hapd, mgmt, len, ssi_signal);
|
||||
+ handle_probe_req(hapd, mgmt, len, fi);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3969,17 +3998,17 @@ int ieee802_11_mgmt(struct hostapd_data
|
||||
switch (stype) {
|
||||
case WLAN_FC_STYPE_AUTH:
|
||||
wpa_printf(MSG_DEBUG, "mgmt::auth");
|
||||
- handle_auth(hapd, mgmt, len);
|
||||
+ handle_auth(hapd, mgmt, len, fi);
|
||||
ret = 1;
|
||||
break;
|
||||
case WLAN_FC_STYPE_ASSOC_REQ:
|
||||
wpa_printf(MSG_DEBUG, "mgmt::assoc_req");
|
||||
- handle_assoc(hapd, mgmt, len, 0);
|
||||
+ handle_assoc(hapd, mgmt, len, 0, fi);
|
||||
ret = 1;
|
||||
break;
|
||||
case WLAN_FC_STYPE_REASSOC_REQ:
|
||||
wpa_printf(MSG_DEBUG, "mgmt::reassoc_req");
|
||||
- handle_assoc(hapd, mgmt, len, 1);
|
||||
+ handle_assoc(hapd, mgmt, len, 1, fi);
|
||||
ret = 1;
|
||||
break;
|
||||
case WLAN_FC_STYPE_DISASSOC:
|
||||
--- a/src/ap/beacon.c
|
||||
+++ b/src/ap/beacon.c
|
||||
@@ -720,7 +720,7 @@ void sta_track_claim_taxonomy_info(struc
|
||||
|
||||
void handle_probe_req(struct hostapd_data *hapd,
|
||||
const struct ieee80211_mgmt *mgmt, size_t len,
|
||||
- int ssi_signal)
|
||||
+ struct hostapd_frame_info *fi)
|
||||
{
|
||||
u8 *resp;
|
||||
struct ieee802_11_elems elems;
|
||||
@@ -729,6 +729,7 @@ void handle_probe_req(struct hostapd_dat
|
||||
size_t i, resp_len;
|
||||
int noack;
|
||||
enum ssid_match_result res;
|
||||
+ int ssi_signal = fi->ssi_signal;
|
||||
int ret;
|
||||
u16 csa_offs[2];
|
||||
size_t csa_offs_len;
|
||||
@@ -737,6 +738,11 @@ void handle_probe_req(struct hostapd_dat
|
||||
struct hostapd_sta_wpa_psk_short *psk = NULL;
|
||||
char *identity = NULL;
|
||||
char *radius_cui = NULL;
|
||||
+ struct hostapd_ubus_request req = {
|
||||
+ .type = HOSTAPD_UBUS_PROBE_REQ,
|
||||
+ .mgmt_frame = mgmt,
|
||||
+ .frame_info = fi,
|
||||
+ };
|
||||
|
||||
if (len < IEEE80211_HDRLEN)
|
||||
return;
|
||||
@@ -914,6 +920,12 @@ void handle_probe_req(struct hostapd_dat
|
||||
}
|
||||
#endif /* CONFIG_P2P */
|
||||
|
||||
+ if (hostapd_ubus_handle_event(hapd, &req)) {
|
||||
+ wpa_printf(MSG_DEBUG, "Probe request for " MACSTR " rejected by ubus handler.\n",
|
||||
+ MAC2STR(mgmt->sa));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
/* TODO: verify that supp_rates contains at least one matching rate
|
||||
* with AP configuration */
|
||||
|
||||
--- a/src/ap/beacon.h
|
||||
+++ b/src/ap/beacon.h
|
||||
@@ -14,7 +14,7 @@ struct ieee80211_mgmt;
|
||||
|
||||
void handle_probe_req(struct hostapd_data *hapd,
|
||||
const struct ieee80211_mgmt *mgmt, size_t len,
|
||||
- int ssi_signal);
|
||||
+ struct hostapd_frame_info *fi);
|
||||
int ieee802_11_set_beacon(struct hostapd_data *hapd);
|
||||
int ieee802_11_set_beacons(struct hostapd_iface *iface);
|
||||
int ieee802_11_update_beacons(struct hostapd_iface *iface);
|
||||
--- a/src/ap/drv_callbacks.c
|
||||
+++ b/src/ap/drv_callbacks.c
|
||||
@@ -116,6 +116,10 @@ int hostapd_notif_assoc(struct hostapd_d
|
||||
u16 reason = WLAN_REASON_UNSPECIFIED;
|
||||
u16 status = WLAN_STATUS_SUCCESS;
|
||||
const u8 *p2p_dev_addr = NULL;
|
||||
+ struct hostapd_ubus_request req = {
|
||||
+ .type = HOSTAPD_UBUS_ASSOC_REQ,
|
||||
+ .addr = addr,
|
||||
+ };
|
||||
|
||||
if (addr == NULL) {
|
||||
/*
|
||||
@@ -195,6 +199,12 @@ int hostapd_notif_assoc(struct hostapd_d
|
||||
goto fail;
|
||||
}
|
||||
|
||||
+ if (hostapd_ubus_handle_event(hapd, &req)) {
|
||||
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
|
||||
+ MAC2STR(req.addr));
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
#ifdef CONFIG_P2P
|
||||
if (elems.p2p) {
|
||||
wpabuf_free(sta->p2p_ie);
|
||||
--- a/src/ap/sta_info.c
|
||||
+++ b/src/ap/sta_info.c
|
||||
@@ -415,6 +415,7 @@ void ap_handle_timer(void *eloop_ctx, vo
|
||||
HOSTAPD_LEVEL_INFO, "deauthenticated due to "
|
||||
"local deauth request");
|
||||
ap_free_sta(hapd, sta);
|
||||
+ hostapd_ubus_notify(hapd, "local-deauth", sta->addr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -562,6 +563,7 @@ skip_poll:
|
||||
hapd, sta,
|
||||
WLAN_REASON_PREV_AUTH_NOT_VALID);
|
||||
ap_free_sta(hapd, sta);
|
||||
+ hostapd_ubus_notify(hapd, "inactive-deauth", sta->addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1223,6 +1225,7 @@ void ap_sta_set_authorized(struct hostap
|
||||
buf, ip_addr);
|
||||
} else {
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);
|
||||
+ hostapd_ubus_notify(hapd, "disassoc", sta->addr);
|
||||
|
||||
if (hapd->msg_ctx_parent &&
|
||||
hapd->msg_ctx_parent != hapd->msg_ctx)
|
||||
--- a/src/ap/wpa_auth_glue.c
|
||||
+++ b/src/ap/wpa_auth_glue.c
|
||||
@@ -177,6 +177,7 @@ static void hostapd_wpa_auth_psk_failure
|
||||
struct hostapd_data *hapd = ctx;
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR,
|
||||
MAC2STR(addr));
|
||||
+ hostapd_ubus_notify(hapd, "key-mismatch", addr);
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue