From 25f2c0ffd8924acd2a6b36fa725a4d1c43cfd369 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 2 Jul 2018 21:07:29 +0200 Subject: [PATCH 1/8] Fix the CONFIG_NET_NS, support for network namespaces --- os_dep/linux/ioctl_cfg80211.c | 3 +++ os_dep/linux/os_intfs.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 9cbd901..e2fa44e 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -7190,6 +7190,9 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) +#if defined(CONFIG_NET_NS) + wiphy->flags |= WIPHY_FLAG_NETNS_OK; +#endif //CONFIG_NET_NS wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; #endif diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index ccba940..e835974 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1605,6 +1605,9 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name) rtw_init_netdev_name(ndev, name); _rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN); +#if defined(CONFIG_NET_NS) + dev_net_set(ndev, wiphy_net(adapter_to_wiphy(adapter))); +#endif //defined(CONFIG_NET_NS) /* Tell the network stack we exist */ From 3aa600b41372af23d738aba1c48e3b8d0fb1e160 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 2 Jul 2018 21:29:24 +0200 Subject: [PATCH 2/8] Count injected frames in interface stats --- core/rtw_xmit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index d1a0053..e2ea602 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -4394,6 +4394,8 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev) pattrib->last_txcmdsz = pattrib->pktlen; dump_mgntframe(padapter, pmgntframe); DBG_COUNTER(padapter->tx_logs.core_tx); + pxmitpriv->tx_pkts++; + pxmitpriv->tx_bytes += skb->len; fail: rtw_skb_free(skb); From 5b8f812224fcd8cd0f5d647daf3afc745a3e6e27 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 2 Jul 2018 21:31:35 +0200 Subject: [PATCH 3/8] Be quiet about power save --- core/rtw_pwrctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index 0bb4d76..b460da7 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -286,7 +286,7 @@ void rtw_ps_processor(_adapter *padapter) ps_deny = rtw_ps_deny_get(padapter); _exit_pwrlock(&adapter_to_pwrctl(padapter)->lock); if (ps_deny != 0) { - RTW_INFO(FUNC_ADPT_FMT ": ps_deny=0x%08X, skip power save!\n", + RTW_DBG(FUNC_ADPT_FMT ": ps_deny=0x%08X, skip power save!\n", FUNC_ADPT_ARG(padapter), ps_deny); goto exit; } From 96505723e3a14b0a19d1b930645c6dcef0a8d277 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 2 Jul 2018 21:39:36 +0200 Subject: [PATCH 4/8] Unmask all available channels --- os_dep/linux/wifi_regd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/os_dep/linux/wifi_regd.c b/os_dep/linux/wifi_regd.c index 73025cc..82abc9c 100644 --- a/os_dep/linux/wifi_regd.c +++ b/os_dep/linux/wifi_regd.c @@ -310,16 +310,16 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy) { #if 1 /* by channel plan */ _adapter *padapter = wiphy_to_adapter(wiphy); - struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter); - u8 channel_plan = rfctl->ChannelPlan; - RT_CHANNEL_INFO *channel_set = rfctl->channel_set; - u8 max_chan_nums = rfctl->max_chan_nums; + //struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter); + //u8 channel_plan = rfctl->ChannelPlan; + //RT_CHANNEL_INFO *channel_set = rfctl->channel_set; + //u8 max_chan_nums = rfctl->max_chan_nums; struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; unsigned int i, j; u16 channel; - u32 freq; + //u32 freq; /* all channels disable */ for (i = 0; i < NUM_NL80211_BANDS; i++) { @@ -330,12 +330,15 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy) ch = &sband->channels[j]; if (ch) - ch->flags = IEEE80211_CHAN_DISABLED; + ch->flags &= ~(IEEE80211_CHAN_DISABLED|IEEE80211_CHAN_NO_HT40PLUS|IEEE80211_CHAN_NO_HT40MINUS); + //ch->flags = IEEE80211_CHAN_DISABLED; } } } /* channels apply by channel plans. */ + + /* for (i = 0; i < max_chan_nums; i++) { channel = channel_set[i].ChannelNum; freq = rtw_ch2freq(channel); @@ -356,6 +359,7 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy) ch->flags = 0; } } +*/ #else struct ieee80211_supported_band *sband; From a202c7ccaacbecf8fab960992dde93225a684b1e Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 2 Jul 2018 21:53:11 +0200 Subject: [PATCH 5/8] Enable the channel 14 and 80 MHz width channels in the regdom --- os_dep/linux/wifi_regd.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/os_dep/linux/wifi_regd.c b/os_dep/linux/wifi_regd.c index 82abc9c..450d4b3 100644 --- a/os_dep/linux/wifi_regd.c +++ b/os_dep/linux/wifi_regd.c @@ -53,34 +53,36 @@ static struct country_code_to_enum_rd allCountries[] = { /* 5G chan 36 - chan 64 */ #define RTW_5GHZ_5150_5350 \ - REG_RULE(5150-10, 5350+10, 40, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) + REG_RULE(5150-10, 5350+10, 80, 0, 30, \ + NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) /* 5G chan 100 - chan 165 */ #define RTW_5GHZ_5470_5850 \ - REG_RULE(5470-10, 5850+10, 40, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) + REG_RULE(5470-10, 5850+10, 80, 0, 30, \ + NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) /* 5G chan 149 - chan 165 */ #define RTW_5GHZ_5725_5850 \ - REG_RULE(5725-10, 5850+10, 40, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) + REG_RULE(5725-10, 5850+10, 80, 0, 30, \ + NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) /* 5G chan 36 - chan 165 */ #define RTW_5GHZ_5150_5850 \ - REG_RULE(5150-10, 5850+10, 40, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) + REG_RULE(5150-10, 5850+10, 80, 0, 30, \ + NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) static const struct ieee80211_regdomain rtw_regdom_rd = { - .n_reg_rules = 3, + .n_reg_rules = 4, .alpha2 = "99", .reg_rules = { RTW_2GHZ_CH01_11, RTW_2GHZ_CH12_13, + RTW_2GHZ_CH14, RTW_5GHZ_5150_5850, } }; +#if 0 static const struct ieee80211_regdomain rtw_regdom_11 = { .n_reg_rules = 1, .alpha2 = "99", @@ -138,7 +140,7 @@ static const struct ieee80211_regdomain rtw_regdom_14 = { RTW_2GHZ_CH14, } }; - +#endif #if 0 static struct rtw_regulatory *rtw_regd; #endif From 116e984cd02dc1ba09baae448f4e42982dcc8efd Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 2 Jul 2018 21:55:43 +0200 Subject: [PATCH 6/8] Fix error switching to 80MHz channels under certain conditions --- os_dep/linux/wifi_regd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/os_dep/linux/wifi_regd.c b/os_dep/linux/wifi_regd.c index 450d4b3..796d27b 100644 --- a/os_dep/linux/wifi_regd.c +++ b/os_dep/linux/wifi_regd.c @@ -332,7 +332,9 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy) ch = &sband->channels[j]; if (ch) - ch->flags &= ~(IEEE80211_CHAN_DISABLED|IEEE80211_CHAN_NO_HT40PLUS|IEEE80211_CHAN_NO_HT40MINUS); + ch->flags &= ~(IEEE80211_CHAN_DISABLED|IEEE80211_CHAN_NO_HT40PLUS| + IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_80MHZ| + IEEE80211_CHAN_NO_160MHZ); //ch->flags = IEEE80211_CHAN_DISABLED; } } From 737913c6613c1c19cc4f0cffb814938fb4a04a37 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 2 Jul 2018 21:59:24 +0200 Subject: [PATCH 7/8] Fix channel switch in monitor mode if both CONFIG_WIRELESS_EXT and CONFIG_CFG80211_WEXT are enabled --- os_dep/linux/ioctl_linux.c | 5 +++-- os_dep/linux/os_intfs.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c index 172da1a..e6abac2 100644 --- a/os_dep/linux/ioctl_linux.c +++ b/os_dep/linux/ioctl_linux.c @@ -12495,8 +12495,9 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) } #endif -#ifdef CONFIG_WIRELESS_EXT -struct iw_handler_def rtw_handlers_def = { +#if defined(CONFIG_WIRELESS_EXT) && !defined(CONFIG_CFG80211_WEXT) +struct iw_handler_def rtw_handlers_def = +{ .standard = rtw_handlers, .num_standard = sizeof(rtw_handlers) / sizeof(iw_handler), #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)) || defined(CONFIG_WEXT_PRIV) diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index e835974..d732019 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1522,7 +1522,7 @@ struct net_device *rtw_init_netdev(_adapter *old_padapter) /* pnetdev->tx_timeout = NULL; */ pnetdev->watchdog_timeo = HZ * 3; /* 3 second timeout */ -#ifdef CONFIG_WIRELESS_EXT +#if defined(CONFIG_WIRELESS_EXT) && !defined(CONFIG_CFG80211_WEXT) pnetdev->wireless_handlers = (struct iw_handler_def *)&rtw_handlers_def; #endif From ffc23dc93326d4b4d8b0f7f9d9566d88617b6717 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 2 Jul 2018 22:01:25 +0200 Subject: [PATCH 8/8] Stop exporting unnecessary symbols --- os_dep/linux/rtw_radiotap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/os_dep/linux/rtw_radiotap.c b/os_dep/linux/rtw_radiotap.c index f2c9218..49f6aa5 100644 --- a/os_dep/linux/rtw_radiotap.c +++ b/os_dep/linux/rtw_radiotap.c @@ -161,7 +161,7 @@ int rtw_ieee80211_radiotap_iterator_init( return 0; } -EXPORT_SYMBOL(rtw_ieee80211_radiotap_iterator_init); +//EXPORT_SYMBOL(rtw_ieee80211_radiotap_iterator_init); static void find_ns(struct ieee80211_radiotap_iterator *iterator, uint32_t oui, uint8_t subns) @@ -367,4 +367,4 @@ int rtw_ieee80211_radiotap_iterator_next( return 0; } } -EXPORT_SYMBOL(rtw_ieee80211_radiotap_iterator_next); \ No newline at end of file +//EXPORT_SYMBOL(rtw_ieee80211_radiotap_iterator_next);