wifi: check whether driver supports AP mode (nl80211 only)

For future use of wpa_supplicant's lightweight AP mode instead
of using Ad-Hoc for hotspot stuff.
This commit is contained in:
Dan Williams 2011-10-10 01:30:24 -05:00
parent 8faa032a27
commit e9d998835b
3 changed files with 20 additions and 1 deletions

View file

@ -141,6 +141,7 @@ typedef enum {
* @NM_WIFI_DEVICE_CAP_CIPHER_CCMP: device supports AES/CCMP encryption
* @NM_WIFI_DEVICE_CAP_WPA: device supports WPA1 authentication
* @NM_WIFI_DEVICE_CAP_RSN: device supports WPA2/RSN authentication
* @NM_WIFI_DEVICE_CAP_AP: device supports Access Point mode
*
* 802.11 specific device encryption and authentication capabilities.
**/
@ -152,7 +153,8 @@ typedef enum {
NM_WIFI_DEVICE_CAP_CIPHER_TKIP = 0x00000004,
NM_WIFI_DEVICE_CAP_CIPHER_CCMP = 0x00000008,
NM_WIFI_DEVICE_CAP_WPA = 0x00000010,
NM_WIFI_DEVICE_CAP_RSN = 0x00000020
NM_WIFI_DEVICE_CAP_RSN = 0x00000020,
NM_WIFI_DEVICE_CAP_AP = 0x00000040
} NMDeviceWifiCapabilities;

View file

@ -332,6 +332,11 @@ constructor (GType type,
}
priv->capabilities = wifi_utils_get_caps (priv->wifi_data);
if (priv->capabilities & NM_WIFI_DEVICE_CAP_AP) {
nm_log_warn (LOGD_HW | LOGD_WIFI, "(%s): driver supports Access Point (AP) mode",
nm_device_get_iface (NM_DEVICE (self)));
}
/* Connect to the supplicant manager */
priv->supplicant.mgr = nm_supplicant_manager_get ();
g_assert (priv->supplicant.mgr);

View file

@ -630,6 +630,18 @@ static int nl80211_wiphy_info_handler (struct nl_msg *msg, void *arg)
}
}
if (tb[NL80211_ATTR_SUPPORTED_IFTYPES]) {
struct nlattr *nl_mode;
int i;
nla_for_each_nested (nl_mode, tb[NL80211_ATTR_SUPPORTED_IFTYPES], i) {
if (nla_type (nl_mode) == NL80211_IFTYPE_AP) {
info->caps |= NM_WIFI_DEVICE_CAP_AP;
break;
}
}
}
info->success = TRUE;
return NL_SKIP;