GNOME Bugzilla – Bug 719852
Use WPA encryption for AP-mode hotspots
Last modified: 2014-09-02 14:11:56 UTC
Ad-hoc mode hotspots cannot (yet) use WPA for kernel-related reasons, but AP-mode hotspots should have no problem using WPA. The default hotspot creation code only creates WEP connections though. panels/network/net-device-wifi.c::start_shared_connection() should get updated to do something like: /* Use real AP mode if the device supports it */ if (nm_device_wifi_get_capabilities (NM_DEVICE_WIFI (device)) & NM_WIFI_DEVICE_CAP_AP) { mode = NM_SETTING_WIRELESS_MODE_AP; is_ap = TRUE; } else mode = NM_SETTING_WIRELESS_MODE_ADHOC; ... sws = (NMSettingWirelessSecurity*) nm_setting_wireless_security_new (); if (is_ap) { wpa_passphrase = generate_wpa_passphrase (device_wifi); g_object_set (sws, "key-mgmt", "wpa-psk", "psk", wpa_passphrase, NULL); g_free (wpa_passphrase); } else { wep_key = generate_wep_key (device_wifi); g_object_set (sws, "key-mgmt", "none", "wep-key0", wep_key, "wep-key-type", NM_WEP_KEY_TYPE_KEY, NULL); g_free (wep_key); } Generating the WPA key is going to be a bit different than doing the WEP key, since a hex WPA PSK is 64 characters long, and that's a b*tch to type. So you really want to generate a WPA passphrase, which is between 8 and 63 *ASCII* characters long (inclusive). Probably hit up a dictionary or something?
Created attachment 265515 [details] [review] 0001-wifi-create-WPA-protected-hotspot-if-supported-by-de.patch Proposed fix for this bug.
Review of attachment 265515 [details] [review]: Rest looks fine. ::: panels/network/net-device-wifi.c @@ +863,3 @@ + gint i; + + /* generate a 8-digits assci WPA key */ ASCII @@ +864,3 @@ + + /* generate a 8-digits assci WPA key */ + for (i = 0; i < 8; i++) { sizeof(key)? @@ +885,2 @@ { + char key[11]; switching gchar to char is not something that should be done in this patch.
(In reply to comment #2) > @@ +864,3 @@ > + > + /* generate a 8-digits assci WPA key */ > + for (i = 0; i < 8; i++) { > > sizeof(key)? I'm going to introduce constant to define size of key.
Created attachment 265899 [details] [review] 0001-wifi-create-WPA-protected-AP-hotspot-if-supported-by.patch Proposed fix - v2.
(In reply to comment #2) > Review of attachment 265515 [details] [review]: > > Rest looks fine. Bastien, ping!
Pushed with a few fixes and changes to the commit message. Thanks for the patch!
*** Bug 678287 has been marked as a duplicate of this bug. ***