From 5b5d01f393d6d868428556d20600aff0b0b5e442 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 00:34:58 +0200 Subject: [PATCH 01/15] do not remove device if it is not of type monitor --- dkms.conf | 2 +- os_dep/linux/ioctl_cfg80211.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dkms.conf b/dkms.conf index 3510a97..1d70c91 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="realtek-rtl88xxau" -PACKAGE_VERSION="5.3.4~20190216" +PACKAGE_VERSION="5.3.4~20190406" CLEAN="'make' clean" BUILT_MODULE_NAME[0]=88XXau PROCS_NUM=`nproc` diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 1a1c213..ab36de7 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -4638,7 +4638,11 @@ static int cfg80211_rtw_del_virtual_intf(struct wiphy *wiphy, pwdev_priv = adapter_wdev_data(adapter); if (ndev == pwdev_priv->pmon_ndev) { - unregister_netdevice(ndev); + /* unregister only monitor device + * because only monitor can be added + */ + if(wdev->iftype == NL80211_IFTYPE_MONITOR) + unregister_netdevice(ndev); pwdev_priv->pmon_ndev = NULL; pwdev_priv->ifname_mon[0] = '\0'; RTW_INFO(FUNC_NDEV_FMT" remove monitor ndev\n", FUNC_NDEV_ARG(ndev)); From 4184d7581f6f9f363771a65b32e5e2c82850e83e Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 00:35:45 +0200 Subject: [PATCH 02/15] Add Travis CI integration --- .travis.yml | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7621ea3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,80 @@ +language: c +compiler: gcc +sudo: required + +before_install: + - export ALL_DEB=$(wget --quiet -O - ${KERNEL_URL}v${KVER}/ | grep -o 'href=".*"' | grep -m1 all | cut -d '"' -f 2) + - export KVER_BUILD=$(echo $ALL_DEB | cut -d '_' -f 1 | cut -c15-) + - wget ${KERNEL_URL}v${KVER}/$(wget --quiet -O - ${KERNEL_URL}v${KVER}/ | grep -o 'href=".*"' | grep headers | grep generic | grep -m1 amd64 | cut -d '"' -f 2) + - wget ${KERNEL_URL}v${KVER}/$ALL_DEB + - sudo apt-get update + - sudo apt-get install -y dpkg # to upgrade to dpkg >= 1.17.5ubuntu5.8, which fixes https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1730627 + - sudo dpkg -i *.deb + +script: + - make CC=$COMPILER KVER=$KVER_BUILD-generic + +env: + global: + - KERNEL_URL=http://kernel.ubuntu.com/~kernel-ppa/mainline/ + +matrix: + include: + - compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:ondrej/nginx-mainline' + packages: + - gcc-5 + - libelf-dev + - libssl1.1 + env: COMPILER=gcc-5 KVER=4.20-rc1 + - compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:ondrej/nginx-mainline' + packages: + - gcc-6 + - libelf-dev + - libssl1.1 + env: COMPILER=gcc-6 KVER=4.19.1 + - compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:ondrej/nginx-mainline' + packages: + - gcc-7 + - libelf-dev + - libssl1.1 + env: COMPILER=gcc-7 KVER=4.19.1 + - compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-5 + env: COMPILER=gcc-5 KVER=4.4.97 + - compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-4.9 + env: COMPILER=gcc-4.9 KVER=3.16.50 + - compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-5 + env: COMPILER=gcc-5 KVER=3.14.79 + From fab47eec906b161cd8ba164c4daa5e13a1f676ae Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 00:38:23 +0200 Subject: [PATCH 03/15] Fix includes to support linux --- core/rtw_xmit.c | 1 + include/drv_types.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 2825865..e290c36 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -16,6 +16,7 @@ #include #include +#include #if defined(PLATFORM_LINUX) && defined (PLATFORM_WINDOWS) #error "Shall be Linux or Windows, but not both!\n" diff --git a/include/drv_types.h b/include/drv_types.h index 37f8fc7..05d764a 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -104,7 +104,7 @@ typedef struct _ADAPTER _adapter, ADAPTER, *PADAPTER; #include #include #include -#include +#include "sta_info.h" #include #include #include From 22acde23b9e98ab02f5c81189d79353a243f3ffd Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 00:41:46 +0200 Subject: [PATCH 04/15] Fix alloc stainfo code --- core/rtw_sta_mgt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index bd4ee19..7c13002 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -512,9 +512,7 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr) /* _enter_critical_bh(&(pfree_sta_queue->lock), &irqL); */ _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); - if (_rtw_queue_empty(pfree_sta_queue) == _TRUE) { - /* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL); */ - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); + if (!pstapriv->padapter->pnetdev || _rtw_queue_empty(pfree_sta_queue) == _TRUE) { psta = NULL; } else { psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); From 04c4350de1e43ebeab7b935434ddec1fd5a3f83f Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 00:47:44 +0200 Subject: [PATCH 05/15] Disable IPv6 to work + sysctl restart --- dkms-install.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dkms-install.sh b/dkms-install.sh index 8139bb0..b4c4379 100755 --- a/dkms-install.sh +++ b/dkms-install.sh @@ -20,4 +20,15 @@ RESULT=$? echo "Finished running dkms install steps." + + if echo "net.ipv6.conf.all.disable_ipv6 = 1 + net.ipv6.conf.default.disable_ipv6 = 1 + net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf; then + echo "Disabled IPv6 Successfuly " + sysctl -p + else + echo "Could not disable IPv6" + fi + + exit $RESULT From cb7b83e8a6113e3f9f20ab0772e373cfc1051c29 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 00:51:57 +0200 Subject: [PATCH 06/15] Hostapd/WPS support --- os_dep/linux/ioctl_cfg80211.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index ab36de7..a1ffca0 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -4827,6 +4827,18 @@ static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev, ret = rtw_add_beacon(adapter, settings->beacon.head, settings->beacon.head_len, settings->beacon.tail, settings->beacon.tail_len); + // In cases like WPS, the proberesp and assocresp IEs vary from the beacon, and need to be explicitly set + if(ret == 0) { + if(settings->beacon.proberesp_ies && settings->beacon.proberesp_ies_len > 0) { + rtw_cfg80211_set_mgnt_wpsp2pie(ndev, (char *)settings->beacon.proberesp_ies, + settings->beacon.proberesp_ies_len, 0x2/*PROBE_RESP*/); + } + if(settings->beacon.assocresp_ies && settings->beacon.assocresp_ies_len < 0) { + rtw_cfg80211_set_mgnt_wpsp2pie(ndev, (char *)settings->beacon.assocresp_ies, + settings->beacon.assocresp_ies_len, 0x4/*ASSOC_RESP*/); + } + } + adapter->mlmeextpriv.mlmext_info.hidden_ssid_mode = settings->hidden_ssid; if (settings->ssid && settings->ssid_len) { @@ -4863,6 +4875,18 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len); + // In cases like WPS, the proberesp and assocresp IEs vary from the beacon, and need to be explicitly set + if(ret == 0) { + if(info->proberesp_ies && info->proberesp_ies_len > 0) { + rtw_cfg80211_set_mgnt_wpsp2pie(ndev, (char *)info->proberesp_ies, + info->proberesp_ies_len, 0x2/*PROBE_RESP*/); + } + if(info->assocresp_ies && info->assocresp_ies_len > 0) { + rtw_cfg80211_set_mgnt_wpsp2pie(ndev, (char *)info->assocresp_ies, + info->assocresp_ies_len, 0x4/*ASSOC_RESP*/); + } + } + return ret; } From fa3502159030ca962a1244199bc2480a12ac89a7 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 01:06:06 +0200 Subject: [PATCH 07/15] Fix ieee80211.h linux capability --- core/rtw_ap.c | 8 ++++---- core/rtw_ieee80211.c | 6 +++--- include/ieee80211.h | 15 +++++++++++---- include/wifi.h | 23 ++++++++++++----------- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 442a332..d8a8e7f 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -4740,10 +4740,10 @@ u16 rtw_ap_parse_sta_security_ie(_adapter *adapter, struct sta_info *sta, struct sta->wpa2_pairwise_cipher = pairwise_cipher & sec->wpa2_pairwise_cipher; if (!sta->wpa2_group_cipher) - status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID; + status = WLAN_STATUS_INVALID_GROUP_CIPHER; if (!sta->wpa2_pairwise_cipher) - status = WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID; + status = WLAN_STATUS_INVALID_PAIRWISE_CIPHER; } else status = WLAN_STATUS_INVALID_IE; @@ -4760,10 +4760,10 @@ u16 rtw_ap_parse_sta_security_ie(_adapter *adapter, struct sta_info *sta, struct sta->wpa_pairwise_cipher = pairwise_cipher & sec->wpa_pairwise_cipher; if (!sta->wpa_group_cipher) - status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID; + status = WLAN_STATUS_INVALID_GROUP_CIPHER; if (!sta->wpa_pairwise_cipher) - status = WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID; + status = WLAN_STATUS_INVALID_PAIRWISE_CIPHER; } else status = WLAN_STATUS_INVALID_IE; diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index 4609336..2edd0ae 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -1287,7 +1287,7 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, elems->timeout_int = pos; elems->timeout_int_len = elen; break; - case WLAN_EID_HT_CAP: + case WLAN_EID_HT_CAPABILITY: elems->ht_capabilities = pos; elems->ht_capabilities_len = elen; break; @@ -1303,7 +1303,7 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, elems->vht_operation = pos; elems->vht_operation_len = elen; break; - case WLAN_EID_VHT_OP_MODE_NOTIFY: + case WLAN_EID_OPMODE_NOTIF: elems->vht_op_mode_notify = pos; elems->vht_op_mode_notify_len = elen; break; @@ -1550,7 +1550,7 @@ void dump_ht_cap_ie(void *sel, const u8 *ie, u32 ie_len) const u8 *ht_cap_ie; sint ht_cap_ielen; - ht_cap_ie = rtw_get_ie(ie, WLAN_EID_HT_CAP, &ht_cap_ielen, ie_len); + ht_cap_ie = rtw_get_ie(ie, WLAN_EID_HT_CAPABILITY, &ht_cap_ielen, ie_len); if (!ie || ht_cap_ie != ie) return; diff --git a/include/ieee80211.h b/include/ieee80211.h index 5ba92b5..7bb71b4 100644 --- a/include/ieee80211.h +++ b/include/ieee80211.h @@ -15,6 +15,9 @@ #ifndef __IEEE80211_H #define __IEEE80211_H +#if defined(PLATFORM_LINUX) && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) +#include +#endif #ifndef CONFIG_RTL8711FW @@ -627,6 +630,7 @@ struct ieee80211_snap_hdr { #define WLAN_CAPABILITY_SHORT_SLOT (1<<10) /* Status codes */ +#if !defined(PLATFORM_LINUX) || LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) #define WLAN_STATUS_SUCCESS 0 #define WLAN_STATUS_UNSPECIFIED_FAILURE 1 #define WLAN_STATUS_CAPS_UNSUPPORTED 10 @@ -653,11 +657,12 @@ struct ieee80211_snap_hdr { #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 +#endif #define WLAN_REASON_MESH_PEER_CANCELED 52 #define WLAN_REASON_MESH_MAX_PEERS 53 #define WLAN_REASON_MESH_CONFIG 54 #define WLAN_REASON_MESH_CLOSE 55 -#define WLAN_REASON_MESH_MAX_RETRIES 56 +#define WLAN_REASON_MESH_MAX_RETRIES 56 #define WLAN_REASON_MESH_CONFIRM_TIMEOUT 57 #define WLAN_REASON_MESH_INVALID_GTK 58 #define WLAN_REASON_MESH_INCONSISTENT_PARAM 59 @@ -681,6 +686,7 @@ struct ieee80211_snap_hdr { ) /* Information Element IDs */ +#if !defined(PLATFORM_LINUX) || LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) #define WLAN_EID_SSID 0 #define WLAN_EID_SUPP_RATES 1 #define WLAN_EID_FH_PARAMS 2 @@ -702,7 +708,7 @@ struct ieee80211_snap_hdr { #define WLAN_EID_IBSS_DFS 41 /* EIDs defined by IEEE 802.11h - END */ #define WLAN_EID_ERP_INFO 42 -#define WLAN_EID_HT_CAP 45 +#define WLAN_EID_HT_CAPABILITY 45 #define WLAN_EID_RSN 48 #define WLAN_EID_EXT_SUPP_RATES 50 #define WLAN_EID_MOBILITY_DOMAIN 54 @@ -725,10 +731,11 @@ struct ieee80211_snap_hdr { #define WLAN_EID_AMPE 139 #define WLAN_EID_MIC 140 #define WLAN_EID_VENDOR_SPECIFIC 221 -#define WLAN_EID_GENERIC (WLAN_EID_VENDOR_SPECIFIC) #define WLAN_EID_VHT_CAPABILITY 191 #define WLAN_EID_VHT_OPERATION 192 -#define WLAN_EID_VHT_OP_MODE_NOTIFY 199 +#define WLAN_EID_OPMODE_NOTIF 199 +#endif +#define WLAN_EID_GENERIC (WLAN_EID_VENDOR_SPECIFIC) #define IEEE80211_MGMT_HDR_LEN 24 #define IEEE80211_DATA_HDR3_LEN 24 diff --git a/include/wifi.h b/include/wifi.h index ff28e7d..8bd9cba 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -209,6 +209,7 @@ enum WIFI_STATUS_CODE { #define WLAN_STATUS_ASSOC_DENIED_RATES 18 #endif /* entended */ +#if !defined(PLATFORM_LINUX) || LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) /* IEEE 802.11b */ #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19 #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20 @@ -226,16 +227,17 @@ enum WIFI_STATUS_CODE { #define WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION 31 /* IEEE 802.11i */ #define WLAN_STATUS_INVALID_IE 40 -#define WLAN_STATUS_GROUP_CIPHER_NOT_VALID 41 -#define WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID 42 -#define WLAN_STATUS_AKMP_NOT_VALID 43 -#define WLAN_STATUS_UNSUPPORTED_RSN_IE_VERSION 44 -#define WLAN_STATUS_INVALID_RSN_IE_CAPAB 45 -#define WLAN_STATUS_CIPHER_REJECTED_PER_POLICY 46 -#define WLAN_STATUS_TS_NOT_CREATED 47 -#define WLAN_STATUS_DIRECT_LINK_NOT_ALLOWED 48 -#define WLAN_STATUS_DEST_STA_NOT_PRESENT 49 -#define WLAN_STATUS_DEST_STA_NOT_QOS_STA 50 +#define WLAN_STATUS_INVALID_GROUP_CIPHER 41 +#define WLAN_STATUS_INVALID_PAIRWISE_CIPHER 42 +#define WLAN_STATUS_INVALID_AKMP 43 +#define WLAN_STATUS_UNSUPP_RSN_VERSION 44 +#define WLAN_STATUS_INVALID_RSN_IE_CAP 45 +#define WLAN_STATUS_CIPHER_SUITE_REJECTED 46 +#define WLAN_STATUS_WAIT_TS_DELAY 47 +#define WLAN_STATUS_NO_DIRECT_LINK 48 +#define WLAN_STATUS_STA_NOT_PRESENT 49 +#define WLAN_STATUS_STA_NOT_QSTA 50 +#endif #define WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE 51 /* IEEE 802.11r */ #define WLAN_STATUS_INVALID_FT_ACTION_FRAME_COUNT 52 @@ -243,7 +245,6 @@ enum WIFI_STATUS_CODE { #define WLAN_STATUS_INVALID_MDIE 54 #define WLAN_STATUS_INVALID_FTIE 55 - enum WIFI_REG_DOMAIN { DOMAIN_FCC = 1, DOMAIN_IC = 2, From c3ccff59afbdafb0c1456ea1c252b5553ef1d616 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 01:10:34 +0200 Subject: [PATCH 08/15] Fix wrong type in rtw_dump_cur_efuse --- hal/hal_com.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hal/hal_com.c b/hal/hal_com.c index 70a48eb..11a1da8 100644 --- a/hal/hal_com.c +++ b/hal/hal_com.c @@ -11155,13 +11155,12 @@ exit: void rtw_dump_cur_efuse(PADAPTER padapter) { - int i =0; - int mapsize =0; + u16 mapsize =0; HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter); EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN , (void *)&mapsize, _FALSE); - if (mapsize <= 0 || mapsize > EEPROM_MAX_SIZE) { + if (mapsize > EEPROM_MAX_SIZE) { RTW_ERR("wrong map size %d\n", mapsize); return; } @@ -11180,14 +11179,14 @@ u32 Hal_readPGDataFromConfigFile(PADAPTER padapter) { HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter); u32 ret = _FALSE; - u32 maplen = 0; + u16 maplen = 0; EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN , (void *)&maplen, _FALSE); if (maplen < 256 || maplen > EEPROM_MAX_SIZE) { RTW_ERR("eFuse length error :%d\n", maplen); return _FALSE; - } + } ret = rtw_read_efuse_from_file(EFUSE_MAP_PATH, hal_data->efuse_eeprom_data, maplen); From ee01e588343d8f3baf807a61726d16dffca2997a Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 01:16:13 +0200 Subject: [PATCH 09/15] Adoptations for using the driver on android/nethunter --- os_dep/linux/ioctl_cfg80211.c | 14 +------------- os_dep/linux/ioctl_cfg80211.h | 5 ----- os_dep/linux/rtw_android.c | 2 +- os_dep/linux/rtw_cfgvendor.c | 9 +-------- 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index a1ffca0..7aae542 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -5270,15 +5270,7 @@ exit: return ret; } -static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)) - u8 *mac -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)) - const u8 *mac -#else - struct station_del_parameters *params -#endif -) +static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev, struct station_del_parameters *params) { int ret = 0; _irqL irqL; @@ -5290,11 +5282,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct sta_priv *pstapriv = &padapter->stapriv; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)) - target_mac = mac; -#else target_mac = params->mac; -#endif RTW_INFO("+"FUNC_NDEV_FMT" mac=%pM\n", FUNC_NDEV_ARG(ndev), target_mac); diff --git a/os_dep/linux/ioctl_cfg80211.h b/os_dep/linux/ioctl_cfg80211.h index 54a319f..f57586d 100644 --- a/os_dep/linux/ioctl_cfg80211.h +++ b/os_dep/linux/ioctl_cfg80211.h @@ -354,12 +354,7 @@ void rtw_cfg80211_deinit_rfkill(struct wiphy *wiphy); #endif #define rtw_cfg80211_connect_result(wdev, bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp) cfg80211_connect_result(wdev_to_ndev(wdev), bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp) - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)) -#define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, gfp) -#else #define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, locally_generated, gfp) -#endif #ifdef CONFIG_RTW_80211R #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) diff --git a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c index 8cde93c..8690883 100644 --- a/os_dep/linux/rtw_android.c +++ b/os_dep/linux/rtw_android.c @@ -1069,7 +1069,7 @@ void *wifi_get_country_code(char *ccode) if (!ccode) return NULL; if (wifi_control_data && wifi_control_data->get_country_code) - return wifi_control_data->get_country_code(ccode); + return wifi_control_data->get_country_code(ccode, 0); return NULL; } #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) */ diff --git a/os_dep/linux/rtw_cfgvendor.c b/os_dep/linux/rtw_cfgvendor.c index 0f0f24f..7517491 100644 --- a/os_dep/linux/rtw_cfgvendor.c +++ b/os_dep/linux/rtw_cfgvendor.c @@ -45,11 +45,7 @@ struct sk_buff *dbg_rtw_cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct struct sk_buff *skb; unsigned int truesize = 0; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) - skb = cfg80211_vendor_event_alloc(wiphy, len, event_id, gfp); -#else skb = cfg80211_vendor_event_alloc(wiphy, wdev, len, event_id, gfp); -#endif if (skb) truesize = skb->truesize; @@ -144,11 +140,8 @@ struct sk_buff *rtw_cfg80211_vendor_event_alloc( { struct sk_buff *skb; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) - skb = cfg80211_vendor_event_alloc(wiphy, len, event_id, gfp); -#else skb = cfg80211_vendor_event_alloc(wiphy, wdev, len, event_id, gfp); -#endif + return skb; } From e95f32d1945c2f2aa00a73285a31dccbae216941 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 01:20:13 +0200 Subject: [PATCH 10/15] Makefile: add support for Android / Nethunter ARM64 devices --- Makefile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0aacb48..878c65f 100755 --- a/Makefile +++ b/Makefile @@ -7,6 +7,10 @@ EXTRA_CFLAGS += -Wextra #EXTRA_CFLAGS += -pedantic #EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes +#EXTRA_CFLAGS += -Wno-tautological-compare +#EXTRA_CFLAGS += -Wno-incompatible-pointer-types +#EXTRA_CFLAGS += -Wno-switch +EXTRA_CFLAGS += -Wno-cast-function-type EXTRA_CFLAGS += -Wno-unused-variable EXTRA_CFLAGS += -Wno-unused-value EXTRA_CFLAGS += -Wno-unused-label @@ -809,6 +813,16 @@ KVER:= 3.1.10 KSRC:= /usr/src/Mstar_kernel/3.1.10/ endif +ifeq ($(CONFIG_PLATFORM_ANDROID_ARM64), y) +EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -fno-pic + +EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC -DCONFIG_RADIO_WORK +#Enable this to have two interfaces: +#EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE +EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT +EXTRA_CFLAGS += -DCONFIG_P2P_IPS +endif + ifeq ($(CONFIG_PLATFORM_ANDROID_X86), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN SUBARCH := $(shell uname -m | sed -e s/i.86/i386/) @@ -1659,7 +1673,7 @@ export CONFIG_RTL8821AU = m all: modules modules: - $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) modules + $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) O="$(KBUILD_OUTPUT)" modules strip: $(CROSS_COMPILE)strip $(MODULE_NAME).ko --strip-unneeded From 69435f8cd2ef211eba2ddf6142fbc5c3a7756a89 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 01:23:14 +0200 Subject: [PATCH 11/15] Fix uninitialized variable in auth seq=2 packet --- core/rtw_mlme_ext.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 6311233..d3c213c 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -8994,12 +8994,12 @@ void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status /* setting auth algo number */ val16 = (u16)psta->authalg; - if (status != _STATS_SUCCESSFUL_) - val16 = 0; - if (val16) { val16 = cpu_to_le16(val16); use_shared_key = 1; + + } else { + val16 = 0; } pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&val16, &(pattrib->pktlen)); From 85c0e2dc9e9d3850d478b36109490eb1fbae3dac Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 01:25:30 +0200 Subject: [PATCH 12/15] fix for missing signal --- hal/phydm/phydm_hwconfig.c | 2 -- include/osdep_service.h | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hal/phydm/phydm_hwconfig.c b/hal/phydm/phydm_hwconfig.c index e866075..69d3490 100644 --- a/hal/phydm/phydm_hwconfig.c +++ b/hal/phydm/phydm_hwconfig.c @@ -31,8 +31,6 @@ #include "phydm_precomp.h" #define READ_AND_CONFIG_MP(ic, txt) (odm_read_and_config_mp_##ic##txt(dm)) -#define READ_AND_CONFIG_TC(ic, txt) (odm_read_and_config_tc_##ic##txt(dm)) - #define READ_AND_CONFIG READ_AND_CONFIG_MP diff --git a/include/osdep_service.h b/include/osdep_service.h index 442f0a7..2bccd40 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -15,6 +15,10 @@ #ifndef __OSDEP_SERVICE_H_ #define __OSDEP_SERVICE_H_ +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) +#include +#endif #define _FAIL 0 #define _SUCCESS 1 From 41734672771b4da88a9f4a0ac9d8fc753211400d Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 01:27:14 +0200 Subject: [PATCH 13/15] remove reference to deleted file --- include/drv_types.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/drv_types.h b/include/drv_types.h index 05d764a..25417d2 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -101,7 +101,6 @@ typedef struct _ADAPTER _adapter, ADAPTER, *PADAPTER; #include #include #include -#include #include #include #include "sta_info.h" From a158dfb78e2d662ec039f7815ad50a7a5f009101 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 01:29:01 +0200 Subject: [PATCH 14/15] Add check for psta->cmn.aid out of bounds --- core/rtw_sta_mgt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index 7c13002..caacdab 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -798,6 +798,11 @@ u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta) #ifdef CONFIG_NATIVEAP_MLME + if (psta->cmn.aid > 31) { + pr_err("***** psta->aid (%d) out of bounds\n", psta->cmn.aid); + return _FAIL; + } + if (pmlmeinfo->state == _HW_STATE_AP_) { rtw_tim_map_clear(padapter, pstapriv->sta_dz_bitmap, psta->cmn.aid); rtw_tim_map_clear(padapter, pstapriv->tim_bitmap, psta->cmn.aid); From 8bc158e9dc13c01b1ab7fc7a1742da1fbd944e40 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 6 Apr 2019 01:36:11 +0200 Subject: [PATCH 15/15] Add entry for compiling against openwrt tree --- Makefile | 11 +++++++++++ core/rtw_ap.c | 2 +- core/rtw_mlme_ext.c | 10 ++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 878c65f..c058b12 100755 --- a/Makefile +++ b/Makefile @@ -112,6 +112,7 @@ CONFIG_PLATFORM_ARM_S3C6K4 = n CONFIG_PLATFORM_MIPS_RMI = n CONFIG_PLATFORM_RTD2880B = n CONFIG_PLATFORM_MIPS_AR9132 = n +CONFIG_PLATFORM_OPENWRT_NEO2 = n CONFIG_PLATFORM_RTK_DMP = n CONFIG_PLATFORM_MIPS_PLM = n CONFIG_PLATFORM_MSTAR389 = n @@ -927,6 +928,16 @@ CROSS_COMPILE := aarch64-openwrt-linux- KSRC := /home/greearb/git/openwrt-neo2-dev/build_dir/target-aarch64_cortex-a53_musl/linux-sunxi_cortexa53/linux-4.14.78 endif +# This is how I built for openwrt Neo2 platform. --Ben +ifeq ($(CONFIG_PLATFORM_OPENWRT_NEO2), y) +EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN +ARCH := arm64 +CROSS_COMPILE := aarch64-openwrt-linux- +#export PATH=$PATH:/home/greearb/git/openwrt-neo2-dev/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.3.0_musl/bin/ +#export STAGING_DIR=/home/greearb/git/openwrt-neo2-dev/staging_dir +KSRC := /home/greearb/git/openwrt-neo2-dev/build_dir/target-aarch64_cortex-a53_musl/linux-sunxi_cortexa53/linux-4.14.78 +endif + ifeq ($(CONFIG_PLATFORM_DMP_PHILIPS), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DRTK_DMP_PLATFORM ARCH := mips diff --git a/core/rtw_ap.c b/core/rtw_ap.c index d8a8e7f..703e17e 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -174,7 +174,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, ie_offset, remainder_ielen = 0; + u32 i, offset, ielen = 0, 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); diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index d3c213c..5bd061e 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -4152,7 +4152,8 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) u8 action = P2P_PUB_ACTION_ACTION; u32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_GO_NEGO_REQ; - u8 wpsie[255] = { 0x00 }, p2pie[255] = { 0x00 }; + u8 *wpsie; + u8 p2pie[ 255 ] = { 0x00 }; u8 wpsielen = 0, p2pielen = 0, i; u8 channel_cnt_24g = 0, channel_cnt_5gl = 0, channel_cnt_5gh = 0; u16 len_channellist_attr = 0; @@ -4550,7 +4551,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l u8 action = P2P_PUB_ACTION_ACTION; u32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_GO_NEGO_RESP; - u8 wpsie[255] = { 0x00 }, p2pie[255] = { 0x00 }; + u8 *wpsie; + u8 p2pie[ 255 ] = { 0x00 }; u8 p2pielen = 0, i; uint wpsielen = 0; u16 wps_devicepassword_id = 0x0000; @@ -4576,6 +4578,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l if (pmgntframe == NULL) return; + wpsie = rtw_zmalloc(256); + RTW_INFO("[%s] In, result = %d\n", __FUNCTION__, result); /* update attribute */ pattrib = &pmgntframe->attrib; @@ -4958,6 +4962,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l dump_mgntframe(padapter, pmgntframe); + kfree(wpsie); + return; }