Load libipsec in Android app.
This commit is contained in:
parent
b70139fbfd
commit
06ed785e5a
|
@ -57,6 +57,7 @@ include $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
|
|||
vstr \
|
||||
openssl \
|
||||
libandroidbridge \
|
||||
strongswan/src/libipsec \
|
||||
strongswan/src/libcharon \
|
||||
strongswan/src/libhydra \
|
||||
strongswan/src/libstrongswan \
|
||||
|
|
|
@ -9,6 +9,7 @@ charonservice.c
|
|||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(libvstr_PATH) \
|
||||
$(strongswan_PATH)/src/libipsec \
|
||||
$(strongswan_PATH)/src/libhydra \
|
||||
$(strongswan_PATH)/src/libcharon \
|
||||
$(strongswan_PATH)/src/libstrongswan
|
||||
|
@ -26,7 +27,7 @@ LOCAL_PRELINK_MODULE := false
|
|||
|
||||
LOCAL_LDLIBS := -llog
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := libstrongswan libhydra libcharon
|
||||
LOCAL_SHARED_LIBRARIES := libstrongswan libhydra libipsec libcharon
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <jni.h>
|
||||
|
||||
#include <hydra.h>
|
||||
#include <ipsec.h>
|
||||
#include <daemon.h>
|
||||
#include <library.h>
|
||||
|
||||
|
@ -88,10 +89,19 @@ JNI_METHOD(CharonVpnService, initializeCharon, void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!libipsec_init())
|
||||
{
|
||||
libipsec_deinit();
|
||||
libhydra_deinit();
|
||||
library_deinit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!libcharon_init("charon") ||
|
||||
!charon->initialize(charon, PLUGINS))
|
||||
{
|
||||
libcharon_deinit();
|
||||
libipsec_deinit();
|
||||
libhydra_deinit();
|
||||
library_deinit();
|
||||
return;
|
||||
|
@ -107,6 +117,7 @@ JNI_METHOD(CharonVpnService, initializeCharon, void)
|
|||
JNI_METHOD(CharonVpnService, deinitializeCharon, void)
|
||||
{
|
||||
libcharon_deinit();
|
||||
libipsec_deinit();
|
||||
libhydra_deinit();
|
||||
library_deinit();
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public class CharonVpnService extends VpnService {
|
|||
System.loadLibrary("strongswan");
|
||||
System.loadLibrary("hydra");
|
||||
System.loadLibrary("charon");
|
||||
System.loadLibrary("ipsec");
|
||||
System.loadLibrary("androidbridge");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue