From 4d11042be9623f74660d930c7bcb82ae6e6fd4df Mon Sep 17 00:00:00 2001 From: MDJ Date: Wed, 25 Jul 2012 13:30:27 +0800 Subject: 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 Ported from jellybean (was Change-Id: I3f72f5e4746ccdd007f647a923d41629afc17d94) http://review.cyanogenmod.org/20317 Signed-off-by: Vishal Mahaveer Signed-off-by: Michael Bestas Change-Id: Ibf95b753d60e47fa2e04d7b703c40851d2a13875 --- hostapd/Android.mk | 4 ++++ hostapd/ctrl_iface.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/hostapd/Android.mk b/hostapd/Android.mk index 2e12012..374911d 100644 --- a/hostapd/Android.mk +++ b/hostapd/Android.mk @@ -43,7 +43,11 @@ endif # Use Android specific directory for control interface sockets L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\" +ifdef USES_TI_MAC80211 +L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/wpa_supplicant\" +else L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/hostapd\" +endif # To force sizeof(enum) = 4 ifeq ($(TARGET_ARCH),arm) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 1b8bede..d2f53f1 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -14,6 +14,10 @@ #include #include +#ifdef USES_TI_MAC80211 +#include +#endif /* USES_TI_MAC80211 */ + #include "utils/common.h" #include "utils/eloop.h" #include "common/version.h" @@ -1015,6 +1019,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 " @@ -1095,6 +1107,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); -- cgit v1.1