Commit Graph

31342 Commits

Author SHA1 Message Date
Daan De Meyer 77f16dbd6d Don't assume /run/systemd exists when creating unit-root
When running tests in a mkosi container, /run/systemd might not
exist yet in the container which causes test-execute to fail.

Fixes #17842.
2020-12-05 11:11:58 +00:00
Lennart Poettering 62ea0ed08d dissect: don't declare unused variables on archs that have no GPT discovery
Fixes: #17839
2020-12-04 17:50:18 +01:00
Yu Watanabe 402506cea5 socket-util: make several socket_set_xxx() functions inline 2020-12-04 17:49:55 +01:00
Lennart Poettering da2268f9d7 cryptsetup: give command line parameters proper names
It's highly confusing to reference the command line parameters via
argv[] indexes. Let's clean this up, and introduce properly named local
variables that make this easier to follow.

No actualy code changes, just some renaming of variables.
2020-12-04 17:49:34 +01:00
Lennart Poettering fea909c1b9
Merge pull request #17854 from poettering/dns-domain-ret-fix
dns-domain: fix some coding style issues
2020-12-04 17:49:05 +01:00
Zbigniew Jędrzejewski-Szmek a2c2421a05
Merge pull request #17834 from yuwata/network-ipv6-reject-type-route
network: handle IPv6 routes with reject type correctly
2020-12-04 12:19:35 +01:00
Vito Caputo 3a595c597a mmap-cache: replace stats accessors with log func
In preparation for logging more mmap-cache statistics get rid of this
piecemeal stats accessor api and just have a debug log output function
for producing the stats.

Updates the one call site using these accessors, moving what that site
did into the new log function.  So the output is unchanged for now,
just a trivial refactor.
2020-12-04 12:09:35 +01:00
Lennart Poettering dcbe4a6860 dns-domain: initialize return param on success 2020-12-04 11:52:22 +01:00
Lennart Poettering cb3714d100 dns-domain: follow coding style, initialize ret params on success 2020-12-04 11:07:06 +01:00
Lennart Poettering 5517e214c8 tree-wide: make use of new DLSYM_ARG() macro everywhere 2020-12-04 10:41:59 +01:00
Lennart Poettering e2f03674bc dlfcn-util: add DLSYM_ARG() helper 2020-12-04 10:41:59 +01:00
Luca Boccassi 442bc2afee meson: check that cxx variable is set before using it
In some cases it is not defined. Eg in a yocto build:

src/systemd/meson.build:61:15: ERROR: Unknown variable cxx.
2020-12-04 08:35:56 +01:00
Yu Watanabe d9d6a10bce network: set protocol to route assigned through DHCP6 or DHCP6-PD 2020-12-04 11:23:23 +09:00
Yu Watanabe 575f14eef0 network: make IPv6 routes with reject type managed by Manager 2020-12-04 11:23:23 +09:00
Yu Watanabe 6c252588df network: introduce route_type_is_reject() helper 2020-12-04 11:23:23 +09:00
Lennart Poettering 877884fc0d resolved: synthesize NODATA instead of NXDOMAIN if gateway exists, but of other protocol
Fixes: #11192
2020-12-03 23:23:11 +01:00
Lennart Poettering c3a8c6aa42 local-addresses: make returning accumulated list optional 2020-12-03 23:21:53 +01:00
Lennart Poettering 6c0bacc146 resolved: improve log message when we use TCP a bit
DNS-over-TLS being in use isn't precisely the same as "UDP not
supported". Let's make this clearer.
2020-12-03 22:46:59 +01:00
Lennart Poettering ce9fb09e96
Merge pull request #17809 from yuwata/network-address-fixes-17803
network: two fixes for configuring address correctly
2020-12-03 21:04:58 +01:00
Lennart Poettering 61bd7d1ed5 random-util: open /dev/urandom implicitly in random_write_entropy() if needed 2020-12-03 20:14:17 +01:00
Lennart Poettering e267d76f73
Merge pull request #17836 from poettering/tpm2-condition
Add ConditionSecurity=tpm2
2020-12-03 20:13:45 +01: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
Lennart Poettering 03d8ebb935
Merge pull request #17812 from poettering/systemctl-version-feature-update
build.h: add a bunch of missing features strings
2020-12-03 14:34:08 +01:00
Zbigniew Jędrzejewski-Szmek 91b79ba84e shared/build: make the version string definition less terrible
The BLKID and ELFUTILS strings were present twice. Let's reaarange things so that
each times requires definition in exactly one place.

Also let's sort things a bit:
the "heavy hitters" like PAM/MAC first,
then crypto libs,
then other libs, alphabetically,
compressors,
and external compat integrations.

I think it's useful for users to group similar concepts together to some extent.
For example, when checking what compression is available, it helps a lot to have
them listed together.

FDISK is renamed to LIBFDISK to make it clear that this is about he library and
the executable.
2020-12-03 12:16:02 +01:00
Lennart Poettering bce334a31c core: add ConditionSecurity=tpm2 support 2020-12-03 12:03:58 +01:00
Florian Westphal 7509c7fdf9 fw_add_masquerade: remove unused function arguments
Similar to the previous commit.  All callers pass NULL.  This will
ease initial nftables backend implementation (less features to cover).

Add the function parameters as local variables and let compiler
remove branches.  Followup patch can remove the if (NULL) conditionals.
2020-12-03 11:05:14 +01:00
Florian Westphal 67b3732a53 fw_add_local_dnat: remove unused function arguments
All users pass a NULL/0 for those, things haven't changed since 2015
when this was added originally, so remove the arguments.

THe paramters are re-added as local function variables, initalised
to NULL or 0.  A followup patch can then manually remove all
if (NULL) rather than leaving dead-branch optimization to compiler.

Reason for not doing it here is to ease patch review.

Not requiring support for this will ease initial nftables backend
implementation.
In case a use-case comues up later this feature can be re-added.
2020-12-03 11:04:46 +01:00
Lennart Poettering 6c822dc2d5 build.h: add a bunch of missing features strings
Let's make "systemctl --version" more useful for detecting when
build-time features/deps are enabled and which ones arent't again.
2020-12-03 09:24:55 +01:00
Yu Watanabe 131e4deaf3 ethtool: add two new link modes 2020-12-03 11:23:50 +09:00
Yu Watanabe 89836c304b shared/kernel: update kernel headers
From kernel commit 34816d20f173a90389c8a7e641166d8ea9dce70a.
2020-12-03 11:21:13 +09:00
Yu Watanabe 8c47d1103f basic/linux: update kernel headers
From kernel commit 34816d20f173a90389c8a7e641166d8ea9dce70a.
2020-12-03 11:20:59 +09:00
Yu Watanabe 2a236f9fc0 network: ignore broadcast address for /31 or /32 addresses
As they do not have broadcast address.
See https://tools.ietf.org/html/rfc3021
2020-12-03 10:23:12 +09:00
Yu Watanabe 05a7023d24 network: fix verification for broadcast address
Fixes a bug caused by fe841414ef.
2020-12-03 10:23:12 +09:00
Yu Watanabe df8aa08642 network: do not set broadcast if prefixlen is 31 or 32
After fe841414ef, broadcast address is
also compared with existing one to determine whether the address is
foregin or not. So, the address object should not contain unnecessary
information.

Fixes #17803.
2020-12-03 10:22:50 +09:00
Lennart Poettering 565147b7bb stub: don't ever respond to datagrams coming in on non-localhost addreses, on the stub 2020-12-03 09:35:40 +09:00
Lennart Poettering 9ca875e80c resolved: beef up logic for suppressing "localhost" entry in /etc/hosts
Either suppress the entry entirely, or not at all. But do not suppress
the "localhost" names we recognize, leaving the ones we do not in place.

On Fedora, where "localhost4.localdomain4" is among those listed in
/etc/hosts for 127.0.0.1 we'd thus otherwise drop the "localhost" but
keep the "localhost4.localdomain4" and then on reverse lookups only
return that, which is highly confusing.
2020-12-03 09:06:27 +09:00
Lennart Poettering 36d892b7e6 resolved: use stat_inode_unmodified() to detect /etc/hosts changes 2020-12-03 08:58:45 +09:00
Lennart Poettering fbbc72189f resolved: never allow _gateway lookups to go to the network
Make them rather fail than go to the network.

Previously we'd filter them on LLMNR (explicitly) and MDNS (implicitly,
because it doesn't have .local suffix), but not on DNS.

In order to make _gateway truly reliable, let's not allow it to go to
DNS either, and keep it local.

This is particular relevant, as clients can now request lookups without
local RR synthesis, where we'd rather have NXDOMAIN returned for
_gateway than have it hit the network.
2020-12-03 08:56:27 +09:00
Lennart Poettering 19bcef9dc3 resolved: lower SERVFAIL cache timeout from 30s to 10s
Apparently 30s is a bit too long for some cases, see #5552. But not
caching SERVFAIL at all also breaks stuff, see explanation in
201d99584e.

Let's try to find some middle ground, by lowering the cache timeout to
10s. This should be ample for the problem
201d99584e attackes, but not as long as
half a miute, as #5552 complains.

Fixes: #5552
2020-12-03 08:52:27 +09:00
Yu Watanabe 34f80876f8
Merge pull request #17807 from poettering/bindtodevice
use SO_BINDTOIFINDEX while connect()
2020-12-03 08:50:43 +09:00
Lennart Poettering 0a489d3f5d resolved: insert large dgram size into EDNS0 only when in LARGE UDP mode
Specifically, in TLS-DO there's no reason to set the exotic dgram size.
2020-12-03 08:49:58 +09:00
Lennart Poettering d80e72ec60 dns-domain: try IDN2003 rules if IDN2008 doesn't work
This follows more closely what web browsers do, and makes sure emojis in
domains work.

Fixes: #14483
2020-12-03 08:48:11 +09: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