Commit Graph

1686 Commits

Author SHA1 Message Date
Dimitri John Ledkov 1c7466aa2e resolve: lift limits on search domains count or length
glibc 2.26 lifted restrictions on search domains count or length to
unlimited. This has also been backported to 2.17 in some distributions (RHEL 7
and derivatives). Other softwares may have their own limits for search domains,
but we should not restrict what is written out any more.

https://sourceware.org/legacy-ml/libc-announce/2017/msg00001.html
2020-08-18 10:06:25 +02:00
Lennart Poettering 35afe47abe test: update tests to use new JSON output instead of human readable output 2020-08-12 22:39:43 +02:00
Luca Boccassi b3d133148e core: new feature MountImages
Follows the same pattern and features as RootImage, but allows an
arbitrary mount point under / to be specified by the user, and
multiple values - like BindPaths.

Original implementation by @topimiettinen at:
https://github.com/systemd/systemd/pull/14451
Reworked to use dissect's logic instead of bare libmount() calls
and other review comments.
Thanks Topi for the initial work to come up with and implement
this useful feature.
2020-08-05 21:34:55 +01:00
Elisei Roca 491b736a49 test: adapt TEST-13-NSPAWN-SMOKE for SUSE 2020-08-03 17:41:29 +02:00
Elisei Roca ef8b52c657 test: adapt TEST-21-SYSUSERS for SUSE 2020-08-03 16:32:14 +02:00
Zbigniew Jędrzejewski-Szmek 7e62257219
Merge pull request #16308 from bluca/root_image_options
service: add new RootImageOptions feature
2020-08-03 10:04:36 +02:00
Dan Streetman 825cba0d43 test: convert ubuntu-ci to use deny-list
Follows #16262
2020-08-01 15:36:35 +02:00
Luca Boccassi 18d7370587 service: add new RootImageOptions feature
Allows to specify mount options for RootImage.
In case of multi-partition images, the partition number can be prefixed
followed by colon. Eg:

RootImageOptions=1:ro,dev 2:nosuid nodev

In absence of a partition number, 0 is assumed.
2020-07-29 17:17:32 +01:00
Yu Watanabe 99e015e28c network: rename settings about DHCPv6 Prefix Delegation
Closes #16602.
2020-07-29 05:50:08 +09:00
Yu Watanabe c9d223e803 test-network: add tests for prefix routes 2020-07-29 01:50:54 +09:00
Lennart Poettering d64e32c245 nspawn: rework how /run/host/ is set up
Let's find the right os-release file on the host side, and only mount
the one that matters, i.e. /etc/os-release if it exists and
/usr/lib/os-release otherwise. Use the fixed path /run/host/os-release
for that.

Let's also mount /run/host as a bind mount on itself before we set up
/run/host, and let's mount it MS_RDONLY after we are done, so that it
remains immutable as a whole.
2020-07-23 18:47:38 +02:00
Yu Watanabe 7f8c1e95a5 test-network: add test for duplicated IPv6Token= 2020-07-22 20:26:11 +09:00
Yu Watanabe f91b234077 test-network: drop unnecessary sleep() in NetworkdStateFileTests.test_state_file 2020-07-22 19:55:15 +09:00
Lennart Poettering 63fdaa36c5
Merge pull request #16407 from bluca/verity_reuse
verity: re-use already open devices if the hashes match
2020-07-22 11:36:49 +02:00
Elisei Roca 2aa5a13aa9 test: adapt test-functions for SUSE 2020-07-22 10:42:42 +02:00
Luca Boccassi ac1f3ad05f verity: re-use already open devices if the hashes match
Opening a verity device is an expensive operation. The kernelspace operations
are mostly sequential with a global lock held regardless of which device
is being opened. In userspace jumps in and out of multiple libraries are
required. When signatures are used, there's the additional cryptographic
checks.

We know when two devices are identical: they have the same root hash.
If libcrypsetup returns EEXIST, double check that the hashes are really
the same, and that either both or none have a signature, and if everything
matches simply remount the already open device. The kernel will do
reference counting for us.

In order to quickly and reliably discover if a device is already open,
change the node naming scheme from '/dev/mapper/major:minor-verity' to
'/dev/mapper/$roothash-verity'.

Unfortunately libdevmapper is not 100% reliable, so in some case it
will say that the device already exists and it is active, but in
reality it is not usable. Fallback to an individually-activated
unique device name in those cases for robustness.
2020-07-21 23:42:03 +01:00
Zbigniew Jędrzejewski-Szmek 739b9a4354
Merge pull request #16353 from yuwata/network-dns-sni
resolve, network: more SNI and port number support
2020-07-21 08:06:17 +02:00
Luca Boccassi 08de6f945d test: run systemd-dissect and systemd-run with log level debug in TEST-50-DISSECT 2020-07-21 10:03:10 +09:00
Yu Watanabe 66479677a9 test-network: add tests for DNS= with port number and SNI 2020-07-21 04:08:22 +09:00
Zbigniew Jędrzejewski-Szmek 4c0668bc14
Merge pull request #16478 from bluca/dissect_tests
Expand TEST-50-DISSECT to cover dm-verity features
2020-07-20 12:59:56 +02:00
Luca Boccassi 14f1c47a0c nspawn: mount os-release in two steps to make it read-only
The kernel interface requires setting up read-only bind-mounts in
two steps, the bind first and then a read-only remount.
Fix nspawn-mount, and cover this case in the integration test.

Fixes #16484
2020-07-16 09:59:59 +01:00
Luca Boccassi 2bc148add0 test: exercise RootImage, RootHash and RootVerity in TEST-50-DISSECT
Run with both the single-filesystem image and the GPT image
2020-07-15 19:40:42 +01:00
Luca Boccassi 0f5d24a8b9 test: pre-assemble minimal image for TEST-50-DISSECT at build time
Easier than in the limited VM environment
2020-07-15 19:40:42 +01:00
Luca Boccassi a5f1d665d7 test: exercise systemd-dissect with GPT and verity in TEST-50-DISSECT 2020-07-15 19:35:40 +01:00
Luca Boccassi 6939873412 test: exercise systemd-dissect --mount in TEST-50-DISSECT 2020-07-15 19:35:40 +01:00
Yu Watanabe 571f953934 test-network: wait for addresses are not in tentative state 2020-07-15 17:15:25 +09:00
Yu Watanabe c5fcd8a70a test-network: check assigned address is not tentative state 2020-07-15 17:14:30 +09:00
Yu Watanabe 491b79aeac test-network: set IPv6AcceptRA=no if no dynamic addresses are not required 2020-07-15 17:14:30 +09:00
Filipe Brandenburger 26698337f3 timer: Adjust calendar timers based on monotonic timer instead of realtime
When the RTC time at boot is off in the future by a few days, OnCalendar=
timers will be scheduled based on the time at boot. But if the time has been
adjusted since boot, the timers will end up scheduled way in the future, which
may cause them not to fire as shortly or often as expected.

Update the logic so that the time will be adjusted based on monotonic time.
We do that by calculating the adjusted manager startup realtime from the
monotonic time stored at that time, by comparing that time with the realtime
and monotonic time of the current time.

Added a test case to validate this works as expected. The test case creates a
QEMU virtual machine with the clock 3 days in the future. Then we adjust the
clock back 3 days, and test creating a timer with an OnCalendar= for every 15
minutes. We also check the manager startup timestamp from both `systemd-analyze
dump` and from D-Bus.

Test output without the corresponding code changes that fix the issue:

  Timer elapse outside of the expected 20 minute window.
    next_elapsed=1594686119
    now=1594426921
    time_delta=259198

With the code changes in, the test passes as expected.
2020-07-15 09:23:09 +02:00
Filipe Brandenburger 06bb441102 test: Add "finish" rule to .PHONY 2020-07-15 08:58:46 +02:00
Zbigniew Jędrzejewski-Szmek a18c7865be meson: do not install testdata when -Dinstall-tests=false
Fixes #16447.
2020-07-14 14:57:04 +02:00
gaoyi 0d3a8bc7eb test: add test case for multi matches when use "||"
Signed-off-by: gaoyi <ymuemc@163.com>
2020-07-12 03:27:45 -04:00
Yu Watanabe 5157d719f0
Merge pull request #16411 from ddstreet/bridge_without_carrier_fails
Bridge without carrier fails
2020-07-09 14:01:45 +09:00
Zbigniew Jędrzejewski-Szmek 55aacd502b
Merge pull request #15891 from bluca/host_os_release
Container Interface: expose the host's os-release metadata to nspawn and portable guests
2020-07-08 23:52:13 +02:00
Dan Streetman 001c07cfff test-netowrk: in test_bridge_configure_without_carrier, avoid strange test failures
For some reason the wait-online is failing intermittently; it's unclear
exactly why, but this hopefully avoids the failure for unrelated PR.

This is a workaround (not fix) for #16105
2020-07-08 17:05:03 -04:00
Zbigniew Jędrzejewski-Szmek 48c190822b Merge pull request #16405 from sipraga/master 2020-07-08 22:32:04 +02:00
Dan Streetman 4e3376d43a test-network: don't print networkctl output for passing subtests
This just clutters up the logs.
2020-07-08 16:13:14 -04:00
Frantisek Sumsal 2e7090e94d test: bump the TEST-47 sleeps once again
Several recent failed runs show that the test is still racy in two ways:

1) Sometimes it takes a while before the PID file is created, leading
   to:

```
[   10.950540] testsuite-47.sh[308]: ++ cat /leakedtestpid
[   10.959712] testsuite-47.sh[308]: cat: /leakedtestpid: No such file or directory
[   10.959824] testsuite-47.sh[298]: + leaked_pid=
```

2) Again, sometimes we check the leaked PID before the unit is actually
   stopped, leading to a false negative:

```
[   18.099599] testsuite-47.sh[346]: ++ cat /leakedtestpid
[   18.116462] testsuite-47.sh[333]: + leaked_pid=342
[   18.117101] testsuite-47.sh[333]: + systemctl stop testsuite-47-repro
...
[   20.033907] testsuite-47.sh[333]: + ps -p 342
[   20.080050] testsuite-47.sh[351]:     PID TTY          TIME CMD
[   20.080050] testsuite-47.sh[351]:     342 ?        00:00:00 sleep
[   20.082040] testsuite-47.sh[333]: + exit 42
```
2020-07-08 22:09:55 +02:00
Alvin Šipraga 0d0de133f0 network: add support for MACVLAN source mode
Add support for creating a MACVLAN interface in "source" mode by
specifying Mode=source in the [MACVLAN] section of a .netdev file.

A list of allowed MAC addresses for the corresponding MACVLAN can also
be specified with the SourceMACAddress= option of the [MACVLAN] section.

An example .netdev file:

    [NetDev]
    Name=macvlan0
    Kind=macvlan
    MACAddress=02:DE:AD:BE:EF:00

    [MACVLAN]
    Mode=source
    SourceMACAddress=02:AB:AB:AB:AB:01 02:CD:CD:CD:CD:01
    SourceMACAddress=02:EF:EF:EF:EF:01

The same keys can also be specified in [MACVTAP] for MACVTAP kinds of
interfaces, with the same semantics.
2020-07-08 18:01:52 +02:00
Zbigniew Jędrzejewski-Szmek 9870cfdf7f
Merge pull request #16388 from keszybz/xdg-desktop-fuzz-case
xdg-desktop fuzz case
2020-07-07 19:41:31 +02:00
Zbigniew Jędrzejewski-Szmek d1ca1f7c2a xdg-autostart: avoid quadratic behaviour in strv parsing
The fuzzer test case has a giant line with ";;;;;;;;;;;..." which is turned into
a strv of empty strings. Unfortunately, when pushing each string, strv_push() needs
to walk the whole array, which leads to quadratic behaviour. So let's use
greedy_allocation here and also keep location in the string to avoid iterating.

build/fuzz-xdg-desktop test/fuzz/fuzz-xdg-desktop/oss-fuzz-22812  51.10s user 0.01s system 99% cpu 51.295 total
↓
build/fuzz-xdg-desktop test/fuzz/fuzz-xdg-desktop/oss-fuzz-22812  0.07s user 0.01s system 96% cpu 0.083 total

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22812.

Other minor changes:
- say "was already defined" instead of "defined multiple times" to make it
  clear that we're ignoring this second definition, and not all definitions
  of the key
- unescaping needs to be done also for the last entry
2020-07-07 12:20:43 +02:00
Zbigniew Jędrzejewski-Szmek 9ecf5d9340 fuzz: add test case that should already be resolved 2020-07-07 10:26:28 +02:00
Luca Boccassi cda667722c core: refresh unit cache when building a transaction if UNIT_NOT_FOUND
When a command asks to load a unit directly and it is in state
UNIT_NOT_FOUND, and the cache is outdated, we refresh it and
attempto to load again.
Use the same logic when building up a transaction and a dependency in
UNIT_NOT_FOUND state is encountered.
Update the unit test to exercise this code path.
2020-07-07 10:09:24 +02:00
Susant Sahani 98ebef62c7 DHCPv4: client add support for DHCP server allow list 2020-07-06 22:28:54 +02:00
Vito Caputo e26538dd04 network: tc: fix n_prio bounds check
Looks like a simple copy and paste error

Fixes https://github.com/systemd/systemd/issues/16367
2020-07-06 15:52:17 +02:00
Frantisek Sumsal bf795c47bc test: use KILL instead of SIGKILL in TEST-52-HONORFIRSTSHUTDOWN
SIG-prefixed signals for `kill` are not POSIX compliant, so on Ubuntu CI
(which defaults to dash instead of bash) the TEST-52 contains following
error:

[ 9693.549638] sh[51]: + systemctl poweroff --no-block
[ 9693.553130] systemd-logind[26]: System is powering down.
[ 9693.608911] sh[54]: /bin/sh: 1: kill: Illegal option -S

This can be reproduced manually as well, either by running dash, or bash
in POSIX mode:

$ dash -c 'kill -SIGKILL 123'
dash: 1: kill: Illegal option -S

$ bash --posix -c 'kill -SIGKILL 123'
bash: line 0: kill: SIGKILL: invalid signal specification
2020-07-05 11:00:57 +01:00
Yu Watanabe c03ef420fa network: tc: rename several settings which take size in bytes 2020-07-02 16:51:11 +02:00
Yu Watanabe 3d2c26925f test-network: add tests for SR-IOV
This also adjusts test_sysctl_disable_ipv6(), as rt_trap flag may be
added to routes on some environments.
2020-07-01 13:51:35 +09:00
Yu Watanabe c3a5025dc6 network: add MACAddress= setting in [SR-IOV] section 2020-07-01 13:51:35 +09:00
Yu Watanabe e64b31c848 network: add VLANProtocol= setting in [SR-IOV] section 2020-07-01 13:51:35 +09:00