aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMDJ <melodydeejay@gmail.com>2012-07-25 13:30:27 +0800
committertbalden <illespal@gmail.com>2012-07-31 21:50:34 +0200
commitb4230c2143698d310b6bdb1da7011d0f15766da4 (patch)
tree04c3068ce5b801d4c9f3980afb08e7f42f06407c
parent824ef55658a7b79b12725a63a30fdc41506b78d4 (diff)
downloadandroid_external_wpa_supplicant_8-b4230c2143698d310b6bdb1da7011d0f15766da4.tar.gz
android_external_wpa_supplicant_8-b4230c2143698d310b6bdb1da7011d0f15766da4.tar.bz2
android_external_wpa_supplicant_8-b4230c2143698d310b6bdb1da7011d0f15766da4.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.mk6
-rw-r--r--hostapd/ctrl_iface.c16
2 files changed, 22 insertions, 0 deletions
diff --git a/hostapd/Android.mk b/hostapd/Android.mk
index 640e6e01..9ec55d5b 100644
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -33,6 +33,12 @@ L_CFLAGS += -DANDROID_QCOM_PATCH
L_CFLAGS += -DANDROID_P2P
endif
+ifdef USES_TI_MAC80211
+# 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\"
+endif
+
# 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 9d5a67e3..ee431e76 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -14,6 +14,10 @@
#include <sys/stat.h>
#include <stddef.h>
+#ifdef USES_TI_MAC80211
+#include <cutils/sockets.h>
+#endif /* USES_TI_MAC80211 */
+
#include "utils/common.h"
#include "utils/eloop.h"
#include "common/version.h"
@@ -993,6 +997,14 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
if (hapd->conf->ctrl_interface == NULL)
return 0;
+#ifdef USES_TI_MAC80211
+ 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 /* USES_TI_MAC80211 */
+
if (mkdir(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) {
if (errno == EEXIST) {
wpa_printf(MSG_DEBUG, "Using existing control "
@@ -1073,6 +1085,10 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
}
os_free(fname);
+#ifdef USES_TI_MAC80211
+havesock:
+#endif /* USES_TI_MAC80211 */
+
hapd->ctrl_sock = s;
eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
NULL);