Commit graph

51917 commits

Author SHA1 Message Date
Yu Watanabe 7f80fa12c2 network: add brief comment about reconfiguring interfaces
This also renames link_reconfigure_internal() -> link_reconfigure_impl().
2021-06-15 05:12:25 +09:00
Yu Watanabe ecb3deccdc network: do not partially update wlan information on failure 2021-06-15 04:32:31 +09:00
Yu Watanabe 7149bde4ba network: add missing increment of Link::set_flags_messages
link_up_or_down() will decrement the counter when the subsequent
RTM_GETLINK netlink method is finished. So, we need to increment
the counter here.

Fixes the issue mentioned at
https://github.com/systemd/systemd/issues/19832#issuecomment-860255692.
2021-06-15 03:58:59 +09:00
Topi Miettinen 1753d30215 Revert "Mount all fs nosuid when NoNewPrivileges=yes"
This reverts commit d8e3c31bd8.

A poorly documented fact is that SELinux unfortunately uses nosuid mount flag
to specify that also a fundamental feature of SELinux, domain transitions, must
not be allowed either. While this could be mitigated case by case by changing
the SELinux policy to use `nosuid_transition`, such mitigations would probably
have to be added everywhere if systemd used automatic nosuid mount flags when
`NoNewPrivileges=yes` would be implied. This isn't very desirable from SELinux
policy point of view since also untrusted mounts in service's mount namespaces
could start triggering domain transitions.

Alternatively there could be directives to override this behavior globally or
for each service (for example, new directives `SUIDPaths=`/`NoSUIDPaths=` or
more generic mount flag applicators), but since there's little value of the
commit by itself (setting NNP already disables most setuid functionality), it's
simpler to revert the commit. Such new directives could be used to implement
the original goal.
2021-06-15 00:33:22 +09:00
Luca Boccassi 2fbb5df8e9
Merge pull request #19898 from yuwata/network-multipath-route-without-interface-name
network: set link ifindex when multi-path routes specified without interface name
2021-06-14 14:27:50 +01:00
Luca Boccassi feaf43158a
Merge pull request #19894 from yuwata/network-fix-configure-without-carrier
network: always check dynamic address assignments before entering con…
2021-06-14 14:23:09 +01:00
Luca Boccassi 1340574cf7
Merge pull request #19866 from yuwata/sd-device-new-from-ifindex
sd-device: introduce sd_device_new_from_ifindex()
2021-06-14 14:21:17 +01:00
Yu Watanabe b5d0fd1e7f network: drop misleading debugging logs about MTU
This fixes the following spurious logs on enumerating links:
```
wlan0: Saved original MTU 1500 (min: 256, max: 2304)
wlan0: MTU is changed: 0 → 1500 (min: 256, max: 2304)
```
2021-06-14 14:19:02 +01:00
Jayanth Ananthapadmanaban 279082ed49 Add a network timeout option to journal-upload 2021-06-14 11:16:38 +02:00
Daniel Schaefer 5a750c49a9 doc: Add RISC-V to FAQ
Was added to the spec in 499f0f8209.
2021-06-13 18:20:09 +09:00
Zbigniew Jędrzejewski-Szmek dce95d0b15 test/TEST-17-UDEV: use default image
No need to build a separate 700MB image to save 3080 bytes in the default image.
2021-06-12 11:19:04 +02:00
Yu Watanabe 4bcb862548 network: always check dynamic address assignments before entering configured state
Previously (v248 or earlier), even if no static address is configured,
the link did not enter configured state, as e.g. Link::static_addresses_configured
is false until the link gained its carrier.
But, after the commit 1187fc3375, the
situation was changed. Static addresses, routes, and etc are requested even
if the link does not have its carrier, and thus the link enters configured
state when no static address and etc are specified.

This makes the link does not enter configured state before it gains its
carrier when at least one of dynamic address assignment protocols (e.g.
DHCP) except for NDISC is enabled.

Note that, unfortunately, netplan always enables ConfigureWithoutCarrier=
for all virtual devices, e.g. bridge. See,
978e20f902
So, we need to support e.g. the following strange config:
```
[Netowkr]
ConfigureWithoutCarrier=yes
DHCP=yes
```

Fixes #19855.
2021-06-12 08:51:16 +09:00
Yu Watanabe 740b638267 test-network: disable dynamic addressing protocols when ConfigureWithoutCarrier= is enabled 2021-06-12 08:51:16 +09:00
Yu Watanabe 705c7b1860 test-network: refuse routable state when no-carrier is expected
If we do not set the maximum operstate in wait-online, then routable
state is allowed when no-carrier state is expected.
2021-06-12 08:51:16 +09:00
Yu Watanabe 7a0fef8688 test-network: add a testcase for MultiPathRoute= without interface name 2021-06-12 05:37:57 +09:00
Yu Watanabe 08c2fcdc0d network: route: set link ifindex when multi-path routes specified without interface name
And do not set RTA_OIF attribute when multi-path routes are specified.
See kernel's fib_get_nhs() in net/ipv4/fib_semantics.c.

Fixes #19890.
2021-06-12 05:34:52 +09:00
Yu Watanabe af7b405dff sd-dhcp: refuse to set iaid if we cannot find the interface 2021-06-12 03:19:08 +09:00
Yu Watanabe 8d71f2b3a6 dhcp: do not use ifindex when generating iaid in tests 2021-06-12 03:19:08 +09:00
Yu Watanabe 0299deab53 sd-dhcp: do not use detect_container() to guess udev is running or not 2021-06-12 03:19:08 +09:00
Yu Watanabe 27fce94ae6 nspawn: path_is_read_only_fs() may return negative errno
And we usually assume /sys is not read only on error.
2021-06-12 03:19:08 +09:00
Yu Watanabe 0ac655a63b tree-wide: use sd_device_new_from_ifindex/ifname() 2021-06-12 03:19:08 +09:00
Yu Watanabe bd44a727f7 sd-device: introduce sd_device_new_from_ifname/ifindex() 2021-06-12 03:19:08 +09:00
Yu Watanabe afdf6c3b60 netlink: make rtnl_resolve_link_alternative_name() optionally return the main interface name 2021-06-12 03:19:08 +09:00
Yu Watanabe 57bd6aa701 netlink: check input name is valid before calling netlink method 2021-06-12 03:19:08 +09:00
Yu Watanabe f6e491547d netlink: move resolve_ifname() or friends to netlink-util.[ch] 2021-06-12 03:19:08 +09:00
Yu Watanabe f0ad7aedd9 network: use link_get_by_name() 2021-06-12 03:19:08 +09:00
Zbigniew Jędrzejewski-Szmek 756755d0fc docs: update coding style a bit
Say that r should be declared at the top of the function.

Don't say that fixed buffers result in truncation, right after saying that they
must only be used if size is known.

Adjust order of examples to be consistent.
2021-06-11 18:45:31 +01:00
Zbigniew Jędrzejewski-Szmek e77365b479
Merge pull request #19882 from keszybz/test-stat-util-more
Add a test for path_is_read_only_fs()
2021-06-11 18:44:58 +02:00
Lennart Poettering 8f56d1a859 update TODO 2021-06-11 16:13:49 +02:00
Michal Koutný cc815b7fea core: Avoid spurious realization of unit cgroups
Cgroups may be unnecessarily realized when they are not needed. This
happens, e.g. for mount units parsed from /proc/$PID/mountinfo, check

        touch /run/ns_mount
        unshare -n sh -c "mount --bind /proc/self/ns/net /run/ns_mount"
        # no cgroup exists
        file /sys/fs/cgroup/system.slice/run-ns_mount.mount
        systemctl daemon-reload
        # the vain cgroup exists
        file /sys/fs/cgroup/system.slice/run-ns_mount.mount

. (Such cgroups can account to a large number with many similar mounts.)

The code already accounts for "lazy" realization (see various checks for
Unit.cgroup_realized) but the unit_deserialize() in the reload/reexec
path performs unconditional realization.

Invalidate (and queue) the units for realization only if we know that
they were already realized in the past. This is a safe thing to do even
in the case the reload brings some new cgroup setting (controllers, BPF)
because units that aren't realized will use the updated setting when the
time for their realization comes. (It's not even needed to add a code
comment because the current formulation suggests the changed behavior.)
2021-06-11 10:34:22 +01:00
Zbigniew Jędrzejewski-Szmek dbb3b26f1b man: clarify that global search domains apply to global servers, not all interfaces
Fixes #19257.
2021-06-11 10:32:42 +01:00
Zbigniew Jędrzejewski-Szmek 51db8fdb92 test-stat-util: don't fail under chroot
I wanted to see what is_path_read_only_fs() and is_path_temporary_fs() return
in a chroot, and various tests would fail. For most of our codebase, we can
assume that /proc and such are mounted, and it doesn't make sense to make the
tests work in a chroot. But let's do it here. (In general, it would be useful
for most stuff in src/basic/, since it's linked into libraries which might be
invoked in incorrectly set up environments and should not fail too badly.)
2021-06-11 07:40:53 +02:00
Luca Boccassi 7ad9bad71b
Merge pull request #19811 from anitazha/revert_mount_rl
sd-event: fix failure to exit rate limiting state
2021-06-10 23:41:55 +01:00
Luca Boccassi 390a22f4b1
Merge pull request #19864 from keszybz/serialization-cleanup
Serialization cleanup
2021-06-10 23:40:23 +01:00
nl6720 9dfb429a44 kbd-model-map: add Latvian keyboard layout mapping 2021-06-10 23:29:32 +01:00
Zbigniew Jędrzejewski-Szmek 6080987130
Merge pull request #18851 from yuwata/dissect-try-to-find-partition-on-timeout
dissect: try to find partition more frequently
2021-06-10 19:09:18 +02:00
Zbigniew Jędrzejewski-Szmek c3988f36d3
Merge pull request #19870 from keszybz/install-foo-again
Tweak the install logic again
2021-06-10 18:56:03 +02:00
Lennart Poettering 31251469c0
Merge pull request #19878 from poettering/large-key-file-cryptsetup
add back support for large key files to systemd-cryptsetup
2021-06-10 17:10:32 +02:00
Štěpán Němec 6ae11e1220 docs/CODING_STYLE: fix some typos 2021-06-10 15:29:28 +01:00
Zbigniew Jędrzejewski-Szmek ab18976b35 core/serialize: drop bogus deserialization of ipcns sockets
a70581ffb5 added ExecRuntime.ipcns_storage_socket[], and
serialization in exec_runtime_serialize(), and deserialization in exec_runtime_deserialize_one(),
but also deserialization in exec_runtime_deserialize_compat(). exec_runtime_deserialize_compat()
is for deserializating ExecRuntime when it was serialized as part of the unit before
e8a565cb66. There was never any code which would serialize
ExecRuntime.ipcns_storage_socket[] this way, so the deserialization attempts are pointless.
2021-06-10 14:17:58 +02:00
Zbigniew Jędrzejewski-Szmek cbc165d17e core/serialization: shorten code, treat all oom error the same 2021-06-10 14:17:58 +02:00
Zbigniew Jędrzejewski-Szmek 1085c0eb69 core/serialization: drop misleadingly-named unit_can_serialize()
All unit types can be serialized. This function was really checking whether the
unit type has custom serialization/deserialization code. But we don't need a
function for this.

Also, the check that both .serialize() and .deserialize_item() are defined is
better written as an assert. Not we have a function which would skip
serialization/deserializaton for the unit if we forgot to set either of the
fields.
2021-06-10 14:17:58 +02:00
Zbigniew Jędrzejewski-Szmek d8d0da1f19 test-stat-util: add a very basic test for test_path_is_read_only() 2021-06-10 13:45:55 +02:00
Zbigniew Jędrzejewski-Szmek b845894c80 test-stat-util: add standard test logging 2021-06-10 13:45:55 +02:00
Lennart Poettering 871f35af85 cryptsetup: improve error message when key files to load are too large
Let's make this easier to grok for users.

Prompted-by: #19193
2021-06-10 10:55:02 +02:00
Lennart Poettering f6dd48fae8 fileio: bump limit for read_full_file() and friends to 64M
Apparently people use such large key files. Specifically, people used 4M
key files, and we lowered the limit from 4M to 4M-1 back in 248.

This raises the limit to 64M for read_full_file() to avoid these
specific issues and give some non-trivial room beyond the 4M files seen
IRL.

Note that that a 64M allocation in glibc is always immediately done via
mmap(), and is thus a lot slower than shorter allocations. This means
read_virtual_file() becomes ridiculously slow if we'd use the large
limit, since we use it all the time for reading /proc and /sys metadata,
and read_virtual_file() typically allocates the full size with malloc()
in advance.  In fact it becomes so slow, that test-process-util kept
timing out on me all the time, once I blindly raised the limit.

This patch hence introduces two distinct limits for read_full_file() and
read_virtual_file(): the former is much larger than the latter and the
latter remains where it is. This is safe since the former uses an
exponentially growing realloc() loop while the latter uses the
aforementioend ahead-of-time full limit allocation.

Fixes: #19193
2021-06-10 10:51:00 +02:00
Zbigniew Jędrzejewski-Szmek ad5fdd3912 shared/install: ignore enablement of template units w/o instance when presetting
When we have a unit which cannot be enabled:
 # foo@.service:
 ...
 [Install]
 WantedBy=foo.target  # there is no instance, so we don't know what to enable

we should throw an error when invoked directly with 'enable', but
not when doing 'preset' or 'preset-all'.

Fixes #19856.
2021-06-10 10:02:38 +02:00
Zbigniew Jędrzejewski-Szmek 9b69770a49 shared/install: pass UnitFileFlags down into the call chain
This just propagates the parameter down into leaf functions,
without any functional change.
2021-06-10 10:00:36 +02:00
Lennart Poettering 527653f827
Merge pull request #19857 from yuwata/tmpfile-fix
tmpfiles: fix an issue found by Coverity
2021-06-10 09:30:57 +02:00
Lennart Poettering bb25f236d4
Merge pull request #19863 from keszybz/coverity-drop-unitialized-workarounds
Drop some -Wmaybe-unitialized workarounds to help coverity
2021-06-10 09:29:59 +02:00