1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-18 21:57:48 +03:00

55855 Commits

Author SHA1 Message Date
Yu Watanabe
073ad7ed1f test-network: wait for a while if manual policy is always-{up,down}
If wait_operstate() is called super quickly after ip command, then the
up/down state may not be changed and propagated to networkd, and
wait_operstate() mistakenly pass with the previous state.

To avoid such situation, wait for a while to make networkd actually
detect the interface brought up/down.
2022-01-28 07:29:37 +09:00
Yu Watanabe
ebb5036ff2 test-network: dummy interface is initially down when activation policy is manual 2022-01-28 07:17:08 +09:00
Yu Watanabe
cfbdc4387f test-network: wait for the link is activated
This fixes the following race:
1. when a dummy interface is created, it is initially down state,
2. hence, wait_operstate() may pass before the link is activated,
3. and the ip command bring up the interface before the activation,
4. and networkd activates, that is, brings down the interface,
5. thus, next wait_operstate() timedout, as it waits for the interface up.

To fix the race, let's wait the link is activated, before enter the loop
of wait_operstate().

Fixes #22267.
2022-01-28 07:02:03 +09:00
Yu Watanabe
b67f3d73b0 test-network: always cleanup the testing environment
Previously, if a subtest fail, then the cleanup process does not run,
and affects the subsequent tests.
2022-01-28 06:59:52 +09:00
Yu Watanabe
e6d31fc97a tree-wide: fix typo 2022-01-28 04:47:39 +09:00
Yu Watanabe
33db66aa36
Merge pull request #22132 from joanbm/main
resolved: Fix DoT timeout on multiple answer records (for CloudFlare, Google, etc. DoT servers)
2022-01-28 04:23:34 +09:00
Yu Watanabe
d5dd3c26eb
Merge pull request #22262 from DaanDeMeyer/journal-fixes
Journal fixes
2022-01-28 04:15:11 +09:00
Daan De Meyer
d93abf465b journal: Truncate file instead of punching hole in final object
Instead of punching a hole in the final object if it's an entry array,
let's just truncate the file instead.
2022-01-27 15:21:37 +00:00
Daan De Meyer
3a787b5e29 journal: stat journal file after truncating
Let's make sure the data stored in last_stat is up-to-date after
truncating the journal file.
2022-01-27 14:46:59 +00:00
Yu Watanabe
2a97a4b374 test: initialize buffer to make Coverity silent
Follow-up for f82f0b993740f4a9a3719c4df7c185411710df2b.

Fixes CID#1469119.
2022-01-27 13:47:58 +00:00
Christian Brauner
7e7a9f9c8b NEWS: mention temporary limitations for running containers in systemd-homed directories 2022-01-27 10:15:56 +00:00
Yu Watanabe
a21440f6d6
Merge pull request #22259 from bluca/exec_cond_restart
core: do not restart a service with Restart=always when ExecCondition fails
2022-01-27 15:09:47 +09:00
Joan Bruguera
726bcd81b9 resolved: Test for DnsStream (plain TCP DNS and DoT)
Tests DnsStream event handling, both for plain TCP DNS and DNS over TLS.

The DoT test requires the "openssl s_server" command line tool to mock a simple
TLS server. Thus the test's TLS part is skipped if openssl it not available.
The test works for both DNS_OVER_TLS_USE_GNUTLS and DNS_OVER_TLS_USE_OPENSSL.

The DoT case fails due to a bug, which is fixed on the next commit.
2022-01-27 14:33:56 +09:00
Joan Bruguera
2aaf6bb6e9 resolved: Fix DoT timeout on multiple answer records
When sending multiple DNS questions to a DNS-over-TLS server (e.g. a question
for A and AAAA records, as is typical) on the same session, the server may
answer to each question in a separate TLS record, but it may also aggregate
multiple answers in a single TLS record.
(Some servers do this very often (e.g. Cloudflare 1.0.0.1), some do it sometimes
(e.g. Google 8.8.8.8) and some seem to never do it (e.g. Quad9 9.9.9.10)).

Both cases should be handled equivalently, as the byte stream is the same, but
when multiple answers came in a single TLS record, usually the first answer was
processed, but the second answer was entirely ignored, which caused a 10s delay
until the resolution timed out and the missing question was retried.
This can be reproduced by configuring one of the offending server and running
`resolvectl query google.com --cache=no` a few times.

To be notified of incoming data, systemd-resolved listens to `EPOLLIN` events
on the underlying socket. However, when DNS-over-TLS is used, the TLS library
(OpenSSL or GnuTLS) may read and buffer the entire TLS record when reading the
first answer, so usually no further `EPOLLIN` events will be generated, and the
second answer will never be processed.

To avoid this, if there's buffered TLS data, generate a "fake" EPOLLIN event.
This is hacky, but it makes this case transparent to the rest of the IO code.
2022-01-27 14:33:28 +09:00
Arfrever Frehtes Taifersar Arahesis
a42a93830f logind.conf: Fix name of option: RuntimeDirectoryInodes -> RuntimeDirectoryInodesMax 2022-01-27 14:04:44 +09:00
Evgeny Vereshchagin
b28d06e059 tests: fuzz dhcp_server_relay_message
It's a follow-up to https://github.com/systemd/systemd/pull/19384 where
dhcp_server_relay_message was introduced.

This PR was prompted by https://github.com/systemd/systemd/pull/22236#issuecomment-1020113269
for the most part.
2022-01-27 13:49:36 +09:00
Anita Zhang
1d3b68f6e1 tree-wide: don't use strjoina() on getenv() values
Avoid doing stack allocations on environment variables.
2022-01-27 13:45:00 +09:00
Erik Sjölund
f223fd6add docs: fix typos and improve language
Fix typos and improve the language by
adding a few commas and a missing word.
2022-01-26 22:35:33 +00:00
Rike-Benjamin Schuppner
b6d2f0338e man: Fix paths for user units (transient/generator.early) 2022-01-26 22:35:22 +00:00
Luca Boccassi
3a5cd7dd8d
Merge pull request #22251 from medhefgo/boot-cleanup
boot: Small improvements
2022-01-26 22:34:32 +00:00
Daan De Meyer
8bad545354 journal: Stop comparing hash values from entry items against data objects
These checks don't achieve anything of value. Assuming they were added to
check for corruption, they don't actually achieve this goal since other parts
of the data object can still get corrupted and we wouldn't notice unless we'd
recalculate the hash every time.

In theory, we could use the entry item hash to avoid a random access lookup
for the data object hash in the journal file in the future to speed up searching,
but for finding all entry objects containing a specific data objects, we already
have entry arrays per data object to get fast access to this information.

This means that duplicating the hashes in the entry item doesn't result in any
added value. In this commit, we remove the checks so that in future commits we
can remove the hashes from the journal file format in the new compact mode.
2022-01-26 20:16:00 +00:00
Daan De Meyer
c710944c83 journal: Inline loop variable 2022-01-26 20:16:00 +00:00
Daan De Meyer
578cd1855b journal: Invert verify entry <=> data consistency checks
Previously, for each entry in a data object's entry array, we'd check
if one of that entry's entry items referred to the data object.

Instead, when verifying the main entry array, let's check if for each
entry item found by iterating the main entry array, the corresponding
data object's entry array refers to that entry.

This enables us to re-use more code from journal-file and turns out to
be roughly 10s faster when verifying my 4G laptop journal.

When verifying data objects, we still check if every entry in the data
object's entry array also exists in the main entry array so that we ensure
we're not missing any entries when iterating the main entry array.
2022-01-26 20:16:00 +00:00
Daan De Meyer
df53536435 journal: Fail gracefully when linking a new entry
Let's always try to link all entry items even if linking one fails
due to not being able to allocate a new entry array. Other entry
items might still be successfully linked if the entry array of the
corresponding data object isn't full yet.
2022-01-26 20:16:00 +00:00
Daan De Meyer
910eb3c063 journal: Use ret_offset everywhere in journal-file.h 2022-01-26 20:16:00 +00:00
Daan De Meyer
ded10e3a5f journal: Only move to objects when necessary
Let's make sure we only move to objects when it's required. If "ret"
is NULL, the caller isn't interested in the actual object and the
function being called shouldn't move to it unless it has to
inspect/modify the object itself.
2022-01-26 20:16:00 +00:00
Daan De Meyer
ec50313d4e journal: Pass data objects to journal_file_move_to_entry_..._for_data() functions
This reduces the number of calls to journal_file_move_to_object() which are heavy.
All call sites have easy access to the data object so this change doesn't end up
complicating things.
2022-01-26 20:16:00 +00:00
Daan De Meyer
57e97246cd journal: Log error when keyed hash env variable cannot be parsed 2022-01-26 20:16:00 +00:00
Daan De Meyer
3a8099a871 journal: Use offsetof(Object, ...) to retrieve object field offsets
We currently use both offsetof(Object, ...) and offsetof(DataObject, ...).
This makes it harder to grep for usages as we have to make sure we grep for
both usages. Let's unify these all to use offsetof(Object, ...) to make it
easier to grep for usages.
2022-01-26 20:16:00 +00:00
Luca Boccassi
429cddbaf1 NEWS: note breaking change w.r.t. Restart=always and ExecCondition= 2022-01-26 19:03:34 +00:00
Luca Boccassi
abb99360d3 core: do not restart a service with Restart=always when ExecCondition fails
When a Condition*= fails, and a service has Restart=always,
the service is not restarted.
Follow the same behaviour for ExecCondition= to avoid inconsistencies.

Fixes #22257
2022-01-26 19:02:11 +00:00
Jan Janssen
1926a11439 boot: Add screen resolution to print status 2022-01-26 18:07:00 +01:00
Jan Janssen
c323c2f63c boot: Also NUL-terminate for CHAR16 in file_reaad 2022-01-26 18:07:00 +01:00
Jan Janssen
20a734726e boot: Use ASSERT_PTR 2022-01-26 18:07:00 +01:00
Jan Janssen
83d905b7b4 boot: Optimize unique title generation 2022-01-26 18:06:52 +01:00
Yu Watanabe
9d3bb25b2d
Merge pull request #22252 from medhefgo/boot-build
meson: Boot build/test changes
2022-01-27 01:32:04 +09:00
Yu Watanabe
58ceeb844d
Merge pull request #22249 from yuwata/wait-online-fix-unmanaged-state
wait-online: fix handling of unmanaged state
2022-01-27 01:17:12 +09:00
Daan De Meyer
f82f0b9937 shared: Ensure COPY_HOLES copies trailing holes
Previously, files with a hole at the end would get silently truncated
which breaks reading journal files. This commit makes sure that holes
are punched in existing space and if no more space is available, that
we grow the file and the hole by using ftruncate().

The corresponding test is extended to put a hole at the end of the file
and we make sure that hole is copied correctly.
2022-01-27 01:15:22 +09:00
Yu Watanabe
cd7fcda543 wait-online: make manager_link_is_online() return 0 when in unmanaged state
Previously, even if a link is in unmanaged state, the function may
returns positive value. So, even if all managed links are in the configured
sate but do not satisfy the online criteria, e.g., IPv4 address state,
then wait-online finishes with positive value.

This makes the function always return 0 for unmanaged state. So, at
least one managed link must satisfies the online criteria.

This also adds more comments and debugging logs.

Fixes #22246.
2022-01-26 22:41:47 +09:00
Yu Watanabe
5f200833ed wait-online: rename Manager elements 2022-01-26 22:41:47 +09:00
Jan Janssen
7afd0196b6 meson: Use --no-wchar-size-warning
This only disables the one warning that we care to ignore, making
sure that any future issues do not get masked.
2022-01-26 14:40:55 +01:00
Jan Janssen
b6167d9611 meson: Use same name format for efi binary intermediates 2022-01-26 14:40:55 +01:00
Jan Janssen
b2ba8511e6 meson: Remove test-efi-create-disk.sh
The script was probably not used for a very long time. It is currently
passed systemd_boot.so as boot loader, which cannot work. The test
entries it creates are all pointing at non-existant efi/linux binaries,
which means they would not even show up in the menu if the created image
were actually booted. There is also nothing that actually tries to run
the image in the first place.

If we end up creating a proper systemd-boot test suite, it would be
better to start from scratch. In the meantime, mkosi already covers
the bare minimum with a simple bootup test.
2022-01-26 14:40:51 +01:00
Luca Boccassi
e3f7ed944a portable: add flag to return extension-releases in GetImageMetadataWithExtensions
Return the name of each extension and the associated extension-release
file, and pretty-print them in 'portablectl inspect', if a new flag
is passed.

$ portablectl inspect --extension app2 --extension app0  minimal app0 app1
(Matching unit files with prefixes 'app0', 'app1'.)
Image:
        /run/portables/minimal.raw
Portable Service:
        n/a
Operating System:
        Debian GNU/Linux 10 (buster)
Extension:
        /run/portables/app2.raw
        Extension Scope:
                n/a
        Extension Compatibility Level:
                n/a
        Portable Service:
                n/a
        Portable Prefixes:
                n/a
        Operating System:
                n/a (debian 10)
Extension:
        /run/portables/app0.raw
        Extension Scope:
                n/a
        Extension Compatibility Level:
                n/a
        Portable Service:
                n/a
        Portable Prefixes:
                n/a
        Operating System:
                n/a (debian 10)
Unit files:
        app0.service
2022-01-25 22:22:47 +00:00
Luca Boccassi
0017415cc5 portable: add GetImageStateWithExtensions method
Allow to correctly query a layered portable service for
attached/detached state.
2022-01-25 06:44:27 +09:00
Yu Watanabe
9697662915 hostname: expose hardware serial through dbus
Closes #22119.
2022-01-24 21:09:37 +00:00
Yu Watanabe
f338a496e4 NEWS: update 2022-01-25 03:03:09 +09:00
Yu Watanabe
1d2842d1e6 NEWS: mention about the regression in WireGuard 2022-01-25 02:56:20 +09:00
Yu Watanabe
0850fb78af
Merge pull request #22236 from yuwata/fuzz-dhcp-server
fuzz-dhcp-server: three fixes or improvements
2022-01-25 02:19:22 +09:00
Yu Watanabe
bf2a8b7b13 fuzz-dhcp-server: attach sd_event to make dhcp_server_cleanup_expired_leases() works in the fuzzer
Otherwise, most code paths in dhcp_server_handle_message() are not
evaluated by the fuzzer.
2022-01-25 00:05:02 +09:00