ipq95xx/hostapd: update to ath12.3-cs

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2024-02-14 12:57:30 +01:00
parent 144c5d00f4
commit dcdbb4f091
220 changed files with 12341 additions and 26099 deletions

View File

@@ -5,13 +5,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostapd
PKG_RELEASE:=$(AUTORELEASE)
PKG_VERSION:=2023-02-21-ath12.3-cs
PKG_SOURCE_URL:=http://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-12-13
PKG_SOURCE_VERSION:=b26f5c0fe3
PKG_MIRROR_HASH:=2c5b72056b6efc3a16ca912118b324371527c7ac79c4b997349d94680538a7d8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_HASH:=639140658012286453c9f4a8d92d70efa0bbfc23d71ddea0496cf3dc90e39c80
PKG_SOURCE_URL:=@KERNEL/software/utils/dtc
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=BSD-3-Clause

View File

@@ -0,0 +1,43 @@
From 21ce83b4ae2b9563175fdb4fc4312096cc399cf8 Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Wed, 5 May 2021 00:44:34 +0200
Subject: [PATCH] wolfssl: add RNG to EC key
Since upstream commit 6467de5a8840 ("Randomize z ordinates in
scalar mult when timing resistant") WolfSSL requires a RNG for
the EC key when built hardened which is the default.
Set the RNG for the EC key to fix connections for OWE clients.
Signed-off-by: David Bauer <mail@david-bauer.net>
---
src/crypto/crypto_wolfssl.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/src/crypto/crypto_wolfssl.c
+++ b/src/crypto/crypto_wolfssl.c
@@ -1340,6 +1340,7 @@ int ecc_projective_add_point(ecc_point *
struct crypto_ec {
ecc_key key;
+ WC_RNG rng;
mp_int a;
mp_int prime;
mp_int order;
@@ -1394,6 +1395,8 @@ struct crypto_ec * crypto_ec_init(int gr
return NULL;
if (wc_ecc_init(&e->key) != 0 ||
+ wc_InitRng(&e->rng) != 0 ||
+ wc_ecc_set_rng(&e->key, &e->rng) != 0 ||
wc_ecc_set_curve(&e->key, 0, curve_id) != 0 ||
mp_init(&e->a) != MP_OKAY ||
mp_init(&e->prime) != MP_OKAY ||
@@ -1425,6 +1428,7 @@ void crypto_ec_deinit(struct crypto_ec*
mp_clear(&e->order);
mp_clear(&e->prime);
mp_clear(&e->a);
+ wc_FreeRng(&e->rng);
wc_ecc_free(&e->key);
os_free(e);
}

View File

@@ -0,0 +1,26 @@
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4621,6 +4621,13 @@ static int add_associated_sta(struct hos
* drivers to accept the STA parameter configuration. Since this is
* after a new FT-over-DS exchange, a new TK has been derived, so key
* reinstallation is not a concern for this case.
+ *
+ * If the STA was associated and authorized earlier, but came for a new
+ * connection (!added_unassoc + !reassoc), remove the existing STA entry
+ * so that it can be re-added. This case is rarely seen when the AP could
+ * not receive the deauth/disassoc frame from the STA. And the STA comes
+ * back with new connection within a short period or before the inactive
+ * STA entry is removed from the list.
*/
wpa_printf(MSG_DEBUG, "Add associated STA " MACSTR
" (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)",
@@ -4634,7 +4641,8 @@ static int add_associated_sta(struct hos
(!(sta->flags & WLAN_STA_AUTHORIZED) ||
(reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) ||
(!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) &&
- !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)))) {
+ !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)) ||
+ (!reassoc && (sta->flags & WLAN_STA_AUTHORIZED)))) {
hostapd_drv_sta_remove(hapd, sta->addr);
wpa_auth_sm_event(sta->wpa_sm, WPA_DRV_STA_REMOVED);
set = 0;

View File

@@ -0,0 +1,27 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 8 Jul 2021 16:33:03 +0200
Subject: [PATCH] hostapd: fix use of uninitialized stack variables
When a CSA is performed on an 80 MHz channel, hostapd_change_config_freq
unconditionally calls hostapd_set_oper_centr_freq_seg0/1_idx with seg0/1
filled by ieee80211_freq_to_chan.
However, if ieee80211_freq_to_chan fails (because the freq is 0 or invalid),
seg0/1 remains uninitialized and filled with stack garbage, causing errors
such as "hostapd: 80 MHz: center segment 1 configured"
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/hostapd.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.c
@@ -4352,7 +4352,7 @@ static int hostapd_change_config_freq(st
struct hostapd_freq_params *old_params)
{
int channel;
- u8 seg0, seg1 = 0;
+ u8 seg0 = 0, seg1 = 0;
struct hostapd_hw_modes *mode;
if (!params->channel) {

View File

@@ -0,0 +1,19 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Wed, 28 Jul 2021 05:43:29 +0200
Subject: [PATCH] ndisc_snoop: call dl_list_del before freeing ipv6 addresses
Fixes a segmentation fault on sta disconnect
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/src/ap/ndisc_snoop.c
+++ b/src/ap/ndisc_snoop.c
@@ -61,6 +61,7 @@ void sta_ip6addr_del(struct hostapd_data
dl_list_for_each_safe(ip6addr, prev, &sta->ip6addr, struct ip6addr,
list) {
hostapd_drv_br_delete_ip_neigh(hapd, 6, (u8 *) &ip6addr->addr);
+ dl_list_del(&ip6addr->list);
os_free(ip6addr);
}
}

View File

@@ -0,0 +1,20 @@
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -324,6 +324,7 @@ ifdef CONFIG_FILS
CFLAGS += -DCONFIG_FILS
OBJS += ../src/ap/fils_hlp.o
NEED_SHA384=y
+NEED_HMAC_SHA384_KDF=y
NEED_AES_SIV=y
ifdef CONFIG_FILS_SK_PFS
CFLAGS += -DCONFIG_FILS_SK_PFS
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -331,6 +331,7 @@ endif
ifdef CONFIG_FILS
CFLAGS += -DCONFIG_FILS
NEED_SHA384=y
+NEED_HMAC_SHA384_KDF=y
NEED_AES_SIV=y
ifdef CONFIG_FILS_SK_PFS
CFLAGS += -DCONFIG_FILS_SK_PFS

View File

@@ -1,97 +0,0 @@
--- 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>
@@ -188,59 +189,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__) */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,114 @@
From c8dba4bd750269bcc80fed3d546e2077cb4cdf0e Mon Sep 17 00:00:00 2001
From: Glenn Strauss <gstrauss@gluelogic.com>
Date: Tue, 19 Jul 2022 20:02:21 -0400
Subject: [PATCH 2/7] mbedtls: fips186_2_prf()
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
---
hostapd/Makefile | 4 ---
src/crypto/crypto_mbedtls.c | 60 +++++++++++++++++++++++++++++++++++++
wpa_supplicant/Makefile | 4 ---
3 files changed, 60 insertions(+), 8 deletions(-)
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -759,10 +759,6 @@ endif
OBJS += ../src/crypto/crypto_$(CONFIG_CRYPTO).o
HOBJS += ../src/crypto/crypto_$(CONFIG_CRYPTO).o
SOBJS += ../src/crypto/crypto_$(CONFIG_CRYPTO).o
-ifdef NEED_FIPS186_2_PRF
-OBJS += ../src/crypto/fips_prf_internal.o
-SHA1OBJS += ../src/crypto/sha1-internal.o
-endif
ifeq ($(CONFIG_CRYPTO), mbedtls)
ifdef CONFIG_DPP
LIBS += -lmbedx509
--- a/src/crypto/crypto_mbedtls.c
+++ b/src/crypto/crypto_mbedtls.c
@@ -132,6 +132,12 @@
#define CRYPTO_MBEDTLS_HMAC_KDF_SHA512
#endif
+#if defined(EAP_SIM) || defined(EAP_SIM_DYNAMIC) || defined(EAP_SERVER_SIM) \
+ || defined(EAP_AKA) || defined(EAP_AKA_DYNAMIC) || defined(EAP_SERVER_AKA)
+/* EAP_SIM=y EAP_AKA=y */
+#define CRYPTO_MBEDTLS_FIPS186_2_PRF
+#endif
+
#if defined(EAP_FAST) || defined(EAP_FAST_DYNAMIC) || defined(EAP_SERVER_FAST) \
|| defined(EAP_TEAP) || defined(EAP_TEAP_DYNAMIC) || defined(EAP_SERVER_FAST)
#define CRYPTO_MBEDTLS_SHA1_T_PRF
@@ -813,6 +819,60 @@ int sha1_t_prf(const u8 *key, size_t key
#endif /* CRYPTO_MBEDTLS_SHA1_T_PRF */
+#ifdef CRYPTO_MBEDTLS_FIPS186_2_PRF
+
+/* fips_prf_internal.c sha1-internal.c */
+
+/* used only by src/eap_common/eap_sim_common.c:eap_sim_prf()
+ * for eap_sim_derive_keys() and eap_sim_derive_keys_reauth()
+ * where xlen is 160 */
+
+int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen)
+{
+ /* FIPS 186-2 + change notice 1 */
+
+ mbedtls_sha1_context ctx;
+ u8 * const xkey = ctx.MBEDTLS_PRIVATE(buffer);
+ u32 * const xstate = ctx.MBEDTLS_PRIVATE(state);
+ const u32 xstate_init[] =
+ { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 };
+
+ mbedtls_sha1_init(&ctx);
+ os_memcpy(xkey, seed, seed_len < 64 ? seed_len : 64);
+
+ /* note: does not fill extra bytes if (xlen % 20) (SHA1_MAC_LEN) */
+ for (; xlen >= 20; xlen -= 20) {
+ /* XSEED_j = 0 */
+ /* XVAL = (XKEY + XSEED_j) mod 2^b */
+
+ /* w_i = G(t, XVAL) */
+ os_memcpy(xstate, xstate_init, sizeof(xstate_init));
+ mbedtls_internal_sha1_process(&ctx, xkey);
+
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+ xstate[0] = host_to_be32(xstate[0]);
+ xstate[1] = host_to_be32(xstate[1]);
+ xstate[2] = host_to_be32(xstate[2]);
+ xstate[3] = host_to_be32(xstate[3]);
+ xstate[4] = host_to_be32(xstate[4]);
+ #endif
+ os_memcpy(x, xstate, 20);
+ if (xlen == 20) /*(done; skip prep for next loop)*/
+ break;
+
+ /* XKEY = (1 + XKEY + w_i) mod 2^b */
+ for (u32 carry = 1, k = 20; k-- > 0; carry >>= 8)
+ xkey[k] = (carry += xkey[k] + x[k]) & 0xff;
+ x += 20;
+ /* x_j = w_0|w_1 (each pair of iterations through loop)*/
+ }
+
+ mbedtls_sha1_free(&ctx);
+ return 0;
+}
+
+#endif /* CRYPTO_MBEDTLS_FIPS186_2_PRF */
+
#endif /* MBEDTLS_SHA1_C */
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -1174,10 +1174,6 @@ endif
OBJS += ../src/crypto/crypto_$(CONFIG_CRYPTO).o
OBJS_p += ../src/crypto/crypto_$(CONFIG_CRYPTO).o
OBJS_priv += ../src/crypto/crypto_$(CONFIG_CRYPTO).o
-ifdef NEED_FIPS186_2_PRF
-OBJS += ../src/crypto/fips_prf_internal.o
-SHA1OBJS += ../src/crypto/sha1-internal.o
-endif
ifeq ($(CONFIG_CRYPTO), mbedtls)
LIBS += -lmbedcrypto
LIBS_p += -lmbedcrypto

View File

@@ -0,0 +1,421 @@
From 31bd19e0e0254b910cccfd3ddc6a6a9222bbcfc0 Mon Sep 17 00:00:00 2001
From: Glenn Strauss <gstrauss@gluelogic.com>
Date: Sun, 9 Oct 2022 05:12:17 -0400
Subject: [PATCH 3/7] mbedtls: annotate with TEST_FAIL() for hwsim tests
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
---
src/crypto/crypto_mbedtls.c | 124 ++++++++++++++++++++++++++++++++++++
1 file changed, 124 insertions(+)
--- a/src/crypto/crypto_mbedtls.c
+++ b/src/crypto/crypto_mbedtls.c
@@ -280,6 +280,9 @@ __attribute_noinline__
static int md_vector(size_t num_elem, const u8 *addr[], const size_t *len,
u8 *mac, mbedtls_md_type_t md_type)
{
+ if (TEST_FAIL())
+ return -1;
+
mbedtls_md_context_t ctx;
mbedtls_md_init(&ctx);
if (mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type), 0) != 0){
@@ -343,6 +346,9 @@ __attribute_noinline__
static int sha384_512_vector(size_t num_elem, const u8 *addr[],
const size_t *len, u8 *mac, int is384)
{
+ if (TEST_FAIL())
+ return -1;
+
struct mbedtls_sha512_context ctx;
mbedtls_sha512_init(&ctx);
#if MBEDTLS_VERSION_MAJOR >= 3
@@ -375,6 +381,9 @@ int sha384_vector(size_t num_elem, const
#include <mbedtls/sha256.h>
int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
+ if (TEST_FAIL())
+ return -1;
+
struct mbedtls_sha256_context ctx;
mbedtls_sha256_init(&ctx);
#if MBEDTLS_VERSION_MAJOR >= 3
@@ -397,6 +406,9 @@ int sha256_vector(size_t num_elem, const
#include <mbedtls/sha1.h>
int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
+ if (TEST_FAIL())
+ return -1;
+
struct mbedtls_sha1_context ctx;
mbedtls_sha1_init(&ctx);
#if MBEDTLS_VERSION_MAJOR >= 3
@@ -419,6 +431,9 @@ int sha1_vector(size_t num_elem, const u
#include <mbedtls/md5.h>
int md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
+ if (TEST_FAIL())
+ return -1;
+
struct mbedtls_md5_context ctx;
mbedtls_md5_init(&ctx);
#if MBEDTLS_VERSION_MAJOR >= 3
@@ -441,6 +456,9 @@ int md5_vector(size_t num_elem, const u8
#include <mbedtls/md4.h>
int md4_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
+ if (TEST_FAIL())
+ return -1;
+
struct mbedtls_md4_context ctx;
mbedtls_md4_init(&ctx);
mbedtls_md4_starts_ret(&ctx);
@@ -460,6 +478,9 @@ static int hmac_vector(const u8 *key, si
const u8 *addr[], const size_t *len, u8 *mac,
mbedtls_md_type_t md_type)
{
+ if (TEST_FAIL())
+ return -1;
+
mbedtls_md_context_t ctx;
mbedtls_md_init(&ctx);
if (mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type), 1) != 0){
@@ -571,6 +592,9 @@ static int hmac_kdf_expand(const u8 *prk
const char *label, const u8 *info, size_t info_len,
u8 *okm, size_t okm_len, mbedtls_md_type_t md_type)
{
+ if (TEST_FAIL())
+ return -1;
+
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(md_type);
#ifdef MBEDTLS_HKDF_C
if (label == NULL) /* RFC 5869 HKDF-Expand when (label == NULL) */
@@ -663,6 +687,9 @@ static int hmac_prf_bits(const u8 *key,
const u8 *data, size_t data_len, u8 *buf,
size_t buf_len_bits, mbedtls_md_type_t md_type)
{
+ if (TEST_FAIL())
+ return -1;
+
mbedtls_md_context_t ctx;
mbedtls_md_init(&ctx);
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(md_type);
@@ -938,6 +965,9 @@ int pbkdf2_sha1(const char *passphrase,
static void *aes_crypt_init_mode(const u8 *key, size_t len, int mode)
{
+ if (TEST_FAIL())
+ return NULL;
+
mbedtls_aes_context *aes = os_malloc(sizeof(*aes));
if (!aes)
return NULL;
@@ -996,6 +1026,9 @@ void aes_decrypt_deinit(void *ctx)
/* aes-wrap.c */
int aes_wrap(const u8 *kek, size_t kek_len, int n, const u8 *plain, u8 *cipher)
{
+ if (TEST_FAIL())
+ return -1;
+
mbedtls_nist_kw_context ctx;
mbedtls_nist_kw_init(&ctx);
size_t olen;
@@ -1010,6 +1043,9 @@ int aes_wrap(const u8 *kek, size_t kek_l
/* aes-unwrap.c */
int aes_unwrap(const u8 *kek, size_t kek_len, int n, const u8 *cipher, u8 *plain)
{
+ if (TEST_FAIL())
+ return -1;
+
mbedtls_nist_kw_context ctx;
mbedtls_nist_kw_init(&ctx);
size_t olen;
@@ -1041,6 +1077,9 @@ int omac1_aes_vector(
const u8 *key, size_t key_len, size_t num_elem, const u8 *addr[],
const size_t *len, u8 *mac)
{
+ if (TEST_FAIL())
+ return -1;
+
mbedtls_cipher_type_t cipher_type;
switch (key_len) {
case 16: cipher_type = MBEDTLS_CIPHER_AES_128_ECB; break;
@@ -1103,6 +1142,9 @@ int omac1_aes_256(const u8 *key, const u
/* aes-encblock.c */
int aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out)
{
+ if (TEST_FAIL())
+ return -1;
+
mbedtls_aes_context aes;
mbedtls_aes_init(&aes);
int ret = mbedtls_aes_setkey_enc(&aes, key, 128)
@@ -1118,6 +1160,9 @@ int aes_128_encrypt_block(const u8 *key,
int aes_ctr_encrypt(const u8 *key, size_t key_len, const u8 *nonce,
u8 *data, size_t data_len)
{
+ if (TEST_FAIL())
+ return -1;
+
unsigned char counter[MBEDTLS_AES_BLOCK_SIZE];
unsigned char stream_block[MBEDTLS_AES_BLOCK_SIZE];
os_memcpy(counter, nonce, MBEDTLS_AES_BLOCK_SIZE);/*(must be writable)*/
@@ -1160,11 +1205,17 @@ static int aes_128_cbc_oper(const u8 *ke
int aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len)
{
+ if (TEST_FAIL())
+ return -1;
+
return aes_128_cbc_oper(key, iv, data, data_len, MBEDTLS_AES_ENCRYPT);
}
int aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len)
{
+ if (TEST_FAIL())
+ return -1;
+
return aes_128_cbc_oper(key, iv, data, data_len, MBEDTLS_AES_DECRYPT);
}
@@ -1407,6 +1458,10 @@ int crypto_hash_finish(struct crypto_has
}
mbedtls_md_free(mctx);
os_free(mctx);
+
+ if (TEST_FAIL())
+ return -1;
+
return 0;
}
@@ -1421,6 +1476,9 @@ int crypto_hash_finish(struct crypto_has
struct crypto_bignum *crypto_bignum_init(void)
{
+ if (TEST_FAIL())
+ return NULL;
+
mbedtls_mpi *bn = os_malloc(sizeof(*bn));
if (bn)
mbedtls_mpi_init(bn);
@@ -1429,6 +1487,9 @@ struct crypto_bignum *crypto_bignum_init
struct crypto_bignum *crypto_bignum_init_set(const u8 *buf, size_t len)
{
+ if (TEST_FAIL())
+ return NULL;
+
mbedtls_mpi *bn = os_malloc(sizeof(*bn));
if (bn) {
mbedtls_mpi_init(bn);
@@ -1442,6 +1503,9 @@ struct crypto_bignum *crypto_bignum_init
struct crypto_bignum *crypto_bignum_init_uint(unsigned int val)
{
+ if (TEST_FAIL())
+ return NULL;
+
#if 0 /*(hostap use of this interface passes int, not uint)*/
val = host_to_be32(val);
return crypto_bignum_init_set((const u8 *)&val, sizeof(val));
@@ -1467,6 +1531,9 @@ void crypto_bignum_deinit(struct crypto_
int crypto_bignum_to_bin(const struct crypto_bignum *a,
u8 *buf, size_t buflen, size_t padlen)
{
+ if (TEST_FAIL())
+ return -1;
+
size_t n = mbedtls_mpi_size((mbedtls_mpi *)a);
if (n < padlen)
n = padlen;
@@ -1477,6 +1544,9 @@ int crypto_bignum_to_bin(const struct cr
int crypto_bignum_rand(struct crypto_bignum *r, const struct crypto_bignum *m)
{
+ if (TEST_FAIL())
+ return -1;
+
/*assert(r != m);*//* r must not be same as m for mbedtls_mpi_random()*/
#if MBEDTLS_VERSION_NUMBER >= 0x021B0000 /* mbedtls 2.27.0 */
return mbedtls_mpi_random((mbedtls_mpi *)r, 0, (mbedtls_mpi *)m,
@@ -1513,6 +1583,9 @@ int crypto_bignum_exptmod(const struct c
const struct crypto_bignum *c,
struct crypto_bignum *d)
{
+ if (TEST_FAIL())
+ return -1;
+
/* (check if input params match d; d is the result) */
/* (a == d) is ok in current mbedtls implementation */
if (b == d || c == d) { /*(not ok; store result in intermediate)*/
@@ -1540,6 +1613,9 @@ int crypto_bignum_inverse(const struct c
const struct crypto_bignum *b,
struct crypto_bignum *c)
{
+ if (TEST_FAIL())
+ return -1;
+
return mbedtls_mpi_inv_mod((mbedtls_mpi *)c,
(const mbedtls_mpi *)a,
(const mbedtls_mpi *)b) ? -1 : 0;
@@ -1549,6 +1625,9 @@ int crypto_bignum_sub(const struct crypt
const struct crypto_bignum *b,
struct crypto_bignum *c)
{
+ if (TEST_FAIL())
+ return -1;
+
return mbedtls_mpi_sub_mpi((mbedtls_mpi *)c,
(const mbedtls_mpi *)a,
(const mbedtls_mpi *)b) ? -1 : 0;
@@ -1558,6 +1637,9 @@ int crypto_bignum_div(const struct crypt
const struct crypto_bignum *b,
struct crypto_bignum *c)
{
+ if (TEST_FAIL())
+ return -1;
+
/*(most current use of this crypto.h interface has a == c (result),
* so store result in an intermediate to avoid overwritten input)*/
mbedtls_mpi R;
@@ -1575,6 +1657,9 @@ int crypto_bignum_addmod(const struct cr
const struct crypto_bignum *c,
struct crypto_bignum *d)
{
+ if (TEST_FAIL())
+ return -1;
+
return mbedtls_mpi_add_mpi((mbedtls_mpi *)d,
(const mbedtls_mpi *)a,
(const mbedtls_mpi *)b)
@@ -1588,6 +1673,9 @@ int crypto_bignum_mulmod(const struct cr
const struct crypto_bignum *c,
struct crypto_bignum *d)
{
+ if (TEST_FAIL())
+ return -1;
+
return mbedtls_mpi_mul_mpi((mbedtls_mpi *)d,
(const mbedtls_mpi *)a,
(const mbedtls_mpi *)b)
@@ -1600,6 +1688,9 @@ int crypto_bignum_sqrmod(const struct cr
const struct crypto_bignum *b,
struct crypto_bignum *c)
{
+ if (TEST_FAIL())
+ return -1;
+
#if 1
return crypto_bignum_mulmod(a, a, b, c);
#else
@@ -1650,6 +1741,9 @@ int crypto_bignum_is_odd(const struct cr
int crypto_bignum_legendre(const struct crypto_bignum *a,
const struct crypto_bignum *p)
{
+ if (TEST_FAIL())
+ return -2;
+
/* Security Note:
* mbedtls_mpi_exp_mod() is not documented to run in constant time,
* though mbedtls/library/bignum.c uses constant_time_internal.h funcs.
@@ -1702,6 +1796,9 @@ int crypto_mod_exp(const u8 *base, size_
const u8 *modulus, size_t modulus_len,
u8 *result, size_t *result_len)
{
+ if (TEST_FAIL())
+ return -1;
+
mbedtls_mpi bn_base, bn_exp, bn_modulus, bn_result;
mbedtls_mpi_init(&bn_base);
mbedtls_mpi_init(&bn_exp);
@@ -1769,6 +1866,9 @@ static int crypto_mbedtls_dh_init_public
int crypto_dh_init(u8 generator, const u8 *prime, size_t prime_len, u8 *privkey,
u8 *pubkey)
{
+ if (TEST_FAIL())
+ return -1;
+
#if 0 /*(crypto_dh_init() duplicated (and identical) in crypto_*.c modules)*/
size_t pubkey_len, pad;
@@ -1810,6 +1910,9 @@ int crypto_dh_derive_secret(u8 generator
const u8 *pubkey, size_t pubkey_len,
u8 *secret, size_t *len)
{
+ if (TEST_FAIL())
+ return -1;
+
#if 0
if (pubkey_len > prime_len ||
(pubkey_len == prime_len &&
@@ -2512,6 +2615,9 @@ const struct crypto_ec_point * crypto_ec
struct crypto_ec_point *crypto_ec_point_init(struct crypto_ec *e)
{
+ if (TEST_FAIL())
+ return NULL;
+
mbedtls_ecp_point *p = os_malloc(sizeof(*p));
if (p != NULL)
mbedtls_ecp_point_init(p);
@@ -2536,6 +2642,9 @@ int crypto_ec_point_x(struct crypto_ec *
int crypto_ec_point_to_bin(struct crypto_ec *e,
const struct crypto_ec_point *point, u8 *x, u8 *y)
{
+ if (TEST_FAIL())
+ return -1;
+
/* crypto.h documents crypto_ec_point_to_bin() output is big-endian */
size_t len = CRYPTO_EC_plen(e);
if (x) {
@@ -2563,6 +2672,9 @@ int crypto_ec_point_to_bin(struct crypto
struct crypto_ec_point * crypto_ec_point_from_bin(struct crypto_ec *e,
const u8 *val)
{
+ if (TEST_FAIL())
+ return NULL;
+
size_t len = CRYPTO_EC_plen(e);
mbedtls_ecp_point *p = os_malloc(sizeof(*p));
u8 buf[1+MBEDTLS_MPI_MAX_SIZE*2];
@@ -2615,6 +2727,9 @@ int crypto_ec_point_add(struct crypto_ec
const struct crypto_ec_point *b,
struct crypto_ec_point *c)
{
+ if (TEST_FAIL())
+ return -1;
+
/* mbedtls does not provide an mbedtls_ecp_point add function */
mbedtls_mpi one;
mbedtls_mpi_init(&one);
@@ -2631,6 +2746,9 @@ int crypto_ec_point_mul(struct crypto_ec
const struct crypto_bignum *b,
struct crypto_ec_point *res)
{
+ if (TEST_FAIL())
+ return -1;
+
return mbedtls_ecp_mul(
(mbedtls_ecp_group *)e, (mbedtls_ecp_point *)res,
(const mbedtls_mpi *)b, (const mbedtls_ecp_point *)p,
@@ -2639,6 +2757,9 @@ int crypto_ec_point_mul(struct crypto_ec
int crypto_ec_point_invert(struct crypto_ec *e, struct crypto_ec_point *p)
{
+ if (TEST_FAIL())
+ return -1;
+
if (mbedtls_ecp_get_type((mbedtls_ecp_group *)e)
== MBEDTLS_ECP_TYPE_MONTGOMERY) {
/* e.g. MBEDTLS_ECP_DP_CURVE25519 and MBEDTLS_ECP_DP_CURVE448 */
@@ -2751,6 +2872,9 @@ struct crypto_bignum *
crypto_ec_point_compute_y_sqr(struct crypto_ec *e,
const struct crypto_bignum *x)
{
+ if (TEST_FAIL())
+ return NULL;
+
mbedtls_mpi *y2 = os_malloc(sizeof(*y2));
if (y2 == NULL)
return NULL;

View File

@@ -0,0 +1,91 @@
The code for hostapd-mbedtls did not work when used for OWE association.
When handling association requests, the buffer offsets and length assumptions were incorrect, leading to never calculating the y point, thus denying association.
Also when crafting the association response, the buffer contained the trailing key-type.
Fix up both issues to adhere to the specification and make hostapd-mbedtls work with the OWE security type.
--- a/src/crypto/crypto_mbedtls.c
+++ b/src/crypto/crypto_mbedtls.c
@@ -2299,25 +2299,30 @@ struct crypto_ecdh * crypto_ecdh_init2(i
struct wpabuf * crypto_ecdh_get_pubkey(struct crypto_ecdh *ecdh, int inc_y)
{
mbedtls_ecp_group *grp = &ecdh->grp;
- size_t len = CRYPTO_EC_plen(grp);
+ size_t prime_len = CRYPTO_EC_plen(grp);
+ size_t output_len = prime_len;
+ u8 output_offset = 0;
+ u8 buf[256];
+
#ifdef MBEDTLS_ECP_MONTGOMERY_ENABLED
/* len */
#endif
#ifdef MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED
- if (mbedtls_ecp_get_type(grp) == MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS)
- len = inc_y ? len*2+1 : len+1;
+ if (mbedtls_ecp_get_type(grp) == MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS) {
+ output_len = inc_y ? prime_len * 2 + 1 : prime_len + 1;
+ output_offset = 1;
+ }
#endif
- struct wpabuf *buf = wpabuf_alloc(len);
- if (buf == NULL)
+
+ if (output_len > sizeof(buf))
return NULL;
+
inc_y = inc_y ? MBEDTLS_ECP_PF_UNCOMPRESSED : MBEDTLS_ECP_PF_COMPRESSED;
- if (mbedtls_ecp_point_write_binary(grp, &ecdh->Q, inc_y, &len,
- wpabuf_mhead_u8(buf), len) == 0) {
- wpabuf_put(buf, len);
- return buf;
+ if (mbedtls_ecp_point_write_binary(grp, &ecdh->Q, inc_y, &output_len,
+ buf, output_len) == 0) {
+ return wpabuf_alloc_copy(buf + output_offset, output_len - output_offset);
}
- wpabuf_free(buf);
return NULL;
}
@@ -2379,10 +2384,7 @@ struct wpabuf * crypto_ecdh_set_peerkey(
os_memcpy(buf+2, key, len);
}
len >>= 1; /*(repurpose len to prime_len)*/
- }
- else if (key[0] == 0x02 || key[0] == 0x03) { /* (inc_y == 0) */
- --len; /*(repurpose len to prime_len)*/
-
+ } else { /* (inc_y == 0) */
/* mbedtls_ecp_point_read_binary() does not currently support
* MBEDTLS_ECP_PF_COMPRESSED format (buf[1] = 0x02 or 0x03)
* (returns MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE) */
@@ -2390,22 +2392,21 @@ struct wpabuf * crypto_ecdh_set_peerkey(
/* derive y, amend buf[] with y for UNCOMPRESSED format */
if (sizeof(buf)-2 < len*2 || len == 0)
return NULL;
+
buf[0] = (u8)(1+len*2);
buf[1] = 0x04;
+ os_memcpy(buf+2, key, len);
+
mbedtls_mpi bn;
mbedtls_mpi_init(&bn);
- int ret = mbedtls_mpi_read_binary(&bn, key+1, len)
- || crypto_mbedtls_short_weierstrass_derive_y(grp, &bn,
- key[0] & 1)
+ int ret = mbedtls_mpi_read_binary(&bn, key, len)
+ || crypto_mbedtls_short_weierstrass_derive_y(grp, &bn, 0)
|| mbedtls_mpi_write_binary(&bn, buf+2+len, len);
mbedtls_mpi_free(&bn);
if (ret != 0)
return NULL;
}
- if (key[0] == 0) /*(repurpose len to prime_len)*/
- len = CRYPTO_EC_plen(grp);
-
if (mbedtls_ecdh_read_public(&ecdh->ctx, buf, buf[0]+1))
return NULL;
}

View File

@@ -0,0 +1,45 @@
From 33afce36c54b0cad38643629ded10ff5d727f077 Mon Sep 17 00:00:00 2001
From: Glenn Strauss <gstrauss@gluelogic.com>
Date: Fri, 12 Aug 2022 05:34:47 -0400
Subject: [PATCH 5/7] add NULL checks (encountered during tests/hwsim)
sae_derive_commit_element_ecc NULL pwe_ecc check
dpp_gen_keypair() NULL curve check
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
---
src/common/dpp_crypto.c | 6 ++++++
src/common/sae.c | 7 +++++++
2 files changed, 13 insertions(+)
--- a/src/common/dpp_crypto.c
+++ b/src/common/dpp_crypto.c
@@ -269,6 +269,12 @@ int dpp_get_pubkey_hash(struct crypto_ec
struct crypto_ec_key * dpp_gen_keypair(const struct dpp_curve_params *curve)
{
+ if (curve == NULL) {
+ wpa_printf(MSG_DEBUG,
+ "DPP: %s curve must be initialized", __func__);
+ return NULL;
+ }
+
struct crypto_ec_key *key;
wpa_printf(MSG_DEBUG, "DPP: Generating a keypair");
--- a/src/common/sae.c
+++ b/src/common/sae.c
@@ -1278,6 +1278,13 @@ void sae_deinit_pt(struct sae_pt *pt)
static int sae_derive_commit_element_ecc(struct sae_data *sae,
struct crypto_bignum *mask)
{
+ if (sae->tmp->pwe_ecc == NULL) {
+ wpa_printf(MSG_DEBUG,
+ "SAE: %s sae->tmp->pwe_ecc must be initialized",
+ __func__);
+ return -1;
+ }
+
/* COMMIT-ELEMENT = inverse(scalar-op(mask, PWE)) */
if (!sae->tmp->own_commit_element_ecc) {
sae->tmp->own_commit_element_ecc =

View File

@@ -0,0 +1,26 @@
From 54211caa2e0e5163aefef390daf88a971367a702 Mon Sep 17 00:00:00 2001
From: Glenn Strauss <gstrauss@gluelogic.com>
Date: Tue, 4 Oct 2022 17:09:24 -0400
Subject: [PATCH 6/7] dpp_pkex: EC point mul w/ value < prime
crypto_ec_point_mul() with mbedtls requires point
be multiplied by a multiplicand with value < prime
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
---
src/common/dpp_crypto.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/src/common/dpp_crypto.c
+++ b/src/common/dpp_crypto.c
@@ -1588,7 +1588,9 @@ dpp_pkex_derive_Qr(const struct dpp_curv
Pr = crypto_ec_key_get_public_key(Pr_key);
Qr = crypto_ec_point_init(ec);
hash_bn = crypto_bignum_init_set(hash, curve->hash_len);
- if (!Pr || !Qr || !hash_bn || crypto_ec_point_mul(ec, Pr, hash_bn, Qr))
+ if (!Pr || !Qr || !hash_bn ||
+ crypto_bignum_mod(hash_bn, crypto_ec_get_prime(ec), hash_bn) ||
+ crypto_ec_point_mul(ec, Pr, hash_bn, Qr))
goto fail;
if (crypto_ec_point_is_at_infinity(ec, Qr)) {

View File

@@ -0,0 +1,20 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 14 Sep 2023 10:53:50 +0200
Subject: [PATCH] driver_nl80211: fix setting QoS map on secondary BSSs
The setting is per-BSS, not per PHY
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11341,7 +11341,7 @@ static int nl80211_set_qos_map(void *pri
wpa_hexdump(MSG_DEBUG, "nl80211: Setting QoS Map",
qos_map_set, qos_map_set_len);
- if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_SET_QOS_MAP)) ||
+ if (!(msg = nl80211_bss_msg(bss, 0, NL80211_CMD_SET_QOS_MAP)) ||
nla_put(msg, NL80211_ATTR_QOS_MAP, qos_map_set_len, qos_map_set)) {
nlmsg_free(msg);
return -ENOBUFS;

View File

@@ -0,0 +1,18 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 14 Sep 2023 11:28:03 +0200
Subject: [PATCH] driver_nl80211: update drv->ifindex on removing the first
BSS
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8867,6 +8867,7 @@ static int wpa_driver_nl80211_if_remove(
if (drv->first_bss->next) {
drv->first_bss = drv->first_bss->next;
drv->ctx = drv->first_bss->ctx;
+ drv->ifindex = drv->first_bss->ifindex;
os_free(bss);
} else {
wpa_printf(MSG_DEBUG, "nl80211: No second BSS to reassign context to");

View File

@@ -0,0 +1,34 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Mon, 18 Sep 2023 16:47:41 +0200
Subject: [PATCH] nl80211: move nl80211_put_freq_params call outside of
802.11ax #ifdef
The relevance of this call is not specific to 802.11ax, so it should be done
even with CONFIG_IEEE80211AX disabled.
Fixes: b3921db426ea ("nl80211: Add frequency info in start AP command")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -5226,6 +5226,9 @@ static int wpa_driver_nl80211_set_ap(voi
nla_nest_end(msg, ftm);
}
+ if (params->freq && nl80211_put_freq_params(msg, params->freq) < 0)
+ goto fail;
+
#ifdef CONFIG_IEEE80211AX
if (params->he_spr_ctrl) {
struct nlattr *spr;
@@ -5260,9 +5263,6 @@ static int wpa_driver_nl80211_set_ap(voi
nla_nest_end(msg, spr);
}
- if (params->freq && nl80211_put_freq_params(msg, params->freq) < 0)
- goto fail;
-
if (params->freq && params->freq->he_enabled) {
struct nlattr *bss_color;

View File

@@ -0,0 +1,28 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Wed, 20 Sep 2023 13:41:10 +0200
Subject: [PATCH] hostapd: cancel channel_list_update_timeout in
hostapd_cleanup_iface_partial
Fixes a crash when disabling an interface during channel list update
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -569,6 +569,7 @@ static void sta_track_deinit(struct host
void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
{
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
+ eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
#ifdef NEED_AP_MLME
hostapd_stop_setup_timers(iface);
#endif /* NEED_AP_MLME */
@@ -598,7 +599,6 @@ void hostapd_cleanup_iface_partial(struc
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
{
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
- eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
NULL);

View File

@@ -18,7 +18,7 @@
OBJS += ../src/ap/vlan_init.o
OBJS += ../src/ap/vlan_ifconfig.o
OBJS += ../src/ap/vlan.o
@@ -349,10 +351,14 @@ CFLAGS += -DCONFIG_MBO
@@ -357,10 +359,14 @@ CFLAGS += -DCONFIG_MBO
OBJS += ../src/ap/mbo_ap.o
endif
@@ -36,7 +36,7 @@
LIBS += $(DRV_AP_LIBS)
ifdef CONFIG_L2_PACKET
@@ -1277,6 +1283,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
@@ -1380,6 +1386,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
_OBJS_VAR := OBJS
include ../src/objs.mk
@@ -49,7 +49,7 @@
hostapd: $(OBJS)
$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
@$(E) " LD " $@
@@ -1351,6 +1363,12 @@ include ../src/objs.mk
@@ -1460,6 +1472,12 @@ include ../src/objs.mk
_OBJS_VAR := SOBJS
include ../src/objs.mk
@@ -64,15 +64,15 @@
@$(E) " LD " $@
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -17,6 +17,7 @@ endif
@@ -10,6 +10,7 @@ ALL += dbus/fi.w1.wpa_supplicant1.servic
EXTRA_TARGETS=dynamic_eap_methods
CONFIG_FILE=.config
+-include $(if $(MULTICALL),../hostapd/.config)
include ../src/build.rules
ifdef LIBS
@@ -354,7 +355,9 @@ endif
ifdef CONFIG_BUILD_PASN_SO
@@ -382,7 +383,9 @@ endif
ifdef CONFIG_IBSS_RSN
NEED_RSN_AUTHENTICATOR=y
CFLAGS += -DCONFIG_IBSS_RSN
@@ -82,7 +82,7 @@
OBJS += ibss_rsn.o
endif
@@ -886,6 +889,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
@@ -924,6 +927,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
LIBS += -ldl -rdynamic
endif
@@ -93,7 +93,7 @@
endif
ifdef CONFIG_AP
@@ -893,9 +900,11 @@ NEED_EAP_COMMON=y
@@ -931,9 +938,11 @@ NEED_EAP_COMMON=y
NEED_RSN_AUTHENTICATOR=y
CFLAGS += -DCONFIG_AP
OBJS += ap.o
@@ -105,7 +105,7 @@
OBJS += ../src/ap/hostapd.o
OBJS += ../src/ap/wpa_auth_glue.o
OBJS += ../src/ap/utils.o
@@ -975,6 +984,12 @@ endif
@@ -1022,6 +1031,12 @@ endif
ifdef CONFIG_HS20
OBJS += ../src/ap/hs20.o
endif
@@ -118,7 +118,7 @@
endif
ifdef CONFIG_MBO
@@ -983,7 +998,9 @@ CFLAGS += -DCONFIG_MBO
@@ -1030,7 +1045,9 @@ CFLAGS += -DCONFIG_MBO
endif
ifdef NEED_RSN_AUTHENTICATOR
@@ -128,7 +128,7 @@
NEED_AES_WRAP=y
OBJS += ../src/ap/wpa_auth.o
OBJS += ../src/ap/wpa_auth_ie.o
@@ -1878,6 +1895,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
@@ -2010,6 +2027,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
_OBJS_VAR := OBJS
include ../src/objs.mk
@@ -141,7 +141,7 @@
wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
$(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
@$(E) " LD " $@
@@ -1983,6 +2006,12 @@ eap_eke.so: ../src/eap_peer/eap_eke.c ..
@@ -2142,6 +2165,12 @@ eap_gpsk.so: $(SRC_EAP_GPSK)
$(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
@$(E) " sed" $<
@@ -156,7 +156,7 @@
wpa_cli.exe: wpa_cli
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -6018,8 +6018,8 @@ union wpa_event_data {
@@ -6667,8 +6667,8 @@ union wpa_event_data {
* Driver wrapper code should call this function whenever an event is received
* from the driver.
*/
@@ -167,7 +167,7 @@
/**
* wpa_supplicant_event_global - Report a driver event for wpa_supplicant
@@ -6031,7 +6031,7 @@ void wpa_supplicant_event(void *ctx, enu
@@ -6680,7 +6680,7 @@ void wpa_supplicant_event(void *ctx, enu
* Same as wpa_supplicant_event(), but we search for the interface in
* wpa_global.
*/
@@ -178,7 +178,7 @@
/*
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -1827,8 +1827,8 @@ err:
@@ -2184,8 +2184,8 @@ err:
#endif /* CONFIG_OWE */
@@ -189,7 +189,7 @@
{
struct hostapd_data *hapd = ctx;
#ifndef CONFIG_NO_STDOUT_DEBUG
@@ -2073,7 +2073,7 @@ void wpa_supplicant_event(void *ctx, enu
@@ -2489,7 +2489,7 @@ void wpa_supplicant_event(void *ctx, enu
}
@@ -200,7 +200,7 @@
struct hapd_interfaces *interfaces = ctx;
--- a/wpa_supplicant/wpa_priv.c
+++ b/wpa_supplicant/wpa_priv.c
@@ -1038,8 +1038,8 @@ static void wpa_priv_send_ft_response(st
@@ -1039,8 +1039,8 @@ static void wpa_priv_send_ft_response(st
}
@@ -211,7 +211,7 @@
{
struct wpa_priv_interface *iface = ctx;
@@ -1102,7 +1102,7 @@ void wpa_supplicant_event(void *ctx, enu
@@ -1103,7 +1103,7 @@ void wpa_supplicant_event(void *ctx, enu
}
@@ -220,7 +220,7 @@
union wpa_event_data *data)
{
struct wpa_priv_global *global = ctx;
@@ -1215,6 +1215,8 @@ int main(int argc, char *argv[])
@@ -1217,6 +1217,8 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;
@@ -231,7 +231,7 @@
os_memset(&global, 0, sizeof(global));
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -4666,8 +4666,8 @@ static void wpas_event_unprot_beacon(str
@@ -5353,8 +5353,8 @@ static void wpas_link_reconfig(struct wp
}
@@ -242,7 +242,7 @@
{
struct wpa_supplicant *wpa_s = ctx;
int resched;
@@ -5512,7 +5512,7 @@ void wpa_supplicant_event(void *ctx, enu
@@ -6272,7 +6272,7 @@ void wpa_supplicant_event(void *ctx, enu
}
@@ -253,7 +253,7 @@
struct wpa_supplicant *wpa_s;
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -6814,7 +6814,6 @@ struct wpa_interface * wpa_supplicant_ma
@@ -7462,7 +7462,6 @@ struct wpa_interface * wpa_supplicant_ma
return NULL;
}
@@ -261,7 +261,7 @@
/**
* wpa_supplicant_match_existing - Match existing interfaces
* @global: Pointer to global data from wpa_supplicant_init()
@@ -6849,6 +6848,11 @@ static int wpa_supplicant_match_existing
@@ -7497,6 +7496,11 @@ static int wpa_supplicant_match_existing
#endif /* CONFIG_MATCH_IFACE */
@@ -273,7 +273,7 @@
/**
* wpa_supplicant_add_iface - Add a new network interface
@@ -7105,6 +7109,8 @@ struct wpa_global * wpa_supplicant_init(
@@ -7753,6 +7757,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 */
@@ -284,7 +284,7 @@
wpa_debug_open_file(params->wpa_debug_file_path);
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -590,6 +590,11 @@ fail:
@@ -698,6 +698,11 @@ fail:
return -1;
}
@@ -296,14 +296,14 @@
#ifdef CONFIG_WPS
static int gen_uuid(const char *txt_addr)
@@ -683,6 +688,8 @@ int main(int argc, char *argv[])
@@ -791,6 +796,8 @@ int main(int argc, char *argv[])
return -1;
#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:");
c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:q");
if (c < 0)
--- a/src/drivers/drivers.c
+++ b/src/drivers/drivers.c
@@ -320,7 +320,7 @@
{
--- a/wpa_supplicant/eapol_test.c
+++ b/wpa_supplicant/eapol_test.c
@@ -30,7 +30,12 @@
@@ -31,7 +31,12 @@
#include "ctrl_iface.h"
#include "pcsc_funcs.h"
#include "wpas_glue.h"
@@ -333,7 +333,7 @@
const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
@@ -1292,6 +1297,10 @@ static void usage(void)
@@ -1303,6 +1308,10 @@ static void usage(void)
"option several times.\n");
}
@@ -344,7 +344,7 @@
int main(int argc, char *argv[])
{
@@ -1312,6 +1321,8 @@ int main(int argc, char *argv[])
@@ -1323,6 +1332,8 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;

View File

@@ -1,6 +1,6 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3439,6 +3439,10 @@ static int hostapd_config_fill(struct ho
@@ -3448,6 +3448,10 @@ static int hostapd_config_fill(struct ho
if (bss->ocv && !bss->ieee80211w)
bss->ieee80211w = 1;
#endif /* CONFIG_OCV */
@@ -13,7 +13,7 @@
} else if (os_strcmp(buf, "ht_capab") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -995,6 +995,8 @@ struct hostapd_config {
@@ -1075,6 +1075,8 @@ struct hostapd_config {
int ht_op_mode_fixed;
u16 ht_capab;
@@ -24,7 +24,7 @@
int no_pri_sec_switch;
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -517,7 +517,8 @@ static int ieee80211n_check_40mhz(struct
@@ -546,7 +546,8 @@ static int ieee80211n_check_40mhz(struct
int ret;
/* Check that HT40 is used and PRI / SEC switch is allowed */
@@ -36,7 +36,7 @@
hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
--- a/src/ap/ieee802_11_ht.c
+++ b/src/ap/ieee802_11_ht.c
@@ -230,6 +230,9 @@ void hostapd_2040_coex_action(struct hos
@@ -239,6 +239,9 @@ void hostapd_2040_coex_action(struct hos
return;
}
@@ -46,7 +46,7 @@
if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) {
wpa_printf(MSG_DEBUG,
"Ignore too short 20/40 BSS Coexistence Management frame");
@@ -390,6 +393,9 @@ void ht40_intolerant_add(struct hostapd_
@@ -399,6 +402,9 @@ void ht40_intolerant_add(struct hostapd_
if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
return;

View File

@@ -1,81 +0,0 @@
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/config.c
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config.c
@@ -2532,6 +2532,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) },
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config_file.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/config_file.c
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config_file.c
@@ -769,6 +769,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(enable_edmg);
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/mesh.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/mesh.c
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/mesh.c
@@ -505,6 +505,8 @@ static int wpa_supplicant_mesh_init(stru
frequency);
goto out_free;
}
+ if (ssid->noscan)
+ conf->noscan = 1;
if (ssid->mesh_basic_rates == NULL) {
/*
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
@@ -2433,7 +2433,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
int ieee80211_mode = wpas_mode_to_ieee80211_mode(ssid->mode);
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 bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955,
6035, 6115, 6195, 6275, 6355, 6435, 6515,
@@ -2441,7 +2441,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
int bw160[] = { 5955, 6115, 6275, 6435, 6595, 6755, 6915 };
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;
@@ -2530,7 +2530,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
#endif /* CONFIG_HE_OVERRIDES */
/* 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++) {
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config_ssid.h
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/config_ssid.h
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config_ssid.h
@@ -974,6 +974,8 @@ struct wpa_ssid {
*/
int no_auto_peer;
+ int noscan;
+
/**
* mesh_rssi_threshold - Set mesh parameter mesh_rssi_threshold (dBm)
*

View File

@@ -1,6 +1,6 @@
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -5147,7 +5147,7 @@ wpa_supplicant_alloc(struct wpa_supplica
@@ -5769,7 +5769,7 @@ wpa_supplicant_alloc(struct wpa_supplica
if (wpa_s == NULL)
return NULL;
wpa_s->scan_req = INITIAL_SCAN_REQ;

View File

@@ -1,6 +1,6 @@
--- a/src/drivers/drivers.mak
+++ b/src/drivers/drivers.mak
@@ -50,7 +50,6 @@ NEED_SME=y
@@ -54,7 +54,6 @@ NEED_SME=y
NEED_AP_MLME=y
NEED_NETLINK=y
NEED_LINUX_IOCTL=y
@@ -8,7 +8,7 @@
NEED_RADIOTAP=y
NEED_LIBNL=y
endif
@@ -107,7 +106,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
@@ -111,7 +110,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
CONFIG_WIRELESS_EXTENSION=y
NEED_NETLINK=y
NEED_LINUX_IOCTL=y
@@ -16,7 +16,7 @@
endif
ifdef CONFIG_DRIVER_NDIS
@@ -133,7 +131,6 @@ endif
@@ -137,7 +135,6 @@ endif
ifdef CONFIG_WIRELESS_EXTENSION
DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
DRV_WPA_OBJS += ../src/drivers/driver_wext.o
@@ -24,7 +24,7 @@
endif
ifdef NEED_NETLINK
@@ -142,6 +139,7 @@ endif
@@ -146,6 +143,7 @@ endif
ifdef NEED_RFKILL
DRV_OBJS += ../src/drivers/rfkill.o

View File

@@ -1,8 +1,8 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4919,7 +4919,7 @@ static int nl80211_set_channel(struct i8
freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled,
freq->bandwidth, freq->center_freq1, freq->center_freq2);
@@ -5407,7 +5407,7 @@ static int nl80211_set_channel(struct i8
freq->he_enabled, freq->eht_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 :

View File

@@ -1,13 +1,18 @@
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -1513,15 +1513,35 @@ int ap_switch_channel(struct wpa_supplic
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/ap.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/ap.c
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/ap.c
@@ -1852,25 +1852,35 @@ int ap_switch_channel(struct wpa_supplic
#ifdef CONFIG_CTRL_IFACE
-int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos)
+
+static int __ap_ctrl_iface_chanswitch(struct hostapd_iface *iface,
+ struct csa_settings *settings)
+{
{
- struct csa_settings settings;
- int ret;
+#ifdef NEED_AP_MLME
+ if (!iface || !iface->bss[0])
+ return 0;
@@ -17,17 +22,25 @@
+ return -1;
+#endif
+}
+
+
int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos)
{
struct csa_settings settings;
int ret = hostapd_parse_csa_settings(pos, &settings);
- if (wpa_s->ifmsh && wpa_s->ifmsh->conf->disable_csa_dfs == 1) {
- wpa_printf(MSG_DEBUG, "wpa chanswitch interface %s :"
- " cancelling radar handling timeout",
- wpa_s->ifmsh->conf->bss[0]->iface);
- eloop_cancel_timeout(hostapd_dfs_radar_handling_timeout,
- wpa_s->ifmsh, NULL);
- }
- ret = hostapd_parse_csa_settings(pos, &settings);
+int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos)
+{
+ struct csa_settings settings;
+ int ret = hostapd_parse_csa_settings(pos, &settings);
+
+ if (!(wpa_s->ap_iface && wpa_s->ap_iface->bss[0]) &&
+ !(wpa_s->ifmsh && wpa_s->ifmsh->bss[0]))
+ return -1;
+
+ ret = __ap_ctrl_iface_chanswitch(wpa_s->ap_iface, &settings);
if (ret)
return ret;

View File

@@ -1,54 +0,0 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2891,10 +2891,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, NULL, NULL);
}
@@ -5550,7 +5555,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);
}
@@ -7990,8 +7995,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);
@@ -8388,7 +8391,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
@@ -8408,7 +8410,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;
}

View File

@@ -1,5 +1,7 @@
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
Index: hostapd-2023-02-21-ath12.3-cs/hostapd/Makefile
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/hostapd/Makefile
+++ hostapd-2023-02-21-ath12.3-cs/hostapd/Makefile
@@ -221,6 +221,9 @@ endif
ifdef CONFIG_NO_CTRL_IFACE
CFLAGS += -DCONFIG_NO_CTRL_IFACE
@@ -10,9 +12,11 @@
ifeq ($(CONFIG_CTRL_IFACE), udp)
CFLAGS += -DCONFIG_CTRL_IFACE_UDP
else
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -3388,6 +3388,7 @@ static int hostapd_ctrl_iface_receive_pr
Index: hostapd-2023-02-21-ath12.3-cs/hostapd/ctrl_iface.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/hostapd/ctrl_iface.c
+++ hostapd-2023-02-21-ath12.3-cs/hostapd/ctrl_iface.c
@@ -3805,6 +3805,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);
@@ -20,7 +24,7 @@
} else if (os_strcmp(buf, "MIB") == 0) {
reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
if (reply_len >= 0) {
@@ -3429,6 +3430,7 @@ static int hostapd_ctrl_iface_receive_pr
@@ -3846,6 +3847,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);
@@ -28,9 +32,11 @@
} 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
@@ -942,6 +942,9 @@ ifdef CONFIG_FILS
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/Makefile
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/Makefile
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/Makefile
@@ -987,6 +987,9 @@ ifdef CONFIG_FILS
OBJS += ../src/ap/fils_hlp.o
endif
ifdef CONFIG_CTRL_IFACE
@@ -40,9 +46,11 @@
OBJS += ../src/ap/ctrl_iface_ap.o
endif
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -2294,7 +2294,7 @@ static int wpa_supplicant_ctrl_iface_sta
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/ctrl_iface.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/ctrl_iface.c
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/ctrl_iface.c
@@ -2327,7 +2327,7 @@ static int wpa_supplicant_ctrl_iface_sta
pos += ret;
}
@@ -51,7 +59,7 @@
if (wpa_s->ap_iface) {
pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
end - pos,
@@ -10602,6 +10602,7 @@ char * wpa_supplicant_ctrl_iface_process
@@ -11989,6 +11989,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);
@@ -59,7 +67,7 @@
} else if (os_strcmp(buf, "MIB") == 0) {
reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
if (reply_len >= 0) {
@@ -10614,6 +10615,7 @@ char * wpa_supplicant_ctrl_iface_process
@@ -12001,6 +12002,7 @@ char * wpa_supplicant_ctrl_iface_process
reply_size - reply_len);
#endif /* CONFIG_MACSEC */
}
@@ -67,7 +75,7 @@
} else if (os_strncmp(buf, "STATUS", 6) == 0) {
reply_len = wpa_supplicant_ctrl_iface_status(
wpa_s, buf + 6, reply, reply_size);
@@ -11102,6 +11104,7 @@ char * wpa_supplicant_ctrl_iface_process
@@ -12489,6 +12491,7 @@ char * wpa_supplicant_ctrl_iface_process
reply_len = wpa_supplicant_ctrl_iface_bss(
wpa_s, buf + 4, reply, reply_size);
#ifdef CONFIG_AP
@@ -75,7 +83,7 @@
} 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) {
@@ -11110,12 +11113,15 @@ char * wpa_supplicant_ctrl_iface_process
@@ -12497,12 +12500,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);
@@ -91,17 +99,19 @@
} 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"
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/ctrl_iface_ap.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/ctrl_iface_ap.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/ctrl_iface_ap.c
@@ -26,6 +26,7 @@
#include "taxonomy.h"
#include "wnm_ap.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)
@@ -451,6 +452,7 @@ int hostapd_ctrl_iface_sta_next(struct h
typedef enum {
BAND_UNII_1 = 1,
@@ -760,6 +761,7 @@ int hostapd_ctrl_iface_sta_next(struct h
return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
}
@@ -109,7 +119,7 @@
#ifdef CONFIG_P2P_MANAGER
static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
@@ -807,12 +809,12 @@ int hostapd_ctrl_iface_status(struct hos
@@ -1192,12 +1194,12 @@ int hostapd_ctrl_iface_status(struct hos
return len;
len += ret;
}
@@ -124,9 +134,11 @@
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
@@ -2712,6 +2712,7 @@ static const char * bool_txt(bool val)
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/ieee802_1x.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/ieee802_1x.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/ieee802_1x.c
@@ -2768,6 +2768,7 @@ static const char * bool_txt(bool val)
return val ? "TRUE" : "FALSE";
}
@@ -134,7 +146,7 @@
int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
{
@@ -2898,6 +2899,7 @@ int ieee802_1x_get_mib_sta(struct hostap
@@ -2954,6 +2955,7 @@ int ieee802_1x_get_mib_sta(struct hostap
return len;
}
@@ -142,9 +154,11 @@
#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
@@ -4503,6 +4503,7 @@ static const char * wpa_bool_txt(int val
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/wpa_auth.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/wpa_auth.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/wpa_auth.c
@@ -5715,6 +5715,7 @@ static const char * wpa_bool_txt(int val
return val ? "TRUE" : "FALSE";
}
@@ -152,7 +166,7 @@
#define RSN_SUITE "%02x-%02x-%02x-%d"
#define RSN_SUITE_ARG(s) \
@@ -4653,7 +4654,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
@@ -5867,7 +5868,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
return len;
}
@@ -161,9 +175,11 @@
void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth)
{
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -2763,6 +2763,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
Index: hostapd-2023-02-21-ath12.3-cs/src/rsn_supp/wpa.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/src/rsn_supp/wpa.c
+++ hostapd-2023-02-21-ath12.3-cs/src/rsn_supp/wpa.c
@@ -3835,6 +3835,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
}
@@ -172,7 +188,7 @@
#define RSN_SUITE "%02x-%02x-%02x-%d"
#define RSN_SUITE_ARG(s) \
((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
@@ -2844,6 +2846,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
@@ -3916,6 +3918,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
return (int) len;
}
@@ -180,9 +196,11 @@
#endif /* CONFIG_CTRL_IFACE */
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -1364,7 +1364,7 @@ int wpas_ap_wps_nfc_report_handover(stru
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/ap.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/ap.c
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/ap.c
@@ -1512,7 +1512,7 @@ int wpas_ap_wps_nfc_report_handover(stru
#endif /* CONFIG_WPS */

View File

@@ -1,6 +1,6 @@
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -744,7 +744,7 @@ static int wpa_ctrl_command_sta(struct w
@@ -757,7 +757,7 @@ static int wpa_ctrl_command_sta(struct w
}
buf[len] = '\0';

View File

@@ -1,6 +1,6 @@
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -2444,6 +2444,31 @@ u32 wpa_akm_to_suite(int akm)
@@ -2841,6 +2841,31 @@ u32 wpa_akm_to_suite(int akm)
}
@@ -32,7 +32,7 @@
int wpa_compare_rsn_ie(int ft_initial_assoc,
const u8 *ie1, size_t ie1len,
const u8 *ie2, size_t ie2len)
@@ -2451,8 +2476,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
@@ -2848,8 +2873,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
if (ie1 == NULL || ie2 == NULL)
return -1;

View File

@@ -11,7 +11,7 @@
bss->wpa_pairwise |= WPA_CIPHER_TKIP;
#endif /* CONFIG_NO_TKIP */
bss->rsn_pairwise = bss->wpa_pairwise;
@@ -1178,8 +1177,7 @@ int hostapd_init_wps(struct hostapd_data
@@ -1181,8 +1180,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;

View File

@@ -60,7 +60,7 @@
#ifdef CONFIG_DEBUG_FILE
static char *last_path = NULL;
#endif /* CONFIG_DEBUG_FILE */
@@ -636,7 +610,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
@@ -644,7 +618,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
}
@@ -69,7 +69,7 @@
{
va_list ap;
char *buf;
@@ -674,7 +648,7 @@ void wpa_msg(void *ctx, int level, const
@@ -682,7 +656,7 @@ void wpa_msg(void *ctx, int level, const
}
@@ -80,9 +80,9 @@
char *buf;
--- a/src/utils/wpa_debug.h
+++ b/src/utils/wpa_debug.h
@@ -50,6 +50,17 @@ int wpa_debug_reopen_file(void);
void wpa_debug_close_file(void);
@@ -51,6 +51,17 @@ void wpa_debug_close_file(void);
void wpa_debug_setup_stdout(void);
void wpa_debug_stop_log(void);
+/* internal */
+void _wpa_hexdump(int level, const char *title, const u8 *buf,
@@ -98,7 +98,7 @@
/**
* wpa_debug_printf_timestamp - Print timestamp for debug output
*
@@ -70,9 +81,15 @@ void wpa_debug_print_timestamp(void);
@@ -71,9 +82,15 @@ void wpa_debug_print_timestamp(void);
*
* Note: New line '\n' is added to the end of the text when printing to stdout.
*/
@@ -115,7 +115,7 @@
/**
* wpa_hexdump - conditional hex dump
* @level: priority level (MSG_*) of the message
@@ -84,7 +101,13 @@ PRINTF_FORMAT(2, 3);
@@ -85,7 +102,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.
*/
@@ -130,7 +130,7 @@
static inline void wpa_hexdump_buf(int level, const char *title,
const struct wpabuf *buf)
@@ -106,7 +129,13 @@ static inline void wpa_hexdump_buf(int l
@@ -107,7 +130,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.
*/
@@ -145,7 +145,7 @@
static inline void wpa_hexdump_buf_key(int level, const char *title,
const struct wpabuf *buf)
@@ -128,8 +157,14 @@ static inline void wpa_hexdump_buf_key(i
@@ -129,8 +158,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.
*/
@@ -162,7 +162,7 @@
/**
* wpa_hexdump_ascii_key - conditional hex dump, hide keys
@@ -145,8 +180,14 @@ void wpa_hexdump_ascii(int level, const
@@ -146,8 +181,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.
*/
@@ -179,7 +179,7 @@
/*
* wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
@@ -183,7 +224,12 @@ void wpa_hexdump_ascii_key(int level, co
@@ -184,7 +225,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.
*/
@@ -193,7 +193,7 @@
/**
* wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
@@ -197,8 +243,13 @@ void wpa_msg(void *ctx, int level, const
@@ -198,8 +244,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.
*/

View File

@@ -1,23 +1,24 @@
--- 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"
@@ -691,7 +692,7 @@ int main(int argc, char *argv[])
@@ -31,7 +31,7 @@
#include "config_file.h"
#include "eap_register.h"
#include "ctrl_iface.h"
-
+#include "build_features.h"
struct hapd_global {
void **drv_priv;
@@ -799,7 +799,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::");
- c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:q");
+ c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:g:G:qv::");
if (c < 0)
break;
switch (c) {
@@ -728,6 +729,8 @@ int main(int argc, char *argv[])
@@ -836,6 +836,8 @@ int main(int argc, char *argv[])
break;
#endif /* CONFIG_DEBUG_LINUX_TRACING */
case 'v':
@@ -25,7 +26,7 @@
+ exit(!has_feature(optarg));
show_version();
exit(1);
break;
case 'g':
--- a/wpa_supplicant/main.c
+++ b/wpa_supplicant/main.c
@@ -12,6 +12,7 @@
@@ -33,10 +34,10 @@
#include "common.h"
+#include "build_features.h"
#include "crypto/crypto.h"
#include "fst/fst.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
for (;;) {
c = getopt(argc, argv,
@@ -45,7 +46,7 @@
if (c < 0)
break;
switch (c) {
@@ -301,8 +302,12 @@ int main(int argc, char *argv[])
@@ -302,8 +303,12 @@ int main(int argc, char *argv[])
break;
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
case 'v':

View File

@@ -1,6 +1,6 @@
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -388,7 +388,6 @@ static int hostapd_cli_cmd_disassociate(
@@ -401,7 +401,6 @@ static int hostapd_cli_cmd_disassociate(
}
@@ -8,7 +8,7 @@
static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@@ -401,7 +400,6 @@ static int hostapd_cli_cmd_signature(str
@@ -414,7 +413,6 @@ static int hostapd_cli_cmd_signature(str
os_snprintf(buf, sizeof(buf), "SIGNATURE %s", argv[0]);
return wpa_ctrl_command(ctrl, buf);
}
@@ -16,7 +16,7 @@
static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc,
@@ -418,7 +416,6 @@ static int hostapd_cli_cmd_sa_query(stru
@@ -431,7 +429,6 @@ static int hostapd_cli_cmd_sa_query(stru
}
@@ -24,7 +24,7 @@
static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@@ -644,7 +641,6 @@ static int hostapd_cli_cmd_wps_config(st
@@ -657,7 +654,6 @@ static int hostapd_cli_cmd_wps_config(st
ssid_hex, argv[1]);
return wpa_ctrl_command(ctrl, buf);
}
@@ -32,7 +32,7 @@
static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
@@ -1571,13 +1567,10 @@ static const struct hostapd_cli_cmd host
@@ -1610,13 +1606,10 @@ static const struct hostapd_cli_cmd host
{ "disassociate", hostapd_cli_cmd_disassociate,
hostapd_complete_stations,
"<addr> = disassociate a station" },
@@ -46,7 +46,7 @@
{ "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,
@@ -1602,7 +1595,6 @@ static const struct hostapd_cli_cmd host
@@ -1641,7 +1634,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" },

View File

@@ -1,10 +0,0 @@
--- 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 */

View File

@@ -22,7 +22,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
#include "common/defs.h"
#include "common/ieee802_11_defs.h"
#include "common/wpa_common.h"
@@ -851,6 +852,9 @@ struct wpa_driver_associate_params {
@@ -953,6 +954,9 @@ struct wpa_driver_associate_params {
* responsible for selecting with which BSS to associate. */
const u8 *bssid;
@@ -42,7 +42,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
#include "config.h"
@@ -2321,6 +2322,97 @@ static char * wpa_config_write_peerkey(c
@@ -2389,6 +2390,97 @@ static char * wpa_config_write_mac_value
#endif /* NO_CONFIG_WRITE */
@@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
/* Helper macros for network block parser */
#ifdef OFFSET
@@ -2606,6 +2698,8 @@ static const struct parse_data ssid_fiel
@@ -2674,6 +2766,8 @@ static const struct parse_data ssid_fiel
{ INT(ap_max_inactivity) },
{ INT(dtim_period) },
{ INT(beacon_int) },
@@ -162,7 +162,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
#define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
@@ -843,6 +845,9 @@ struct wpa_ssid {
@@ -879,6 +881,9 @@ struct wpa_ssid {
*/
void *parent_cred;
@@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
* macsec_policy - Determines the policy for MACsec secure session
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3673,6 +3673,12 @@ static void wpas_start_assoc_cb(struct w
@@ -4177,6 +4177,12 @@ static void wpas_start_assoc_cb(struct w
params.beacon_int = ssid->beacon_int;
else
params.beacon_int = wpa_s->conf->beacon_int;

View File

@@ -1,59 +0,0 @@
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
@@ -5886,7 +5886,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);
@@ -5913,6 +5913,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;

View File

@@ -1,68 +0,0 @@
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
@@ -1618,6 +1618,7 @@ struct wpa_driver_mesh_join_params {
#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
unsigned int flags;
bool handle_dfs;
+ int mcast_rate;
};
struct wpa_driver_set_key_params {
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -10398,6 +10398,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)
{
@@ -10459,6 +10471,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
@@ -600,6 +600,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, &params->freq);
wpa_s->mesh_ht_enabled = !!params->freq.ht_enabled;
wpa_s->mesh_vht_enabled = !!params->freq.vht_enabled;

View File

@@ -1,19 +1,14 @@
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2403,11 +2403,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];
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wpa_supplicant.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wpa_supplicant.c
@@ -2744,6 +2744,9 @@ void ibss_mesh_setup_freq(struct wpa_sup
bool is_24ghz, is_6ghz;
- if (ssid->mode != WPAS_MODE_IBSS)
+ /* Don't adjust control freq in case of fixed_freq */
+ if (ssid->fixed_freq) {
+ obss_scan = 0;
break;
+ }
freq->freq = ssid->frequency;
+ if (ssid->fixed_freq) {
+ obss_scan = 0;
+ }
- /* 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))
for (j = 0; j < wpa_s->last_scan_res_used; j++) {
struct wpa_bss *bss = wpa_s->last_scan_res[j];

View File

@@ -1,44 +1,29 @@
Index: hostapd-2021-12-13-b26f5c0f/src/ap/acs.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/src/ap/acs.c
+++ hostapd-2021-12-13-b26f5c0f/src/ap/acs.c
@@ -302,16 +302,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 {
- wpa_printf(MSG_ERROR, "ACS: Survey data missing");
- return 0;
- }
total = survey->channel_time;
@@ -420,20 +416,19 @@ static int acs_usable_bw160_chan(const s
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -455,17 +455,17 @@ static int acs_get_bw_center_chan(int fr
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");
wpa_printf(MSG_INFO,
"ACS: Survey for freq %d is missing noise floor",
survey->freq);
- return 0;
}
if (!(survey->filled & SURVEY_HAS_CHAN_TIME)) {
+ survey->channel_time = 0;
wpa_printf(MSG_INFO, "ACS: Survey is missing channel time");
wpa_printf(MSG_INFO,
"ACS: Survey for freq %d is missing channel time",
survey->freq);
- return 0;
}
if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) &&
!(survey->filled & SURVEY_HAS_CHAN_TIME_RX)) {
@@ -473,7 +473,6 @@ static int acs_survey_is_sufficient(stru
wpa_printf(MSG_INFO,
"ACS: Survey is missing RX and busy time (at least one is required)");
"ACS: Survey for freq %d is missing RX and busy time (at least one is required)",
survey->freq);
- return 0;
}

View File

@@ -1,6 +1,6 @@
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -1293,7 +1293,7 @@ hostapd_multi.a: $(BCHECK) $(OBJS)
@@ -1396,7 +1396,7 @@ hostapd_multi.a: $(BCHECK) $(OBJS)
@$(AR) cr $@ hostapd_multi.o $(OBJS)
hostapd: $(OBJS)
@@ -9,7 +9,7 @@
@$(E) " LD " $@
ifdef CONFIG_WPA_TRACE
@@ -1304,7 +1304,7 @@ _OBJS_VAR := OBJS_c
@@ -1407,7 +1407,7 @@ _OBJS_VAR := OBJS_c
include ../src/objs.mk
hostapd_cli: $(OBJS_c)
@@ -20,7 +20,7 @@
NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS)
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -1905,31 +1905,31 @@ wpa_supplicant_multi.a: .config $(BCHECK
@@ -2037,31 +2037,31 @@ wpa_supplicant_multi.a: .config $(BCHECK
@$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)

View File

@@ -1,6 +1,6 @@
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -148,6 +148,21 @@ struct hostapd_sae_commit_queue {
@@ -163,6 +163,21 @@ struct hostapd_sae_commit_queue {
};
/**
@@ -22,9 +22,9 @@
* struct hostapd_data - hostapd per-BSS data structure
*/
struct hostapd_data {
@@ -161,6 +176,9 @@ struct hostapd_data {
@@ -182,6 +197,9 @@ struct hostapd_data {
u8 own_addr[ETH_ALEN];
struct hostapd_data *mld_first_bss;
+ /* OpenWrt specific statistics */
+ struct hostapd_openwrt_stats openwrt_stats;
@@ -42,9 +42,9 @@
wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request to "
MACSTR " dialog_token=%u req_mode=0x%x disassoc_timer=%u "
"validity_interval=%u",
@@ -646,10 +647,12 @@ int ieee802_11_rx_wnm_action_ap(struct h
switch (action) {
@@ -790,10 +791,12 @@ int ieee802_11_rx_wnm_action_ap(struct h
plen);
return 0;
case WNM_BSS_TRANS_MGMT_QUERY:
+ hapd->openwrt_stats.wnm.bss_transition_query_rx++;
ieee802_11_rx_bss_trans_mgmt_query(hapd, mgmt->sa, payload,
@@ -55,7 +55,7 @@
ieee802_11_rx_bss_trans_mgmt_resp(hapd, mgmt->sa, payload,
plen);
return 0;
@@ -696,6 +699,7 @@ int wnm_send_disassoc_imminent(struct ho
@@ -840,6 +843,7 @@ int wnm_send_disassoc_imminent(struct ho
pos = mgmt->u.action.u.bss_tm_req.variable;
@@ -63,7 +63,7 @@
wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request frame to indicate imminent disassociation (disassoc_timer=%d) to "
MACSTR, disassoc_timer, MAC2STR(sta->addr));
if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0, NULL, 0, 0) < 0) {
@@ -777,6 +781,7 @@ int wnm_send_ess_disassoc_imminent(struc
@@ -921,6 +925,7 @@ int wnm_send_ess_disassoc_imminent(struc
return -1;
}
@@ -71,7 +71,7 @@
if (disassoc_timer) {
/* send disassociation frame after time-out */
set_disassoc_timer(hapd, sta, disassoc_timer);
@@ -856,6 +861,7 @@ int wnm_send_bss_tm_req(struct hostapd_d
@@ -1001,6 +1006,7 @@ int wnm_send_bss_tm_req(struct hostapd_d
}
os_free(buf);

View File

@@ -1,7 +1,7 @@
Index: hostapd-2021-02-20-59e9794c/hostapd/Makefile
Index: hostapd-2023-02-21-ath12.3-cs/hostapd/Makefile
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/hostapd/Makefile
+++ hostapd-2021-02-20-59e9794c/hostapd/Makefile
--- hostapd-2023-02-21-ath12.3-cs.orig/hostapd/Makefile
+++ hostapd-2023-02-21-ath12.3-cs/hostapd/Makefile
@@ -166,6 +166,12 @@ OBJS += ../src/common/hw_features_common
OBJS += ../src/eapol_auth/eapol_auth_sm.o
@@ -15,11 +15,11 @@ Index: hostapd-2021-02-20-59e9794c/hostapd/Makefile
ifdef CONFIG_CODE_COVERAGE
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.h
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/hostapd.h
+++ hostapd-2021-02-20-59e9794c/src/ap/hostapd.h
@@ -17,6 +17,7 @@
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/hostapd.h
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.h
@@ -18,6 +18,7 @@
#include "utils/list.h"
#include "ap_config.h"
#include "drivers/driver.h"
@@ -27,15 +27,15 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.h
#define OCE_STA_CFON_ENABLED(hapd) \
((hapd->conf->oce & OCE_STA_CFON) && \
@@ -169,6 +170,7 @@ struct hostapd_data {
struct hostapd_iface *iface;
@@ -203,6 +204,7 @@ struct hostapd_data {
#endif
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;
@@ -626,6 +628,7 @@ hostapd_alloc_bss_data(struct hostapd_if
@@ -741,6 +743,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);
@@ -43,11 +43,11 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.h
void hostapd_interface_deinit(struct hostapd_iface *iface);
void hostapd_interface_free(struct hostapd_iface *iface);
struct hostapd_iface * hostapd_alloc_iface(void);
Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.c
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/hostapd.c
+++ hostapd-2021-02-20-59e9794c/src/ap/hostapd.c
@@ -376,6 +376,7 @@ void hostapd_free_hapd_data(struct hosta
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/hostapd.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.c
@@ -471,6 +471,7 @@ void hostapd_free_hapd_data(struct hosta
hapd->beacon_set_done = 0;
wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
@@ -55,7 +55,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.c
accounting_deinit(hapd);
hostapd_deinit_wpa(hapd);
vlan_deinit(hapd);
@@ -1398,6 +1399,8 @@ static int hostapd_setup_bss(struct host
@@ -1224,6 +1225,8 @@ static int hostapd_start_beacon(struct h
if (hapd->driver && hapd->driver->set_operstate)
hapd->driver->set_operstate(hapd->drv_priv, 1);
@@ -64,15 +64,15 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.c
return 0;
}
@@ -1983,6 +1986,7 @@ static int hostapd_setup_interface_compl
@@ -2331,6 +2334,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->freq) {
#ifdef NEED_AP_MLME
@@ -2180,6 +2184,7 @@ dfs_offload:
@@ -2567,6 +2571,7 @@ dfs_offload:
fail:
wpa_printf(MSG_ERROR, "Interface initialization failed");
@@ -80,7 +80,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.c
hostapd_set_state(iface, HAPD_IFACE_DISABLED);
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
#ifdef CONFIG_FST
@@ -2653,6 +2658,7 @@ void hostapd_interface_deinit_free(struc
@@ -3464,6 +3469,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;
@@ -88,11 +88,21 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.c
hostapd_interface_deinit(iface);
wpa_printf(MSG_DEBUG, "%s: driver=%p drv_priv=%p -> hapd_deinit",
__func__, driver, drv_priv);
Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/ieee802_11.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/ieee802_11.c
+++ hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
@@ -3421,13 +3421,18 @@ static void handle_auth(struct hostapd_d
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/ieee802_11.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/ieee802_11.c
@@ -87,8 +87,7 @@ static size_t hostapd_eid_basic_resp_mle
static void handle_auth(struct hostapd_data *hapd,
struct ieee80211_mgmt *mgmt, size_t len,
- int rssi, int from_queue,
- struct hostapd_frame_info *fi);
+ int rssi, int from_queue);
u8 * hostapd_eid_multi_ap(struct hostapd_data *hapd, u8 *eid)
@@ -2785,7 +2784,7 @@ static void handle_auth(struct hostapd_d
u16 auth_alg, auth_transaction, status_code;
u16 resp = WLAN_STATUS_SUCCESS;
struct sta_info *sta = NULL;
@@ -101,9 +111,10 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
u16 fc;
const u8 *challenge = NULL;
u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN];
size_t resp_ies_len = 0;
u16 seq_ctrl;
struct radius_sta rad_info;
@@ -2800,6 +2799,11 @@ static void handle_auth(struct hostapd_d
const u8 *token = NULL;
size_t token_len = 0;
int parsed_len = 0;
+ struct hostapd_ubus_request req = {
+ .type = HOSTAPD_UBUS_AUTH_REQ,
+ .mgmt_frame = mgmt,
@@ -112,7 +123,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
@@ -3595,6 +3600,13 @@ static void handle_auth(struct hostapd_d
@@ -3019,6 +3023,13 @@ skip_ml_parsing:
resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
goto fail;
}
@@ -126,7 +137,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
if (res == HOSTAPD_ACL_PENDING)
return;
@@ -5322,7 +5334,7 @@ static void handle_assoc(struct hostapd_
@@ -5519,7 +5530,7 @@ static void handle_assoc(struct hostapd_
int resp = WLAN_STATUS_SUCCESS;
u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE;
const u8 *pos;
@@ -135,7 +146,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
struct sta_info *sta;
u8 *tmp = NULL;
#ifdef CONFIG_FILS
@@ -5535,6 +5547,11 @@ static void handle_assoc(struct hostapd_
@@ -5733,6 +5744,11 @@ static void handle_assoc(struct hostapd_
left = res;
}
#endif /* CONFIG_FILS */
@@ -147,7 +158,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
/* followed by SSID and Supported rates; and HT capabilities if 802.11n
* is used */
@@ -5633,6 +5650,13 @@ static void handle_assoc(struct hostapd_
@@ -5840,6 +5856,13 @@ static void handle_assoc(struct hostapd_
}
#endif /* CONFIG_FILS */
@@ -161,31 +172,30 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
fail:
/*
@@ -5726,6 +5750,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));
@@ -6019,6 +6042,7 @@ static void handle_deauth(struct hostapd
/* Clear the PTKSA cache entries for PASN */
ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE);
+ hostapd_ubus_notify(hapd, "deauth", mgmt->sa);
sta = ap_get_sta(hapd, mgmt->sa);
if (sta == NULL) {
@@ -6141,6 +6165,7 @@ static int handle_action(struct hostapd_
sta->last_seq_ctrl = seq_ctrl;
sta->last_subtype = WLAN_FC_STYPE_ACTION;
}
+ hostapd_ubus_notify(hapd, "disassoc", mgmt->sa);
sta = ap_get_sta(hapd, mgmt->sa);
if (sta == NULL) {
@@ -5792,6 +5817,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 "
Index: hostapd-2021-02-20-59e9794c/src/ap/beacon.c
switch (mgmt->u.action.category) {
#ifdef CONFIG_IEEE80211R_AP
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/beacon.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/beacon.c
+++ hostapd-2021-02-20-59e9794c/src/ap/beacon.c
@@ -823,6 +823,12 @@ void handle_probe_req(struct hostapd_dat
u16 csa_offs[2];
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/beacon.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/beacon.c
@@ -1424,6 +1424,12 @@ void handle_probe_req(struct hostapd_dat
size_t csa_offs_len;
struct radius_sta rad_info;
struct multi_link_data ml_data;
+ struct hostapd_ubus_request req = {
+ .type = HOSTAPD_UBUS_PROBE_REQ,
+ .mgmt_frame = mgmt,
@@ -193,9 +203,9 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/beacon.c
+ .elems = &elems,
+ };
if (hapd->iconf->rssi_ignore_probe_request && ssi_signal &&
ssi_signal < hapd->iconf->rssi_ignore_probe_request)
@@ -1009,6 +1015,12 @@ void handle_probe_req(struct hostapd_dat
os_memset(&ml_data, 0, sizeof(struct multi_link_data));
@@ -1612,6 +1618,12 @@ void handle_probe_req(struct hostapd_dat
}
#endif /* CONFIG_P2P */
@@ -208,11 +218,11 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/beacon.c
/* TODO: verify that supp_rates contains at least one matching rate
* with AP configuration */
Index: hostapd-2021-02-20-59e9794c/src/ap/drv_callbacks.c
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/drv_callbacks.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/drv_callbacks.c
+++ hostapd-2021-02-20-59e9794c/src/ap/drv_callbacks.c
@@ -145,6 +145,10 @@ int hostapd_notif_assoc(struct hostapd_d
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/drv_callbacks.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/drv_callbacks.c
@@ -147,6 +147,10 @@ int hostapd_notif_assoc(struct hostapd_d
u16 reason = WLAN_REASON_UNSPECIFIED;
int status = WLAN_STATUS_SUCCESS;
const u8 *p2p_dev_addr = NULL;
@@ -223,7 +233,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/drv_callbacks.c
if (addr == NULL) {
/*
@@ -237,6 +241,12 @@ int hostapd_notif_assoc(struct hostapd_d
@@ -239,6 +243,12 @@ int hostapd_notif_assoc(struct hostapd_d
goto fail;
}
@@ -236,23 +246,11 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/drv_callbacks.c
#ifdef CONFIG_P2P
if (elems.p2p) {
wpabuf_free(sta->p2p_ie);
@@ -981,9 +991,11 @@ void hostapd_event_ch_switch(struct host
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_CSA_FINISHED
"freq=%d dfs=%d", freq, is_dfs);
+ hostapd_ubus_notify_csa(hapd, freq);
} else if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) {
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_CSA_FINISHED
"freq=%d dfs=%d", freq, is_dfs);
+ hostapd_ubus_notify_csa(hapd, freq);
} else if (is_dfs &&
hostapd_is_dfs_required(hapd->iface) &&
!hostapd_is_dfs_chan_available(hapd->iface) &&
Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/sta_info.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/sta_info.c
+++ hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
@@ -458,6 +458,7 @@ void ap_handle_timer(void *eloop_ctx, vo
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/sta_info.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/sta_info.c
@@ -597,6 +597,7 @@ void ap_handle_timer(void *eloop_ctx, vo
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_INFO, "deauthenticated due to "
"local deauth request");
@@ -260,7 +258,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
ap_free_sta(hapd, sta);
return;
}
@@ -613,6 +614,7 @@ skip_poll:
@@ -752,6 +753,7 @@ skip_poll:
mlme_deauthenticate_indication(
hapd, sta,
WLAN_REASON_PREV_AUTH_NOT_VALID);
@@ -268,7 +266,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
ap_free_sta(hapd, sta);
break;
}
@@ -1298,12 +1300,25 @@ void ap_sta_set_authorized(struct hostap
@@ -1592,15 +1594,28 @@ void ap_sta_set_authorized(struct hostap
sta->addr, authorized, dev_addr);
if (authorized) {
@@ -283,18 +281,21 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
+ [WLAN_AUTH_PASN] = "pasn",
+ };
+ const char *auth_alg = NULL;
const u8 *dpp_pkhash;
const char *keyid;
char dpp_pkhash_buf[100];
char keyid_buf[100];
char ip_addr[100];
+ char alg_buf[100];
dpp_pkhash_buf[0] = '\0';
keyid_buf[0] = '\0';
ip_addr[0] = '\0';
+ alg_buf[0] = '\0';
#ifdef CONFIG_P2P
if (wpa_auth_get_ip_addr(sta->wpa_sm, ip_addr_buf) == 0) {
os_snprintf(ip_addr, sizeof(ip_addr),
@@ -1313,22 +1328,31 @@ void ap_sta_set_authorized(struct hostap
@@ -1610,6 +1625,13 @@ void ap_sta_set_authorized(struct hostap
}
#endif /* CONFIG_P2P */
@@ -308,33 +309,35 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
keyid = ap_sta_wpa_get_keyid(hapd, sta);
if (keyid) {
os_snprintf(keyid_buf, sizeof(keyid_buf),
" keyid=%s", keyid);
@@ -1628,17 +1650,19 @@ void ap_sta_set_authorized(struct hostap
dpp_pkhash, SHA256_MAC_LEN);
}
- wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s",
- buf, ip_addr, keyid_buf);
+ hostapd_ubus_notify_authorized(hapd, sta);
+ wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s",
+ buf, ip_addr, keyid_buf, alg_buf);
- wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s",
- buf, ip_addr, keyid_buf, dpp_pkhash_buf);
+ hostapd_ubus_notify_authorized(hapd, sta, auth_alg);
+ wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s%s",
+ buf, ip_addr, keyid_buf, dpp_pkhash_buf, alg_buf);
if (hapd->msg_ctx_parent &&
hapd->msg_ctx_parent != hapd->msg_ctx)
wpa_msg_no_global(hapd->msg_ctx_parent, MSG_INFO,
- AP_STA_CONNECTED "%s%s%s",
- buf, ip_addr, keyid_buf);
+ AP_STA_CONNECTED "%s%s%s%s",
+ buf, ip_addr, keyid_buf, alg_buf);
- AP_STA_CONNECTED "%s%s%s%s",
+ AP_STA_CONNECTED "%s%s%s%s%s",
buf, ip_addr, keyid_buf,
- dpp_pkhash_buf);
+ dpp_pkhash_buf, alg_buf);
} 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)
Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_glue.c
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/wpa_auth_glue.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/wpa_auth_glue.c
+++ hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_glue.c
@@ -265,6 +265,7 @@ static void hostapd_wpa_auth_psk_failure
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/wpa_auth_glue.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/wpa_auth_glue.c
@@ -270,6 +270,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));
@@ -342,11 +345,11 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_glue.c
}
Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/Makefile
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/Makefile
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/wpa_supplicant/Makefile
+++ hostapd-2021-02-20-59e9794c/wpa_supplicant/Makefile
@@ -169,6 +169,13 @@ ifdef CONFIG_EAPOL_TEST
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/Makefile
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/Makefile
@@ -192,6 +192,13 @@ ifdef CONFIG_EAPOL_TEST
CFLAGS += -Werror -DEAPOL_TEST
endif
@@ -360,7 +363,7 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/Makefile
ifdef CONFIG_CODE_COVERAGE
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
LIBS += -lgcov
@@ -946,6 +953,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
@@ -991,6 +998,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
CFLAGS += -DCONFIG_CTRL_IFACE_MIB
endif
OBJS += ../src/ap/ctrl_iface_ap.o
@@ -370,11 +373,11 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/Makefile
endif
CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant.c
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wpa_supplicant.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant.c
@@ -6943,6 +6943,8 @@ struct wpa_supplicant * wpa_supplicant_a
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wpa_supplicant.c
@@ -7640,6 +7640,8 @@ struct wpa_supplicant * wpa_supplicant_a
}
#endif /* CONFIG_P2P */
@@ -383,7 +386,7 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant.c
return wpa_s;
}
@@ -6969,6 +6971,8 @@ int wpa_supplicant_remove_iface(struct w
@@ -7666,6 +7668,8 @@ int wpa_supplicant_remove_iface(struct w
struct wpa_supplicant *parent = wpa_s->parent;
#endif /* CONFIG_MESH */
@@ -392,7 +395,7 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant.c
/* Remove interface from the global list of interfaces */
prev = global->ifaces;
if (prev == wpa_s) {
@@ -7272,8 +7276,12 @@ int wpa_supplicant_run(struct wpa_global
@@ -8012,8 +8016,12 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
@@ -405,19 +408,19 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant.c
return 0;
}
Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant_i.h
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wpa_supplicant_i.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/wpa_supplicant/wpa_supplicant_i.h
+++ hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant_i.h
@@ -19,6 +19,7 @@
#include "wps/wps_defs.h"
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/wpa_supplicant_i.h
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wpa_supplicant_i.h
@@ -21,6 +21,7 @@
#include "config_ssid.h"
#include "wmm_ac.h"
#include "pasn/pasn_common.h"
+#include "ubus.h"
extern const char *const wpa_supplicant_version;
extern const char *const wpa_supplicant_license;
@@ -316,6 +317,8 @@ struct wpa_global {
@@ -319,6 +320,8 @@ struct wpa_global {
#endif /* CONFIG_WIFI_DISPLAY */
struct psk_list_entry *add_psk; /* From group formation */
@@ -426,7 +429,7 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant_i.h
};
@@ -596,6 +599,7 @@ struct wpa_supplicant {
@@ -650,6 +653,7 @@ struct wpa_supplicant {
unsigned char own_addr[ETH_ALEN];
unsigned char perm_addr[ETH_ALEN];
char ifname[100];
@@ -434,10 +437,10 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant_i.h
#ifdef CONFIG_MATCH_IFACE
int matched;
#endif /* CONFIG_MATCH_IFACE */
Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wps_supplicant.c
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wps_supplicant.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/wpa_supplicant/wps_supplicant.c
+++ hostapd-2021-02-20-59e9794c/wpa_supplicant/wps_supplicant.c
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/wps_supplicant.c
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wps_supplicant.c
@@ -33,6 +33,7 @@
#include "p2p/p2p.h"
#include "p2p_supplicant.h"
@@ -446,7 +449,7 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wps_supplicant.c
#ifndef WPS_PIN_SCAN_IGNORE_SEL_REG
@@ -392,6 +393,8 @@ static int wpa_supplicant_wps_cred(void
@@ -402,6 +403,8 @@ static int wpa_supplicant_wps_cred(void
wpa_hexdump_key(MSG_DEBUG, "WPS: Received Credential attribute",
cred->cred_attr, cred->cred_attr_len);
@@ -455,11 +458,11 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wps_supplicant.c
if (wpa_s->conf->wps_cred_processing == 1)
return 0;
Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/main.c
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/main.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/wpa_supplicant/main.c
+++ hostapd-2021-02-20-59e9794c/wpa_supplicant/main.c
@@ -202,7 +202,7 @@ int main(int argc, char *argv[])
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/main.c
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/main.c
@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
for (;;) {
c = getopt(argc, argv,
@@ -468,7 +471,7 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/main.c
if (c < 0)
break;
switch (c) {
@@ -267,6 +267,9 @@ int main(int argc, char *argv[])
@@ -268,6 +268,9 @@ int main(int argc, char *argv[])
params.conf_p2p_dev = optarg;
break;
#endif /* CONFIG_P2P */
@@ -478,10 +481,10 @@ Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/main.c
case 'o':
params.override_driver = optarg;
break;
Index: hostapd-2021-02-20-59e9794c/src/ap/rrm.c
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/rrm.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/rrm.c
+++ hostapd-2021-02-20-59e9794c/src/ap/rrm.c
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/rrm.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/rrm.c
@@ -89,6 +89,9 @@ static void hostapd_handle_beacon_report
return;
wpa_msg(hapd->msg_ctx, MSG_INFO, BEACON_RESP_RX MACSTR " %u %02x %s",
@@ -492,10 +495,18 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/rrm.c
}
Index: hostapd-2021-02-20-59e9794c/src/ap/vlan_init.c
@@ -360,6 +363,7 @@ void hostapd_handle_radio_measurement(st
break;
case WLAN_RRM_LINK_MEASUREMENT_REPORT:
hostapd_handle_link_mesr_report(hapd, buf, len);
+ hostapd_ubus_handle_link_measurement(hapd, buf, len);
break;
default:
wpa_printf(MSG_DEBUG, "RRM action %u is not supported",
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/vlan_init.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/vlan_init.c
+++ hostapd-2021-02-20-59e9794c/src/ap/vlan_init.c
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/vlan_init.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/vlan_init.c
@@ -22,6 +22,7 @@
static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
int existsok)
@@ -532,11 +543,11 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/vlan_init.c
return hostapd_vlan_if_remove(hapd, vlan->ifname);
}
Index: hostapd-2021-02-20-59e9794c/src/ap/dfs.c
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/dfs.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/dfs.c
+++ hostapd-2021-02-20-59e9794c/src/ap/dfs.c
@@ -1226,6 +1226,8 @@ int hostapd_dfs_nop_finished(struct host
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/dfs.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/dfs.c
@@ -1331,6 +1331,8 @@ int hostapd_dfs_pre_cac_expired(struct h
"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
@@ -545,11 +556,11 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/dfs.c
/* Proceed only if DFS is not offloaded to the driver */
if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
return 0;
Index: hostapd-2021-02-20-59e9794c/src/ap/airtime_policy.c
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/airtime_policy.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/airtime_policy.c
+++ hostapd-2021-02-20-59e9794c/src/ap/airtime_policy.c
@@ -108,8 +108,14 @@ static void set_sta_weights(struct hosta
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/airtime_policy.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/airtime_policy.c
@@ -112,8 +112,14 @@ static void set_sta_weights(struct hosta
{
struct sta_info *sta;
@@ -566,7 +577,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/airtime_policy.c
}
@@ -240,7 +246,10 @@ int airtime_policy_new_sta(struct hostap
@@ -244,7 +250,10 @@ int airtime_policy_new_sta(struct hostap
unsigned int weight;
if (hapd->iconf->airtime_mode == AIRTIME_MODE_STATIC) {
@@ -578,11 +589,11 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/airtime_policy.c
if (weight)
return sta_set_airtime_weight(hapd, sta, weight);
}
Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.h
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/sta_info.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/sta_info.h
+++ hostapd-2021-02-20-59e9794c/src/ap/sta_info.h
@@ -323,6 +323,7 @@ struct sta_info {
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/sta_info.h
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/sta_info.h
@@ -322,6 +322,7 @@ struct sta_info {
#endif /* CONFIG_TESTING_OPTIONS */
#ifdef CONFIG_AIRTIME_POLICY
unsigned int airtime_weight;
@@ -590,13 +601,13 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.h
struct os_reltime backlogged_until;
#endif /* CONFIG_AIRTIME_POLICY */
Index: hostapd-2021-02-20-59e9794c/src/ap/wnm_ap.c
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/wnm_ap.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/wnm_ap.c
+++ hostapd-2021-02-20-59e9794c/src/ap/wnm_ap.c
@@ -442,7 +442,8 @@ static void ieee802_11_rx_bss_trans_mgmt
wpa_hexdump(MSG_DEBUG, "WNM: BSS Transition Candidate List Entries",
pos, end - pos);
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/wnm_ap.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/wnm_ap.c
@@ -495,7 +495,8 @@ static void ieee802_11_rx_bss_trans_mgmt
MAC2STR(addr), reason, hex ? " neighbor=" : "", hex);
os_free(hex);
- ieee802_11_send_bss_trans_mgmt_request(hapd, addr, dialog_token);
+ if (!hostapd_ubus_notify_bss_transition_query(hapd, addr, dialog_token, reason, pos, end - pos))
@@ -604,7 +615,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wnm_ap.c
}
@@ -464,7 +465,7 @@ static void ieee802_11_rx_bss_trans_mgmt
@@ -517,7 +518,7 @@ static void ieee802_11_rx_bss_trans_mgmt
size_t len)
{
u8 dialog_token, status_code, bss_termination_delay;
@@ -613,7 +624,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wnm_ap.c
int enabled = hapd->conf->bss_transition;
struct sta_info *sta;
@@ -511,6 +512,7 @@ static void ieee802_11_rx_bss_trans_mgmt
@@ -564,6 +565,7 @@ static void ieee802_11_rx_bss_trans_mgmt
wpa_printf(MSG_DEBUG, "WNM: not enough room for Target BSSID field");
return;
}
@@ -621,7 +632,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wnm_ap.c
sta->agreed_to_steer = 1;
eloop_cancel_timeout(ap_sta_reset_steer_flag_timer, hapd, sta);
eloop_register_timeout(2, 0, ap_sta_reset_steer_flag_timer,
@@ -530,6 +532,10 @@ static void ieee802_11_rx_bss_trans_mgmt
@@ -583,6 +585,10 @@ static void ieee802_11_rx_bss_trans_mgmt
MAC2STR(addr), status_code, bss_termination_delay);
}
@@ -632,10 +643,10 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wnm_ap.c
wpa_hexdump(MSG_DEBUG, "WNM: BSS Transition Candidate List Entries",
pos, end - pos);
}
Index: hostapd-2021-02-20-59e9794c/src/utils/eloop.c
Index: hostapd-2023-02-21-ath12.3-cs/src/utils/eloop.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/utils/eloop.c
+++ hostapd-2021-02-20-59e9794c/src/utils/eloop.c
--- hostapd-2023-02-21-ath12.3-cs.orig/src/utils/eloop.c
+++ hostapd-2023-02-21-ath12.3-cs/src/utils/eloop.c
@@ -77,6 +77,9 @@ struct eloop_sock_table {
struct eloop_data {
int max_sock;
@@ -646,7 +657,7 @@ Index: hostapd-2021-02-20-59e9794c/src/utils/eloop.c
size_t count; /* sum of all table counts */
#ifdef CONFIG_ELOOP_POLL
size_t max_pollfd_map; /* number of pollfds_map currently allocated */
@@ -1116,6 +1119,12 @@ void eloop_run(void)
@@ -1121,6 +1124,12 @@ void eloop_run(void)
os_reltime_sub(&timeout->time, &now, &tv);
else
tv.sec = tv.usec = 0;
@@ -659,7 +670,7 @@ Index: hostapd-2021-02-20-59e9794c/src/utils/eloop.c
#if defined(CONFIG_ELOOP_POLL) || defined(CONFIG_ELOOP_EPOLL)
timeout_ms = tv.sec * 1000 + tv.usec / 1000;
#endif /* defined(CONFIG_ELOOP_POLL) || defined(CONFIG_ELOOP_EPOLL) */
@@ -1185,7 +1194,8 @@ void eloop_run(void)
@@ -1190,7 +1199,8 @@ void eloop_run(void)
eloop.exceptions.changed = 0;
eloop_process_pending_signals();
@@ -669,7 +680,7 @@ Index: hostapd-2021-02-20-59e9794c/src/utils/eloop.c
/* check if some registered timeouts have occurred */
timeout = dl_list_first(&eloop.timeout, struct eloop_timeout,
@@ -1247,6 +1257,14 @@ out:
@@ -1252,6 +1262,14 @@ out:
return;
}
@@ -684,10 +695,10 @@ Index: hostapd-2021-02-20-59e9794c/src/utils/eloop.c
void eloop_terminate(void)
{
Index: hostapd-2021-02-20-59e9794c/src/utils/eloop.h
Index: hostapd-2023-02-21-ath12.3-cs/src/utils/eloop.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/utils/eloop.h
+++ hostapd-2021-02-20-59e9794c/src/utils/eloop.h
--- hostapd-2023-02-21-ath12.3-cs.orig/src/utils/eloop.h
+++ hostapd-2023-02-21-ath12.3-cs/src/utils/eloop.h
@@ -65,6 +65,9 @@ typedef void (*eloop_timeout_handler)(vo
*/
typedef void (*eloop_signal_handler)(int sig, void *signal_ctx);
@@ -717,10 +728,10 @@ Index: hostapd-2021-02-20-59e9794c/src/utils/eloop.h
/**
* eloop_run - Start the event loop
*
Index: hostapd-2021-02-20-59e9794c/src/utils/uloop.c
Index: hostapd-2023-02-21-ath12.3-cs/src/utils/uloop.c
===================================================================
--- /dev/null
+++ hostapd-2021-02-20-59e9794c/src/utils/uloop.c
+++ hostapd-2023-02-21-ath12.3-cs/src/utils/uloop.c
@@ -0,0 +1,64 @@
+#include <libubox/uloop.h>
+#include "includes.h"

View File

@@ -1,7 +1,7 @@
Index: hostapd-2021-12-13-b26f5c0f/hostapd/Makefile
Index: hostapd-2023-02-21-ath12.3-cs/hostapd/Makefile
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/hostapd/Makefile
+++ hostapd-2021-12-13-b26f5c0f/hostapd/Makefile
--- hostapd-2023-02-21-ath12.3-cs.orig/hostapd/Makefile
+++ hostapd-2023-02-21-ath12.3-cs/hostapd/Makefile
@@ -168,9 +168,21 @@ OBJS += ../src/eapol_auth/eapol_auth_sm.
ifdef CONFIG_UBUS
@@ -26,11 +26,11 @@ Index: hostapd-2021-12-13-b26f5c0f/hostapd/Makefile
endif
ifdef CONFIG_CODE_COVERAGE
Index: hostapd-2021-12-13-b26f5c0f/hostapd/main.c
Index: hostapd-2023-02-21-ath12.3-cs/hostapd/main.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/hostapd/main.c
+++ hostapd-2021-12-13-b26f5c0f/hostapd/main.c
@@ -898,6 +898,7 @@ int main(int argc, char *argv[])
--- hostapd-2023-02-21-ath12.3-cs.orig/hostapd/main.c
+++ hostapd-2023-02-21-ath12.3-cs/hostapd/main.c
@@ -985,6 +985,7 @@ int main(int argc, char *argv[])
}
hostapd_global_ctrl_iface_init(&interfaces);
@@ -38,19 +38,19 @@ Index: hostapd-2021-12-13-b26f5c0f/hostapd/main.c
if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
wpa_printf(MSG_ERROR, "Failed to start eloop");
@@ -907,6 +908,7 @@ int main(int argc, char *argv[])
@@ -994,6 +995,7 @@ int main(int argc, char *argv[])
ret = 0;
out:
+ hostapd_ucode_free();
hostapd_global_ctrl_iface_deinit(&interfaces);
/* Deinitialize all interfaces */
for (i = 0; i < interfaces.count; i++) {
Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.h
/* Sending deauth to all stations before deinit */
hostapd_deauthenticate_stations(&interfaces);
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.h
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/src/ap/hostapd.h
+++ hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.h
@@ -18,6 +18,7 @@
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/hostapd.h
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.h
@@ -19,6 +19,7 @@
#include "ap_config.h"
#include "drivers/driver.h"
#include "ubus.h"
@@ -58,7 +58,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.h
#define OCE_STA_CFON_ENABLED(hapd) \
((hapd->conf->oce & OCE_STA_CFON) && \
@@ -50,6 +51,10 @@ struct hapd_interfaces {
@@ -56,6 +57,10 @@ struct hapd_interfaces {
struct hostapd_config * (*config_read_cb)(const char *config_fname);
int (*ctrl_iface_init)(struct hostapd_data *hapd);
void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
@@ -69,7 +69,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.h
int (*for_each_interface)(struct hapd_interfaces *interfaces,
int (*cb)(struct hostapd_iface *iface,
void *ctx), void *ctx);
@@ -173,6 +178,7 @@ struct hostapd_data {
@@ -205,6 +210,7 @@ struct hostapd_data {
struct hostapd_config *iconf;
struct hostapd_bss_config *conf;
struct hostapd_ubus_bss ubus;
@@ -77,7 +77,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.h
int interface_added; /* virtual interface added for this BSS */
unsigned int started:1;
unsigned int disabled:1;
@@ -467,6 +473,7 @@ struct hostapd_sta_info {
@@ -540,6 +546,7 @@ struct hostapd_mld {
*/
struct hostapd_iface {
struct hapd_interfaces *interfaces;
@@ -85,7 +85,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.h
void *owner;
char *config_fname;
struct hostapd_config *conf;
@@ -641,6 +648,8 @@ struct hostapd_iface * hostapd_init(stru
@@ -752,6 +759,8 @@ struct hostapd_iface * hostapd_init(stru
struct hostapd_iface *
hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
const char *config_fname, int debug);
@@ -94,11 +94,11 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.h
void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
int reassoc);
void hostapd_interface_deinit_free(struct hostapd_iface *iface);
Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.c
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/src/ap/hostapd.c
+++ hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.c
@@ -217,6 +217,8 @@ int hostapd_reload_config(struct hostapd
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/hostapd.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.c
@@ -285,6 +285,8 @@ int hostapd_reload_config(struct hostapd
struct hostapd_config *newconf, *oldconf;
size_t j;
@@ -107,7 +107,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.c
if (iface->config_fname == NULL) {
/* Only in-memory config in use - assume it has been updated */
hostapd_clear_old(iface);
@@ -377,6 +379,7 @@ void hostapd_free_hapd_data(struct hosta
@@ -471,6 +473,7 @@ void hostapd_free_hapd_data(struct hosta
hapd->beacon_set_done = 0;
wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
@@ -115,24 +115,15 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.c
hostapd_ubus_free_bss(hapd);
accounting_deinit(hapd);
hostapd_deinit_wpa(hapd);
@@ -534,6 +537,7 @@ void hostapd_cleanup_iface_partial(struc
@@ -637,6 +640,7 @@ void hostapd_cleanup_iface_partial(struc
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
{
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
+ hostapd_ucode_free_iface(iface);
eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
NULL);
@@ -1108,7 +1112,7 @@ static int db_table_create_radius_attrib
* initialized. Most of the modules that are initialized here will be
* deinitialized in hostapd_cleanup().
*/
-static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
+int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool set_beacon)
{
struct hostapd_bss_config *conf = hapd->conf;
u8 ssid[SSID_MAX_LEN + 1];
@@ -1405,6 +1409,7 @@ static int hostapd_setup_bss(struct host
@@ -1226,6 +1230,7 @@ static int hostapd_start_beacon(struct h
hapd->driver->set_operstate(hapd->drv_priv, 1);
hostapd_ubus_add_bss(hapd);
@@ -140,16 +131,17 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.c
return 0;
}
@@ -2116,7 +2121,7 @@ static int hostapd_setup_interface_compl
hapd = iface->bss[j];
if (j)
os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN);
- if (hostapd_setup_bss(hapd, j == 0)) {
+ if (hostapd_setup_bss(hapd, j == 0, true)) {
for (;;) {
hapd = iface->bss[j];
hostapd_bss_deinit_no_free(hapd);
@@ -2396,7 +2401,7 @@ hostapd_alloc_bss_data(struct hostapd_if
@@ -1248,8 +1253,7 @@ static int hostapd_start_beacon(struct h
* initialized. Most of the modules that are initialized here will be
* deinitialized in hostapd_cleanup().
*/
-static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
- bool start_beacon)
+int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
{
struct hostapd_bss_config *conf = hapd->conf;
u8 ssid[SSID_MAX_LEN + 1];
@@ -2919,7 +2923,7 @@ hostapd_alloc_bss_data(struct hostapd_if
}
@@ -158,16 +150,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.c
{
if (!hapd)
return;
@@ -3013,7 +3018,7 @@ int hostapd_add_iface(struct hapd_interf
if (start_ctrl_iface_bss(hapd) < 0 ||
(hapd_iface->state == HAPD_IFACE_ENABLED &&
- hostapd_setup_bss(hapd, -1))) {
+ hostapd_setup_bss(hapd, -1, true))) {
hostapd_cleanup(hapd);
hapd_iface->bss[hapd_iface->num_bss - 1] = NULL;
hapd_iface->conf->num_bss--;
@@ -3165,7 +3170,8 @@ int hostapd_remove_iface(struct hapd_int
@@ -4086,7 +4090,8 @@ int hostapd_remove_iface(struct hapd_int
hapd_iface = interfaces->iface[i];
if (hapd_iface == NULL)
return -1;
@@ -177,11 +160,11 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.c
wpa_printf(MSG_INFO, "Remove interface '%s'", buf);
hapd_iface->driver_ap_teardown =
!!(hapd_iface->drv_flags &
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/Makefile
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/Makefile
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/Makefile
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/Makefile
@@ -177,8 +177,20 @@ endif
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/Makefile
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/Makefile
@@ -195,8 +195,20 @@ endif
ifdef CONFIG_UBUS
CFLAGS += -DUBUS_SUPPORT
OBJS += ubus.o
@@ -203,7 +186,7 @@ Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/Makefile
endif
ifdef CONFIG_CODE_COVERAGE
@@ -969,6 +981,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o
@@ -1001,6 +1013,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o
ifdef CONFIG_UBUS
OBJS += ../src/ap/ubus.o
endif
@@ -213,11 +196,11 @@ Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/Makefile
endif
CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wpa_supplicant.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
@@ -1033,6 +1033,7 @@ void wpa_supplicant_set_state(struct wpa
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wpa_supplicant.c
@@ -1044,6 +1044,7 @@ void wpa_supplicant_set_state(struct wpa
sme_sched_obss_scan(wpa_s, 0);
}
wpa_s->wpa_state = state;
@@ -225,7 +208,7 @@ Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
#ifdef CONFIG_BGSCAN
if (state == WPA_COMPLETED && wpa_s->current_ssid != wpa_s->bgscan_ssid)
@@ -7155,6 +7156,7 @@ struct wpa_supplicant * wpa_supplicant_a
@@ -7641,6 +7642,7 @@ struct wpa_supplicant * wpa_supplicant_a
#endif /* CONFIG_P2P */
wpas_ubus_add_bss(wpa_s);
@@ -233,7 +216,7 @@ Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
return wpa_s;
}
@@ -7182,6 +7184,7 @@ int wpa_supplicant_remove_iface(struct w
@@ -7668,6 +7670,7 @@ int wpa_supplicant_remove_iface(struct w
struct wpa_supplicant *parent = wpa_s->parent;
#endif /* CONFIG_MESH */
@@ -241,7 +224,7 @@ Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
wpas_ubus_free_bss(wpa_s);
/* Remove interface from the global list of interfaces */
@@ -7449,6 +7452,7 @@ struct wpa_global * wpa_supplicant_init(
@@ -7978,6 +7981,7 @@ struct wpa_global * wpa_supplicant_init(
eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0,
wpas_periodic, global, NULL);
@@ -249,7 +232,7 @@ Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
return global;
}
@@ -7487,12 +7491,8 @@ int wpa_supplicant_run(struct wpa_global
@@ -8016,12 +8020,8 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
@@ -262,7 +245,7 @@ Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
return 0;
}
@@ -7525,6 +7525,8 @@ void wpa_supplicant_deinit(struct wpa_gl
@@ -8054,6 +8054,8 @@ void wpa_supplicant_deinit(struct wpa_gl
wpas_notify_supplicant_deinitialized(global);
@@ -271,19 +254,19 @@ Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
eap_peer_unregister_methods();
#ifdef CONFIG_AP
eap_server_unregister_methods();
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant_i.h
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wpa_supplicant_i.h
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/wpa_supplicant_i.h
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant_i.h
@@ -20,6 +20,7 @@
#include "config_ssid.h"
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/wpa_supplicant_i.h
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/wpa_supplicant_i.h
@@ -22,6 +22,7 @@
#include "wmm_ac.h"
#include "pasn/pasn_common.h"
#include "ubus.h"
+#include "ucode.h"
extern const char *const wpa_supplicant_version;
extern const char *const wpa_supplicant_license;
@@ -707,6 +708,7 @@ struct wpa_supplicant {
@@ -654,6 +655,7 @@ struct wpa_supplicant {
unsigned char perm_addr[ETH_ALEN];
char ifname[100];
struct wpas_ubus_bss ubus;
@@ -291,11 +274,11 @@ Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant_i.h
#ifdef CONFIG_MATCH_IFACE
int matched;
#endif /* CONFIG_MATCH_IFACE */
Index: hostapd-2021-12-13-b26f5c0f/hostapd/ctrl_iface.c
Index: hostapd-2023-02-21-ath12.3-cs/hostapd/ctrl_iface.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/hostapd/ctrl_iface.c
+++ hostapd-2021-12-13-b26f5c0f/hostapd/ctrl_iface.c
@@ -5023,6 +5023,7 @@ try_again:
--- hostapd-2023-02-21-ath12.3-cs.orig/hostapd/ctrl_iface.c
+++ hostapd-2023-02-21-ath12.3-cs/hostapd/ctrl_iface.c
@@ -5369,6 +5369,7 @@ try_again:
return -1;
}
@@ -303,7 +286,7 @@ Index: hostapd-2021-12-13-b26f5c0f/hostapd/ctrl_iface.c
wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
return 0;
@@ -5124,6 +5125,7 @@ fail:
@@ -5470,6 +5471,7 @@ fail:
os_free(fname);
interface->global_ctrl_sock = s;
@@ -311,11 +294,11 @@ Index: hostapd-2021-12-13-b26f5c0f/hostapd/ctrl_iface.c
eloop_register_read_sock(s, hostapd_global_ctrl_iface_receive,
interface, NULL);
Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver.h
Index: hostapd-2023-02-21-ath12.3-cs/src/drivers/driver.h
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/src/drivers/driver.h
+++ hostapd-2021-12-13-b26f5c0f/src/drivers/driver.h
@@ -3366,6 +3366,25 @@ struct wpa_driver_ops {
--- hostapd-2023-02-21-ath12.3-cs.orig/src/drivers/driver.h
+++ hostapd-2023-02-21-ath12.3-cs/src/drivers/driver.h
@@ -3899,6 +3899,25 @@ struct wpa_driver_ops {
const char *ifname);
/**
@@ -341,7 +324,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver.h
* set_sta_vlan - Bind a station into a specific interface (AP only)
* @priv: Private driver interface data
* @ifname: Interface (main or virtual BSS or VLAN)
@@ -5842,6 +5861,7 @@ union wpa_event_data {
@@ -6525,6 +6544,7 @@ union wpa_event_data {
/**
* struct ch_switch
@@ -349,56 +332,58 @@ Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver.h
* @freq: Frequency of new channel in MHz
* @ht_enabled: Whether this is an HT channel
* @ch_offset: Secondary channel offset
@@ -5850,6 +5870,7 @@ union wpa_event_data {
* @cf2: Center frequency 2
@@ -6534,6 +6554,7 @@ union wpa_event_data {
* @link_id: Link ID of the MLO link
*/
struct ch_switch {
+ int count;
int freq;
int ht_enabled;
int ch_offset;
Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver_nl80211_event.c
Index: hostapd-2023-02-21-ath12.3-cs/src/drivers/driver_nl80211_event.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/src/drivers/driver_nl80211_event.c
+++ hostapd-2021-12-13-b26f5c0f/src/drivers/driver_nl80211_event.c
@@ -684,6 +684,7 @@ static void mlme_event_ch_switch(struct
struct nlattr *ifindex, struct nlattr *freq,
struct nlattr *type, struct nlattr *bw,
struct nlattr *cf1, struct nlattr *cf2,
--- hostapd-2023-02-21-ath12.3-cs.orig/src/drivers/driver_nl80211_event.c
+++ hostapd-2023-02-21-ath12.3-cs/src/drivers/driver_nl80211_event.c
@@ -1002,6 +1002,7 @@ static void mlme_event_ch_switch(struct
struct nlattr *cf2,
struct nlattr *ru_punct_bitmap,
struct nlattr *ru_punct_ofdma,
+ struct nlattr *count,
int finished)
{
struct i802_bss *bss;
@@ -745,6 +746,8 @@ static void mlme_event_ch_switch(struct
data.ch_switch.cf1 = nla_get_u32(cf1);
if (cf2)
data.ch_switch.cf2 = nla_get_u32(cf2);
@@ -1092,7 +1093,9 @@ static void mlme_event_ch_switch(struct
if (ru_punct_ofdma)
data.ch_switch.ru_punct_ofdma = nla_get_flag(ru_punct_ofdma);
}
-
+ if (count)
+ data.ch_switch.count = nla_get_u32(count);
+
if (finished)
bss->freq = data.ch_switch.freq;
@@ -3003,6 +3006,7 @@ static void do_process_drv_event(struct
tb[NL80211_ATTR_CHANNEL_WIDTH],
tb[NL80211_ATTR_CENTER_FREQ1],
@@ -3833,6 +3836,7 @@ static void do_process_drv_event(struct
tb[NL80211_ATTR_CENTER_FREQ2],
tb[NL80211_ATTR_RU_PUNCT_BITMAP],
tb[NL80211_ATTR_RU_PUNCT_SUPP_HE],
+ tb[NL80211_ATTR_CH_SWITCH_COUNT],
0);
break;
case NL80211_CMD_CH_SWITCH_NOTIFY:
@@ -3013,6 +3017,7 @@ static void do_process_drv_event(struct
tb[NL80211_ATTR_CHANNEL_WIDTH],
tb[NL80211_ATTR_CENTER_FREQ1],
@@ -3846,6 +3850,7 @@ static void do_process_drv_event(struct
tb[NL80211_ATTR_CENTER_FREQ2],
+ NULL,
tb[NL80211_ATTR_RU_PUNCT_BITMAP],
tb[NL80211_ATTR_RU_PUNCT_SUPP_HE],
+ NULL,
1);
break;
case NL80211_CMD_DISCONNECT:
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/events.c
Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/events.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/events.c
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/events.c
@@ -4927,6 +4927,7 @@ void supplicant_event(void *ctx, enum wp
--- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/events.c
+++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/events.c
@@ -5294,6 +5294,7 @@ void supplicant_event(void *ctx, enum wp
event_to_string(event), event);
#endif /* CONFIG_NO_STDOUT_DEBUG */
@@ -406,11 +391,11 @@ Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/events.c
switch (event) {
case EVENT_AUTH:
#ifdef CONFIG_FST
Index: hostapd-2021-12-13-b26f5c0f/src/ap/ap_drv_ops.h
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/ap_drv_ops.h
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/src/ap/ap_drv_ops.h
+++ hostapd-2021-12-13-b26f5c0f/src/ap/ap_drv_ops.h
@@ -367,6 +367,23 @@ static inline int hostapd_drv_stop_ap(st
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/ap_drv_ops.h
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/ap_drv_ops.h
@@ -415,6 +415,23 @@ static inline int hostapd_drv_stop_ap(st
return hapd->driver->stop_ap(hapd->drv_priv);
}
@@ -434,11 +419,11 @@ Index: hostapd-2021-12-13-b26f5c0f/src/ap/ap_drv_ops.h
static inline int hostapd_drv_channel_info(struct hostapd_data *hapd,
struct wpa_channel_info *ci)
{
Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver_nl80211.c
Index: hostapd-2023-02-21-ath12.3-cs/src/drivers/driver_nl80211.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/src/drivers/driver_nl80211.c
+++ hostapd-2021-12-13-b26f5c0f/src/drivers/driver_nl80211.c
@@ -1249,7 +1249,7 @@ static void wpa_driver_nl80211_event_rtm
--- hostapd-2023-02-21-ath12.3-cs.orig/src/drivers/driver_nl80211.c
+++ hostapd-2023-02-21-ath12.3-cs/src/drivers/driver_nl80211.c
@@ -1370,7 +1370,7 @@ static void wpa_driver_nl80211_event_rtm
}
wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)",
namebuf, ifname);
@@ -447,7 +432,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver_nl80211.c
wpa_printf(MSG_DEBUG,
"nl80211: Not the main interface (%s) - do not indicate interface down",
drv->first_bss->ifname);
@@ -1285,7 +1285,7 @@ static void wpa_driver_nl80211_event_rtm
@@ -1406,7 +1406,7 @@ static void wpa_driver_nl80211_event_rtm
}
wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)",
namebuf, ifname);
@@ -456,15 +441,15 @@ Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver_nl80211.c
wpa_printf(MSG_DEBUG,
"nl80211: Not the main interface (%s) - do not indicate interface up",
drv->first_bss->ifname);
@@ -7691,6 +7691,7 @@ static void *i802_init(struct hostapd_da
char master_ifname[IFNAMSIZ];
@@ -8706,6 +8706,7 @@ static void *i802_init(struct hostapd_da
int ifindex, br_ifindex = 0;
int br_added = 0;
const u8 *set_addr;
+ int err;
bss = wpa_driver_nl80211_drv_init(hapd, params->ifname,
params->global_priv, 1,
@@ -7751,21 +7752,17 @@ static void *i802_init(struct hostapd_da
if (params->mld_addr)
set_addr = params->mld_addr;
@@ -8789,21 +8790,17 @@ static void *i802_init(struct hostapd_da
add_ifidx(drv, br_ifindex, drv->ifindex);
#ifdef CONFIG_LIBNL3_ROUTE
@@ -496,7 +481,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver_nl80211.c
}
#endif /* CONFIG_LIBNL3_ROUTE */
@@ -8125,6 +8122,50 @@ static int wpa_driver_nl80211_if_remove(
@@ -9218,6 +9215,50 @@ static int wpa_driver_nl80211_if_remove(
return 0;
}
@@ -547,7 +532,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver_nl80211.c
static int cookie_handler(struct nl_msg *msg, void *arg)
{
@@ -9479,6 +9520,37 @@ static int driver_nl80211_if_remove(void
@@ -10784,6 +10825,37 @@ static int driver_nl80211_if_remove(void
}
@@ -585,7 +570,7 @@ Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver_nl80211.c
static int driver_nl80211_send_mlme(void *priv, const u8 *data,
size_t data_len, int noack,
unsigned int freq,
@@ -12183,6 +12255,8 @@ const struct wpa_driver_ops wpa_driver_n
@@ -13925,6 +13997,8 @@ const struct wpa_driver_ops wpa_driver_n
.set_acl = wpa_driver_nl80211_set_acl,
.if_add = wpa_driver_nl80211_if_add,
.if_remove = driver_nl80211_if_remove,

View File

@@ -0,0 +1,33 @@
--- a/src/common/wpa_ctrl.c
+++ b/src/common/wpa_ctrl.c
@@ -135,7 +135,7 @@ try_again:
return NULL;
}
tries++;
-#ifdef ANDROID
+
/* Set client socket file permissions so that bind() creates the client
* socket with these permissions and there is no need to try to change
* them with chmod() after bind() which would have potential issues with
@@ -147,7 +147,7 @@ try_again:
* operations to allow the response to go through. Those are using the
* no-deference-symlinks version to avoid races. */
fchmod(ctrl->s, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
-#endif /* ANDROID */
+
if (bind(ctrl->s, (struct sockaddr *) &ctrl->local,
sizeof(ctrl->local)) < 0) {
if (errno == EADDRINUSE && tries < 2) {
@@ -165,7 +165,11 @@ try_again:
return NULL;
}
-#ifdef ANDROID
+#ifndef ANDROID
+ /* Set group even if we do not have privileges to change owner */
+ lchown(ctrl->local.sun_path, -1, 101);
+ lchown(ctrl->local.sun_path, 101, 101);
+#else
/* Set group even if we do not have privileges to change owner */
lchown(ctrl->local.sun_path, -1, AID_WIFI);
lchown(ctrl->local.sun_path, AID_SYSTEM, AID_WIFI);

View File

@@ -1,6 +1,6 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4699,7 +4699,12 @@ struct hostapd_config * hostapd_config_r
@@ -4816,7 +4816,12 @@ struct hostapd_config * hostapd_config_r
int errors = 0;
size_t i;
@@ -16,7 +16,7 @@
"for reading.", fname);
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -318,8 +318,13 @@ struct wpa_config * wpa_config_read(cons
@@ -326,8 +326,13 @@ struct wpa_config * wpa_config_read(cons
while (cred_tail && cred_tail->next)
cred_tail = cred_tail->next;

View File

@@ -1,6 +1,6 @@
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -115,6 +115,7 @@ struct hostapd_ssid {
@@ -121,6 +121,7 @@ struct hostapd_ssid {
#define DYNAMIC_VLAN_OPTIONAL 1
#define DYNAMIC_VLAN_REQUIRED 2
int dynamic_vlan;
@@ -30,7 +30,7 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3342,6 +3342,8 @@ static int hostapd_config_fill(struct ho
@@ -3351,6 +3351,8 @@ static int hostapd_config_fill(struct ho
#ifndef CONFIG_NO_VLAN
} else if (os_strcmp(buf, "dynamic_vlan") == 0) {
bss->ssid.dynamic_vlan = atoi(pos);

View File

@@ -1,6 +1,8 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2341,6 +2341,8 @@ static int hostapd_config_fill(struct ho
Index: hostapd-2023-02-21-a9012070/hostapd/config_file.c
===================================================================
--- hostapd-2023-02-21-a9012070.orig/hostapd/config_file.c
+++ hostapd-2023-02-21-a9012070/hostapd/config_file.c
@@ -2316,6 +2316,8 @@ static int hostapd_config_fill(struct ho
sizeof(conf->bss[0]->iface));
} else if (os_strcmp(buf, "bridge") == 0) {
os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
@@ -9,9 +11,11 @@
} else if (os_strcmp(buf, "vlan_bridge") == 0) {
os_strlcpy(bss->vlan_bridge, pos, sizeof(bss->vlan_bridge));
} else if (os_strcmp(buf, "wds_bridge") == 0) {
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -340,8 +340,6 @@ int hostapd_set_wds_sta(struct hostapd_d
Index: hostapd-2023-02-21-a9012070/src/ap/ap_drv_ops.c
===================================================================
--- hostapd-2023-02-21-a9012070.orig/src/ap/ap_drv_ops.c
+++ hostapd-2023-02-21-a9012070/src/ap/ap_drv_ops.c
@@ -348,8 +348,6 @@ int hostapd_set_wds_sta(struct hostapd_d
return -1;
if (hapd->conf->wds_bridge[0])
bridge = hapd->conf->wds_bridge;

View File

@@ -1,6 +1,8 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2853,6 +2853,14 @@ static int hostapd_config_fill(struct ho
Index: hostapd-2023-02-21-ath12.3-cs/hostapd/config_file.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/hostapd/config_file.c
+++ hostapd-2023-02-21-ath12.3-cs/hostapd/config_file.c
@@ -2778,6 +2778,14 @@ static int hostapd_config_fill(struct ho
line, bss->max_num_sta, MAX_STA_COUNT);
return 1;
}
@@ -15,22 +17,26 @@
} else if (os_strcmp(buf, "wpa") == 0) {
bss->wpa = atoi(pos);
} else if (os_strcmp(buf, "extended_key_id") == 0) {
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -672,6 +672,7 @@ void hostapd_cleanup_cs_params(struct ho
void hostapd_periodic_iface(struct hostapd_iface *iface);
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.h
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/hostapd.h
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.h
@@ -790,6 +790,7 @@ void hostapd_periodic_iface(struct hosta
int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
void free_beacon_data(struct beacon_data *beacon);
+int hostapd_check_max_sta(struct hostapd_data *hapd);
/* utils.c */
int hostapd_register_probereq_cb(struct hostapd_data *hapd,
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -209,6 +209,30 @@ static int hostapd_iface_conf_changed(st
void hostapd_switch_color(struct hostapd_data *hapd, u64 bitmap);
void hostapd_cleanup_cca_params(struct hostapd_data *hapd);
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/hostapd.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/hostapd.c
@@ -277,6 +277,29 @@ static int hostapd_iface_conf_changed(st
return 0;
}
+static inline int hostapd_iface_num_sta(struct hostapd_iface *iface)
+{
+ int num_sta = 0;
@@ -54,13 +60,14 @@
+
+ return 0;
+}
+
int hostapd_reload_config(struct hostapd_iface *iface)
{
struct hapd_interfaces *interfaces = iface->interfaces;
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1039,7 +1039,7 @@ void handle_probe_req(struct hostapd_dat
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/beacon.c
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/beacon.c
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/beacon.c
@@ -1642,7 +1642,7 @@ void handle_probe_req(struct hostapd_dat
if (hapd->conf->no_probe_resp_if_max_sta &&
is_multicast_ether_addr(mgmt->da) &&
is_multicast_ether_addr(mgmt->bssid) &&
@@ -69,9 +76,11 @@
!ap_get_sta(hapd, mgmt->sa)) {
wpa_printf(MSG_MSGDUMP, "%s: Ignore Probe Request from " MACSTR
" since no room for additional STA",
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -959,6 +959,8 @@ struct hostapd_config {
Index: hostapd-2023-02-21-ath12.3-cs/src/ap/ap_config.h
===================================================================
--- hostapd-2023-02-21-ath12.3-cs.orig/src/ap/ap_config.h
+++ hostapd-2023-02-21-ath12.3-cs/src/ap/ap_config.h
@@ -1044,6 +1044,8 @@ struct hostapd_config {
unsigned int track_sta_max_num;
unsigned int track_sta_max_age;

View File

@@ -1,6 +1,6 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3011,6 +3011,8 @@ static int hostapd_config_fill(struct ho
@@ -3007,6 +3007,8 @@ static int hostapd_config_fill(struct ho
wpa_printf(MSG_INFO,
"Line %d: Obsolete peerkey parameter ignored", line);
#ifdef CONFIG_IEEE80211R_AP
@@ -11,17 +11,17 @@
hexstr2bin(pos, bss->mobility_domain,
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -275,6 +275,7 @@ struct airtime_sta_weight {
@@ -283,6 +283,7 @@ struct airtime_sta_weight {
struct hostapd_bss_config {
char iface[IFNAMSIZ + 1];
char bridge[IFNAMSIZ + 1];
+ char ft_iface[IFNAMSIZ + 1];
char vlan_bridge[IFNAMSIZ + 1];
char wds_bridge[IFNAMSIZ + 1];
int bridge_hairpin; /* hairpin_mode on bridge members */
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -1565,8 +1565,12 @@ int hostapd_setup_wpa(struct hostapd_dat
@@ -1727,8 +1727,12 @@ int hostapd_setup_wpa(struct hostapd_dat
wpa_key_mgmt_ft(hapd->conf->wpa_key_mgmt)) {
const char *ft_iface;

View File

@@ -1,6 +1,8 @@
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -276,6 +276,7 @@ struct hostapd_bss_config {
Index: hostapd-2023-02-21-a9012070/src/ap/ap_config.h
===================================================================
--- hostapd-2023-02-21-a9012070.orig/src/ap/ap_config.h
+++ hostapd-2023-02-21-a9012070/src/ap/ap_config.h
@@ -284,6 +284,7 @@ struct hostapd_bss_config {
char iface[IFNAMSIZ + 1];
char bridge[IFNAMSIZ + 1];
char ft_iface[IFNAMSIZ + 1];
@@ -8,11 +10,13 @@
char vlan_bridge[IFNAMSIZ + 1];
char wds_bridge[IFNAMSIZ + 1];
--- a/src/ap/x_snoop.c
+++ b/src/ap/x_snoop.c
@@ -31,28 +31,31 @@ int x_snoop_init(struct hostapd_data *ha
return -1;
}
Index: hostapd-2023-02-21-a9012070/src/ap/x_snoop.c
===================================================================
--- hostapd-2023-02-21-a9012070.orig/src/ap/x_snoop.c
+++ hostapd-2023-02-21-a9012070/src/ap/x_snoop.c
@@ -33,28 +33,31 @@ int x_snoop_init(struct hostapd_data *ha
hapd->x_snoop_initialized = true;
- if (hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE,
+ if (!conf->snoop_iface[0] &&
@@ -46,7 +50,7 @@
wpa_printf(MSG_DEBUG,
"x_snoop: Failed to enable multicast snooping on the bridge");
return -1;
@@ -71,8 +74,12 @@ x_snoop_get_l2_packet(struct hostapd_dat
@@ -73,8 +76,12 @@ x_snoop_get_l2_packet(struct hostapd_dat
{
struct hostapd_bss_config *conf = hapd->conf;
struct l2_packet_data *l2;
@@ -60,32 +64,38 @@
if (l2 == NULL) {
wpa_printf(MSG_DEBUG,
"x_snoop: Failed to initialize L2 packet processing %s",
@@ -125,7 +132,10 @@ void x_snoop_mcast_to_ucast_convert_send
@@ -127,9 +134,12 @@ void x_snoop_mcast_to_ucast_convert_send
void x_snoop_deinit(struct hostapd_data *hapd)
{
- hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT, 0);
+ struct hostapd_bss_config *conf = hapd->conf;
+
if (!hapd->x_snoop_initialized)
return;
- hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT, 0);
+ hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT,
+ conf->snoop_iface[0] ? conf->snoop_iface : NULL, 0);
hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_PROXYARP, 0);
hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE, 0);
}
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2343,6 +2343,8 @@ static int hostapd_config_fill(struct ho
os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
if (!bss->wds_bridge[0])
hapd->x_snoop_initialized = false;
Index: hostapd-2023-02-21-a9012070/hostapd/config_file.c
===================================================================
--- hostapd-2023-02-21-a9012070.orig/hostapd/config_file.c
+++ hostapd-2023-02-21-a9012070/hostapd/config_file.c
@@ -2320,6 +2320,8 @@ static int hostapd_config_fill(struct ho
os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge));
+ } else if (os_strcmp(buf, "snoop_iface") == 0) {
+ os_strlcpy(bss->snoop_iface, pos, sizeof(bss->snoop_iface));
} else if (os_strcmp(buf, "vlan_bridge") == 0) {
os_strlcpy(bss->vlan_bridge, pos, sizeof(bss->vlan_bridge));
+ } else if (os_strcmp(buf, "snoop_iface") == 0) {
+ os_strlcpy(bss->snoop_iface, pos, sizeof(bss->snoop_iface));
} else if (os_strcmp(buf, "wds_bridge") == 0) {
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -340,12 +340,12 @@ static inline int hostapd_drv_br_port_se
os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge));
} else if (os_strcmp(buf, "driver") == 0) {
Index: hostapd-2023-02-21-a9012070/src/ap/ap_drv_ops.h
===================================================================
--- hostapd-2023-02-21-a9012070.orig/src/ap/ap_drv_ops.h
+++ hostapd-2023-02-21-a9012070/src/ap/ap_drv_ops.h
@@ -359,12 +359,12 @@ static inline int hostapd_drv_br_port_se
static inline int hostapd_drv_br_set_net_param(struct hostapd_data *hapd,
enum drv_br_net_param param,
@@ -100,9 +110,11 @@
}
static inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd,
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -3756,7 +3756,7 @@ struct wpa_driver_ops {
Index: hostapd-2023-02-21-a9012070/src/drivers/driver.h
===================================================================
--- hostapd-2023-02-21-a9012070.orig/src/drivers/driver.h
+++ hostapd-2023-02-21-a9012070/src/drivers/driver.h
@@ -4117,7 +4117,7 @@ struct wpa_driver_ops {
* Returns: 0 on success, negative (<0) on failure
*/
int (*br_set_net_param)(void *priv, enum drv_br_net_param param,
@@ -111,9 +123,11 @@
/**
* get_wowlan - Get wake-on-wireless status
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -10825,7 +10825,7 @@ static const char * drv_br_net_param_str
Index: hostapd-2023-02-21-a9012070/src/drivers/driver_nl80211.c
===================================================================
--- hostapd-2023-02-21-a9012070.orig/src/drivers/driver_nl80211.c
+++ hostapd-2023-02-21-a9012070/src/drivers/driver_nl80211.c
@@ -11732,7 +11732,7 @@ static const char * drv_br_net_param_str
static int wpa_driver_br_set_net_param(void *priv, enum drv_br_net_param param,
@@ -122,7 +136,7 @@
{
struct i802_bss *bss = priv;
char path[128];
@@ -10851,8 +10851,11 @@ static int wpa_driver_br_set_net_param(v
@@ -11758,8 +11758,11 @@ static int wpa_driver_br_set_net_param(v
return -EINVAL;
}

View File

@@ -0,0 +1,97 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1604,6 +1604,8 @@ static int parse_anqp_elem(struct hostap
return 0;
}
+#endif /* CONFIG_INTERWORKING */
+
static int parse_qos_map_set(struct hostapd_bss_config *bss,
char *buf, int line)
@@ -1645,8 +1647,6 @@ static int parse_qos_map_set(struct host
return 0;
}
-#endif /* CONFIG_INTERWORKING */
-
#ifdef CONFIG_HS20
static int hs20_parse_conn_capab(struct hostapd_bss_config *bss, char *buf,
@@ -4062,10 +4062,10 @@ static int hostapd_config_fill(struct ho
bss->gas_frag_limit = val;
} else if (os_strcmp(buf, "gas_comeback_delay") == 0) {
bss->gas_comeback_delay = atoi(pos);
+#endif /* CONFIG_INTERWORKING */
} else if (os_strcmp(buf, "qos_map_set") == 0) {
if (parse_qos_map_set(bss, pos, line) < 0)
return 1;
-#endif /* CONFIG_INTERWORKING */
#ifdef CONFIG_RADIUS_TEST
} else if (os_strcmp(buf, "dump_msk_file") == 0) {
os_free(bss->dump_msk_file);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1486,6 +1486,7 @@ int hostapd_setup_bss(struct hostapd_dat
wpa_printf(MSG_ERROR, "GAS server initialization failed");
return -1;
}
+#endif /* CONFIG_INTERWORKING */
if (conf->qos_map_set_len &&
hostapd_drv_set_qos_map(hapd, conf->qos_map_set,
@@ -1493,7 +1494,6 @@ int hostapd_setup_bss(struct hostapd_dat
wpa_printf(MSG_ERROR, "Failed to initialize QoS Map");
return -1;
}
-#endif /* CONFIG_INTERWORKING */
if (conf->bss_load_update_period && bss_load_update_init(hapd)) {
wpa_printf(MSG_ERROR, "BSS Load initialization failed");
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2683,8 +2683,6 @@ void wnm_bss_keep_alive_deinit(struct wp
}
-#ifdef CONFIG_INTERWORKING
-
static int wpas_qos_map_set(struct wpa_supplicant *wpa_s, const u8 *qos_map,
size_t len)
{
@@ -2717,8 +2715,6 @@ static void interworking_process_assoc_r
}
}
-#endif /* CONFIG_INTERWORKING */
-
static void wpa_supplicant_set_4addr_mode(struct wpa_supplicant *wpa_s)
{
@@ -3098,10 +3094,8 @@ static int wpa_supplicant_event_associnf
wnm_process_assoc_resp(wpa_s, data->assoc_info.resp_ies,
data->assoc_info.resp_ies_len);
#endif /* CONFIG_WNM */
-#ifdef CONFIG_INTERWORKING
interworking_process_assoc_resp(wpa_s, data->assoc_info.resp_ies,
data->assoc_info.resp_ies_len);
-#endif /* CONFIG_INTERWORKING */
if (wpa_s->hw_capab == CAPAB_VHT &&
get_ie(data->assoc_info.resp_ies,
data->assoc_info.resp_ies_len, WLAN_EID_VHT_CAP))
--- a/src/ap/ieee802_11_shared.c
+++ b/src/ap/ieee802_11_shared.c
@@ -1116,13 +1116,11 @@ u8 * hostapd_eid_rsnxe(struct hostapd_da
u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta,
const u8 *ext_capab_ie, size_t ext_capab_ie_len)
{
-#ifdef CONFIG_INTERWORKING
/* check for QoS Map support */
if (ext_capab_ie_len >= 5) {
if (ext_capab_ie[4] & 0x01)
sta->qos_map_enabled = 1;
}
-#endif /* CONFIG_INTERWORKING */
if (ext_capab_ie_len > 0) {
sta->ecsa_supported = !!(ext_capab_ie[0] & BIT(2));

View File

@@ -1,105 +0,0 @@
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -1904,6 +1904,25 @@ static int ieee802_1x_update_vlan(struct
}
#endif /* CONFIG_NO_VLAN */
+static int ieee802_1x_update_wispr(struct hostapd_data *hapd,
+ struct sta_info *sta,
+ struct radius_msg *msg)
+{
+ memset(sta->bandwidth, 0, sizeof(sta->bandwidth));
+
+ if (radius_msg_get_wispr(msg, &sta->bandwidth))
+ return 0;
+
+ if (!sta->bandwidth[0] && !sta->bandwidth[1])
+ return 0;
+
+ hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
+ HOSTAPD_LEVEL_INFO,
+ "received wispr bandwidth from RADIUS server %d/%d",
+ sta->bandwidth[0], sta->bandwidth[1]);
+
+ return 0;
+}
/**
* ieee802_1x_receive_auth - Process RADIUS frames from Authentication Server
@@ -2029,6 +2048,7 @@ ieee802_1x_receive_auth(struct radius_ms
ieee802_1x_check_hs20(hapd, sta, msg,
session_timeout_set ?
(int) session_timeout : -1);
+ ieee802_1x_update_wispr(hapd, sta, msg);
break;
case RADIUS_CODE_ACCESS_REJECT:
sm->eap_if->aaaFail = true;
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -116,6 +116,7 @@ struct sta_info {
u8 supported_rates[WLAN_SUPP_RATES_MAX];
int supported_rates_len;
u8 qosinfo; /* Valid when WLAN_STA_WMM is set */
+ u32 bandwidth[2];
#ifdef CONFIG_MESH
enum mesh_plink_state plink_state;
--- a/src/radius/radius.c
+++ b/src/radius/radius.c
@@ -1182,6 +1182,35 @@ radius_msg_get_cisco_keys(struct radius_
return keys;
}
+#define RADIUS_VENDOR_ID_WISPR 14122
+#define RADIUS_WISPR_AV_BW_UP 7
+#define RADIUS_WISPR_AV_BW_DOWN 8
+
+int
+radius_msg_get_wispr(struct radius_msg *msg, u32 *bandwidth)
+{
+ int i;
+
+ if (msg == NULL || bandwidth == NULL)
+ return 1;
+
+ for (i = 0; i < 2; i++) {
+ size_t keylen;
+ u8 *key;
+
+ key = radius_msg_get_vendor_attr(msg, RADIUS_VENDOR_ID_WISPR,
+ RADIUS_WISPR_AV_BW_UP + i, &keylen);
+ if (!key)
+ continue;
+
+ if (keylen == 4)
+ bandwidth[i] = ntohl(*((u32 *)key));
+ os_free(key);
+ }
+
+ return 0;
+}
+
int radius_msg_add_mppe_keys(struct radius_msg *msg,
const u8 *req_authenticator,
--- a/src/radius/radius.h
+++ b/src/radius/radius.h
@@ -205,6 +205,10 @@ enum {
RADIUS_VENDOR_ATTR_WFA_HS20_T_C_URL = 10,
};
+#define RADIUS_VENDOR_ID_WISPR 14122
+#define RADIUS_WISPR_AV_BW_UP 7
+#define RADIUS_WISPR_AV_BW_DOWN 8
+
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
@@ -277,6 +281,7 @@ radius_msg_get_ms_keys(struct radius_msg
struct radius_ms_mppe_keys *
radius_msg_get_cisco_keys(struct radius_msg *msg, struct radius_msg *sent_msg,
const u8 *secret, size_t secret_len);
+int radius_msg_get_wispr(struct radius_msg *msg, u32 *bandwidth);
int radius_msg_add_mppe_keys(struct radius_msg *msg,
const u8 *req_authenticator,
const u8 *secret, size_t secret_len,

View File

@@ -0,0 +1,12 @@
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -927,7 +927,8 @@ int hostapd_start_dfs_cac(struct hostapd
int hostapd_drv_set_qos_map(struct hostapd_data *hapd,
const u8 *qos_map_set, u8 qos_map_set_len)
{
- if (!hapd->driver || !hapd->driver->set_qos_map || !hapd->drv_priv)
+ if (!hapd->driver || !hapd->driver->set_qos_map || !hapd->drv_priv ||
+ !(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_QOS_MAPPING))
return 0;
return hapd->driver->set_qos_map(hapd->drv_priv, qos_map_set,
qos_map_set_len);

View File

@@ -1,13 +0,0 @@
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -668,6 +668,10 @@ acs_find_ideal_chan_mode(struct hostapd_
continue;
}
+ if (iface->conf->acs_exclude_dfs &&
+ (chan->flag & HOSTAPD_CHAN_RADAR))
+ continue;
+
/* HT40 on 5 GHz has a limited set of primary channels as per
* 11n Annex J */
if (mode->mode == HOSTAPD_MODE_IEEE80211A &&

View File

@@ -1,6 +1,6 @@
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -301,6 +301,7 @@ struct hostapd_bss_config {
@@ -310,6 +310,7 @@ struct hostapd_bss_config {
unsigned int eap_sim_db_timeout;
int eap_server_erp; /* Whether ERP is enabled on internal EAP server */
struct hostapd_ip_addr own_ip_addr;
@@ -10,7 +10,7 @@
int acct_interim_interval;
--- a/src/radius/radius_client.c
+++ b/src/radius/radius_client.c
@@ -162,6 +162,8 @@ struct radius_client_data {
@@ -163,6 +163,8 @@ struct radius_client_data {
*/
void *ctx;
@@ -19,7 +19,7 @@
/**
* conf - RADIUS client configuration (list of RADIUS servers to use)
*/
@@ -719,6 +721,30 @@ static void radius_client_list_add(struc
@@ -720,6 +722,30 @@ static void radius_client_list_add(struc
/**
@@ -50,7 +50,7 @@
* radius_client_send - Send a RADIUS request
* @radius: RADIUS client context from radius_client_init()
* @msg: RADIUS message to be sent
@@ -1219,6 +1245,10 @@ radius_change_server(struct radius_clien
@@ -1238,6 +1264,10 @@ radius_change_server(struct radius_clien
wpa_printf(MSG_DEBUG, "RADIUS local address: %s:%u",
inet_ntoa(claddr.sin_addr),
ntohs(claddr.sin_port));
@@ -61,7 +61,7 @@
}
break;
#ifdef CONFIG_IPV6
@@ -1230,6 +1260,10 @@ radius_change_server(struct radius_clien
@@ -1249,6 +1279,10 @@ radius_change_server(struct radius_clien
inet_ntop(AF_INET6, &claddr6.sin6_addr,
abuf, sizeof(abuf)),
ntohs(claddr6.sin6_port));
@@ -74,7 +74,7 @@
}
--- a/src/radius/radius_client.h
+++ b/src/radius/radius_client.h
@@ -244,6 +244,8 @@ int radius_client_register(struct radius
@@ -249,6 +249,8 @@ int radius_client_register(struct radius
void radius_client_set_interim_error_cb(struct radius_client_data *radius,
void (*cb)(const u8 *addr, void *ctx),
void *ctx);
@@ -85,7 +85,7 @@
RadiusType msg_type, const u8 *addr);
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -535,6 +535,10 @@ int add_common_radius_attr(struct hostap
@@ -598,6 +598,10 @@ int add_common_radius_attr(struct hostap
struct hostapd_radius_attr *attr;
int len;
@@ -98,7 +98,7 @@
hapd->conf->own_ip_addr.af == AF_INET &&
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2696,6 +2696,8 @@ static int hostapd_config_fill(struct ho
@@ -2688,6 +2688,8 @@ static int hostapd_config_fill(struct ho
} else if (os_strcmp(buf, "iapp_interface") == 0) {
wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used");
#endif /* CONFIG_IAPP */

View File

@@ -1,5 +1,7 @@
--- a/src/radius/radius_das.h
+++ b/src/radius/radius_das.h
Index: hostapd-2023-02-21-a9012070/src/radius/radius_das.h
===================================================================
--- hostapd-2023-02-21-a9012070.orig/src/radius/radius_das.h
+++ hostapd-2023-02-21-a9012070/src/radius/radius_das.h
@@ -44,6 +44,7 @@ struct radius_das_attrs {
struct radius_das_conf {
int port;
@@ -8,9 +10,11 @@
size_t shared_secret_len;
const struct hostapd_ip_addr *client_addr;
unsigned int time_window;
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1325,6 +1325,7 @@ int hostapd_setup_bss(struct hostapd_dat
Index: hostapd-2023-02-21-a9012070/src/ap/hostapd.c
===================================================================
--- hostapd-2023-02-21-a9012070.orig/src/ap/hostapd.c
+++ hostapd-2023-02-21-a9012070/src/ap/hostapd.c
@@ -1394,6 +1394,7 @@ int hostapd_setup_bss(struct hostapd_dat
struct radius_das_conf das_conf;
os_memset(&das_conf, 0, sizeof(das_conf));
das_conf.port = conf->radius_das_port;
@@ -18,8 +22,10 @@
das_conf.shared_secret = conf->radius_das_shared_secret;
das_conf.shared_secret_len =
conf->radius_das_shared_secret_len;
--- a/src/radius/radius_das.c
+++ b/src/radius/radius_das.c
Index: hostapd-2023-02-21-a9012070/src/radius/radius_das.c
===================================================================
--- hostapd-2023-02-21-a9012070.orig/src/radius/radius_das.c
+++ hostapd-2023-02-21-a9012070/src/radius/radius_das.c
@@ -12,13 +12,26 @@
#include "utils/common.h"
#include "utils/eloop.h"
@@ -48,7 +54,7 @@
size_t shared_secret_len;
struct hostapd_ip_addr client_addr;
unsigned int time_window;
@@ -379,56 +392,17 @@ fail:
@@ -378,56 +391,17 @@ fail:
}
@@ -111,7 +117,7 @@
if (radius_msg_verify_das_req(msg, das->shared_secret,
das->shared_secret_len,
@@ -495,9 +469,8 @@ static void radius_das_receive(int sock,
@@ -494,9 +468,8 @@ static void radius_das_receive(int sock,
radius_msg_dump(reply);
rbuf = radius_msg_get_buf(reply);
@@ -123,11 +129,7 @@
if (res < 0) {
wpa_printf(MSG_ERROR, "DAS: sendto(to %s:%d): %s",
abuf, from_port, strerror(errno));
@@ -505,10 +478,76 @@ static void radius_das_receive(int sock,
}
fail:
- radius_msg_free(msg);
@@ -508,6 +481,72 @@ fail:
radius_msg_free(reply);
}
@@ -193,7 +195,6 @@
+ fromlen, abuf, from_port);
+ }
+
+ radius_msg_free(msg);
+ if (!found)
+ wpa_printf(MSG_DEBUG, "DAS: Drop message from unknown client");
+}
@@ -201,7 +202,7 @@
static int radius_das_open_socket(int port)
{
@@ -534,6 +573,49 @@ static int radius_das_open_socket(int po
@@ -533,6 +572,49 @@ static int radius_das_open_socket(int po
}
@@ -251,7 +252,7 @@
struct radius_das_data *
radius_das_init(struct radius_das_conf *conf)
{
@@ -554,6 +636,8 @@ radius_das_init(struct radius_das_conf *
@@ -553,6 +635,8 @@ radius_das_init(struct radius_das_conf *
das->ctx = conf->ctx;
das->disconnect = conf->disconnect;
das->coa = conf->coa;
@@ -260,7 +261,7 @@
os_memcpy(&das->client_addr, conf->client_addr,
sizeof(das->client_addr));
@@ -566,19 +650,15 @@ radius_das_init(struct radius_das_conf *
@@ -565,19 +649,15 @@ radius_das_init(struct radius_das_conf *
}
das->shared_secret_len = conf->shared_secret_len;
@@ -283,7 +284,7 @@
return das;
}
@@ -589,11 +669,14 @@ void radius_das_deinit(struct radius_das
@@ -588,11 +668,14 @@ void radius_das_deinit(struct radius_das
if (das == NULL)
return;

View File

@@ -0,0 +1,154 @@
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -63,6 +63,10 @@ endif
OBJS += main.o
OBJS += config_file.o
+ifdef CONFIG_RADIUS_SERVER
+OBJS += radius.o
+endif
+
OBJS += ../src/ap/hostapd.o
OBJS += ../src/ap/wpa_auth_glue.o
OBJS += ../src/ap/drv_callbacks.o
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -40,6 +40,7 @@ struct hapd_global {
static struct hapd_global global;
+extern int radius_main(int argc, char **argv);
#ifndef CONFIG_NO_HOSTAPD_LOGGER
static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module,
@@ -771,6 +772,11 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;
+#ifdef RADIUS_SERVER
+ if (strstr(argv[0], "radius"))
+ return radius_main(argc, argv);
+#endif
+
os_memset(&interfaces, 0, sizeof(interfaces));
interfaces.reload_config = hostapd_reload_config;
interfaces.config_read_cb = hostapd_config_read;
--- a/src/radius/radius_server.c
+++ b/src/radius/radius_server.c
@@ -63,6 +63,12 @@ struct radius_server_counters {
u32 unknown_acct_types;
};
+struct radius_accept_attr {
+ u8 type;
+ u16 len;
+ void *data;
+};
+
/**
* struct radius_session - Internal RADIUS server data for a session
*/
@@ -90,7 +96,7 @@ struct radius_session {
unsigned int macacl:1;
unsigned int t_c_filtering:1;
- struct hostapd_radius_attr *accept_attr;
+ struct radius_accept_attr *accept_attr;
u32 t_c_timestamp; /* Last read T&C timestamp from user DB */
};
@@ -394,6 +400,7 @@ static void radius_server_session_free(s
radius_msg_free(sess->last_reply);
os_free(sess->username);
os_free(sess->nas_ip);
+ os_free(sess->accept_attr);
os_free(sess);
data->num_sess--;
}
@@ -554,6 +561,36 @@ radius_server_erp_find_key(struct radius
}
#endif /* CONFIG_ERP */
+static struct radius_accept_attr *
+radius_server_copy_attr(const struct hostapd_radius_attr *data)
+{
+ const struct hostapd_radius_attr *attr;
+ struct radius_accept_attr *attr_new;
+ size_t data_size = 0;
+ void *data_buf;
+ int n_attr = 1;
+
+ for (attr = data; attr; attr = attr->next) {
+ n_attr++;
+ data_size += wpabuf_len(attr->val);
+ }
+
+ attr_new = os_zalloc(n_attr * sizeof(*attr) + data_size);
+ if (!attr_new)
+ return NULL;
+
+ data_buf = &attr_new[n_attr];
+ for (n_attr = 0, attr = data; attr; attr = attr->next) {
+ struct radius_accept_attr *cur = &attr_new[n_attr++];
+
+ cur->type = attr->type;
+ cur->len = wpabuf_len(attr->val);
+ cur->data = memcpy(data_buf, wpabuf_head(attr->val), cur->len);
+ data_buf += cur->len;
+ }
+
+ return attr_new;
+}
static struct radius_session *
radius_server_get_new_session(struct radius_server_data *data,
@@ -607,7 +644,7 @@ radius_server_get_new_session(struct rad
eap_user_free(tmp);
return NULL;
}
- sess->accept_attr = tmp->accept_attr;
+ sess->accept_attr = radius_server_copy_attr(tmp->accept_attr);
sess->macacl = tmp->macacl;
eap_user_free(tmp);
@@ -1118,11 +1155,10 @@ radius_server_encapsulate_eap(struct rad
}
if (code == RADIUS_CODE_ACCESS_ACCEPT) {
- struct hostapd_radius_attr *attr;
- for (attr = sess->accept_attr; attr; attr = attr->next) {
- if (!radius_msg_add_attr(msg, attr->type,
- wpabuf_head(attr->val),
- wpabuf_len(attr->val))) {
+ struct radius_accept_attr *attr;
+ for (attr = sess->accept_attr; attr->data; attr++) {
+ if (!radius_msg_add_attr(msg, attr->type, attr->data,
+ attr->len)) {
wpa_printf(MSG_ERROR, "Could not add RADIUS attribute");
radius_msg_free(msg);
return NULL;
@@ -1211,11 +1247,10 @@ radius_server_macacl(struct radius_serve
}
if (code == RADIUS_CODE_ACCESS_ACCEPT) {
- struct hostapd_radius_attr *attr;
- for (attr = sess->accept_attr; attr; attr = attr->next) {
- if (!radius_msg_add_attr(msg, attr->type,
- wpabuf_head(attr->val),
- wpabuf_len(attr->val))) {
+ struct radius_accept_attr *attr;
+ for (attr = sess->accept_attr; attr->data; attr++) {
+ if (!radius_msg_add_attr(msg, attr->type, attr->data,
+ attr->len)) {
wpa_printf(MSG_ERROR, "Could not add RADIUS attribute");
radius_msg_free(msg);
return NULL;
@@ -2512,7 +2547,7 @@ static int radius_server_get_eap_user(vo
ret = data->get_eap_user(data->conf_ctx, identity, identity_len,
phase2, user);
if (ret == 0 && user) {
- sess->accept_attr = user->accept_attr;
+ sess->accept_attr = radius_server_copy_attr(user->accept_attr);
sess->remediation = user->remediation;
sess->macacl = user->macacl;
sess->t_c_timestamp = user->t_c_timestamp;

View File

@@ -1,34 +0,0 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -11,6 +11,8 @@
#include <sqlite3.h>
#endif /* CONFIG_SQLITE */
+#include <syslog.h>
+
#include "utils/common.h"
#include "utils/eloop.h"
#include "utils/crc32.h"
@@ -1198,6 +1200,22 @@ int hostapd_setup_bss(struct hostapd_dat
os_memcpy(hapd->own_addr, if_addr, ETH_ALEN);
}
+ if (conf->wds_sta) {
+ char path[128];
+ FILE *fp;
+
+ sprintf(path, "/sys/kernel/debug/ieee80211/%s/netdev:%s/disable_offload", hostapd_drv_get_radio_name(hapd), conf->iface);
+
+ fp = fopen(path, "w");
+ if (fp) {
+ syslog(0, "WDS: disable encap - %s\n", path);
+ fprintf(fp, "1");
+ fclose(fp);
+ } else {
+ syslog(0, "WDS: failed to disable encap - %s\n", path);
+ }
+ }
+
if (conf->wmm_enabled < 0)
conf->wmm_enabled = hapd->iconf->ieee80211n;

View File

@@ -1,11 +0,0 @@
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -717,7 +717,7 @@ struct sta_info * ap_sta_add(struct host
return sta;
wpa_printf(MSG_DEBUG, " New STA");
- if (hapd->num_sta >= hapd->conf->max_num_sta) {
+ if (hostapd_check_max_sta(hapd)) {
/* FIX: might try to remove some old STAs first? */
wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)",
hapd->num_sta, hapd->conf->max_num_sta);

View File

@@ -1,27 +0,0 @@
--- a/src/common/hw_features_common.c
+++ b/src/common/hw_features_common.c
@@ -609,9 +609,21 @@ int hostapd_set_freq_params(struct hosta
center_segment0 == channel - 6)
data->center_freq1 = 5000 + center_segment0 * 5;
else {
- wpa_printf(MSG_ERROR,
- "Wrong coupling between HT and VHT/HE channel setting");
- return -1;
+ if (channel <= 48)
+ center_segment0 = 42;
+ else if (channel <= 64)
+ center_segment0 = 58;
+ else if (channel <= 112)
+ center_segment0 = 106;
+ else if (channel <= 128)
+ center_segment0 = 122;
+ else if (channel <= 144)
+ center_segment0 = 138;
+ else if (channel <= 161)
+ center_segment0 = 155;
+ else if (channel <= 177)
+ center_segment0 = 171;
+ data->center_freq1 = 5000 + center_segment0 * 5;
}
}
break;

View File

@@ -1,22 +0,0 @@
--- a/src/radius/radius_das.c
+++ b/src/radius/radius_das.c
@@ -48,6 +48,8 @@ static struct radius_msg * radius_das_di
RADIUS_ATTR_EVENT_TIMESTAMP,
RADIUS_ATTR_MESSAGE_AUTHENTICATOR,
RADIUS_ATTR_CHARGEABLE_USER_IDENTITY,
+ RADIUS_ATTR_VENDOR_SPECIFIC,
+ RADIUS_ATTR_CALLED_STATION_ID,
#ifdef CONFIG_IPV6
RADIUS_ATTR_NAS_IPV6_ADDRESS,
#endif /* CONFIG_IPV6 */
@@ -205,9 +207,8 @@ static struct radius_msg * radius_das_co
RADIUS_ATTR_EVENT_TIMESTAMP,
RADIUS_ATTR_MESSAGE_AUTHENTICATOR,
RADIUS_ATTR_CHARGEABLE_USER_IDENTITY,
-#ifdef CONFIG_HS20
RADIUS_ATTR_VENDOR_SPECIFIC,
-#endif /* CONFIG_HS20 */
+ RADIUS_ATTR_CALLED_STATION_ID,
#ifdef CONFIG_IPV6
RADIUS_ATTR_NAS_IPV6_ADDRESS,
#endif /* CONFIG_IPV6 */

View File

@@ -1,31 +0,0 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2366,6 +2366,8 @@ static int hostapd_config_fill(struct ho
return 1;
}
conf->driver = driver;
+ } else if (os_strcmp(buf, "uci_section") == 0) {
+ bss->uci_section = os_strdup(pos);
} else if (os_strcmp(buf, "driver_params") == 0) {
os_free(conf->driver_params);
conf->driver_params = os_strdup(pos);
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -279,6 +279,7 @@ struct hostapd_bss_config {
char snoop_iface[IFNAMSIZ + 1];
char vlan_bridge[IFNAMSIZ + 1];
char wds_bridge[IFNAMSIZ + 1];
+ char *uci_section;
enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -785,6 +785,7 @@ void hostapd_config_free_bss(struct host
os_free(conf->radius_req_attr_sqlite);
os_free(conf->rsn_preauth_interfaces);
os_free(conf->ctrl_interface);
+ os_free(conf->uci_section);
os_free(conf->ca_cert);
os_free(conf->server_cert);
os_free(conf->server_cert2);

View File

@@ -1,53 +0,0 @@
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2175,6 +2175,10 @@ struct hostap_sta_driver_data {
u8 tx_mcs;
u8 rx_vht_nss;
u8 tx_vht_nss;
+ u8 rx_hemcs;
+ u8 tx_hemcs;
+ u8 rx_he_nss;
+ u8 tx_he_nss;
};
struct hostapd_sta_add_params {
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -7010,6 +7010,8 @@ static int get_sta_handler(struct nl_msg
[NL80211_RATE_INFO_VHT_MCS] = { .type = NLA_U8 },
[NL80211_RATE_INFO_SHORT_GI] = { .type = NLA_FLAG },
[NL80211_RATE_INFO_VHT_NSS] = { .type = NLA_U8 },
+ [NL80211_RATE_INFO_HE_NSS] = { .type = NLA_U8 },
+ [NL80211_RATE_INFO_HE_MCS] = { .type = NLA_U8 },
};
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@@ -7102,6 +7104,10 @@ static int get_sta_handler(struct nl_msg
nla_get_u8(rate[NL80211_RATE_INFO_VHT_NSS]);
data->flags |= STA_DRV_DATA_TX_VHT_NSS;
}
+ if (rate[NL80211_RATE_INFO_HE_MCS])
+ data->tx_hemcs = nla_get_u8(rate[NL80211_RATE_INFO_HE_MCS]);
+ if (rate[NL80211_RATE_INFO_HE_NSS])
+ data->tx_he_nss = nla_get_u8(rate[NL80211_RATE_INFO_HE_NSS]);
}
if (stats[NL80211_STA_INFO_RX_BITRATE] &&
@@ -7132,11 +7138,16 @@ static int get_sta_handler(struct nl_msg
nla_get_u8(rate[NL80211_RATE_INFO_VHT_NSS]);
data->flags |= STA_DRV_DATA_RX_VHT_NSS;
}
+ if (rate[NL80211_RATE_INFO_HE_MCS])
+ data->rx_hemcs = nla_get_u8(rate[NL80211_RATE_INFO_HE_MCS]);
+ if (rate[NL80211_RATE_INFO_HE_NSS])
+ data->rx_he_nss = nla_get_u8(rate[NL80211_RATE_INFO_HE_NSS]);
}
if (stats[NL80211_STA_INFO_TID_STATS])
get_sta_tid_stats(data, stats[NL80211_STA_INFO_TID_STATS]);
+
return NL_SKIP;
}

View File

@@ -0,0 +1,33 @@
From f0e9f5aab52b3eab85d28338cc996972ced4c39c Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Tue, 17 May 2022 23:07:59 +0200
Subject: [PATCH] ctrl: make WNM_AP functions dependant on CONFIG_AP
This fixes linking errors found when compiling wpa_supplicant with
CONFIG_WNM_AP enabled but CONFIG_AP disabled.
Signed-off-by: David Bauer <mail@david-bauer.net>
---
wpa_supplicant/ctrl_iface.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -12763,7 +12763,7 @@ char * wpa_supplicant_ctrl_iface_process
if (wpas_ctrl_iface_coloc_intf_report(wpa_s, buf + 18))
reply_len = -1;
#endif /* CONFIG_WNM */
-#ifdef CONFIG_WNM_AP
+#if defined(CONFIG_AP) && defined(CONFIG_WNM_AP)
} else if (os_strncmp(buf, "DISASSOC_IMMINENT ", 18) == 0) {
if (ap_ctrl_iface_disassoc_imminent(wpa_s, buf + 18))
reply_len = -1;
@@ -12773,7 +12773,7 @@ char * wpa_supplicant_ctrl_iface_process
} else if (os_strncmp(buf, "BSS_TM_REQ ", 11) == 0) {
if (ap_ctrl_iface_bss_tm_req(wpa_s, buf + 11))
reply_len = -1;
-#endif /* CONFIG_WNM_AP */
+#endif /* CONFIG_AP && CONFIG_WNM_AP */
} else if (os_strcmp(buf, "FLUSH") == 0) {
wpa_supplicant_ctrl_iface_flush(wpa_s);
} else if (os_strncmp(buf, "RADIO_WORK ", 11) == 0) {

View File

@@ -0,0 +1,62 @@
From: David Bauer <mail@david-bauer.net>
To: hostap@lists.infradead.org
Cc: =?utf-8?q?=C3=89tienne_Morice?= <neon.emorice@mail.com>
Subject: [PATCH] nl80211: add extra-ies only if allowed by driver
Date: Sun, 30 Jan 2022 20:22:00 +0100
Message-Id: <20220130192200.10883-1-mail@david-bauer.net>
List-Id: <hostap.lists.infradead.org>
Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl
based adapters. The reason for it is hostapd tries to install additional
IEs for scanning while the driver does not support this.
The kernel indicates the maximum number of bytes for additional scan IEs
using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and
only add additional scan IEs in case the driver can accommodate these
additional IEs.
Reported-by: Étienne Morice <neon.emorice@mail.com>
Tested-by: Étienne Morice <neon.emorice@mail.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
---
src/drivers/driver.h | 3 +++
src/drivers/driver_nl80211_capa.c | 4 ++++
src/drivers/driver_nl80211_scan.c | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2283,6 +2283,9 @@ struct wpa_driver_capa {
/** Maximum number of iterations in a single scan plan */
u32 max_sched_scan_plan_iterations;
+ /** Maximum number of extra IE bytes for scans */
+ u16 max_scan_ie_len;
+
/** Whether sched_scan (offloaded scanning) is supported */
int sched_scan_supported;
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -949,6 +949,10 @@ static int wiphy_info_handler(struct nl_
nla_get_u32(tb[NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS]);
}
+ if (tb[NL80211_ATTR_MAX_SCAN_IE_LEN])
+ capa->max_scan_ie_len =
+ nla_get_u16(tb[NL80211_ATTR_MAX_SCAN_IE_LEN]);
+
if (tb[NL80211_ATTR_MAX_MATCH_SETS])
capa->max_match_sets =
nla_get_u8(tb[NL80211_ATTR_MAX_MATCH_SETS]);
--- a/src/drivers/driver_nl80211_scan.c
+++ b/src/drivers/driver_nl80211_scan.c
@@ -222,7 +222,7 @@ nl80211_scan_common(struct i802_bss *bss
wpa_printf(MSG_DEBUG, "nl80211: Passive scan requested");
}
- if (params->extra_ies) {
+ if (params->extra_ies && drv->capa.max_scan_ie_len >= params->extra_ies_len) {
wpa_hexdump(MSG_MSGDUMP, "nl80211: Scan extra IEs",
params->extra_ies, params->extra_ies_len);
if (nla_put(msg, NL80211_ATTR_IE, params->extra_ies_len,

View File

@@ -1,95 +0,0 @@
Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.c
+++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.c
@@ -63,6 +63,7 @@ static struct radius_msg * radius_das_di
RADIUS_ATTR_CHARGEABLE_USER_IDENTITY,
RADIUS_ATTR_VENDOR_SPECIFIC,
RADIUS_ATTR_CALLED_STATION_ID,
+ RADIUS_ATTR_PROXY_STATE,
#ifdef CONFIG_IPV6
RADIUS_ATTR_NAS_IPV6_ADDRESS,
#endif /* CONFIG_IPV6 */
@@ -159,6 +160,12 @@ static struct radius_msg * radius_das_di
attrs.cui_len = len;
}
+ if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_PROXY_STATE,
+ &buf, &len, NULL) == 0) {
+ attrs.proxy = buf;
+ attrs.proxy_len = len;
+ }
+
res = das->disconnect(das->ctx, &attrs);
switch (res) {
case RADIUS_DAS_NAS_MISMATCH:
@@ -167,10 +174,11 @@ static struct radius_msg * radius_das_di
error = 403;
break;
case RADIUS_DAS_SESSION_NOT_FOUND:
- wpa_printf(MSG_INFO, "DAS: Session not found for request from "
- "%s:%d", abuf, from_port);
- error = 503;
- break;
+ return NULL;
+// wpa_printf(MSG_INFO, "DAS: Session not found for request from "
+// "%s:%d", abuf, from_port);
+// error = 503;
+// break;
case RADIUS_DAS_MULTI_SESSION_MATCH:
wpa_printf(MSG_INFO,
"DAS: Multiple sessions match for request from %s:%d",
@@ -192,6 +200,9 @@ fail:
if (reply == NULL)
return NULL;
+ if (attrs.proxy)
+ radius_msg_add_attr(reply, RADIUS_ATTR_PROXY_STATE, attrs.proxy, attrs.proxy_len);
+
if (error) {
if (!radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE,
error)) {
@@ -222,6 +233,7 @@ static struct radius_msg * radius_das_co
RADIUS_ATTR_CHARGEABLE_USER_IDENTITY,
RADIUS_ATTR_VENDOR_SPECIFIC,
RADIUS_ATTR_CALLED_STATION_ID,
+ RADIUS_ATTR_PROXY_STATE,
#ifdef CONFIG_IPV6
RADIUS_ATTR_NAS_IPV6_ADDRESS,
#endif /* CONFIG_IPV6 */
@@ -347,6 +359,12 @@ static struct radius_msg * radius_das_co
}
#endif /* CONFIG_HS20 */
+ if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_PROXY_STATE,
+ &buf, &len, NULL) == 0) {
+ attrs.proxy = buf;
+ attrs.proxy_len = len;
+ }
+
res = das->coa(das->ctx, &attrs);
switch (res) {
case RADIUS_DAS_NAS_MISMATCH:
@@ -382,6 +400,9 @@ fail:
if (!reply)
return NULL;
+ if (attrs.proxy)
+ radius_msg_add_attr(reply, RADIUS_ATTR_PROXY_STATE, attrs.proxy, attrs.proxy_len);
+
if (error &&
!radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE, error)) {
radius_msg_free(reply);
Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.h
+++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.h
@@ -36,6 +36,8 @@ struct radius_das_attrs {
size_t acct_multi_session_id_len;
const u8 *cui;
size_t cui_len;
+ const u8 *proxy;
+ size_t proxy_len;
/* Authorization changes */
const u8 *hs20_t_c_filtering;

View File

@@ -1,48 +0,0 @@
Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/wpa_auth_ft.c
+++ hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
@@ -3067,6 +3067,7 @@ static int wpa_ft_process_auth_req(struc
size_t identity_len = 0, radius_cui_len = 0;
int use_sha384;
size_t pmk_r1_len, kdk_len;
+ struct os_reltime now;
*resp_ies = NULL;
*resp_ies_len = 0;
@@ -3185,10 +3186,19 @@ pmk_r1_derived:
os_memcpy(sm->pmk_r1, pmk_r1, pmk_r1_len);
sm->pmk_r1_len = pmk_r1_len;
- if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) {
- wpa_printf(MSG_DEBUG, "FT: Failed to get random data for "
- "ANonce");
- return WLAN_STATUS_UNSPECIFIED_FAILURE;
+ if (os_get_reltime(&now) < 0 ||
+ os_reltime_expired(&now, &sm->ANonce_time, 1)) {
+ if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) {
+ wpa_printf(MSG_DEBUG, "FT: Failed to get random data for "
+ "ANonce");
+ return WLAN_STATUS_UNSPECIFIED_FAILURE;
+ }
+ sm->ANonce_time.sec = now.sec;
+ sm->ANonce_time.usec = now.usec;
+ wpa_printf(MSG_INFO, "FT: ANonce was randomized");
+ } else {
+ wpa_printf(MSG_INFO, "FT: ANonce has not expired");
+
}
wpa_hexdump(MSG_DEBUG, "FT: Received SNonce",
Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_i.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/wpa_auth_i.h
+++ hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_i.h
@@ -54,6 +54,7 @@ struct wpa_state_machine {
bool MICVerified;
bool GUpdateStationKeys;
u8 ANonce[WPA_NONCE_LEN];
+ struct os_reltime ANonce_time;
u8 SNonce[WPA_NONCE_LEN];
u8 alt_SNonce[WPA_NONCE_LEN];
u8 alt_replay_counter[WPA_REPLAY_COUNTER_LEN];

View File

@@ -1,43 +0,0 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3337,6 +3337,8 @@ static int hostapd_config_fill(struct ho
bss->ignore_broadcast_ssid = atoi(pos);
} else if (os_strcmp(buf, "no_probe_resp_if_max_sta") == 0) {
bss->no_probe_resp_if_max_sta = atoi(pos);
+ } else if (os_strcmp(buf, "dynamic_probe_resp") == 0) {
+ bss->dynamic_probe_resp = atoi(pos);
#ifdef CONFIG_WEP
} else if (os_strcmp(buf, "wep_default_key") == 0) {
bss->ssid.wep.idx = atoi(pos);
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -459,6 +459,7 @@ struct hostapd_bss_config {
int ap_max_inactivity;
int ignore_broadcast_ssid;
int no_probe_resp_if_max_sta;
+ int dynamic_probe_resp;
int wmm_enabled;
int wmm_uapsd;
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -920,7 +920,8 @@ void handle_probe_req(struct hostapd_dat
}
#endif /* CONFIG_P2P */
- if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 &&
+ if (!hapd->conf->dynamic_probe_resp &&
+ hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 &&
elems.ssid_list_len == 0 && elems.short_ssid_list_len == 0) {
wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for "
"broadcast SSID ignored", MAC2STR(mgmt->sa));
@@ -967,7 +968,8 @@ void handle_probe_req(struct hostapd_dat
return;
}
- if (hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) {
+ if (!hapd->conf->dynamic_probe_resp &&
+ hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) {
wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for "
"broadcast SSID ignored", MAC2STR(mgmt->sa));
return;

View File

@@ -1,75 +0,0 @@
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -57,6 +57,17 @@
#include "gas_query_ap.h"
+static int
+ewma(int new, int old)
+{
+ #define ALPHA 10
+ if (!old)
+ return new;
+ if (new >= 0)
+ return old;
+ return ((ALPHA * new) + ((100 - ALPHA) * old)) / 100;
+}
+
#ifdef CONFIG_FILS
static struct wpabuf *
prepare_auth_resp_fils(struct hostapd_data *hapd,
@@ -5873,7 +5882,7 @@ static int robust_action_frame(u8 catego
static int handle_action(struct hostapd_data *hapd,
const struct ieee80211_mgmt *mgmt, size_t len,
- unsigned int freq)
+ unsigned int freq, int ssi_signal)
{
struct sta_info *sta;
u8 *action __maybe_unused;
@@ -5930,6 +5939,7 @@ static int handle_action(struct hostapd_
sta->last_seq_ctrl = seq_ctrl;
sta->last_subtype = WLAN_FC_STYPE_ACTION;
+ sta->signal_mgmt = ewma(ssi_signal, sta->signal_mgmt);;
}
switch (mgmt->u.action.category) {
@@ -6109,6 +6119,8 @@ int ieee802_11_mgmt(struct hostapd_data
unsigned int freq;
int ssi_signal = fi ? fi->ssi_signal : 0;
+ hapd->signal_mgmt = ewma(ssi_signal, hapd->signal_mgmt);;
+
if (len < 24)
return 0;
@@ -6208,7 +6220,7 @@ int ieee802_11_mgmt(struct hostapd_data
break;
case WLAN_FC_STYPE_ACTION:
wpa_printf(MSG_DEBUG, "mgmt::action");
- ret = handle_action(hapd, mgmt, len, freq);
+ ret = handle_action(hapd, mgmt, len, freq, ssi_signal);
break;
default:
hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -331,6 +331,7 @@ struct sta_info {
#ifdef CONFIG_PASN
struct pasn_data *pasn;
#endif /* CONFIG_PASN */
+ int signal_mgmt;
};
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -451,6 +451,7 @@ struct hostapd_data {
#ifdef CONFIG_CTRL_IFACE_UDP
unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN];
#endif /* CONFIG_CTRL_IFACE_UDP */
+ int signal_mgmt;
};

View File

@@ -1,153 +0,0 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2424,6 +2424,8 @@ static int hostapd_config_fill(struct ho
conf->ieee80211d = atoi(pos);
} else if (os_strcmp(buf, "ieee80211h") == 0) {
conf->ieee80211h = atoi(pos);
+ } else if (os_strcmp(buf, "dfs_test_mode") == 0) {
+ conf->dfs_test_mode = atoi(pos);
} else if (os_strcmp(buf, "ieee8021x") == 0) {
bss->ieee802_1x = atoi(pos);
} else if (os_strcmp(buf, "eapol_version") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -950,6 +950,7 @@ struct hostapd_config {
int ieee80211d;
int ieee80211h; /* DFS */
+ int dfs_test_mode;
/*
* Local power constraint is an octet encoded as an unsigned integer in
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -17,6 +17,8 @@
#include "ap_drv_ops.h"
#include "drivers/driver.h"
#include "dfs.h"
+#include "beacon.h"
+#include "eloop.h"
static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)
@@ -1015,6 +1017,73 @@ static int hostapd_dfs_start_channel_swi
return err;
}
+void hostapd_dfs_test_mode_csa_timeout(void *eloop_data, void *user_data)
+{
+ struct hostapd_data *hapd = eloop_data;
+
+ wpa_printf(MSG_INFO, "Stopping CSA in dfs test mode");
+ hostapd_cleanup_cs_params(hapd);
+ ieee802_11_set_beacon(hapd);
+}
+
+static int hostapd_dfs_testmode_set_beacon_csa(struct hostapd_iface *iface)
+{
+ struct hostapd_data *hapd = iface->bss[0];
+ struct csa_settings csa_settings;
+ int secondary_channel;
+ u8 vht_oper_centr_freq_seg0_idx;
+ u8 vht_oper_centr_freq_seg1_idx;
+ int err = 0;
+
+ eloop_cancel_timeout(hostapd_dfs_test_mode_csa_timeout, hapd, NULL);
+ secondary_channel = iface->conf->secondary_channel;
+ vht_oper_centr_freq_seg0_idx =
+ iface->conf->vht_oper_centr_freq_seg0_idx;
+ vht_oper_centr_freq_seg1_idx =
+ iface->conf->vht_oper_centr_freq_seg1_idx;
+
+ /* Setup CSA request */
+ os_memset(&csa_settings, 0, sizeof(csa_settings));
+ err = hostapd_set_freq_params(&csa_settings.freq_params,
+ iface->conf->hw_mode,
+ iface->freq,
+ iface->conf->channel,
+ iface->conf->ieee80211n,
+ iface->conf->ieee80211ac,
+ secondary_channel,
+ iface->conf->vht_oper_chwidth,
+ vht_oper_centr_freq_seg0_idx,
+ vht_oper_centr_freq_seg1_idx,
+ iface->current_mode->vht_capab);
+
+ if (err) {
+ wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
+ goto fail;
+ }
+
+ if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) {
+ wpa_printf(MSG_INFO, "CSA is not supported");
+ hostapd_disable_iface(iface);
+ return -1;
+ }
+
+ hapd->cs_freq_params = csa_settings.freq_params;
+ hapd->cs_count = 3;
+ hapd->cs_block_tx = 1;
+ err = ieee802_11_set_beacon(hapd);
+ if (err)
+ goto fail;
+ wpa_printf(MSG_DEBUG, "CSA beacon configured for dfs mode, count %d",
+ hapd->cs_count);
+ hapd->csa_in_progress = 1;
+ eloop_register_timeout(HOSTAPD_DFS_TEST_MODE_CSA_DUR, 0,
+ hostapd_dfs_test_mode_csa_timeout, hapd, NULL);
+ return 0;
+
+fail:
+ hostapd_disable_iface(iface);
+ return err;
+}
static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
{
@@ -1049,6 +1118,9 @@ static int hostapd_dfs_start_channel_swi
if (iface->dfs_domain == HOSTAPD_DFS_REGION_ETSI)
skip_radar = 0;
+ if (iface->conf->dfs_test_mode)
+ return hostapd_dfs_testmode_set_beacon_csa(iface);
+
/* Perform channel switch/CSA */
channel = dfs_get_valid_channel(iface, &secondary_channel,
&oper_centr_freq_seg0_idx,
@@ -1172,6 +1244,12 @@ int hostapd_dfs_radar_detected(struct ho
if (!res)
return 0;
+ if (iface->conf->dfs_test_mode) {
+ set_dfs_state(iface, freq, ht_enabled, chan_offset,
+ chan_width, cf1, cf2,
+ HOSTAPD_CHAN_DFS_AVAILABLE);
+ }
+
/* Skip if reported radar event not overlapped our channels */
res = dfs_are_channels_overlapped(iface, freq, chan_width, cf1, cf2);
if (!res)
--- a/src/ap/dfs.h
+++ b/src/ap/dfs.h
@@ -9,6 +9,11 @@
#ifndef DFS_H
#define DFS_H
+/* CSA beacon duration in seconds for dfs testing mode */
+#define HOSTAPD_DFS_TEST_MODE_CSA_DUR 1
+
+void hostapd_dfs_test_mode_csa_timeout(void *eloop_data, void *user_data);
+
int hostapd_handle_dfs(struct hostapd_iface *iface);
int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2767,6 +2767,7 @@ int hostapd_disable_iface(struct hostapd
hostapd_cleanup_cs_params(hapd_iface->bss[j]);
#endif /* NEED_AP_MLME */
+ eloop_cancel_timeout(hostapd_dfs_test_mode_csa_timeout, hapd_iface, NULL);
/* same as hostapd_interface_deinit without deinitializing ctrl-iface */
for (j = 0; j < hapd_iface->num_bss; j++) {
struct hostapd_data *hapd = hapd_iface->bss[j];

View File

@@ -1,18 +0,0 @@
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -31,6 +31,7 @@
#include "tkip_countermeasures.h"
#include "ieee802_1x.h"
#include "wpa_auth.h"
+#include "wpa_auth_glue.h"
#include "wps_hostapd.h"
#include "ap_drv_ops.h"
#include "ap_config.h"
@@ -2030,6 +2031,7 @@ void hostapd_wpa_event(void *ctx, enum w
* Try to re-enable interface if the driver stopped it
* when the interface got disabled.
*/
+ hostapd_reconfig_wpa(hapd);
if (hapd->wpa_auth)
wpa_auth_reconfig_group_keys(hapd->wpa_auth);
else

View File

@@ -1,140 +0,0 @@
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -1051,7 +1051,7 @@ void wpa_receive(struct wpa_authenticato
mic_len, key_data_length);
wpa_hexdump(MSG_MSGDUMP,
"WPA: EAPOL-Key header (ending before Key MIC)",
- key, sizeof(*key));
+ (u8 *)key, sizeof(*key));
wpa_hexdump(MSG_MSGDUMP, "WPA: EAPOL-Key Key MIC",
mic, mic_len);
if (key_data_length > data_len - sizeof(*hdr) - keyhdrlen) {
@@ -3140,7 +3140,7 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
idx = bitfield_get_first_zero(wpa_auth->ip_pool);
if (idx >= 0) {
u32 start = WPA_GET_BE32(wpa_auth->conf.ip_addr_start);
- bitfield_set(wpa_auth->ip_pool, idx);
+ bitfield_set_local(wpa_auth->ip_pool, idx);
WPA_PUT_BE32(sm->ip_addr, start + idx);
wpa_printf(MSG_DEBUG,
"P2P: Assigned IP address %u.%u.%u.%u to "
--- a/src/crypto/tls_openssl.c
+++ b/src/crypto/tls_openssl.c
@@ -1099,7 +1099,7 @@ void * tls_init(const struct tls_config
if (conf && conf->openssl_ciphers)
ciphers = conf->openssl_ciphers;
else
- ciphers = TLS_DEFAULT_CIPHERS;
+ ciphers = "DEFAULT:!EXP:!LOW";
if (SSL_CTX_set_cipher_list(ssl, ciphers) != 1) {
wpa_printf(MSG_ERROR,
"OpenSSL: Failed to set cipher string '%s'",
--- a/src/utils/bitfield.c
+++ b/src/utils/bitfield.c
@@ -37,7 +37,7 @@ void bitfield_free(struct bitfield *bf)
}
-void bitfield_set(struct bitfield *bf, size_t bit)
+void bitfield_set_local(struct bitfield *bf, size_t bit)
{
if (bit >= bf->max_bits)
return;
--- a/src/utils/bitfield.h
+++ b/src/utils/bitfield.h
@@ -13,7 +13,7 @@ struct bitfield;
struct bitfield * bitfield_alloc(size_t max_bits);
void bitfield_free(struct bitfield *bf);
-void bitfield_set(struct bitfield *bf, size_t bit);
+void bitfield_set_local(struct bitfield *bf, size_t bit);
void bitfield_clear(struct bitfield *bf, size_t bit);
int bitfield_is_set(struct bitfield *bf, size_t bit);
int bitfield_get_first_zero(struct bitfield *bf);
--- a/src/utils/utils_module_tests.c
+++ b/src/utils/utils_module_tests.c
@@ -142,7 +142,7 @@ static int bitfield_tests(void)
errors++;
if (i > 0 && bitfield_is_set(bf, i - 1))
errors++;
- bitfield_set(bf, i);
+ bitfield_set_local(bf, i);
if (!bitfield_is_set(bf, i))
errors++;
bitfield_clear(bf, i);
@@ -155,7 +155,7 @@ static int bitfield_tests(void)
errors++;
if (i > 0 && bitfield_is_set(bf, i - 1))
errors++;
- bitfield_set(bf, i);
+ bitfield_set_local(bf, i);
if (bitfield_is_set(bf, i))
errors++;
bitfield_clear(bf, i);
@@ -166,7 +166,7 @@ static int bitfield_tests(void)
for (i = 0; i < 123; i++) {
if (bitfield_is_set(bf, i) || bitfield_is_set(bf, i + 1))
errors++;
- bitfield_set(bf, i);
+ bitfield_set_local(bf, i);
if (!bitfield_is_set(bf, i))
errors++;
}
@@ -182,7 +182,7 @@ static int bitfield_tests(void)
for (i = 0; i < 123; i++) {
if (bitfield_get_first_zero(bf) != i)
errors++;
- bitfield_set(bf, i);
+ bitfield_set_local(bf, i);
}
if (bitfield_get_first_zero(bf) != -1)
errors++;
@@ -192,7 +192,7 @@ static int bitfield_tests(void)
bitfield_clear(bf, i);
if (bitfield_get_first_zero(bf) != i)
errors++;
- bitfield_set(bf, i);
+ bitfield_set_local(bf, i);
}
if (bitfield_get_first_zero(bf) != -1)
errors++;
@@ -205,7 +205,7 @@ static int bitfield_tests(void)
if (bitfield_get_first_zero(bf) != 0)
errors++;
for (i = 0; i < 8; i++)
- bitfield_set(bf, i);
+ bitfield_set_local(bf, i);
if (bitfield_get_first_zero(bf) != -1)
errors++;
bitfield_free(bf);
--- a/wpa_supplicant/rrm.c
+++ b/wpa_supplicant/rrm.c
@@ -1125,7 +1125,7 @@ static int wpas_rm_handle_beacon_req_sub
}
for (i = 0; i < slen; i++)
- bitfield_set(data->eids, subelem[i]);
+ bitfield_set_local(data->eids, subelem[i]);
break;
case WLAN_BEACON_REQUEST_SUBELEM_AP_CHANNEL:
/* Skip - it will be processed when freqs are added */
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1678,7 +1678,7 @@ static int copy_peer_he_capab(const stru
peer->he_capab_len = kde->he_capab_len;
wpa_hexdump(MSG_DEBUG, "TDLS: Peer HE capabilities",
- peer->he_capabilities, peer->he_capab_len);
+ (u8 *)peer->he_capabilities, peer->he_capab_len);
return 0;
}
@@ -1704,7 +1704,7 @@ static int copy_peer_he_6ghz_band_capab(
sizeof(struct ieee80211_he_6ghz_band_cap));
wpa_hexdump(MSG_DEBUG, "TDLS: Peer 6 GHz band HE capabilities",
- peer->he_6ghz_band_capabilities,
+ (u8 *)peer->he_6ghz_band_capabilities,
sizeof(struct ieee80211_he_6ghz_band_cap));
return 0;

View File

@@ -1,130 +0,0 @@
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -3112,6 +3112,92 @@ set:
return ret;
}
+static int hostapd_2ghz_ht40_allow_map(struct hostapd_hw_modes *mode,
+ char *buf, size_t buflen)
+{
+ int j, ret, len = 0;
+
+ for (j = 0; j < mode->num_channels; j++) {
+ struct hostapd_channel_data *chan = &mode->channels[j];
+ if (!(chan->flag & HOSTAPD_CHAN_DISABLED)) {
+ ret = os_snprintf(buf + len, buflen - len,
+ "Channel: %d : %d HT40%c%c\n",
+ chan->chan, chan->freq,
+ (chan->flag & HOSTAPD_CHAN_HT40MINUS) ?
+ '-' : ' ',
+ (chan->flag & HOSTAPD_CHAN_HT40PLUS) ?
+ '+' : ' ');
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ }
+ }
+ return len;
+}
+
+static int hostapd_5ghz_ht40_allow_map(struct hostapd_hw_modes *mode,
+ char *buf, size_t buflen)
+{
+ int j, k, ok, ret, len = 0, allowed[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 140,
+ 149, 157, 184, 192 };
+
+ for (j = 0; j < mode->num_channels; j++) {
+ struct hostapd_channel_data *chan = &mode->channels[j];
+
+ if ((chan->flag & HOSTAPD_CHAN_HT40MINUS) ||
+ (chan->flag & HOSTAPD_CHAN_HT40PLUS)) {
+ ok = 0;
+ for (k = 0; k < ARRAY_SIZE(allowed); k++) {
+ if (chan->chan < allowed[k])
+ break;
+ if (chan->chan == allowed[k]) {
+ ok = 1;
+ break;
+ }
+ }
+
+ if (!ok && chan->chan != (allowed[k - 1] + 4))
+ ok = -1;
+
+ if (ok == 1 && (mode->channels[j + 1].flag &
+ HOSTAPD_CHAN_DISABLED))
+ ok = -1;
+
+ if (ok != -1) {
+ ret = os_snprintf(buf + len, buflen - len,
+ "Channel: %d : %d HT40%s\n",
+ chan->chan, chan->freq,
+ ok == 1 ? "+" : "-");
+
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+
+ len += ret;
+ }
+ }
+ }
+ return len;
+}
+
+static int hostapd_ctrl_iface_ht40_allow_map(struct hostapd_iface *iface,
+ char *buf, size_t buflen)
+{
+ struct hostapd_data *hapd = iface->bss[0];
+ struct hostapd_hw_modes *mode;
+ int len = 0;
+ u16 num_modes, flags;
+ u8 dfs_domain;
+
+ mode = hostapd_get_hw_feature_data(hapd, &num_modes, &flags,
+ &dfs_domain);
+
+ if (mode->mode != HOSTAPD_MODE_IEEE80211A)
+ len = hostapd_2ghz_ht40_allow_map(mode, buf, buflen);
+ else
+ len = hostapd_5ghz_ht40_allow_map(mode, buf, buflen);
+
+ return len;
+}
static int hostapd_ctrl_iface_remove_neighbor(struct hostapd_data *hapd,
char *buf)
@@ -3790,6 +3876,10 @@ static int hostapd_ctrl_iface_receive_pr
if (radius_server_dac_request(hapd->radius_srv, buf + 12) < 0)
reply_len = -1;
#endif /* RADIUS_SERVER */
+ } else if (os_strcmp(buf, "HT40_ALLOW_MAP") == 0) {
+ reply_len = hostapd_ctrl_iface_ht40_allow_map(hapd->iface,
+ reply,
+ reply_size);
} else if (os_strncmp(buf, "GET_CAPABILITY ", 15) == 0) {
reply_len = hostapd_ctrl_iface_get_capability(
hapd, buf + 15, reply, reply_size);
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1362,6 +1362,12 @@ static int hostapd_cli_cmd_driver_flags(
return wpa_ctrl_command(ctrl, "DRIVER_FLAGS");
}
+static int hostapd_cli_cmd_ht40_allow_map(struct wpa_ctrl *ctrl,
+ int argc, char *argv[])
+{
+ return wpa_ctrl_command(ctrl, "HT40_ALLOW_MAP");
+}
+
#ifdef CONFIG_DPP
@@ -1705,6 +1711,8 @@ static const struct hostapd_cli_cmd host
"=Add/Delete/Show/Clear deny MAC ACL" },
{ "poll_sta", hostapd_cli_cmd_poll_sta, hostapd_complete_stations,
"<addr> = poll a STA to check connectivity with a QoS null frame" },
+ { "ht40_allow_map", hostapd_cli_cmd_ht40_allow_map, NULL,
+ "= show ht40 allow map status" },
{ "req_beacon", hostapd_cli_cmd_req_beacon, NULL,
"<addr> [req_mode=] <measurement request hexdump> = send a Beacon report request to a station" },
{ "reload_wpa_psk", hostapd_cli_cmd_reload_wpa_psk, NULL,

View File

@@ -1,18 +0,0 @@
--- a/src/ap/ieee802_11_auth.c
+++ b/src/ap/ieee802_11_auth.c
@@ -174,6 +174,15 @@ static int hostapd_radius_acl_query(stru
int hostapd_check_acl(struct hostapd_data *hapd, const u8 *addr,
struct vlan_description *vlan_id)
{
+
+#ifdef CONFIG_WPS
+ /* According to WPS spec 2.0, disable MAC address filtering
+ * if WPS is enabled on the AP.
+ */
+ if (hapd->conf->wps_state)
+ return HOSTAPD_ACL_ACCEPT;
+#endif /*CONFIG_WPS */
+
if (hostapd_maclist_found(hapd->conf->accept_mac,
hapd->conf->num_accept_mac, addr, vlan_id))
return HOSTAPD_ACL_ACCEPT;

View File

@@ -1,224 +0,0 @@
commit 2dfbe0feb590dfebaf1e92c4006c1ae22ee482bb
Author: houbao <houbao@codeaurora.org>
Date: Thu Dec 6 15:17:46 2018 +0800
Subject: [PATCH] hostapd: Add max rate information into STATUS and STA
commands
These allow external programs to get max MCS, max nss, and rate
information of an interface or a STA.
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -51,6 +51,107 @@ static size_t hostapd_write_ht_mcs_bitma
}
+static u8 hostapd_maxnss(struct hostapd_data *hapd, struct sta_info *sta)
+{
+ u8 *mcs_set = NULL;
+ u16 mcs_map;
+ u8 ht_rx_nss = 0;
+ u8 vht_rx_nss = 1;
+ u8 mcs;
+ u8 ht_supported = 0;
+ u8 vht_supported = 0;
+ int i;
+
+ if (sta) {
+ if (sta->ht_capabilities && (sta->flags & WLAN_STA_HT)) {
+ mcs_set = sta->ht_capabilities->supported_mcs_set;
+ ht_supported = 1;
+ }
+ if (sta->vht_capabilities && (sta->flags & WLAN_STA_VHT)) {
+ mcs_map = le_to_host16(sta->vht_capabilities->
+ vht_supported_mcs_set.rx_map);
+ vht_supported = 1;
+ }
+ } else {
+ struct hostapd_config *conf = hapd->iface->conf;
+ struct hostapd_hw_modes *mode = hapd->iface->current_mode;
+
+ if (mode && conf->ieee80211ac && !hapd->conf->disable_11ac) {
+ mcs_map = mode->vht_mcs_set[4] | \
+ (mode->vht_mcs_set[5] << 8);
+ vht_supported = 1;
+ }
+ if (mode && conf->ieee80211n && !hapd->conf->disable_11n) {
+ mcs_set = mode->mcs_set;
+ ht_supported = 1;
+ }
+ }
+ if (ht_supported && mcs_set != NULL) {
+ if (mcs_set[0])
+ ht_rx_nss++;
+ if (mcs_set[1])
+ ht_rx_nss++;
+ if (mcs_set[2])
+ ht_rx_nss++;
+ if (mcs_set[3])
+ ht_rx_nss++;
+ }
+ if (vht_supported) {
+ for (i = 7; i >= 0; i--) {
+ mcs = (mcs_map >> (2 * i)) & 0x03;
+ if (mcs != 0x03) {
+ vht_rx_nss = i + 1;
+ break;
+ }
+ }
+ }
+
+ return ht_rx_nss > vht_rx_nss ? ht_rx_nss : vht_rx_nss;
+}
+
+
+static u8 hostapd_htmaxmcs(const u8 *mcs_set)
+{
+ u8 rates[WLAN_SUPP_RATES_MAX];
+ u8 i;
+ u8 j = 0;
+
+ for (i = 0; i < WLAN_SUPP_HT_RATES_MAX; i++) {
+ if (mcs_set[i / 8] & (1 << (i % 8)))
+ rates[j++] = i;
+ if (j == WLAN_SUPP_RATES_MAX) {
+ wpa_printf(MSG_INFO,
+ "HT extended rate set too large; using only %u rates",
+ j);
+ break;
+ }
+ }
+ if (j <= WLAN_SUPP_RATES_MAX)
+ return rates[j - 1];
+
+ return 0;
+}
+
+
+static u8 hostapd_vhtmaxmcs(u16 rx_vht_mcs_map, u16 tx_vht_mcs_map)
+{
+ u8 rx_max_mcs, tx_max_mcs, max_mcs;
+
+ if (rx_vht_mcs_map && tx_vht_mcs_map) {
+ /* Refer to IEEE P802.11ac/D7.0 Figure 8-401bs
+ * for VHT MCS Map definition
+ */
+ rx_max_mcs = rx_vht_mcs_map & 0x03;
+ tx_max_mcs = tx_vht_mcs_map & 0x03;
+ max_mcs = rx_max_mcs < tx_max_mcs ? rx_max_mcs : tx_max_mcs;
+ if (max_mcs < 0x03)
+ return 7 + max_mcs;
+ }
+
+ return 0;
+}
+
+
static int hostapd_get_sta_info(struct hostapd_data *hapd,
struct sta_info *sta,
char *buf, size_t buflen)
@@ -161,6 +262,38 @@ static int hostapd_get_sta_info(struct
len += ret;
}
+ ret = os_snprintf(buf + len, buflen - len, "max_nss=%u\n",
+ hostapd_maxnss(hapd, sta));
+ if (!os_snprintf_error(buflen - len, ret))
+ len += ret;
+
+#ifdef CONFIG_IEEE80211AC
+ if ((sta->flags & WLAN_STA_VHT) && sta->vht_capabilities) {
+ u8 vht_maxmcs = hostapd_vhtmaxmcs(
+ le_to_host16(sta->vht_capabilities->
+ vht_supported_mcs_set.rx_map),
+ le_to_host16(sta->vht_capabilities->
+ vht_supported_mcs_set.tx_map));
+ ret = os_snprintf(buf + len, buflen - len, "max_vhtmcs=%u\n",
+ vht_maxmcs);
+ if (!os_snprintf_error(buflen - len, ret))
+ len += ret;
+ }
+#endif /* CONFIG_IEEE80211AC */
+
+#ifdef CONFIG_IEEE80211N
+ if ((sta->flags & (WLAN_STA_HT | WLAN_STA_VHT)) == WLAN_STA_HT &&
+ sta->ht_capabilities) {
+ u8 ht_maxmcs;
+
+ ht_maxmcs = hostapd_htmaxmcs(sta->ht_capabilities->
+ supported_mcs_set);
+ ret = os_snprintf(buf + len, buflen - len, "max_mcs=%u\n",
+ ht_maxmcs);
+ if (!os_snprintf_error(buflen - len, ret))
+ len += ret;
+ }
+#endif /* CONFIG_IEEE80211N */
return len;
}
@@ -798,6 +931,20 @@ int hostapd_ctrl_iface_status(struct hos
if (os_snprintf_error(buflen - len, ret))
return len;
len += ret;
+
+ if (mode) {
+ u16 rxmap = mode->vht_mcs_set[0] |
+ (mode->vht_mcs_set[1] << 8);
+ u16 txmap = mode->vht_mcs_set[4] |
+ (mode->vht_mcs_set[5] << 8);
+
+ ret = os_snprintf(buf + len, buflen - len,
+ "vht_max_mcs=%u\n",
+ hostapd_vhtmaxmcs(rxmap, txmap));
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ }
}
if (iface->conf->ieee80211n && !hapd->conf->disable_11n) {
@@ -832,8 +979,33 @@ int hostapd_ctrl_iface_status(struct hos
if (os_snprintf_error(buflen - len, ret))
return len;
len += ret;
+
+ if (mode) {
+ ret = os_snprintf(buf + len, buflen - len,
+ "max_mcs=%u\n",
+ hostapd_htmaxmcs(mode->mcs_set));
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ }
}
+ if (mode && mode->rates && mode->num_rates &&
+ mode->num_rates <= WLAN_SUPP_RATES_MAX) {
+ ret = os_snprintf(buf + len, buflen - len,
+ "max_rate=%u\n",
+ mode->rates[mode->num_rates - 1]);
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ }
+
+ ret = os_snprintf(buf + len, buflen - len, "max_nss=%u\n",
+ hostapd_maxnss(hapd, NULL));
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+
for (j = 0; mode && j < mode->num_channels; j++) {
if (mode->channels[j].freq == iface->freq) {
ret = os_snprintf(buf + len, buflen - len,
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -46,6 +46,7 @@
/* Maximum number of supported rates (from both Supported Rates and Extended
* Supported Rates IEs). */
#define WLAN_SUPP_RATES_MAX 32
+#define WLAN_SUPP_HT_RATES_MAX 77
struct hostapd_data;

View File

@@ -1,41 +0,0 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4235,6 +4235,8 @@ static int hostapd_config_fill(struct ho
} else if (os_strcmp(buf, "wowlan_triggers") == 0) {
os_free(bss->wowlan_triggers);
bss->wowlan_triggers = os_strdup(pos);
+ } else if (os_strcmp(buf, "disable_40mhz_scan") == 0) {
+ conf->disable_40mhz_scan = atoi(pos);
#ifdef CONFIG_FST
} else if (os_strcmp(buf, "fst_group_id") == 0) {
size_t len = os_strlen(pos);
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1018,6 +1018,7 @@ struct hostapd_config {
} *acs_chan_bias;
unsigned int num_acs_chan_bias;
#endif /* CONFIG_ACS */
+ int disable_40mhz_scan;
struct wpabuf *lci;
struct wpabuf *civic;
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -696,9 +696,14 @@ int hostapd_check_ht_capab(struct hostap
!ieee80211ac_supported_vht_capab(iface))
return -1;
#endif /* CONFIG_IEEE80211AC */
- ret = ieee80211n_check_40mhz(iface);
- if (ret)
- return ret;
+ if (!iface->conf->disable_40mhz_scan) {
+ ret = ieee80211n_check_40mhz(iface);
+ if (ret)
+ return ret;
+ } else {
+ wpa_printf(MSG_INFO, "%s:40mhz scan disabled",
+ iface->conf->bss[0]->iface);
+ }
if (!ieee80211n_allowed_ht40_channel_pair(iface))
return -1;

View File

@@ -1,53 +0,0 @@
From 1737f5a14528e32df1806471222176e507728fe0 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Fri, 3 May 2019 08:16:44 +0200
Subject: [PATCH] update nl80211.h
Sync with mac80211-next.git include/uapi/linux/nl80211.h
This brings in nl80211 definitions as of 2019-06-19.
Signed-off-by: John Crispin <john@phrozen.org>
---
src/drivers/nl80211_copy.h | 75 +++++++++++++++++++++++-----------------------
1 file changed, 37 insertions(+), 38 deletions(-)
Index: hostapd-2021-02-08/src/drivers/nl80211_copy.h
===================================================================
--- hostapd-2021-02-08.orig/src/drivers/nl80211_copy.h
+++ hostapd-2021-02-08/src/drivers/nl80211_copy.h
@@ -4541,6 +4541,10 @@ enum nl80211_chan_width {
NL80211_CHAN_WIDTH_4,
NL80211_CHAN_WIDTH_8,
NL80211_CHAN_WIDTH_16,
+
+ /* keep last */
+ __NL80211_CHAN_WIDTH_NUM,
+ NL80211_CHAN_WIDTH_MAX = __NL80211_CHAN_WIDTH_NUM - 1,
};
/**
Index: hostapd-2021-02-08/src/ap/dfs.c
===================================================================
--- hostapd-2021-02-08.orig/src/ap/dfs.c
+++ hostapd-2021-02-08/src/ap/dfs.c
@@ -1051,13 +1051,17 @@ static int hostapd_dfs_testmode_set_beac
iface->conf->hw_mode,
iface->freq,
iface->conf->channel,
+ iface->conf->enable_edmg,
+ iface->conf->edmg_channel,
iface->conf->ieee80211n,
iface->conf->ieee80211ac,
+ iface->conf->ieee80211ax,
secondary_channel,
- iface->conf->vht_oper_chwidth,
+ hostapd_get_oper_chwidth(iface->conf),
vht_oper_centr_freq_seg0_idx,
vht_oper_centr_freq_seg1_idx,
- iface->current_mode->vht_capab);
+ iface->current_mode->vht_capab,
+ &iface->current_mode->he_capab[IEEE80211_MODE_AP]);
if (err) {
wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");

View File

@@ -1,11 +0,0 @@
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2653,7 +2653,7 @@ skip_ht40:
if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq,
freq->channel, ssid->enable_edmg,
ssid->edmg_channel, freq->ht_enabled,
- vht_freq.vht_enabled, freq->he_enabled,
+ vht_freq.vht_enabled, vht_freq.he_enabled,
freq->sec_channel_offset,
chwidth, seg0, seg1, vht_caps,
&mode->he_capab[ieee80211_mode]) != 0)

View File

@@ -1,370 +0,0 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4143,10 +4143,12 @@ static int hostapd_config_fill(struct ho
#ifdef CONFIG_MBO
} else if (os_strcmp(buf, "mbo") == 0) {
bss->mbo_enabled = atoi(pos);
- } else if (os_strcmp(buf, "mbo_cell_data_conn_pref") == 0) {
- bss->mbo_cell_data_conn_pref = atoi(pos);
+ } else if (os_strcmp(buf, "mbo_ap_cap_ind") == 0) {
+ bss->mbo_ap_cap_ind = atoi(pos);
} else if (os_strcmp(buf, "oce") == 0) {
bss->oce = atoi(pos);
+ } else if (os_strcmp(buf, "mbo_cell_data_conn_pref") == 0) {
+ bss->mbo_cell_data_conn_pref = atoi(pos);
#endif /* CONFIG_MBO */
#ifdef CONFIG_TESTING_OPTIONS
#define PARSE_TEST_PROBABILITY(_val) \
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -882,10 +882,11 @@ static int hostapd_ctrl_iface_bss_tm_req
if (pos) {
pos += 10;
req_mode |= WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED;
- /* TODO: TSF configurable/learnable */
+ /* TODO: TSF learnable */
bss_term_dur[0] = 4; /* Subelement ID */
bss_term_dur[1] = 10; /* Length */
- os_memset(&bss_term_dur[2], 0, 8);
+ bss_term_dur[2] = atoi(pos); /* TSF */
+ os_memset(&bss_term_dur[3], 0, 7);
end = os_strchr(pos, ',');
if (end == NULL) {
wpa_printf(MSG_DEBUG, "Invalid bss_term data");
@@ -895,7 +896,7 @@ static int hostapd_ctrl_iface_bss_tm_req
WPA_PUT_LE16(&bss_term_dur[10], atoi(end));
}
- nei_len = ieee802_11_parse_candidate_list(cmd, nei_rep,
+ nei_len = ieee802_11_parse_candidate_list(cmd, sta, nei_rep,
sizeof(nei_rep));
if (nei_len < 0)
return -1;
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -714,6 +714,11 @@ struct hostapd_bss_config {
* - Set BIT(2) to enable OCE in AP mode
*/
unsigned int oce;
+ /**
+ * Set BIT(6) to advertise cellular data aware capability
+ * in AP mode
+ */
+ unsigned int mbo_ap_cap_ind;
int mbo_cell_data_conn_pref;
#endif /* CONFIG_MBO */
--- a/src/ap/gas_serv.c
+++ b/src/ap/gas_serv.c
@@ -19,6 +19,7 @@
#include "dpp_hostapd.h"
#include "sta_info.h"
#include "gas_serv.h"
+#include "neighbor_db.h"
#ifdef CONFIG_DPP
@@ -603,6 +604,28 @@ static void anqp_add_domain_name(struct
}
}
+static void anqp_add_neighbor_report(struct hostapd_data *hapd,
+ struct wpabuf *buf)
+{
+ if (anqp_add_override(hapd, buf, ANQP_NEIGHBOR_REPORT))
+ return;
+
+ if (hapd->conf->radio_measurements[0] &
+ WLAN_RRM_CAPS_NEIGHBOR_REPORT) {
+ u8* len, *nei_len;
+ len = gas_anqp_add_element(buf, ANQP_NEIGHBOR_REPORT);
+ wpabuf_put_u8(buf, WLAN_EID_NEIGHBOR_REPORT);
+ nei_len = (u8 *)wpabuf_put(buf, 1);
+
+ if (hostapd_prepare_neighbor_buf(hapd, hapd->own_addr,
+ buf)) {
+ buf->used -= 2;
+ return;
+ }
+ *nei_len = ((u8 *)wpabuf_put(buf, 0) - nei_len - 1);
+ gas_anqp_set_element_len(buf, len);
+ }
+}
#ifdef CONFIG_FILS
static void anqp_add_fils_realm_info(struct hostapd_data *hapd,
@@ -1028,6 +1051,8 @@ gas_serv_build_gas_resp_payload(struct h
anqp_add_elem(hapd, buf, ANQP_TDLS_CAPABILITY);
if (request & ANQP_REQ_EMERGENCY_NAI)
anqp_add_elem(hapd, buf, ANQP_EMERGENCY_NAI);
+ if (request & ANQP_REQ_NEIGHBOR_REPORT)
+ anqp_add_neighbor_report(hapd, buf);
for (i = 0; i < num_extra_req; i++) {
#ifdef CONFIG_FILS
@@ -1172,6 +1197,12 @@ static void rx_anqp_query_list_id(struct
"Emergency NAI",
get_anqp_elem(hapd, info_id) != NULL, qi);
break;
+ case ANQP_NEIGHBOR_REPORT:
+ set_anqp_req(ANQP_REQ_NEIGHBOR_REPORT,
+ "Neighbor report",
+ (hapd->conf->radio_measurements[0] &
+ WLAN_RRM_CAPS_NEIGHBOR_REPORT), qi);
+ break;
default:
#ifdef CONFIG_FILS
if (info_id == ANQP_FILS_REALM_INFO &&
--- a/src/ap/gas_serv.h
+++ b/src/ap/gas_serv.h
@@ -40,6 +40,8 @@
(1 << (ANQP_TDLS_CAPABILITY - ANQP_QUERY_LIST))
#define ANQP_REQ_EMERGENCY_NAI \
(1 << (ANQP_EMERGENCY_NAI - ANQP_QUERY_LIST))
+#define ANQP_REQ_NEIGHBOR_REPORT \
+ (1 << (ANQP_NEIGHBOR_REPORT - ANQP_QUERY_LIST))
/*
* First 15 Hotspot 2.0 vendor specific ANQP-elements can be included in the
* optimized bitmap.
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -132,6 +132,9 @@ static inline void sae_clear_retransmit_
}
#endif /* CONFIG_SAE */
+u8 * hostapd_eid_rm_enabled_capab(struct hostapd_data *hapd,
+ u8 *eid, size_t len);
+
#ifdef CONFIG_MBO
u8 * hostapd_eid_mbo(struct hostapd_data *hapd, u8 *eid, size_t len);
--- a/src/ap/ieee802_11_shared.c
+++ b/src/ap/ieee802_11_shared.c
@@ -801,11 +801,13 @@ u8 * hostapd_eid_mbo(struct hostapd_data
!OCE_STA_CFON_ENABLED(hapd) && !OCE_AP_ENABLED(hapd))
return eid;
- if (hapd->conf->mbo_enabled) {
+ if (hapd->conf->mbo_enabled && hapd->conf->oce & OCE_AP) {
*mbo_pos++ = MBO_ATTR_ID_AP_CAPA_IND;
*mbo_pos++ = 1;
- /* Not Cellular aware */
- *mbo_pos++ = 0;
+ if (hapd->conf->mbo_ap_cap_ind & MBO_AP_CAPA_CELL_AWARE)
+ *mbo_pos++ = MBO_AP_CAPA_CELL_AWARE;
+ else
+ *mbo_pos++ = 0;
}
if (hapd->conf->mbo_enabled && hapd->mbo_assoc_disallow) {
--- a/src/ap/neighbor_db.c
+++ b/src/ap/neighbor_db.c
@@ -160,6 +160,24 @@ fail:
return -1;
}
+int hostapd_prepare_neighbor_buf(struct hostapd_data *hapd,
+ const u8 *bssid, struct wpabuf *nrbuf)
+{
+ struct hostapd_neighbor_entry *nr;
+
+ nr = hostapd_neighbor_get(hapd, bssid, NULL);
+ if (!nr)
+ return -1;
+
+ if (wpabuf_tailroom(nrbuf) < wpabuf_len(nr->nr)) {
+ wpa_printf(MSG_ERROR,
+ "Invalid buf size for Neighbor Report\n");
+ return -1;
+ }
+
+ wpabuf_put_buf(nrbuf, nr->nr);
+ return 0;
+}
int hostapd_neighbor_remove(struct hostapd_data *hapd, const u8 *bssid,
const struct wpa_ssid_value *ssid)
--- a/src/ap/neighbor_db.h
+++ b/src/ap/neighbor_db.h
@@ -19,6 +19,8 @@ int hostapd_neighbor_set(struct hostapd_
const struct wpabuf *nr, const struct wpabuf *lci,
const struct wpabuf *civic, int stationary);
void hostapd_neighbor_set_own_report(struct hostapd_data *hapd);
+int hostapd_prepare_neighbor_buf(struct hostapd_data *hapd,
+ const u8 *bssid, struct wpabuf *nrbuf);
int hostapd_neighbor_remove(struct hostapd_data *hapd, const u8 *bssid,
const struct wpa_ssid_value *ssid);
void hostapd_free_neighbor_db(struct hostapd_data *hapd);
--- a/src/ap/wnm_ap.c
+++ b/src/ap/wnm_ap.c
@@ -20,6 +20,7 @@
#include "ap/wpa_auth.h"
#include "mbo_ap.h"
#include "wnm_ap.h"
+#include "neighbor_db.h"
#define MAX_TFS_IE_LEN 1024
@@ -366,11 +367,27 @@ static int ieee802_11_send_bss_trans_mgm
u8 dialog_token)
{
struct ieee80211_mgmt *mgmt;
- size_t len;
+ size_t len, nr_len = 0;
u8 *pos;
+ u8 req_mode = 0;
int res;
- mgmt = os_zalloc(sizeof(*mgmt));
+#ifdef CONFIG_MBO
+ u8 *nr_pos;
+ struct hostapd_neighbor_entry *nr;
+ struct wpabuf *nrbuf = NULL;
+ if (hapd->conf->mbo_enabled) {
+ dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry,
+ list)
+ /* ID and length */
+ nr_len += wpabuf_len(nr->nr) + 1 + 1;
+
+ nrbuf = wpabuf_alloc(nr_len);
+ if (nrbuf == NULL)
+ return -1;
+ }
+#endif
+ mgmt = os_zalloc(sizeof(*mgmt) + nr_len);
if (mgmt == NULL)
return -1;
os_memcpy(mgmt->da, addr, ETH_ALEN);
@@ -381,7 +398,11 @@ static int ieee802_11_send_bss_trans_mgm
mgmt->u.action.category = WLAN_ACTION_WNM;
mgmt->u.action.u.bss_tm_req.action = WNM_BSS_TRANS_MGMT_REQ;
mgmt->u.action.u.bss_tm_req.dialog_token = dialog_token;
- mgmt->u.action.u.bss_tm_req.req_mode = 0;
+#ifdef CONFIG_MBO
+ if (hapd->conf->mbo_enabled)
+ req_mode |= WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED;
+#endif
+ mgmt->u.action.u.bss_tm_req.req_mode = req_mode;
mgmt->u.action.u.bss_tm_req.disassoc_timer = host_to_le16(0);
mgmt->u.action.u.bss_tm_req.validity_interval = 1;
pos = mgmt->u.action.u.bss_tm_req.variable;
@@ -394,6 +415,25 @@ static int ieee802_11_send_bss_trans_mgm
le_to_host16(mgmt->u.action.u.bss_tm_req.disassoc_timer),
mgmt->u.action.u.bss_tm_req.validity_interval);
+#ifdef CONFIG_MBO
+ if (hapd->conf->mbo_enabled) {
+ dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry,
+ list) {
+ wpabuf_put_u8(nrbuf, WLAN_EID_NEIGHBOR_REPORT);
+ /* Length to be filled */
+ nr_pos = (u8 *)wpabuf_put(nrbuf, 1);
+ if (hostapd_prepare_neighbor_buf(hapd, nr->bssid,
+ nrbuf) < 0) {
+ res = -1;
+ }
+ /* Fill in the length field */
+ *nr_pos = ((u8 *)wpabuf_put(nrbuf, 0) - nr_pos - 1);
+ }
+ os_memcpy(pos, nrbuf->buf, nr_len);
+ pos += nr_len;
+ wpabuf_free(nrbuf);
+ }
+#endif
len = pos - &mgmt->u.action.category;
res = hostapd_drv_send_action(hapd, hapd->iface->freq, 0,
mgmt->da, &mgmt->u.action.category, len);
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -2290,11 +2290,21 @@ bool is_6ghz_psc_frequency(int freq)
}
-int ieee802_11_parse_candidate_list(const char *pos, u8 *nei_rep,
- size_t nei_rep_len)
+int ieee802_11_parse_candidate_list(const char *pos, struct sta_info *sta,
+ u8 *nei_rep, size_t nei_rep_len)
{
u8 *nei_pos = nei_rep;
const char *end;
+#ifdef CONFIG_MBO
+ u8 non_pref_chan = 0;
+ u8 *pref_pos = NULL;
+ int i;
+
+ struct mbo_non_pref_chan_info *info = NULL;
+
+ if (sta && sta->non_pref_chan)
+ info = sta->non_pref_chan;
+#endif
/*
* BSS Transition Candidate List Entries - Neighbor Report elements
@@ -2350,6 +2360,9 @@ int ieee802_11_parse_candidate_list(cons
pos++;
*nei_pos++ = atoi(pos); /* Channel Number */
+#ifdef CONFIG_MBO
+ non_pref_chan = atoi(pos);
+#endif
pos = os_strchr(pos, ',');
if (pos == NULL) {
wpa_printf(MSG_DEBUG, "Missing PHY Type");
@@ -2381,6 +2394,25 @@ int ieee802_11_parse_candidate_list(cons
"Invalid neighbor subelement info");
return -1;
}
+#ifdef CONFIG_MBO
+ if (info) {
+ for (i = 0; i < (len / 2); i++)
+ if (nei_pos[i] == WNM_NEIGHBOR_BSS_TRANSITION_CANDIDATE &&
+ nei_pos[i + 1] == 0x1) /* length */
+ pref_pos = (nei_pos + i + 2);
+
+ /* If STA had updated MBO non-pref chan report,
+ * use the same candidate preference value in the
+ * BSS Transition Candidate sub-element.
+ */
+ for ( ; info ; info = info->next)
+ for (i = 0; i < info->num_channels; i++)
+ if (non_pref_chan == info->channels[i])
+ *pref_pos = info->pref;
+
+ info = sta->non_pref_chan;
+ }
+#endif
nei_pos += len / 2;
pos = end;
}
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -11,6 +11,7 @@
#include "defs.h"
#include "ieee802_11_defs.h"
+#include "ap/sta_info.h"
struct element {
u8 id;
@@ -265,8 +266,8 @@ bool is_6ghz_freq(int freq);
bool is_6ghz_op_class(u8 op_class);
bool is_6ghz_psc_frequency(int freq);
-int ieee802_11_parse_candidate_list(const char *pos, u8 *nei_rep,
- size_t nei_rep_len);
+int ieee802_11_parse_candidate_list(const char *pos, struct sta_info *sta,
+ u8 *nei_rep, size_t nei_rep_len);
int ieee802_11_ext_capab(const u8 *ie, unsigned int capab);
int op_class_to_bandwidth(u8 op_class);
--- a/wpa_supplicant/wnm_sta.c
+++ b/wpa_supplicant/wnm_sta.c
@@ -1630,7 +1630,7 @@ int wnm_send_bss_transition_mgmt_query(s
return ret;
}
- ret = ieee802_11_parse_candidate_list(btm_candidates,
+ ret = ieee802_11_parse_candidate_list(btm_candidates, NULL,
wpabuf_put(buf, 0),
max_len);
if (ret < 0) {

View File

@@ -1,30 +0,0 @@
From 950186814b355d91bcb15ce544eed6f5727da791 Mon Sep 17 00:00:00 2001
From: Lavanya Suresh <lavaks@codeaurora.org>
Date: Tue, 17 Nov 2020 19:23:46 +0530
Subject: [PATCH] hostapd: Add channel width config in htcapab for 40MHz
HT Support Channel Width field needs to be set in HT capabilities for
40MHz BW operation.
Signed-off-by: Lavanya Suresh <lavaks@codeaurora.org>
---
src/ap/hostapd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index be9ef82..346d83c 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3532,6 +3532,9 @@ static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
if (!iface || !iface->freq || hapd->csa_in_progress)
return -1;
+ if (settings->freq_params.bandwidth != 20)
+ hapd->iconf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+
switch (settings->freq_params.bandwidth) {
case 80:
if (settings->freq_params.center_freq2)
--
2.7.4

View File

@@ -1,63 +0,0 @@
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config_ssid.h
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/config_ssid.h
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config_ssid.h
@@ -1124,7 +1124,6 @@ struct wpa_ssid {
* FT initial mobility domain association.
*/
int ft_eap_pmksa_caching;
-
/**
* beacon_prot - Whether Beacon protection is enabled
*
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
@@ -2578,16 +2578,14 @@ void ibss_mesh_setup_freq(struct wpa_sup
return;
/* Allow HE on 2.4 GHz without VHT: see nl80211_put_freq_params() */
- if (is_24ghz)
- freq->he_enabled = mode->he_capab[ieee80211_mode].he_supported;
+ if (is_24ghz) {
#ifdef CONFIG_HE_OVERRIDES
- if (is_24ghz && ssid->disable_he)
- freq->he_enabled = 0;
+ if (ssid->disable_he)
+ freq->he_enabled = 0;
+ else
#endif /* CONFIG_HE_OVERRIDES */
-
- /* Setup higher BW only for 5 GHz */
- if (mode->mode != HOSTAPD_MODE_IEEE80211A && !(ssid->noscan))
- return;
+ freq->he_enabled = mode->he_capab[ieee80211_mode].he_supported;
+ }
for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) {
pri_chan = &mode->channels[chan_idx];
@@ -2677,6 +2675,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
wpa_scan_results_free(scan_res);
}
+#ifdef CONFIG_HE_OVERRIDES
+skip_vht80:
+ if (ssid->disable_he)
+ vht_freq.he_enabled = 0;
+#endif /* CONFIG_HE_OVERRIDES */
#ifdef CONFIG_HT_OVERRIDES
skip_ht40:
@@ -2711,6 +2714,11 @@ skip_to_6ghz:
/* Enable HE with VHT for 5 GHz */
freq->he_enabled = mode->he_capab[ieee80211_mode].he_supported;
+#ifdef CONFIG_HE_OVERRIDES
+ if (is_24ghz)
+ goto skip_vht80;
+#endif /* CONFIG_HE_OVERRIDES */
+
/* setup center_freq1, bandwidth */
for (j = 0; j < ARRAY_SIZE(bw80); j++) {
if (freq->freq >= bw80[j] &&

View File

@@ -1,83 +0,0 @@
From ed93959f61e103703d04b85351eed7a1c4fe644b Mon Sep 17 00:00:00 2001
From: Karthikeyan Kathirvel <kathirve@codeaurora.org>
Date: Fri, 28 Aug 2020 14:16:10 +0530
Subject: [PATCH] hostapd: Fixed compilation warnings
Below warnings are fixed
Uninitialized and redefined macro warnings has been fixed
../src/crypto/sha1-internal.c:152:0: error: "R3" redefined [-Werror]
#define R3(v,w,x,y,z,i) \
^
In file included from qsdk/staging_dir/toolchain-arm_cortex-a7_gcc-5.2.0_uClibc-1.0.14_eabi/include/signal.h:358:0,
from qsdk/build_dir/target-arm_cortex-a7_uClibc-1.0.14_eabi/hostapd-supplicant-full/hostapd-2021-12-13/src/utils/includes.h:26,
from ../src/crypto/sha1-internal.c:9:
qsdk/staging_dir/toolchain-arm_cortex-a7_gcc-5.2.0_uClibc-1.0.14_eabi/include/sys/ucontext.h:49:0:
note: this is the location of the previous definition
#define R3 R3
Signed-off-by: Karthikeyan Kathirvel <kathirve@codeaurora.org>
---
src/ap/ieee802_11.c | 2 +-
src/ap/wpa_auth.c | 4 ++++
src/rsn_supp/wpa.c | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4859,7 +4859,7 @@ static int wpa_driver_nl80211_sta_add(vo
if (params->he_capab) {
wpa_hexdump(MSG_DEBUG, " * he_capab",
- params->he_capab, params->he_capab_len);
+ (u8 *) params->he_capab, params->he_capab_len);
if (nla_put(msg, NL80211_ATTR_HE_CAPABILITY,
params->he_capab_len, params->he_capab))
goto fail;
--- a/src/tls/tlsv1_client_ocsp.c
+++ b/src/tls/tlsv1_client_ocsp.c
@@ -322,7 +322,7 @@ tls_process_ocsp_responses(struct tlsv1_
{
struct asn1_hdr hdr;
const u8 *pos, *end;
- enum tls_ocsp_result res;
+ enum tls_ocsp_result res = TLS_OCSP_NO_RESPONSE;
pos = resp;
end = resp + len;
--- a/src/crypto/sha1-internal.c
+++ b/src/crypto/sha1-internal.c
@@ -141,17 +141,32 @@ A million repetitions of "a"
block->l[(i + 8) & 15] ^ block->l[(i + 2) & 15] ^ block->l[i & 15], 1))
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
+#ifdef R0
+#undef R0
+#endif
#define R0(v,w,x,y,z,i) \
z += ((w & (x ^ y)) ^ y) + blk0(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);
+#ifdef R1
+#undef R1
+#endif
#define R1(v,w,x,y,z,i) \
z += ((w & (x ^ y)) ^ y) + blk(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);
+#ifdef R2
+#undef R2
+#endif
#define R2(v,w,x,y,z,i) \
z += (w ^ x ^ y) + blk(i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30);
+#ifdef R3
+#undef R3
+#endif
#define R3(v,w,x,y,z,i) \
z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + rol(v, 5); \
w = rol(w, 30);
+#ifdef R4
+#undef R4
+#endif
#define R4(v,w,x,y,z,i) \
z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + rol(v, 5); \
w=rol(w, 30);

View File

@@ -1,291 +0,0 @@
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -1785,6 +1785,39 @@ static void hostapd_event_wds_sta_interf
ifname, MAC2STR(addr));
}
+static void hostapd_event_update_muedca_params(struct hostapd_data *hapd,
+ struct update_muedca *params)
+{
+ int i;
+ u8 updated_count;
+
+ /* Update current MU-EDCA parameters */
+ for (i = 0; i < 3; i++) {
+ hapd->iface->conf->he_mu_edca.he_mu_ac_be_param[i] =
+ params->he_mu_ac_be_param[i];
+ hapd->iface->conf->he_mu_edca.he_mu_ac_bk_param[i] =
+ params->he_mu_ac_bk_param[i];
+ hapd->iface->conf->he_mu_edca.he_mu_ac_vo_param[i] =
+ params->he_mu_ac_vo_param[i];
+ hapd->iface->conf->he_mu_edca.he_mu_ac_vi_param[i] =
+ params->he_mu_ac_vi_param[i];
+ }
+
+ /* Increment Parameter Set Update Count for MU-EDCA and WME EDCA only
+ * if any STA is connected
+ */
+ if (hapd->num_sta) {
+ updated_count = (hapd->iface->conf->he_mu_edca.he_qos_info + 1) & 0xf;
+ hapd->iface->conf->he_mu_edca.he_qos_info &= 0xf0;
+ hapd->iface->conf->he_mu_edca.he_qos_info |= updated_count;
+ hapd->parameter_set_count++;
+ }
+
+ /* Update beacon with updated MU-EDCA parameters */
+ if (ieee802_11_update_beacons(hapd->iface))
+ wpa_printf(MSG_DEBUG,
+ "Failed to update beacons with MU-EDCA parameters");
+}
#ifdef CONFIG_OWE
static int hostapd_notif_update_dh_ie(struct hostapd_data *hapd,
@@ -2093,6 +2126,9 @@ void hostapd_wpa_event(void *ctx, enum w
data->wds_sta_interface.ifname,
data->wds_sta_interface.sta_addr);
break;
+ case EVENT_UPDATE_MUEDCA_PARAMS:
+ hostapd_event_update_muedca_params(hapd, &data->update_muedca);
+ break;
default:
wpa_printf(MSG_DEBUG, "Unknown event %d", event);
break;
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5135,6 +5135,15 @@ enum wpa_event_type {
* is required to provide more details of the frame.
*/
EVENT_UNPROT_BEACON,
+
+ /**
+ * EVENT_UPDATE_MUEDCA_PARAMS - Updated MU-EDCA parameters received
+ *
+ * This event is emitted when updated MU-EDCA parameters from driver
+ * are received. Updated MU-EDCA parameters need to be updated in
+ * beacon.
+ */
+ EVENT_UPDATE_MUEDCA_PARAMS,
};
@@ -6027,6 +6036,16 @@ union wpa_event_data {
struct unprot_beacon {
const u8 *sa;
} unprot_beacon;
+
+ /**
+ * struct update_muedca - Data for EVENT_UPDATE_MU_EDCA_PARAMS
+ */
+ struct update_muedca {
+ u8 he_mu_ac_be_param[3];
+ u8 he_mu_ac_bk_param[3];
+ u8 he_mu_ac_vi_param[3];
+ u8 he_mu_ac_vo_param[3];
+ } update_muedca;
};
/**
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -172,6 +172,8 @@ static const char * nl80211_command_to_s
C2S(NL80211_CMD_UNPROT_BEACON)
C2S(NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS)
C2S(NL80211_CMD_SET_SAR_SPECS)
+ C2S(NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS)
+ C2S(NL80211_CMD_COLOR_CHANGE)
C2S(__NL80211_CMD_AFTER_LAST)
}
#undef C2S
@@ -2797,6 +2799,35 @@ static void nl80211_sta_opmode_change_ev
wpa_supplicant_event(drv->ctx, EVENT_STATION_OPMODE_CHANGED, &ed);
}
+static void nl80211_update_muedca_params_event(struct wpa_driver_nl80211_data *drv,
+ struct nlattr **tb)
+{
+ struct host_update_muedca {
+ u8 mu_qos_info;
+ u8 ac_be[3];
+ u8 ac_bk[3];
+ u8 ac_vi[3];
+ u8 ac_vo[3];
+ };
+
+ struct host_update_muedca *rx_muedca_params;
+ union wpa_event_data ed;
+ int i;
+
+ if (!tb[NL80211_ATTR_HE_MUEDCA_PARAMS])
+ return;
+
+ rx_muedca_params = nla_data(tb[NL80211_ATTR_HE_MUEDCA_PARAMS]);
+
+ for (i = 0; i< 3; i++) {
+ ed.update_muedca.he_mu_ac_be_param[i] = rx_muedca_params->ac_be[i];
+ ed.update_muedca.he_mu_ac_bk_param[i] = rx_muedca_params->ac_bk[i];
+ ed.update_muedca.he_mu_ac_vi_param[i] = rx_muedca_params->ac_vi[i];
+ ed.update_muedca.he_mu_ac_vo_param[i] = rx_muedca_params->ac_vo[i];
+ }
+
+ wpa_supplicant_event(drv->ctx, EVENT_UPDATE_MUEDCA_PARAMS, &ed);
+}
static void nl80211_control_port_frame(struct wpa_driver_nl80211_data *drv,
struct nlattr **tb)
@@ -2854,7 +2885,6 @@ nl80211_control_port_frame_tx_status(str
wpa_supplicant_event(drv->ctx, EVENT_EAPOL_TX_STATUS, &event);
}
-
static void do_process_drv_event(struct i802_bss *bss, int cmd,
struct nlattr **tb)
{
@@ -3101,6 +3131,9 @@ static void do_process_drv_event(struct
tb[NL80211_ATTR_ACK],
tb[NL80211_ATTR_COOKIE]);
break;
+ case NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS:
+ nl80211_update_muedca_params_event(drv, tb);
+ break;
default:
wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event "
"(cmd=%d)", cmd);
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -1185,6 +1185,11 @@
* passed using %NL80211_ATTR_SAR_SPEC. %NL80211_ATTR_WIPHY is used to
* specify the wiphy index to be applied to.
*
+ * @NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS: Updated MU-EDCA parameters from driver.
+ * This event is used to update MU-EDCA parameters in Beacon frame, which
+ * were indicated by driver and now need to be reflected in
+ * Beacon frame.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -1417,6 +1422,7 @@ enum nl80211_commands {
NL80211_CMD_SET_SAR_SPECS,
+ NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS,
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -2560,6 +2566,9 @@ enum nl80211_commands {
* disassoc events to indicate that an immediate reconnect to the AP
* is desired.
*
+ * @NL80211_ATTR_HE_MUEDCA_PARAMS: MU-EDCA AC parameters for the
+ NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS command.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3057,6 +3066,7 @@ enum nl80211_attrs {
NL80211_ATTR_DISABLE_HE,
+ NL80211_ATTR_HE_MUEDCA_PARAMS,
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
--- a/src/drivers/driver_common.c
+++ b/src/drivers/driver_common.c
@@ -90,6 +90,7 @@ const char * event_to_string(enum wpa_ev
E2S(WDS_STA_INTERFACE_STATUS);
E2S(UPDATE_DH);
E2S(UNPROT_BEACON);
+ E2S(UPDATE_MUEDCA_PARAMS);
}
return "UNKNOWN";
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3585,6 +3585,10 @@ static int hostapd_fill_csa_settings(str
hapd->cs_count = settings->cs_count;
hapd->cs_block_tx = settings->block_tx;
+ /* reset MU-EDCA and WME EDCA parameter set count */
+ hapd->iface->conf->he_mu_edca.he_qos_info &= 0xfff0;
+ hapd->parameter_set_count = 0;
+
ret = hostapd_build_beacon_data(hapd, &settings->beacon_csa);
if (ret) {
free_beacon_data(&settings->beacon_after);
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1545,6 +1545,11 @@ static int hostapd_ctrl_iface_set(struct
} else if (os_strncmp(cmd, "wme_ac_", 7) == 0 ||
os_strncmp(cmd, "wmm_ac_", 7) == 0) {
hapd->parameter_set_count++;
+ /* Incrementing MU-EDCA Parameter Set Update Count*/
+ hapd->iface->conf->he_mu_edca.he_qos_info =
+ (hapd->iface->conf->he_mu_edca.he_qos_info & 0xf0) |
+ ((hapd->iface->conf->he_mu_edca.he_qos_info + 1) &
+ 0xf);
if (ieee802_11_update_beacons(hapd->iface))
wpa_printf(MSG_DEBUG,
"Failed to update beacons with WMM parameters");
--- a/src/ap/wmm.c
+++ b/src/ap/wmm.c
@@ -68,8 +68,8 @@ wmm_set_regulatory_limit(const struct ho
/*
* Calculate WMM regulatory limit if any.
*/
-static void wmm_calc_regulatory_limit(struct hostapd_data *hapd,
- struct hostapd_wmm_ac_params *acp)
+void wmm_calc_regulatory_limit(struct hostapd_data *hapd,
+ struct hostapd_wmm_ac_params *acp)
{
struct hostapd_hw_modes *mode = hapd->iface->current_mode;
int c;
@@ -98,6 +98,10 @@ static void wmm_calc_regulatory_limit(st
os_memcpy(hapd->iface->prev_wmm, acp,
sizeof(hapd->iconf->wmm_ac_params));
hapd->parameter_set_count++;
+ /* Incrementing MU-EDCA Parameter Set Update Count*/
+ hapd->iface->conf->he_mu_edca.he_qos_info =
+ (hapd->iface->conf->he_mu_edca.he_qos_info & 0xf0) |
+ ((hapd->iface->conf->he_mu_edca.he_qos_info + 1) & 0xf);
}
}
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -18,6 +18,7 @@
#include "sta_info.h"
#include "ieee802_11.h"
#include "dfs.h"
+#include "wmm.h"
static u8 ieee80211_he_ppet_size(u8 ppe_thres_hdr, const u8 *phy_cap_info)
{
@@ -266,9 +267,16 @@ u8 * hostapd_eid_he_operation(struct hos
u8 * hostapd_eid_he_mu_edca_parameter_set(struct hostapd_data *hapd, u8 *eid)
{
struct ieee80211_he_mu_edca_parameter_set *edca;
+ struct hostapd_wmm_ac_params wmmp[WMM_AC_NUM];
u8 *pos;
size_t i;
+ /* Updating WME Parameter Set Count to avoid mismatch */
+ os_memset(wmmp, 0, sizeof(wmmp));
+
+ if (hapd->conf->wmm_enabled)
+ wmm_calc_regulatory_limit(hapd, wmmp);
+
pos = (u8 *) &hapd->iface->conf->he_mu_edca;
for (i = 0; i < sizeof(*edca); i++) {
if (pos[i])
--- a/src/ap/wmm.h
+++ b/src/ap/wmm.h
@@ -13,6 +13,8 @@
struct ieee80211_mgmt;
struct wmm_tspec_element;
+void wmm_calc_regulatory_limit(struct hostapd_data *hapd,
+ struct hostapd_wmm_ac_params *acp);
u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid);
int hostapd_eid_wmm_valid(struct hostapd_data *hapd, const u8 *eid,
size_t len);

View File

@@ -1,65 +0,0 @@
From 917653b0674dfacc976e20956e999fef13c6e6ba Mon Sep 17 00:00:00 2001
From: Muna Sinada <msinada@codeaurora.org>
Date: Wed, 29 Jul 2020 09:41:31 -0700
Subject: [PATCH] hostapd:remove 11A specific case to allow for 6 GHz
With 6 GHz utilizing 11A/HE, frequency to channel conversions needed
to accomedate for 6 GHz frequencies in hostapd_event_ch_switch. Removed
5 GHz specific conversions for the 11A case due to incorrect 6 GHz
frequencies being incorrectly being converted in
hostapd_event_ch_switch
Signed-off-by: Muna Sinada <msinada@codeaurora.org>
---
src/ap/drv_callbacks.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -876,7 +876,7 @@ void hostapd_event_ch_switch(struct host
{
#ifdef NEED_AP_MLME
int channel, chwidth, is_dfs;
- u8 seg0_idx = 0, seg1_idx = 0;
+ u8 seg0_idx = 0, seg1_idx = 0, op_class;
size_t i;
hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
@@ -922,27 +922,8 @@ void hostapd_event_ch_switch(struct host
break;
}
- switch (hapd->iface->current_mode->mode) {
- case HOSTAPD_MODE_IEEE80211A:
- if (cf1 == 5935)
- seg0_idx = (cf1 - 5925) / 5;
- else if (cf1 > 5950)
- seg0_idx = (cf1 - 5950) / 5;
- else if (cf1 > 5000)
- seg0_idx = (cf1 - 5000) / 5;
-
- if (cf2 == 5935)
- seg1_idx = (cf2 - 5925) / 5;
- else if (cf2 > 5950)
- seg1_idx = (cf2 - 5950) / 5;
- else if (cf2 > 5000)
- seg1_idx = (cf2 - 5000) / 5;
- break;
- default:
- ieee80211_freq_to_chan(cf1, &seg0_idx);
- ieee80211_freq_to_chan(cf2, &seg1_idx);
- break;
- }
+ ieee80211_freq_to_channel_ext(cf1, offset, chwidth, &op_class, &seg0_idx);
+ ieee80211_freq_to_chan(cf2, &seg1_idx);
hapd->iconf->channel = channel;
hapd->iconf->ieee80211n = ht;
@@ -977,6 +958,7 @@ void hostapd_event_ch_switch(struct host
hostapd_set_oper_chwidth(hapd->iconf, chwidth);
hostapd_set_oper_centr_freq_seg0_idx(hapd->iconf, seg0_idx);
hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, seg1_idx);
+ hapd->iconf->op_class = op_class;
if (hapd->iconf->ieee80211ac) {
hapd->iconf->vht_capab &= ~VHT_CAP_SUPP_CHAN_WIDTH_MASK;
if (chwidth == CHANWIDTH_160MHZ)

View File

@@ -1,142 +0,0 @@
From d4c4ef302f98fd6bce173b8636e7e350d8b44981 Mon Sep 17 00:00:00 2001
From: P Praneesh <ppranees@codeaurora.org>
Date: Fri, 19 Mar 2021 12:17:27 +0530
Subject: [PATCH] hostapd: update cfs0 and cfs1 for 160MHz
As per standard Draft P802.11ax_D8.0,( Table 26-9—Setting
of the VHT Channel Width and VHT NSS at an HE STA
transmitting the OM Control subfield ), center frequency of
160MHz should be published in HT information subset 2 of
HT information when EXT NSS BW field is enabled.
If the supported number of NSS in 160MHz is at least max NSS
support, then center_freq_seg0 indicates the center frequency of 80MHz and
center_freq_seg1 indicates the center frequency of 160MHz.
If the supported number of NSS in 160MHz is less than max NSS
support, then center_freq_seg0 indicates the center frequency of 80MHz and
center_freq_seg1 is 0. The center frequency of 160MHz is published in HT
operation information element instead.
Signed-off-by: P Praneesh <ppranees@codeaurora.org>
---
hostapd/config_file.c | 2 ++
src/ap/ieee802_11_ht.c | 7 +++++++
src/ap/ieee802_11_vht.c | 16 ++++++++++++++++
src/common/hw_features_common.c | 1 +
src/common/ieee802_11_defs.h | 1 +
5 files changed, 27 insertions(+)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1195,6 +1195,8 @@ static int hostapd_config_vht_capab(stru
conf->vht_capab |= VHT_CAP_RX_ANTENNA_PATTERN;
if (os_strstr(capab, "[TX-ANTENNA-PATTERN]"))
conf->vht_capab |= VHT_CAP_TX_ANTENNA_PATTERN;
+ if (os_strstr(capab, "[EXT-NSS-BW-SUPP]"))
+ conf->vht_capab |= VHT_CAP_EXTENDED_NSS_BW_SUPPORT;
return 0;
}
#endif /* CONFIG_IEEE80211AC */
--- a/src/ap/ieee802_11_ht.c
+++ b/src/ap/ieee802_11_ht.c
@@ -82,7 +82,9 @@ u8 * hostapd_eid_ht_capabilities(struct
u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid)
{
struct ieee80211_ht_operation *oper;
+ le32 vht_capabilities_info;
u8 *pos = eid;
+ u8 chwidth;
if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n ||
is_6ghz_op_class(hapd->iconf->op_class))
@@ -103,6 +105,13 @@ u8 * hostapd_eid_ht_operation(struct hos
oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW |
HT_INFO_HT_PARAM_STA_CHNL_WIDTH;
+ vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab);
+ chwidth = hostapd_get_oper_chwidth(hapd->iconf);
+ if (vht_capabilities_info & VHT_CAP_EXTENDED_NSS_BW_SUPPORT
+ && ((chwidth == CHANWIDTH_160MHZ) || (chwidth == CHANWIDTH_80P80MHZ))) {
+ oper->operation_mode = host_to_le16(hapd->iconf->vht_oper_centr_freq_seg0_idx << 5);
+ }
+
pos += sizeof(*oper);
return pos;
--- a/src/ap/ieee802_11_vht.c
+++ b/src/ap/ieee802_11_vht.c
@@ -25,6 +25,7 @@ u8 * hostapd_eid_vht_capabilities(struct
struct ieee80211_vht_capabilities *cap;
struct hostapd_hw_modes *mode = hapd->iface->current_mode;
u8 *pos = eid;
+ u8 chwidth;
if (!mode || is_6ghz_op_class(hapd->iconf->op_class))
return eid;
@@ -62,6 +63,17 @@ u8 * hostapd_eid_vht_capabilities(struct
host_to_le32(nsts << VHT_CAP_BEAMFORMEE_STS_OFFSET);
}
+ chwidth = hostapd_get_oper_chwidth(hapd->iconf);
+ if (((host_to_le32(mode->vht_capab)) & VHT_CAP_EXTENDED_NSS_BW_SUPPORT)
+ && ((chwidth == CHANWIDTH_160MHZ) || (chwidth == CHANWIDTH_80P80MHZ))) {
+ cap->vht_capabilities_info |= VHT_CAP_EXTENDED_NSS_BW_SUPPORT;
+ cap->vht_capabilities_info &= ~(host_to_le32(VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ));
+ cap->vht_capabilities_info &= ~(host_to_le32(VHT_CAP_SUPP_CHAN_WIDTH_160MHZ));
+ cap->vht_capabilities_info &= ~(host_to_le32(VHT_CAP_SUPP_CHAN_WIDTH_MASK));
+ } else {
+ cap->vht_capabilities_info &= ~VHT_CAP_EXTENDED_NSS_BW_SUPPORT_MASK;
+ }
+
/* Supported MCS set comes from hw */
os_memcpy(&cap->vht_supported_mcs_set, mode->vht_mcs_set, 8);
@@ -74,6 +86,7 @@ u8 * hostapd_eid_vht_capabilities(struct
u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
{
struct ieee80211_vht_operation *oper;
+ le32 vht_capabilities_info;
u8 *pos = eid;
if (is_6ghz_op_class(hapd->iconf->op_class))
@@ -96,6 +109,7 @@ u8 * hostapd_eid_vht_operation(struct ho
hapd->iconf->vht_oper_centr_freq_seg1_idx;
oper->vht_op_info_chwidth = hapd->iconf->vht_oper_chwidth;
+ vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab);
if (hapd->iconf->vht_oper_chwidth == 2) {
/*
* Convert 160 MHz channel width to new style as interop
@@ -109,6 +123,10 @@ u8 * hostapd_eid_vht_operation(struct ho
oper->vht_op_info_chan_center_freq_seg0_idx -= 8;
else
oper->vht_op_info_chan_center_freq_seg0_idx += 8;
+
+ if (vht_capabilities_info & VHT_CAP_EXTENDED_NSS_BW_SUPPORT)
+ oper->vht_op_info_chan_center_freq_seg1_idx = 0;
+
} else if (hapd->iconf->vht_oper_chwidth == 3) {
/*
* Convert 80+80 MHz channel width to new style as interop
--- a/src/common/hw_features_common.c
+++ b/src/common/hw_features_common.c
@@ -740,6 +740,7 @@ int ieee80211ac_cap_check(u32 hw, u32 co
VHT_CAP_CHECK(VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB);
VHT_CAP_CHECK(VHT_CAP_RX_ANTENNA_PATTERN);
VHT_CAP_CHECK(VHT_CAP_TX_ANTENNA_PATTERN);
+ VHT_CAP_CHECK(VHT_CAP_EXTENDED_NSS_BW_SUPPORT);
#undef VHT_CAP_CHECK
#undef VHT_CAP_CHECK_MAX
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -1304,6 +1304,8 @@ struct ieee80211_ampe_ie {
#define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB ((u32) BIT(26) | BIT(27))
#define VHT_CAP_RX_ANTENNA_PATTERN ((u32) BIT(28))
#define VHT_CAP_TX_ANTENNA_PATTERN ((u32) BIT(29))
+#define VHT_CAP_EXTENDED_NSS_BW_SUPPORT ((u32) BIT(30))
+#define VHT_CAP_EXTENDED_NSS_BW_SUPPORT_MASK ((u32) BIT(30) | BIT(31))
#define VHT_OPMODE_CHANNEL_WIDTH_MASK ((u8) BIT(0) | BIT(1))
#define VHT_OPMODE_CHANNEL_RxNSS_MASK ((u8) BIT(4) | BIT(5) | \

View File

@@ -1,278 +0,0 @@
From: John Crispin <john@phrozen.org>
Subject: [PATCH V4 1/6] bss coloring: add support for handling collision
events and triggering CCA
Date: Wed, 26 Aug 2020 08:22:11 +0200
Add the core code for handling bss color collision events and triggering
CCA inside the kernel.
Signed-off-by: John Crispin <john@phrozen.org>
---
src/ap/ap_drv_ops.h | 12 ++++
src/ap/hostapd.c | 119 +++++++++++++++++++++++++++++++++++
src/ap/hostapd.h | 16 +++++
src/common/ieee802_11_defs.h | 6 ++
src/drivers/driver.h | 31 +++++++++
5 files changed, 184 insertions(+)
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -299,6 +299,18 @@ static inline int hostapd_drv_switch_cha
return hapd->driver->switch_channel(hapd->drv_priv, settings);
}
+#ifdef CONFIG_IEEE80211AX
+static inline int hostapd_drv_switch_color(struct hostapd_data *hapd,
+ struct cca_settings *settings)
+{
+ if (hapd->driver == NULL || hapd->driver->switch_color == NULL ||
+ hapd->drv_priv == NULL)
+ return -1;
+
+ return hapd->driver->switch_color(hapd->drv_priv, settings);
+}
+#endif
+
static inline int hostapd_drv_status(struct hostapd_data *hapd, char *buf,
size_t buflen)
{
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -65,6 +65,8 @@ static int setup_interface2(struct hosta
static void channel_list_update_timeout(void *eloop_ctx, void *timeout_ctx);
static void hostapd_interface_setup_failure_handler(void *eloop_ctx,
void *timeout_ctx);
+static void
+hostapd_switch_color_timeout_handler(void *eloop_data, void *user_ctx);
int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
@@ -476,6 +478,9 @@ static void hostapd_free_hapd_data(struc
}
eloop_cancel_timeout(auth_sae_process_commit, hapd, NULL);
#endif /* CONFIG_SAE */
+#ifdef CONFIG_IEEE80211AX
+ eloop_cancel_timeout(hostapd_switch_color_timeout_handler, hapd, NULL);
+#endif
}
@@ -3713,6 +3718,119 @@ hostapd_switch_channel_fallback(struct h
hostapd_enable_iface(iface);
}
+
+#ifdef CONFIG_IEEE80211AX
+void hostapd_cleanup_cca_params(struct hostapd_data *hapd)
+{
+ hapd->cca_count = 0;
+ hapd->cca_color = 0;
+ hapd->cca_c_off_beacon = 0;
+ hapd->cca_c_off_proberesp = 0;
+ hapd->cca_in_progress = 0;
+}
+
+
+static int hostapd_fill_cca_settings(struct hostapd_data *hapd,
+ struct cca_settings *settings)
+{
+ struct hostapd_iface *iface = hapd->iface;
+ u8 old_color;
+ int ret;
+
+ if (!iface || iface->conf->he_op.he_bss_color_disabled)
+ return -1;
+
+ old_color = iface->conf->he_op.he_bss_color;
+ iface->conf->he_op.he_bss_color = hapd->cca_color;
+ ret = hostapd_build_beacon_data(hapd, &settings->beacon_after);
+ iface->conf->he_op.he_bss_color = old_color;
+
+ settings->cca_count = hapd->cca_count;
+ settings->cca_color = hapd->cca_color,
+ hapd->cca_in_progress = 1;
+
+ ret = hostapd_build_beacon_data(hapd, &settings->beacon_cca);
+ if (ret) {
+ free_beacon_data(&settings->beacon_after);
+ return ret;
+ }
+
+ settings->counter_offset_beacon = hapd->cca_c_off_beacon;
+ settings->counter_offset_presp = hapd->cca_c_off_proberesp;
+
+ return 0;
+}
+
+
+static void
+hostapd_switch_color_timeout_handler(void *eloop_data, void *user_ctx)
+{
+ struct hostapd_data *hapd = (struct hostapd_data *) eloop_data;
+ struct cca_settings settings;
+ struct os_time now;
+ int i, r, b, ret;
+
+ if (os_get_time(&now))
+ return;
+
+ /* check if there has been a recent collision */
+ if (now.sec - hapd->last_color_collision.sec > 50)
+ return;
+
+ r = os_random() % HE_OPERATION_BSS_COLOR_MAX;
+ for (i = 0; i < HE_OPERATION_BSS_COLOR_MAX; i++) {
+ if (r && (hapd->color_collision_bitmap & (1 << r)) == 0)
+ break;
+ r = (r + 1) % HE_OPERATION_BSS_COLOR_MAX;
+ }
+ if (i == HE_OPERATION_BSS_COLOR_MAX) {
+ /* there are no free colors so turn bss coloring off */
+ wpa_printf(MSG_INFO, "no free colors left, turning of BSS coloring");
+ hapd->iface->conf->he_op.he_bss_color_disabled = 1;
+ for (b = 0; b < hapd->iface->num_bss; b++)
+ ieee802_11_set_beacon(hapd->iface->bss[b]);
+ return;
+ }
+
+ for (b = 0; b < hapd->iface->num_bss; b++) {
+ struct hostapd_data *bss = hapd->iface->bss[b];
+
+ hostapd_cleanup_cca_params(bss);
+ bss->cca_color = r;
+ bss->cca_count = 10;
+
+ if (hostapd_fill_cca_settings(bss, &settings)) {
+ hostapd_cleanup_cca_params(bss);
+ continue;
+ }
+
+ ret = hostapd_drv_switch_color(bss, &settings);
+ free_beacon_data(&settings.beacon_cca);
+ free_beacon_data(&settings.beacon_after);
+
+ if (ret)
+ hostapd_cleanup_cca_params(bss);
+ }
+}
+
+
+void
+hostapd_switch_color(struct hostapd_data *hapd, u64 bitmap)
+{
+ if (hapd->cca_in_progress)
+ return;
+
+ if (os_get_time(&hapd->last_color_collision))
+ return;
+
+ hapd->color_collision_bitmap = bitmap;
+
+ if (!eloop_is_timeout_registered(hostapd_switch_color_timeout_handler, hapd, NULL))
+ eloop_register_timeout(DOT11BSS_COLOR_COLLISION_AP_PERIOD, 0,
+ hostapd_switch_color_timeout_handler, hapd, NULL);
+}
+#endif
+
#endif /* NEED_AP_MLME */
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -296,6 +296,16 @@ struct hostapd_data {
unsigned int cs_c_off_ecsa_beacon;
unsigned int cs_c_off_ecsa_proberesp;
+#ifdef CONFIG_IEEE80211AX
+ int cca_in_progress;
+ u8 cca_count;
+ u8 cca_color;
+ unsigned int cca_c_off_beacon;
+ unsigned int cca_c_off_proberesp;
+ struct os_time last_color_collision;
+ u64 color_collision_bitmap;
+#endif
+
#ifdef CONFIG_P2P
struct p2p_data *p2p;
struct p2p_group *p2p_group;
@@ -642,6 +652,12 @@ void hostapd_periodic_iface(struct hosta
int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
+
+#ifdef CONFIG_IEEE80211AX
+void hostapd_switch_color(struct hostapd_data *hapd, u64 bitmap);
+void hostapd_cleanup_cca_params(struct hostapd_data *hapd);
+#endif
+
/* utils.c */
int hostapd_register_probereq_cb(struct hostapd_data *hapd,
int (*cb)(void *ctx, const u8 *sa,
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2280,6 +2280,7 @@ struct ieee80211_spatial_reuse {
#define HE_OPERATION_BSS_COLOR_PARTIAL ((u32) BIT(30))
#define HE_OPERATION_BSS_COLOR_DISABLED ((u32) BIT(31))
#define HE_OPERATION_BSS_COLOR_OFFSET 24
+#define HE_OPERATION_BSS_COLOR_MAX 64
/* Spatial Reuse defines */
#define SPATIAL_REUSE_SRP_DISALLOWED BIT(0)
@@ -2430,4 +2431,9 @@ enum mscs_description_subelem {
#define TBTT_BSS_PARAM_CO_LOCATED BIT(6)
#define TBTT_PSD_MAX_TXPOWER 255 /* dBm */
+/* IEEE802.11/D6.0 - 26.17.3.5.1
+ * the minimum default timeout between color collision and color change is defined as 50s
+ */
+#define DOT11BSS_COLOR_COLLISION_AP_PERIOD 50
+
#endif /* IEEE802_11_DEFS_H */
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2417,6 +2417,26 @@ struct csa_settings {
u16 counter_offset_presp[2];
};
+/**
+ * struct cca_settings - Settings for color switch command
+ * @cca_count: Count in Beacon frames (TBTT) to perform the switch
+ * @cca_color: The new color that we are switching to
+ * @beacon_cca: Beacon/probe resp/asooc resp info for color switch period
+ * @beacon_after: Next beacon/probe resp/asooc resp info
+ * @counter_offset_beacon: Offset to the count field in beacon's tail
+ * @counter_offset_presp: Offset to the count field in probe resp.
+ */
+struct cca_settings {
+ u8 cca_count;
+ u8 cca_color;
+
+ struct beacon_data beacon_cca;
+ struct beacon_data beacon_after;
+
+ u16 counter_offset_beacon;
+ u16 counter_offset_presp;
+};
+
/* TDLS peer capabilities for send_tdls_mgmt() */
enum tdls_peer_capability {
TDLS_PEER_HT = BIT(0),
@@ -3989,6 +4009,17 @@ struct wpa_driver_ops {
int (*switch_channel)(void *priv, struct csa_settings *settings);
/**
+ * switch_color - Announce color switch and migrate the BSS to the
+ * given color
+ * @priv: Private driver interface data
+ * @settings: Settings for CCA period and new color
+ * Returns: 0 on success, -1 on failure
+ *
+ * This function is used to move the BSS to its new color.
+ */
+ int (*switch_color)(void *priv, struct cca_settings *settings);
+
+ /**
* add_tx_ts - Add traffic stream
* @priv: Private driver interface data
* @tsid: Traffic stream ID

View File

@@ -1,104 +0,0 @@
From: John Crispin <john@phrozen.org>
Subject: [PATCH V4 2/6] bss_coloring: add the code required to generate the
CCA IE
Date: Wed, 26 Aug 2020 08:22:12 +0200
This IE is similar to the CSA one. It contains a counter and the target
color. Once the counter expired, the change to the new color happens.
Signed-off-by: John Crispin <john@phrozen.org>
---
src/ap/beacon.c | 12 ++++++++++++
src/ap/ieee802_11.h | 1 +
src/ap/ieee802_11_he.c | 14 ++++++++++++++
src/common/ieee802_11_defs.h | 1 +
4 files changed, 28 insertions(+)
Index: hostapd-2021-02-08/src/ap/beacon.c
===================================================================
--- hostapd-2021-02-08.orig/src/ap/beacon.c
+++ hostapd-2021-02-08/src/ap/beacon.c
@@ -592,11 +592,17 @@ static u8 * hostapd_gen_probe_resp(struc
#ifdef CONFIG_IEEE80211AX
if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) {
+ u8 *cca_pos;
+
pos = hostapd_eid_he_capab(hapd, pos, IEEE80211_MODE_AP);
pos = hostapd_eid_he_operation(hapd, pos);
pos = hostapd_eid_spatial_reuse(hapd, pos);
pos = hostapd_eid_he_mu_edca_parameter_set(hapd, pos);
pos = hostapd_eid_he_6ghz_band_cap(hapd, pos);
+ cca_pos = hostapd_eid_cca(hapd, pos);
+ if (cca_pos != pos)
+ hapd->cca_c_off_proberesp = cca_pos - (u8 *) resp - 2;
+ pos = cca_pos;
}
#endif /* CONFIG_IEEE80211AX */
@@ -1646,12 +1652,18 @@ int ieee802_11_build_ap_params(struct ho
#ifdef CONFIG_IEEE80211AX
if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) {
+ u8 *cca_pos;
+
tailpos = hostapd_eid_he_capab(hapd, tailpos,
IEEE80211_MODE_AP);
tailpos = hostapd_eid_he_operation(hapd, tailpos);
tailpos = hostapd_eid_spatial_reuse(hapd, tailpos);
tailpos = hostapd_eid_he_mu_edca_parameter_set(hapd, tailpos);
tailpos = hostapd_eid_he_6ghz_band_cap(hapd, tailpos);
+ cca_pos = hostapd_eid_cca(hapd, tailpos);
+ if (cca_pos != tailpos)
+ hapd->cca_c_off_beacon = cca_pos - tail - 2;
+ tailpos = cca_pos;
}
#endif /* CONFIG_IEEE80211AX */
Index: hostapd-2021-02-08/src/ap/ieee802_11.h
===================================================================
--- hostapd-2021-02-08.orig/src/ap/ieee802_11.h
+++ hostapd-2021-02-08/src/ap/ieee802_11.h
@@ -100,6 +100,7 @@ u16 copy_sta_he_6ghz_capab(struct hostap
const u8 *he_6ghz_capab);
int hostapd_get_he_twt_responder(struct hostapd_data *hapd,
enum ieee80211_op_mode mode);
+u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid);
void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
const u8 *buf, size_t len, int ack);
void hostapd_eapol_tx_status(struct hostapd_data *hapd, const u8 *dst,
Index: hostapd-2021-02-08/src/ap/ieee802_11_he.c
===================================================================
--- hostapd-2021-02-08.orig/src/ap/ieee802_11_he.c
+++ hostapd-2021-02-08/src/ap/ieee802_11_he.c
@@ -521,3 +521,17 @@ int hostapd_get_he_twt_responder(struct
return !!(mac_cap[HE_MAC_CAPAB_0] & HE_MACCAP_TWT_RESPONDER);
}
+
+
+u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid)
+{
+ if (!hapd->cca_in_progress)
+ return eid;
+ *eid++ = WLAN_EID_EXTENSION;
+ *eid++ = 3;
+ *eid++ = WLAN_EID_EXT_COLOR_CHANGE_ANNOUNCEMENT;
+ *eid++ = hapd->cca_count;
+ *eid++ = hapd->cca_color;
+
+ return eid;
+}
Index: hostapd-2021-02-08/src/common/ieee802_11_defs.h
===================================================================
--- hostapd-2021-02-08.orig/src/common/ieee802_11_defs.h
+++ hostapd-2021-02-08/src/common/ieee802_11_defs.h
@@ -480,6 +480,7 @@
#define WLAN_EID_EXT_HE_OPERATION 36
#define WLAN_EID_EXT_HE_MU_EDCA_PARAMS 38
#define WLAN_EID_EXT_SPATIAL_REUSE 39
+#define WLAN_EID_EXT_COLOR_CHANGE_ANNOUNCEMENT 42
#define WLAN_EID_EXT_OCV_OCI 54
#define WLAN_EID_EXT_SHORT_SSID_LIST 58
#define WLAN_EID_EXT_HE_6GHZ_BAND_CAP 59

View File

@@ -1,603 +0,0 @@
From 171c96df407c45e94d1fe8afd44ca6cc3a191157 Mon Sep 17 00:00:00 2001
From: Nishant Pandey <nishpand@codeaurora.org>
Date: Tue, 22 Sep 2020 14:15:36 +0530
Subject: [PATCH] hostap: Move ACL configuration callback to generic
Move ACL configuration support callbacks to generic
place so that it can be utilized for mesh functionality.
No functional change as such made in this patch
Signed-off-by: Nishant Pandey <nishpand@codeaurora.org>
---
hostapd/config_file.c | 119 +-----------------------------------
hostapd/config_file.h | 5 --
hostapd/ctrl_iface.c | 111 ----------------------------------
src/ap/ctrl_iface_ap.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++
src/ap/ctrl_iface_ap.h | 10 ++++
src/ap/ieee802_11.c | 81 +++++++++++++++++++++++++
src/ap/ieee802_11.h | 9 +++
7 files changed, 260 insertions(+), 234 deletions(-)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -23,6 +23,7 @@
#include "radius/radius_client.h"
#include "ap/wpa_auth.h"
#include "ap/ap_config.h"
+#include "ap/ieee802_11.h"
#include "config_file.h"
@@ -118,124 +119,6 @@ static int hostapd_config_read_vlan_file
#endif /* CONFIG_NO_VLAN */
-int hostapd_acl_comp(const void *a, const void *b)
-{
- const struct mac_acl_entry *aa = a;
- const struct mac_acl_entry *bb = b;
- return os_memcmp(aa->addr, bb->addr, sizeof(macaddr));
-}
-
-
-int hostapd_add_acl_maclist(struct mac_acl_entry **acl, int *num,
- int vlan_id, const u8 *addr)
-{
- struct mac_acl_entry *newacl;
-
- newacl = os_realloc_array(*acl, *num + 1, sizeof(**acl));
- if (!newacl) {
- wpa_printf(MSG_ERROR, "MAC list reallocation failed");
- return -1;
- }
-
- *acl = newacl;
- os_memcpy((*acl)[*num].addr, addr, ETH_ALEN);
- os_memset(&(*acl)[*num].vlan_id, 0, sizeof((*acl)[*num].vlan_id));
- (*acl)[*num].vlan_id.untagged = vlan_id;
- (*acl)[*num].vlan_id.notempty = !!vlan_id;
- (*num)++;
-
- return 0;
-}
-
-
-void hostapd_remove_acl_mac(struct mac_acl_entry **acl, int *num,
- const u8 *addr)
-{
- int i = 0;
-
- while (i < *num) {
- if (os_memcmp((*acl)[i].addr, addr, ETH_ALEN) == 0) {
- os_remove_in_array(*acl, *num, sizeof(**acl), i);
- (*num)--;
- } else {
- i++;
- }
- }
-}
-
-
-static int hostapd_config_read_maclist(const char *fname,
- struct mac_acl_entry **acl, int *num)
-{
- FILE *f;
- char buf[128], *pos;
- int line = 0;
- u8 addr[ETH_ALEN];
- int vlan_id;
-
- f = fopen(fname, "r");
- if (!f) {
- wpa_printf(MSG_ERROR, "MAC list file '%s' not found.", fname);
- return -1;
- }
-
- while (fgets(buf, sizeof(buf), f)) {
- int rem = 0;
-
- line++;
-
- if (buf[0] == '#')
- continue;
- pos = buf;
- while (*pos != '\0') {
- if (*pos == '\n') {
- *pos = '\0';
- break;
- }
- pos++;
- }
- if (buf[0] == '\0')
- continue;
- pos = buf;
- if (buf[0] == '-') {
- rem = 1;
- pos++;
- }
-
- if (hwaddr_aton(pos, addr)) {
- wpa_printf(MSG_ERROR, "Invalid MAC address '%s' at "
- "line %d in '%s'", pos, line, fname);
- fclose(f);
- return -1;
- }
-
- if (rem) {
- hostapd_remove_acl_mac(acl, num, addr);
- continue;
- }
- vlan_id = 0;
- pos = buf;
- while (*pos != '\0' && *pos != ' ' && *pos != '\t')
- pos++;
- while (*pos == ' ' || *pos == '\t')
- pos++;
- if (*pos != '\0')
- vlan_id = atoi(pos);
-
- if (hostapd_add_acl_maclist(acl, num, vlan_id, addr) < 0) {
- fclose(f);
- return -1;
- }
- }
-
- fclose(f);
-
- if (*acl)
- qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
-
- return 0;
-}
-
#ifdef EAP_SERVER
--- a/hostapd/config_file.h
+++ b/hostapd/config_file.h
@@ -13,10 +13,5 @@ struct hostapd_config * hostapd_config_r
int hostapd_set_iface(struct hostapd_config *conf,
struct hostapd_bss_config *bss, const char *field,
char *value);
-int hostapd_acl_comp(const void *a, const void *b);
-int hostapd_add_acl_maclist(struct mac_acl_entry **acl, int *num,
- int vlan_id, const u8 *addr);
-void hostapd_remove_acl_mac(struct mac_acl_entry **acl, int *num,
- const u8 *addr);
#endif /* CONFIG_FILE_H */
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1363,42 +1363,6 @@ static int hostapd_ctrl_iface_get_config
}
-static void hostapd_disassoc_accept_mac(struct hostapd_data *hapd)
-{
- struct sta_info *sta;
- struct vlan_description vlan_id;
-
- if (hapd->conf->macaddr_acl != DENY_UNLESS_ACCEPTED)
- return;
-
- for (sta = hapd->sta_list; sta; sta = sta->next) {
- if (!hostapd_maclist_found(hapd->conf->accept_mac,
- hapd->conf->num_accept_mac,
- sta->addr, &vlan_id) ||
- (vlan_id.notempty &&
- vlan_compare(&vlan_id, sta->vlan_desc)))
- ap_sta_disconnect(hapd, sta, sta->addr,
- WLAN_REASON_UNSPECIFIED);
- }
-}
-
-
-static void hostapd_disassoc_deny_mac(struct hostapd_data *hapd)
-{
- struct sta_info *sta;
- struct vlan_description vlan_id;
-
- for (sta = hapd->sta_list; sta; sta = sta->next) {
- if (hostapd_maclist_found(hapd->conf->deny_mac,
- hapd->conf->num_deny_mac, sta->addr,
- &vlan_id) &&
- (!vlan_id.notempty ||
- !vlan_compare(&vlan_id, sta->vlan_desc)))
- ap_sta_disconnect(hapd, sta, sta->addr,
- WLAN_REASON_UNSPECIFIED);
- }
-}
-
static int hostapd_ctrl_iface_set_band(struct hostapd_data *hapd,
const char *bands)
@@ -3470,81 +3434,6 @@ static int hostapd_ctrl_driver_flags2(st
return pos - buf;
}
-
-static int hostapd_ctrl_iface_acl_del_mac(struct mac_acl_entry **acl, int *num,
- const char *txtaddr)
-{
- u8 addr[ETH_ALEN];
- struct vlan_description vlan_id;
-
- if (!(*num))
- return 0;
-
- if (hwaddr_aton(txtaddr, addr))
- return -1;
-
- if (hostapd_maclist_found(*acl, *num, addr, &vlan_id))
- hostapd_remove_acl_mac(acl, num, addr);
-
- return 0;
-}
-
-
-static void hostapd_ctrl_iface_acl_clear_list(struct mac_acl_entry **acl,
- int *num)
-{
- while (*num)
- hostapd_remove_acl_mac(acl, num, (*acl)[0].addr);
-}
-
-
-static int hostapd_ctrl_iface_acl_show_mac(struct mac_acl_entry *acl, int num,
- char *buf, size_t buflen)
-{
- int i = 0, len = 0, ret = 0;
-
- if (!acl)
- return 0;
-
- while (i < num) {
- ret = os_snprintf(buf + len, buflen - len,
- MACSTR " VLAN_ID=%d\n",
- MAC2STR(acl[i].addr),
- acl[i].vlan_id.untagged);
- if (ret < 0 || (size_t) ret >= buflen - len)
- return len;
- i++;
- len += ret;
- }
- return len;
-}
-
-
-static int hostapd_ctrl_iface_acl_add_mac(struct mac_acl_entry **acl, int *num,
- const char *cmd)
-{
- u8 addr[ETH_ALEN];
- struct vlan_description vlan_id;
- int ret = 0, vlanid = 0;
- const char *pos;
-
- if (hwaddr_aton(cmd, addr))
- return -1;
-
- pos = os_strstr(cmd, "VLAN_ID=");
- if (pos)
- vlanid = atoi(pos + 8);
-
- if (!hostapd_maclist_found(*acl, *num, addr, &vlan_id)) {
- ret = hostapd_add_acl_maclist(acl, num, vlanid, addr);
- if (ret != -1 && *acl)
- qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
- }
-
- return ret < 0 ? -1 : 0;
-}
-
-
static int hostapd_ctrl_iface_get_capability(struct hostapd_data *hapd,
const char *field, char *buf,
size_t buflen)
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -24,6 +24,7 @@
#include "ap_drv_ops.h"
#include "mbo_ap.h"
#include "taxonomy.h"
+#include "ap/vlan.h"
#ifdef CONFIG_CTRL_IFACE_MIB
@@ -645,6 +646,164 @@ static int p2p_manager_disconnect(struct
#endif /* CONFIG_P2P_MANAGER */
+int hostapd_add_acl_maclist(struct mac_acl_entry **acl, int *num,
+ int vlan_id, const u8 *addr)
+{
+ struct mac_acl_entry *newacl;
+
+ newacl = os_realloc_array(*acl, *num + 1, sizeof(**acl));
+ if (!newacl) {
+ wpa_printf(MSG_ERROR, "MAC list reallocation failed");
+ return -1;
+ }
+
+ *acl = newacl;
+ os_memcpy((*acl)[*num].addr, addr, ETH_ALEN);
+ os_memset(&(*acl)[*num].vlan_id, 0, sizeof((*acl)[*num].vlan_id));
+ (*acl)[*num].vlan_id.untagged = vlan_id;
+ (*acl)[*num].vlan_id.notempty = !!vlan_id;
+ (*num)++;
+
+ return 0;
+}
+
+
+void hostapd_remove_acl_mac(struct mac_acl_entry **acl, int *num,
+ const u8 *addr)
+{
+ int i = 0;
+
+ while (i < *num) {
+ if (os_memcmp((*acl)[i].addr, addr, ETH_ALEN) == 0) {
+ os_remove_in_array(*acl, *num, sizeof(**acl), i);
+ (*num)--;
+ } else {
+ i++;
+ }
+ }
+}
+
+int hostapd_disassoc_accept_mac(struct hostapd_data *hapd)
+{
+ struct sta_info *sta;
+ struct vlan_description vlan_id;
+
+ if (hapd->conf->macaddr_acl != DENY_UNLESS_ACCEPTED)
+ return 0;
+
+ for (sta = hapd->sta_list; sta; sta = sta->next) {
+ if (!hostapd_maclist_found(hapd->conf->accept_mac,
+ hapd->conf->num_accept_mac,
+ sta->addr, &vlan_id) ||
+ (vlan_id.notempty &&
+ vlan_compare(&vlan_id, sta->vlan_desc))) {
+#ifdef CONFIG_MESH
+ if (hapd->iface->mconf)
+ return 1;
+#endif /* CONFIG_MESH */
+ ap_sta_disconnect(hapd, sta, sta->addr,
+ WLAN_REASON_UNSPECIFIED);
+ }
+ }
+ return 0;
+}
+
+int hostapd_disassoc_deny_mac(struct hostapd_data *hapd)
+{
+ struct sta_info *sta;
+ struct vlan_description vlan_id;
+
+ for (sta = hapd->sta_list; sta; sta = sta->next) {
+ if (hostapd_maclist_found(hapd->conf->deny_mac,
+ hapd->conf->num_deny_mac, sta->addr,
+ &vlan_id) &&
+ (!vlan_id.notempty ||
+ !vlan_compare(&vlan_id, sta->vlan_desc))) {
+#ifdef CONFIG_MESH
+ if (hapd->iface->mconf)
+ return 1;
+#endif /* CONFIG_MESH */
+ ap_sta_disconnect(hapd, sta, sta->addr,
+ WLAN_REASON_UNSPECIFIED);
+ }
+ }
+
+ return 0;
+}
+
+int hostapd_ctrl_iface_acl_del_mac(struct mac_acl_entry **acl, int *num,
+ const char *txtaddr)
+{
+ u8 addr[ETH_ALEN];
+ struct vlan_description vlan_id;
+
+ if (!(*num))
+ return 0;
+
+ if (hwaddr_aton(txtaddr, addr))
+ return -1;
+
+ if (hostapd_maclist_found(*acl, *num, addr, &vlan_id))
+ hostapd_remove_acl_mac(acl, num, addr);
+
+ return 0;
+}
+
+
+void hostapd_ctrl_iface_acl_clear_list(struct mac_acl_entry **acl,
+ int *num)
+{
+ while (*num)
+ hostapd_remove_acl_mac(acl, num, (*acl)[0].addr);
+}
+
+
+int hostapd_ctrl_iface_acl_show_mac(struct mac_acl_entry *acl, int num,
+ char *buf, size_t buflen)
+{
+ int i = 0, len = 0, ret = 0;
+
+ if (!acl)
+ return 0;
+
+ while (i < num) {
+ ret = os_snprintf(buf + len, buflen - len,
+ MACSTR " VLAN_ID=%d\n",
+ MAC2STR(acl[i].addr),
+ acl[i].vlan_id.untagged);
+ if (ret < 0 || (size_t) ret >= buflen - len)
+ return len;
+ i++;
+ len += ret;
+ }
+ return len;
+}
+
+
+int hostapd_ctrl_iface_acl_add_mac(struct mac_acl_entry **acl, int *num,
+ const char *cmd)
+{
+ u8 addr[ETH_ALEN];
+ struct vlan_description vlan_id;
+ int ret = 0, vlanid = 0;
+ const char *pos;
+
+ if (hwaddr_aton(cmd, addr))
+ return -1;
+
+ pos = os_strstr(cmd, "VLAN_ID=");
+ if (pos)
+ vlanid = atoi(pos + 8);
+
+ if (!hostapd_maclist_found(*acl, *num, addr, &vlan_id)) {
+ ret = hostapd_add_acl_maclist(acl, num, vlanid, addr);
+ if (ret != -1 && *acl)
+ qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
+ }
+
+ return ret < 0 ? -1 : 0;
+}
+
int hostapd_ctrl_iface_deauthenticate(struct hostapd_data *hapd,
const char *txtaddr)
{
--- a/src/ap/ctrl_iface_ap.h
+++ b/src/ap/ctrl_iface_ap.h
@@ -36,5 +36,15 @@ int hostapd_ctrl_iface_pmksa_add(struct
int hostapd_ctrl_iface_pmksa_list_mesh(struct hostapd_data *hapd,
const u8 *addr, char *buf, size_t len);
void * hostapd_ctrl_iface_pmksa_create_entry(const u8 *aa, char *cmd);
+int hostapd_ctrl_iface_acl_add_mac(struct mac_acl_entry **acl, int *num,
+ const char *cmd);
+int hostapd_ctrl_iface_acl_show_mac(struct mac_acl_entry *acl, int num,
+ char *buf, size_t buflen);
+void hostapd_ctrl_iface_acl_clear_list(struct mac_acl_entry **acl,
+ int *num);
+int hostapd_ctrl_iface_acl_del_mac(struct mac_acl_entry **acl, int *num,
+ const char *txtaddr);
+int hostapd_disassoc_accept_mac(struct hostapd_data *hapd);
+int hostapd_disassoc_deny_mac(struct hostapd_data *hapd);
#endif /* CTRL_IFACE_AP_H */
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -7099,6 +7099,87 @@ u8 * hostapd_eid_wb_chsw_wrapper(struct
}
+int hostapd_acl_comp(const void *a, const void *b)
+{
+ const struct mac_acl_entry *aa = a;
+ const struct mac_acl_entry *bb = b;
+
+ return os_memcmp(aa->addr, bb->addr, sizeof(macaddr));
+}
+
+int hostapd_config_read_maclist(const char *fname,
+ struct mac_acl_entry **acl, int *num)
+{
+ FILE *f;
+ char buf[128], *pos;
+ int line = 0;
+ u8 addr[ETH_ALEN];
+ int vlan_id;
+
+ f = fopen(fname, "r");
+ if (!f) {
+ wpa_printf(MSG_ERROR, "MAC list file '%s' not found.", fname);
+ return -1;
+ }
+
+ while (fgets(buf, sizeof(buf), f)) {
+ int rem = 0;
+
+ line++;
+
+ if (buf[0] == '#')
+ continue;
+ pos = buf;
+ while (*pos != '\0') {
+ if (*pos == '\n') {
+ *pos = '\0';
+ break;
+ }
+ pos++;
+ }
+ if (buf[0] == '\0')
+ continue;
+ pos = buf;
+ if (buf[0] == '-') {
+ rem = 1;
+ pos++;
+ }
+
+ if (hwaddr_aton(pos, addr)) {
+ wpa_printf(MSG_ERROR, "Invalid MAC address '%s' at "
+ "line %d in '%s'", pos, line, fname);
+ fclose(f);
+ return -1;
+ }
+
+ if (rem) {
+ hostapd_remove_acl_mac(acl, num, addr);
+ continue;
+ }
+ vlan_id = 0;
+ pos = buf;
+ while (*pos != '\0' && *pos != ' ' && *pos != '\t')
+ pos++;
+ while (*pos == ' ' || *pos == '\t')
+ pos++;
+ if (*pos != '\0')
+ vlan_id = atoi(pos);
+
+ if (hostapd_add_acl_maclist(acl, num, vlan_id, addr) < 0) {
+ fclose(f);
+ return -1;
+ }
+ }
+
+ fclose(f);
+
+ if (*acl)
+ qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
+
+ return 0;
+}
+
+
static size_t hostapd_eid_nr_db_len(struct hostapd_data *hapd,
size_t *current_len)
{
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -18,6 +18,7 @@ struct ieee80211_vht_capabilities;
struct ieee80211_mgmt;
struct radius_sta;
enum ieee80211_op_mode;
+struct mac_acl_entry;
int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
struct hostapd_frame_info *fi);
@@ -25,6 +26,14 @@ void ieee802_11_mgmt_cb(struct hostapd_d
u16 stype, int ok);
void hostapd_2040_coex_action(struct hostapd_data *hapd,
const struct ieee80211_mgmt *mgmt, size_t len);
+
+int hostapd_config_read_maclist(const char *fname,
+ struct mac_acl_entry **acl, int *num);
+int hostapd_acl_comp(const void *a, const void *b);
+int hostapd_add_acl_maclist(struct mac_acl_entry **acl, int *num,
+ int vlan_id, const u8 *addr);
+void hostapd_remove_acl_mac(struct mac_acl_entry **acl, int *num,
+ const u8 *addr);
#ifdef NEED_AP_MLME
int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,

View File

@@ -1,229 +0,0 @@
From d3447cf20a26072d294cd74a8b3e5c676a7421e7 Mon Sep 17 00:00:00 2001
From: Nishant Pandey <nishpand@codeaurora.org>
Date: Tue, 22 Sep 2020 14:19:41 +0530
Subject: [PATCH] mesh: Add ACL logic support to mesh configuration
Extend AP-STA accept and deny acl list support to
mesh peer connection as well. Here mesh node uses
macaddr_acl value either ACCEPT_UNLESS_DENIED or
DENY_UNLESS_ACCEPTED.
Signed-off-by: Nishant Pandey <nishpand@codeaurora.org>
---
wpa_supplicant/config.c | 21 ++++++++++++++++++++-
wpa_supplicant/config_file.c | 6 ++++++
wpa_supplicant/config_ssid.h | 5 +++++
wpa_supplicant/mesh.c | 22 ++++++++++++++++++++++
wpa_supplicant/mesh_mpm.c | 15 +++++++++++++++
wpa_supplicant/wpa_supplicant.conf | 14 ++++++++++++++
6 files changed, 82 insertions(+), 1 deletion(-)
Index: hostapd-2021-02-08/wpa_supplicant/config.c
===================================================================
--- hostapd-2021-02-08.orig/wpa_supplicant/config.c
+++ hostapd-2021-02-08/wpa_supplicant/config.c
@@ -20,7 +20,9 @@
#include "drivers/nl80211_copy.h"
#include "fst/fst.h"
#include "config.h"
-
+#ifdef CONFIG_MESH
+#include "ap/ap_config.h"
+#endif
#if !defined(CONFIG_CTRL_IFACE) && defined(CONFIG_NO_CONFIG_WRITE)
#define NO_CONFIG_WRITE
@@ -2710,6 +2712,9 @@ static const struct parse_data ssid_fiel
{ INT(dot11MeshRetryTimeout) },
{ INT(dot11MeshConfirmTimeout) },
{ INT(dot11MeshHoldingTimeout) },
+ { STR(accept_mac_file) },
+ { STR(deny_mac_file) },
+ { INT(macaddr_acl) },
#endif /* CONFIG_MESH */
{ INT(wpa_ptk_rekey) },
{ INT_RANGE(wpa_deny_ptk0_rekey, 0, 2) },
@@ -2980,6 +2985,8 @@ void wpa_config_free_ssid(struct wpa_ssi
os_free(ssid->p2p_client_list);
os_free(ssid->bssid_ignore);
os_free(ssid->bssid_accept);
+ os_free(ssid->accept_mac_file);
+ os_free(ssid->deny_mac_file);
#ifdef CONFIG_HT_OVERRIDES
os_free(ssid->ht_mcs);
#endif /* CONFIG_HT_OVERRIDES */
@@ -3344,6 +3351,18 @@ int wpa_config_set(struct wpa_ssid *ssid
}
ret = -1;
}
+#ifdef CONFIG_MESH
+ if (os_strcmp(var, "macaddr_acl") == 0) {
+ if (ssid->macaddr_acl != ACCEPT_UNLESS_DENIED &&
+ ssid->macaddr_acl != DENY_UNLESS_ACCEPTED) {
+ wpa_printf(MSG_ERROR,
+ "Line %d: unknown macaddr_acl %d",
+ line, ssid->macaddr_acl);
+ ret = -1;
+ }
+ }
+#endif
+
#ifdef CONFIG_SAE
if (os_strcmp(var, "ssid") == 0 ||
os_strcmp(var, "psk") == 0 ||
Index: hostapd-2021-02-08/wpa_supplicant/config_file.c
===================================================================
--- hostapd-2021-02-08.orig/wpa_supplicant/config_file.c
+++ hostapd-2021-02-08/wpa_supplicant/config_file.c
@@ -18,6 +18,9 @@
#include "common.h"
#include "config.h"
#include "base64.h"
+#ifdef CONFIG_MESH
+#include "ap/ap_config.h"
+#endif
#include "uuid.h"
#include "common/ieee802_1x_defs.h"
#include "p2p/p2p.h"
@@ -914,6 +917,9 @@ static void wpa_config_write_network(FIL
write_int(f, "mac_addr", ssid->mac_addr, -1);
#ifdef CONFIG_MESH
STR(mesh_basic_rates);
+ STR(accept_mac_file);
+ STR(deny_mac_file);
+ INT_DEF(macaddr_acl, ACCEPT_UNLESS_DENIED);
INT_DEF(dot11MeshMaxRetries, DEFAULT_MESH_MAX_RETRIES);
INT_DEF(dot11MeshRetryTimeout, DEFAULT_MESH_RETRY_TIMEOUT);
INT_DEF(dot11MeshConfirmTimeout, DEFAULT_MESH_CONFIRM_TIMEOUT);
Index: hostapd-2021-02-08/wpa_supplicant/config_ssid.h
===================================================================
--- hostapd-2021-02-08.orig/wpa_supplicant/config_ssid.h
+++ hostapd-2021-02-08/wpa_supplicant/config_ssid.h
@@ -546,6 +546,11 @@ struct wpa_ssid {
int dot11MeshConfirmTimeout; /* msec */
int dot11MeshHoldingTimeout; /* msec */
+ char *accept_mac_file;
+ char *deny_mac_file;
+ int macaddr_acl;
+
+
int ht;
int ht40;
Index: hostapd-2021-02-08/wpa_supplicant/mesh.c
===================================================================
--- hostapd-2021-02-08.orig/wpa_supplicant/mesh.c
+++ hostapd-2021-02-08/wpa_supplicant/mesh.c
@@ -16,6 +16,7 @@
#include "common/hw_features_common.h"
#include "ap/sta_info.h"
#include "ap/hostapd.h"
+#include "ap/ieee802_11_auth.h"
#include "ap/ieee802_11.h"
#include "config_ssid.h"
#include "config.h"
@@ -459,6 +460,17 @@ static int wpa_supplicant_mesh_init(stru
ifmsh->bss[0]->dot11RSNASAERetransPeriod =
wpa_s->conf->dot11RSNASAERetransPeriod;
os_strlcpy(bss->conf->iface, wpa_s->ifname, sizeof(bss->conf->iface));
+ bss->conf->macaddr_acl = ssid->macaddr_acl;
+
+ if (ssid->accept_mac_file)
+ hostapd_config_read_maclist(ssid->accept_mac_file,
+ &bss->conf->accept_mac,
+ &bss->conf->num_accept_mac);
+
+ if (ssid->deny_mac_file)
+ hostapd_config_read_maclist(ssid->deny_mac_file,
+ &bss->conf->deny_mac,
+ &bss->conf->num_deny_mac);
mconf = mesh_config_create(wpa_s, ssid);
if (!mconf)
@@ -555,6 +567,16 @@ void wpa_mesh_notify_peer(struct wpa_sup
const u8 *ies, size_t ie_len)
{
struct ieee802_11_elems elems;
+ int acl_res;
+ struct hostapd_data *data = wpa_s->ifmsh->bss[0];
+ struct radius_sta rad_info;
+
+ acl_res = hostapd_allowed_address(data, addr, NULL, 0, &rad_info, 0);
+ if (acl_res == HOSTAPD_ACL_REJECT) {
+ wpa_printf(MSG_ERROR, "Ignore new peer notification\n");
+ return;
+
+ }
wpa_msg(wpa_s, MSG_INFO,
"new peer notification for " MACSTR, MAC2STR(addr));
Index: hostapd-2021-02-08/wpa_supplicant/mesh_mpm.c
===================================================================
--- hostapd-2021-02-08.orig/wpa_supplicant/mesh_mpm.c
+++ hostapd-2021-02-08/wpa_supplicant/mesh_mpm.c
@@ -16,6 +16,7 @@
#include "ap/hostapd.h"
#include "ap/sta_info.h"
#include "ap/ieee802_11.h"
+#include "ap/ieee802_11_auth.h"
#include "ap/wpa_auth.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
@@ -1128,10 +1129,12 @@ void mesh_mpm_action_rx(struct wpa_suppl
enum plink_event event;
struct ieee802_11_elems elems;
struct mesh_peer_mgmt_ie peer_mgmt_ie;
+ struct radius_sta rad_info;
const u8 *ies;
size_t ie_len;
int ret;
u16 reason = 0;
+ int acl_res;
if (mgmt->u.action.category != WLAN_ACTION_SELF_PROTECTED)
return;
@@ -1179,6 +1182,18 @@ void mesh_mpm_action_rx(struct wpa_suppl
return;
}
if (action_field != PLINK_CLOSE) {
+ if (action_field != PLINK_CLOSE) {
+ acl_res = hostapd_allowed_address(hapd, mgmt->sa,
+ (const u8 *) mgmt,
+ len, &rad_info, 0);
+ if (acl_res == HOSTAPD_ACL_REJECT) {
+ wpa_printf(MSG_DEBUG,
+ "MPM: Ignore action frame\n");
+ return;
+
+ }
+ }
+
if (!elems.mesh_id || !elems.mesh_config) {
wpa_printf(MSG_DEBUG,
"MPM: No Mesh ID or Mesh Configuration element");
Index: hostapd-2021-02-08/wpa_supplicant/wpa_supplicant.conf
===================================================================
--- hostapd-2021-02-08.orig/wpa_supplicant/wpa_supplicant.conf
+++ hostapd-2021-02-08/wpa_supplicant/wpa_supplicant.conf
@@ -150,6 +150,20 @@ ap_scan=1
# This timeout value is used in mesh STA to clean up inactive stations.
#mesh_max_inactivity=300
+# Mesh node address -based authentication
+# Please note that this kind of access control requires a driver that uses
+# wpa_supplicant to take care of management frame and mesh PLINK connection
+# processing and as such.
+# 0 = accept unless in deny list
+# 1 = deny unless in accept list
+macaddr_acl=0
+
+# Accept/deny lists are read from separate files (containing list of
+# MAC addresses, one per line). Use absolute path name to make sure that the
+# files can be read on SIGHUP configuration reloads.
+#accept_mac_file=/etc/hostapd.accept
+#deny_mac_file=/etc/hostapd.deny
+
# 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

View File

@@ -1,24 +0,0 @@
From: John Crispin <john@phrozen.org>
Subject: [PATCH V4 3/6] bss coloring: disable BSS color during CCA
Date: Wed, 26 Aug 2020 08:22:13 +0200
While we are doing CCA the bss color disable bit inside the he oper field
needs to be set.
Signed-off-by: John Crispin <john@phrozen.org>
---
src/ap/ieee802_11_he.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -198,7 +198,7 @@ u8 * hostapd_eid_he_operation(struct hos
params |= (hapd->iface->conf->he_op.he_rts_threshold <<
HE_OPERATION_RTS_THRESHOLD_OFFSET);
- if (hapd->iface->conf->he_op.he_bss_color_disabled)
+ if (hapd->iface->conf->he_op.he_bss_color_disabled || hapd->cca_in_progress)
params |= HE_OPERATION_BSS_COLOR_DISABLED;
if (hapd->iface->conf->he_op.he_bss_color_partial)
params |= HE_OPERATION_BSS_COLOR_PARTIAL;

View File

@@ -1,156 +0,0 @@
From 2113291e2fb20d82ac9f9740fed13abea2193a35 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 3 Nov 2020 20:15:08 -0800
Subject: [PATCH V4 4/6] bss coloring: add the switch_color handler to the
nl80211 driver
In order to start the CCA process we need to send NL80211_CMD_COLOR_CHANGE
to the kernel. This patch adds the required code.
Signed-off-by: John Crispin <john@phrozen.org>
---
src/drivers/driver_nl80211.c | 79 ++++++++++++++++++++++++++++++++++++
src/drivers/nl80211_copy.h | 18 +++++++-
2 files changed, 95 insertions(+), 2 deletions(-)
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -9977,6 +9977,82 @@ error:
}
+#ifdef CONFIG_IEEE80211AX
+static int nl80211_switch_color(void *priv, struct cca_settings *settings)
+{
+ struct nl_msg *msg;
+ struct i802_bss *bss = priv;
+ struct wpa_driver_nl80211_data *drv = bss->drv;
+ struct nlattr *beacon_cca;
+ int ret = -ENOBUFS;
+
+ wpa_printf(MSG_DEBUG, "nl80211: Color change request (cca_count=%u color=%d)",
+ settings->cca_count, settings->cca_color);
+
+ if (drv->nlmode != NL80211_IFTYPE_AP)
+ return -EOPNOTSUPP;
+
+ if (!settings->beacon_cca.tail)
+ return -EINVAL;
+
+ if ((settings->beacon_cca.tail_len <= settings->counter_offset_beacon) ||
+ (settings->beacon_cca.tail[settings->counter_offset_beacon] !=
+ settings->cca_count))
+ return -EINVAL;
+
+ if (settings->beacon_cca.probe_resp &&
+ ((settings->beacon_cca.probe_resp_len <=
+ settings->counter_offset_presp) ||
+ (settings->beacon_cca.probe_resp[settings->counter_offset_presp] !=
+ settings->cca_count)))
+ return -EINVAL;
+
+ if (!(msg = nl80211_bss_msg(bss, 0, NL80211_CMD_COLOR_CHANGE)) ||
+ nla_put_u8(msg, NL80211_ATTR_COLOR_CHANGE_ANNOUNCEMENT_COUNT,
+ settings->cca_count) ||
+ nla_put_u8(msg, NL80211_ATTR_COLOR_CHANGE_ANNOUNCEMENT_COLOR,
+ settings->cca_color))
+ goto error;
+
+ /* beacon_after params */
+ ret = set_beacon_data(msg, &settings->beacon_after);
+ if (ret)
+ goto error;
+
+ /* beacon_csa params */
+ beacon_cca = nla_nest_start(msg, NL80211_ATTR_COLOR_CHANGE_ANNOUNCEMENT_IES);
+ if (!beacon_cca)
+ goto fail;
+
+ ret = set_beacon_data(msg, &settings->beacon_cca);
+ if (ret)
+ goto error;
+
+ if (nla_put_u16(msg, NL80211_ATTR_CNTDWN_OFFS_BEACON,
+ settings->counter_offset_beacon) ||
+ (settings->beacon_cca.probe_resp &&
+ nla_put_u16(msg, NL80211_ATTR_CNTDWN_OFFS_PRESP,
+ settings->counter_offset_presp)))
+ goto fail;
+
+ nla_nest_end(msg, beacon_cca);
+ ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
+ if (ret) {
+ wpa_printf(MSG_DEBUG, "nl80211: switch_color failed err=%d (%s)",
+ ret, strerror(-ret));
+ }
+ return ret;
+
+fail:
+ ret = -ENOBUFS;
+error:
+ nlmsg_free(msg);
+ wpa_printf(MSG_DEBUG, "nl80211: Could not build color switch request");
+ return ret;
+}
+#endif
+
+
static int nl80211_add_ts(void *priv, u8 tsid, const u8 *addr,
u8 user_priority, u16 admitted_time)
{
@@ -12242,6 +12318,9 @@ const struct wpa_driver_ops wpa_driver_n
.get_survey = wpa_driver_nl80211_get_survey,
.status = wpa_driver_nl80211_status,
.switch_channel = nl80211_switch_channel,
+#ifdef CONFIG_IEEE80211AX
+ .switch_color = nl80211_switch_color,
+#endif
#ifdef ANDROID_P2P
.set_noa = wpa_driver_set_p2p_noa,
.get_noa = wpa_driver_get_p2p_noa,
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -1423,6 +1423,16 @@ enum nl80211_commands {
NL80211_CMD_SET_SAR_SPECS,
NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS,
+
+ NL80211_CMD_OBSS_COLOR_COLLISION,
+
+ NL80211_CMD_COLOR_CHANGE,
+ NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_STARTED,
+ NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_ABORTED,
+ NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_COMPLETED,
+
+ NL80211_CMD_SET_FILS_AAD,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -3067,6 +3077,16 @@ enum nl80211_attrs {
NL80211_ATTR_DISABLE_HE,
NL80211_ATTR_HE_MUEDCA_PARAMS,
+
+ NL80211_ATTR_OBSS_COLOR_BITMAP,
+
+ NL80211_ATTR_COLOR_CHANGE_ANNOUNCEMENT_COUNT,
+ NL80211_ATTR_COLOR_CHANGE_ANNOUNCEMENT_COLOR,
+ NL80211_ATTR_COLOR_CHANGE_ANNOUNCEMENT_IES,
+
+ NL80211_ATTR_MBSSID_CONFIG,
+ NL80211_ATTR_MBSSID_ELEMS,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -172,6 +172,7 @@ static const char * nl80211_command_to_s
C2S(NL80211_CMD_UNPROT_BEACON)
C2S(NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS)
C2S(NL80211_CMD_SET_SAR_SPECS)
+ C2S(NL80211_CMD_SET_FILS_AAD)
C2S(NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS)
C2S(NL80211_CMD_COLOR_CHANGE)
C2S(__NL80211_CMD_AFTER_LAST)

View File

@@ -1,299 +0,0 @@
From 2173e65aa098ab130bfdbc9b9cfe8ac2fc2ae086 Mon Sep 17 00:00:00 2001
From: Nishant Pandey <nishpand@codeaurora.org>
Date: Tue, 22 Sep 2020 14:23:08 +0530
Subject: [PATCH] mesh: Dynamic MAC ACL management over control interface
Extend support to modify MAC ACL and displayed it through
new control interface
commands:
ACCEPT_ACL <subcmd> [argument]
DENY_ACL <subcmd> [argument]
subcmd: ADD_MAC <addr> |DEL_MAC <addr>|SHOW|CLEAR
Signed-off-by: Nishant Pandey <nishpand@codeaurora.org>
---
wpa_supplicant/ap.c | 68 +++++++++++++++++++++++++++++++++++++++++
wpa_supplicant/ap.h | 5 +++
wpa_supplicant/ctrl_iface.c | 45 +++++++++++++++++++++++++++
wpa_supplicant/events.c | 1 +
wpa_supplicant/mesh.c | 1 +
wpa_supplicant/wpa_cli.c | 19 ++++++++++++
wpa_supplicant/wpa_supplicant.c | 3 +-
wpa_supplicant/wps_supplicant.c | 2 ++
8 files changed, 143 insertions(+), 1 deletion(-)
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -6,6 +6,7 @@
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
+#include <stdbool.h>
#include "utils/includes.h"
@@ -1616,6 +1617,73 @@ void wpas_ap_pmksa_cache_flush(struct wp
hostapd_ctrl_iface_pmksa_flush(wpa_s->ifmsh->bss[0]);
}
+#ifdef CONFIG_MESH
+
+int wpas_ap_acl_del_mac(struct wpa_supplicant *wpa_s, char *buf, bool accept)
+{
+ struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
+
+ if (accept) {
+ if (!hostapd_ctrl_iface_acl_del_mac(&hapd->conf->accept_mac,
+ &hapd->conf->num_accept_mac,
+ buf))
+ if (hostapd_disassoc_accept_mac(hapd))
+ return 1;
+ }
+
+ return hostapd_ctrl_iface_acl_del_mac(&hapd->conf->deny_mac,
+ &hapd->conf->num_deny_mac,
+ buf);
+}
+
+int wpas_ap_acl_add_mac(struct wpa_supplicant *wpa_s, char *buf, bool accept)
+{
+ struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
+
+ if (accept) {
+ return hostapd_ctrl_iface_acl_add_mac(&hapd->conf->accept_mac,
+ &hapd->conf->num_accept_mac,
+ buf);
+ } else {
+ if (!hostapd_ctrl_iface_acl_add_mac(&hapd->conf->deny_mac,
+ &hapd->conf->num_deny_mac, buf)) {
+ if (hostapd_disassoc_deny_mac(hapd))
+ return 1;
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+int wpas_ap_acl_show_mac(struct wpa_supplicant *wpa_s, char *reply,
+ const int reply_size, bool accept)
+{
+ struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
+
+ if (accept)
+ return hostapd_ctrl_iface_acl_show_mac(
+ hapd->conf->accept_mac,
+ hapd->conf->num_accept_mac,
+ reply, reply_size);
+
+ return hostapd_ctrl_iface_acl_show_mac(
+ hapd->conf->deny_mac,
+ hapd->conf->num_deny_mac,
+ reply, reply_size);
+}
+
+void wpas_ap_deny_acl_clear_list(struct wpa_supplicant *wpa_s)
+{
+ struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
+
+
+ return hostapd_ctrl_iface_acl_clear_list(&hapd->conf->deny_mac,
+ &hapd->conf->num_deny_mac);
+}
+
+#endif /* CONFIG_MESH */
+
#ifdef CONFIG_PMKSA_CACHE_EXTERNAL
#ifdef CONFIG_MESH
--- a/wpa_supplicant/ap.h
+++ b/wpa_supplicant/ap.h
@@ -99,6 +99,11 @@ void wpas_ap_event_dfs_cac_aborted(struc
struct dfs_event *radar);
void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
struct dfs_event *radar);
+int wpas_ap_acl_del_mac(struct wpa_supplicant *wpa_s, char *buf, bool accept);
+int wpas_ap_acl_add_mac(struct wpa_supplicant *wpa_s, char *buf, bool accept);
+int wpas_ap_acl_show_mac(struct wpa_supplicant *wpa_s, char *reply,
+ const int reply_size, bool accept);
+void wpas_ap_deny_acl_clear_list(struct wpa_supplicant *wpa_s);
void ap_periodic(struct wpa_supplicant *wpa_s);
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -5,6 +5,7 @@
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
+#include <stdbool.h>
#include "utils/includes.h"
#ifdef CONFIG_TESTING_OPTIONS
@@ -56,6 +57,7 @@
#include "mesh.h"
#include "dpp_supplicant.h"
#include "sme.h"
+#include "ap/ieee802_11.h"
#ifdef __NetBSD__
#include <net/if_ether.h>
@@ -3284,6 +3286,18 @@ static int wpa_supplicant_ctrl_iface_mes
return wpas_mesh_peer_remove(wpa_s, addr);
}
+static void wpas_ap_accept_acl_clear_list(struct wpa_supplicant *wpa_s)
+{
+ struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
+ struct mac_acl_entry **acl = &hapd->conf->accept_mac;
+ int *num = &hapd->conf->num_accept_mac;
+
+ while (*num) {
+ wpas_mesh_peer_remove(wpa_s, (*acl)[0].addr);
+ hostapd_remove_acl_mac(acl, num, (*acl)[0].addr);
+ }
+}
+
static int wpa_supplicant_ctrl_iface_mesh_peer_add(
struct wpa_supplicant *wpa_s, char *cmd)
@@ -10655,6 +10669,38 @@ char * wpa_supplicant_ctrl_iface_process
reply_len = -1;
#endif /* CONFIG_IBSS_RSN */
#ifdef CONFIG_MESH
+ } else if (os_strncmp(buf, "ACCEPT_ACL ", 11) == 0) {
+ if (os_strncmp(buf + 11, "ADD_MAC ", 8) == 0) {
+ wpas_ap_acl_add_mac(wpa_s, buf + 19, 1);
+ } else if (os_strncmp((buf + 11), "DEL_MAC ", 8) == 0) {
+ reply_len = wpas_ap_acl_del_mac(wpa_s, buf + 19, 1);
+ if (reply_len == 1)
+ wpa_supplicant_ctrl_iface_mesh_peer_remove(
+ wpa_s, buf + 19);
+ else if (reply_len)
+ reply_len = -1;
+ } else if (os_strcmp(buf + 11, "SHOW") == 0) {
+ reply_len = wpas_ap_acl_show_mac(wpa_s, reply,
+ reply_size, 1);
+ } else if (os_strcmp(buf + 11, "CLEAR") == 0) {
+ wpas_ap_accept_acl_clear_list(wpa_s);
+ }
+ } else if (os_strncmp(buf, "DENY_ACL ", 9) == 0) {
+ if (os_strncmp(buf + 9, "ADD_MAC ", 8) == 0) {
+ reply_len = wpas_ap_acl_add_mac(wpa_s, buf + 17, 0);
+ if (reply_len == 1)
+ wpa_supplicant_ctrl_iface_mesh_peer_remove(
+ wpa_s, buf + 17);
+ else if (reply_len)
+ reply_len = -1;
+ } else if (os_strncmp(buf + 9, "DEL_MAC ", 8) == 0) {
+ wpas_ap_acl_del_mac(wpa_s, buf + 17, 0);
+ } else if (os_strcmp(buf + 9, "SHOW") == 0) {
+ reply_len = wpas_ap_acl_show_mac(wpa_s, reply,
+ reply_size, 0);
+ } else if (os_strcmp(buf + 9, "CLEAR") == 0) {
+ wpas_ap_deny_acl_clear_list(wpa_s);
+ }
} else if (os_strncmp(buf, "MESH_INTERFACE_ADD ", 19) == 0) {
reply_len = wpa_supplicant_ctrl_iface_mesh_interface_add(
wpa_s, buf + 19, reply, reply_size);
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -5,6 +5,7 @@
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
+#include <stdbool.h>
#include "includes.h"
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -5,6 +5,7 @@
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
+#include <stdbool.h>
#include "utils/includes.h"
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -2113,6 +2113,19 @@ static int wpa_cli_cmd_mesh_link_probe(s
return wpa_cli_cmd(ctrl, "MESH_LINK_PROBE", 1, argc, argv);
}
+static int wpa_cli_cmd_accept_macacl(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return wpa_cli_cmd(ctrl, "ACCEPT_ACL", 1, argc, argv);
+}
+
+
+static int wpa_cli_cmd_deny_macacl(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return wpa_cli_cmd(ctrl, "DENY_ACL", 1, argc, argv);
+}
+
#endif /* CONFIG_MESH */
@@ -3532,6 +3545,12 @@ static const struct wpa_cli_cmd wpa_cli_
{ "mesh_link_probe", wpa_cli_cmd_mesh_link_probe, NULL,
cli_cmd_flag_none,
"<addr> [payload=<hex dump of payload>] = Probe a mesh link for a given peer by injecting a frame." },
+ { "accept_acl", wpa_cli_cmd_accept_macacl, NULL,
+ cli_cmd_flag_none,
+ "=Add/Delete/Show/Clear accept MAC ACL" },
+ { "deny_acl", wpa_cli_cmd_deny_macacl, NULL,
+ cli_cmd_flag_none,
+ "=Add/Delete/Show/Clear deny MAC ACL" },
#endif /* CONFIG_MESH */
#ifdef CONFIG_P2P
{ "p2p_find", wpa_cli_cmd_p2p_find, wpa_cli_complete_p2p_find,
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -9,6 +9,7 @@
* %wpa_supplicant interfaces. In addition, this file contains number of
* functions for managing network connections.
*/
+#include <stdbool.h>
#include "includes.h"
#ifdef CONFIG_MATCH_IFACE
@@ -49,7 +50,6 @@
#include "ibss_rsn.h"
#include "sme.h"
#include "gas_query.h"
-#include "ap.h"
#include "p2p_supplicant.h"
#include "wifi_display.h"
#include "notify.h"
@@ -67,6 +67,7 @@
#include "ap/ap_config.h"
#include "ap/hostapd.h"
#endif /* CONFIG_MESH */
+#include "ap.h"
const char *const wpa_supplicant_version =
"wpa_supplicant v" VERSION_STR "\n"
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -5,6 +5,7 @@
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
+#include <stdbool.h>
#include "includes.h"
@@ -21,6 +22,7 @@
#include "eap_peer/eap.h"
#include "eapol_supp/eapol_supp_sm.h"
#include "rsn_supp/wpa.h"
+#include "ap/hostapd.h"
#include "wps/wps_attr_parse.h"
#include "config.h"
#include "wpa_supplicant_i.h"

View File

@@ -1,227 +0,0 @@
From: John Crispin <john@phrozen.org>
Subject: [PATCH V4 5/6] bss coloring: handle the collision and CCA events
coming from the kernel
Date: Wed, 26 Aug 2020 08:22:15 +0200
This patch activates the functionality of the previous patches by handling
the actual events that will trigger the CCA process.
Signed-off-by: John Crispin <john@phrozen.org>
---
src/ap/drv_callbacks.c | 45 ++++++++++++++++++++-
src/drivers/driver.h | 27 +++++++++++++
src/drivers/driver_common.c | 4 ++
src/drivers/driver_nl80211_event.c | 64 +++++++++++++++++++++++++++++-
4 files changed, 138 insertions(+), 2 deletions(-)
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -44,7 +44,6 @@
#include "fils_hlp.h"
#include "neighbor_db.h"
-
#ifdef CONFIG_FILS
void hostapd_notify_assoc_fils_finish(struct hostapd_data *hapd,
struct sta_info *sta)
@@ -1801,6 +1800,39 @@ static void hostapd_event_update_muedca_
"Failed to update beacons with MU-EDCA parameters");
}
+#ifdef CONFIG_IEEE80211AX
+static void hostapd_event_bss_color_collision(struct hostapd_data *hapd,
+ u64 bitmap)
+{
+ /* the bss color is shared amongst all BBSs on a specific phy.
+ * therefore we always start the color change on the primary BSS
+ */
+ wpa_printf(MSG_DEBUG, "BSS color collision on %s", hapd->conf->iface);
+ hostapd_switch_color(hapd->iface->bss[0], bitmap);
+}
+
+static void hostapd_event_cca(struct hostapd_data *hapd, enum wpa_event_type event)
+{
+ switch (event) {
+ case EVENT_CCA_STARTED_NOTIFY:
+ wpa_printf(MSG_DEBUG, "CCA started on %s", hapd->conf->iface);
+ break;
+ case EVENT_CCA_NOTIFY:
+ wpa_printf(MSG_DEBUG, "CCA finished on %s (new color: %d)", hapd->conf->iface, hapd->cca_color);
+ hapd->iface->conf->he_op.he_bss_color = hapd->cca_color;
+ hostapd_cleanup_cca_params(hapd);
+ break;
+ case EVENT_CCA_ABORTED_NOTIFY:
+ wpa_printf(MSG_DEBUG, "CCA aborted on %s for cca_color: %d", hapd->conf->iface, hapd->cca_color);
+ hostapd_cleanup_cca_params(hapd);
+ break;
+ default:
+ break;
+ }
+}
+#endif
+
+
#ifdef CONFIG_OWE
static int hostapd_notif_update_dh_ie(struct hostapd_data *hapd,
const u8 *peer, const u8 *ie,
@@ -2111,6 +2143,17 @@ void hostapd_wpa_event(void *ctx, enum w
case EVENT_UPDATE_MUEDCA_PARAMS:
hostapd_event_update_muedca_params(hapd, &data->update_muedca);
break;
+#ifdef CONFIG_IEEE80211AX
+ case EVENT_BSS_COLOR_COLLISION:
+ hostapd_event_bss_color_collision(hapd,
+ data->bss_color_collision.bitmap);
+ break;
+ case EVENT_CCA_STARTED_NOTIFY:
+ case EVENT_CCA_ABORTED_NOTIFY:
+ case EVENT_CCA_NOTIFY:
+ hostapd_event_cca(hapd, event);
+ break;
+#endif
default:
wpa_printf(MSG_DEBUG, "Unknown event %d", event);
break;
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5175,6 +5175,26 @@ enum wpa_event_type {
* beacon.
*/
EVENT_UPDATE_MUEDCA_PARAMS,
+
+ /**
+ * EVENT_BSS_COLOR_COLLISION - Notification of a BSS color collision
+ */
+ EVENT_BSS_COLOR_COLLISION,
+
+ /**
+ * EVENT_CCA_STARTED_NOTIFY - Notification that CCA has started
+ */
+ EVENT_CCA_STARTED_NOTIFY,
+
+ /**
+ * EVENT_CCA_ABORTED_NOTIFY - Notification that CCA has aborted
+ */
+ EVENT_CCA_ABORTED_NOTIFY,
+
+ /**
+ * EVENT_CCA_NOTIFY - Notification that CCA has completed
+ */
+ EVENT_CCA_NOTIFY,
};
@@ -6077,6 +6097,13 @@ union wpa_event_data {
u8 he_mu_ac_vi_param[3];
u8 he_mu_ac_vo_param[3];
} update_muedca;
+
+ /**
+ * struct bss_color_collision - Data for EVENT_BSS_COLOR_COLLISION
+ */
+ struct bss_color_collision {
+ u64 bitmap;
+ } bss_color_collision;
};
/**
--- a/src/drivers/driver_common.c
+++ b/src/drivers/driver_common.c
@@ -91,6 +91,10 @@ const char * event_to_string(enum wpa_ev
E2S(UPDATE_DH);
E2S(UNPROT_BEACON);
E2S(UPDATE_MUEDCA_PARAMS);
+ E2S(BSS_COLOR_COLLISION);
+ E2S(CCA_STARTED_NOTIFY);
+ E2S(CCA_ABORTED_NOTIFY);
+ E2S(CCA_NOTIFY);
}
return "UNKNOWN";
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -175,6 +175,10 @@ static const char * nl80211_command_to_s
C2S(NL80211_CMD_SET_FILS_AAD)
C2S(NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS)
C2S(NL80211_CMD_COLOR_CHANGE)
+ C2S(NL80211_CMD_OBSS_COLOR_COLLISION)
+ C2S(NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_STARTED)
+ C2S(NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_ABORTED)
+ C2S(NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_COMPLETED)
C2S(__NL80211_CMD_AFTER_LAST)
}
#undef C2S
@@ -2863,6 +2867,51 @@ static void nl80211_control_port_frame(s
}
}
+#ifdef CONFIG_IEEE80211AX
+static void mlme_event_obss_color_collision(struct wpa_driver_nl80211_data *drv,
+ struct nlattr *tb[])
+{
+ union wpa_event_data data;
+
+ if (!tb[NL80211_ATTR_OBSS_COLOR_BITMAP])
+ return;
+
+ os_memset(&data, 0, sizeof(data));
+ data.bss_color_collision.bitmap = nla_get_u64(tb[NL80211_ATTR_OBSS_COLOR_BITMAP]);
+
+ wpa_printf(MSG_DEBUG, "nl80211: BSS color collision - bitmap %08llx",
+ (long long unsigned int)data.bss_color_collision.bitmap);
+
+ wpa_supplicant_event(drv->ctx, EVENT_BSS_COLOR_COLLISION, &data);
+}
+
+static void mlme_event_color_change_announcement_started(struct wpa_driver_nl80211_data *drv)
+{
+ union wpa_event_data data = {};
+
+ wpa_printf(MSG_DEBUG, "nl80211: CCA started");
+
+ wpa_supplicant_event(drv->ctx, EVENT_CCA_STARTED_NOTIFY, &data);
+}
+
+static void mlme_event_color_change_announcement_aborted(struct wpa_driver_nl80211_data *drv)
+{
+ union wpa_event_data data = {};
+
+ wpa_printf(MSG_DEBUG, "nl80211: CCA aborted");
+
+ wpa_supplicant_event(drv->ctx, EVENT_CCA_ABORTED_NOTIFY, &data);
+}
+
+static void mlme_event_color_change_announcement_completed(struct wpa_driver_nl80211_data *drv)
+{
+ union wpa_event_data data = {};
+
+ wpa_printf(MSG_DEBUG, "nl80211: CCA completed");
+
+ wpa_supplicant_event(drv->ctx, EVENT_CCA_NOTIFY, &data);
+}
+#endif
static void
nl80211_control_port_frame_tx_status(struct wpa_driver_nl80211_data *drv,
@@ -3135,6 +3184,20 @@ static void do_process_drv_event(struct
case NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS:
nl80211_update_muedca_params_event(drv, tb);
break;
+#ifdef CONFIG_IEEE80211AX
+ case NL80211_CMD_OBSS_COLOR_COLLISION:
+ mlme_event_obss_color_collision(drv, tb);
+ break;
+ case NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_STARTED:
+ mlme_event_color_change_announcement_started(drv);
+ break;
+ case NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_ABORTED:
+ mlme_event_color_change_announcement_aborted(drv);
+ break;
+ case NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_COMPLETED:
+ mlme_event_color_change_announcement_completed(drv);
+ break;
+#endif
default:
wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event "
"(cmd=%d)", cmd);

View File

@@ -1,44 +0,0 @@
From: John Crispin <john@phrozen.org>
Subject: [PATCH V4 6/6] bss_coloring: allow using a random starting color
Date: Wed, 26 Aug 2020 08:22:16 +0200
Enhance the possible values for he_bss_color. Anything greater than 63 will
make hostapd choose a random color.
Signed-off-by: John Crispin <john@phrozen.org>
---
hostapd/config_file.c | 7 +++++--
hostapd/hostapd.conf | 5 ++++-
2 files changed, 9 insertions(+), 3 deletions(-)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3367,8 +3367,11 @@ static int hostapd_config_fill(struct ho
} else if (os_strcmp(buf, "he_ul_mumimo") == 0) {
conf->he_phy_capab.he_ul_mumimo = atoi(pos);
} else if (os_strcmp(buf, "he_bss_color") == 0) {
- conf->he_op.he_bss_color = atoi(pos) & 0x3f;
- conf->he_op.he_bss_color_disabled = 0;
+ conf->he_op.he_bss_color = atoi(pos);
+ if (conf->he_op.he_bss_color > 63)
+ conf->he_op.he_bss_color = (os_random() % 63) + 1;
+ if (conf->he_op.he_bss_color)
+ conf->he_op.he_bss_color_disabled = 0;
} else if (os_strcmp(buf, "he_bss_color_partial") == 0) {
conf->he_op.he_bss_color_partial = atoi(pos);
} else if (os_strcmp(buf, "he_default_pe_duration") == 0) {
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -810,7 +810,10 @@ wmm_ac_vo_acm=0
# 1 = supported
#he_mu_beamformer=1
-# he_bss_color: BSS color (1-63)
+# he_bss_color:
+# 0 = disable
+# 1-63 = pre-defined color
+# 64+ = random color
#he_bss_color=1
# he_bss_color_partial: BSS color AID equation

View File

@@ -1,126 +0,0 @@
From d0d7cc4647ecad26b7bf04e39a4e9403cab68a48 Mon Sep 17 00:00:00 2001
From: Karthikeyan Periyasamy <periyasa@codeaurora.org>
Date: Sat, 15 Aug 2020 18:47:26 +0530
Subject: [PATCH] hostapd: Add intelligence color choose in CCA
Gather color information of the neighbor APs and choose available
free color after go through the neighbor colors to minimise the color collision
Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
---
src/ap/ap_list.c | 29 +++++++++++++++++++++++++
src/ap/ap_list.h | 7 ++++++
src/ap/hostapd.c | 66 +++++++++++++++++++++++++++++---------------------------
3 files changed, 70 insertions(+), 32 deletions(-)
--- a/src/ap/ap_list.c
+++ b/src/ap/ap_list.c
@@ -174,6 +174,7 @@ void ap_list_process_beacon(struct hosta
struct ap_info *ap;
int new_ap = 0;
int set_beacon = 0;
+ u32 he_operation;
if (iface->conf->ap_table_max_size < 1)
return;
@@ -210,6 +211,17 @@ void ap_list_process_beacon(struct hosta
else
ap->ht_support = 0;
+ if (iface->conf->ieee80211ax &&
+ elems->he_operation) {
+ he_operation = *(u32 *)elems->he_operation;
+
+ if (!(he_operation & HE_OPERATION_BSS_COLOR_DISABLED))
+ ap->color = (he_operation & HE_OPERATION_BSS_COLOR_MASK) >>
+ HE_OPERATION_BSS_COLOR_OFFSET;
+ else
+ ap->color = 0;
+ }
+
os_get_reltime(&ap->last_beacon);
if (!new_ap && ap != iface->ap_list) {
@@ -295,6 +307,21 @@ void ap_list_timer(struct hostapd_iface
ieee802_11_update_beacons(iface);
}
+u64 ap_list_get_color(struct hostapd_iface *iface)
+{
+ u64 used_color_bitmap = 0;
+ struct ap_info *ap;
+
+ if (!iface->ap_list)
+ return used_color_bitmap;
+
+ ap = iface->ap_list;
+ while (ap != NULL) {
+ used_color_bitmap |= (u64)1 << ap->color;
+ ap = ap->next;
+ }
+ return used_color_bitmap;
+}
int ap_list_init(struct hostapd_iface *iface)
{
--- a/src/ap/ap_list.h
+++ b/src/ap/ap_list.h
@@ -25,6 +25,7 @@ struct ap_info {
int channel;
int ht_support;
+ u8 color;
struct os_reltime last_beacon;
};
@@ -40,6 +41,7 @@ void ap_list_process_beacon(struct hosta
int ap_list_init(struct hostapd_iface *iface);
void ap_list_deinit(struct hostapd_iface *iface);
void ap_list_timer(struct hostapd_iface *iface);
+u64 ap_list_get_color(struct hostapd_iface *iface);
#else /* NEED_AP_MLME */
static inline int ap_list_init(struct hostapd_iface *iface)
{
@@ -53,6 +55,11 @@ static inline void ap_list_deinit(struct
static inline void ap_list_timer(struct hostapd_iface *iface)
{
}
+
+static u64 ap_list_get_color(struct hostapd_iface *iface)
+{
+ return 0;
+}
#endif /* NEED_AP_MLME */
#endif /* AP_LIST_H */
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3769,6 +3769,7 @@ hostapd_switch_color_timeout_handler(voi
struct cca_settings settings;
struct os_time now;
int i, r, b, ret;
+ u64 neighbor_color;
if (os_get_time(&now))
return;
@@ -3777,11 +3778,16 @@ hostapd_switch_color_timeout_handler(voi
if (now.sec - hapd->last_color_collision.sec > 50)
return;
- r = os_random() % HE_OPERATION_BSS_COLOR_MAX;
- for (i = 0; i < HE_OPERATION_BSS_COLOR_MAX; i++) {
- if (r && (hapd->color_collision_bitmap & (1 << r)) == 0)
+ neighbor_color = ap_list_get_color(hapd->iface);
+ neighbor_color |= hapd->color_collision_bitmap;
+
+ r = os_random() % HE_OPERATION_BSS_COLOR_MAX - 1;
+ r++;
+ for (i = 1; i < HE_OPERATION_BSS_COLOR_MAX; i++) {
+ if ((neighbor_color & (1 << r)) == 0)
break;
- r = (r + 1) % HE_OPERATION_BSS_COLOR_MAX;
+ r = r % HE_OPERATION_BSS_COLOR_MAX - 1;
+ r++;
}
if (i == HE_OPERATION_BSS_COLOR_MAX) {
/* there are no free colors so turn bss coloring off */

View File

@@ -1,194 +0,0 @@
From baf3a982caee59ec08602a9e981d6742abc4fc7b Mon Sep 17 00:00:00 2001
From: Lavanya Suresh <lavaks@codeaurora.org>
Date: Mon, 28 Sep 2020 23:21:43 +0530
Subject: [PATCH] hostapd: Add support to change bss color by user
hostpad_cli command is added to change bss color in runtime,
for testing purpose. hostapd_cli status can be used to check
updated color.
Usage: hostapd_cli color_change <color>
Signed-off-by: Lavanya Suresh <lavaks@codeaurora.org>
---
hostapd/ctrl_iface.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
hostapd/hostapd_cli.c | 23 +++++++++++++++++++++++
src/ap/ctrl_iface_ap.c | 6 ++++--
src/ap/hostapd.c | 4 ++--
src/ap/hostapd.h | 3 ++-
5 files changed, 76 insertions(+), 5 deletions(-)
Index: hostapd-2021-12-13-b26f5c0f/hostapd/ctrl_iface.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/hostapd/ctrl_iface.c
+++ hostapd-2021-12-13-b26f5c0f/hostapd/ctrl_iface.c
@@ -2781,6 +2781,59 @@ static int hostapd_ctrl_check_freq_param
}
#endif /* NEED_AP_MLME */
+static int hostapd_ctrl_iface_color_change(struct hostapd_iface *iface,
+ char *pos)
+{
+#ifdef NEED_AP_MLME
+ struct cca_settings settings;
+ struct hostapd_data *hapd = iface->bss[0];
+ int ret, color;
+ unsigned int i;
+ char *end;
+
+ os_memset(&settings, 0, sizeof(settings));
+ color = strtol(pos, &end, 10);
+ if (pos == end || color < 0 || color > 63) {
+ wpa_printf(MSG_ERROR, "colorchange: invalid color provided");
+ return -1;
+ }
+
+ if (color == iface->conf->he_op.he_bss_color) {
+ wpa_printf(MSG_ERROR, "colorchange: provided color is already set");
+ return -1;
+ }
+
+ if (hapd->cca_in_progress) {
+ wpa_printf(MSG_ERROR, "colorchange: cca is in progress, so color change is now allowed");
+ return -1;
+ }
+
+ for (i = 0; i < iface->num_bss; i++) {
+ struct hostapd_data *bss = iface->bss[i];
+ hostapd_cleanup_cca_params(bss);
+ bss->cca_color = color;
+ bss->cca_count = 10;
+
+ if (hostapd_fill_cca_settings(bss, &settings)) {
+ wpa_printf(MSG_DEBUG, "hostapd fill cca settings failed for color: %d\n", color);
+ hostapd_cleanup_cca_params(bss);
+ continue;
+ }
+
+ wpa_printf(MSG_DEBUG, "Setting user selected color: %d\n", color);
+ ret = hostapd_drv_switch_color(bss, &settings);
+ free_beacon_data(&settings.beacon_cca);
+ free_beacon_data(&settings.beacon_after);
+
+ if (ret)
+ hostapd_cleanup_cca_params(bss);
+ }
+
+ return 0;
+#else /* NEED_AP_MLME */
+ return -1;
+#endif /* NEED_AP_MLME */
+}
static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
char *pos)
@@ -3813,6 +3866,9 @@ static int hostapd_ctrl_iface_receive_pr
} else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) {
if (hostapd_ctrl_iface_chan_switch(hapd->iface, buf + 12))
reply_len = -1;
+ } else if (os_strncmp(buf, "COLOR_CHANGE ", 12) == 0) {
+ if (hostapd_ctrl_iface_color_change(hapd->iface, buf + 12))
+ reply_len = -1;
} else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
reply_size);
Index: hostapd-2021-12-13-b26f5c0f/hostapd/hostapd_cli.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/hostapd/hostapd_cli.c
+++ hostapd-2021-12-13-b26f5c0f/hostapd/hostapd_cli.c
@@ -1150,6 +1150,27 @@ static int hostapd_cli_cmd_fst(struct wp
}
#endif /* CONFIG_FST */
+static int hostapd_cli_cmd_color_change(struct wpa_ctrl *ctrl,
+ int argc, char *argv[])
+{
+ char cmd[256];
+ int res;
+
+ if (argc < 1) {
+ printf("Invalid color_change command: no argument given \n"
+ "usage: <color> \n");
+ return -1;
+ }
+
+ res = os_snprintf(cmd, sizeof(cmd), "COLOR_CHANGE %s",
+ argv[0]);
+ if (os_snprintf_error(sizeof(cmd), res)) {
+ printf("Too long CHAN_CHANGE command\n");
+ return -1;
+ }
+
+ return wpa_ctrl_command(ctrl, cmd);
+}
static int hostapd_cli_cmd_chan_switch(struct wpa_ctrl *ctrl,
int argc, char *argv[])
@@ -1646,6 +1667,8 @@ static const struct hostapd_cli_cmd host
"<cs_count> <freq> [sec_channel_offset=] [center_freq1=]\n"
" [center_freq2=] [bandwidth=] [blocktx] [ht|vht]\n"
" = initiate channel switch announcement" },
+ { "color_change", hostapd_cli_cmd_color_change, NULL,
+ "<color> = initiate bss color change to set user color\n" },
{ "hs20_wnm_notif", hostapd_cli_cmd_hs20_wnm_notif, NULL,
"<addr> <url>\n"
" = send WNM-Notification Subscription Remediation Request" },
Index: hostapd-2021-12-13-b26f5c0f/src/ap/ctrl_iface_ap.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/src/ap/ctrl_iface_ap.c
+++ hostapd-2021-12-13-b26f5c0f/src/ap/ctrl_iface_ap.c
@@ -1063,10 +1063,12 @@ int hostapd_ctrl_iface_status(struct hos
ret = os_snprintf(buf + len, buflen - len,
"he_oper_chwidth=%d\n"
"he_oper_centr_freq_seg0_idx=%d\n"
- "he_oper_centr_freq_seg1_idx=%d\n",
+ "he_oper_centr_freq_seg1_idx=%d\n"
+ "he_bss_color=%d\n",
iface->conf->he_oper_chwidth,
iface->conf->he_oper_centr_freq_seg0_idx,
- iface->conf->he_oper_centr_freq_seg1_idx);
+ iface->conf->he_oper_centr_freq_seg1_idx,
+ iface->conf->he_op.he_bss_color);
if (os_snprintf_error(buflen - len, ret))
return len;
len += ret;
Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.c
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/src/ap/hostapd.c
+++ hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.c
@@ -3429,7 +3429,7 @@ int hostapd_csa_in_progress(struct hosta
#ifdef NEED_AP_MLME
-static void free_beacon_data(struct beacon_data *beacon)
+void free_beacon_data(struct beacon_data *beacon)
{
os_free(beacon->head);
beacon->head = NULL;
@@ -3834,7 +3834,7 @@ void hostapd_cleanup_cca_params(struct h
}
-static int hostapd_fill_cca_settings(struct hostapd_data *hapd,
+int hostapd_fill_cca_settings(struct hostapd_data *hapd,
struct cca_settings *settings)
{
struct hostapd_iface *iface = hapd->iface;
Index: hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.h
===================================================================
--- hostapd-2021-12-13-b26f5c0f.orig/src/ap/hostapd.h
+++ hostapd-2021-12-13-b26f5c0f/src/ap/hostapd.h
@@ -680,10 +680,12 @@ int hostapd_owe_trans_get_info(struct ho
void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
int hostapd_check_max_sta(struct hostapd_data *hapd);
+void free_beacon_data(struct beacon_data *beacon);
#ifdef CONFIG_IEEE80211AX
void hostapd_switch_color(struct hostapd_data *hapd, u64 bitmap);
void hostapd_cleanup_cca_params(struct hostapd_data *hapd);
+int hostapd_fill_cca_settings(struct hostapd_data *hapd, struct cca_settings *settings);
#endif
/* utils.c */

View File

@@ -1,96 +0,0 @@
From f2cc86f874e09b0b1d1247de98f1720aa51080d8 Mon Sep 17 00:00:00 2001
From: Lavanya Suresh <lavaks@codeaurora.org>
Date: Tue, 6 Oct 2020 21:37:04 +0530
Subject: [PATCH] hostapd: Add BCCA IE with countdown zero
During BCCA, BCCA IE with countdown zero has to be added
in the beacon in which new color is updated. Remove BCCA
IE in the beacon template after color change is
completed.
Signed-off-by: Lavanya Suresh <lavaks@codeaurora.org>
---
src/ap/drv_callbacks.c | 6 ++++++
src/ap/hostapd.c | 10 ++++++++--
src/ap/hostapd.h | 1 +
src/ap/ieee802_11_he.c | 2 +-
4 files changed, 16 insertions(+), 3 deletions(-)
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -1802,14 +1802,29 @@ static void hostapd_event_bss_color_coll
static void hostapd_event_cca(struct hostapd_data *hapd, enum wpa_event_type event)
{
+ int b, err;
+
switch (event) {
case EVENT_CCA_STARTED_NOTIFY:
wpa_printf(MSG_DEBUG, "CCA started on %s", hapd->conf->iface);
break;
case EVENT_CCA_NOTIFY:
wpa_printf(MSG_DEBUG, "CCA finished on %s (new color: %d)", hapd->conf->iface, hapd->cca_color);
- hapd->iface->conf->he_op.he_bss_color = hapd->cca_color;
- hostapd_cleanup_cca_params(hapd);
+
+ for (b = 0; b < hapd->iface->num_bss; b++) {
+ if (hapd->iface->bss[b]->cca_color != 0) {
+ hapd->iface->conf->he_op.he_bss_color = hapd->iface->bss[b]->cca_color;
+ hapd->iface->bss[b]->cca_in_progress = 0;
+ err = ieee802_11_set_beacon(hapd->iface->bss[b]);
+ if (err) {
+ wpa_printf(MSG_ERROR, "Failed to remove BCCA IE");
+ hapd->iface->bss[b]->cca_in_progress = 1;
+ }
+ else
+ hostapd_cleanup_cca_params(hapd->iface->bss[b]);
+ }
+ }
+
break;
case EVENT_CCA_ABORTED_NOTIFY:
wpa_printf(MSG_DEBUG, "CCA aborted on %s for cca_color: %d", hapd->conf->iface, hapd->cca_color);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3742,12 +3742,18 @@ int hostapd_fill_cca_settings(struct hos
old_color = iface->conf->he_op.he_bss_color;
iface->conf->he_op.he_bss_color = hapd->cca_color;
+
+ settings->cca_count = hapd->cca_count;
+ settings->cca_color = hapd->cca_color;
+ hapd->cca_count = 0;
+ hapd->cca_zero_count = 1;
+
ret = hostapd_build_beacon_data(hapd, &settings->beacon_after);
iface->conf->he_op.he_bss_color = old_color;
- settings->cca_count = hapd->cca_count;
- settings->cca_color = hapd->cca_color,
+ hapd->cca_count = settings->cca_count;
hapd->cca_in_progress = 1;
+ hapd->cca_zero_count = 0;
ret = hostapd_build_beacon_data(hapd, &settings->beacon_cca);
if (ret) {
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -298,6 +298,7 @@ struct hostapd_data {
#ifdef CONFIG_IEEE80211AX
int cca_in_progress;
+ int cca_zero_count;
u8 cca_count;
u8 cca_color;
unsigned int cca_c_off_beacon;
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -496,7 +496,7 @@ int hostapd_get_he_twt_responder(struct
u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid)
{
- if (!hapd->cca_in_progress)
+ if (!hapd->cca_in_progress && !hapd->cca_zero_count)
return eid;
*eid++ = WLAN_EID_EXTENSION;
*eid++ = 3;

View File

@@ -1,70 +0,0 @@
From 7c0383bf8883e2bad9c7beb47712105be38b5427 Mon Sep 17 00:00:00 2001
From: Lavanya Suresh <lavaks@codeaurora.org>
Date: Wed, 7 Oct 2020 13:29:03 +0530
Subject: [PATCH] hostapd: Check free colors periodically if no new color is
available
In case of collision, if all the colors are in use, start dot11APcollision
timer(50s) and check for new color after timeout.
Signed-off-by: Lavanya Suresh <lavaks@codeaurora.org>
---
src/ap/hostapd.c | 20 +++++++++++++++++---
src/ap/hostapd.h | 1 +
2 files changed, 18 insertions(+), 3 deletions(-)
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3781,11 +3781,12 @@ hostapd_switch_color_timeout_handler(voi
return;
/* check if there has been a recent collision */
- if (now.sec - hapd->last_color_collision.sec > 50)
+ if (now.sec - hapd->last_color_collision.sec > 50 && !hapd->no_free_color)
return;
neighbor_color = ap_list_get_color(hapd->iface);
- neighbor_color |= hapd->color_collision_bitmap;
+ if (!hapd->no_free_color)
+ neighbor_color |= hapd->color_collision_bitmap;
r = os_random() % HE_OPERATION_BSS_COLOR_MAX - 1;
r++;
@@ -3797,13 +3798,26 @@ hostapd_switch_color_timeout_handler(voi
}
if (i == HE_OPERATION_BSS_COLOR_MAX) {
/* there are no free colors so turn bss coloring off */
- wpa_printf(MSG_INFO, "no free colors left, turning of BSS coloring");
+ wpa_printf(MSG_INFO, "no free colors left, turning off BSS coloring");
hapd->iface->conf->he_op.he_bss_color_disabled = 1;
+ hapd->no_free_color = 1;
for (b = 0; b < hapd->iface->num_bss; b++)
ieee802_11_set_beacon(hapd->iface->bss[b]);
+
+ /* Enabling for next check after timeout*/
+ hapd->iface->conf->he_op.he_bss_color_disabled = 0;
+
+ /* start timer for DOT11BSS_COLOR_COLLISION_AP_PERIOD, and check free color on timeout */
+ if (!eloop_is_timeout_registered(hostapd_switch_color_timeout_handler, hapd, NULL))
+ eloop_register_timeout(DOT11BSS_COLOR_COLLISION_AP_PERIOD, 0,
+ hostapd_switch_color_timeout_handler, hapd, NULL);
+
return;
}
+ if (hapd->no_free_color)
+ hapd->no_free_color = 0;
+
for (b = 0; b < hapd->iface->num_bss; b++) {
struct hostapd_data *bss = hapd->iface->bss[b];
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -299,6 +299,7 @@ struct hostapd_data {
#ifdef CONFIG_IEEE80211AX
int cca_in_progress;
int cca_zero_count;
+ int no_free_color;
u8 cca_count;
u8 cca_color;
unsigned int cca_c_off_beacon;

View File

@@ -1,37 +0,0 @@
From 93f695bfe52dd725841fcca71ed4e14e9a90e1dc Mon Sep 17 00:00:00 2001
From: Abinaya Kalaiselvan <akalaise@codeaurora.org>
Date: Wed, 25 Nov 2020 19:58:58 +0530
Subject: [PATCH] hostapd: fix int-in-bool-context Werror
Add changes to fix the below compilation error.
./src/rsn_supp/wpa.c:621:35: error: ?: using integer constants
in boolean context, the expression will always evaluate
to 'true' [-Werror=int-in-bool-context]
Signed-off-by: Abinaya Kalaiselvan <akalaise@codeaurora.org>
---
src/rsn_supp/wpa.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index 3205527..88c1e3e 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -615,10 +615,11 @@ static int wpa_handle_ext_key_id(struct wpa_sm *sm,
{
if (sm->ext_key_id) {
u16 key_id;
+ u8 use_ext_key_id;
if (!kde->key_id) {
- wpa_msg(sm->ctx->msg_ctx,
- sm->use_ext_key_id ? MSG_INFO : MSG_DEBUG,
+ use_ext_key_id = sm->use_ext_key_id ? MSG_INFO : MSG_DEBUG;
+ wpa_msg(sm->ctx->msg_ctx, use_ext_key_id,
"RSN: No Key ID in Extended Key ID handshake");
sm->keyidx_active = 0;
return sm->use_ext_key_id ? -1 : 0;
--
2.7.4

View File

@@ -1,32 +0,0 @@
From 789bc909ea59671e43fa89e539cca3b8970275fb Mon Sep 17 00:00:00 2001
From: Muna Sinada <msinada@codeaurora.org>
Date: Mon, 30 Nov 2020 20:37:14 -0800
Subject: [PATCH] hostapd: Initilize chan for second 80 mhz to zero
CSA updates freq for CSA beacons and after CSA beacons utilizing
hostapd_change_config_freq(). In the case of 80+80 MHz, there are two
channels store, one for the 80 MHz and the second 80 MHz. In non
80+80 cases, the second channel needs to be initialized to zero or
else garbage values are stored in place.
Signed-off-by: Muna Sinada <msinada@codeaurora.org>
---
src/ap/hostapd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 346d83cfda91..fa46667017f4 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3455,7 +3455,7 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
struct hostapd_freq_params *old_params)
{
int channel;
- u8 seg0, seg1;
+ u8 seg0, seg1 = 0;
struct hostapd_hw_modes *mode;
if (!params->channel) {
--
2.7.4

Some files were not shown because too many files have changed in this diff Show More