[network-manager-applet/bg/wifi-enable-adhoc-wpa2] wifi: drop wpa-none and add ad-hoc wpa2 support



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

    wifi: drop wpa-none and add ad-hoc wpa2 support

 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 e53588c4..aaf67a65 100644
--- a/src/connection-editor/page-wifi-security.c
+++ b/src/connection-editor/page-wifi-security.c
@@ -401,7 +401,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++;
@@ -533,10 +533,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 1ea1791b..d5ed52c1 100644
--- a/src/wireless-security/ws-wpa-psk.c
+++ b/src/wireless-security/ws-wpa-psk.c
@@ -145,14 +145,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);
 
@@ -192,7 +188,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]