summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2014-10-13 11:02:44 +0200
committerLubomir Rintel <lkundrak@v3.sk>2014-10-23 18:34:39 +0200
commit3a6c618a4a9459462115740652bffcfd62f98011 (patch)
tree68f6da917540d5ea23f090968240582c53278029
parent0bc11cb7301972f771d85e5fc1737187d7453697 (diff)
downloadNetworkManager-3a6c618a4a9459462115740652bffcfd62f98011.tar.gz
wifi: Use SSID from connection also if AP is not configured
Creating a mode=ap connection (as GNOME control center does) would otherwise assert in complete_connection despite having a proper SSID set: NetworkManager-wifi:ERROR:nm-device-wifi.c:1118:complete_connection: assertion failed: (ssid) Aborted
-rw-r--r--src/devices/wifi/nm-device-wifi.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 6617f4a69e..fc03826745 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -1046,35 +1046,37 @@ complete_connection (NMDevice *device,
nm_connection_add_setting (connection, NM_SETTING (s_wifi));
}
- if (ap) {
+ if (ap)
ssid = nm_ap_get_ssid (ap);
-
- if (ssid == NULL) {
- /* The AP must be hidden. Connecting to a WiFi AP requires the SSID
- * as part of the initial handshake, so check the connection details
- * for the SSID. The AP object will still be used for encryption
- * settings and such.
- */
- setting_ssid = nm_setting_wireless_get_ssid (s_wifi);
- if (setting_ssid) {
- ssid = tmp_ssid = g_byte_array_new ();
- g_byte_array_append (tmp_ssid,
- g_bytes_get_data (setting_ssid, NULL),
- g_bytes_get_size (setting_ssid));
- }
+ if (ssid == NULL) {
+ /* The AP must be hidden. Connecting to a WiFi AP requires the SSID
+ * as part of the initial handshake, so check the connection details
+ * for the SSID. The AP object will still be used for encryption
+ * settings and such.
+ */
+ setting_ssid = nm_setting_wireless_get_ssid (s_wifi);
+ if (setting_ssid) {
+ ssid = tmp_ssid = g_byte_array_new ();
+ g_byte_array_append (tmp_ssid,
+ g_bytes_get_data (setting_ssid, NULL),
+ g_bytes_get_size (setting_ssid));
}
+ }
- if (ssid == NULL) {
- /* If there's no SSID on the AP itself, and no SSID in the
- * connection data, then we cannot connect at all. Return an error.
- */
- g_set_error_literal (error,
- NM_DEVICE_ERROR,
- NM_DEVICE_ERROR_INVALID_CONNECTION,
- "A 'wireless' setting with a valid SSID is required for hidden access points.");
- return FALSE;
- }
+ if (ssid == NULL) {
+ /* If there's no SSID on the AP itself, and no SSID in the
+ * connection data, then we cannot connect at all. Return an error.
+ */
+ g_set_error_literal (error,
+ NM_DEVICE_ERROR,
+ NM_DEVICE_ERROR_INVALID_CONNECTION,
+ ap
+ ? "A 'wireless' setting with a valid SSID is required for hidden access points."
+ : "Cannot create 'wireless' setting due to missing SSID.");
+ return FALSE;
+ }
+ if (ap) {
/* If the SSID is a well-known SSID, lock the connection to the AP's
* specific BSSID so NM doesn't autoconnect to some random wifi net.
*/
@@ -1103,7 +1105,6 @@ complete_connection (NMDevice *device,
return FALSE;
}
- g_assert (ssid);
str_ssid = nm_utils_ssid_to_utf8 (ssid->data, ssid->len);
nm_utils_complete_generic (connection,