1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 00:51:24 +03:00
Commit Graph

49304 Commits

Author SHA1 Message Date
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
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
Frantisek Sumsal
58bc1735fe ci: build on Fedora ELN as well
ELN builds with a slightly different content set and RHEL-like options,
which should, theoretically, help a bit with RHEL stuff.
2021-02-10 16:34:22 +01:00
Yu Watanabe
9a67c080b0
Merge pull request #18506 from keszybz/fuzz-systemctl-parse-argv
Fuzzer for systemctl argline parsing
2021-02-11 00:29:22 +09:00
Lennart Poettering
bbe05f94f1
Merge pull request #18521 from poettering/coredumpctl-table
coredumpctl improvements (mostly about table formatting)
2021-02-10 15:58:56 +01:00
Lennart Poettering
2571aafbd8 core: fix manager_ref_gid() parameter name in header
It should match what we do for manager_ref_uid() and in the .c file.
2021-02-10 15:48:39 +01:00
Lennart Poettering
010becd90a manager: simplify uid-ref/gid-ref a code a bit
Let's drop unused function arguments, and needless double pointers where
we can.

no actual change in behaviour, just simplifications

(I tried to track down #14026 without success, and this came out of it)
2021-02-10 15:48:35 +01:00
Zbigniew Jędrzejewski-Szmek
23ece765cc test-string-util: add missing comma
Coverity CID#1446368.
2021-02-10 14:47:00 +01:00
Zbigniew Jędrzejewski-Szmek
419076978c resolved: rework a few functions to return early on error
The implementation is a bit ugly because we set the output variable
twice. But we were already doing this on error, so this is not
significantly worse. Doing this allows us to avoid goto's, and the
compiler should be able to figure this out and only set once.
2021-02-10 14:47:00 +01:00
Zbigniew Jędrzejewski-Szmek
c706a52ac5 machinectl: write arg_* only after verifying the value 2021-02-10 14:47:00 +01:00
Zbigniew Jędrzejewski-Szmek
7211c853c2 tree-wide: propagate error code from _from_string() functions
Now that we know we have something useful, no need to make an answer up.
2021-02-10 14:46:59 +01:00
Zbigniew Jędrzejewski-Szmek
751db3b4cd Return -EINVAL from _from_string() functions
We'd return -1 (-EPERM), even though we have a general rule to use real errno
values. The particular case that caught my attention was:

$ sudo udevadm control -l asdf
Failed to parse log priority 'asdf': Operation not permitted

... but "git grep 'r =.*_from_string' src/" return 110 hits. Confusingly, some
of the _from_string functions already return a proper errno value, so not all
of those are broken, but probably quite a few.
2021-02-10 14:46:59 +01:00
Zbigniew Jędrzejewski-Szmek
2d93c20e5f tree-wide: use -EINVAL for enum invalid values
As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617.

This does not touch anything exposed in src/systemd. Changing the defines there
would be a compatibility break.

Note that tests are broken after this commit. They will be fixed in the next one.
2021-02-10 14:46:59 +01:00
Zbigniew Jędrzejewski-Szmek
71c163c9fa udev: make sure UdevBuiltinCommand is properly converted 2021-02-10 14:46:59 +01:00
Zbigniew Jędrzejewski-Szmek
38d1e12063 sd-bus: drop some bitfields in sd_bus_slot
A hole was/is present after the booleans, so changing them to be one byte each
doesn't change the structure size (122 bits on amd64). If we add more stuff
later, it might make sense to turn some of those into bitfields again. For now,
let's take the easy route. EINVAL fits into type now.

Code size it minimally reduced:
-rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb 10 14:00 build/libsystemd.so.0.30.0
-rwxrwxr-x 1 zbyszek zbyszek 4109712 Feb 10 14:01 build/libsystemd.so.0.30.0
2021-02-10 14:46:59 +01:00
Lennart Poettering
8dfc2beb57 github: expressly ask for logs in github issue template
Apparently it's not obvious that logs are a good thing to provide, hence
let's explicitly ask for them.
2021-02-10 14:43:16 +01:00
Zbigniew Jędrzejewski-Szmek
399f74c79d sd-netlink: pahole optimization of sd_netlink_slot
By rearranging the fields, we can avoid one of the holes (on amd64).
By adding more space for .type, -EINVAL can be used as a value later on.
The structure is reduced from 96 to 88 bytes (on amd64).

Text size is also smaller:
-rwxrwxr-x 1 zbyszek zbyszek 4109832 Feb  9 19:50 build/libsystemd.so.0.30.0
-rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb  9 19:51 build/libsystemd.so.0.30.0
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
4d24463211 shared/json: make JsonVariant.type field wider
pahole shows that this doesn't make a difference, but we can fit -EINVAL
into .type without warnings.
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
755c6d5923 sd-event: drop one bitfield from sd_event_source
pahole analysis confirms that the structure size does not change (there
was/is a hole after the sequence of bitfields anyway).
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
ec08f27069 core: drop bitfields in Manager object
Every bitfield may make the object a little smaller, but requires additional
code when accessing the field. So it only makes sense in objects that are
created in many many copies. The Manager is pretty much a singleton.

-rwxrwxr-x 1 zbyszek zbyszek 4443840 Feb  9 16:14 build/systemd
-rwxrwxr-x 1 zbyszek zbyszek 4442552 Feb  9 16:42 build/systemd

We save 1288 bytes of code by "wasting" a few bytes on storage. (The speed
advantages are probably more important, but harder to measure…)
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
61b315de9b Add comma in structured initialization in a few places
It just looks nicer…
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
170d40260b core: do not initialize variable which is unconditionally set below 2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
3c3cd61e75 test-tables: make the assert more readable
Doing it all in one line and with negation in front seemed like a good
idea at some point, but I think it is vastly easier to understand when
it is split out a bit.
2021-02-10 14:43:10 +01:00
Zbigniew Jędrzejewski-Szmek
b357fe57b2 test-tables: fix warning about NULL used in printf
With the simplified asserts, newer gcc is able to (correctly) figure
out that NULL was being passed.
2021-02-10 14:43:10 +01:00
Lennart Poettering
505061bb4f clock-util: modernize settimeofday() timezone calls
Let's use structured initialization, and avoid the weird `tv_null`
indirection.

No changes in behaviour, just some clean-ups.
2021-02-10 14:14:37 +01:00
Luca Boccassi
8aa35d09d3 Fix coverity warning in test-string-util.c
CID 1446368:  Incorrect expression  (MISSING_COMMA)
2021-02-10 13:22:06 +01:00
Lennart Poettering
4016281c4f coredumpctl: include coredump size in output
This improves the output of the "list" and "info" verbs and adds
coredump size information to the output.

For doing that a common helper function is added that analyzes the
coredump file on disk.
2021-02-10 12:22:21 +01:00
Lennart Poettering
bbd86b72f1 man: document new coredumpctl features 2021-02-10 12:22:03 +01:00