[network-manager-applet] wifi: support ad-hoc WPA2 connections



commit 9255dd0879983abae59b105bded869f3bf30d97a
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Wed Aug 21 14:39:11 2019 +0200

    wifi: support ad-hoc WPA2 connections
    
    Now that NM supports ad-hoc WPA2 connections, enable them in the applet.
    
    https://gitlab.gnome.org/GNOME/network-manager-applet/merge_requests/58

 src/connection-editor/page-wifi-security.c |  6 +-----
 src/wireless-security/ws-wpa-psk.c         | 14 +++++---------
 2 files changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/src/connection-editor/page-wifi-security.c b/src/connection-editor/page-wifi-security.c
index c5bfab6c..4d0699b0 100644
--- a/src/connection-editor/page-wifi-security.c
+++ b/src/connection-editor/page-wifi-security.c
@@ -387,7 +387,7 @@ finish_setup (CEPageWifiSecurity *self, gpointer user_data)
                ws_wpa_psk = ws_wpa_psk_new (connection, FALSE);
                if (ws_wpa_psk) {
                        add_security_item (self, WIRELESS_SECURITY (ws_wpa_psk), sec_model,
-                                          &iter, _("WPA & WPA2 Personal"), FALSE, TRUE);
+                                          &iter, _("WPA & WPA2 Personal"), TRUE, TRUE);
                        if ((active < 0) && ((default_type == NMU_SEC_WPA_PSK) || (default_type == 
NMU_SEC_WPA2_PSK)))
                                active = item;
                        item++;
@@ -519,10 +519,6 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
        s_wireless = nm_connection_get_setting_wireless (connection);
        g_assert (s_wireless);
 
-       /* Kernel Ad-Hoc WPA support is busted; it creates open networks.  Disable
-        * WPA when Ad-Hoc is selected.  set_sensitive() will pick up priv->mode
-        * and do the right thing.
-        */
        mode = nm_setting_wireless_get_mode (s_wireless);
        if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_ADHOC) == 0)
                priv->mode = NM_802_11_MODE_ADHOC;
diff --git a/src/wireless-security/ws-wpa-psk.c b/src/wireless-security/ws-wpa-psk.c
index a7531041..eba22a79 100644
--- a/src/wireless-security/ws-wpa-psk.c
+++ b/src/wireless-security/ws-wpa-psk.c
@@ -131,14 +131,10 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
        wireless_security_clear_ciphers (connection);
        if (is_adhoc) {
                /* Ad-Hoc settings as specified by the supplicant */
-               g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-none", NULL);
-               nm_setting_wireless_security_add_proto (s_wireless_sec, "wpa");
-               nm_setting_wireless_security_add_pairwise (s_wireless_sec, "none");
-
-               /* Ad-hoc can only have _one_ group cipher... default to TKIP to be more
-                * compatible for now.  Maybe we'll support selecting CCMP later.
-                */
-               nm_setting_wireless_security_add_group (s_wireless_sec, "tkip");
+               g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", NULL);
+               nm_setting_wireless_security_add_proto (s_wireless_sec, "rsn");
+               nm_setting_wireless_security_add_pairwise (s_wireless_sec, "ccmp");
+               nm_setting_wireless_security_add_group (s_wireless_sec, "ccmp");
        } else {
                g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", NULL);
 
@@ -178,7 +174,7 @@ ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
        if (!parent)
                return NULL;
 
-       parent->adhoc_compatible = FALSE;
+       parent->adhoc_compatible = TRUE;
        sec = (WirelessSecurityWPAPSK *) parent;
        sec->editing_connection = secrets_only ? FALSE : TRUE;
        sec->password_flags_name = NM_SETTING_WIRELESS_SECURITY_PSK;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]