Commit Graph

48132 Commits

Author SHA1 Message Date
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
Yu Watanabe f01a3b79fa
Merge pull request #17810 from systemd/meson-allows-fuzzer-building
meson: always allow fuzzers to be built
2020-12-03 07:36:43 +09:00
Lennart Poettering 90df0fbea8 resolved: automatically flush caches on clock change
DNSSEC validation takes the system clock into account to validate
signatures. This means if we had incorrect time and the time is then
changed to the correct one we should flush out everything and
re-validate taking the new time into account.

(This logic will also trigger after system suspend, which is not bad
either, given that quite possibly we are connected to a different
network, and thus would get different DNS data, without us noticing
otherwise via link beat).
2020-12-03 07:25:17 +09:00
Christopher Obbard c8037dbf05 virt: Properly detect nested UML inside another hypervisor
UML runs as a user-process so it can quite easily be ran inside of
another hypervisor, for instance inside a KVM instance. UML passes
through the CPUID from the host machine so in this case detect_vm
incorrectly identifies as running under KVM. So check we are running
a UML kernel first, before we check any other hypervisors.

Resolves: #17754

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2020-12-03 07:19:41 +09:00
Lennart Poettering 0b261ac5be resolved: log when a bus client changes per-link DNS info
Fixes: #16298
2020-12-03 07:08:07 +09:00
Zbigniew Jędrzejewski-Szmek 4cbd28af60
Merge pull request #17804 from poettering/write-resolve-conf-less
write resolv.conf less often
2020-12-02 16:56:52 +01:00
Lennart Poettering 7e8a93b77c resolved: properly check per-link NTA list
We need to check for parent domains too. We did this correctly for the
system-wide NTA list, but not for the per-link one. Let's fix that.
2020-12-02 16:56:11 +01:00
Lennart Poettering d301c52383 resolved: bind socket to interface during connect()
Apparently, IF_UNICAST_IF does not influence the routing decisions done
during connect(). But SO_BINDTODEVICE/SO_BINDTOINDEX does, which however
brings a lot of other semantics with it, we are not so interested in
(i.e. it doesn't not allow packets from any other iface to us, even if
routing otherwise allows it).

Hence, let's bind to the ifindex immediately before the connect() and
unbind right after again, so that we get the semantics we want, but not
the ones we don't.

Fixes: #11935
Replaces: #12004
2020-12-02 15:15:02 +01:00
Lennart Poettering 3132597182 socket-util: add sockaddr_in_addr() helper
This extracts the IP address (as union in_addr_union) from a socket
address (i.e. a struct sockaddr).
2020-12-02 15:14:21 +01:00
Zbigniew Jędrzejewski-Szmek 9c2c6692f3
Merge pull request #17707 from yuwata/network-fix-reconfigure
network: fix race in reconfiguring link
2020-12-02 15:10:34 +01: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
Zbigniew Jędrzejewski-Szmek 7e299ffe10 meson: allow fuzzers to be built even if fuzz testing is disabled
This makes commands like 'ninja -C build fuzz-journal-remote' or
'ninja -C build fuzzers' work, even if we have -Dfuzz-tests=false.
Two advantages: correctness of the meson declarations is verified even
if fuzzers are not built, and it easier to do a one-off build to check for
regressions or such.

Follow-up for 1763ef1d49.
2020-12-02 13:51:31 +01:00
Yu Watanabe 59c31eba49 network: stop to assign UUID when reconfiguring link
This fixes the following race in reconfiguring link:
1. an interface requests UUID.
2. the interface is reconfigured and link_configure() is called.
3. sd-lldp client is started on the interface (it is enabled by default).
4. networkd acquires UUID, and get_product_uuid_handler() calls
   link_configure() for the link again.
5. link_lldp_rx_configure() fails to set ifindex for already running
   sd-lldp client.
6. the link enters failed state.
2020-12-02 20:31:39 +09:00
Yu Watanabe f63e09ef75 network: use bus_error_message() 2020-12-02 20:31:39 +09:00
Yu Watanabe 0f82a2ab5c meson: use '_' as separator in fuzz test names
Follow-up for d448888924 and ca121e20c4.

Fixes #17568.
2020-12-02 11:14:26 +01:00
Yu Watanabe da115b935a tree-wide: fix typos 2020-12-02 10:53:33 +01:00
Yu Watanabe 5f016e326d network: add debug log about requesting DHCP address
This addresses
https://github.com/systemd/systemd/pull/17474#discussion_r515996491.
2020-12-02 18:50:45 +09: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
Yu Watanabe 878c035a48 sd-ipv4acd: logs current state 2020-12-02 18:42:17 +09:00
Yu Watanabe 3f2c0d8520 sd-ipv4acd,sd-ipv4ll: include interface name in the debug logs 2020-12-02 18:42:13 +09:00
Yu Watanabe 1f1d4d42c1 log-link: introduce log_interface_full_errno() macro 2020-12-02 18:41:01 +09:00
Yu Watanabe 99b06a2f5c sd-ipv4acd,sd-ipv4ll: introduce _get_ifindex() and _get_ifname()
They will be used in later commits.

This also makes sd_ipv4acd_set_ifindex() check the existence of the interface.
2020-12-02 18:40:24 +09:00
Lennart Poettering f3e1f00d03 resolved: don't update resolv.conf snippets unnecessarily
Fixes: #17577
2020-12-02 10:32:17 +01:00
Lennart Poettering 1098142436 fs-util: add conservative_rename() that suppresses unnecessary renames
if the source and destination file match in contents and basic file
attributes, don#t rename, but just remove source.

This is a simple way to suppress inotify events + mtime changes when
atomically updating files.
2020-12-02 10:32:17 +01:00
Lennart Poettering b1b657c48f copy: teach copy_file() that a mode=-1 call means "take mode from original file" 2020-12-02 10:32:17 +01:00
Zbigniew Jędrzejewski-Szmek ebef02dd8f pager: stop disabling urlification under a pager
Less 568 properly shows urlified strings.

Putative NEWS entry:
* Urlification is now enabled by default even when a pager is used.
  Previously it was disabled, because less would not show such markup
  properly. This has been fixed in less 568.
  Please either upgrade less, or use SYSTEMD_URLIFY=0 to disable the
  feature.
2020-12-02 16:50:44 +09:00
Zbigniew Jędrzejewski-Szmek 0a67dd8310
Merge pull request #17692 from yuwata/ipv4ll
network: fold ipv4ll fallback modes into normal ipv4ll addressing
2020-12-01 21:59:30 +01:00
Zbigniew Jędrzejewski-Szmek f319b2b1b0
Merge pull request #17703 from poettering/event-ratelimit
sd-event: add a concept of ratelimiting
2020-12-01 21:47:43 +01:00
Zbigniew Jędrzejewski-Szmek 946f3d868c
Merge pull request #17524 from poettering/fileio-offset
cryptsetup: if keyfile is specified as AF_UNIX socket in the fs, connect to it, and read key data from it
2020-12-01 21:38:52 +01:00
Lennart Poettering a303686fc1 man: document new ratelimiting APIs 2020-12-01 15:15:39 +01:00
Michal Sekletár d586f642fd core: prevent excessive /proc/self/mountinfo parsing 2020-12-01 15:15:39 +01:00
Michal Sekletár 68d8906517 test: add ratelimiting test
(Taken from Michal's #17274 by Lennart, and slightly adjusted)
2020-12-01 15:15:39 +01:00
Lennart Poettering b6d5481b3d sd-event: add ability to ratelimit event sources
Let's a concept of "rate limiting" to event sources: if specific event
sources fire too often in some time interval temporarily take them
offline, and take them back online once the interval passed.

This is a simple scheme of avoiding starvation of event sources if some
event source fires too often.

This introduces the new conceptual states of "offline" and "online" for
event sources: an event source is "online" only when enabled *and* not
ratelimited, and offline in all other cases. An event source that is
online hence has its fds registered in the epoll, its signals in the
signalfd and so on.
2020-12-01 15:11:24 +01:00
Lennart Poettering f41315fceb sd-event: remove earliest_index/latest_index into common part of event source objects
So far we used these fields to organize the earliest/latest timer event
priority queue.  In a follow-up commit we want to introduce ratelimiting
to event sources, at which point we want any kind of event source to be
able to trigger time wakeups, and hence they all need to be included in
the earliest/latest prioqs.  Thus, in preparation let's make this
generic.

No change in behaviour, just some shifting around of struct members from
the type-specific to the generic part.
2020-12-01 15:10:50 +01:00
Lennart Poettering cad143a8f2 sd-event: follow coding style with naming return parameter 2020-12-01 15:10:50 +01:00
Lennart Poettering f814c871e6 sd-event: ref event loop while in sd_event_prepare() ot sd_event_run()
sd_event_prepare() invokes callbacks that might drop the last user ref
on our event loop. Let's make sure we keep an explicit ref around it, so
that we won't end up with an invalid pointer. Similar in sd_event_run().

Basically, any function that is publically callable that might end up
invoking callbacks should ref the relevant objects to be protected
against callbacks destroying these objects while we still want to access
them. We did this correctly in sd_event_dispatch() and sd_event_loop(),
but these are not the only ones which are callable from the outside.
2020-12-01 15:10:50 +01:00
Lennart Poettering e6a7bee538 sd-event: let's suffix last_run/last_log with "_usec"
Otherwise it's a bit confusing what this is about: two timestamps.
2020-12-01 15:10:50 +01:00
Lennart Poettering 1e45e3fecc sd-event: split out code to add/remove timer event sources to earliest/latest prioq
Just some refactoring that makes code prettier, and will come handy
later, because we can reuse these functions at more places.
2020-12-01 15:10:50 +01:00
Lennart Poettering 41c63f36c3 sd-event: split clock data allocation out of sd_event_add_time()
Just some simple refactoring, that will make things easier for us later.
But it looks better this way even without the later function reuse.
2020-12-01 15:10:50 +01:00
Lennart Poettering f80a5d6a86 sd-event: mention that two debug logged events are ignored 2020-12-01 14:36:06 +01:00
Lennart Poettering 8c437318b8 update TODO 2020-12-01 14:27:33 +01:00
Lennart Poettering 59d6f7b097 man: drop comment about ECC vs. RSA and Yubikey
The comment is pointless, ECC systematically doesn't allow
encryption/decryption directly, only RSA does that. If you want to use
ECC for asymmetric encryption/decryption you have to combine it with key
exchange scheme and symmetric scheme. This all is not a limitation of
the Yubikey, hence don't claim so. It's just how ECC is.
2020-12-01 14:27:33 +01:00
Lennart Poettering 96e9a9a4e6 man: document how cryptsetup keys may be acquired via AF_UNIX sockets 2020-12-01 14:27:12 +01:00
Lennart Poettering e060ed32e4 cryptsetup: modify keyfile search logic to use read_file_full() too
Let's move the 3rd way how cryptsetup acquires key files to
read_file_full() too.

Since load_key_file()'s raison d'etre now is just the search path logic,
let's rename the function to find_key_file().
2020-12-01 14:27:01 +01:00
Lennart Poettering e2c2f868b2 cryptsetup: port cryptsetup's main key file logic over to read_full_file_full()
Previously, we'd load the file with libcryptsetup's calls. Let's do that
in our own, so that we can make use of READ_FULL_FILE_CONNECT_SOCKET,
i.e. read in keys via AF_UNIX sockets, so that people can plug key
providers into our logic.

This provides functionality similar to Debian's keyscript= crypttab
option (see → #3007), as it allows key scripts to be run as socket
activated services, that have stdout connected to the activated socket.
In contrast to traditional keyscript= support this logic runs stuff out
of process however, which is beneficial, since it allows sandboxing and
similar.
2020-12-01 14:17:47 +01:00
Lennart Poettering 4d1bb8f397 cryptsetup: port PKCS#11 code to read key file with read_full_file()
Now that we can read from offsets/with size, let's port the cryptsetup
PKCS#11 key file logic over to read_full_file_full().
2020-12-01 14:17:47 +01:00
Lennart Poettering 986311c2da fileio: teach read_full_file_full() to read from offset/with maximum size 2020-12-01 14:17:47 +01:00
Lennart Poettering c61f46fe31 journal-remote: suffix cmdline option that expects arg with = 2020-12-01 14:17:47 +01:00
Lennart Poettering ce82de671f man: mention that --key= is about *secret* keys 2020-12-01 14:17:47 +01:00