Skip to content

Commit

Permalink
Upload new v5.6.4.1 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
kimocoder committed Jun 22, 2019
1 parent 7938cb9 commit decdb78
Show file tree
Hide file tree
Showing 36 changed files with 986 additions and 429 deletions.
6 changes: 0 additions & 6 deletions Kconfig

This file was deleted.

8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
EXTRA_CFLAGS += -O1
#EXTRA_CFLAGS += -O3
EXTRA_CFLAGS += -Wall
EXTRA_CFLAGS += -Wextra
#EXTRA_CFLAGS += -Wall
#EXTRA_CFLAGS += -Wextra
#EXTRA_CFLAGS += -Werror
#EXTRA_CFLAGS += -pedantic
#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
Expand Down Expand Up @@ -585,6 +585,10 @@ endif

########### HAL_RTL8814A #################################
ifeq ($(CONFIG_RTL8814A), y)
## ADD NEW VHT MP HW TX MODE ##
#EXTRA_CFLAGS += -DCONFIG_MP_VHT_HW_TX_MODE
#CONFIG_MP_VHT_HW_TX_MODE = y
##########################################
RTL871X = rtl8814a
ifeq ($(CONFIG_USB_HCI), y)
MODULE_NAME = 8814au
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,3 @@ at the end of file /etc/NetworkManager/NetworkManager.conf and restart NetworkMa
sudo service NetworkManager restart
```

### Other sources worth checking out
```
new rtw88 mac80211 driver: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/log/rtw88
wireless git: https://git.kernel.org/pub/scm/linux/kernel/git/jh/wireless.git/log/
wireless testing git: https://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git/log/
wpa_supplicant git: https://w1.fi/cgit/hostap/log/
Binary file modified ReleaseNotes.pdf
Binary file not shown.
23 changes: 1 addition & 22 deletions core/mesh/rtw_mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1179,33 +1179,12 @@ void rtw_mesh_adjust_chbw(u8 req_ch, u8 *req_bw, u8 *req_offset)
}
}

int rtw_sae_check_frames(_adapter *adapter, const u8 *buf, u32 len, u8 tx)
void rtw_mesh_sae_check_frames(_adapter *adapter, const u8 *buf, u32 len, u8 tx, u16 alg, u16 seq, u16 status)
{
const u8 *frame_body = buf + sizeof(struct rtw_ieee80211_hdr_3addr);
u16 alg;
u16 seq;
u16 status;
int ret = 0;

alg = RTW_GET_LE16(frame_body);
if (alg != 3)
goto exit;

seq = RTW_GET_LE16(frame_body + 2);
status = RTW_GET_LE16(frame_body + 4);

RTW_INFO("RTW_%s:AUTH alg:0x%04x, seq:0x%04x, status:0x%04x\n"
, (tx == _TRUE) ? "Tx" : "Rx", alg, seq, status);

ret = 1;

#if CONFIG_RTW_MESH_PEER_BLACKLIST
if (tx && seq == 1)
rtw_mesh_plink_set_peer_conf_timeout(adapter, GetAddr1Ptr(buf));
#endif

exit:
return ret;
}

#if CONFIG_RTW_MPM_TX_IES_SYNC_BSS
Expand Down
2 changes: 1 addition & 1 deletion core/mesh/rtw_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ void dump_mesh_networks(void *sel, _adapter *adapter);

void rtw_mesh_adjust_chbw(u8 req_ch, u8 *req_bw, u8 *req_offset);

int rtw_sae_check_frames(_adapter *adapter, const u8 *buf, u32 len, u8 tx);
void rtw_mesh_sae_check_frames(_adapter *adapter, const u8 *buf, u32 len, u8 tx, u16 alg, u16 seq, u16 status);
int rtw_mesh_check_frames_tx(_adapter *adapter, const u8 **buf, size_t *len);
int rtw_mesh_check_frames_rx(_adapter *adapter, const u8 *buf, size_t len);

Expand Down
40 changes: 37 additions & 3 deletions core/rtw_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *d
u8 bmatch = _FALSE;
u8 *pie = pnetwork->IEs;
u8 *p = NULL, *dst_ie = NULL, *premainder_ie = NULL, *pbackup_remainder_ie = NULL;
u32 i, offset, ielen = 0, ie_offset, remainder_ielen = 0;
u32 i, offset, ielen, ie_offset, remainder_ielen = 0;

for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;) {
pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i);
Expand Down Expand Up @@ -1897,6 +1897,7 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
u16 cap, ht_cap = _FALSE;
uint ie_len = 0;
int group_cipher, pairwise_cipher;
u32 akm;
u8 mfp_opt = MFP_NO;
u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX];
int supportRateNum = 0;
Expand Down Expand Up @@ -2057,20 +2058,30 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
psecuritypriv->wpa_psk = 0;

/* wpa2 */
akm = 0;
group_cipher = 0;
pairwise_cipher = 0;
psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_;
psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _RSN_IE_2_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p && ie_len > 0) {
if (rtw_parse_wpa2_ie(p, ie_len + 2, &group_cipher, &pairwise_cipher, NULL, &mfp_opt) == _SUCCESS) {
if (rtw_parse_wpa2_ie(p, ie_len + 2, &group_cipher, &pairwise_cipher, &akm, &mfp_opt) == _SUCCESS) {
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK;
psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */
psecuritypriv->wpa_psk |= BIT(1);

psecuritypriv->wpa2_group_cipher = group_cipher;
psecuritypriv->wpa2_pairwise_cipher = pairwise_cipher;

/*
Kernel < v5.1, the auth_type set as NL80211_AUTHTYPE_AUTOMATIC
in cfg80211_rtw_start_ap().
if the AKM SAE in the RSN IE, we have to update the auth_type for SAE
in rtw_check_beacon_data().
*/
if (CHECK_BIT(WLAN_AKM_TYPE_SAE, akm))
psecuritypriv->auth_type = NL80211_AUTHTYPE_SAE;
#if 0
switch (group_cipher) {
case WPA_CIPHER_NONE:
Expand Down Expand Up @@ -3858,6 +3869,12 @@ u8 ap_free_sta(_adapter *padapter, struct sta_info *psta, bool active, u16 reaso

_enter_critical_bh(&psta->lock, &irqL);
psta->state &= ~(_FW_LINKED | WIFI_UNDER_KEY_HANDSHAKE);

if ((psta->auth_len != 0) && (psta->pauth_frame != NULL)) {
rtw_mfree(psta->pauth_frame, psta->auth_len);
psta->pauth_frame = NULL;
psta->auth_len = 0;
}
_exit_critical_bh(&psta->lock, &irqL);

if (!MLME_IS_MESH(padapter)) {
Expand Down Expand Up @@ -5172,6 +5189,7 @@ u16 rtw_ap_parse_sta_security_ie(_adapter *adapter, struct sta_info *sta, struct
u8 *wpa_ie;
int wpa_ie_len;
int group_cipher = 0, pairwise_cipher = 0;
u32 akm = 0;
u8 mfp_opt = MFP_NO;
u16 status = _STATS_SUCCESSFUL_;

Expand All @@ -5187,13 +5205,17 @@ u16 rtw_ap_parse_sta_security_ie(_adapter *adapter, struct sta_info *sta, struct
wpa_ie = elems->rsn_ie;
wpa_ie_len = elems->rsn_ie_len;

if (rtw_parse_wpa2_ie(wpa_ie - 2, wpa_ie_len + 2, &group_cipher, &pairwise_cipher, NULL, &mfp_opt) == _SUCCESS) {
if (rtw_parse_wpa2_ie(wpa_ie - 2, wpa_ie_len + 2, &group_cipher, &pairwise_cipher, &akm, &mfp_opt) == _SUCCESS) {
sta->dot8021xalg = 1;/* psk, todo:802.1x */
sta->wpa_psk |= BIT(1);

sta->wpa2_group_cipher = group_cipher & sec->wpa2_group_cipher;
sta->wpa2_pairwise_cipher = pairwise_cipher & sec->wpa2_pairwise_cipher;

sta->akm_suite_type = akm;
if ((CHECK_BIT(WLAN_AKM_TYPE_SAE, akm)) && (MFP_NO == mfp_opt))
status = WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION;

if (!sta->wpa2_group_cipher)
status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID;

Expand Down Expand Up @@ -5239,6 +5261,18 @@ u16 rtw_ap_parse_sta_security_ie(_adapter *adapter, struct sta_info *sta, struct
else if (sec->mfp_opt >= MFP_OPTIONAL && mfp_opt >= MFP_OPTIONAL)
sta->flags |= WLAN_STA_MFP;

if ((sec->auth_type == NL80211_AUTHTYPE_SAE) &&
(CHECK_BIT(WLAN_AKM_TYPE_SAE, sta->akm_suite_type)) &&
(WLAN_AUTH_OPEN == sta->authalg)) {
/* WPA3-SAE, PMK caching */
if (rtw_cached_pmkid(adapter, sta->cmn.mac_addr) == -1) {
RTW_INFO("SAE: No PMKSA cache entry found\n");
status = WLAN_STATUS_INVALID_PMKID;
} else {
RTW_INFO("SAE: PMKSA cache entry found\n");
}
}

if (status != _STATS_SUCCESSFUL_)
goto exit;

Expand Down
153 changes: 61 additions & 92 deletions core/rtw_ieee80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,28 @@ u8 WPA_CIPHER_SUITE_CCMP[] = { 0x00, 0x50, 0xf2, 4 };
u8 WPA_CIPHER_SUITE_WEP104[] = { 0x00, 0x50, 0xf2, 5 };

u16 RSN_VERSION_BSD = 1;
u8 RSN_AUTH_KEY_MGMT_UNSPEC_802_1X[] = { 0x00, 0x0f, 0xac, 1 };
u8 RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X[] = { 0x00, 0x0f, 0xac, 2 };
u8 RSN_CIPHER_SUITE_NONE[] = { 0x00, 0x0f, 0xac, 0 };
u8 RSN_CIPHER_SUITE_WEP40[] = { 0x00, 0x0f, 0xac, 1 };
u8 RSN_CIPHER_SUITE_TKIP[] = { 0x00, 0x0f, 0xac, 2 };
u8 RSN_CIPHER_SUITE_WRAP[] = { 0x00, 0x0f, 0xac, 3 };
u8 RSN_CIPHER_SUITE_CCMP[] = { 0x00, 0x0f, 0xac, 4 };
u8 RSN_CIPHER_SUITE_WEP104[] = { 0x00, 0x0f, 0xac, 5 };

u8 WLAN_AKM_8021X[] = {0x00, 0x0f, 0xac, 1};
u8 WLAN_AKM_PSK[] = {0x00, 0x0f, 0xac, 2};
u8 WLAN_AKM_FT_8021X[] = {0x00, 0x0f, 0xac, 3};
u8 WLAN_AKM_FT_PSK[] = {0x00, 0x0f, 0xac, 4};
u8 WLAN_AKM_8021X_SHA256[] = {0x00, 0x0f, 0xac, 5};
u8 WLAN_AKM_PSK_SHA256[] = {0x00, 0x0f, 0xac, 6};
u8 WLAN_AKM_TDLS[] = {0x00, 0x0f, 0xac, 7};
u8 WLAN_AKM_SAE[] = {0x00, 0x0f, 0xac, 8};
u8 WLAN_AKM_FT_OVER_SAE[] = {0x00, 0x0f, 0xac, 9};
u8 WLAN_AKM_8021X_SUITE_B[] = {0x00, 0x0f, 0xac, 11};
u8 WLAN_AKM_8021X_SUITE_B_192[] = {0x00, 0x0f, 0xac, 12};
u8 WLAN_AKM_FILS_SHA256[] = {0x00, 0x0f, 0xac, 14};
u8 WLAN_AKM_FILS_SHA384[] = {0x00, 0x0f, 0xac, 15};
u8 WLAN_AKM_FT_FILS_SHA256[] = {0x00, 0x0f, 0xac, 16};
u8 WLAN_AKM_FT_FILS_SHA384[] = {0x00, 0x0f, 0xac, 17};
/* -----------------------------------------------------------
* for adhoc-master to generate ie and provide supported-rate to fw
* ----------------------------------------------------------- */
Expand Down Expand Up @@ -661,8 +675,44 @@ int rtw_get_wpa2_cipher_suite(u8 *s)
return 0;
}

u32 rtw_get_akm_suite_bitmap(u8 *s)
{
if (_rtw_memcmp(s, WLAN_AKM_8021X, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_8021X;
if (_rtw_memcmp(s, WLAN_AKM_PSK, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_PSK;
if (_rtw_memcmp(s, WLAN_AKM_FT_8021X, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_FT_8021X;
if (_rtw_memcmp(s, WLAN_AKM_FT_PSK, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_FT_PSK;
if (_rtw_memcmp(s, WLAN_AKM_8021X_SHA256, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_8021X_SHA256;
if (_rtw_memcmp(s, WLAN_AKM_PSK_SHA256, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_PSK_SHA256;
if (_rtw_memcmp(s, WLAN_AKM_TDLS, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_TDLS;
if (_rtw_memcmp(s, WLAN_AKM_SAE, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_SAE;
if (_rtw_memcmp(s, WLAN_AKM_FT_OVER_SAE, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_FT_OVER_SAE;
if (_rtw_memcmp(s, WLAN_AKM_8021X_SUITE_B, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_8021X_SUITE_B;
if (_rtw_memcmp(s, WLAN_AKM_8021X_SUITE_B_192, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_8021X_SUITE_B_192;
if (_rtw_memcmp(s, WLAN_AKM_FILS_SHA256, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_FILS_SHA256;
if (_rtw_memcmp(s, WLAN_AKM_FILS_SHA384, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_FILS_SHA384;
if (_rtw_memcmp(s, WLAN_AKM_FT_FILS_SHA256, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_FT_FILS_SHA256;
if (_rtw_memcmp(s, WLAN_AKM_FT_FILS_SHA384, RSN_SELECTOR_LEN) == _TRUE)
return WLAN_AKM_TYPE_FT_FILS_SHA384;

return 0;
}

int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher, int *is_8021x)
int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
int *pairwise_cipher, u32 *akm)
{
int i, ret = _SUCCESS;
int left, count;
Expand Down Expand Up @@ -721,11 +771,11 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
return _FAIL;
}

if (is_8021x) {
if (akm) {
if (left >= 6) {
pos += 2;
if (_rtw_memcmp(pos, SUITE_1X, 4) == 1) {
*is_8021x = 1;
*akm = WLAN_AKM_TYPE_8021X;
}
}
}
Expand Down Expand Up @@ -833,11 +883,11 @@ int rtw_rsne_info_parse(const u8 *ie, uint ie_len, struct rsne_info *info)
return _FAIL;
}

int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwise_cipher, int *is_8021x, u8 *mfp_opt)
int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher,
int *pairwise_cipher, u32 *akm, u8 *mfp_opt)
{
struct rsne_info info;
int i, ret = _SUCCESS;
u8 SUITE_1X[4] = {0x00, 0x0f, 0xac, 0x01};

ret = rtw_rsne_info_parse(rsn_ie, rsn_ie_len, &info);
if (ret != _SUCCESS)
Expand All @@ -856,11 +906,10 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
*pairwise_cipher |= rtw_get_wpa2_cipher_suite(info.pcs_list + 4 * i);
}

if (is_8021x) {
*is_8021x = 0;
/* here only check the first AKM suite */
if (info.akm_cnt && _rtw_memcmp(SUITE_1X, info.akm_list, 4) == _TRUE)
*is_8021x = 1;
if (akm) {
*akm = 0;
for (i = 0; i < info.akm_cnt; i++)
*akm |= rtw_get_akm_suite_bitmap(info.akm_list + 4 * i);
}

if (mfp_opt) {
Expand Down Expand Up @@ -2660,86 +2709,6 @@ int ieee80211_get_hdrlen(u16 fc)
return hdrlen;
}

int rtw_get_cipher_info(struct wlan_network *pnetwork)
{
u32 wpa_ielen;
unsigned char *pbuf;
int group_cipher = 0, pairwise_cipher = 0, is8021x = 0;
int ret = _FAIL;
pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength - 12);

if (pbuf && (wpa_ielen > 0)) {
if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen + 2, &group_cipher, &pairwise_cipher, &is8021x)) {

pnetwork->BcnInfo.pairwise_cipher = pairwise_cipher;
pnetwork->BcnInfo.group_cipher = group_cipher;
pnetwork->BcnInfo.is_8021x = is8021x;
ret = _SUCCESS;
}
} else {

pbuf = rtw_get_wpa2_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength - 12);

if (pbuf && (wpa_ielen > 0)) {
if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen + 2, &group_cipher, &pairwise_cipher, &is8021x, NULL)) {
pnetwork->BcnInfo.pairwise_cipher = pairwise_cipher;
pnetwork->BcnInfo.group_cipher = group_cipher;
pnetwork->BcnInfo.is_8021x = is8021x;
ret = _SUCCESS;
}
}
}

return ret;
}

void rtw_get_bcn_info(struct wlan_network *pnetwork)
{
unsigned short cap = 0;
u8 bencrypt = 0;
/* u8 wpa_ie[255],rsn_ie[255]; */
u16 wpa_len = 0, rsn_len = 0;
struct HT_info_element *pht_info = NULL;
struct rtw_ieee80211_ht_cap *pht_cap = NULL;
unsigned int len;
unsigned char *p;

_rtw_memcpy((u8 *)&cap, rtw_get_capability_from_ie(pnetwork->network.IEs), 2);
cap = le16_to_cpu(cap);
if (cap & WLAN_CAPABILITY_PRIVACY) {
bencrypt = 1;
pnetwork->network.Privacy = 1;
} else
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_OPENSYS;
rtw_get_sec_ie(pnetwork->network.IEs , pnetwork->network.IELength, NULL, &rsn_len, NULL, &wpa_len);

if (rsn_len > 0)
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_WPA2;
else if (wpa_len > 0)
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_WPA;
else {
if (bencrypt)
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_WEP;
}
rtw_get_cipher_info(pnetwork);

/* get bwmode and ch_offset */
/* parsing HT_CAP_IE */
p = rtw_get_ie(pnetwork->network.IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pnetwork->network.IELength - _FIXED_IE_LENGTH_);
if (p && len > 0) {
pht_cap = (struct rtw_ieee80211_ht_cap *)(p + 2);
pnetwork->BcnInfo.ht_cap_info = pht_cap->cap_info;
} else
pnetwork->BcnInfo.ht_cap_info = 0;
/* parsing HT_INFO_IE */
p = rtw_get_ie(pnetwork->network.IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, pnetwork->network.IELength - _FIXED_IE_LENGTH_);
if (p && len > 0) {
pht_info = (struct HT_info_element *)(p + 2);
pnetwork->BcnInfo.ht_info_infos_0 = pht_info->infos[0];
} else
pnetwork->BcnInfo.ht_info_infos_0 = 0;
}

u8 rtw_ht_mcsset_to_nss(u8 *supp_mcs_set)
{
u8 nss = 1;
Expand Down
Loading

0 comments on commit decdb78

Please sign in to comment.