Compare commits

..

3 Commits

Author SHA1 Message Date
Sophie Brun
f075fe14db New upstream version 5.3.9~git20201227 2021-01-26 17:01:57 +01:00
Sophie Brun
739e000bbf New upstream version 5.3.9~git20200829 2020-09-16 15:00:46 +02:00
Sophie Brun
1791b22180 New upstream version 5.3.9~git20200710 2020-07-10 08:55:07 +02:00
8 changed files with 96 additions and 19 deletions

0
.gitgnore Normal file
View File

View File

@@ -154,6 +154,7 @@ CONFIG_PLATFORM_AML_S905 = n
CONFIG_PLATFORM_ZTE_ZX296716 = n CONFIG_PLATFORM_ZTE_ZX296716 = n
CONFIG_PLATFORM_ARM_ODROIDC2 = n CONFIG_PLATFORM_ARM_ODROIDC2 = n
CONFIG_PLATFORM_PPC = n CONFIG_PLATFORM_PPC = n
CONFIG_PLATFORM_PPC64LE = n
############################################################### ###############################################################
CONFIG_DRVEXT_MODULE = n CONFIG_DRVEXT_MODULE = n
@@ -1031,7 +1032,7 @@ EXTRA_CFLAGS += -DDM_ODM_SUPPORT_TYPE=0x04
ifeq ($(CONFIG_PLATFORM_I386_PC), y) ifeq ($(CONFIG_PLATFORM_I386_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
SUBARCH := $(shell uname -m | sed -e "s/i.86/i386/; s/ppc/powerpc/; s/armv.l/arm/; s/aarch64/arm64/;") SUBARCH := $(shell uname -m | sed -e "s/i.86/i386/; s/ppc64le/powerpc/; s/ppc/powerpc/; s/armv.l/arm/; s/aarch64/arm64/;")
ARCH ?= $(SUBARCH) ARCH ?= $(SUBARCH)
CROSS_COMPILE ?= CROSS_COMPILE ?=
KVER := $(shell uname -r) KVER := $(shell uname -r)
@@ -1085,6 +1086,17 @@ MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX := INSTALL_PREFIX :=
endif endif
ifeq ($(CONFIG_PLATFORM_PPC64LE), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
SUBARCH := $(shell uname -m | sed -e s/ppc64le/powerpc/)
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
KVER ?= $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
endif
ifeq ($(CONFIG_PLATFORM_NV_TK1), y) ifeq ($(CONFIG_PLATFORM_NV_TK1), y)
EXTRA_CFLAGS += -DCONFIG_PLATFORM_NV_TK1 EXTRA_CFLAGS += -DCONFIG_PLATFORM_NV_TK1
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN

View File

@@ -18,19 +18,19 @@
* MESH Support * MESH Support
* Monitor mode * Monitor mode
* Frame injection * Frame injection
* Up to kernel v5.3+ * Up to kernel v5.8+
... And a bunch of various wifi chipsets ... And a bunch of various wifi chipsets
# Howto build/install # Howto build/install
1. You will need to blacklist another driver in order to use this one. 1. You will need to blacklist another driver in order to use this one.
2. "echo "blacklist r8188eu" > "/etc/modprobe.d/realtek.conf" 2. `echo "blacklist r8188eu" >> "/etc/modprobe.d/realtek.conf"`
3. "make && make install"<br> 3. `make && make install`
4. Reboot in order to blacklist and load the new driver/module. 4. Reboot in order to blacklist and load the new driver/module.
# MONITOR MODE howto # MONITOR MODE howto
Use these steps to enter monitor mode. Use these steps to enter monitor mode.
``` ```
$ sudo airmon-ng check-kill $ sudo airmon-ng check kill
$ sudo ip link set <interface> down $ sudo ip link set <interface> down
$ sudo iw dev <interface> set type monitor $ sudo iw dev <interface> set type monitor
``` ```
@@ -42,7 +42,7 @@ $ aireplay -9 <interface>
# NetworkManager configuration # NetworkManager configuration
Add these lines below to "NetworkManager.conf" and ADD YOUR ADAPTER MAC below [keyfile] Add these lines below to "NetworkManager.conf" and ADD YOUR ADAPTER MAC below [keyfile]
This will make the Network-Manager ignore the device, and therefor don't cause problems. This will make the Network-Manager ignore the device, and therefore don't cause problems.
``` ```
[device] [device]
wifi.scan-rand-mac-address=no wifi.scan-rand-mac-address=no

View File

@@ -2133,6 +2133,7 @@ BIP_exit:
#ifndef PLATFORM_FREEBSD #ifndef PLATFORM_FREEBSD
#if defined(CONFIG_TDLS) #if defined(CONFIG_TDLS)
/* compress 512-bits */ /* compress 512-bits */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
static int sha256_compress(struct sha256_state *md, unsigned char *buf) static int sha256_compress(struct sha256_state *md, unsigned char *buf)
{ {
u32 S[8], W[64], t0, t1; u32 S[8], W[64], t0, t1;
@@ -2179,8 +2180,10 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf)
md->state[i] = md->state[i] + S[i]; md->state[i] = md->state[i] + S[i];
return 0; return 0;
} }
#endif
/* Initialize the hash state */ /* Initialize the hash state */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
static void sha256_init(struct sha256_state *md) static void sha256_init(struct sha256_state *md)
{ {
md->curlen = 0; md->curlen = 0;
@@ -2194,6 +2197,7 @@ static void sha256_init(struct sha256_state *md)
md->state[6] = 0x1F83D9ABUL; md->state[6] = 0x1F83D9ABUL;
md->state[7] = 0x5BE0CD19UL; md->state[7] = 0x5BE0CD19UL;
} }
#endif
/** /**
Process a block of memory though the hash Process a block of memory though the hash
@@ -2202,6 +2206,8 @@ static void sha256_init(struct sha256_state *md)
@param inlen The length of the data (octets) @param inlen The length of the data (octets)
@return CRYPT_OK if successful @return CRYPT_OK if successful
*/ */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
static int sha256_process(struct sha256_state *md, unsigned char *in, static int sha256_process(struct sha256_state *md, unsigned char *in,
unsigned long inlen) unsigned long inlen)
{ {
@@ -2235,7 +2241,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
return 0; return 0;
} }
#endif
/** /**
Terminate the hash to get the digest Terminate the hash to get the digest
@@ -2243,6 +2249,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
@param out [out] The destination of the hash (32 bytes) @param out [out] The destination of the hash (32 bytes)
@return CRYPT_OK if successful @return CRYPT_OK if successful
*/ */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
static int sha256_done(struct sha256_state *md, unsigned char *out) static int sha256_done(struct sha256_state *md, unsigned char *out)
{ {
int i; int i;
@@ -2281,6 +2288,7 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
return 0; return 0;
} }
#endif
/** /**
* sha256_vector - SHA256 hash for data vector * sha256_vector - SHA256 hash for data vector
@@ -2290,6 +2298,8 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
* @mac: Buffer for the hash * @mac: Buffer for the hash
* Returns: 0 on success, -1 of failure * Returns: 0 on success, -1 of failure
*/ */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len, static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len,
u8 *mac) u8 *mac)
{ {
@@ -2304,6 +2314,7 @@ static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len,
return -1; return -1;
return 0; return 0;
} }
#endif
static u8 os_strlen(const char *s) static u8 os_strlen(const char *s)
{ {
@@ -2344,6 +2355,7 @@ static int os_memcmp(const void *s1, const void *s2, u8 n)
* @mac: Buffer for the hash (32 bytes) * @mac: Buffer for the hash (32 bytes)
*/ */
#if defined(CONFIG_TDLS) #if defined(CONFIG_TDLS)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem, static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
u8 *addr[], size_t *len, u8 *mac) u8 *addr[], size_t *len, u8 *mac)
{ {
@@ -2405,6 +2417,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
_len[1] = 32; _len[1] = 32;
sha256_vector(2, _addr, _len, mac); sha256_vector(2, _addr, _len, mac);
} }
#endif
#endif /* CONFIG_TDLS */ #endif /* CONFIG_TDLS */
#endif /* PLATFORM_FREEBSD */ #endif /* PLATFORM_FREEBSD */
/** /**
@@ -2422,6 +2435,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
*/ */
#ifndef PLATFORM_FREEBSD /* Baron */ #ifndef PLATFORM_FREEBSD /* Baron */
#if defined(CONFIG_TDLS) #if defined(CONFIG_TDLS)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
static void sha256_prf(u8 *key, size_t key_len, char *label, static void sha256_prf(u8 *key, size_t key_len, char *label,
u8 *data, size_t data_len, u8 *buf, size_t buf_len) u8 *data, size_t data_len, u8 *buf, size_t buf_len)
{ {
@@ -2459,6 +2473,7 @@ static void sha256_prf(u8 *key, size_t key_len, char *label,
} }
} }
#endif #endif
#endif
#endif /* PLATFORM_FREEBSD Baron */ #endif /* PLATFORM_FREEBSD Baron */
/* AES tables*/ /* AES tables*/

View File

@@ -249,11 +249,13 @@ struct security_priv {
#define SEC_IS_BIP_KEY_INSTALLED(sec) _FALSE #define SEC_IS_BIP_KEY_INSTALLED(sec) _FALSE
#endif #endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
struct sha256_state { struct sha256_state {
u64 length; u64 length;
u32 state[8], curlen; u32 state[8], curlen;
u8 buf[64]; u8 buf[64];
}; };
#endif
#define GET_ENCRY_ALGO(psecuritypriv, psta, encry_algo, bmcst)\ #define GET_ENCRY_ALGO(psecuritypriv, psta, encry_algo, bmcst)\
do {\ do {\

View File

@@ -686,18 +686,12 @@ static int rtw_cfg80211_sync_iftype(_adapter *adapter)
static u64 rtw_get_systime_us(void) static u64 rtw_get_systime_us(void)
{ {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0))
struct timespec64 ts;
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
struct timespec ts; struct timespec ts;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
getboottime64(&ts);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0))
getboottime(&ts);
#else
get_monotonic_boottime(&ts); get_monotonic_boottime(&ts);
#endif
return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000; return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000;
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0))
return ktime_to_us(ktime_get_boottime());
#else #else
struct timeval tv; struct timeval tv;
do_gettimeofday(&tv); do_gettimeofday(&tv);
@@ -7100,11 +7094,26 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
#else #else
struct net_device *ndev, struct net_device *ndev,
#endif #endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
struct mgmt_frame_regs *upd)
#else
u16 frame_type, bool reg) u16 frame_type, bool reg)
#endif
{ {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
u32 rtw_mask = BIT(IEEE80211_STYPE_PROBE_REQ >> 4);
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
struct net_device *ndev = wdev_to_ndev(wdev); struct net_device *ndev = wdev_to_ndev(wdev);
#endif #endif
/* hardcoded always true, to make it pass compilation */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
bool reg = true;
#endif
_adapter *adapter; _adapter *adapter;
struct rtw_wdev_priv *pwdev_priv; struct rtw_wdev_priv *pwdev_priv;
@@ -7116,14 +7125,24 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
pwdev_priv = adapter_wdev_data(adapter); pwdev_priv = adapter_wdev_data(adapter);
#ifdef CONFIG_DEBUG_CFG80211 #ifdef CONFIG_DEBUG_CFG80211
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
RTW_INFO(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter), RTW_INFO(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter),
frame_type, reg); frame_type, reg);
#else
RTW_INFO(FUNC_ADPT_FMT " old_regs:%x new_regs:%x\n",
FUNC_ADPT_ARG(adapter), pwdev_priv->mgmt_mask, upd->interface_stypes);
#endif
#endif #endif
/* Wait QC Verify */ /* Wait QC Verify */
return; return;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
switch (upd->interface_stypes) {
#else
switch (frame_type) { switch (frame_type) {
#endif
case IEEE80211_STYPE_PROBE_REQ: /* 0x0040 */ case IEEE80211_STYPE_PROBE_REQ: /* 0x0040 */
SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_PROBE_REQ, reg); SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_PROBE_REQ, reg);
break; break;
@@ -7133,6 +7152,12 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
default: default:
break; break;
} }
#else
if ((upd->interface_stypes & rtw_mask) == (pwdev_priv->mgmt_mask & rtw_mask))
return;
pwdev_priv->mgmt_mask = upd->interface_stypes;
#endif
exit: exit:
return; return;
@@ -9438,7 +9463,11 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
.mgmt_tx = cfg80211_rtw_mgmt_tx, .mgmt_tx = cfg80211_rtw_mgmt_tx,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
.update_mgmt_frame_registrations = cfg80211_rtw_mgmt_frame_register,
#else
.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
#endif
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
.action = cfg80211_rtw_mgmt_tx, .action = cfg80211_rtw_mgmt_tx,
#endif #endif
@@ -9772,5 +9801,3 @@ void rtw_cfg80211_dev_res_unregister(struct dvobj_priv *dvobj)
rtw_wiphy_unregister(dvobj_to_wiphy(dvobj)); rtw_wiphy_unregister(dvobj_to_wiphy(dvobj));
#endif #endif
} }
#endif /* CONFIG_IOCTL_CFG80211 */

View File

@@ -168,6 +168,10 @@ struct rtw_wdev_priv {
bool block_scan; bool block_scan;
bool power_mgmt; bool power_mgmt;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
u32 mgmt_mask;
#endif
/* report mgmt_frame registered */ /* report mgmt_frame registered */
u16 report_mgmt; u16 report_mgmt;

View File

@@ -2139,15 +2139,19 @@ static int isFileReadable(const char *path, u32 *sz)
{ {
struct file *fp; struct file *fp;
int ret = 0; int ret = 0;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
mm_segment_t oldfs; mm_segment_t oldfs;
#endif
char buf; char buf;
fp = filp_open(path, O_RDONLY, 0); fp = filp_open(path, O_RDONLY, 0);
if (IS_ERR(fp)) if (IS_ERR(fp))
ret = PTR_ERR(fp); ret = PTR_ERR(fp);
else { else {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
#endif
if (1 != readFile(fp, &buf, 1)) if (1 != readFile(fp, &buf, 1))
ret = PTR_ERR(fp); ret = PTR_ERR(fp);
@@ -2159,8 +2163,9 @@ static int isFileReadable(const char *path, u32 *sz)
*sz = i_size_read(fp->f_dentry->d_inode); *sz = i_size_read(fp->f_dentry->d_inode);
#endif #endif
} }
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
set_fs(oldfs); set_fs(oldfs);
#endif
filp_close(fp, NULL); filp_close(fp, NULL);
} }
return ret; return ret;
@@ -2176,7 +2181,9 @@ static int isFileReadable(const char *path, u32 *sz)
static int retriveFromFile(const char *path, u8 *buf, u32 sz) static int retriveFromFile(const char *path, u8 *buf, u32 sz)
{ {
int ret = -1; int ret = -1;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
mm_segment_t oldfs; mm_segment_t oldfs;
#endif
struct file *fp; struct file *fp;
if (path && buf) { if (path && buf) {
@@ -2184,10 +2191,14 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
if (0 == ret) { if (0 == ret) {
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp); RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
#endif
ret = readFile(fp, buf, sz); ret = readFile(fp, buf, sz);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
set_fs(oldfs); set_fs(oldfs);
#endif
closeFile(fp); closeFile(fp);
RTW_INFO("%s readFile, ret:%d\n", __FUNCTION__, ret); RTW_INFO("%s readFile, ret:%d\n", __FUNCTION__, ret);
@@ -2211,7 +2222,9 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
static int storeToFile(const char *path, u8 *buf, u32 sz) static int storeToFile(const char *path, u8 *buf, u32 sz)
{ {
int ret = 0; int ret = 0;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
mm_segment_t oldfs; mm_segment_t oldfs;
#endif
struct file *fp; struct file *fp;
if (path && buf) { if (path && buf) {
@@ -2219,10 +2232,14 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
if (0 == ret) { if (0 == ret) {
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp); RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
#endif
ret = writeFile(fp, buf, sz); ret = writeFile(fp, buf, sz);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
set_fs(oldfs); set_fs(oldfs);
#endif
closeFile(fp); closeFile(fp);
RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret); RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret);