From 6ac1aedd79fd1cdced9be3ca8d379b18ca3f8686 Mon Sep 17 00:00:00 2001 From: Kirill Zhumarin Date: Sun, 27 Nov 2022 16:19:29 +0200 Subject: [PATCH] Fix p2p-go advertising --- drivers/net/wireless/rtl8189fs/os_dep/linux/ioctl_cfg80211.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/wireless/rtl8189fs/os_dep/linux/ioctl_cfg80211.c b/drivers/net/wireless/rtl8189fs/os_dep/linux/ioctl_cfg80211.c index 4ac88af..9c67bbf 100644 --- a/drivers/net/wireless/rtl8189fs/os_dep/linux/ioctl_cfg80211.c +++ b/drivers/net/wireless/rtl8189fs/os_dep/linux/ioctl_cfg80211.c @@ -4952,6 +4952,15 @@ 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*/); + } + if (settings->ssid && settings->ssid_len) { WLAN_BSSID_EX *pbss_network = &adapter->mlmepriv.cur_network.network; WLAN_BSSID_EX *pbss_network_ext = &adapter->mlmeextpriv.mlmext_info.network; @@ -4986,6 +4995,15 @@ 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; } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19, 2)) From 5ef7643845caab699016983aef3aaf773988d026 Mon Sep 17 00:00:00 2001 From: Kirill Zhumarin Date: Fri, 6 Jan 2023 17:07:53 +0200 Subject: [PATCH] Fix uninitialized cfg80211_chan_def --- drivers/net/wireless/rtl8189fs/os_dep/linux/ioctl_cfg80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rtl8189fs/os_dep/linux/ioctl_cfg80211.c b/drivers/net/wireless/rtl8189fs/os_dep/linux/ioctl_cfg80211.c index 4ac88af..f0b3d49 100644 --- a/drivers/net/wireless/rtl8189fs/os_dep/linux/ioctl_cfg80211.c +++ b/drivers/net/wireless/rtl8189fs/os_dep/linux/ioctl_cfg80211.c @@ -413,7 +413,7 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 u8 ret = _SUCCESS; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) - struct cfg80211_chan_def chdef; + struct cfg80211_chan_def chdef = {}; ret = rtw_chbw_to_cfg80211_chan_def(wiphy, &chdef, ch, bw, offset, ht); if (ret != _SUCCESS)