From f075fe14db6b9f9167bc1d0fbeea8b8455aedbcb Mon Sep 17 00:00:00 2001 From: Sophie Brun Date: Tue, 26 Jan 2021 17:01:57 +0100 Subject: [PATCH] New upstream version 5.3.9~git20201227 --- README.md | 8 ++++---- os_dep/linux/ioctl_cfg80211.c | 29 ++++++++++++++++++----------- os_dep/osdep_service.c | 19 ++++++++++++++++++- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 595b902..841289d 100644 --- a/README.md +++ b/README.md @@ -23,14 +23,14 @@ # Howto build/install 1. You will need to blacklist another driver in order to use this one. -2. "echo "blacklist r8188eu" > "/etc/modprobe.d/realtek.conf" -3. "make && make install"
+2. `echo "blacklist r8188eu" >> "/etc/modprobe.d/realtek.conf"` +3. `make && make install` 4. Reboot in order to blacklist and load the new driver/module. # MONITOR MODE howto Use these steps to enter monitor mode. ``` -$ sudo airmon-ng check-kill +$ sudo airmon-ng check kill $ sudo ip link set down $ sudo iw dev set type monitor ``` @@ -42,7 +42,7 @@ $ aireplay -9 # NetworkManager configuration 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] wifi.scan-rand-mac-address=no diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 383a557..fb8a2cf 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -7088,18 +7088,16 @@ exit: return ret; } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)) static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) struct wireless_dev *wdev, #else struct net_device *ndev, #endif - u16 frame_type, bool reg) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + struct mgmt_frame_regs *upd) #else -static void cfg80211_rtw_update_mgmt_frame_register(struct wiphy *wiphy, - struct wireless_dev *wdev, - struct mgmt_frame_regs *upd) + u16 frame_type, bool reg) #endif { @@ -7110,6 +7108,12 @@ static void cfg80211_rtw_update_mgmt_frame_register(struct wiphy *wiphy, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) struct net_device *ndev = wdev_to_ndev(wdev); #endif + +/* hardcoded always true, to make it pass compilation */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + bool reg = true; +#endif + _adapter *adapter; struct rtw_wdev_priv *pwdev_priv; @@ -7132,8 +7136,13 @@ static void cfg80211_rtw_update_mgmt_frame_register(struct wiphy *wiphy, /* Wait QC Verify */ return; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)) + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + switch (upd->interface_stypes) { +#else switch (frame_type) { +#endif + case IEEE80211_STYPE_PROBE_REQ: /* 0x0040 */ SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_PROBE_REQ, reg); break; @@ -9454,10 +9463,10 @@ static struct cfg80211_ops rtw_cfg80211_ops = { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) .mgmt_tx = cfg80211_rtw_mgmt_tx, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)) - .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + .update_mgmt_frame_registrations = cfg80211_rtw_mgmt_frame_register, #else - .update_mgmt_frame_registrations = cfg80211_rtw_update_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)) .action = cfg80211_rtw_mgmt_tx, @@ -9792,5 +9801,3 @@ void rtw_cfg80211_dev_res_unregister(struct dvobj_priv *dvobj) rtw_wiphy_unregister(dvobj_to_wiphy(dvobj)); #endif } - -#endif /* CONFIG_IOCTL_CFG80211 */ diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 82a37d2..6ebd769 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -2139,15 +2139,19 @@ static int isFileReadable(const char *path, u32 *sz) { struct file *fp; int ret = 0; + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) mm_segment_t oldfs; + #endif char buf; fp = filp_open(path, O_RDONLY, 0); if (IS_ERR(fp)) ret = PTR_ERR(fp); else { + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) oldfs = get_fs(); set_fs(KERNEL_DS); + #endif if (1 != readFile(fp, &buf, 1)) 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); #endif } - + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) set_fs(oldfs); + #endif filp_close(fp, NULL); } return ret; @@ -2176,7 +2181,9 @@ static int isFileReadable(const char *path, u32 *sz) static int retriveFromFile(const char *path, u8 *buf, u32 sz) { int ret = -1; + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) mm_segment_t oldfs; + #endif struct file *fp; if (path && buf) { @@ -2184,10 +2191,14 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz) if (0 == ret) { RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp); + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) oldfs = get_fs(); set_fs(KERNEL_DS); + #endif ret = readFile(fp, buf, sz); + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) set_fs(oldfs); + #endif closeFile(fp); 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) { int ret = 0; + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) mm_segment_t oldfs; + #endif struct file *fp; if (path && buf) { @@ -2219,10 +2232,14 @@ static int storeToFile(const char *path, u8 *buf, u32 sz) if (0 == ret) { RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp); + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) oldfs = get_fs(); set_fs(KERNEL_DS); + #endif ret = writeFile(fp, buf, sz); + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) set_fs(oldfs); + #endif closeFile(fp); RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret);