nerves-networking / vintage_net_wifi

WiFi networking for VintageNet
Apache License 2.0
32 stars 18 forks source link

Support creating WPA2/WPA3 configurations #217

Closed fhunleth closed 9 months ago

fhunleth commented 9 months ago

This adds support for passing a list of allowed WiFi encryption protocols. This lets you make a configuration that will work whether the AP is using WPA2 or WPA3.

Here's an example that specifies both WPA2 and WPA3 options and supports WPA2-SHA256 too:

%{
  type: VintageNetWiFi,
  vintage_net_wifi: %{
    networks: [
      %{
        ssid: "testing",
        psk: "password",
        sae_password: "password",
        key_mgmt: [:sae, :wpa_psk_sha256, :wpa_psk],
        ieee80211w: 2
      }
    ]
  },
  ipv4: %{method: :dhcp}
}

To test, you can either specify the above configuration to VintageNet.configure or use VintageNetWiFi.quick_configure/2 which has been update to support both WPA3 and WPA2.

fhunleth commented 9 months ago

I've tested this on WPA2, WPA3/2 transitional and WPA3-only networks and it seems to work. I also tested this on a Raspberry Zero W to see that it doesn't break a WPA2-only board, and it doesn't.

It's backwards compatible so you can revert to old versions of VintageNetWiFi and you just get forced into WPA2-only mode if you used quick_configure. It defaults to whatever is first in the list of allowed key management protocols.

I think this is ready to go for broader use.

ConnorRigby commented 9 months ago

image I tested on a beaglebone green wifi with a WPA3 only network.