Commit Graph

77 Commits

Author SHA1 Message Date
Tobias Brunner 4a0b6d659d Add plugin constructor registration for all libraries that provide plugins
Unfortunately, we can't just add the generated C file to the sources in
Makefile.am as the linker would remove that object file when it notices
that no symbol in it is ever referenced.  So we include it in the file
that contains the library initialization, which will definitely be
referenced by the executable.

This allows building an almost stand-alone static version of e.g. charon
when building with `--enable-monolithic --enable-static --disable-shared`
(without `--disable-shared` libtool will only build a version that links
the libraries dynamically).  External libraries (e.g. gmp or openssl) are
not linked statically this way, though.
2017-05-23 18:29:12 +02:00
Tobias Brunner 98b55c8b83 library: Add compile option to disable memwipe() check 2017-05-23 18:29:11 +02:00
Tobias Brunner e9e643b240 leak-detective: Fix compile warning due to unused variable if LD is disabled 2016-09-20 17:24:52 +02:00
Tobias Brunner 4f1c6bc5a6 leak-detective: Optionally write report to a log file 2016-09-20 15:36:09 +02:00
Tobias Brunner 5c8dc908d0 library: Add option to register additional namespaces before calling library_init()
Because settings are already accessed in library_init(), calling
add_fallback() externally after calling library_init() is not ideal.
This way namespaces already serve as fallback while library_init() is
executed and they are also in the correct order so that libstrongswan is
always the last root section.
2016-03-08 10:56:19 +01:00
Shea Levy 5fea45506e library: Allow specifying the path to strongswan.conf in the STRONGSWAN_CONF env var 2014-10-02 14:28:01 +02:00
Martin Willi 9e783f6e89 library: Store the used root strongswan.conf configuration 2014-09-22 13:40:39 +02:00
Martin Willi 46184b07c1 diffie-hellman: Explicitly initialize DH exponent sizes during initialization
To avoid any race conditions when multiple threads call and initialize
diffie_hellman_get_params(), explicitly examine the optimum DH exponent size
during library initialization.

Fixes #655.
2014-08-25 09:43:29 +02:00
Martin Willi 460adb5d09 unit-tests: Seed chunk_hash() only once, but before creating any hashtables
Due to the removal of pthread_once, we manually create the seed for
chunk_hash(). With the new testable functions interface, this won't work for
the hashtable initiated using __attribute__((constructor)). Enforce seeding
before creating that hashtable.
2014-06-04 15:53:11 +02:00
Martin Willi 965e846cc3 library: Change init/deinit order to allow utils to depend on threading 2014-06-04 15:53:01 +02:00
Martin Willi c46cee6f6d chunk: Don't depend on pthread directly 2014-06-04 15:53:00 +02:00
Martin Willi 87a79e6a03 windows: Add utils_init/deinit functions to initialize Winsock2 2014-06-04 15:52:59 +02:00
Tobias Brunner 4b670a20a9 settings: strongswan.conf must be loaded explicitly 2014-05-15 11:28:10 +02:00
Tobias Brunner adc1157487 leak-detective: LEAK_DETECTIVE_DISABLE completely disables LD
If lib->leak_detective is non-null some code parts (e.g. the plugin
loader) assume LD is actually used.
2014-04-03 09:44:26 +02:00
Tobias Brunner b3613c49a2 array: Add fallback for qsort_r using thread-local value
Cygwin for example does not support qsort_r.
2014-02-12 14:34:33 +01:00
Tobias Brunner 8dc6e71632 lib: All settings use configured namespace 2014-02-12 14:34:32 +01:00
Tobias Brunner 7a684aece4 lib: Add default config fallback for configured namespace
All settings in the configured global namespace fall back to libstrongswan.
2014-02-12 14:34:32 +01:00
Tobias Brunner 34d3bfcf14 lib: Add global config namespace 2014-02-12 14:34:31 +01:00
Martin Willi a426851f63 leak-detective: Use callback functions to report leaks and usage information
This is more flexible than printing reports to a FILE.
2013-11-06 10:30:59 +01:00
Martin Willi 2ba276017d stream: create library instance of stream-manager 2013-07-18 16:00:28 +02:00
Martin Willi 32b2a5e04b watcher: add a centralized an generic facility to monitor file descriptors 2013-07-18 16:00:27 +02:00
Tobias Brunner a2eb581781 capabilities: Move global capabilities_t instance to libstrongswan 2013-06-25 17:16:32 +02:00
Martin Willi bc1c92c9e9 Strictly memwipe_check() for magic only in the affected buffer
Passing back the buffer address we memwipe() is not ideal, as it could, in
theory, change the behavior of the compiler and not-optimize memwipe(). But
as checking a larger stack is very difficult for different architectures
and compilers, we do it nonetheless for now.
2013-06-05 15:02:18 +02:00
Martin Willi 9312fbc73d In memwipe_check(), don't put magic on stack when calling do_magic()
Otherwise the magic might be on the stack while checking it.
2013-05-03 14:17:37 +02:00
Martin Willi 1657b4ef26 Dump stack if memwipe() check fails 2013-05-03 11:41:51 +02:00
Martin Willi e6ba688a35 During libstrongswan initialization, check if memwipe() works as expected 2013-04-18 13:05:37 +02:00
Reto Guadagnini b1505b345b Added manager for DNS resolvers 2013-02-19 11:57:21 +01:00
Martin Willi 1e5e1fb685 libstrongswan can be initialized more than once 2012-11-14 10:14:31 +01:00
Tobias Brunner f05b427265 Moved debug.[ch] to utils folder 2012-10-24 16:00:51 +02:00
Tobias Brunner 12642a6831 Moved data structures to new collections subfolder 2012-10-24 16:00:49 +02:00
Tobias Brunner 2e7cc07ecd Moved host_t and host_resolver_t to a new networking subfolder 2012-10-24 15:06:18 +02:00
Tobias Brunner b4f6c39e55 Terminate unused resolver threads after a timeout 2012-10-18 12:26:00 +02:00
Tobias Brunner 292d8f41c3 Resolve hosts by DNS name in separate threads so we can cancel them
getaddrinfo(3) may block a long time so proper termination of the daemon may
block if DNS servers are not reachable.

getaddrinfo(3) is an optional cancellation point in posix threads so it
might still block a shutdown but at least on Android (with the signal based
pthread_cancel implementation) it works, on Linux starter will kill charon
anyway after a while.
2012-10-18 10:57:55 +02:00
Tobias Brunner 4c57c63062 Added possibility to register custom proposal keywords
Keyword lookup and registration are handled via the new lib->proposal object.
2012-09-13 15:44:46 +02:00
Martin Willi 4c6c934635 With --enable-bfd-backtraces, use binutils libbfd to resolve backtraces
The invocation of addr2line to resolve backtrace source locations
is slow and cumbersome. When using libbfd directly, we can eliminate
the overhead of the process invocation. Even better, we can cache
library symbol names, bringing wicked fast lookups. As a neat bonus,
we can resolve static function names.
2012-07-13 13:23:29 +02:00
Tobias Brunner a5951a2861 Make sure the certificate cache is flushed when plugins are unloaded.
This avoids segmentation faults when plugins implementing cert_t are
already unloaded when the cache is flushed during destruction.
2011-12-15 12:20:09 +01:00
Tobias Brunner 8fde0b669b Destroy objects hashtable after plugin_manager.
If plugins are not explicitly unloaded before library_deinit is called
there could have been a segfault because some plugins might unregister
objects during unloading/destruction.
2011-10-26 17:39:12 +02:00
Martin Willi 2ce569cc35 Provide generic object registration by name on libstrongswan 2011-08-08 13:19:02 +02:00
Tobias Brunner 60d62b9e5c Don't install the libraries directly in lib/.
Instead use a subdirectory (prefix/lib/ipsec by default). Also moved the
plugins from libexec to a subdirectory of that dir.
2011-07-05 14:42:14 +02:00
Martin Willi f37e8252a3 Make leak detective public 2011-05-16 15:22:21 +02:00
Tobias Brunner e18556e9e9 Moved scheduler and thread pool to libstrongswan. 2010-09-02 19:04:18 +02:00
Martin Willi da9724e6d0 Renamed key_encod{ing,der}_t and constants, prepare for generic credential encoding 2010-07-13 11:29:35 +02:00
Martin Willi 2ccc02a4fd Moved credential manager to libstrongswan 2010-07-13 10:26:07 +02:00
Martin Willi 5493ffde0b traffic_selector_t is gone into libstrongswan, migrate printf hook registration, too. 2010-06-07 15:06:09 +02:00
Martin Willi 091d178060 Option to skip slow addr2line resolution in leak-detective 2010-05-20 17:37:18 +02:00
Tobias Brunner 8b0e09103b Adding DBG_LIB to all calls of libstrongswan's version of DBG*. 2010-04-06 12:47:40 +02:00
Tobias Brunner 567d3f1463 Attributes moved from libstrongswan to libhydra.
The attribute_manager_t instance is now located on the new hydra object
instead of the lib object.
2010-03-24 18:53:10 +01:00
Tobias Brunner fac3bfa5cd Fixing some includes by replacing <> with "".
I changed only the includes needed to fix the build on Android, which has an utils.h system header file, but we should probably change all the local includes in libstrongswan to "" and relative paths.
2010-03-02 10:38:58 +01:00
Tobias Brunner 4a5a5dd290 Using the thread wrapper in charon, libstrongswan and their plugins. 2009-12-23 17:03:41 +01:00
Andreas Steffen 930443afff moved attribute_manager to libstrongswan 2009-10-13 13:46:27 +02:00