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

32151 Commits

Author SHA1 Message Date
Lennart Poettering
b17b6a7401 resolved: slight modernizations of resolved-dns-answer.c functions
Let's follow our own coding style an initialized return values on all
cases of "success".
2021-02-09 17:52:43 +01:00
Lennart Poettering
7d44b1986b resolved: add dns_answer_contains() helper 2021-02-09 17:52:36 +01:00
Lennart Poettering
81b4d94df5 resolved: add logic for patching TTLs of full packets 2021-02-09 17:52:30 +01:00
Lennart Poettering
93748b2686 resolved: add logic for patching OPT max udp size of existing packet 2021-02-09 17:52:24 +01:00
Lennart Poettering
42df953247 resolved: introduce dns_transaction_key() helper for getting RR key for transaction
This is a simple search&replace excercise: instead of accessing the
"key" field of the transaction directly, let's use a small inline helper
that does this for us.

This appears pointless for now, but this will become useful later when
we introduce "bypass" transactions, that reuse the original client DNS
packet for queries instead of synthesizing a packet of our own. In that
case transactions either have regular "key" field initialized as before,
or the "bypass" packet field instead. The new dns_transaction_key()
helper allows us to hide the differences for most cases as we can later
teach it to access the "bypass" packet's question key transparently.

No change in behaviour.
2021-02-09 17:52:19 +01:00
Lennart Poettering
1a6cd0206b resolved: add helper dns_packet_dup() for duplicating packets 2021-02-09 17:51:45 +01:00
Lennart Poettering
619b0c077c inhibit: cut off overly long "who" fields
systemd-inhibit when invoked with a command line will put the whole
command line in the "who" field of the inhibitor lock. This can get
extremely long for shell expressions, making the table "systemd-inhibit
--list" shows ridiculously weirdly formatted. Let's put a limit on the
column width: half of the screen, not more.
2021-02-09 15:06:25 +01:00
Lennart Poettering
2cd9f773e2 format-table: don't hit assert if column got less width than it asked for
If one field in a specific column has a maximum size limit, other fields
in the same column might affected by it and get less than they asked
for. Let's make sure we can handle this, and don't assert on this
because surprisingly we got less than what we asked for.
2021-02-09 15:05:25 +01:00
Luca Boccassi
0f15cb2243
Merge pull request #18470 from mrc0mmand/ci-clang-12
ci: run build test with clang-12 as well
2021-02-09 13:06:40 +00:00
Zbigniew Jędrzejewski-Szmek
5bbf331434
Merge pull request #18416 from yuwata/strverscmp
util: introduce strverscmp_improved()
2021-02-09 14:06:18 +01:00
Zbigniew Jędrzejewski-Szmek
4ef8478eb5 fuzz-journal-remote: do not assert on resource conditions
We have a number of issues where oss-fuzz reports input-independent crashes of
fuzz-journal-remote. Instead of asserting that stuff that allocated fds and
memory never fails, let's instead just return an error.

https://oss-fuzz.com/testcase-detail/4791099424112640
https://oss-fuzz.com/testcase-detail/4531912477638656

I don't see any docs as to whether LLVMFuzzerTestOneInput() is allowed to
return non-zero. Propagating the error code is easiest, so let's just do that.
If it turns out that this causes oss-fuzz to still report a failure, we can
suppress that later.
2021-02-09 13:59:01 +01:00
Yu Watanabe
7bc38f59dc log: do not use uninitialized value
Follow-up for 85cf96e3f5.
2021-02-09 13:58:12 +01:00
Zbigniew Jędrzejewski-Szmek
f47df388a0
Merge pull request #18346 from yuwata/hostnamectl-try-to-set-transient-hostname
hostnamectl: try to set transient hostname even if setting static or pretty hostname failed
2021-02-09 12:42:25 +01:00
Kevin P. Fleming
12f7469bbe network: Delay addition of IPv6 Proxy NDP addresses
Setting of IPv6 Proxy NDP addresses must be done at the same
time as static addresses, static routes, and other link attributes
that must be configured when the link is up. Doing this ensures
that they are reconfigured on the link if the link goes down
and returns to service.
2021-02-09 19:56:56 +09:00
Yu Watanabe
8087644a13 tree-wide: replace strverscmp() and str_verscmp() with strverscmp_improved() 2021-02-09 14:25:03 +09:00
Yu Watanabe
87b7d9b6ff string-util: introduce strverscmp_improved()
Unfortunately, strverscmp() from libc or str_verscmp() do not correctly
handle pre-release version, e.g. 247 vs 247~rc1.

This implement a new comparison function, which is based on the RPM's
rpmvercmp().
2021-02-09 14:24:58 +09:00
Yu Watanabe
e5bc5f1f5a fundamental: move several macros and functions into src/fundamental/
sd-boot has a copy of a subset of codes from libbasic. This makes
sd-boot share the code with libbasic, and dedup the code.

Note, startswith_no_case() is dropped from sd-boot, as
- it is not used,
- the previous implementation is not correct,
- gnu-efi does not have StrniCmp() or so.
2021-02-09 14:22:54 +09:00
Yu Watanabe
822be62fb2 hostnamectl: use Table 2021-02-09 13:49:27 +09:00
Yu Watanabe
f2d3ec7abf hostnamectl: show hint when user try to set transient hostname but static hostname is already used 2021-02-09 13:49:27 +09:00
Yu Watanabe
e8acf09186 hostname: use free_and_strdup_and_warn() 2021-02-09 13:49:27 +09:00
Yu Watanabe
ba12e41d05 hostname: re-read file later when failed to update file
Previously, even when writing e.g. /etc/hostname fails, the static
hostname in Context is not restored. So, the subsequent call of the same
method succeeds:
```
$ sudo chattr +i /etc/hostname
$ sudo hostnamectl --static set-hostname aaa
Could not set static hostname: Access denied
$ echo $?
1
$ sudo hostnamectl --static set-hostname aaa
$ echo $?
0
```

This makes when updating file is failed, the saved stat is cleared. So,
the static hostname or machine information in the context are always
consistent to the corresponding files.
2021-02-09 13:49:27 +09:00
Yu Watanabe
c388618ec0 hostnamectl: unset pretty hostname only when no target is specified 2021-02-09 13:49:27 +09:00
Yu Watanabe
2d79e90a1f hostnamectl: try to set transient hostname even if updating static or pretty hostname failed
If no target (--pretty, --static, or --transient) is specified, then
let's try to set transient hostname even if setting static or pretty
hostname failed. This may be useful for read-only filesystem.
2021-02-09 13:49:15 +09:00
Yu Watanabe
957991b7ac hostname: introduce two bus errors for updating file 2021-02-09 13:37:27 +09:00
Yu Watanabe
0ce2a086da bus-error: align error definitions 2021-02-09 13:37:27 +09:00
Yu Watanabe
5c3d2e3f43 hostnamectl: improve log message on failure 2021-02-09 13:37:27 +09:00
Frantisek Sumsal
8762049792 tree-wide: fix the string concatenation warning with clang-12
e.g.:
./src/shared/dissect-image.c:2218:39: error: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Werror,-Wstring-concatenation]
                                      "/usr/lib/os-release\0",
                                      ^
../src/shared/dissect-image.c:2217:39: note: place parentheses around the string literal to silence warning
                [META_OS_RELEASE]   = "/etc/os-release\0"
                                      ^
1 error generated.

See: https://reviews.llvm.org/D85545
2021-02-08 12:22:03 +01:00
Zbigniew Jędrzejewski-Szmek
ad22e7cf5c
Merge pull request #18375 from yuwata/cli-tools-also-read-kernel-command-line
tree-wide: make CLI tools also read kernel command line when run as service
2021-02-08 11:45:42 +01:00
Zbigniew Jędrzejewski-Szmek
07ffdcf915
Merge pull request #18331 from yuwata/test-udev-event-spawn
udev: add tests for udev_event_spawn()
2021-02-08 11:10:36 +01:00
Antonius Frie
4d0052d52f
Use correct config parser for MountAPIVFS (#18501)
As far as I can see, at some point the parser function for MountAPIVFS
was changed from the generic bool parser to a custom implementation, to
allow the context to keep track of whether MountAPIVFS had been set
explicitly. If not, exec_context_get_effective_mount_apivfs would fall
back to a default value. However, the corresponding entry in the big
parser table wasn't updated, meaning that the old bool parser was still
used, meaning that context->mount_apivfs_set remained at its default
value of false, meaning that the default value was always used and the
config option was effectively ignored.

Fix for 5e98086d16.
2021-02-08 09:15:15 +01:00
Lennart Poettering
900915080a copy: use stat_verify_directory() where appropriate 2021-02-06 10:37:10 +00:00
Lennart Poettering
f8f5b8d864 resolved: suppress ifindex info in varlink JSON responses if zero
If we don't have ifindex info, don't set the field for it.

We already do that for parsed IP address replies, let's do it for all
cases: it's a bit nicer to suppress the ifindex prop if it doesn't apply
than to pass it invalid.

This is the other side of #18482, i.e. fixes things so that the parser
doesn't get tripped up by this.

(This too makes a problem go away we should track down properly, i.e.
figure out how the ifindex got lost in
https://github.com/systemd/systemd/pull/17823#issuecomment-742439422 )
2021-02-06 00:17:10 +01:00
Lennart Poettering
425ed13991 nss-resolve: shortcut fixing of ifindex if it's zero anyway 2021-02-05 18:46:18 +01:00
Lennart Poettering
6da52ca861 nss-resolve: accept zero ifindex when parsing resolved reply
Sometimes a reply isn't associated to any specific interface, it might
be a general truth (for example served from /etc/hosts or so). In this
case the server might pass ifindex == 0. Accept that.

https://github.com/systemd/systemd/pull/17823#issuecomment-742439422
2021-02-05 18:44:22 +01:00
Lennart Poettering
cb3363ef7a
Merge pull request #18318 from yuwata/network-route-table-name
network: RouteTable= improvements
2021-02-05 18:08:56 +01:00
Ali Abdallah
3deed59afd PATCH] Always free deserialized_subscribed on reload
Otherwise, it will keep consuming memory on systemctl daemon-reload.
2021-02-05 18:04:55 +01:00
Lennart Poettering
ca9fab8896 Revert "resolvectl: Add show-multicast verb to show discovered LLMNR/mDNS hosts" 2021-02-05 09:23:05 +09:00
Lennart Poettering
a24fb9b2ce
Merge pull request #18472 from poettering/conservative-rename-fix
fix conservative_renameat()
2021-02-04 22:08:47 +01:00
Zbigniew Jędrzejewski-Szmek
29eb0eefd1 core: map io.bfq.weight to 1..1000
Aaargh. See the comment in the code.

Apparently the range is like that:
$ sudo bash -c 'echo "default 1001" >/sys/fs/cgroup/user.slice/io.bfq.weight'
bash: line 0: echo: write error: Numerical result out of range

$ uname -r
5.11.0-0.rc4.129.fc34.x86_64
2021-02-04 19:15:03 +01:00
Lennart Poettering
06fed305d4 test-fs-util: beef up test for conservative_renameat()
Instead of using a short fixed string, let's use a huge blob for
testing, with randomized size and contents, that definitely is above the
16K buffer size conservative_renameat() uses internally.
2021-02-04 18:25:25 +01:00
Lennart Poettering
eff57d1c2f fs-util: make sure conservative_renameat() properly detects identity of longer files
The old code got confused with files with a size >16K. Let's fix that.

Noticed by @benjarobin

Replaces: #18442
2021-02-04 18:25:25 +01:00
David Edmundson
84c46fb03c xdg-autostart: Generate autostart services with templated name
The "XDG standardization for applications" specification states that
services should be in the form:

app[-<launcher>]-<ApplicationID>[@<RANDOM>].service or
app[-<launcher>]-<ApplicationID>-<RANDOM>.scope

In this case "autostart" takes the place of [RANDOM] to provide a unique
identifier if the same app is launched elsewhere. As it is a service
that means it should be set as a template not using a hyphen delimiter.
2021-02-04 16:41:22 +01:00
Daan De Meyer
bcea93326b boot: Replace efivar_set() persistent argument with flags argument
To add secure-boot enrolling support, we need to be able to specify
the EFI_VARIABLE_APPEND_WRITE flag so let's make the efivar_set()
methods more generic so we can set that flag.
2021-02-04 16:38:22 +01:00
Zbigniew Jędrzejewski-Szmek
3d0112878f
Merge pull request #18444 from anitazha/proprename
oom: parse properties with 1/10000 precision instead of 1/100
2021-02-04 12:53:10 +01:00
Zbigniew Jędrzejewski-Szmek
5623600c6e
Merge pull request #18355 from DaanDeMeyer/resolved-discover
resolvectl: Add show-multicast verb to show discovered LLMNR/mDNS hosts
2021-02-04 10:37:21 +01:00
Yu Watanabe
436cde839f
Merge pull request #18462 from poettering/copy-time
timestamp fixes in copy.c
2021-02-04 14:04:37 +09:00
Lennart Poettering
d8f9686c0f import: use +i (immutable) chattr flag for marking OS images read-only
This is what nspawn and machine-image.[ch] actually look for, hence us
it here too.
2021-02-04 14:03:03 +09:00
Lennart Poettering
5d80583d5d import: fix etag detection support
Let's make sure we still look at the etags reported by http 304 (i.e.
the cache management code). Otherwise we won't properly realize we
already downloaded this before.

This fixes a bug introduced in 6792cbbcf8
2021-02-04 14:00:11 +09:00
Yu Watanabe
245f4b384d
Merge pull request #18459 from poettering/discover-image
shared: rename machine-image.[ch] → discover-image.[ch]
2021-02-04 13:57:37 +09:00
Lennart Poettering
2ef2376d83 path-util: tighten path_is_valid() checks
This tightens the path_is_valid() checking: it now tests whether each
component in the path is bound by FILENAME_MAX in its size.
2021-02-03 23:36:55 +01:00