summary refs log tree commit diff
path: root/src/wifi
diff options
context:
space:
mode:
Diffstat (limited to 'src/wifi')
-rw-r--r--src/wifi/wifi-utils-nl80211.c29
-rw-r--r--src/wifi/wifi-utils-wext.c6
2 files changed, 27 insertions, 8 deletions
diff --git a/src/wifi/wifi-utils-nl80211.c b/src/wifi/wifi-utils-nl80211.c
index 5a7103ee..4a2dd937 100644
--- a/src/wifi/wifi-utils-nl80211.c
+++ b/src/wifi/wifi-utils-nl80211.c
@@ -564,6 +564,15 @@ struct nl80211_device_info {
 	gboolean success;
 };
 
+#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
+#define WLAN_CIPHER_SUITE_WEP40     0x000FAC01
+#define WLAN_CIPHER_SUITE_TKIP      0x000FAC02
+#define WLAN_CIPHER_SUITE_CCMP      0x000FAC04
+#define WLAN_CIPHER_SUITE_WEP104    0x000FAC05
+#define WLAN_CIPHER_SUITE_AES_CMAC  0x000FAC06
+#define WLAN_CIPHER_SUITE_GCMP      0x000FAC08
+#define WLAN_CIPHER_SUITE_SMS4      0x00147201
+
 static int nl80211_wiphy_info_handler (struct nl_msg *msg, void *arg)
 {
 	struct nlattr *tb[NL80211_ATTR_MAX + 1];
@@ -674,22 +683,26 @@ static int nl80211_wiphy_info_handler (struct nl_msg *msg, void *arg)
 		num = nla_len (tb[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32);
 		for (i = 0; i < num; i++) {
 			switch (ciphers[i]) {
-			case 0x000fac01:
+			case WLAN_CIPHER_SUITE_WEP40:
 				info->caps |= NM_WIFI_DEVICE_CAP_CIPHER_WEP40;
 				break;
-			case 0x000fac05:
+			case WLAN_CIPHER_SUITE_WEP104:
 				info->caps |= NM_WIFI_DEVICE_CAP_CIPHER_WEP104;
 				break;
-			case 0x000fac02:
+			case WLAN_CIPHER_SUITE_TKIP:
 				info->caps |= NM_WIFI_DEVICE_CAP_CIPHER_TKIP |
 					      NM_WIFI_DEVICE_CAP_WPA;
 				break;
-			case 0x000fac04:
+			case WLAN_CIPHER_SUITE_CCMP:
 				info->caps |= NM_WIFI_DEVICE_CAP_CIPHER_CCMP |
 					      NM_WIFI_DEVICE_CAP_RSN;
 				break;
+			case WLAN_CIPHER_SUITE_AES_CMAC:
+			case WLAN_CIPHER_SUITE_GCMP:
+			case WLAN_CIPHER_SUITE_SMS4:
+				break;
 			default:
-				nm_log_err (LOGD_HW | LOGD_WIFI, "Don't know the meaning of NL80211_ATTR_CIPHER_SUITES %#8.8x.", ciphers[i]);
+				nm_log_dbg (LOGD_HW | LOGD_WIFI, "Don't know the meaning of NL80211_ATTR_CIPHER_SUITE %#8.8x.", ciphers[i]);
 				break;
 			}
 		}
@@ -700,10 +713,10 @@ static int nl80211_wiphy_info_handler (struct nl_msg *msg, void *arg)
 		int i;
 
 		nla_for_each_nested (nl_mode, tb[NL80211_ATTR_SUPPORTED_IFTYPES], i) {
-			if (nla_type (nl_mode) == NL80211_IFTYPE_AP) {
+			if (nla_type (nl_mode) == NL80211_IFTYPE_AP)
 				info->caps |= NM_WIFI_DEVICE_CAP_AP;
-				break;
-			}
+			else if (nla_type (nl_mode) == NL80211_IFTYPE_ADHOC)
+				info->caps |= NM_WIFI_DEVICE_CAP_ADHOC;
 		}
 	}
 
diff --git a/src/wifi/wifi-utils-wext.c b/src/wifi/wifi-utils-wext.c
index 37cd94e9..6e990aed 100644
--- a/src/wifi/wifi-utils-wext.c
+++ b/src/wifi/wifi-utils-wext.c
@@ -556,6 +556,12 @@ wext_get_caps (WifiDataWext *wext, struct iw_range *range)
 		caps &= ~WPA_CAPS;
 	}
 
+	/* There's no way to detect Ad-Hoc/AP mode support with WEXT
+	 * (other than actually trying to do it), so just assume that
+	 * Ad-Hoc is supported and AP isn't.
+	 */
+	caps |= NM_WIFI_DEVICE_CAP_ADHOC;
+
 	return caps;
 }