bigtreetech / bigtreetech/CB1

WPA2/WPA3 managed mode fails / broken access point mode

Open
#35 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
496
Forks
86
PR merge metrics
No merged PRs in 30d

Description

I found a nasty bug that prevent the CB1 with v2.1.2 with kernel 5.16 from connection my home Wifi.

Bug with common WPA2/WPA3 pre-shared key wifi networks (tried a few router and APs): The wlan0 doesn't recognize these networks as wpa-psk kind-of. network-manager gives up connecting and reports an error 53 ("network not found").

The /etc/scripts/reconnect_wifi.sh doesn't provide this information to the network-manager in the creation / connect process.

I fixed this afterwards by modify the connection like this:
`nmcli c modify "My_WiFi_SSID" wifi-sec.key-mgmt wpa-psk`

Suggested solution:
Create a $WIFI_METHOD variable in system.cfg like 'WIFI_METHOD=wpa-psk' and use it in the function Env_init().

There is no need for $eth and $wlan at all, because in this system Ethernet will be 'eth0' and WiFi is always 'wlan0'.
Suggested action:
remove it from 'system.cfg' and add it in the 'reconnect-wifi.sh' script.

### hostapd isn't configured

hostapd service was not used and configured, but started. Raises errors.
Suggested solution:
Just remove the start links with `sudo update-rc.d -f hostapd remove`.

### Access Point mode broken
This simply can't work because there is no 'create_ap' executable / script installed in this image!
I suggest to completely redesign this because 'create_ap' is depreciated. Maybe a newer script like 'lnxrouter' (https://github.com/garywill/linux-router) or the usage of 'hostapd' will be a better solution.
I realized that in function Env_init() the system always use the network-manager to connect to the $WIFI_SSID network. The AP part of the system.cfg ($WIFI_AP, $WIFI_AP_SSID and $WIFI_AP_PASSWD) will be ignored.

### Toggling between Managed and AP mode
There is no need to add the WiFi connection again tn the function Create_AP_OFF().
Instead of
`sudo nmcli dev wifi connect $WIFI_SSID password $WIFI_PASSWD ifname $wlan`
It's better to do a connect of the (existing) system connection:
`sudo nmcli c up id $WIFI_SSID`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with /etc/scripts/reconnect_wifi.sh, system.cfg, and the Env_init() and Create_AP_OFF() functions, then inspect how hostapd and create_ap are started or referenced. Reproduce managed WPA2/WPA3 connection and managed/AP toggling on the stated CB1 image. Done means the reported managed-mode, hostapd, AP-mode, and mode-toggle failures have defined and verified behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, shell
Domain
networking, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.