[PATCH 3/3 applet] Allow to create and connect to Ad-Hoc RSN networks.



From: Nicolas Cavallari <cavallar lri fr>

This follows changes to Network Manager, which now
supports WPA2/RSN in Ad-Hoc/IBSS mode.
---
 src/applet-dialogs.c                           |    2 --
 src/connection-editor/page-wireless-security.c |    9 ++-------
 src/libnm-gtk/nm-wireless-dialog.c             |    3 +--
 src/wireless-security/ws-wpa-psk.c             |   15 +++++++--------
 4 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c
index b9ebc47..bb893af 100644
--- a/src/applet-dialogs.c
+++ b/src/applet-dialogs.c
@@ -241,8 +241,6 @@ create_info_label_security (NMConnection *connection)
 
 			if (!strcmp (key_mgmt, "none"))
 				label = g_strdup (_("WEP"));
-			else if (!strcmp (key_mgmt, "wpa-none"))
-				label = g_strdup (_("WPA/WPA2"));
 			else if (!strcmp (key_mgmt, "wpa-psk"))
 				label = g_strdup (_("WPA/WPA2"));
 			else
diff --git a/src/connection-editor/page-wireless-security.c b/src/connection-editor/page-wireless-security.c
index 09a6744..855f783 100644
--- a/src/connection-editor/page-wireless-security.c
+++ b/src/connection-editor/page-wireless-security.c
@@ -79,8 +79,7 @@ get_default_type_for_security (NMSettingWirelessSecurity *sec)
 		return NMU_SEC_DYNAMIC_WEP;
 	}
 
-	if (   !strcmp (key_mgmt, "wpa-none")
-	    || !strcmp (key_mgmt, "wpa-psk")) {
+	if (!strcmp (key_mgmt, "wpa-psk")) {
 		if (find_proto (sec, "rsn"))
 			return NMU_SEC_WPA2_PSK;
 		else if (find_proto (sec, "wpa"))
@@ -337,7 +336,7 @@ finish_setup (CEPageWirelessSecurity *self, gpointer unused, GError *error, gpoi
 		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);
+			                   &iter, _("WPA & WPA2 Personal"), TRUE);
 			if ((active < 0) && ((default_type == NMU_SEC_WPA_PSK) || (default_type == NMU_SEC_WPA2_PSK)))
 				active = item;
 			item++;
@@ -472,10 +471,6 @@ validate (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 self->adhoc
-	 * and do the right thing.
-	 */
 	mode = nm_setting_wireless_get_mode (s_wireless);
 	if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_ADHOC) == 0)
 		self->adhoc = TRUE;
diff --git a/src/libnm-gtk/nm-wireless-dialog.c b/src/libnm-gtk/nm-wireless-dialog.c
index 885a1c6..ec7c7e2 100644
--- a/src/libnm-gtk/nm-wireless-dialog.c
+++ b/src/libnm-gtk/nm-wireless-dialog.c
@@ -692,8 +692,7 @@ get_default_type_for_security (NMSettingWirelessSecurity *sec,
 		return NMU_SEC_DYNAMIC_WEP;
 	}
 
-	if (   !strcmp (key_mgmt, "wpa-none")
-	    || !strcmp (key_mgmt, "wpa-psk")) {
+	if (!strcmp (key_mgmt, "wpa-psk")) {
 		if (!have_ap || (ap_flags & NM_802_11_AP_FLAGS_PRIVACY)) {
 			if (find_proto (sec, "rsn"))
 				return NMU_SEC_WPA2_PSK;
diff --git a/src/wireless-security/ws-wpa-psk.c b/src/wireless-security/ws-wpa-psk.c
index ceb89e1..02be4ad 100644
--- a/src/wireless-security/ws-wpa-psk.c
+++ b/src/wireless-security/ws-wpa-psk.c
@@ -117,14 +117,13 @@ 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");
+		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");
 
-		/* 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");
+		/* The supplicant only supports CCMP with Ad-hoc RSN;
+		 * Selecting something else will make it use CCMP anyway. */
+		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);
 
@@ -163,7 +162,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;
 
 	widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_entry"));
-- 
1.7.10.4



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