aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2011-11-30 11:41:55 (GMT)
committerJouni Malinen <j@w1.fi>2011-12-21 11:33:41 (GMT)
commitb088cf82c919a0eca7a5ea1445165f9aeb67cd5e (patch)
tree93f71bb1c22df5e133d0d0b5c445e0add9ad4bba /src
parent653c4893be17d12ef7bc6e941b765c92c1e4a161 (diff)
downloadhostap-b088cf82c919a0eca7a5ea1445165f9aeb67cd5e.zip
hostap-b088cf82c919a0eca7a5ea1445165f9aeb67cd5e.tar.gz
hostap-b088cf82c919a0eca7a5ea1445165f9aeb67cd5e.tar.bz2
Android: nl80211: Work around limited genl_ctrl_resolve()
Android ICS system/core/libnl_2 has very limited genl_ctrl_resolve() implementation that cannot handle names other than nlctrl. Work around that by implementing more complete genl_ctrl_resolve() functionality within driver_nl80211.c for Android builds. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/driver_nl80211.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index bc8b1fc..fc5b624 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2572,6 +2572,42 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
}
+#ifdef ANDROID
+static int android_genl_ctrl_resolve(struct nl_handle *handle,
+ const char *name)
+{
+ /*
+ * Android ICS has very minimal genl_ctrl_resolve() implementation, so
+ * need to work around that.
+ */
+ struct nl_cache *cache = NULL;
+ struct genl_family *nl80211 = NULL;
+ int id = -1;
+
+ if (genl_ctrl_alloc_cache(handle, &cache) < 0) {
+ wpa_printf(MSG_ERROR, "nl80211: Failed to allocate generic "
+ "netlink cache");
+ goto fail;
+ }
+
+ nl80211 = genl_ctrl_search_by_name(cache, name);
+ if (nl80211 == NULL)
+ goto fail;
+
+ id = genl_family_get_id(nl80211);
+
+fail:
+ if (nl80211)
+ genl_family_put(nl80211);
+ if (cache)
+ nl_cache_free(cache);
+
+ return id;
+}
+#define genl_ctrl_resolve android_genl_ctrl_resolve
+#endif /* ANDROID */
+
+
static int wpa_driver_nl80211_init_nl_global(struct nl80211_global *global)
{
int ret;