Commit Graph

248 Commits

Author SHA1 Message Date
Iwan Timmer 5d67a7ae74 resolved: support for DNS-over-TLS
Add support for DNS-over-TLS using GnuTLS. To reduce latency also TLS False Start and TLS session resumption is supported.
2018-06-11 21:35:58 +02:00
Zbigniew Jędrzejewski-Szmek d28b67d46a meson: also reject shifts that change the sign bit
../src/test/test-sizeof.c: In function ‘main’:
../src/test/test-sizeof.c:70:24: error: result of ‘1 << 31’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Werror=shift-overflow=]
                 X = (1 << 31),
                        ^~
cc1: some warnings being treated as errors

Follow-up for b05ecb8cad.
2018-06-11 17:06:58 +02:00
Zbigniew Jędrzejewski-Szmek b05ecb8cad meson: do not allow bit-shift overflows
The primary motivation is to catch enum values created through a shift that is
too big:

../src/test/test-sizeof.c:26:29: error: left shift count >= width of type [-Werror=shift-count-overflow]
         enum_with_shift = 1 << 32,
                             ^~
cc1: some warnings being treated as errors

The compiler will now reject those.

This is an alternative to #9224.
2018-06-09 12:42:30 -07:00
Zbigniew Jędrzejewski-Szmek d40f5cc498 CODING_STYLE: allow c99-style mixed code and declarations
We already allowed variables to be declared in the middle of a function
(whenever a new scope was opened), so this isn't such a big change. Sometimes
we would open a scope just to work around this prohibition.

But sometimes the code can be much clearer if the variable is declared
somewhere in the middle of a scope, in particular if the declaration is
combined with initialization or acquisition of some resources. So let's allow
this, but keep things in the old style, unless there's a good reason to move
the variable declaration to a different place.
2018-06-07 16:42:34 +02:00
Felipe Sateler f3794366b0 build-sys: Add option to link systemctl statically
Systemctl is special because it is required for many tasks that may need to
be performed when the system is not fully configured and/or partially
broken:

1. Installing/Uninstalling services during OS installs and upgrades
2. Shutting down the system

Therefore reduce the number of dependencies that systemctl pulls in, by
not linking to systemd-shared. This brings a bit of resilience to
systemctl (and its aliases shutdown, reboot, etc), by linking against
less external libraries.

Because this extra resilience comes at a cost of approximately 580 KB
extra space, this is done behind a meson build option.
2018-05-31 16:05:00 +02:00
Zbigniew Jędrzejewski-Szmek a38f7fec44 fuzz-journal-remote: a fuzzer for journal-remote over-the-wire input 2018-05-31 13:04:18 +02:00
Zbigniew Jędrzejewski-Szmek c064d8db40 journal-remote: split out µhttpd support and main() into a separate file
This is in preparation to reusing the RemoteServer in other concepts.
I tried to keep changes to minimum:
- arg_* global variables are now passed as state in RemoteServer
- exported functions get the "journal_remote_" prefix
- some variables are renamed

In particular, there is an ugly global RemoveServer* variable. It was originally
added because µhttpd did not allow state to be passed to the callbacks. I'm not
sure if this has been remediated in µhttpd, but either way, this is not changed
here, the global variable is only renamed for clarity.
2018-05-31 13:04:18 +02:00
Zbigniew Jędrzejewski-Szmek 97d9061563 meson: use a convenience static library for nspawn core
This makes it easier to link the nspawn implementation to the tests.
Right now this just means that nspawn-patch-uid.c is not compiled
twice, which is nice, but results in test-patch-uid being slightly bigger,
which is not nice. But in general, we should use convenience libs to
compile everything just once, as far as possible. Otherwise, once we
start compiling a few files here twice, and a few file there thrice, we
soon end up in a state where we are doing hundreds of extra compilations.
So let's do the "right" thing, even if is might not be more efficient.
2018-05-28 10:40:00 +02:00
Lennart Poettering 61d0578b07 add new portable service framework
This adds a small service "systemd-portabled" and a matching client
"portablectl", which implement the "portable service" concept.

The daemon implements the actual operations, is PolicyKit-enabled and is
activated on demand with exit-on-idle.

Both the daemon and the client are an optional build artifact, enabled
by default rhough.
2018-05-24 17:01:57 +02:00
Yu Watanabe 0297f67e7a
Merge pull request #9036 from keszybz/rpm-macro-cleanup
rpm macro cleanup
2018-05-20 23:20:24 +09:00
Zbigniew Jędrzejewski-Szmek 424e80b4b7 rpm: add macros for common configuration dirs
%_environmnentdir /usr/lib/environment.d
%_modulesloaddir /usr/lib/modules-load.d
%_modprobedir /usr/lib/modprobe.d

This makes installing files there more convenient because people don't need to
construct the path from %_prefix/lib/… .

See https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/GBF5WJLTQVSXMHGYGBF3723ZYCWFBR7C/.
2018-05-19 17:02:59 +02:00
Evegeny Vereshchagin 2f09974f34 meson: use run_target for generating tags with ctags
In https://github.com/systemd/systemd/pull/6561, `run_target`
was changed to `custom_target`, which inadvertently caused
relative paths to be passed to ctags due to
https://github.com/mesonbuild/meson/issues/3589.
The switch to `run_target` causes absolute paths to be
passed again and makes it easier to jump from file to
file, hopefully delaying the need to exit Vim :-)
2018-05-19 15:32:47 +02:00
Zbigniew Jędrzejewski-Szmek d18cb3937b Turn VALGRIND variable into a meson configuration switch
Configuration through environment variable is inconvenient with meson, because
they cannot be convieniently changed and/or are not preserved during
reconfiguration (https://github.com/mesonbuild/meson/issues/1503).
This adds -Dvalgrind=true/false, which has the advantage that it can be set
at any time with meson configure -Dvalgrind=... and ninja will rebuild targets
as necessary. Additional minor advantages are better consistency with the
options for hashmap debugging, and typo avoidance with '#if' instead of '#ifdef'.
2018-05-17 09:54:36 -07:00
Yu Watanabe ad7aa76061 meson: use array type option
Array type option is supported since 0.44.0.
2018-05-10 15:31:00 +09:00
Yu Watanabe 8ea9fad715 meson: use warning() method
This bumps the required minimum version of meson to 0.44, as
`warning()` method is supported since 0.44.
2018-05-10 15:30:56 +09:00
Yu Watanabe 30a4ddff7f meson: use get_supported_arguments()
This bumps the required minimum version of meson to 0.43, as
`get_supported_arguments()` is supported since meson-0.43.
2018-05-10 15:30:42 +09:00
Zbigniew Jędrzejewski-Szmek f5ce2e764f
Merge pull request #8689 from davide125/static
meson: add support for building static libsystemd and libudev
2018-05-10 00:39:36 +02:00
Zbigniew Jędrzejewski-Szmek 975464e0d4 meson: recompile all sources for install_libudev_static and install_libsystemd_static
This means that when those targets are built, all the sources are built again,
instead of reusing the work done to create libbasic.a and other convenience static
libraries. It would be nice to not do this, but there seems to be no support in
our toolchain for joining multiple static libraries into one. When linking
a static library, any -l arguments are simply ignored by ar/gcc-ar, and .a
libraries given as positional arguments are copied verbatim into the archive
so they objects in them cannot be accessed.

https://stackoverflow.com/questions/2157629/linking-static-libraries-to-other-static-libraries
suggests either unzipping all the archives and putting them back togather,
or using a linker script. Unzipping and zipping back together seems ugly.
The other option is not very nice. The linker script language does not
allow "+" to appear in the filenames, and filenames that meson generates
use that, so files would have to be renamed before a linker script was used.
And we would have to generate the linker script on the fly. Either way, this
doesn't seem attractive. Since those static libraries are a niche use case,
it seems reasonable to just go with the easiest and safest solution and
recompile all the source files. Thanks to ccache, this is probably almost as
cheap as actually reusing the convenience .a libraries.

test-libsystemd-sym.c and test-libudev-sym.c compile fine with the generated
static libs, so it seems that they indeed provide all the symbols they should.
2018-05-08 17:33:04 +02:00
Davide Cavalca 20f3d32d8d meson: only build test-lib{systemd,udev}-static-sym for pic 2018-05-08 17:33:04 +02:00
Zbigniew Jędrzejewski-Szmek 0632b4cd36 meson: add test-lib{systemd,udev}-static-sym
This is the same as test-lib{systemd,udev}-sym, but linked to the static
variants of those libraries.
2018-05-08 17:33:04 +02:00
Davide Cavalca 70848ecfc6 meson: add support for building static libsystemd and libudev 2018-05-08 17:33:04 +02:00
Yu Watanabe 348b44372f meson: generate m4 preprocessor from config.h (#8914) 2018-05-07 11:17:35 +02:00
Yu Watanabe 6129ec852e timedatectl: add timesync-status and show-timesync commands
Closes #1589.
2018-05-03 18:07:43 +09:00
Yu Watanabe b0903bb585 meson: drop 'name' argument in cc.has_argument() (#8878) 2018-05-02 10:05:51 +02:00
Lennart Poettering 385f3a0d8d
Merge pull request #7599 from keszybz/slice-templates
Make user@.service independent of logind
2018-04-26 21:39:05 +02:00
Yu Watanabe 8ac42236b0 meson: drop 'name' argument in cc.has_argument() (#8823)
This fixes the following warning with clang and meson-0.46.0,
```
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
Compiler for C supports arguments -Wno-typedef-redefinition: YES
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
Compiler for C supports arguments -Wno-gnu-variable-sized-type-not-at-end: YES
```
2018-04-26 10:53:10 +02:00
Zbigniew Jędrzejewski-Szmek a9f0f5e501 logind: split %t directory creation to a helper unit
Unfortunately this needs a new binary to do the mount because there's just
too many special steps to outsource this to systemd-mount:
- EPERM needs to be treated specially
- UserRuntimeDir= setting must be obeyed
- SELinux label must be adjusted

This allows user@.service to be started independently of logind.
So 'systemctl start user@nnn' will start the user manager for user nnn.
Logind will start it too when the user logs in, and will stop it (unless
lingering is enabled) when the user logs out.

Fixes #7339.
2018-04-25 16:20:28 +02:00
Yu Watanabe c2e84cab3a resolvectl: rename systemd-resolve to resolvectl
For the compatibility, `systemd-resolve` will be created as a symbolic
link to `resolvectl`.
2018-04-19 03:24:23 +09:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Filipe Brandenburger add384dd4d units: use `systemctl exit` to kill the user manager (#8648)
Use `systemctl --user --force exit` to implement the systemd-exit
user service.

This removes our dependence on an external `kill` binary and the
concerns about whether they recognize SIGRTMIN+n by name or what their
interpretation of SIGRTMIN is.

Tested: `systemctl --user start systemd-exit.service` kills the
  `systemd --user` instance for my user.
2018-04-04 11:14:37 +02:00
Lennart Poettering 2d684e65aa doc: merge docs/ dir → doc/
It's weird having two subdirs for documentation, let's unify this in
one.
2018-03-28 09:38:30 -07:00
Zbigniew Jędrzejewski-Szmek b1ffacb631 tests: skip udev-test when perl is not installed 2018-03-22 15:57:56 +01:00
Peter A. Bigot 5c3376efcd time-sync-wait: add service (#8494)
This one-shot service waits until the kernel time has been set to
synchronized.
2018-03-21 12:42:04 +01:00
Lennart Poettering 8c637fe242
Merge pull request #8452 from keszybz/use-libmount-more
Use libmount in systemd-shutdown, add tests
2018-03-20 09:53:34 +01:00
Yu Watanabe bcabcde5d2
Merge pull request #8408 from keszybz/ln-relative
bugs.fd.o bug archelogy
2018-03-19 18:32:30 +09:00
Zbigniew Jędrzejewski-Szmek 95b862b054 shutdown: use libmount to enumerate /proc/self/mountinfo
This is analogous to 8d3ae2bd4c, except that now
src/core/umount.c not src/core/mount.c is converted.

Might help with https://bugzilla.redhat.com/show_bug.cgi?id=1554943, or not.

In the patch, mnt_free_tablep and mnt_free_iterp are declared twice. It'd
be nicer to define them just once in mount-setup.h, but then libmount.h would
have to be included there. libmount.h seems to be buggy, and declares some
defines which break other headers, and working around this is more pain than
the two duplicate lines. So let's live with the duplication for now.

This fixes memleak of MountPoint in mount_points_list_get() on error, not that
it matters any.
2018-03-16 10:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 52d4d1d339 test: run all fuzz regression tests with all sanitizers
We currently have just one sanitizer for tests, asan, but we may add more in
the future. So let's keep the loop over the sanitizers in meson.build, but
just enable all regression cases under all sanitizers. If it fails under one
of them, it might fail under a different one.

In subsequent commits I'll add test cases which might not fail under asan,
but it's good to commit them for future use.

The test names are made more verbose:
256/257 fuzz-dns-packet:oss-fuzz-5465:address   OK       0.04 s
257/257 fuzz-dns-packet:issue-7888:address      OK       0.03 s
2018-03-14 14:27:04 +01:00
Zbigniew Jędrzejewski-Szmek 99eae076eb
Merge pull request #8296 from poettering/resolvconf
resolvconf(8) compat interface
2018-03-12 17:27:39 +01:00
Zbigniew Jędrzejewski-Szmek 6fed2cc41f
Merge pull request #8412 from keszybz/meson-warning-fixes
Meson warning fixes
2018-03-09 20:12:37 +01:00
Michal Koutný c7f7e859f0 man: Correct value of default KillUserProcesses= 2018-03-09 18:29:25 +01:00
Michal Koutný 7f672e865a man: Unify values of boolean configuration values with sample config 2018-03-09 18:29:05 +01:00
Zbigniew Jędrzejewski-Szmek c0b4b0f8f5 meson: libmount is required for oss-fuzz builds now too
See https://github.com/google/oss-fuzz/issues/1191.
2018-03-09 14:58:47 +01:00
Zbigniew Jędrzejewski-Szmek af4d7860c4 meson: avoid warning about comparison of bool and string
meson.build:2907: WARNING: Trying to compare values of different types (bool, str) using ==.
The result of this is undefined and will become a hard error in a future Meson release.
2018-03-09 14:21:08 +01:00
Zbigniew Jędrzejewski-Szmek cd001016a1 meson: add note about coreutils version with ln --relative
https://bugs.freedesktop.org/show_bug.cgi?id=90799
2018-03-09 10:31:10 +01:00
Zbigniew Jędrzejewski-Szmek ad6a085310 meson: bump so revision and systemd version in preparation for v238 2018-03-05 17:21:09 +01:00
Lennart Poettering 088c136384 resolve-tool: provide resolvconf(8) compatibility
This turns resolve-tool into a multi-call binary. When invoked as
"resolvconf" it provides minimal compatibility with the resolvconf(8)
tool of various distributions (and FreeBSD as it appears).

This new interface understands to varying degrees features of the two
major implementations of resolvconf(8): Debian's original one and
"openresolv". Specifically:

Fully supported:

        -a -d (supported by all implementations)
        -f    (introduced by openresolv)

Somewhat supported:

        -x    (introduced by openresolv, mapped to a '~.' domain entry)

Unsupported and ignored:

        -m -p (introduced by openresolv, not really necessary for us)

Unsupported and resulting in failure:
        -u    (supported by all other implementations)
        -I -i -l -R -r -v -V
              (all introduced by openresolv)
        --enable-updates --disable-updates --updates-are-enabled
              (specific to Debian's implementation)

Of course, resolvconf(8) is a tool with multiple backends, in our
implementation systemd-resolved is the only backend.

Fixes: #7202
2018-03-02 15:48:46 +01:00
Zbigniew Jędrzejewski-Szmek 3cca71c456
Merge pull request #8323 from xyproto/ok_color
Make the color of the status OK configurable at build-time
2018-03-02 13:00:07 +01:00
Zbigniew Jędrzejewski-Szmek f7c5427c28 meson: use dashes in colour names 2018-03-02 09:09:29 +01:00
Alexander F Rødseth 96164a3936 Add build-time option to change the color of the "OK" status text 2018-03-02 09:00:44 +01:00
Zbigniew Jędrzejewski-Szmek 671f0f8de0 Remove /sbin from paths if split-bin is false (#8324)
Follow-up for 157baa87e4.
2018-03-01 21:48:36 +01:00