Skip to content

Conversation

smuppand
Copy link
Contributor

Some images return the following when using the “simple” NetworkManager path:

nmcli dev wifi connect password
Error: 802-11-wireless-security.key-mgmt: property is missing.
This PR makes wifi_connect_nmcli() resilient to that case while preserving current behavior on images where the simple path works.

What changed

  • Keep the existing “simple connect” attempt (with retries).
  • If it fails with the key-mgmt property is missing error (or similar NM error):
  • Ensure Wi-Fi is enabled and device is managed: nmcli r wifi on, nmcli dev set managed yes.
  • Disconnect and rescan the SSID.
  • Remove any stale connection with the same name.
  • Create an explicit profile:
  • WPA2/PSK: wifi-sec.key-mgmt wpa-psk, wifi-sec.psk
  • Fallback to WPA3/SAE (wifi-sec.key-mgmt sae) if WPA2 creation/bring-up fails.
  • Open networks (no password): wifi-sec.key-mgmt none.
  • Bring the profile up: nmcli con up .
  • All nmcli output is logged to ${LOG_DIR:-.}/nmcli__.log for triage.
  • The function returns success on the first working method; otherwise bubbles up failure.
  • No changes required for callers; function name and signature unchanged.

Why this is safe

  • Only triggers the profile path when the simple path fails with the specific NM error.
  • Does not change flow for already-working environments.
  • Avoids echoing the PSK into logs (only nmcli’s output is captured).

Some images fail the simple NetworkManager path:

  nmcli dev wifi connect <SSID> password <PSK>
  Error: 802-11-wireless-security.key-mgmt: property is missing.

Extend wifi_connect_nmcli() to detect this error and automatically
switch to an explicit profile flow:

- Ensure Wi-Fi is enabled and device is managed.
- Disconnect and rescan the SSID, delete any stale connection.
- Create a profile with:
    * WPA2/PSK:   wifi-sec.key-mgmt wpa-psk, wifi-sec.psk <pass>
    * Fallback:   wifi-sec.key-mgmt sae (WPA3-Personal) if needed
    * Open nets:  wifi-sec.key-mgmt none (no password)
- Bring the connection up and return success on first working method.

Signed-off-by: Srikanth Muppandam <[email protected]>
@smuppand smuppand requested a review from vnarapar September 29, 2025 04:58
Copy link
Contributor

@vnarapar vnarapar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vnarapar vnarapar merged commit 8ab2f60 into qualcomm-linux:main Sep 30, 2025
8 checks passed
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