1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 00:51:24 +03:00
Commit Graph

2126 Commits

Author SHA1 Message Date
Annika Wickert
c0267a592a network: Implement B.A.T.M.A.N. Advanced interface type 2021-02-25 01:57:29 +09:00
Luca Boccassi
04153c4509 test: skip TEST-56-OOMD if systemd-oomd is not installed
Fixes #18775
2021-02-24 15:02:07 +01:00
Luca Boccassi
93f597013a Add ExtensionImages directive to form overlays
Add support for overlaying images for services on top of their
root fs, using a read-only overlay.
2021-02-23 15:34:46 +00:00
Yu Watanabe
9947c7bad1 test-network: add tests for dropping unnecessary nexthops 2021-02-23 22:48:12 +09:00
Yu Watanabe
69a91c704e test-network: add tests for Blackhole= setting in [NextHop] section 2021-02-23 02:21:35 +09:00
Yu Watanabe
30f1083709 network: nexthop: add Blackhole= setting in [NextHop] section
As similar to unreachable type routes, blackhole nexthops do not have
NHA_OID attribute, so they are managed by Manager.
2021-02-23 02:21:17 +09:00
Zbigniew Jędrzejewski-Szmek
5735ab0979 fuzz-systemctl-parse-argv: add "telinit" to the argv[0] list 2021-02-22 14:22:07 +00:00
Yu Watanabe
84d32bf59b test-network: test wireguard peer in drop-in config
Closes #18241.
2021-02-22 21:33:36 +09:00
Yu Watanabe
e2d9bc5cfd test-network: add a test for OnLink= in [NextHop] section 2021-02-21 05:16:27 +09:00
Yu Watanabe
2ddd52d1e2 network: nexthop: add OnLink= setting 2021-02-21 05:16:23 +09:00
Yu Watanabe
045db4fa0d test-network: add tests for Broadcast= with boolean settings 2021-02-20 14:23:07 +09:00
Yu Watanabe
7f37ecf7e5
Merge pull request #18699 from yuwata/network-route-add-nexthop-setting
network: add NextHop= setting in [Route] section
2021-02-20 14:17:17 +09:00
Zbigniew Jędrzejewski-Szmek
5800f0fc68 basic/alloc-util: also reset the cleaned-up variable in freep()
freep() has it's own definition, so I missed it in fd421c4adc.

Again, there is a small growth, but the compiler should be able to optimize it away:
-Dbuildtype=debug:

-rwxrwxr-x 1 zbyszek zbyszek 4106816 Feb 19 12:52 build/libsystemd.so.0.30.0
-rwxrwxr-x 1 zbyszek zbyszek 7492952 Feb 19 12:52 build/src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 zbyszek zbyszek 4472624 Feb 19 12:53 build/systemd

-rwxrwxr-x 1 zbyszek zbyszek 4107056 Feb 19 13:03 build/libsystemd.so.0.30.0
-rwxrwxr-x 1 zbyszek zbyszek 7493480 Feb 19 13:03 build/src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 zbyszek zbyszek 4472760 Feb 19 13:03 build/systemd

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31055.
2021-02-19 15:25:16 +01:00
Yu Watanabe
cee0f719d8 test-network: add tests for NextHop= setting in [Route] 2021-02-19 22:42:39 +09:00
Yu Watanabe
324e342219 network: add NextHop= setting in [Route] section 2021-02-19 22:42:39 +09:00
Yu Watanabe
38ba3da0a1 network: rename UseFQDN= -> UseHostname=
Prompted by
https://github.com/systemd/systemd/pull/18543#issuecomment-780798451.
2021-02-18 21:47:37 +01:00
Lennart Poettering
489344f24b networkd-test: reenable dnssec while testing
We need to list the synthesized domains as NTAs, otherwise the DNSSEC
validation of course cannot succeed.

Fixes: #10487 #5029
2021-02-18 14:12:42 +00:00
Susant Sahani
d75bf6cfe2 network: Add "route_localnet" sysctl support 2021-02-18 21:04:17 +09:00
Lennart Poettering
dc288ffeab
Merge pull request #18596 from keszybz/systemctl-quiet-legend
systemctl: hide legends with --quiet, allow overriding
2021-02-17 23:40:04 +01:00
Zbigniew Jędrzejewski-Szmek
6906da2692 systemctl: hide legends with --quiet, allow overriding
--no-legend is replaced by --legend=no.

--quiet now implies --legend=no, but --legend=yes may be used to override that.
--quiet controls hints and warnings and such, and --legend controls just the
legends. I think it makes sense to allow both to controlled independently, in
particular --quiet --legend makes sense when using systemctl in a script to
provide some user-visible output.

Fixes #18560.
2021-02-17 21:09:14 +01:00
Luca Boccassi
0761da386a test: avoid leaking open loop devices
When a subshell is used ('make' or 'make all') the LOOPDEV environment
variable, which is used to store the opened loop device, is lost.
So the cleanup on trap/exit doesn't do anything, and the loop
device used to mount the test image is left around.

Avoid using a subshell to fix the issue.
2021-02-17 18:55:05 +01:00
Yu Watanabe
6cd8f9b5f2 test-network: add tests for Family= in [NextHop] 2021-02-17 15:55:37 +09:00
Yu Watanabe
f1923efccb network: nexthop: introduce Family= setting in [NextHop] section
This is an alias of `Gateway=0.0.0.0` or `Gateway=::`.
2021-02-17 15:55:37 +09:00
Zbigniew Jędrzejewski-Szmek
425ac7a253 fuzz-systemctl-parse-argv: call static destuctors
With all the preparatory work in previous PRs, we can now call static destructors
repeatedly without issue. We need to do it here so that global variables allocated
during parsing are properly freed.
2021-02-16 17:15:11 +01:00
Lennart Poettering
83ce3b1944
Merge pull request #18579 from keszybz/fix-fragment-id-crash
Fix fragment id crash
2021-02-15 23:35:25 +01:00
Luca Boccassi
79dbbb261d
Merge pull request #18593 from keszybz/fuzz-more-systemctl-paths
Fuzz more systemctl paths
2021-02-15 19:13:58 +00:00
Luca Boccassi
7eba0c50f5 test: install binaries from local d/control file
The source package in the apt cache might be older than the
packaging from salsa.debian.org/systemd-team/systemd so it might not
list all the current binary packages.
This is currently the case for systemd-timesyncd, so TEST-30 fails.

Simply grep the control file rather than using apt-cache when iterating
over the packages contents.
2021-02-15 10:17:39 +01:00
Zbigniew Jędrzejewski-Szmek
860f154fa3 fuzz-systemctl-parse-argv: add argv[0] values to corpus 2021-02-15 10:01:38 +01:00
Zbigniew Jędrzejewski-Szmek
3b5ab02119 TEST-15-DROPINS: add test for linked units 2021-02-14 15:08:49 +01:00
Zbigniew Jędrzejewski-Szmek
b3c57df0f5
Merge pull request #18401 from anitazha/oomdxattr
oomd: implement avoid/omit support for cgroups
2021-02-13 10:00:31 +01:00
Anita Zhang
4e806bfa9f oom: add unit file settings for oomd avoid/omit xattrs 2021-02-12 12:45:36 -08:00
Yu Watanabe
4a70450104 test-network: merge test_address_static and test_address_preferred_lifetime_zero_ipv6 2021-02-12 23:09:21 +09:00
Vinnie Magro
f963f8953d networkd: add UseFQDN option for DHCPv6
Similar to DHCPv4's UseHostname option, add a UseFQDN config option in
[DHCPv6] to set the system's transient hostname if the FQDN option is
set in the DHCPv6 response from the server.
2021-02-11 13:30:04 +09:00
Luca Boccassi
e26fe5f911 portable: add 'reattach' verb and DBUS interface
Add 'reattach' verb to portablectl, and corresponding DBUS interface
to systemd-portabled.
Takes the same parameters as 'attach', but it will do a 'detach' (and
it will refuse to proceed if it cannot be done) first, matching on
the unversioned prefix of the new image. Eg:

portablectl reattach /tmp/foo_2.raw

will cause foo_1.raw to be detached, and foo_2.raw to be attached.

The key difference with a manual 'detach old' plus 'attach new' is that
the running units are not disturbed until after the attach completed,
and if --now is passed they are then restarted.
A 'detach' is not allowed normally if the units are running.

By using a restart-after-deploy method, 'reattach' allows for minimal
interruption of service and also for features that only work on restart
(eg: file descriptor store) to work as intended.

The DBUS interface returns two lists: first the removals from the detach
that were not immediately re-added in the attach, so that the caller
can stop the relevant units, and then the list of additions that are
either new or updates, so that the caller can restart/enable the
relevant units. portablectl already implements this with the existing
--now/--enable switches.
2021-02-10 19:07:36 +00:00
Luca Boccassi
8b535f3aac test: setup var/tmp in the test image as well 2021-02-10 18:54:12 +00:00
Luca Boccassi
e763342091 test: add empty /etc/resolv.conf in test image
Portable services have a BindPath pointing to it, so it needs to
be available in the image
2021-02-10 18:54:12 +00:00
Luca Boccassi
9785c44dd8 test-50-dissect: move minimal image setup to common setup function
So that it can be re-used for other tests by simply setting
TEST_INSTALL_VERITY_MINIMAL=1 in test.sh, without having to
replicate the setup commands.
2021-02-10 18:54:12 +00:00
Frantisek Sumsal
2de908aead test: count call instructions as well
Binaries on the latest Arch Linux use `call` instructions instead of
`callq`, which breaks the ASan detection and eventually the image
building process (due to insufficient space).
2021-02-10 20:20:31 +03:00
Yu Watanabe
9a67c080b0
Merge pull request #18506 from keszybz/fuzz-systemctl-parse-argv
Fuzzer for systemctl argline parsing
2021-02-11 00:29:22 +09:00
Zbigniew Jędrzejewski-Szmek
5fd8782328 fuzz-systemctl-parse-argv: a new fuzzer
Does what the name suggests. Obviously inspired by sudoers, but note that
our tools are not supposed to be installed suid, so there is no privilege
boundary to cross here.
2021-02-09 14:11:42 +01:00
Yu Watanabe
beb75dd31d test-network: support protocol and linkdown flag for ff00::/8 route
Fixes #18507.
2021-02-09 12:25:27 +01:00
Anita Zhang
59331b8e29 oom: implement avoid/omit xattr support
There may be situations where a cgroup should be protected from killing
or deprioritized as a candidate. In FB oomd xattrs are used to bias oomd
away from supervisor cgroups and towards worker cgroups in container
tasks. On desktops this can be used to protect important units with
unpredictable resource consumption.

The patch allows systemd-oomd to understand 2 xattrs:
"user.oomd_avoid" and "user.oomd_omit". If systemd-oomd sees these
xattrs set to 1 on a candidate cgroup (i.e. while attempting to kill something)
AND the cgroup is owned by root, it will either deprioritize the cgroup as
a candidate (avoid) or remove it completely as a candidate (omit).

Usage is restricted to root owned cgroups to prevent situations where an
unprivileged user can set their own cgroups lower in the kill priority than
another user's (and prevent them from omitting their units from
systemd-oomd killing).
2021-02-09 02:27:40 -08:00
Frantisek Sumsal
01da74243d test: add a custom SELinux file context
Since the test suite overhaul, the test units are now under
/usr/lib/systemd/tests/testdata/tetsuite-06.units with
system_u:object_r:lib_t context. This causes an AVC denial, since the
systemd unit files are expected to have the
system_u:object_r:systemd_unit_file_t context. Let's fix this by using a
custom file context definition.
2021-02-05 17:08:58 +01:00
Frantisek Sumsal
cd2d8fea14 test: clean the module build dir before compiling it
otherwise the module won't compile & load after autorelabel reboot,
since the target is already built.
2021-02-05 16:57:30 +01:00
Zbigniew Jędrzejewski-Szmek
3d0112878f
Merge pull request #18444 from anitazha/proprename
oom: parse properties with 1/10000 precision instead of 1/100
2021-02-04 12:53:10 +01:00
Yu Watanabe
0fb613000d test-network: disable NDISC on veth-peer
This should speed the tests up.
2021-02-03 22:09:07 +00:00
Yu Watanabe
face9fcc16 network,udev: move TransmitQueues=/ReceiveQueues= from .network to .link
As the settings are mostly hardware setup, and merely see from network
layer.

See also discussions in
https://github.com/systemd/systemd/pull/18170#issuecomment-758807497
https://github.com/orgs/systemd/teams/systemd/discussions/1
2021-02-03 14:44:51 +09:00
Yu Watanabe
1f8dc96c06 udev: rename TxQueueLength= -> TransmitQueueLength=
As we usually (unfortunately not always though) do not use abbreviations.

Tx may be standard abbreviation, but we already have e.g.
TransmitChecksumOffload=. So, let's use Transmit instead of Tx.

Follow-up for ef4a91a7e8.
2021-02-03 14:43:49 +09:00
Anita Zhang
0a9f93443b oom: rework *MemoryPressureLimit= properties to have 1/10000 precision
Requested in
https://github.com/systemd/systemd/pull/15206#discussion_r505506657,
preserve the full granularity for memory pressure limits (permyriad)
instead of capping out at percent.
2021-02-02 17:52:48 -08:00
Zbigniew Jędrzejewski-Szmek
0c3c9a4096
Merge pull request #18395 from bluca/make_docs_img_clean
Add Python 3.7 compat in update-dbus-docs and fix regression in integration tests 'make clean'
2021-01-29 14:07:54 +01:00
Topi Miettinen
ddc155b2fd New directives NoExecPaths= ExecPaths=
Implement directives `NoExecPaths=` and `ExecPaths=` to control `MS_NOEXEC`
mount flag for the file system tree. This can be used to implement file system
W^X policies, and for example with allow-listing mode (NoExecPaths=/) a
compromised service would not be able to execute a shell, if that was not
explicitly allowed.

Example:
[Service]
NoExecPaths=/
ExecPaths=/usr/bin/daemon /usr/lib64 /usr/lib

Closes: #17942.
2021-01-29 12:40:52 +00:00
Luca Boccassi
21be71eefb test: fix 'make clean' not removing shared image 2021-01-29 09:56:45 +00:00
Zbigniew Jędrzejewski-Szmek
e798ffef82
Merge pull request #18340 from ddstreet/integration-tests-no-build
allow test/run-integration-tests.sh to work without a local build
2021-01-27 08:23:38 +01:00
Yu Watanabe
37baf8db56
Merge pull request #18380 from yuwata/test-network-ipv6-proxy-ndp
test-network: add tests for IPv6ProxyNDPAddress=
2021-01-27 10:47:36 +09:00
Dan Streetman
59b8cb3c45 test/TEST-01-BASIC: also install testsuite.target
This test doesn't require the tests to be installed, so it must manually
install required test services and targets itself, including the default
target of testsuite.target

Also use $TEST_UNITS_DIR which is set by test-functions instead of
calculating the path
2021-01-26 17:38:23 -05:00
Dan Streetman
b3e4340664 test/run-integration-tests.sh: adjust arg processing
The script currently parses either 'clean' or 'clean-again' as wanting
to clean both before and after running tests. This fixes that to split
the action up; clean runs before tests, clean-again after; and also
verifies the parameter(s) before passing them to make.
2021-01-26 17:36:53 -05:00
Dan Streetman
232add5c47 test: allow run-integration-tests.sh to run without build 2021-01-26 17:09:48 -05:00
Dan Streetman
8fa038085e test/test-functions: allow installing systemd files from local system
Add NO_BUILD var to allow testing with no local build, by installing
local systemd files into the image.

This only works for debian-like distros currently, that use the
tools 'apt' and 'dpkg' for package management.
2021-01-26 17:09:48 -05:00
Dan Streetman
12d31e4ea5 test: find $BUILD_DIR in test-functions, remove from other scripts
The $BUILD_DIR is only used in test-functions, and doesn't need to
be specified in any other scripts. Additionally, to be able to allow
the integration test suite to be run against locally installed binaries,
instead of built binaries, moving BUILD_DIR logic completely into
test-functions allows later patches to be simpler.
2021-01-26 17:09:48 -05:00
Dan Streetman
42f3b48c97 test/test-functions: add variables for several dir locations 2021-01-26 17:09:39 -05:00
Dan Streetman
1918406900 test/test-functions: move var assignment
This makes no code change, only moves a small block of vars higher in the
file. This makes the next commit a bit easier to read.
2021-01-26 16:05:49 -05:00
Dan Streetman
4326586be2 test: remove unused 'basedir' var from integration test makefiles 2021-01-26 16:05:49 -05:00
Yu Watanabe
f0d87798ea test-network: retry several times if expected LLDP info is not obtained
As LLDP thing does not get involved in the link status, `networkctl lldp`
may not provide an expected information even if the link is in
'configured' state.

Fixes #17360.
2021-01-26 18:48:44 +01:00
Yu Watanabe
cff0cadcac test-network: add tests for IPv6ProxyNDPAddress= 2021-01-27 01:28:28 +09:00
Zbigniew Jędrzejewski-Szmek
6dcf299d9b
Merge pull request #18363 from bluca/test_image_reuse
tests: build the image once and then copy/extend it
2021-01-25 09:25:56 +01:00
Luca Boccassi
d9e606e89f tests: build the image once and then copy/extend it
Building custom images for each test takes a lot of time.
Build the default one, and if the test needs incompatible changes
just copy it and extend it instead.
2021-01-24 13:07:39 +00:00
Luca Boccassi
74eec54d66 test: note where the bionic-* CI tool/integration lives 2021-01-24 12:03:53 +00:00
Anita Zhang
2e744a2cd8 oom: update extended test to remove swap gating 2021-01-24 02:03:59 -08:00
Anita Zhang
c20aa7b171 oom: make memory pressure duration configurable through oomd.conf 2021-01-24 01:59:03 -08:00
Luca Boccassi
95457dc13c
Merge pull request #18302 from bluca/mount_image_runtime
systemctl/core: add DBUS method to mount images without service restart
2021-01-22 17:49:11 +00:00
Luca Boccassi
6faecbd353 systemctl: add new option to mount image inside a running service namespace
Use the new DBUS method and follow the same pattern as the
systemctl bind command.
2021-01-21 19:08:40 +00:00
Dan Streetman
a853652ae9 save link activation policy to state file and display in networkctl 2021-01-21 12:05:17 -05:00
Dan Streetman
2236d75df9 test: add ActivationPolicy= unit tests 2021-01-21 12:05:17 -05:00
Dan Streetman
61135582e0 network: add ActivationPolicy= configuration parameter
This parameter allows configuring the activation policy for an interface,
meaning how it manages the interface's administrative state (IFF_UP flag).
The policy can be configured to bring the interface either up or down when
the interface is (re)configured, to always force the interface either up or
down, or to never change the interface administrative state.

If the interface is bound with BindCarrier=, its administrative state is
controlled by the interface(s) it's bound to, and this parameter is forced
to 'bound'.

This changes the default behavior of how systemd-networkd sets the IFF_UP
flag; previously, it was set up (if not already up) every time the
link_joined() function was called. Now, with the default ActivationPolicy=
setting of 'up', it will only set the IFF_UP flag once, the first time
link_joined() is called, during an interface's configuration; and on
the first link_joined() call each time the interface is reconfigured.

Fixes: #3031
Fixes: #17437
2021-01-21 11:49:43 -05:00
Zbigniew Jędrzejewski-Szmek
6eab0c6dba Revert "test-functions: make sure we test our own libudev instead of the host libudev"
This reverts commit 73484ecff9.

3976f372ae moved libudev.so to be built in the
main directory, so this addition to $LD_LIBRARY_PATH is now obsolete.

After that commit, we build the following shared libraries:

build/libnss_myhostname.so.2
build/libnss_mymachines.so.2
build/libnss_resolve.so.2
build/libnss_systemd.so.2
build/libsystemd.so.0.30.0
build/libudev.so.1.7.0
build/pam_systemd.so
build/pam_systemd_home.so
build/src/boot/efi/stub.so
build/src/boot/efi/systemd_boot.so
build/src/shared/libsystemd-shared-247.so

EFI stubs don't matter, and libsystemd-shared-nnn.so is loaded through rpath,
and is doesn't need to and shouldn't be in $LD_LIBRARY_PATH. In effect, we only
ever need to add the main build directory to the search path.
2021-01-20 14:04:52 +09:00
Lennart Poettering
b5e0c17654 test: improve a log message while building test images 2021-01-19 13:41:42 +01:00
Yu Watanabe
7e2757c42f
Merge pull request #18038 from yuwata/meson-split
meson: various cleanups
2021-01-19 12:22:34 +09:00
Yu Watanabe
4c6dd238b8
Merge pull request #18267 from lucaswerkmeister/truncate
Two StandardOutput=truncate:file improvements
2021-01-19 08:47:39 +09:00
Yu Watanabe
a79e17234d meson.build: drop unused variable 2021-01-19 07:04:19 +09:00
Yu Watanabe
0703d2f6c4 test: move test-systemd-tmpfiles.py from src/test to test
As the other test scripts, e.g. test-sysusers.sh, are located under
test rather than src/test.
2021-01-19 07:04:19 +09:00
Luca Boccassi
fa7a3cd00e test: run strace with -f and copy log out 2021-01-18 17:24:05 +00:00
Luca Boccassi
a9d34376e6 test: skip missing optional libraries in image install
Not all optional libraries might be available on developers machines,
so log and skip.
Also some pkg-config files are broken (eg: tss2 on Debian Stable) so
skip if the required variables are missing, and improve logs.
2021-01-18 17:24:05 +00:00
Luca Boccassi
5e8deb94c6 core: add DBUS method to bind mount new nodes without service restart
Allow to setup new bind mounts for a service at runtime (via either
DBUS or a new 'systemctl bind' verb) with a new helper that forks into
the unit's mount namespace.
Add a new integration test to cover this.

Useful for zero-downtime addition to services that are running inside
mount namespaces, especially when using RootImage/RootDirectory.

If a service runs with a read-only root, a tmpfs is added on /run
to ensure we can create the airlock directory for incoming mounts
under /run/host/incoming.
2021-01-18 17:24:05 +00:00
Luca Boccassi
98f654fdea machine: enter target PID namespace when adding a live mount
machinectl fails since 21935150a0 as it's now
mounting onto a file descriptor in a target namespace, without joining the
target's PID namespace.
Note that it's not enough to setns CLONE_NEWPID, but a double-fork is required
as well, as implemented by namespace_fork().

Add a test case to TEST-13-NSPAWN to cover this use case.
2021-01-18 17:24:05 +00:00
Yu Watanabe
f9ead1a2f4
Merge pull request #18230 from ssahani/macvlan-bcqueuelen
network: macvlan - add support to configure rx queue for broadcast / multicast
2021-01-17 20:05:22 +09:00
Lennart Poettering
3dc536e0c5
Merge pull request #17576 from gportay/veritysetup-add-support-for-dm-verity-flags
veritysetup: add support for veritytab
2021-01-17 11:18:25 +01:00
Susant Sahani
dca0a4e131 network: macvlan - add support to configure rx queue for broadcast/multicast 2021-01-17 08:39:28 +01:00
Lucas Werkmeister
58b65c6d6d test: fix exec-standardoutput-truncate test
The cmp in ExecStartPost= was actually failing – ExecStartPost= has the
same StandardOutput as the rest of the service, so the output file is
truncated before cmp can compare it with the expected output – but the
test still passed because test_exec_standardoutput_truncate() calls
test(), which only checks the main result, rather than test_service(),
which checks the result of the whole service. Fix the test by merging
the ExecStartPost= into the ExecStart= – the cmp has to be part of the
same command line as the cat so that the file is not truncated between
the two processes.
2021-01-15 20:22:29 +01:00
Lucas Werkmeister
8d7dab1fda Add truncate: to StandardOutput= etc.
This adds the ability to specify truncate:PATH for StandardOutput= and
StandardError=, similar to the existing append:PATH. The code is mostly
copied from the related append: code. Fixes #8983.
2021-01-15 09:54:50 +01:00
Gaël PORTAY
0141102f10 veritysetup-generator: add support for verity root options
This adds support for a new kernel root verity command line option
"verity_root_options=" which controls the behaviour of dm-verity by
forwarding options directly to systemd-veritysetup.

See `veritysetup(8)` for more details.
2021-01-14 19:41:41 -05:00
Lennart Poettering
ce0079d75e
Merge pull request #18227 from yuwata/network-dhcp6-pd-manage-temporary-address
network: introduce ManageTemporaryAddress= setting in [DHCPv6PrefixDelegation] section
2021-01-13 21:52:44 +01:00
Yu Watanabe
cb2ae9f8b9
Merge pull request #18170 from OnkelUlla/udev_introduce_TxQueueLen=_setting
udev: introduce TxQueueLength= setting
2021-01-14 00:19:29 +09:00
Yu Watanabe
fec1b650ad network: introduce ManageTemporaryAddress= setting in [DHCPv6PrefixDelegation] section
The setting is enabled by default, as NDisc also enabled the flag by
default.

Closes #18208.
2021-01-14 00:17:05 +09:00
Ulrich Ölmann
ef4a91a7e8 udev: introduce TxQueueLength= setting
Enable udev to set the transmit queue length of a device via a new directive to
be used in link files. The kernel stores this parameter as an unsigned 32 bit
integer. As typical values currently range in the order of 10 to a few 10,000
packets reduce the domain of valid values for this directive to 0..4294967294
and take the excluded 4294967295 == UINT32_MAX to indicate that the directive
is unset.
2021-01-13 06:41:06 +01:00
Lennart Poettering
1cf96f68db test: add a test that ensures we don't regress on "argument" field handling in tmpfiles.d
Let's make sure what is now documented as fix for #17740 is not
accidentally changed anymore.
2021-01-12 22:00:35 +01:00
Yu Watanabe
048be097d2
Merge pull request #18157 from ssahani/vlan-qos
network: Allow to configure VLan egress qos maps
2021-01-13 05:42:53 +09:00
Yu Watanabe
7c5869530c
Merge pull request #17628 from ssahani/network-gso
udev: Add support to configure Generic Segment Offload
2021-01-13 05:42:23 +09:00
Karel Zak
4fcc033b54 udev-builtin-blkid: add support for --hint offsets
The next libblkid v2.37 is going to support session offsets for
multi-session CD/DVDs. This feature is implemented by "hint offsets".

These offsets are optional and prober specific (e.g., iso, udf, ...).
For this purpose, the library provides a new function
blkid_probe_set_hint(), and blkid(8) provides a new command-line
option --hint <name>=<offset>. For CD/DVD, the offset name is
"session_offset".

The difference between classic --offset and the new --hint is that
--offset is very restrictive and defines the probing area and the rest
of the device is invisible to the library. The new --hint works
like a suggestion, it provides a hint where the user assumes the
filesystem, but the rest of the device is still readable for the
library (for example, to get some additional superblock information
etc.).

If the --hint is without a value then it defaults to zero.

The option --hint implementation in udev-builtin-blkid.c is backwardly
compatible. If compiled against old libblkid, then the option is used in
the same way as --offset.

Addresses: https://github.com/karelzak/util-linux/issues/1161
Addresses: https://github.com/systemd/systemd/pull/17424
2021-01-13 00:58:43 +09:00
Susant Sahani
1e270127de link: Add support to configure Generic Segment Offload 2021-01-12 15:19:23 +01:00
Susant Sahani
ea07086285 network: Allow to configure VLan egress qos maps 2021-01-12 14:31:03 +01:00
Susant Sahani
0d9b8913e2 network: Allow to configure VLan egress qos maps 2021-01-12 14:30:56 +01:00
Yu Watanabe
1536b7b2d0 network: introduce new UseAddress= setting in [DHCPv6] section
If it is disabled, then the addresses provided by the DHCPv6 server will
be ignored.

Closes #18203.
2021-01-12 14:19:03 +09:00
Zbigniew Jędrzejewski-Szmek
a412ec5714 meson: fix git ls-files invocations during rebase
Normally ls-files prints the full path to files from the repo root. But when
$GIT_WORK_TREE is set, ls-files prints paths relative to the current
directory. When rebasing, $GIT_WORK_TREE is set in the commands executed from
'rebase -x'. This causes problems if meson config is touched and the meson
reconfigures itself. ($GIT_WORK_TREE shouldn't be relevant, since the paths that
ls-files reports don't depend on the work tree, but whatever.) Let's unset
GIT_WORK_TREE to avoid the issue.

$ (cd test; git --git-dir=$PWD/../.git ls-files ':/test/dmidecode-dumps/*.bin')
test/dmidecode-dumps/HP-Z600.bin
test/dmidecode-dumps/Lenovo-ThinkPad-X280.bin
test/dmidecode-dumps/Lenovo-Thinkcentre-m720s.bin

$ (cd test; GIT_WORK_TREE=$PWD/.. git --git-dir=$PWD/../.git ls-files ':/test/dmidecode-dumps/*.bin')
dmidecode-dumps/HP-Z600.bin
dmidecode-dumps/Lenovo-ThinkPad-X280.bin
dmidecode-dumps/Lenovo-Thinkcentre-m720s.bin

Fixes #18148.
2021-01-09 09:22:26 +09:00
Yu Watanabe
66bf4617b1
Merge pull request #18169 from OnkelUlla/can_bus_error_reporting
network: can: add support for bus error reporting
2021-01-09 09:21:54 +09:00
Ulrich Ölmann
77b674049b network: can: add support for bus error reporting
Enhance systemd-networkd to be able to control a CAN device's berr-reporting
flag via the new boolean directive BusErrorReporting= to be used in network
files.
2021-01-08 20:23:12 +01:00
Yu Watanabe
0b5dc24953 test-network: add tests for route advmss 2021-01-09 00:01:53 +09:00
Susant Sahani
007cac09a2 network: route - add support to configure tcp advmss 2021-01-08 14:06:13 +00:00
Susant Sahani
0a9fb9bad8 network: Allow to set device's receive queues and transmit queues 2021-01-05 12:46:28 +09:00
Luca Boccassi
eb3785f367 tests: add TEST_PREFER_NSPAWN variable to run as many as possible under nspawn
By default the test suite prefers qemu, and uses nspawn only if
a test specifically says it doesn't support qemu.
Add a variable to allow flipping the default, and run as many
tests under nspawn as possible.
2021-01-01 21:33:16 +00:00
Luca Boccassi
51d56d3be0 tests: add TEST_QEMU_ONLY variable to run only tests where qemu is mandatory
Allows to split the test run in two parts. Most tests can run under
nspawn which is much faster, and they can be ran in one chunk with
TEST_NO_QEMU=1. The qemu-only tests, which are just a handful, can
be ran in another chunk with TEST_QEMU_ONLY=1.

Allows autopkgtest to be split in two parts.
2021-01-01 21:33:16 +00:00
Luca Boccassi
84d9358586 Do not run ninja in run-integration-tests.sh
It is typically ran as root, while builds are done as normal users.
It is documented anyway to build beforehand.
2021-01-01 21:33:16 +00:00
Luca Boccassi
aeac20fc69 test: shortcut skip if both TEST_NO_QEMU and TEST_NO_NSPAWN are set
Allows to run all tests in bulk with TEST_NO_QEMU, skipping those where it is
mandatory, without wasting time building the image.
2021-01-01 21:33:16 +00:00
Luca Boccassi
0515e4c17d test: check for binariers in [usr/][s]bin
The image build function greps for ExecStart lines in unit files, but some
of them (eg: systemd-firstboot) do not use a full path.
It then falls back to 'type -P' but that only works if you have the binary
installed. For optional binaries like systemd-firstboot, the installation
can then fail.

Manually check if the binary already exists in /[usr/][s]bin.
2021-01-01 21:33:16 +00:00
Luca Boccassi
53a1c94480 test: use pkg-config to get user unit dir when installing dbus user socket
Usually on Debian ROOTLIBDIR is /lib/<arch triplet>, which is not the right place.
Use pkg-config since we define it, and then fallback to /usr/lib/systemd/user which is
the canonical location.
On both Debian&friends and Fedora dbus/dbus-broker install the user socket/service
under /usr/lib/systemd/user, not /lib/systemd/systemd/user.
2021-01-01 21:33:16 +00:00
Luca Boccassi
bb64bec589 test: update test_create_image
Run mask_supporting_services, which was missing, and remove setup_nspawn_root which
is now already called outside test_create_image
2021-01-01 21:33:16 +00:00
Luca Boccassi
68147f9371
Merge pull request #18109 from yuwata/network-routing-policy-rule-family-both-fixes
network: fixes related to Family=both in [RoutingPolicyRule]
2020-12-30 11:27:24 +00:00
Yu Watanabe
ae45e1a383 resolve: slightly optimize dns_answer_add()
Previously, dns_answer_add() was O(n^2).
With this change dns_packet_extract() becomes ~15 times faster for some
extremal case.

Before:
```
$ time ./fuzz-dns-packet ~/downloads/clusterfuzz-testcase-minimized-fuzz-dns-packet-5631106733047808
/home/watanabe/downloads/clusterfuzz-testcase-minimized-fuzz-dns-packet-5631106733047808... ok

real    0m15.453s
user    0m15.430s
sys     0m0.007s
```

After:
```
$ time ./fuzz-dns-packet ~/downloads/clusterfuzz-testcase-minimized-fuzz-dns-packet-5631106733047808
/home/watanabe/downloads/clusterfuzz-testcase-minimized-fuzz-dns-packet-5631106733047808... ok

real    0m0.831s
user    0m0.824s
sys     0m0.006s
```

Hopefully fixes oss-fuzz#19227.
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19227
2020-12-30 04:14:22 +09:00
Yu Watanabe
49ff3f34d5 test-network: add tests for fib rules with Family=both vs networkctl reload or reconfigure 2020-12-30 03:32:07 +09:00
Yu Watanabe
1e5fd3216a network: set FRA_PROTOCOL to RTPROT_STATIC by default 2020-12-29 16:03:26 +09:00
Yu Watanabe
635f2a6692 test-network: add tests for [IPv6AcceptRA] PrefixDenyList= or friends 2020-12-24 17:16:15 +09:00
Yu Watanabe
75d2641190 network: introduce RouterAllowList= and RouterDenyList= in [IPv6AcceptRA] 2020-12-24 17:16:15 +09:00
Susant Sahani
de6b6ff84c networkd: add support for prefix allow-list and route allow-list 2020-12-24 17:16:13 +09:00
Yu Watanabe
3f0af4a5f9 network: rename DenyList= -> PrefixDenyList= 2020-12-24 17:15:44 +09:00
Yu Watanabe
8786d4bbe4 journal-importer: ignore invalid field at one more place
Fixes oss-fuzz#28817.
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28817
2020-12-21 12:40:44 +00:00
Luca Boccassi
92fa741cf2 test: fix regex in run-integration-tests.sh
The regex results in calls of "make setup run -again" which is broken
2020-12-19 21:56:57 +00:00
Luca Boccassi
b382b8de1e test: use deny-list in run-integration-tests.sh
The old env var doesn't seem to be used anywhere, and the script
currently doesn't work, so it seems safe to change immediately
2020-12-19 21:56:57 +00:00
Devon Pringle
16c89e649d networkd: add RouteDenyList
Allow configuration for IPv6 discovered routes to be ignored instead of
adding them as a route. This can be used to block unwanted routes, for
example, you may wish to not receive some set of routes on an interface
if they are causing issues.
2020-12-18 21:44:32 +09:00
Yu Watanabe
af42881bf9
Merge pull request #18015 from keszybz/dmi-test-mesonification2
Dmi test mesonification2
2020-12-18 21:44:00 +09:00
Susant Sahani
d7d1d18fd2
network: Allow to configure unreachable/blackhole RoutingPolicyRule (#17984) 2020-12-18 12:21:15 +09:00
Lennart Poettering
a60d5b2f38 test: add tpm2 and fido2 libs to dlopen test 2020-12-17 20:02:24 +01:00
Zbigniew Jędrzejewski-Szmek
7bbdef621f test: add one more dmidecode dump 2020-12-17 09:21:31 +01:00
Zbigniew Jędrzejewski-Szmek
2b7b142e97 meson: make each dmidecode a separate test
This allows them to be executed in parallel and also gives us
better reporting.

The dump files are renamed to avoid repeating "dmidecode-dump", since that
string is already present in the subdirectory name.
2020-12-17 09:21:29 +01:00
Zbigniew Jędrzejewski-Szmek
68f18549c5
Merge pull request #18001 from systemd/wip/hadess/unsupported-dmi
meson: Disable dmi_memory_id on arches without DMI
2020-12-17 09:16:33 +01:00
Frantisek Sumsal
0ce96f4152
Merge pull request #17998 from mrc0mmand/qemu-drop-trailing-whitespace
test: drop the trailing whitespace from the QEMU version check
2020-12-16 23:48:17 +01:00
Bastien Nocera
2bfb92a978 meson: Disable dmi_memory_id on arches without DMI 2020-12-16 19:21:19 +01:00
Bastien Nocera
4dd465cb4e udev: Extract RAM properties from DMI information
Add memory_id program to set properties about the physical memory
devices in the system. This is useful on machines with removable memory
modules to show how the machine can be upgraded, and on all devices to
detect the actual RAM size, without relying on the OS accessible amount.

Closes: #16651
2020-12-16 18:32:29 +01:00
Yu Watanabe
84a1ff9457 tree-wide: fix typo 2020-12-16 18:30:15 +01:00
Zbigniew Jędrzejewski-Szmek
199f75205b
Merge pull request #17799 from yuwata/oss-fuzz-25353
logs-show: skip non-utf8 name entries
2020-12-16 17:52:35 +01:00
Frantisek Sumsal
26b127245a test: s/MUMA/NUMA/ 2020-12-16 16:38:44 +01:00
Frantisek Sumsal
f26d091460 test: drop the trailing whitespace from the QEMU version check
I suspect the original version of the regex was written on a system,
which prints both the QEMU version and the QEMU package version in the
--version output, like Fedora:

$ /bin/qemu-system-x86_64 --version
QEMU emulator version 4.2.1 (qemu-4.2.1-1.fc32)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers

However, Arch Linux prints only the QEMU version:
$ /bin/qemu-system-x86_64 --version
QEMU emulator version 5.2.0
Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers

This causes the awk regex to not match the version string, since there's
no whitespace after it, causing the version check to fail (as well as the
TEST-36-NUMAPOLICY) as well.

Follow-up for 43b49470d1.
2020-12-16 16:38:26 +01:00
Yu Watanabe
a7c52e1ee1
Merge pull request #17968 from yuwata/purge-libudev
udev: do not link with libudev
2020-12-16 12:07:46 +09:00
Susant Sahani
937e305e93 network: Allow to configure interface promiscuous mode 2020-12-15 20:25:08 +00:00
Christian Ehrhardt
43b49470d1 test: use modern qemu numa arguments
Upgrading to qemu 5.2 breaks TEST-36-NUMAPOLICY like:
  qemu-system-x86_64: total memory for NUMA nodes (0x0) should
  equal RAM size (0x20000000)

Use the new (as in >=2014) form of memdev in test 36:
 -object memory-backend-ram,id=mem0,size=512M -numa node,memdev=mem0,nodeid=0

Since some target systems are as old as qemu 1.5.3 (CentOS7) but the new
kind to specify was added in qemu 2.1 this needs to add version parsing and
add the argument only when qemu is >=5.2.

Fixes #17986.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2020-12-16 05:16:41 +09:00
Yu Watanabe
f2bd032044 journal: refuse data which contain invalid fields
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25353.
2020-12-16 04:56:35 +09:00
Yu Watanabe
90ac73eb1b rules: drop broken links 2020-12-16 02:31:44 +09:00
Dan Streetman
b226c15cfb test-network: increase wait_online timeout to handle longer dhcpv4 transient timeout
Previous commits changed the dhcpv4 retransmission algorithm to be
slightly slower, changing the amount of time it takes to notify
systemd-networkd that the dhcpv4 configuration has (transiently)
failed from around 14 second up to 28 seconds.

Since the test_dhcp_client_with_ipv4ll_without_dhcp_server test
configures an interface to use dhcpv4 without any operating dhcpv4
server running, it must increase the amount of time it waits for
the test interface to reach degraded state.
2020-12-14 18:19:32 -05:00
Yu Watanabe
28423d9a75 tree-wide: fix typo 2020-12-14 12:05:55 +00:00
Yu Watanabe
8d80f27530 sd-device: make TAGS= property prefixed and suffixed with ":"
The commit 6f3ac0d517 drops the prefix and
suffix in TAGS= property. But there exists several rules that have like
`TAGS=="*:tag:*"`. So, the property must be always prefixed and suffixed
with ":".

Fixes #17930.
2020-12-14 14:04:53 +09:00
Zbigniew Jędrzejewski-Szmek
6bfbfce795 networkd-test: add final newlines in generated files, use .format() 2020-12-10 14:31:39 +09:00
Luca Boccassi
b7fca1b059 test: pull in weak deps into tests
(Pulled from @bluca's comment here:
https://github.com/systemd/systemd/pull/17884#issuecomment-740005624 and
turned into a commit by @poettering)
2020-12-09 13:34:49 +01:00
Yu Watanabe
6f3ac0d517 sd-device: use set_strjoin()
This slightly changes TAGS= and CURRENT_TAGS= properties:

Before
E: TAGS=:aaa:bbb:

After
E: TAGS=aaa:bbb
2020-12-08 12:28:58 +09:00
Luca Boccassi
32c7f02bb4
Merge pull request #17829 from anitazha/testoomdfix
test: fix TEST-56-OOMD thresholds for linux 5.9 changes
2020-12-04 12:22:46 +00:00
Yu Watanabe
452d86a532 test-network: add tests for IPv6 routes with reject type 2020-12-04 16:50:35 +09:00
Yu Watanabe
37b9c79e5d test-network: sleep 1s after reloading configs
As interfaces will be reconfigured asynchronously after `networkctl reload`.
So, right after `networkctl reload` is finished, interfaces may be still
in 'configured' state with the old .network files.
2020-12-04 11:28:52 +09:00
Lennart Poettering
6dd16814a5
Merge pull request #17079 from keszybz/late-exec-resolution
Resolve executable paths before execution, use fexecve()
2020-12-03 14:58:20 +01:00
Anita Zhang
14d044da23 test: fix TEST-56-OOMD thresholds for linux 5.9 changes
Fixes #17533

The memory pressure values of the units in TEST-56-OOMD seemed to be a
lot lower after updating to linux 5.9. This is likely due to a fix from
e22c6ed90a.

To account for this, I lowered memory.high on testbloat.service to
throttle it even more. This was enough to generate the 50%+ value to trigger
oomd for the test, but as an extra precaution I also lowered the oomd
threshold to 1% so it's certain to try and kill testbloat.service.
2020-12-02 15:27:15 -08:00
Zbigniew Jędrzejewski-Szmek
efbbdf2923
Merge pull request #17798 from yuwata/ipv4ll-follow-ups
network: improve debug logs and add tests for IPv4LL
2020-12-02 14:59:33 +01:00
walbit-de
2d453f3597
network: add Protocol= to vlan netdev (#17794) 2020-12-02 14:58:02 +01:00
Yu Watanabe
da115b935a tree-wide: fix typos 2020-12-02 10:53:33 +01:00
Yu Watanabe
240e41372e test-network: confirm that IPv4ll address is dropped after DHCPv4 lease is acquired 2020-12-02 18:50:13 +09:00
Zbigniew Jędrzejewski-Szmek
0107b769b1 networkd: start ipv4ll when dhcp has trouble getting a lease
Fixes #13316.
2020-11-30 12:37:36 +09:00
Zbigniew Jędrzejewski-Szmek
3ca1fab70a networkd: merge ll addressing fallback modes into normal "boolean" values
They are not really boolean, because we have both ipv4 and ipv6, but
for each protocol we have either unset, no, and yes.

From https://github.com/systemd/systemd/issues/13316#issuecomment-582906817:
LinkLocalAddressing must be a boolean option, at least for ipv4:
- LinkLocalAddressing=no => no LL at all.

- LinkLocalAddressing=yes + Static Address => invalid configuration, warn and
  interpret as LinkLocalAddressing=no, no LL at all.

(we check that during parsing and reject)

- LinkLocalAddressing=yes + DHCP => LL process should be subordinated to the
  DHCP one, an LL address must be acquired at start or after a short N
  unsuccessful DHCP attemps, and must not stop DHCP to keeping trying. When a
  DHCP address is acquired, drop the LL address. If the DHCP address is lost,
  re-adquire a new LL address.

(next patch will move in this direction)

- LinkLocalAddressing=fallback has no reason to exist, because LL address must
  always be allocated as a fallback option when using DHCP. Having both DHCP
  and LL address at the same time is an RFC violation, so
  LinkLocalAdressing=yes correctly implemented is already the "fallback"
  behavior. The fallback option must be deprecated and if present in older
  configs must be interpreted as LinkLocalAddressing=yes.

(removed)

- And for IPv6, the LinkLocalAddress option has any sense at all? IPv6-LL
  address aren't required to be always set for every IPv6 enabled interface (in
  this case, coexisting with static or dynamic address if any)? Shouldn't be
  always =yes?

(good question)

This effectively reverts 29e81083bd. There is no
special "fallback" mode now, so the check doesn't make sense anymore.
2020-11-30 12:37:36 +09:00
Yu Watanabe
dca63b5b46
Merge pull request #17474 from yuwata/network-drop-link-deserialization-logic
network: drop link deserialization logic
2020-11-27 09:08:01 +09:00
Pavel Sapezhko
6d8325f66a resolved: allow cache responses from local DNS servers 2020-11-27 09:03:42 +09:00
Lennart Poettering
e2c5e698c0 mkosi: make sure our mkosi files work with f33 2020-11-25 13:18:36 +01:00
Dan Streetman
3965279c67 test/test-functions: copy /usr/lib/pam.d into $initdir
The systemd-user file has been moved from /etc/pam.d into /usr/lib/pam.d,
so test-functions needs to copy it from /usr/lib/pam.d instead.

This will copy it from either location.
2020-11-23 17:17:19 -05:00
Zbigniew Jędrzejewski-Szmek
d407638382 test/udev-test: gracefully exit when imports fail
In Fedora rawhide various perl modules are now available as separate
packages that are not pulled in by dependencies. If we don't have some
package, skip the tests.

This ugly code is apparently the way to do conditional imports:
https://www.cs.ait.ac.th/~on/O/oreilly/perl/cookbook/ch12_03.htm.
2020-11-18 03:50:17 +09:00
Zbigniew Jędrzejewski-Szmek
ffe3533eb7
Merge pull request #17599 from yuwata/meson-fuzz-tests
meson: do not build fuzzers when -Dfuzz-tests=false
2020-11-17 10:16:47 +01:00
Yu Watanabe
1763ef1d49 meson: do not build fuzzers when fuzz-tests=false
Closes #17578.
2020-11-13 18:15:37 +09:00
Yu Watanabe
d3f044ddf4 test: fix typo 2020-11-13 16:29:00 +09:00
Yu Watanabe
faa73d4e0c license: LGPL-2.1+ -> LGPL-2.1-or-later
Follow-up for db9ecf0501.
2020-11-12 10:50:23 +01:00
Lennart Poettering
394131d5be
Merge pull request #17497 from anitazha/randomizeonce
timer: add new feature FixedRandomDelay=
2020-11-10 13:29:04 +01:00
Zbigniew Jędrzejewski-Szmek
b8aac5014c
Merge pull request #17431 from msekletar/udev-link-update-race
udev: make algorithm that selects highest priority devlink less susceptible to race conditions
2020-11-10 09:41:57 +01:00
Yu Watanabe
db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Zbigniew Jędrzejewski-Szmek
f98ca3a11d test-execute: make sure shell execs the child
echo is a built-in, so we were testing execve in our own code, and not in
the running child.
2020-11-06 15:20:34 +01:00
Zbigniew Jędrzejewski-Szmek
a6d9111c67 core/execute: fall back to execve() for scripts
fexecve() fails with ENOENT and we need a fallback. Add appropriate test.
2020-11-06 15:14:13 +01:00
Kristijan Gjoshev
acf24a1a84 timer: add new feature FixedRandomDelay=
FixedRandomDelay=yes will use
`siphash24(sd_id128_get_machine() || MANAGER_IS_SYSTEM(m) || getuid() || u->id)`,
where || is concatenation, instead of a random number to choose a value between
0 and RandomizedDelaySec= as the timer delay.
This essentially sets up a fixed, but seemingly random, offset for each timer
iteration rather than having a random offset recalculated each time it fires.

Closes #10355

Co-author: Anita Zhang <the.anitazha@gmail.com>
2020-11-05 10:59:33 -08:00
Martin Wilck
dec8e6cfb4 test/sys-script.py: add missing DEVNAME entries to uevents 2020-11-02 11:43:15 +01:00
Martin Wilck
cbeb23d863 test/udev_test.pl: add "expected good" count
Since 'test/udev-test.pl: count "good" results', we know how many
checks succeeded. Add an "expected good" count to make that number
more meaningful.
2020-11-02 11:43:15 +01:00
Martin Wilck
f1cb086054 test/udev-test.pl: suppress umount error message at startup
umount emits an error message "no mount point specified" if the
tmpfs isn't mounted yet, which is the normal case.
Suppress that by redirecting stderr.
2020-11-02 11:43:15 +01:00
Martin Wilck
0ed1b64469 test/sd-script.py: new helper script for udev testing
Script for generating LOTS of SCSI disk and partition devices in
the fake sysfs we use for udev testing.

This script is supposed to be run after sys-script.py. It uses
code from sys-script.py as template to generate additional SCSI disk data
structures. Together with the "generator" code in udev-test.pl
added in the previous patch, it allows to run udev tests with almost
arbitrarily many devices, and thus to do performance scaling tests.
2020-11-02 11:43:15 +01:00
Martin Wilck
eb44d715eb test/udev-test.pl: generator for large list of block devices
Manually listing all devices in the test definition becomes cumbersome with
lots of devices. Add a function that scans on all block devices in
the test sysfs and generates a list of devices to test.
2020-11-02 11:43:15 +01:00
Martin Wilck
2ab0a8d00b test/udev-test.pl: add repeat count
for easier reproduction of sporadic test failures.
2020-11-02 11:43:15 +01:00
Martin Wilck
4a0ec82daf tests/udev-test.pl: add multiple device test
Add 4 new tests using multiple devices. Number 2-4 use many
devices claiming the same symlink, where only one device has
a higher priority thatn the others. They fail sporadically with
the current code, if a race condition causes the symlink to point
to the wrong device. Test 4 is like test 2 with sleeps in between,
it's much less likely to fail.
2020-11-02 11:43:15 +01:00
Martin Wilck
b95c43982a test/udev-test.pl: count "good" results
This is helpful to catch possible regressions in the test.
Also, don't count wait() errors, they are likely not udev errors.
2020-11-02 11:43:15 +01:00
Martin Wilck
a96cd21d31 test/udev-test.pl: merge import parent tests into one
As we can test multiple devices and multiple links per device
in one test now, these two tests can be merged into one.
2020-11-02 11:43:15 +01:00
Martin Wilck
2084fe0d32 test/udev-test.pl: merge "space and var with space" tests
As we can check multiple links in a single test now, these 3
tests can be merged into one.
2020-11-02 11:43:15 +01:00
Martin Wilck
86634df43b test/udev-test.pl: remove bogus rules from magic subsys test
These rules have survived from an ancient version of the code
and save no purpose any more.
2020-11-02 11:43:14 +01:00
Martin Wilck
06d4d4e24e test/udev-test.pl: Make some tests a little harder
Add some rules that make it a bit harder to pass, mainly the
non-existence checks.
2020-11-02 11:43:14 +01:00
Martin Wilck
17cce03153 test/udev-test.pl: last_rule is unsupported
the "last_rule" option hasn't been supported for some time.
Therefore this test fails if a "not_exp_links" attribute is added,
as it should be. Mark it appropriately.
2020-11-02 11:43:14 +01:00
Martin Wilck
46bc71b2b7 test/udev-test.pl: fix wrong test descriptions
udev hasn't supported renaming device nodes for some time.
2020-11-02 11:43:14 +01:00
Martin Wilck
e62acc3159 test/udev-test.pl: allow checking multiple symlinks
Instead of testing the existence or non-exisitence of just a single
symlink, allow testing of several links per device.

Change the test definitions accordingly.
2020-11-02 11:43:14 +01:00
Martin Wilck
997683c8f1 test/udev-test.pl: test correctness of symlink targets
Test if symlinks are created correctly by comparing the symlink
targets to the devnode path. This implies (for the symlink) that
major/minor numbers and permissions are correct, as we have tested
that on the devnode already.
2020-11-02 11:43:14 +01:00
Martin Wilck
f0dccf01a7 test/udev-test.pl: use computed devnode name
More often than not, the created devnode is the basename of the
sysfs entry. The "devnode" device may be used to override the
auto-detected node name.

Permissions and major/minor number are now verified on the devnode
itself, not on symlinks.

For those tests where exp_name is set to the computed devnode name,
the explicit "exp_name" can be removed. "exp_name" is only required for
symlinks.

This allows separate testing for devnodes and symlinks an a follow-up
patch.
2020-11-02 11:43:14 +01:00
Martin Wilck
09a4062d70 test/udev-test.pl: allow concurrent additions and removals
Allow testing cases where multiple devices are added and removed
simultaneously. Tests are started as synchronously as possible using a
semaphore, in order to test possible race conditions. If this isn't desired,
the test parameter "sleep_us" can be set to the number of microseconds to wait
between udev invocations.
2020-11-02 11:43:14 +01:00
Martin Wilck
af7ee3eae6 test/udev-test.pl: create rules only once
It's not necessary to write the rules for every udev run, as we
now may have many (rather than just 2) per test.
2020-11-02 11:43:14 +01:00
Martin Wilck
255c05b724 test/udev-test.pl: allow multiple devices per test
Allow testing cases where multiple devices are added and removed.
This implies a change of the data structure: every test allows
for multiple devices to be added, and "exp_name" etc. are now properties
of the device, not of the test.
2020-11-02 11:43:14 +01:00
Yu Watanabe
7b829a7b3b network: do not serialize/deserialize addresses
The link state file is always removed when networkd is stopping. So,
the deserialization logic does not work. Moreover, the ADDRESSES=
entry is not used by sd-network, so serialization is also not necessary.
2020-10-28 18:15:57 +09:00
Zbigniew Jędrzejewski-Szmek
c37a43d2dd
Merge pull request #17438 from anitazha/systoomd_quick
Additional fix ups from #17417
2020-10-27 18:43:34 +01:00
Yu Watanabe
80762cccdc test-network: add a test case for DNSSL in RA
Closes #4590.
2020-10-24 14:08:51 +02:00