Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtl8189fs: Fix p2p-go advertising #87

Open
wants to merge 1 commit into
base: rtl8189fs
Choose a base branch
from

Conversation

Azq2
Copy link

@Azq2 Azq2 commented Nov 27, 2022

I'm trying to use WiFi P2P group owner on this driver, but my p2p access point looks like regular access point and not listed in "WiFi Direct" list on Android phone.

Main reason of this problem - "p2p ie" from wpa_supplicant not passed into wifi beacon

I found other driver where p2p_go works fine (but for other chip) https://github.com/aircrack-ng/rtl8812au

And I make diff of os_dep/linux/ioctl_cfg80211.c

 	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) {
 		WLAN_BSSID_EX *pbss_network = &adapter->mlmepriv.cur_network.network;
 		WLAN_BSSID_EX *pbss_network_ext = &adapter->mlmeextpriv.mlmext_info.network;
@@ -4986,9 +5214,22 @@
 
 	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;
 }

And after backporting of this changes p2p_go now works fine!
Now I see my orangepi on my android device in "Wi-Fi Direct" list.

@Azq2 Azq2 changed the title Fix p2p-go advertising rtl8189fs: Fix p2p-go advertising Jan 19, 2023
@khuongtrinh2
Copy link

Hello @Azq2, when I apply this diff file, I cannot see my board on Android phone.

@Azq2
Copy link
Author

Azq2 commented Nov 1, 2024

@khuongtrinh2 Please check with armbian. Armbian already contains my patches for wifi direct and 2nd iface.

https://github.com/armbian/build/pulls?q=is%3Apr+author%3AAzq2+is%3Aclosed

@khuongtrinh2
Copy link

Hi @Azq2 , Thank you so much, I will apply and check it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants