summaryrefslogtreecommitdiff
path: root/libnm-core/nm-utils.c
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-08-19 18:04:48 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2019-08-26 10:38:02 +0200
commita205eb4aa41c5e35fb4171f7b7922da488a829dc (patch)
treeeac38532e45b714686a161be8b27f2234e7fcd05 /libnm-core/nm-utils.c
parentc97e0ce30b8b9b118d47d0e02e6ebe7556e9f0c4 (diff)
downloadNetworkManager-a205eb4aa41c5e35fb4171f7b7922da488a829dc.tar.gz
wifi: support WPA2 ad-hoc (ibss-rsn)
If the device supports it, allow usage of WPA2 in ad-hoc networks. Based-on-patch-by: Nicolas Cavallari <cavallar@lri.fr> https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/184
Diffstat (limited to 'libnm-core/nm-utils.c')
-rw-r--r--libnm-core/nm-utils.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index a39b6f87ea..cc701b3546 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -1214,46 +1214,30 @@ nm_utils_security_valid (NMUtilsSecurityType type,
break;
case NMU_SEC_WPA_PSK:
if (adhoc)
- return FALSE; /* FIXME: Kernel WPA Ad-Hoc support is buggy */
+ return FALSE;
if (!(wifi_caps & NM_WIFI_DEVICE_CAP_WPA))
return FALSE;
if (have_ap) {
- /* Ad-Hoc WPA APs won't necessarily have the PSK flag set, and
- * they don't have any pairwise ciphers. */
- if (adhoc) {
- /* coverity[dead_error_line] */
- if ( (ap_wpa & NM_802_11_AP_SEC_GROUP_TKIP)
+ if (ap_wpa & NM_802_11_AP_SEC_KEY_MGMT_PSK) {
+ if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_TKIP)
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP))
return TRUE;
- if ( (ap_wpa & NM_802_11_AP_SEC_GROUP_CCMP)
+ if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_CCMP)
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
return TRUE;
- } else {
- if (ap_wpa & NM_802_11_AP_SEC_KEY_MGMT_PSK) {
- if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_TKIP)
- && (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP))
- return TRUE;
- if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_CCMP)
- && (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
- return TRUE;
- }
}
return FALSE;
}
break;
case NMU_SEC_WPA2_PSK:
- if (adhoc)
- return FALSE; /* FIXME: Kernel WPA Ad-Hoc support is buggy */
if (!(wifi_caps & NM_WIFI_DEVICE_CAP_RSN))
return FALSE;
if (have_ap) {
- /* Ad-Hoc WPA APs won't necessarily have the PSK flag set, and
- * they don't have any pairwise ciphers, nor any RSA flags yet. */
if (adhoc) {
- /* coverity[dead_error_line] */
- if (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP)
- return TRUE;
- if (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP)
+ if (!(wifi_caps & NM_WIFI_DEVICE_CAP_IBSS_RSN))
+ return FALSE;
+ if ( (ap_rsn & NM_802_11_AP_SEC_PAIR_CCMP)
+ && (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
return TRUE;
} else {
if (ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_PSK) {