prusa3d / Prusa-ESP-Nic-FW

ESP8266 as generic network interface over UART
15 stars 10 forks source link

ESP01 not connecting when PMF (Protected Management Frames) enforced by AP #15

Open SerePes opened 11 months ago

SerePes commented 11 months ago

Protected Management Frames (PMF) is a standard(802.11w) defined by WiFi Alliance to enhance WiFi connection safety. It provides unicast and multicast management actions and frames a secure method with WPA2/WPA3, which can improve packet privacy protection. Workaround is switching the protection off at WIFI AP. To support this protection following simple patch can be applied. I tested it on my mini and works fine.

diff --git a/main/uart_nic.c b/main/uart_nic.c
index cd35f12..98efc9f 100644
--- a/main/uart_nic.c
+++ b/main/uart_nic.c
@@ -370,6 +370,7 @@ static void IRAM_ATTR handle_rx_msg_clientconfig_v2(uint8_t* data, size_t size)
     if (strlen((char *)wifi_config.sta.password)) {
         wifi_config.sta.threshold.authmode = WIFI_AUTH_WPA2_PSK;
     }
+    wifi_config.sta.pmf_cfg.capable = 1;

     esp_wifi_stop();
     ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) )
vorner commented 11 months ago

Thank you for the discovery. We'll try it out and put it to the next version of FW.

bkerler commented 8 months ago

As it was merged, I think this issue can be closed now.

pilotak commented 5 months ago

i disabled "Management Protection" as this is how it's called in Mikrotik and it still can't connect, however i didn't apply you patch