From 4e80077cfadb35a1754103214dbaf0060e14ae09 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 27 Aug 2012 16:55:38 -0500 Subject: [PATCH] libnm-util: handle RSN IBSS in AP/connection compatibility checks --- libnm-util/nm-setting-wireless.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libnm-util/nm-setting-wireless.c b/libnm-util/nm-setting-wireless.c index f9ed310898..be64d19af2 100644 --- a/libnm-util/nm-setting-wireless.c +++ b/libnm-util/nm-setting-wireless.c @@ -187,14 +187,21 @@ nm_setting_wireless_ap_security_compatible (NMSettingWireless *s_wireless, if (!strcmp (key_mgmt, "wpa-none")) { if (ap_mode != NM_802_11_MODE_ADHOC) return FALSE; - // FIXME: validate ciphers if the BSSID actually puts WPA/RSN IE in - // it's beacon + /* FIXME: validate ciphers if they're in the beacon */ return TRUE; } - /* Stuff after this point requires infrastructure */ - if (ap_mode != NM_802_11_MODE_INFRA) - return FALSE; + /* Adhoc WPA2 (ie, RSN IBSS) */ + if (ap_mode == NM_802_11_MODE_ADHOC) { + if (strcmp (key_mgmt, "wpa-psk")) + return FALSE; + + /* Ensure the AP has RSN PSK capability */ + if (!(ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_PSK)) + return FALSE; + + /* Fall through and check ciphers in generic WPA-PSK code */ + } /* Dynamic WEP or LEAP */ if (!strcmp (key_mgmt, "ieee8021x")) {