Commit Graph

12798 Commits

Author SHA1 Message Date
Martin Willi 356846db5d child-cfg: Allow passing NULL as proposal to add_proposal()
Making the API consistent to the one of ike_cfg.
2014-05-16 16:01:21 +02:00
Martin Willi 3312c447ef ike-cfg: Allow passing NULL to add_proposal()
This simplifies adding default proposals with constructors potentially
returning NULL.
2014-05-16 16:01:21 +02:00
Martin Willi 8642f8bdb7 proposal: Use an additional "default" constructor specific to AEAD algorithms
This allows a caller to create a separated proposal for supported AEAD
algorithms, as required by RFC 5996.
2014-05-16 16:01:21 +02:00
Martin Willi 0fc4dd429d proposal: Don't include AEAD algorithms in the default proposal
According to RFC 5996 3.3 we should use a separate proposal for AEAD algorithms.
This was not clear in RFC 5282, hence we previously included both AEAD and
non-AEAD algorithms in a single proposal.
2014-05-16 16:01:21 +02:00
Martin Willi 9612db648a Merge branch 'clang-fixes'
Fixes some warnings raised when compiling with clang. Some are cosmetically,
others are worth to fix.

This prepares the Travis build for -Werror, which will force us to fix all
warnings raised by all compilers.
2014-05-16 15:45:41 +02:00
Martin Willi 064fe9c963 enum: Return boolean result for enum_from_name() lookup
Handling the result for enum_from_name() is difficult, as checking for
negative return values requires a cast if the enum type is unsigned. The new
signature clearly differentiates lookup result from lookup value.

Further, this actually allows to convert real -1 enum values, which could not
be distinguished from "not-found" and the -1 return value.

This also fixes several clang warnings where enums are unsigned.
2014-05-16 15:42:07 +02:00
Martin Willi 9ee8b3b41f enum: Don't directly include enum.h
To allow enum.h to depend on utils.h definitions, avoid its direct inclusion.
Instead include utils.h, which includes enum.h as well.
2014-05-16 15:42:07 +02:00
Martin Willi 8584e62368 libtps: Silence GCC set-but-unused warning in incomplete code 2014-05-16 15:42:07 +02:00
Martin Willi ed9bdfee41 scepclient: Cast OID_UNKNOWN before comparing it to unsigned hash_algorithm_t
clang uses unsigned enums and complains about the always-false -1 check.
2014-05-16 15:42:07 +02:00
Martin Willi 78db68cecf swanctl: Properly initialize return value of --install command 2014-05-16 15:42:07 +02:00
Martin Willi f5bbbd480c xauth-pam: Fix header include guard 2014-05-16 15:42:07 +02:00
Martin Willi 2cf5e97dd2 eap-peap: Remove dead SoH code from PEAP
clang complains about the unused variables.
2014-05-16 15:42:07 +02:00
Martin Willi e2bf45a491 tls: Move variable sized tls_record_t struct to end of tls_t data
clang complains about the the non-last variable length member.
2014-05-16 15:42:07 +02:00
Martin Willi 6eff96f543 kernel-klips: Pass a pointer to a properly sized integer for algorithm lookup 2014-05-16 15:42:07 +02:00
Martin Willi e163427d9f auth-cfg: Cast literal default value to pointer type
Fixes a clang warning.
2014-05-16 15:42:07 +02:00
Martin Willi 0746e38c51 unbound: Explicitly cast from ldns RR type/class to our types
These definitions are directly derived from the RFC, so it should be safe
to cast them. clang complains about the different types, so cast them
explicitly.
2014-05-16 15:42:06 +02:00
Martin Willi fb515325cc x509: Remove some unused ASN1 OID constants 2014-05-16 15:42:06 +02:00
Martin Willi d3cf9ca322 aes: Remove unused build variants
The AES code historically has different build options for various size/speed
trade-offs. We never made use of them, so just drop the obsolete code. The code
now has four hard-coded fixed tables, both inverse and original.
2014-05-16 15:42:06 +02:00
Andreas Steffen 0f000cdd6c Minor changes in the test environment 2014-05-15 21:30:42 +02:00
Tobias Brunner ff4a2acbe6 Merge branch 'settings-parser'
Adds a flex/bison based parser for settings_t.  It provides several
improvements over the previous parser e.g. quoted strings (with escape
sequences), unlimited includes, more relaxed newline handling, better
syntax error reporting, and a distinction between empty and unset
values (key = vs. key = "").
2014-05-15 12:15:16 +02:00
Tobias Brunner b3dd0168f1 settings: Properly match } and # in include statements
Found due to %option nodefault.  A match for } was actually missing
and # was not properly matched if it was part of an include statement
on the last line of a file that did not end with a newline.
2014-05-15 12:03:07 +02:00
Tobias Brunner c92d44f2cf settings: Eliminate performance warning
This was useful during development, but we accept that matching \n together
with %option yylineno impacts performance.
2014-05-15 12:03:07 +02:00
Tobias Brunner 5b64c04046 scripts: Add test script for settings_t 2014-05-15 12:03:07 +02:00
Tobias Brunner 4102fc9c09 parser-helper: Define debug macros depending on DEBUG_LEVEL 2014-05-15 11:28:10 +02:00
Tobias Brunner 66248396c6 parser-helper: Make parser_helper_file_t private 2014-05-15 11:28:10 +02:00
Tobias Brunner c976cc7d33 parser-helper: Make parser_helper_log a function 2014-05-15 11:28:10 +02:00
Tobias Brunner 4b670a20a9 settings: strongswan.conf must be loaded explicitly 2014-05-15 11:28:10 +02:00
Tobias Brunner da45f9e994 settings: Replace deprecated YYLEX_PARAM with %lex-param
With Bison 3.x support for YYLEX_PARAM has been removed and %lex-param
should be used.  Unfortunately, that option does not take expressions.
Instead we use a wrapper function that calls the lexer with the proper
scanner object, which should also be backward compatible to older Bison
versions.
2014-05-15 11:28:09 +02:00
Tobias Brunner 813e510d69 settings: Include generated header after others
Newer Bison versions declare the parser function in the header, which
requires custom types.
2014-05-15 11:28:09 +02:00
Tobias Brunner f65ac98c64 settings: Reduce log verbosity if files can't be opened
Basically reintroducing 2a38b4556e.
2014-05-15 11:28:09 +02:00
Tobias Brunner 8b43c9ba34 settings: Adopt the new order of sections and settings when replacing configs 2014-05-15 11:28:09 +02:00
Tobias Brunner 5ac20cbb87 settings: Only purge sections if necessary
Instead of removing and caching all values of a previous config, we only
do this for actually removed sections/settings.
2014-05-15 11:28:08 +02:00
Tobias Brunner b98551c74a coverage: Make genhtml not fail if sources are not found
For some reason the .y and .l files of the settings parser are searched in
the wrong directory.
2014-05-15 11:28:08 +02:00
Tobias Brunner f5dd274ab8 settings: Maintain order of sections and settings while enumerating 2014-05-15 11:28:08 +02:00
Tobias Brunner 2fbbea55c5 settings: Don't overwrite values in-place
This is not thread safe.  If threads are reading from pointers to existing
values they could get a partially updated invalid value.

Refactored assignment to a separate function.
2014-05-15 11:28:08 +02:00
Tobias Brunner 725c479f8b settings: Add functions to add sections and key/value pairs to a section 2014-05-15 11:28:07 +02:00
Tobias Brunner 2fe04fb312 unit-tests: Update settings tests to match new parser
Empty settings are now ignored, strings are supported, newlines are
handled properly (e.g. at the end of files) etc.
2014-05-15 11:28:07 +02:00
Tobias Brunner 3855dc01ec settings: Don't enumerate key/value pairs with NULL value 2014-05-15 11:28:07 +02:00
Tobias Brunner 47a3ed979b settings: Use generated parser instead of our own 2014-05-15 11:28:07 +02:00
Tobias Brunner 073d72cf49 settings: Optionally keep track of removed/replaced values 2014-05-15 11:28:06 +02:00
Tobias Brunner 1f669078ac settings: Add flex/bison based parser for strongswan.conf
This parser features several improvements over the existing one.
For instance, quoted strings (with escape sequences), unlimited includes,
relaxed newline handling (e.g. at the end of files or before/after { and }),
and the difference between empty and unset values (key = vs. key = "").

It also complains a lot more about invalid syntax. The current one accepts
pretty odd stuff (like settings or sections without name) without any
errors or warnings.
2014-05-15 11:28:06 +02:00
Tobias Brunner f99d1f7ba5 settings: Extract section and key/value pair types and helper functions
This allows us to use them in the upcoming parser.
2014-05-15 11:28:06 +02:00
Tobias Brunner 3cb8016f0e parser-helper: Add utility class for flex/bison based parsers 2014-05-15 11:28:06 +02:00
Tobias Brunner 3784633fa5 settings: Use glob enumerator to load included files 2014-05-15 11:28:06 +02:00
Tobias Brunner 96de74b879 enumerator: Add enumerator to enumerate files matching a pattern
This enumerator is a wrapper around glob(3).  If that function is not
supported NULL is returned.  If no files match or an error occurs during
the pattern expansion an error is logged and the enumerator simply returns
no items.

RFC: if GLOB_ERR is not supplied glob returns GLOB_NOMATCH if e.g. the
base directory of the pattern does not exist, which would otherwise
result in an error. This way there is at least a clear error message in
case of a typo.
2014-05-15 11:28:05 +02:00
Tobias Brunner b9b1114ab1 settings: Move to a separate folder 2014-05-15 11:28:05 +02:00
Tobias Brunner 8069b3b14b array: Allocate initial data properly if esize is 0 2014-05-15 11:28:05 +02:00
Martin Willi e20e0a0586 swanctl: Increase default debug level to 1
We initially intended to silence debugging only during thread initialization,
not for swanctl in general.
2014-05-14 16:28:01 +02:00
Martin Willi 80b56fb468 vici: Support the close_action keyword, as we have it documented 2014-05-14 16:26:53 +02:00
Martin Willi cdc42256b0 ikev1: Fix debugging log when remote traffic selector selection fails 2014-05-14 10:01:57 +02:00