Avoiding autonomous 5GHz band Wi-Fi steering when a P2P-GO is set to freq=2
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- c, linux
- Domain
- networking, operating-systems
Research direction
Start by reproducing the P2P-GO setup with wpa_supplicant, nl80211, and the p2p_group_add freq=2 command, then compare it with the direct iw setup described in the issue. Trace the Raspberry Pi wireless driver handling for P2P-GO frequency selection and determine why the interface changes bands despite the requested frequency. Done means identifying a driver-side cause or supported prevention mechanism and verifying behavior with iw dev.
Written by the indexing model from the issue text.
Description
Is this the right place for my bug report?
I think that this issue might be related to the BCM2711 nl80211 wireless kernel device driver.
Describe the bug
With a Raspberry Pi supporting the 5GHz Wi-Fi band (e.g., Raspberry Pi 4 Model B), if a Wi-Fi Direct P2P-GO group is created with option 2.4 GHz (freq=2), considering also the presence of some P2P Clients only supporting 2.4 GHz and some supporting Wi-Fi dual bands, the starting P2P-GO band will be 2.4GHz, but after some time the band will autonomously move to 5 GHz.
To reproduce
wpa_supplicant config file (wpa_supplicant.conf):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
device_name=DIRECT-test
device_type=6-0050F204-1
p2p_go_intent=15
country=IT
No AP shall be active (P2P-GO and AP cannot run concurrently on such hw),
wpa_supplicant command:
sudo wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -Dnl80211,wext
Start wpa_cli -i p2p-dev-wlan0 and issue:
p2p_group_add freq=2
The result is the following (iw dev):
Interface p2p-wlan0-0
ifindex 5
wdev 0x4
addr de:a6:32:01:82:03
type P2P-GO
channel 1 (2412 MHz), width: 20 MHz, center1: 2412 MHz
txpower 31.00 dBm
Unnamed/non-netdev interface
wdev 0x2
addr dc:a6:32:01:02:03
type P2P-device
txpower 31.00 dBm
Interface wlan0
ifindex 3
wdev 0x1
addr dc:a6:32:00:9a:f5
ssid TIM-86817771
type managed
channel 104 (5520 MHz), width: 40 MHz, center1: 5510 MHz
txpower 31.00 dBm
Notice the different channels of p2p-wlan0-0 (2.4 GHz) and wlan0 (5 GHz)
Ensure wpa_supplicant is not interfering:
sudo killall -STOP wpa_supplicant
Wait for several minutes.
The iw dev will show a 5 GHz channel for the p2p-wlan0-0 Interface:
phy#0
Interface p2p-wlan0-1
ifindex 5
wdev 0x4
addr de:a6:32:01:82:03
type P2P-GO
channel 36 (5180 MHz), width: 40 MHz, center1: 5190 MHz
txpower 31.00 dBm
Unnamed/non-netdev interface
wdev 0x2
addr dc:a6:32:01:02:03
type P2P-device
txpower 31.00 dBm
Interface wlan0
ifindex 3
wdev 0x1
addr dc:a6:32:00:9a:f5
ssid TIM-86817771
type managed
channel 104 (5520 MHz), width: 40 MHz, center1: 5510 MHz
txpower 31.00 dBm
Expected behaviour
p2p-wlan0-0 channel shall not autonomously move to different frequencies when not driven by wpa_supplicant.
Actual behaviour
Just after creating the P2P-GO group, wpa_supplicant correctly configures the band, in fact the initial P2P-GO virtual interface (p2p-wlan0-0) is set to a 2.4 GHz frequency even if the Wi-Fi interface (wlan0) is set to a frequency in the 5 GHz band. To verify that wpa_supplicant does not interfere, we can send a SIGSTOP signal just after the P2P-GO group is created.
After several minutes, the Broadcom nl80211 wireless device driver autonomously appears to move the P2P-GO frequency from the 2.4 GHz band to the 5 GHz band.
The result is that 5 GHz P2P Devices can still connect the P2P-GO group after a while, while the 2.4 GHz ones will no more receive the group beaconing data.
Considering to find a workaround by modifying the wpa_supplicant sources, which is the correct nl80211 wireless device driver option to prevent this (wrong) default behavior when creating the NL80211_IFTYPE_P2P_GO type interface? Notice that if the P2P-GO interface is created with NL80211_ATTR_FREQ_FIXED property, the results are unchanged.
System
Results of the raspinfo command
-
Which model of Raspberry Pi? Pi4 Model B
-
Which OS and version (
cat /etc/rpi-issue)?
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 9a3a10bf1019ebb2d59053564dc6b90068bad27d, stage4 -
Which firmware version (
vcgencmd version)?
Oct 22 2020 13:59:27
Copyright (c) 2012 Broadcom
version 74e754ff8947c58d2773253f77f6f68a303188f8 (clean) (release) (start) -
Which kernel version (
uname -a)?
Linux RaspberryPi 5.4.72-v7l+ #1356 SMP Thu Oct 22 13:57:51 BST 2020 armv7l GNU/Linux
Additional context
I'm not sure that this is misleading, but there should be a way to overcome the issue, in fact if I run the following commands (after resuming and stopping wpa_supplicant with sudo killall -CONT wpa_supplicant; sleep 10; sudo killall wpa_supplicant), the frequency of the interface appears to stably remain to 2.4 GHz even if, before issuing them, the wlan0 frequency was in a 5 GHz band:
iw dev wlan0 interface add p2p-wlan0-0 type __p2pgo
ifconfig p2p-wlan0-0 192.168.4.1 netmask 255.255.255.0 up
iw dev p2p-wlan0-0 ap start DIRECT-PP-Toyota 2437 100 1 head 80000000ffffffffffff0a85bc6459460a85bc645946000000000000000000006400110400104449524543542d50502d546f796f746101088c129824b048606c030101
iw dev
The output is the following:
phy#0
Interface p2p-wlan0-0
ifindex 6
wdev 0x5
addr de:a6:32:01:82:03
type P2P-GO
channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
txpower 31.00 dBm
Interface wlan0
ifindex 3
wdev 0x1
addr dc:a6:32:00:9a:f5
type managed
channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
Such case is anyway different and possibly not appropriate: both p2p-wlan0-0 and wlan0 are stably set to the same fixed 2.4 GHz frequency, while ideally only the P2P-GO group should be set to a 2.4 GHz frequency.
- Dominant language
- C
- Stars
- 13.2k
- Forks
- 5.5k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 21
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/linux
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7415 · 2 comments · 1 reaction ·
-
rp1-cfe doesn't forward V4L2_EVENT_SOURCE_CHANGE event from csi-2 sensor driver to userspace app Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
raspberrypi/linux#7399 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
raspberrypi/linux#7357 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7054 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
raspberrypi/linux#7634 · 8 comments · 1 reaction ·
All issues in raspberrypi/linux
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zephyrproject-rtos/zephyr#119726 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BasedHardware/omi#15320 ·
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·