Previously, if the two utility functions were called while the VPN
connection was established (i.e. charon was initialized) the logger for
libstrongswan would get reset to the initial log handler. So certain
log messages would not get logged to the log file after the TUN device
was created (one of the helpers is used to convert IPs there).
exit(1);
}
+/**
+ * Register this logger as default before we have the bus available
+ */
+static void __attribute__ ((constructor))register_logger()
+{
+ dbg = dbg_android;
+}
+
/**
* Initialize charon and the libraries via JNI
*/
struct utsname utsname;
char *logfile, *appdir, *plugins;
- /* logging for library during initialization, as we have no bus yet */
- dbg = dbg_android;
-
/* initialize library */
if (!library_init(NULL, "charon"))
{
char *str;
bool valid;
- dbg = dbg_android;
-
if (!library_init(NULL, "charon"))
{
library_deinit();
host_t *host;
char *str;
- dbg = dbg_android;
-
if (!library_init(NULL, "charon"))
{
library_deinit();