android: Use a different set of plugins if BYOD features are enabled
This commit is contained in:
@@ -10,10 +10,11 @@ strongswan_CHARON_PLUGINS := android-log openssl fips-prf random nonce pubkey \
|
|||||||
eap-identity eap-mschapv2 eap-md5 eap-gtc
|
eap-identity eap-mschapv2 eap-md5 eap-gtc
|
||||||
|
|
||||||
ifneq ($(strongswan_USE_BYOD),)
|
ifneq ($(strongswan_USE_BYOD),)
|
||||||
strongswan_CHARON_PLUGINS += eap-ttls eap-tnc tnc-imc tnc-tnccs tnccs-20
|
strongswan_BYOD_PLUGINS := eap-ttls eap-tnc tnc-imc tnc-tnccs tnccs-20
|
||||||
endif
|
endif
|
||||||
|
|
||||||
strongswan_PLUGINS := $(strongswan_CHARON_PLUGINS)
|
strongswan_PLUGINS := $(strongswan_CHARON_PLUGINS) \
|
||||||
|
$(strongswan_BYOD_PLUGINS)
|
||||||
|
|
||||||
include $(LOCAL_PATH)/strongswan/Android.common.mk
|
include $(LOCAL_PATH)/strongswan/Android.common.mk
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ endif
|
|||||||
LOCAL_CFLAGS := $(strongswan_CFLAGS) \
|
LOCAL_CFLAGS := $(strongswan_CFLAGS) \
|
||||||
-DPLUGINS='"$(strongswan_CHARON_PLUGINS)"'
|
-DPLUGINS='"$(strongswan_CHARON_PLUGINS)"'
|
||||||
|
|
||||||
|
ifneq ($(strongswan_USE_BYOD),)
|
||||||
|
LOCAL_CFLAGS += -DPLUGINS_BYOD='"$(strongswan_BYOD_PLUGINS)"'
|
||||||
|
endif
|
||||||
|
|
||||||
LOCAL_MODULE := libandroidbridge
|
LOCAL_MODULE := libandroidbridge
|
||||||
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
@@ -58,5 +62,3 @@ LOCAL_SHARED_LIBRARIES += libimcv libtncif libtnccs libpts
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -507,7 +507,8 @@ static void set_options(char *logfile)
|
|||||||
/**
|
/**
|
||||||
* Initialize the charonservice object
|
* Initialize the charonservice object
|
||||||
*/
|
*/
|
||||||
static void charonservice_init(JNIEnv *env, jobject service, jobject builder)
|
static void charonservice_init(JNIEnv *env, jobject service, jobject builder,
|
||||||
|
jboolean byod)
|
||||||
{
|
{
|
||||||
private_charonservice_t *this;
|
private_charonservice_t *this;
|
||||||
static plugin_feature_t features[] = {
|
static plugin_feature_t features[] = {
|
||||||
@@ -543,6 +544,7 @@ static void charonservice_init(JNIEnv *env, jobject service, jobject builder)
|
|||||||
countof(features), TRUE);
|
countof(features), TRUE);
|
||||||
|
|
||||||
#ifdef USE_BYOD
|
#ifdef USE_BYOD
|
||||||
|
if (byod)
|
||||||
{
|
{
|
||||||
plugin_feature_t byod_features[] = {
|
plugin_feature_t byod_features[] = {
|
||||||
PLUGIN_CALLBACK(imc_android_register, this->vpn_service),
|
PLUGIN_CALLBACK(imc_android_register, this->vpn_service),
|
||||||
@@ -588,11 +590,11 @@ static void segv_handler(int signal)
|
|||||||
* Initialize charon and the libraries via JNI
|
* Initialize charon and the libraries via JNI
|
||||||
*/
|
*/
|
||||||
JNI_METHOD(CharonVpnService, initializeCharon, void,
|
JNI_METHOD(CharonVpnService, initializeCharon, void,
|
||||||
jobject builder, jstring jlogfile)
|
jobject builder, jstring jlogfile, jboolean byod)
|
||||||
{
|
{
|
||||||
struct sigaction action;
|
struct sigaction action;
|
||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
char *logfile;
|
char *logfile, *plugins;
|
||||||
|
|
||||||
/* logging for library during initialization, as we have no bus yet */
|
/* logging for library during initialization, as we have no bus yet */
|
||||||
dbg = dbg_android;
|
dbg = dbg_android;
|
||||||
@@ -635,7 +637,7 @@ JNI_METHOD(CharonVpnService, initializeCharon, void,
|
|||||||
|
|
||||||
charon->load_loggers(charon, NULL, FALSE);
|
charon->load_loggers(charon, NULL, FALSE);
|
||||||
|
|
||||||
charonservice_init(env, this, builder);
|
charonservice_init(env, this, builder, byod);
|
||||||
|
|
||||||
if (uname(&utsname) != 0)
|
if (uname(&utsname) != 0)
|
||||||
{
|
{
|
||||||
@@ -644,7 +646,18 @@ JNI_METHOD(CharonVpnService, initializeCharon, void,
|
|||||||
DBG1(DBG_DMN, "Starting IKE charon daemon (strongSwan "VERSION", %s %s, %s)",
|
DBG1(DBG_DMN, "Starting IKE charon daemon (strongSwan "VERSION", %s %s, %s)",
|
||||||
utsname.sysname, utsname.release, utsname.machine);
|
utsname.sysname, utsname.release, utsname.machine);
|
||||||
|
|
||||||
if (!charon->initialize(charon, PLUGINS))
|
#ifdef PLUGINS_BYOD
|
||||||
|
if (byod)
|
||||||
|
{
|
||||||
|
plugins = PLUGINS " " PLUGINS_BYOD;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
plugins = PLUGINS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!charon->initialize(charon, plugins))
|
||||||
{
|
{
|
||||||
libcharon_deinit();
|
libcharon_deinit();
|
||||||
charonservice_deinit(env);
|
charonservice_deinit(env);
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ public class CharonVpnService extends VpnService implements Runnable
|
|||||||
mIsDisconnecting = false;
|
mIsDisconnecting = false;
|
||||||
|
|
||||||
BuilderAdapter builder = new BuilderAdapter(mCurrentProfile.getName());
|
BuilderAdapter builder = new BuilderAdapter(mCurrentProfile.getName());
|
||||||
initializeCharon(builder, mLogFile);
|
initializeCharon(builder, mLogFile, true);
|
||||||
Log.i(TAG, "charon started");
|
Log.i(TAG, "charon started");
|
||||||
|
|
||||||
initiate(mCurrentProfile.getVpnType().getIdentifier(),
|
initiate(mCurrentProfile.getVpnType().getIdentifier(),
|
||||||
@@ -516,8 +516,9 @@ public class CharonVpnService extends VpnService implements Runnable
|
|||||||
*
|
*
|
||||||
* @param builder BuilderAdapter for this connection
|
* @param builder BuilderAdapter for this connection
|
||||||
* @param logfile absolute path to the logfile
|
* @param logfile absolute path to the logfile
|
||||||
|
* @param boyd enable BYOD features
|
||||||
*/
|
*/
|
||||||
public native void initializeCharon(BuilderAdapter builder, String logfile);
|
public native void initializeCharon(BuilderAdapter builder, String logfile, boolean byod);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deinitialize charon, provided by libandroidbridge.so
|
* Deinitialize charon, provided by libandroidbridge.so
|
||||||
|
|||||||
Reference in New Issue
Block a user