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 #4661

Merged
merged 3 commits into from
Jan 7, 2023
Merged

RTL8189FS: Fix P2P-GO advertising #4661

merged 3 commits into from
Jan 7, 2023

Conversation

Azq2
Copy link
Collaborator

@Azq2 Azq2 commented Jan 6, 2023

Description

Most of Realtek drivers have a bug: P2P IE not passed to AP beacon.
This causes problems, when P2P-GO looks like a regular AP. All P2P capable devices can't see my P2P-GO in the list.

I found a driver where P2P-GO works fine (according to user reviews): https://github.com/aircrack-ng/rtl8812au
And found these differences. After I backported these changes my P2P-GO works fine.

Also this changes is totally safe, because affects only P2P-related code

This patch contains my patches to the original driver repo:

  1. rtl8189fs: Fix p2p-go advertising jwrdegoede/rtl8189ES_linux#87
  2. rtl8189fs: Fix uninitialized cfg80211_chan_def jwrdegoede/rtl8189ES_linux#88

But the owner is too busy to review that :(

How Has This Been Tested?

  1. Create /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=1
device_name=orangepilite
device_type=1-0050F204-1
config_methods=virtual_push_button
p2p_no_group_iface=1
  1. Setup DHCP for the wlan0: /etc/systemd/network/wlan0.network
[Match]
Name=wlan0

[Network]
Address=10.7.7.7/24
DHCPServer=true
IPMasquerade=ipv4

[DHCPServer]
PoolOffset=100
PoolSize=20
EmitDNS=yes
DNS=1.1.1.1
  1. Setup services
# We don't need NM
sudo systemctl disable NetworkManager
sudo systemctl stop NetworkManager

# For test we need systemd-networkd
sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd

# Useless without NM
sudo systemctl stop wpa_supplicant
sudo systemctl disable wpa_supplicant

# Enable wpa_supplicant for wlan0
sudo systemctl enable wpa_supplicant@wlan0
sudo systemctl start wpa_supplicant@wlan0
  1. Now create P2P-GO:
sudo wpa_cli p2p_group_add
  1. Open on android "Wifi Direct" section in settings.
    Now you can see "orangepilite" device in the list. Just click it!

  2. Accept join req from your phone to P2P-GO

sudo wpa_cli wps_pbc

In wpa_supplicant logs you can see something like that:

<3>P2P-DEVICE-FOUND xx:xx:xx:xx:xx:xx p2p_dev_addr=xx:xx:xx:xx:xx:xx pri_dev_type=10-0050F204-5 name='Android_6d7f' config_methods=0x188 dev_capab=0x25 group_capab=0x0 new=1
<3>P2P-PROV-DISC-PBC-REQ xx:xx:xx:xx:xx:xx p2p_dev_addr=xx:xx:xx:xx:xx:xx pri_dev_type=10-0050F204-5 name='Android_6d7f' config_methods=0x188 dev_capab=0x25 group_capab=0x0
<3>WPS-PBC-ACTIVE 
<3>P2P-PROV-DISC-PBC-REQ xx:xx:xx:xx:xx:xx p2p_dev_addr=xx:xx:xx:xx:xx:xx pri_dev_type=10-0050F204-5 name='Android_6d7f' config_methods=0x188 dev_capab=0x25 group_capab=0x0
<3>CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
<3>CTRL-EVENT-EAP-STARTED xx:xx:xx:xx:xx:xx
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=254
<3>WPS-REG-SUCCESS xx:xx:xx:xx:xx:xx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
<3>WPS-PBC-DISABLE 
<3>WPS-SUCCESS 
<3>CTRL-EVENT-EAP-FAILURE xx:xx:xx:xx:xx:xx
<3>CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
<3>AP-STA-CONNECTED xx:xx:xx:xx:xx:xx p2p_dev_addr=xx:xx:xx:xx:xx:xx
<3>EAPOL-4WAY-HS-COMPLETED xx:xx:xx:xx:xx:xx

That's successful connection.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@Azq2 Azq2 changed the title RTL8188FS: Fix P2P-GO advertising RTL8189FS: Fix P2P-GO advertising Jan 6, 2023
@Azq2
Copy link
Collaborator Author

Azq2 commented Jan 6, 2023

I think, this patch must be ported to all realtek drivers. That easily.
Having working P2P in the armbian is a great feature.

But I have only RTL8189FS :(

@igorpecovnik
Copy link
Member

I think, this patch must be ported to all realtek drivers. That easily.

Agree, but we are also very low on time :( I hope patch just applies elsewhere too but probably not ...

But I have only RTL8189FS :(

We have around 25 different USB wireless chips in the lab for testing purposes. Plan is to share them via usbip and run automated tests with. But since I am as busy as Hans :) adaptors just sit there doing nothing :(

IMG_20230106_210911

@Azq2
Copy link
Collaborator Author

Azq2 commented Jan 6, 2023

Sounds cool :)

If this PR will be successful, I can try to adapt this patch to other RTL wifi's.
Theoretically, this  is safe, because it affects only P2P-GO code, which is currently broken anyway.
And all testing will be delegated to end-users, which want to use P2P.

Also I have tinkerboard with RTL8723BS. With same bug. I'll send a patch for it too.

@hzyitc
Copy link
Member

hzyitc commented Jan 7, 2023

We have around 25 different USB wireless chips in the lab for testing purposes. Plan is to share them via usbip and run automated tests with. But since I am as busy as Hans :) adaptors just sit there doing nothing :(

If necessary, I can try to help.

@The-going
Copy link
Contributor

Plan is to share them via usbip and run automated tests with.

Do I understand correctly, we are talking about this one?
linux-mainline/6.1/tools/usb/usbip/*

@igorpecovnik
Copy link
Member

Idea was summarised in https://armbian.atlassian.net/browse/INFRA-3

Do I understand correctly, we are talking about this one?

Yes, but until test scripting is not production ready, it can run on x86 machinery - where this just works.

@The-going
Copy link
Contributor

Yes, but until test scripting is not production ready, it can run on x86 machinery - where this just works.

I will formulate the question differently.
Do I need to implement a package build for usbip? When we assemble the target kernel (current, edge).

@igorpecovnik
Copy link
Member

Do I need to implement a package build for usbip? When we assemble the target kernel (current, edge).

yes. usbip client is needed. assembled on the device or packaged. But its not urgent as we only need this, when this test system is functioning. I think on x86 just works as I was already testing this by hand few months ago.

@The-going
Copy link
Contributor

yes. usbip client is needed. assembled on the device or packaged.

Good. I'll do that, too.

igorpecovnik
igorpecovnik previously approved these changes Jan 7, 2023
@igorpecovnik igorpecovnik added the Ready to merge Reviewed, tested and ready for merge label Jan 7, 2023
@igorpecovnik igorpecovnik merged commit ba48245 into armbian:master Jan 7, 2023
smlinux pushed a commit to smlinux/armbian-tanix-tx6 that referenced this pull request Jan 8, 2023
* RTL8189FS: fix P2P-GO adverising

* Add patch to drivers_network.sh

Co-authored-by: Igor Pečovnik <[email protected]>
@Azq2 Azq2 mentioned this pull request Jan 20, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready to merge Reviewed, tested and ready for merge
Development

Successfully merging this pull request may close these issues.

5 participants