SDK Wi-Fi Sta sample app will not connect to WPA2 AP - broken wifi_connect_req_params.security setting

The 2.3 SDK Wi-Fi sta sample app does not appear to work like it did with SDK 2.2, at least with my access point running WPA2.

It looks like the net_mgmt() macro call does not work with CONFIG_STA_KEY_MGMT_WPA2=y.  

The sta sample code __wifi_args_to_params() sets wifi_connect_req_params.security to STA_KEY_MGMT_WPA2, which does not work.
Overriding it and setting wifi_connect_req_params.security to WIFI_SECURITY_TYPE_PSK before net_mgmt() macro does connect successfully.
The wi-fi shell sample app does work. It sets wifi_connect_req_params.security to WIFI_SECURITY_TYPE_PSK

	if (net_mgmt(NET_REQUEST_WIFI_CONNECT, iface,
		     &cnx_params, sizeof(struct wifi_connect_req_params))) {
		LOG_ERR("Connection request failed");

		return -ENOEXEC;
	}

Parents Reply Children
  • I see the issue now.  It enabled the supplicant log and say it was complaining about a key management mismatch.  I went to the project config and manually uncommented 

    CONFIG_STA_KEY_MGMT_WPA2
    and it will join my wpa2 AP successfully.
    My fault for not reading the complete README.rst that says to configure prj.conf and I did not see the sta app security option radio buttons at the bottom, especially when I filter for "WPA2".
    The KConfig menu is confusing because it does not allow enabling of WPA2 (greyed out until you enable with sta settings at bottom), and has hostap WPA3 support selected, though that config does not appear in the prj.conf file.
     
    FWIW, the way that the shell app will join with out specifying the specific WPA management is nicer IMO.
    Also, the sta sample app is also sometimes stack faulting due to this issue:
    The suggested fix of increasing the MGMT_EVENT_STACK_SIZE seems to fix it.
    thanks for the help.
Related