1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-12 09:17:44 +03:00
Commit Graph

49330 Commits

Author SHA1 Message Date
Yu Watanabe
53ae4762ef network: address: do not set IFA_F_PERMANENT flag
The flag is automatically set by kernel when the valid lifetime is
infinite. Note that the flag in netlink message for IPv4 address is
ignored. See set_ifa_lifetime() in kernel's net/ipv4/devinet.c.
But the flag is honored for IPv6 address. And if the flag is set with
finite valid lifetime, the address will not removed automatically by
the kernel.
2021-02-12 23:09:21 +09:00
Yu Watanabe
a8481354f0 network: address: also set IFA_FLAGS on remove
If an address is assigned with IFA_F_MANAGETEMPADDR, then the flag must
be also set on remove. Otherwise, temporary addresses will not be
removed. See also inet6_rtm_deladdr() in kernel's net/ipv6/addrconf.c.

Fixes #13218.
2021-02-12 23:09:21 +09:00
Zbigniew Jędrzejewski-Szmek
e81fd9dd23
Merge pull request #18544 from yuwata/tree-wide-use-error-in-xxx_from_string
tree-wide: use error in xxx_from_string()
2021-02-12 12:16:23 +01:00
Yu Watanabe
0ef0c9caf7
Merge pull request #18554 from yuwata/network-address-set-NLM_F_REPLACE-flag-automatically
network: automatically set NLM_F_REPLACE flag
2021-02-12 13:47:58 +09:00
Yu Watanabe
b3f9c17a6b tree-wide: use free_and_strdup_warn() 2021-02-12 03:05:08 +09:00
Yu Watanabe
37c0b60177 network: automatically set NLM_F_REPLACE flag
The difference between sd_rtnl_message_new_addr() and
sd_rtnl_message_new_addr_update() is only whether NLM_F_REPLACE flag
will be set or not.

If an address is already assigned, then we need to set NLM_F_REPLACE
flag, otherwise, address_configure() will be fail.

This makes address_configure() judge whether we should use the flag or
not.
2021-02-12 01:50:14 +09:00
Yu Watanabe
fe44ce8dba network: address: also logs preferred lifetime 2021-02-12 01:49:59 +09:00
Yu Watanabe
7fb1d980af tree-wide: propagate error in xxx_from-string() 2021-02-12 01:19:18 +09:00
Yu Watanabe
bde8467a0d network: dhcp: use string table 2021-02-12 01:19:18 +09:00
Yu Watanabe
58f99ed8a8 string-table: introduce DEFINE_STRING_TABLE_LOOKUP_FROM_STRING() 2021-02-12 01:19:18 +09:00
Yu Watanabe
e4ffe10367 network: route: use _WITH_FALLBACK macros 2021-02-12 01:19:18 +09:00
Yu Watanabe
0fcc4e7484 networkd: lldp: use string table 2021-02-12 01:19:13 +09:00
Yu Watanabe
641bcbc56b string-table: introduce DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN() 2021-02-12 01:17:13 +09:00
Yu Watanabe
b98680b2b8 tree-wide: use error codes in xxx_from_string() 2021-02-12 01:17:13 +09:00
Yu Watanabe
0cbb768aba conf-parser: use return codes in xxx_from_string()
Follow-up for #11484.
2021-02-12 01:17:06 +09:00
Luca Boccassi
1c3c43a417
Merge pull request #18550 from keszybz/coverity-inspired-fixes
Coverity inspired fixes
2021-02-11 15:44:25 +00:00
Zbigniew Jędrzejewski-Szmek
aaf73b2ecf
Merge pull request #17902 from bugaevc/fix-container-detection
improve container detection
2021-02-11 12:56:01 +01:00
Zbigniew Jędrzejewski-Szmek
a4aa5742f7 homework: fix unitialized variable
Coverity CID#1444703.
2021-02-11 12:00:09 +01:00
Zbigniew Jędrzejewski-Szmek
78b4e9ed17 homework: reduce scope of iterator variables 2021-02-11 11:59:22 +01:00
Zbigniew Jędrzejewski-Szmek
0eacd1852a basic/locale-util: reduce variable scope 2021-02-11 09:55:01 +01:00
Zbigniew Jędrzejewski-Szmek
333ab199a1 fsck: make sure we don't read an unitialized variable
This use on %n was completely unnecessary: fprintf returns the number of
characters written. And the issue was that if fprintf failed for whatever
reason, it would not process the %n and m would be unitialized. Rework the
code a bit to simplify it.

Coverity CID#1444708.
2021-02-11 09:50:49 +01:00
Zbigniew Jędrzejewski-Szmek
363729c470 sd-journal: add forgotten unmap in error path
Bug introduced in 4b5bc5396c :(

Coverity CID#1444709.
2021-02-11 09:35:52 +01:00
Zbigniew Jędrzejewski-Szmek
47237e0ed4 shared/generator: add missing initializer
Coverity CID#1444710.
2021-02-11 09:23:22 +01:00
Zbigniew Jędrzejewski-Szmek
b5f1c0d88b udev: add assert to make coverity happy
Coverity says:
CID 1446387 (#1 of 1): Bad bit shift operation (BAD_SHIFT)
8. negative_shift: In expression 1U << (int)cmd, shifting by a negative amount
has undefined behavior. The shift amount, cmd, is -22.

I don't think there's any issue, unless we forget to set token->data
appropriately. Let's add an assert.
2021-02-11 09:17:46 +01:00
Zbigniew Jędrzejewski-Szmek
372a5002dc
Merge pull request #18545 from poettering/netlink-seqno-fix
sd-netlink seqnum fixes
2021-02-11 08:24:39 +01: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
Zbigniew Jędrzejewski-Szmek
39755e0014
Merge pull request #17823 from poettering/resolved-just-bypass
resolved: just the dnssec bypass logic
2021-02-11 00:10:25 +01:00
Lennart Poettering
ac3bc1b819 sd-netlink: spread out sequence numbers a bit
An (imperfect) fix for #14760.

This makes collisions unlikely, but still theoretically possible.

Fixes: #14760
2021-02-10 23:07:46 +01:00
Lennart Poettering
baf78f1a51 sd-netlink: reduce indentation levels a bit 2021-02-10 22:01:24 +01:00
Lennart Poettering
13ec9f103b sd-netlink: use getsockopt_int() where appropriate 2021-02-10 22:01:24 +01:00
Lennart Poettering
b522c4b92a sd-netlink: revamp message serial handling
Let's use uint32_t everywhere to maintain the seqno, since that's what
the kernel does. Prviously in the reply_callback logic we used 64bit,
for no apparent reason.

Using 32bit also provides us with the benefit that we can avoid using
uint64_hash_ops, and can use trivial_hash_ops instead for the reply
hashmap, so that we can store the seqno in the key pointer directly.

While we are at it, let's make sure we never run into serial collisions
internally (32bit is a lot, but not that much), and let's put a limit on
outstanding serials, to catch programming errors.
2021-02-10 22:01:24 +01:00
Lennart Poettering
01131684ac tmpfiles: explicitly say we need /proc/ to run
I don't think it's realistic to operate without /proc/. Hence, let's
make this explicit.

If one day someone finds a way to do what we need without /proc/ we can
certainly drop this check again, but for now I think it's a lot
friendlier to users to make this explicitly early on instead continuing
to run and then not do what we need to do, oftentimes failing in cryptic
ways.

After all, invoking the tool without /proc/ is not an error that was
specific to some of the lines we process, but it's systematic error that
will show its ugly face in many codepaths down the line.

Fixes: #14745
2021-02-10 21:50:37 +01:00
Yu Watanabe
23c32ff830 network: use SD_BUS_METHOD_WITH_ARGS() macro 2021-02-10 21:34:47 +01:00
Lennart Poettering
f5ec78e503 core: improve log message when unit deactivates cleanly
Whenever a unit deactivates sucessfully we so far generated a message
"unit xyz: succeeded". This is a bit confusing, since various unit types
cannot really "succeed", e.g. a device unit can't really "suceed", not
can a swap unit. In particular in the latter case people would probably
assume that a swap unit that "suceeded" would actually mean a swap was
active now, but the opposite is actually true.

Let's improve this by saying "Deactivated successfully", which hopefully
clears this up.

(I thought about saying "terminated" or "completed" or "finished" or so
instead, but that too doesn#t make sense if you think about unit types
like swaps or devices.)
2021-02-10 21:26:35 +01:00
Lennart Poettering
ee1680cb52
Merge pull request #18440 from bluca/portable_upgrade
portable: add 'reattach' verb and DBUS interface
2021-02-10 21:26:14 +01:00
Adrian Vovk
4368c60c39 tmpfiles: v/q/Q: Add env var to skip check for rootfs in subvolume 2021-02-10 21:10:28 +01:00
Sergey Bugaev
0e13779d37 virt: detect cgroups namespaces
detect_container() is now able to detect if we're running in a cgroup namespace.
2021-02-10 22:25:04 +03:00
Sergey Bugaev
a4a9a6f7c6 virt: detect Docker and Podman containers
Docker doesn't set $container, so it cannot be detected that way. Instead, we
check for presence of /.dockerinit, which it creates. Podman does set
$container, but some Red Hat images (in particular, Fedora images) override
$container to equal "oci". So to correctly detect Podman containers, we check
for presence of /run/.containerenv, which is created by Podman and is now the
official way to get information about the container from within the container.

Fixes https://github.com/systemd/systemd/issues/15393
2021-02-10 22:25:04 +03: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
9e4079d411 portable: allow Detach to match images with different version suffixes 2021-02-10 19:07:27 +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
Zbigniew Jędrzejewski-Szmek
46a906f414
Merge pull request #18542 from yuwata/bash-completion-update
bash-completion: add missing options
2021-02-10 19:31:11 +01:00
Yu Watanabe
01e3d04ee6
Merge pull request #18536 from poettering/uid-refs-simplify
dynamic uid/gid reference handling simplifications
2021-02-11 03:18:15 +09:00
Yu Watanabe
fa7924db0b
Merge pull request #11484 from keszybz/udevadm-error-logs
Use real return codes in _from_string() functions
2021-02-11 03:17:47 +09:00
Yu Watanabe
aba1c9c85b bash-completion: loginctl: add -P option 2021-02-11 02:51:00 +09:00
Yu Watanabe
e56aa17084 bash-completion: coredumpctl: add --json and -n options 2021-02-11 02:50:54 +09: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
Weblate (bot)
2c7bd14280
Translations update from Weblate (#18537)
Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
2021-02-11 00:55:41 +09:00