Commit Graph

12 Commits

Author SHA1 Message Date
Tobias Brunner 71dca60c31 settings: Don't allow dots in section/key names anymore
This requires config changes if filelog is used with a path that
contains dots. This path must now be defined in the `path` setting of an
arbitrarily named subsection of `filelog`.  Without that change the
whole strongswan.conf file will fail to load, which some users might
not notice immediately.
2018-09-11 18:30:18 +02:00
Tobias Brunner 35ca6a7b2f settings: Add reference feature
Similar to the `also` keyword in ipsec.conf, the new syntax allows adding
one or more references to other sections, which means all the settings and
subsections defined there are inherited (values may be overridden, even
with an empty value to clear it).

It's important to note that all subsections are inherited, so if this is
used to reference a connection in swanctl.conf all auth rounds and
children are inherited.  There is currently no syntax to limit the
inclusion level or clear inherited sections (but as mentioned, settings
in those inherited sections may be overridden).

Another property is that inherited settings or sections always follow
explicitly defined entries in the current section when they are enumerated.
This is relevant if the order is important (e.g. for auth rounds if `round`
is not specified).

References are evaluated dynamically at runtime, so referring to
sections later in the config file or included via other files is no
problem.

The colon used as separator to reference other sections may be used in
section names by writing :: (e.g. for Windows log file paths).

This is based on a patch originally written in 2016.
2018-06-27 14:19:35 +02:00
Tobias Brunner 1b67166921 Unify format of HSR copyright statements 2018-05-23 16:32:53 +02:00
Tobias Brunner 0dba2690c4 settings: Extend parser so we can parse settings from a string 2015-07-28 13:27:32 +02:00
Tobias Brunner 764960e8b9 settings: Add support for multi-line strings
Unterminated strings are now an error.
2015-07-28 13:27:32 +02:00
Martin Willi 68da3bad57 settings: Use strongswan.conf used during library initialization for reload
Since 4b670a20 we require an explicit strongswan.conf to re-load configurations.
However, the define was missing in the build, breaking SIGHUP based config
reloading.

Fixes #651.
2014-09-22 13:40:39 +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 725c479f8b settings: Add functions to add sections and key/value pairs to a section 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