qcacld-3.0: increase the max supported number of MAC ACL

Extend type of the variables for the number of MAC addresses
in ACL, from 255(uint8_t) to 65535(uint16_t).
With this change, it can support up to 65535 MAC addresses in
theory, after modifying the MACRO 'MAX_ACL_MAC_ADDRESS'.

Change-Id: I32288e46ea4590ebaaa143b2cdca7cefd14997c4
CRs-Fixed: 2856707
This commit is contained in:
Yu Wang
2021-01-19 10:48:47 +08:00
committed by snandini
parent 8553c2b4d2
commit d91ac3bd8e
5 changed files with 35 additions and 36 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -288,7 +288,7 @@ static QDF_STATUS hdd_print_acl(struct hdd_adapter *adapter)
{ {
eSapMacAddrACL acl_mode; eSapMacAddrACL acl_mode;
struct qdf_mac_addr maclist[MAX_ACL_MAC_ADDRESS]; struct qdf_mac_addr maclist[MAX_ACL_MAC_ADDRESS];
uint8_t listnum; uint16_t listnum;
struct sap_context *sap_ctx; struct sap_context *sap_ctx;
sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter); sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -487,8 +487,8 @@ struct sap_config {
uint32_t ch_width_orig; uint32_t ch_width_orig;
uint8_t max_num_sta; /* maximum number of STAs in station table */ uint8_t max_num_sta; /* maximum number of STAs in station table */
uint8_t dtim_period; /* dtim interval */ uint8_t dtim_period; /* dtim interval */
uint8_t num_accept_mac; uint16_t num_accept_mac;
uint8_t num_deny_mac; uint16_t num_deny_mac;
/* Max ie length 255 * 2(WPA+RSN) + 2 bytes(vendor specific ID) * 2 */ /* Max ie length 255 * 2(WPA+RSN) + 2 bytes(vendor specific ID) * 2 */
uint8_t RSNWPAReqIE[(WLAN_MAX_IE_LEN * 2) + 4]; uint8_t RSNWPAReqIE[(WLAN_MAX_IE_LEN * 2) + 4];
/* it is ignored if [0] is 0. */ /* it is ignored if [0] is 0. */
@@ -1002,7 +1002,7 @@ QDF_STATUS wlansap_clear_acl(struct sap_context *sap_ctx);
*/ */
QDF_STATUS wlansap_get_acl_accept_list(struct sap_context *sap_ctx, QDF_STATUS wlansap_get_acl_accept_list(struct sap_context *sap_ctx,
struct qdf_mac_addr *pAcceptList, struct qdf_mac_addr *pAcceptList,
uint8_t *nAcceptList); uint16_t *nAcceptList);
/** /**
* wlansap_is_channel_present_in_acs_list() - Freq present in ACS list or not * wlansap_is_channel_present_in_acs_list() - Freq present in ACS list or not
@@ -1028,7 +1028,7 @@ bool wlansap_is_channel_present_in_acs_list(uint32_t freq,
*/ */
QDF_STATUS wlansap_get_acl_deny_list(struct sap_context *sap_ctx, QDF_STATUS wlansap_get_acl_deny_list(struct sap_context *sap_ctx,
struct qdf_mac_addr *pDenyList, struct qdf_mac_addr *pDenyList,
uint8_t *nDenyList); uint16_t *nDenyList);
/** /**
* wlansap_set_acl_mode() - Set the SAP ACL mode * wlansap_set_acl_mode() - Set the SAP ACL mode

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -3024,9 +3024,9 @@ void sap_free_roam_profile(struct csr_roam_profile *profile)
} }
} }
void sap_sort_mac_list(struct qdf_mac_addr *macList, uint8_t size) void sap_sort_mac_list(struct qdf_mac_addr *macList, uint16_t size)
{ {
uint8_t outer, inner; uint16_t outer, inner;
struct qdf_mac_addr temp; struct qdf_mac_addr temp;
int32_t nRes = -1; int32_t nRes = -1;
@@ -3057,11 +3057,10 @@ void sap_sort_mac_list(struct qdf_mac_addr *macList, uint8_t size)
bool bool
sap_search_mac_list(struct qdf_mac_addr *macList, sap_search_mac_list(struct qdf_mac_addr *macList,
uint8_t num_mac, uint8_t *peerMac, uint16_t num_mac, uint8_t *peerMac,
uint8_t *index) uint16_t *index)
{ {
int32_t nRes = -1; int32_t nRes = -1, nStart = 0, nEnd, nMiddle;
int8_t nStart = 0, nEnd, nMiddle;
nEnd = num_mac - 1; nEnd = num_mac - 1;
@@ -3081,7 +3080,7 @@ sap_search_mac_list(struct qdf_mac_addr *macList,
/* "index equals NULL" means the caller does not need the */ /* "index equals NULL" means the caller does not need the */
/* index value of the peerMac being searched */ /* index value of the peerMac being searched */
if (index) { if (index) {
*index = (uint8_t) nMiddle; *index = (uint16_t)nMiddle;
sap_debug("index %d", *index); sap_debug("index %d", *index);
} }
return true; return true;
@@ -3097,7 +3096,7 @@ sap_search_mac_list(struct qdf_mac_addr *macList,
} }
void sap_add_mac_to_acl(struct qdf_mac_addr *macList, void sap_add_mac_to_acl(struct qdf_mac_addr *macList,
uint8_t *size, uint8_t *peerMac) uint16_t *size, uint8_t *peerMac)
{ {
int32_t nRes = -1; int32_t nRes = -1;
int i; int i;
@@ -3129,7 +3128,7 @@ void sap_add_mac_to_acl(struct qdf_mac_addr *macList,
} }
void sap_remove_mac_from_acl(struct qdf_mac_addr *macList, void sap_remove_mac_from_acl(struct qdf_mac_addr *macList,
uint8_t *size, uint8_t index) uint16_t *size, uint16_t index)
{ {
int i; int i;
@@ -3158,9 +3157,9 @@ void sap_remove_mac_from_acl(struct qdf_mac_addr *macList,
(*size)--; (*size)--;
} }
void sap_print_acl(struct qdf_mac_addr *macList, uint8_t size) void sap_print_acl(struct qdf_mac_addr *macList, uint16_t size)
{ {
int i; uint16_t i;
uint8_t *macArray; uint8_t *macArray;
sap_debug("print acl entered"); sap_debug("print acl entered");

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -162,9 +162,9 @@ struct sap_context {
/* Mac filtering settings */ /* Mac filtering settings */
eSapMacAddrACL eSapMacAddrAclMode; eSapMacAddrACL eSapMacAddrAclMode;
struct qdf_mac_addr acceptMacList[MAX_ACL_MAC_ADDRESS]; struct qdf_mac_addr acceptMacList[MAX_ACL_MAC_ADDRESS];
uint8_t nAcceptMac; uint16_t nAcceptMac;
struct qdf_mac_addr denyMacList[MAX_ACL_MAC_ADDRESS]; struct qdf_mac_addr denyMacList[MAX_ACL_MAC_ADDRESS];
uint8_t nDenyMac; uint16_t nDenyMac;
void *user_context; void *user_context;
@@ -319,22 +319,22 @@ QDF_STATUS
sap_is_peer_mac_allowed(struct sap_context *sap_ctx, uint8_t *peerMac); sap_is_peer_mac_allowed(struct sap_context *sap_ctx, uint8_t *peerMac);
void void
sap_sort_mac_list(struct qdf_mac_addr *macList, uint8_t size); sap_sort_mac_list(struct qdf_mac_addr *macList, uint16_t size);
void void
sap_add_mac_to_acl(struct qdf_mac_addr *macList, uint8_t *size, sap_add_mac_to_acl(struct qdf_mac_addr *macList, uint16_t *size,
uint8_t *peerMac); uint8_t *peerMac);
void void
sap_remove_mac_from_acl(struct qdf_mac_addr *macList, uint8_t *size, sap_remove_mac_from_acl(struct qdf_mac_addr *macList, uint16_t *size,
uint8_t index); uint16_t index);
void void
sap_print_acl(struct qdf_mac_addr *macList, uint8_t size); sap_print_acl(struct qdf_mac_addr *macList, uint16_t size);
bool bool
sap_search_mac_list(struct qdf_mac_addr *macList, uint8_t num_mac, sap_search_mac_list(struct qdf_mac_addr *macList, uint16_t num_mac,
uint8_t *peerMac, uint8_t *index); uint8_t *peerMac, uint16_t *index);
QDF_STATUS sap_init_dfs_channel_nol_list(struct sap_context *sap_ctx); QDF_STATUS sap_init_dfs_channel_nol_list(struct sap_context *sap_ctx);

View File

@@ -921,7 +921,7 @@ QDF_STATUS wlansap_get_acl_mode(struct sap_context *sap_ctx,
QDF_STATUS wlansap_get_acl_accept_list(struct sap_context *sap_ctx, QDF_STATUS wlansap_get_acl_accept_list(struct sap_context *sap_ctx,
struct qdf_mac_addr *pAcceptList, struct qdf_mac_addr *pAcceptList,
uint8_t *nAcceptList) uint16_t *nAcceptList)
{ {
if (!sap_ctx) { if (!sap_ctx) {
sap_err("Invalid SAP pointer"); sap_err("Invalid SAP pointer");
@@ -936,7 +936,7 @@ QDF_STATUS wlansap_get_acl_accept_list(struct sap_context *sap_ctx,
QDF_STATUS wlansap_get_acl_deny_list(struct sap_context *sap_ctx, QDF_STATUS wlansap_get_acl_deny_list(struct sap_context *sap_ctx,
struct qdf_mac_addr *pDenyList, struct qdf_mac_addr *pDenyList,
uint8_t *nDenyList) uint16_t *nDenyList)
{ {
if (!sap_ctx) { if (!sap_ctx) {
sap_err("Invalid SAP pointer from p_cds_gctx"); sap_err("Invalid SAP pointer from p_cds_gctx");
@@ -951,13 +951,13 @@ QDF_STATUS wlansap_get_acl_deny_list(struct sap_context *sap_ctx,
QDF_STATUS wlansap_clear_acl(struct sap_context *sap_ctx) QDF_STATUS wlansap_clear_acl(struct sap_context *sap_ctx)
{ {
uint8_t i; uint16_t i;
if (!sap_ctx) { if (!sap_ctx) {
return QDF_STATUS_E_RESOURCES; return QDF_STATUS_E_RESOURCES;
} }
for (i = 0; i < (sap_ctx->nDenyMac - 1); i++) { for (i = 0; i < sap_ctx->nDenyMac; i++) {
qdf_mem_zero((sap_ctx->denyMacList + i)->bytes, qdf_mem_zero((sap_ctx->denyMacList + i)->bytes,
QDF_MAC_ADDR_SIZE); QDF_MAC_ADDR_SIZE);
} }
@@ -965,7 +965,7 @@ QDF_STATUS wlansap_clear_acl(struct sap_context *sap_ctx)
sap_print_acl(sap_ctx->denyMacList, sap_ctx->nDenyMac); sap_print_acl(sap_ctx->denyMacList, sap_ctx->nDenyMac);
sap_ctx->nDenyMac = 0; sap_ctx->nDenyMac = 0;
for (i = 0; i < (sap_ctx->nAcceptMac - 1); i++) { for (i = 0; i < sap_ctx->nAcceptMac; i++) {
qdf_mem_zero((sap_ctx->acceptMacList + i)->bytes, qdf_mem_zero((sap_ctx->acceptMacList + i)->bytes,
QDF_MAC_ADDR_SIZE); QDF_MAC_ADDR_SIZE);
} }
@@ -981,7 +981,7 @@ QDF_STATUS wlansap_modify_acl(struct sap_context *sap_ctx,
eSapACLType list_type, eSapACLCmdType cmd) eSapACLType list_type, eSapACLCmdType cmd)
{ {
bool sta_white_list = false, sta_black_list = false; bool sta_white_list = false, sta_black_list = false;
uint8_t staWLIndex, staBLIndex; uint16_t staWLIndex, staBLIndex;
if (!sap_ctx) { if (!sap_ctx) {
sap_err("Invalid SAP Context"); sap_err("Invalid SAP Context");