Merge branch 'android-ndk'
This branch comes with some preliminary changes for the user-land IPsec implementation and the Android App. One important change is that the UDP ports used by the socket-default plugin were made configurable (either via ./configure or strongswan.conf). Also, the plugin does randomly allocate a port if it is configured to 0, which is useful for client implementations. A consequence of these changes is that the local UDP port used when creating ike_cfg_t objects has to be fetched from the socket.
This commit is contained in:
@@ -58,7 +58,7 @@ LOCAL_SRC_FILES += $(call add_plugin, nonce)
|
||||
|
||||
LOCAL_SRC_FILES += $(call add_plugin, openssl)
|
||||
ifneq ($(call plugin_enabled, openssl),)
|
||||
LOCAL_C_INCLUDES += external/openssl/include
|
||||
LOCAL_C_INCLUDES += $(openssl_PATH)
|
||||
LOCAL_SHARED_LIBRARIES += libcrypto
|
||||
endif
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ ENUM(debug_names, DBG_DMN, DBG_LIB,
|
||||
"PTS",
|
||||
"TLS",
|
||||
"APP",
|
||||
"ESP",
|
||||
"LIB",
|
||||
);
|
||||
|
||||
@@ -54,6 +55,7 @@ ENUM(debug_lower_names, DBG_DMN, DBG_LIB,
|
||||
"pts",
|
||||
"tls",
|
||||
"app",
|
||||
"esp",
|
||||
"lib",
|
||||
);
|
||||
|
||||
|
||||
@@ -64,6 +64,8 @@ enum debug_t {
|
||||
DBG_TLS,
|
||||
/** applications other than daemons */
|
||||
DBG_APP,
|
||||
/** libipsec */
|
||||
DBG_ESP,
|
||||
/** libstrongswan */
|
||||
DBG_LIB,
|
||||
/** number of groups */
|
||||
|
||||
@@ -250,8 +250,11 @@ static bool load_plugin(private_plugin_loader_t *this, char *name, char *file,
|
||||
this->plugins->insert_last(this->plugins, entry);
|
||||
return TRUE;
|
||||
case NOT_FOUND:
|
||||
/* try to load the plugin from a file */
|
||||
break;
|
||||
if (file)
|
||||
{ /* try to load the plugin from a file */
|
||||
break;
|
||||
}
|
||||
/* fall-through */
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
@@ -651,16 +654,18 @@ METHOD(plugin_loader_t, load_plugins, bool,
|
||||
char *token;
|
||||
bool critical_failed = FALSE;
|
||||
|
||||
#ifdef PLUGINDIR
|
||||
if (path == NULL)
|
||||
{
|
||||
path = PLUGINDIR;
|
||||
}
|
||||
#endif /* PLUGINDIR */
|
||||
|
||||
enumerator = enumerator_create_token(list, " ", " ");
|
||||
while (!critical_failed && enumerator->enumerate(enumerator, &token))
|
||||
{
|
||||
bool critical = FALSE;
|
||||
char file[PATH_MAX];
|
||||
char buf[PATH_MAX], *file = NULL;
|
||||
int len;
|
||||
|
||||
token = strdup(token);
|
||||
@@ -675,10 +680,14 @@ METHOD(plugin_loader_t, load_plugins, bool,
|
||||
free(token);
|
||||
continue;
|
||||
}
|
||||
if (snprintf(file, sizeof(file), "%s/libstrongswan-%s.so",
|
||||
path, token) >= sizeof(file))
|
||||
if (path)
|
||||
{
|
||||
return FALSE;
|
||||
if (snprintf(buf, sizeof(buf), "%s/libstrongswan-%s.so",
|
||||
path, token) >= sizeof(buf))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
file = buf;
|
||||
}
|
||||
if (!load_plugin(this, token, file, critical) && critical)
|
||||
{
|
||||
|
||||
@@ -1117,14 +1117,21 @@ static bool load_files_internal(private_settings_t *this, section_t *parent,
|
||||
char *pattern, bool merge)
|
||||
{
|
||||
char *text;
|
||||
linked_list_t *contents = linked_list_create();
|
||||
section_t *section = section_create(NULL);
|
||||
linked_list_t *contents;
|
||||
section_t *section;
|
||||
|
||||
if (pattern == NULL)
|
||||
{
|
||||
#ifdef STRONGSWAN_CONF
|
||||
pattern = STRONGSWAN_CONF;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
contents = linked_list_create();
|
||||
section = section_create(NULL);
|
||||
|
||||
if (!parse_files(contents, NULL, 0, pattern, section))
|
||||
{
|
||||
contents->destroy_function(contents, (void*)free);
|
||||
|
||||
Reference in New Issue
Block a user