From patchwork Thu Apr 26 05:36:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Keane, Ben (STRX)" X-Patchwork-Id: 155156 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 371D0B6EEB for ; Thu, 26 Apr 2012 15:36:33 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 06E799C17E; Thu, 26 Apr 2012 01:36:28 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 88Q6zHbAar5R; Thu, 26 Apr 2012 01:36:27 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 642539C180; Thu, 26 Apr 2012 01:36:22 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2A2B09C180 for ; Thu, 26 Apr 2012 01:36:21 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c9BKVLHy7Ii8 for ; Thu, 26 Apr 2012 01:36:16 -0400 (EDT) Received: from mail54.messagelabs.com (mail54.messagelabs.com [216.82.241.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail54.messagelabs.com", Issuer "VeriSign Class 3 International Server CA - G3" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 8563E9C17E for ; Thu, 26 Apr 2012 01:36:16 -0400 (EDT) X-Env-Sender: ben.keane@kaelus.com X-Msg-Ref: server-5.tower-54.messagelabs.com!1335418575!12768777!1 X-Originating-IP: [209.62.144.185] X-StarScan-Version: 6.5.7; banners=kaelus.com,-,- X-VirusChecked: Checked Received: (qmail 22515 invoked from network); 26 Apr 2012 05:36:15 -0000 Received: from vmdfsafh6607?cas4.usi.net (HELO MDS8AEO04.ATTSMITHS.COM) (209.62.144.185) by server-5.tower-54.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 26 Apr 2012 05:36:15 -0000 X-TM-IMSS-Message-ID: <17fa7b2500011ffb@smiths.com> Received: from MDS8AEH02.ATTSMITHS.COM (mds8aeh02.attsmiths.com [10.225.228.12]) by smiths.com ([10.225.228.25]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 AES128-SHA (128/128)) id 17fa7b2500011ffb ; Thu, 26 Apr 2012 01:36:14 -0400 Received: from MDS8AEX12.ATTSMITHS.COM ([::1]) by MDS8AEH02.ATTSMITHS.COM ([::1]) with mapi; Thu, 26 Apr 2012 01:36:15 -0400 From: "Keane, Ben (STRX)" To: "hostap@lists.shmoo.com" Date: Thu, 26 Apr 2012 01:36:13 -0400 Subject: Android branch compiled against Gingerbread Patch Thread-Topic: Android branch compiled against Gingerbread Patch Thread-Index: Ac0jbn3+5DQ/kPmqTDSx1QF/LufyUg== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Hi, I recently grabbed the android-stable-2012-03 branch from http://hostap.epitest.fi/hostap.git I had to modify the source code and Makefile slightly to get it to compile and work with my Gingerbread port (based on rowboat). I would assume that what I have done may not be completely correct, but I hope it is of some use to you. The following is a list of issues (no particular order) 1. My Android uses libnl1.1, so I had to: 1.1 change the location of the headers 1.2 change the Android.mk to link against version 1.1 instead of 2, and 1.3 change the call to genl_ctrl_alloc_cache() as it had changed between the versions 2. hostapd would exit with chown: permission denied error. This patch changes the chown to use AID_WIFI for uid and gid (because under Android it isn't running as root). 3. If I use CONFIG_TLS=internal I had to add includes to libtommath For other gingerbread uses this patch includes mods to android.config which are required to get it working on my system. I hope this helps the community. Signed-hostap: Ben Keane Kind Regards, Ben Keane PROPRIETARY: This e-mail contains proprietary information some or all of which may be legally privileged. It is intended for the recipient only. If an addressing or transmission error has misdirected this e-mail, please notify the authority by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail. diff --git a/hostapd/Android.mk b/hostapd/Android.mk index 8363bd7..989e1f9 100644 --- a/hostapd/Android.mk +++ b/hostapd/Android.mk @@ -38,8 +38,15 @@ INCLUDES += $(LOCAL_PATH)/src INCLUDES += $(LOCAL_PATH)/src/utils INCLUDES += external/openssl/include INCLUDES += frameworks/base/cmds/keystore +ifeq ($(CONFIG_TLS), internal) +INCLUDES += external/dropbear/libtommath +endif ifdef CONFIG_DRIVER_NL80211 +ifdef CONFIG_LIBNL20 INCLUDES += external/libnl-headers +else +INCLUDES += external/libnl/include +endif endif @@ -787,6 +794,10 @@ ifdef CONFIG_ANDROID_LOG L_CFLAGS += -DCONFIG_ANDROID_LOG endif +#ifdef CONFIG_ANDROID +#L_CFLAGS += -DANDROID +#endif + OBJS_c = hostapd_cli.c src/common/wpa_ctrl.c src/utils/os_$(CONFIG_OS).c OBJS_c += src/utils/eloop.c ifdef CONFIG_WPA_TRACE @@ -823,7 +834,14 @@ ifneq ($(BOARD_HOSTAPD_PRIVATE_LIB),) endif LOCAL_SHARED_LIBRARIES := libc libcutils libcrypto libssl ifdef CONFIG_DRIVER_NL80211 +ifdef CONFIG_LIBNL20 LOCAL_STATIC_LIBRARIES += libnl_2 +else +LOCAL_SHARED_LIBRARIES += libnl +endif +endif +ifeq ($(CONFIG_TLS), internal) +LOCAL_STATIC_LIBRARIES := libtommath endif LOCAL_CFLAGS := $(L_CFLAGS) LOCAL_SRC_FILES := $(OBJS) diff --git a/hostapd/android.config b/hostapd/android.config index 8341d4b..4bbf416 100644 --- a/hostapd/android.config +++ b/hostapd/android.config @@ -27,7 +27,7 @@ #LIBNL=/usr/src/libnl #CFLAGS += -I$(LIBNL)/include #LIBS += -L$(LIBNL)/lib -CONFIG_LIBNL20=y +#CONFIG_LIBNL20=y # Driver interface for FreeBSD net80211 layer (e.g., Atheros driver) #CONFIG_DRIVER_BSD=y @@ -55,25 +55,25 @@ CONFIG_LIBNL20=y #CONFIG_IEEE80211W=y # Integrated EAP server -#CONFIG_EAP=y +CONFIG_EAP=y # EAP-MD5 for the integrated EAP server -#CONFIG_EAP_MD5=y +CONFIG_EAP_MD5=y # EAP-TLS for the integrated EAP server -#CONFIG_EAP_TLS=y +CONFIG_EAP_TLS=y # EAP-MSCHAPv2 for the integrated EAP server -#CONFIG_EAP_MSCHAPV2=y +CONFIG_EAP_MSCHAPV2=y # EAP-PEAP for the integrated EAP server -#CONFIG_EAP_PEAP=y +CONFIG_EAP_PEAP=y # EAP-GTC for the integrated EAP server -#CONFIG_EAP_GTC=y +CONFIG_EAP_GTC=y # EAP-TTLS for the integrated EAP server -#CONFIG_EAP_TTLS=y +CONFIG_EAP_TTLS=y # EAP-SIM for the integrated EAP server #CONFIG_EAP_SIM=y @@ -128,7 +128,7 @@ CONFIG_PKCS12=y #CONFIG_RADIUS_SERVER=y # Build IPv6 support for RADIUS operations -CONFIG_IPV6=y +#CONFIG_IPV6=y # IEEE Std 802.11r-2008 (Fast BSS Transition) #CONFIG_IEEE80211R=y @@ -148,6 +148,9 @@ CONFIG_IPV6=y # Add support for writing debug log to Android logcat instead of standard output CONFIG_ANDROID_LOG=y +# Add support for Android in general +CONFIG_ANDROID=y + # Remove support for RADIUS accounting #CONFIG_NO_ACCOUNTING=y diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index b1bafc1..7c9de18 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -34,6 +34,10 @@ #include "config_file.h" #include "ctrl_iface.h" +#ifdef ANDROID +#include +#endif /* ANDROID */ + struct wpa_ctrl_dst { struct wpa_ctrl_dst *next; @@ -848,9 +852,16 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd) } } +#ifdef ANDROID + if (hapd->conf->ctrl_interface_gid_set && + chown(hapd->conf->ctrl_interface, AID_WIFI, + AID_WIFI) < 0) { + +#else if (hapd->conf->ctrl_interface_gid_set && chown(hapd->conf->ctrl_interface, 0, hapd->conf->ctrl_interface_gid) < 0) { +#endif perror("chown[ctrl_interface]"); return -1; } @@ -906,8 +917,14 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd) } } +#ifdef ANDROID + if (hapd->conf->ctrl_interface_gid_set && + chown(fname, AID_WIFI, AID_WIFI) < 0) { + +#else if (hapd->conf->ctrl_interface_gid_set && chown(fname, 0, hapd->conf->ctrl_interface_gid) < 0) { +#endif perror("chown[ctrl_interface/ifname]"); goto fail; } diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 4282905..d8fe238 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -2674,7 +2674,16 @@ static int android_genl_ctrl_resolve(struct nl_handle *handle, struct genl_family *nl80211 = NULL; int id = -1; +#ifdef CONFIG_LIBNL20 if (genl_ctrl_alloc_cache(handle, &cache) < 0) { +#else + /* + * Android Rowboat (libnl-1.1) has a different genl_ctrl_alloc_cache function prototype + */ + cache = genl_ctrl_alloc_cache(handle); + if (cache == NULL) { + +#endif wpa_printf(MSG_ERROR, "nl80211: Failed to allocate generic " "netlink cache"); goto fail;