Commit Graph

1875 Commits

Author SHA1 Message Date
Yu Watanabe 43d4bc9f56 test-network: add tests for routes managed by Manager 2020-10-23 23:07:12 +09:00
Zbigniew Jędrzejewski-Szmek 15a6c4bf8b
Merge pull request #17417 from anitazha/more_systoomd
More systemd-oomd tweaks
2020-10-23 13:06:51 +02:00
Yu Watanabe 9c914c0401
Merge pull request #17357 from yuwata/network-dhcp6-pd-announce-17353
network: add an option to control announcement of delegated prefix
2020-10-23 12:57:58 +09:00
Anita Zhang e4ff80404a test: add basic memory pressure extended test for oomd
Simple test to generate a lot of pressure in one unit and assert that
systemd-oomd kills the right one.
2020-10-22 17:04:22 -07:00
Zbigniew Jędrzejewski-Szmek 4cce6f2524 test-path: start infinite sleep instead of a short command
The test sometimes fails, e.g. in bionic-s390x ci. I think it might be because
the service binary exits before we get a chance to notice that it is running:
13:59:31 --- Listing only the last 100 lines from a long log. ---
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4639845)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4539608)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4439376)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4338946)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4238702)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4138424)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4038116)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3937835)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3837553)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3737250)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3636934)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3536622)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3436318)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3336021)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3235730)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3135468)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3035158)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2934855)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2834541)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2732511)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2632255)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2532014)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2431746)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2331438)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2231213)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2130952)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2030663)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1930428)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1830172)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1729906)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1629652)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1529368)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1429110)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1328852)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1228593)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1128320)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1028083)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 927824)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 827564)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 724935)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 624664)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 524411)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 424124)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 323853)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 223585)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 120356)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 18053)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: -82385)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 Test timeout when testing path-unit.path

It seems test/test-path/path-service.service wasn't actually used for anything.
2020-10-22 11:05:17 +02:00
Zbigniew Jędrzejewski-Szmek 28c48f4d78 tests: replace the few remaining Type=simple with Type=exec
Except for the places where we explicitly want to test Type=simple,
we should use Type=exec.
2020-10-22 11:05:17 +02:00
Zbigniew Jędrzejewski-Szmek 333d102c64 test-path: use Type=exec
In general, Type=exec is superior to Type=simple. Let's not assume that
the service is started before it was really started.
2020-10-22 11:05:17 +02:00
Zbigniew Jędrzejewski-Szmek 515736d0f3 tree-wide: update web link to logind description
https://www.freedesktop.org/wiki/Software/systemd/multiseat/ says that it
is obsoleted by sd-login(3), so it doesn't make much sense to link to the former.
2020-10-19 15:23:37 +02:00
Yu Watanabe 610e747748 test-network: use new IPv6SendRA= setting 2020-10-19 14:55:21 +09:00
Yu Watanabe 99e1ab06b4 fuzz: move DNSDefaultRoute= setting to [Network] section 2020-10-19 14:55:21 +09:00
Yu Watanabe 27ff0490e6 network: rename IPv6PrefixDelegation= to IPv6SendRA= 2020-10-19 14:55:18 +09:00
Yu Watanabe 4afd986753 network: introduce Announce= in [DHCPv6PrefixDelegation]
When disabled, the delegated prefixes are not emit by RA.

Closes #17353.
2020-10-19 12:09:36 +09:00
Yu Watanabe e502f94dcf network: introduce DHCPv6PrefixDelegation= setting
Then, the link can configure prefix delegated by DHCPv6 without emitting
RA.
2020-10-19 10:09:38 +09:00
Luca Boccassi 9198752738 test: account for non-x86-64 archs in TEST-50-DISSECT 2020-10-18 15:41:34 +01:00
Luca Boccassi 7580a64766 test: increase size of verity partition in TEST-50-DISSECT GPT image
On Ubuntu it seems there's some padding added
2020-10-18 11:44:18 +01:00
Luca Boccassi 964523e6c2 test/README: notes about Ubuntu CI logs and dependencies
Add a note about where to find the full journal, and how to add
packages/dependencies for the Ubuntu CI.
2020-10-17 17:58:40 +01:00
Luca Boccassi d888cd4cfc test: fix TEST-50-DISSECT build on Ubuntu CI
Ubuntu CI's just got the dependencies require dto run this test added,
and it seems the build is different enough from other platforms
that it fails to create the required directories:

cp: cannot create regular file '/var/tmp/systemd-test.JJMOBY/minimal/usr/lib/os-release': No such file or directory
2020-10-17 17:58:40 +01:00
Luca Boccassi 1bac565641 Revert "Block TEST-50-DISSECT on Ubuntu CI temporarily"
This reverts commit 329315b29f.
2020-10-17 17:58:40 +01:00
Luca Boccassi 329315b29f Block TEST-50-DISSECT on Ubuntu CI temporarily
It looks like we need to do some whack-a-mole before it will fully pass,
so disable for now. It was skipped until today anyway due to missing
dependencies.
2020-10-17 09:05:31 +02:00
Yu Watanabe 9087e3d609 test-network: do not use deprecated value 2020-10-15 07:08:27 +09:00
Yu Watanabe c27abcf4fb network: when Gateway=_dhcp4, set several properties based on lease if they are not explicitly specified
Before this commit, event when Gateway=_dhcp4 or _ra is set, the
route was configured with 'protocol static', and other properties
specified by RouteTable=, RouteMTU=, or etc, were ignored.

This commit makes set the route protocol based on the protocol the
gateway address is obtained, and apply other settings if it is not
explicitly specified in the [Route] section.
2020-10-15 07:06:23 +09:00
Lennart Poettering fc8bc57f6b
Merge pull request #16968 from yuwata/remove-old-device-on-move-event
core, udev: remove old device on move event
2020-10-14 17:49:37 +02:00
Yu Watanabe 21266e60e9 test-network: add test for issue #17304 2020-10-13 20:32:17 +09:00
Yu Watanabe d9005dec6e test-network: do not fail when multiple ipv6 default gateways are configured
When multiple ipv6 default gateways are set, kernel seems to merge them
into a multipath route.
2020-10-08 02:51:23 +09:00
Yu Watanabe 297f9d86fe test-network: add a test case for IPv4 route with IPv6 gateway 2020-10-08 02:51:13 +09:00
Yu Watanabe 0a2808a208 test-network: drop meaningless Scope= settings in the config 2020-10-07 15:22:10 +02:00
Yu Watanabe 66493453b3 test-network: also remove IPv6 rules 2020-10-07 03:23:27 +09:00
Yu Watanabe 713bfdaa6c test-network: add a missing netdev in the list 2020-10-07 03:23:27 +09:00
Yu Watanabe 47f8411249 test-network: disable RA in test_sriov
We usually disable IPv6AcceptRA= if the test does not require any
dynamic address configuration, as it makes slightly slow down the test.

C.f. 491b79aeac.
2020-10-07 03:23:27 +09:00
Yu Watanabe 5cf52d90a9 test-network: add missing file in the list 2020-10-07 03:23:27 +09:00
Yu Watanabe 6dcc637574 test-network: drop duplicated address 2020-10-07 03:23:27 +09:00
Lennart Poettering c14ebe07a9
Merge pull request #17172 from keszybz/read-login-defs
Read /etc/login.defs
2020-10-02 11:01:30 +02:00
Zbigniew Jędrzejewski-Szmek a3709e3709 tests: when creating temp dirs, include test name in path
This makes it easier to figure out which directory we want to look at
when tests fail, and also which test left behind a directory when it
shouldn't.
2020-10-01 19:53:45 +02:00
Zbigniew Jędrzejewski-Szmek aa25270cb2 sysusers: look at login.defs when setting the default range to allocate users
Also, even if login.defs are not present, don't start allocating at 1, but at
SYSTEM_UID_MIN.

Fixes #9769.

The test is adjusted. Actually, it was busted before, because sysusers would
never use SYSTEM_GID_MIN, so if SYSTEM_GID_MIN was different than
SYSTEM_UID_MIN, the tests would fail. On all "normal" systems the two are
equal, so we didn't notice. Since sysusers now always uses the minimum of the
two, we only need to substitute one value.
2020-10-01 19:53:45 +02:00
Zbigniew Jędrzejewski-Szmek 044df624aa test-sysusers: fix how paths are calculated
We were looking at ${f%.*}, i.e. the $f with any suffix starting with a dot removed.
This worked fine for paths like /some/path/test-11.input. It also worked
for paths like /some/path/inline (there were no dots, so we got $f back unscathed).
But in the ubuntu CI the package is built in a temporary directory like
/tmp/autopkgtest-lxc.nnnfqb26/downtmp/build.UfW/ (yes, it has a dot, even two.).
That still worked for the first case, but in the second case we truncated things
after the first dot, and we would try to get
/tmp/autopkgtest-lxc.nnnfqb26/downtmp/build and try to load
/tmp/autopkgtest-lxc.nnnfqb26/downtmp/build.expected-password, which obviously
didn't work as expected. To avoid this issue, do the suffix removal only when
we know that there really is a suffix.

A second minor issue was that we would try to copy $1.expected-*, and sometimes
$1 would be given, and sometimes not. Effectively we were relying on there
not being any files matching .expected-*. There weren't any such files, but let's
avoid this ugliness and always pass $1.
2020-10-01 17:52:51 +02:00
Zbigniew Jędrzejewski-Szmek 69a7c5fb1f test-sysusers: sort examples
This shouldn't affect the outcome, but makes outputs easier to compare.
2020-10-01 17:52:51 +02:00
Zbigniew Jędrzejewski-Szmek bd7e6aa73a test/TEST-21-SYSUSERS: turn into a unit test
All this test does is manipulate text files in a subdir specified with --testroot.
It can be a normal unittest without the overhead of creating a machine image.

As a bonus, also test the .standalone version.
2020-10-01 17:52:51 +02:00
Lennart Poettering 36296ae2ad
Merge pull request #17152 from keszybz/make-mountapivfs-default
Make MountAPIVFS=yes default
2020-10-01 11:00:02 +02:00
Zbigniew Jędrzejewski-Szmek 581b2c7359
Merge pull request #17132 from keszybz/test-suite-update
Test suite updates
2020-09-25 13:39:24 +02:00
Zbigniew Jędrzejewski-Szmek 9309a23b95 test: switch TEST-02-CRYPTSETUP and TEST-24-UNITTESTS
When tests are executed serially (the default), it seems better to launch
the fairly generic test that runs the unittests early in the sequence.
Right now the tests are ordered based on when they were written, but
this doesn't make much sense.
2020-09-24 17:02:20 +02:00
Zbigniew Jędrzejewski-Szmek d583cf45b6 TEST-50-DISSECT: drop now-unneeded MountAPIVFS=yes and full paths to executables
With the previous changes we can simplify the invocations in the test a bit.
2020-09-24 10:03:18 +02:00
Zbigniew Jędrzejewski-Szmek abf6346c5e test/run-integration-tests: do not run the tests if only "clean" is passed 2020-09-22 18:05:19 +02:00
Franck Bui 64a3494c3d udev: rename kernel option 'log_priority' into 'log_level'
Let's be consistent with the rest of the project.

'log_priority' is still supported for backward compatibility.
2020-09-22 09:05:57 +02:00
Yu Watanabe e4c01fe6af test: add test cases for RuntimeDirectoryPreserve=yes 2020-09-18 13:11:39 +02:00
Zbigniew Jędrzejewski-Szmek 05d418fed9
Merge pull request #17085 from yuwata/network-configure-mdb-entries-on-bridge-master
network: allow to configure mdb entries on bridge master
2020-09-18 13:06:44 +02:00
Lennart Poettering 437d6de1fe
Merge pull request #17092 from keszybz/libtool-excorcism
Libtool excorcism
2020-09-18 10:14:09 +02:00
Yu Watanabe 1034044260
Merge pull request #15050 from ssahani/fq-pie
network: tc: add support for FQ-PIE packet scheduler
2020-09-18 03:50:02 +09:00
Zbigniew Jędrzejewski-Szmek d688c5d653 mkosi: update rules in mkosi.default.networkd-test boot
We need to include ninja-build in the packages list because meson doesn't
depend on it (because it supports other backends too).

Also drop xz-devel, it's not crucial for the test.
2020-09-17 17:06:51 +02:00
Zbigniew Jędrzejewski-Szmek 050b4981e0 mkosi: stop pulling in libtool
Not useful since 72cdb3e783.
2020-09-17 16:08:41 +02:00
Yu Watanabe dc0e90d2e0
Merge pull request #16929 from ssahani/network-bare-udp
network: introduce Bare UDP Tunnelling
2020-09-17 20:34:15 +09:00
Yu Watanabe 9f773037a0 test-network: add test for bridge MDB entries on bridge master 2020-09-17 18:15:25 +09:00
Yu Watanabe 1578266b02 test-network: add tests for FQ-PIE 2020-09-17 17:18:48 +09:00
Susant Sahani 8f6b6d7091 network: TC - introduce fq pie
see https://patchwork.ozlabs.org/patch/1233253/
2020-09-17 17:12:07 +09:00
Yu Watanabe 130604719a test-network: add tests for BareUDP netdev 2020-09-17 16:46:29 +09:00
Yu Watanabe 039971ea43 test-network: add test for Independent= for vxlan 2020-09-17 15:58:41 +09:00
Susant Sahani a9b8450bd4 network: Allow vxlan to be created without .network file 2020-09-17 15:49:36 +09:00
Susant Sahani e6980c7270 network: Introduce bare UDP 2020-09-17 15:05:58 +09:00
Yu Watanabe cc0276cc3e test-network: add test for [BridgeMDB] section 2020-09-17 00:04:59 +09:00
Topi Miettinen 005bfaf118 exec: Add kill action to system call filters
Define explicit action "kill" for SystemCallErrorNumber=.

In addition to errno code, allow specifying "kill" as action for
SystemCallFilter=.

---
v7: seccomp_parse_errno_or_action() returns -EINVAL if !HAVE_SECCOMP
v6: use streq_ptr(), let errno_to_name() handle bad values, kill processes,
 init syscall_errno
v5: actually use seccomp_errno_or_action_to_string(), don't fail bus unit
parsing without seccomp
v4: fix build without seccomp
v3: drop log action
v2: action -> number
2020-09-15 12:54:17 +03:00
Yu Watanabe 41bed67613
Merge pull request #16998 from zonque/networkd/mdb
network: add support for setting MDB entries
2020-09-15 16:30:39 +09:00
Yu Watanabe efdaeb88f0 test: add test for device renaming issue #16967 2020-09-15 11:29:38 +09:00
Yu Watanabe 766f8f388f test-network: add test for ENOBUFS issue #17012
The issue seems already fixed by PR #16982 and its follow-up commit
4934ba2121.
2020-09-11 18:07:47 +02:00
Daniel Mack 58695ed50a test: add BridgeMDB to fuzz-network-parser/directives.network 2020-09-10 18:55:20 +02:00
Yu Watanabe 87adeabfb7 test-network: update tests for issue #16784 2020-09-10 18:57:07 +09:00
Lennart Poettering c6552f7cd5
Merge pull request #16955 from keszybz/test-execute-cleanup
One patch for test-execute and assorted cleanups
2020-09-08 18:33:12 +02:00
Yu Watanabe 68248f43fc test-network: add test for IPv6Token=prefixstable 2020-09-08 14:32:44 +09:00
Zbigniew Jędrzejewski-Szmek a9030b81c1 udev-test: do not rely on "mail" group being defined
"audio" should be there, at least we declare it. "mail" nowadays is less
likely to exist than in the past.

Fixes one of the items in #16942.
2020-09-04 18:45:44 +02:00
Zbigniew Jędrzejewski-Szmek 0b3861d224 test-execute/exec-dynamicuser-statedir.service: fix quoting
All backslashes that should be single in shell syntax need to be written as "\\" because
our parser will remove one level of quoting. Also, single quotes were doubly nested, which
cannot work.

Should fix the following message:
test-execute/exec-dynamicuser-statedir.service:16: Ignoring unknown escape sequences: "test $$(find / \( -path /var/tmp -o -path /tmp -o -path /proc -o -path /dev/mqueue -o -path /dev/shm -o -path /sys/fs/bpf -o -path /dev/.lxc \) -prune -o -type d -writable -print 2>/dev/null | sort -u | tr -d \\n) = /var/lib/private/quux/pief/var/lib/private/waldo"
2020-09-04 18:11:22 +02:00
Zbigniew Jędrzejewski-Szmek 908dbc70d6
Merge pull request #16044 from ssahani/resolved-interface
systemd-resolved: allow configurable bind address
2020-09-03 19:06:05 +02:00
Susant Sahani 1f05101fb6 resolve: allow configurable bind address 2020-09-03 08:27:41 +00:00
Lennart Poettering 31abedbb03 test: add test for new "sticky" tags logic 2020-09-01 17:40:12 +02:00
Lennart Poettering 73484ecff9 test-functions: make sure we test our own libudev instead of the host libudev
When invoking "ldd" to find dependency libraries we already set
$LD_LIBRARY_PATH to point to our own build tree, so that our libraries
are checked, not the host libraries. This is not sufficient howeever, as
libudev is built in a subdir. Add that, too.
2020-09-01 17:40:12 +02:00
Michael Biebl 9654645b62
Merge pull request #16850 from mbiebl/networkd-socket-activation
networkd: use socket activation when starting networkd
2020-08-29 16:12:46 +02:00
Michael Biebl 3aa645f0c0 test-network: stop networkd and its socket
With the changes from 2c0dffe82d, starting
systemd-networkd.service will also activate systemd-networkd.socket.
When tearing down a test, we need to stop the socket as well, to make
sure networkd can't be activated accidentally with the wrong
configuration.
2020-08-28 21:03:09 +02:00
Zbigniew Jędrzejewski-Szmek 7efbe21850
Merge pull request #16872 from keszybz/test-50
Improve handling of os-release in tests
2020-08-28 08:27:55 +02:00
Zbigniew Jędrzejewski-Szmek 9f927e46ac test/test-functions: do not execute strip_binaries twice
It is called from setup_basic_environment(), which also calls install_symtemd()
a bit earlier, so in effect it would be called twice.
2020-08-27 13:10:30 +02:00
Zbigniew Jędrzejewski-Szmek ae6c598791 tests/TEST-50: support the case when /etc/os-release is present
We have four legal cases:
1. /usr/lib/os-release exists and /etc/os-release is a symlink to it
2. both exist but /etc/os-release is not a symlink to /usr/lib/os-release
3. only /usr/lib/os-release exists
4. only /etc/os-release exists

The generic setup code in test-functions and create-busybox-image didn't handle
case 3.

The test-specific code in TEST-50 didn't handle 2 (because the general setup
code would only install /etc/os-release in the image and
grep -f /usr/lib/os-release would not work) and 4 (same reason) and would fail
in case 3 in generic setup.
2020-08-27 13:08:14 +02:00
Michael Biebl ac741c10e2 test: remove executable bit from testsuite-52.service 2020-08-27 12:13:16 +02:00
Zbigniew Jędrzejewski-Szmek 37b6a5dff5 TEST-50: sfdisk is already installed by setup_basic_environment 2020-08-27 11:31:11 +02:00
Lennart Poettering 30dd9f7391 test: add test suite for new credentials logic 2020-08-25 19:46:36 +02:00
Lennart Poettering 4e39995371 core: introduce ProtectProc= and ProcSubset= to expose hidepid= and subset= procfs mount options
Kernel 5.8 gained a hidepid= implementation that is truly per procfs,
which allows us to mount a distinct once into every unit, with
individual hidepid= settings. Let's expose this via two new settings:
ProtectProc= (wrapping hidpid=) and ProcSubset= (wrapping subset=).

Replaces: #11670
2020-08-24 20:11:02 +02:00
Zbigniew Jędrzejewski-Szmek eea63c03b9
Merge pull request #16808 from yuwata/test-network-reconfigure-routing-policy-rules
add a test case for [RoutingPolicyRule] and fix minor issue in man page
2020-08-21 14:20:52 +02:00
Zbigniew Jędrzejewski-Szmek 3fb01017ee
Merge pull request #16686 from bluca/mount_images_opts
core: add mount options support for MountImages
2020-08-21 10:11:08 +02:00
Yu Watanabe 9dffe6fc27 test-network: add a test case for reconfiguring routing policy rules
C.f. #16784.
2020-08-21 15:27:38 +09:00
Zbigniew Jędrzejewski-Szmek 990307c3da
Merge pull request #16803 from poettering/analyze-condition-rework
support missing conditions/asserts everywhere
2020-08-20 18:18:13 +02:00
Luca Boccassi 427353f668 core: add mount options support for MountImages
Follow the same model established for RootImage and RootImageOptions,
and allow to either append a single list of options or tuples of
partition_number:options.
2020-08-20 14:45:40 +01:00
Luca Boccassi 9ece644435 core: change RootImageOptions to use names instead of partition numbers
Follow the designations from the Discoverable Partitions Specification
2020-08-20 13:58:02 +01:00
Lennart Poettering 476cfe626d core: remove support for ConditionNull=
The concept is flawed, and mostly useless. Let's finally remove it.

It has been deprecated since 90a2ec10f2 (6
years ago) and we started to warn since
55dadc5c57 (1.5 years ago).

Let's get rid of it altogether.
2020-08-20 14:01:25 +02:00
Lennart Poettering e96ceabac9 nspawn: move $NOTIFY_SOCKET into /run/host/ too
The sd_notify() socket that nspawn binds that the payload can use to
talk to it was previously stored in /run/systemd/nspawn/notify, which is
weird (as in the previous commit) since this makes /run/systemd
something that is cooperatively maintained by systemd inside the
container and nspawn outside of it.

We now have a better place where container managers can put the stuff
they want to pass to the payload: /run/host/, hence let's make use of
that.

This is not a compat breakage, since the sd_notify() protocol is based
on the $NOTIFY_SOCKET env var, where we place the new socket path.
2020-08-20 10:17:48 +02:00
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
Susant Sahani 518cd6b527 network: Introduce SR-IOV
SR-IOV provides the ability to partition a single physical PCI
resource into virtual PCI functions which can then be injected in
to a VM. In the case of network VFs, SR-IOV improves north-south n
etwork performance (that is, traffic with endpoints outside the
host machine) by allowing traffic to bypass the host machine’s network stack.
2020-07-01 13:51:33 +09:00
Zbigniew Jędrzejewski-Szmek 6c3a19d5b3
Merge pull request #16313 from yuwata/network-move-ipv6ll-gen-mode
network: move IPv6LinkLocalAddressGenerationMode= to [Network] section
2020-06-30 17:13:02 +02:00
Luca Boccassi 7233e91af0 core: store timestamps of unit load attempts
When the system is under heavy load, it can happen that the unit cache
is refreshed for an unrelated reason (in the test I simulate this by
attempting to start a non-existing unit). The new unit is found and
accounted for in the cache, but it's ignored since we are loading
something else.
When we actually look for it, by attempting to start it, the cache is
up to date so no refresh happens, and starting fails although we have
it loaded in the cache.

When the unit state is set to UNIT_NOT_FOUND, mark the timestamp in
u->fragment_loadtime. Then when attempting to load again we can check
both if the cache itself needs a refresh, OR if it was refreshed AFTER
the last failed attempt that resulted in the state being
UNIT_NOT_FOUND.

Update the test so that this issue reproduces more often.
2020-06-30 16:50:00 +02:00
Yu Watanabe 6f6296b93f network: move IPv6LinkLocalAddressGenerationMode= to [Network] section
This also moves and renames variables and functions.

Follow-ups for a6f1848a23.
2020-06-30 18:58:52 +09:00
Frantisek Sumsal 8f843190ff test: bump the timeout for systemd-hwdb-update.service under ASan
Since the hwdb update from a79be2f807
the systemd-hwdb-update service started timing out under ASan when
compiled with gcc, as we started tripping over the 3 minutes timeout.

This affects only gcc runs, since the current gcc on Arch still suffers
from the detect_stack_use_after_return performance penalty[0]. Until
the fixed gcc is present in the respective repositories, let's bump
the timeout to 4 minutes, as we might not be able to upgrade right
away, due to systemd/systemd#16199.

Before the hwdb update:
[ 7958.292540] systemd[63]: systemd-hwdb-update.service: Executing: /usr/bin/time systemd-hwdb update
[ 7958.304005] systemd[1]: systemd-journald.service: Got notification message from PID 44 (FDSTORE=1)
[ 7958.314434] systemd[1]: systemd-journald.service: Added fd 3 (n/a) to fd store.
[ 8008.520082] systemd[1]: systemd-journald.service: Got notification message from PID 44 (WATCHDOG=1)
[ 8068.520151] systemd[1]: systemd-journald.service: Got notification message from PID 44 (WATCHDOG=1)
[ 8125.682843] time[63]: 84.47user 82.92system 2:47.50elapsed 99%CPU (0avgtext+0avgdata 811512maxresident)k
[ 8125.682843] time[63]: 0inputs+19680outputs (0major+25000853minor)pagefaults 0swaps

After the hwdb update:
[ 6215.491958] systemd[63]: systemd-hwdb-update.service: Executing: /usr/bin/time systemd-hwdb update
[ 6215.503380] systemd[1]: systemd-journald.service: Got notification message from PID 44 (FDSTORE=1)
[ 6215.514172] systemd[1]: systemd-journald.service: Added fd 3 (n/a) to fd store.
[ 6329.392918] systemd[1]: systemd-journald.service: Got notification message from PID 44 (WATCHDOG=1)
[ 6394.920205] time[63]: 89.48user 89.98system 2:59.55elapsed 99%CPU (0avgtext+0avgdata 812764maxresident)k
[ 6394.920205] time[63]: 0inputs+20568outputs (0major+27318354minor)pagefaults 0swaps

[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94910
2020-06-29 16:07:11 +02:00
Gaoyi 0090b551e6 Add quotes for -n
According to SC2070, -n doesn't work with unquoted arguments
https://github.com/koalaman/shellcheck/wiki/SC2070

Signed-off-by: Gaoyi <ymuemc@163.com>
2020-06-26 15:12:29 +02:00
Zbigniew Jędrzejewski-Szmek 3f11426f52
Merge pull request #16275 from yuwata/network-deprecate-netdevsim
network: deprecate netdevsim support
2020-06-25 18:41:49 +02:00
Zbigniew Jędrzejewski-Szmek 98506a41fe
Merge pull request #15697 from OhNoMoreGit/fix-path-units
Recheck PathExists=, PathExistsGlob=, DirectoryNotEmpty= when triggered unit terminates
2020-06-25 18:23:47 +02:00
Lennart Poettering f49bead3b0
Merge pull request #16257 from keszybz/two-fuzzer-issues
Two fuzzer issues
2020-06-25 14:40:35 +02:00
Yu Watanabe 440988666c test-network: remove unused config 2020-06-25 17:30:19 +09:00
Luca Boccassi d4d55b0d13 core: add RootHashSignature service parameter
Allow to explicitly pass root hash signature as a unit option. Takes precedence
over implicit checks.
2020-06-25 08:45:21 +01:00