aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2013-02-28 23:20:24 +0000
committerChirayu Desai <cdesai@cyanogenmod.org>2013-03-20 17:27:06 +0530
commit4d29f0d12afde09b0f84b8220c5ebeadefde9a8d (patch)
tree4f54de4b14e7a90e498a1d1a424d4dfad1421ffc /wpa_supplicant
parenta526cad2b2713d368003f40c0a23e89c5ec3d4d2 (diff)
downloadexternal_wpa_supplicant_8-4d29f0d12afde09b0f84b8220c5ebeadefde9a8d.zip
external_wpa_supplicant_8-4d29f0d12afde09b0f84b8220c5ebeadefde9a8d.tar.gz
external_wpa_supplicant_8-4d29f0d12afde09b0f84b8220c5ebeadefde9a8d.tar.bz2
Add capability flag for IBSS and get_capabiliy modes
Add a driver capability flag for drivers which support IBSS mode and set it for nl80211 drivers which have set the NL80211_IFTYPE_ADHOC. Add a new option "modes" to "get_capability" which will return "AP" and "IBSS" if the corresponding capability flags are set. Change-Id: I7991ae49b6ac6bc154d4edb0b01af774f4e8522c
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/ctrl_iface.c43
-rw-r--r--wpa_supplicant/wpa_cli.c2
2 files changed, 44 insertions, 1 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index bcf27be..53393d1 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -2432,6 +2432,45 @@ static int ctrl_iface_get_capability_auth_alg(int res, char *strict,
return pos - buf;
}
+static int ctrl_iface_get_capability_modes(int res, char *strict,
+ struct wpa_driver_capa *capa,
+ char *buf, size_t buflen)
+{
+ int ret, first = 1;
+ char *pos, *end;
+ size_t len;
+
+ pos = buf;
+ end = pos + buflen;
+
+ if (res < 0) {
+ if (strict)
+ return 0;
+ len = os_strlcpy(buf, "IBSS AP", buflen);
+ if (len >= buflen)
+ return -1;
+ return len;
+ }
+
+ if (capa->flags & (WPA_DRIVER_FLAGS_IBSS)) {
+ ret = os_snprintf(pos, end - pos, "%sIBSS", first ? "" : " ");
+ if (ret < 0 || ret >= end - pos)
+ return pos - buf;
+ pos += ret;
+ first = 0;
+ }
+
+ if (capa->flags & (WPA_DRIVER_FLAGS_AP)) {
+ ret = os_snprintf(pos, end - pos, "%sAP",
+ first ? "" : " ");
+ if (ret < 0 || ret >= end - pos)
+ return pos - buf;
+ pos += ret;
+ first = 0;
+ }
+
+ return pos - buf;
+}
static int ctrl_iface_get_capability_channels(struct wpa_supplicant *wpa_s,
char *buf, size_t buflen)
@@ -2530,6 +2569,10 @@ static int wpa_supplicant_ctrl_iface_get_capability(
return ctrl_iface_get_capability_auth_alg(res, strict, &capa,
buf, buflen);
+ if (os_strcmp(field, "modes") == 0)
+ return ctrl_iface_get_capability_modes(res, strict, &capa,
+ buf, buflen);
+
if (os_strcmp(field, "channels") == 0)
return ctrl_iface_get_capability_channels(wpa_s, buf, buflen);
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 3986b9b..97e11bb 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -2417,7 +2417,7 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
"<<idx> | <bssid>> = get detailed scan result info" },
{ "get_capability", wpa_cli_cmd_get_capability, NULL,
cli_cmd_flag_none,
- "<eap/pairwise/group/key_mgmt/proto/auth_alg/channels> "
+ "<eap/pairwise/group/key_mgmt/proto/auth_alg/channels/modes> "
"= get capabilies" },
{ "reconfigure", wpa_cli_cmd_reconfigure, NULL,
cli_cmd_flag_none,