aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishal Mahaveer <a0271468@ti.com>2011-08-19 09:45:41 -0600
committerKeith Deacon <kdeacon@ti.com>2011-11-15 20:45:49 -0600
commitdded76108ed8fceb12b37310dbe83e48c44eada4 (patch)
tree8f01f24ed2afa3d18937589802ea46666c288cd7
parent648b7492d15bb4efaeebdfdd8bd261563a5f6227 (diff)
downloadandroid_external_wpa_supplicant_8-dded76108ed8fceb12b37310dbe83e48c44eada4.tar.gz
android_external_wpa_supplicant_8-dded76108ed8fceb12b37310dbe83e48c44eada4.tar.bz2
android_external_wpa_supplicant_8-dded76108ed8fceb12b37310dbe83e48c44eada4.zip
wpa_supplicant_8 - Hostapd: Android related changes for sockets
Android related changes for socket handling. Similar to ctrl_iface.c in wpa_supplicant/ctrl_iface.c Change-Id: I3f72f5e4746ccdd007f647a923d41629afc17d94 Signed-off-by: Vishal Mahaveer <a0271468@ti.com>
-rw-r--r--hostapd/Android.mk4
-rw-r--r--hostapd/ctrl_iface.c13
2 files changed, 17 insertions, 0 deletions
diff --git a/hostapd/Android.mk b/hostapd/Android.mk
index 403375f0..3812b4ea 100644
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -20,6 +20,10 @@ ifdef CONFIG_DRIVER_NL80211
L_CFLAGS += -DANDROID_BRCM_P2P_PATCH
endif
+# Use Android specific directory for control interface sockets
+L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"
+L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/wpa_supplicant\"
+
# To force sizeof(enum) = 4
ifeq ($(TARGET_ARCH),arm)
L_CFLAGS += -mabi=aapcs-linux
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 195b8a73..b4ac1e41 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -20,6 +20,10 @@
#include <sys/stat.h>
#include <stddef.h>
+#ifdef ANDROID
+#include <cutils/sockets.h>
+#endif /* ANDROID */
+
#include "utils/common.h"
#include "utils/eloop.h"
#include "common/version.h"
@@ -944,6 +948,14 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
if (hapd->conf->ctrl_interface == NULL)
return 0;
+#ifdef ANDROID
+ os_snprintf(addr.sun_path, sizeof(addr.sun_path), "wpa_%s",
+ hapd->conf->ctrl_interface);
+ s = android_get_control_socket(addr.sun_path);
+ if (s >= 0)
+ goto havesock;
+#endif /* ANDROID */
+
if (mkdir(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) {
if (errno == EEXIST) {
wpa_printf(MSG_DEBUG, "Using existing control "
@@ -1024,6 +1036,7 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
}
os_free(fname);
+havesock:
hapd->ctrl_sock = s;
eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
NULL);