]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agoMerge pull request #18631 from yuwata/sd-netlink-fix-assertions
Lennart Poettering [Tue, 16 Feb 2021 21:36:06 +0000 (22:36 +0100)] 
Merge pull request #18631 from yuwata/sd-netlink-fix-assertions

sd-netlink: update assertions and drop unused functions

3 years agosystemd: don't try to run as user manager when called without any arguments
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 16:40:56 +0000 (17:40 +0100)] 
systemd: don't try to run as user manager when called without any arguments

It's better for users if programs don't do "significant" things too easily, and
should be especially conservative when called without any arguments whatsoever.
So far systemd would would try to launch itself as a user manager and fail on
some cgroup permission stuff. systemd --user is run execlusively from user@.service
and there we call it with --user. Calls to the binary without any arguments as
non-pid1 are almost always a mistake.

https://github.com/systemd/systemd/issues/18419#issuecomment-779422571

3 years agoman: make clear that sd-journal notifications always come with extra latency
Lennart Poettering [Tue, 16 Feb 2021 16:15:16 +0000 (17:15 +0100)] 
man: make clear that sd-journal notifications always come with extra latency

Replaces: #17699

3 years agoMerge pull request #18636 from poettering/resolved-different-server
Lennart Poettering [Tue, 16 Feb 2021 19:27:09 +0000 (20:27 +0100)] 
Merge pull request #18636 from poettering/resolved-different-server

resolved: tweaks for switching to different DNS servers

3 years agoMerge pull request #18620 from bluca/mount_images_fixes
Lennart Poettering [Tue, 16 Feb 2021 19:26:06 +0000 (20:26 +0100)] 
Merge pull request #18620 from bluca/mount_images_fixes

MountImages and core tmpfs fixes

3 years agoMerge pull request #18616 from keszybz/argv-fuzzer-quick-fix
Lennart Poettering [Tue, 16 Feb 2021 19:25:37 +0000 (20:25 +0100)] 
Merge pull request #18616 from keszybz/argv-fuzzer-quick-fix

fuzz-systemctl-parse-argv: avoid "leak" of bus object

3 years agologind: Restore chvt as non-root user without polkit
Joshua Watt [Fri, 30 Oct 2020 13:15:43 +0000 (08:15 -0500)] 
logind: Restore chvt as non-root user without polkit

4acf0cfd2f ("logind: check PolicyKit before allowing VT switch") broke
the ability to write user sessions that run graphical sessions (e.g.
weston/X11). This was partially amended in 19bb87fbfa ("login: allow
non-console sessions to change vt") by changing the default PolicyKit
policy so that non-root users with a session are again allowed to switch
the VT. This makes the policy when PolKit is not enabled (as on many
embedded systems) closer the default PolKit policy and allows launching
graphical sessions as a non-root user.

Closes #17473

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
3 years agostat-util: fix dir_is_empty_at without path
Luca Boccassi [Mon, 18 Jan 2021 20:15:03 +0000 (20:15 +0000)] 
stat-util: fix dir_is_empty_at without path

Use the right FD, and do a fd_reopen instead of a dup, since the
latter will still share the internal pointer which then gets
moved by FOREACH_DIRENT, affecting the caller's FD.

3 years agoMerge pull request #18624 from poettering/resolved-feature-level-tweak
Lennart Poettering [Tue, 16 Feb 2021 19:24:05 +0000 (20:24 +0100)] 
Merge pull request #18624 from poettering/resolved-feature-level-tweak

resolved: three tweaks to server feature level tracking

3 years agoMerge pull request #18629 from yuwata/sd-netlink-nexthop-types
Yu Watanabe [Tue, 16 Feb 2021 19:06:15 +0000 (04:06 +0900)] 
Merge pull request #18629 from yuwata/sd-netlink-nexthop-types

sd-netlink: add nexthop related types

3 years agoresolved: unify code for trying a different DNS server 18636/head
Lennart Poettering [Thu, 12 Nov 2020 17:36:08 +0000 (18:36 +0100)] 
resolved: unify code for trying a different DNS server

Let's unify some code, and add a common implementation of a function
that checks whether we have tried all DNS servers yet, and retries the
transaction if we don't. We already use this same code twice. Let's use
it at some other places too now — basically all cases where we switch to
a new server — with the one case of packet loss, where we too switch
servers, but don#t care how many times we already tried to switch.

3 years agoresolved: improve log message when retrying a transaction with a different server
Lennart Poettering [Thu, 12 Nov 2020 17:34:18 +0000 (18:34 +0100)] 
resolved: improve log message when retrying a transaction with a different server

3 years agoresolved: never go below DNSSEC feature level in DNSSEC strict mode 18624/head
Lennart Poettering [Thu, 12 Nov 2020 15:05:15 +0000 (16:05 +0100)] 
resolved: never go below DNSSEC feature level in DNSSEC strict mode

This adjusts our feature level handling: when DNSSEC strict mode is on,
let's never lower the feature level below the lowest DNSSEC mode.

Also, when asking whether DNSSEC is supproted, always say yes in strict
mode. This means that error reporting about transactions that fail
because of missing DNSSEC RRs will not report "incompatible-server" but
instead "missing-signature" or suchlike.

The main difference here is that DNSSEC failures become local to a
transaction, instead of propagating into the feature level we reuse for
future transactions. This is beneficial with routers that implement
"mostly a DNS proxy", i.e. that propagate most DNS requests 1:1 to their
upstream servers, but synthesize local answers for a select few domains.
For example, AVM Fritz!Boxes operate that way: they proxy most traffic
1:1 upstream in an DNSSEC-compatible fashion, but synthesize the
"fritz.box" locally, so that it can be used to configure the router.
This local domain cannot be DNSSEC verified, it comes without
signatures. Previously this would mean once that domain was resolved
feature level would be downgraded, and we'd thus fail all future DNSSEC
attempts. With this change, the immediate lookup for "fritz.box" will
fail validation, but for all other unrelated future ones that comes
without prejudice.

(While we are at it, also make a couple of other downgrade paths a bit
tighter.)

Fixes: #10570 #14435 #6490
3 years agoresolved: make feature level checks a bit more discriptive
Lennart Poettering [Wed, 11 Nov 2020 20:19:22 +0000 (21:19 +0100)] 
resolved: make feature level checks a bit more discriptive

The levels have an order, but the order is sometimes a bit arbitrary.
Hence add simple macros to check for specific features and use those, so
that the ordering leaks a bit less into all files.

3 years agoresolved: when we can't parse a packet, downgrade feature level
Lennart Poettering [Wed, 11 Nov 2020 20:03:04 +0000 (21:03 +0100)] 
resolved: when we can't parse a packet, downgrade feature level

So far we didn't really handle the case where we can't parse a reply
packet. Since this apparently happens in real-life though, let's add
some minimal logic, to downgrade/restart if we see this.

3 years agonetlink: drop sd_rtnl_message_{route,nexthop}_set_family() 18631/head
Yu Watanabe [Mon, 15 Feb 2021 00:21:24 +0000 (09:21 +0900)] 
netlink: drop sd_rtnl_message_{route,nexthop}_set_family()

The family is already set when the message is created.

3 years agonetwork: drop unnecessary family setting
Yu Watanabe [Tue, 16 Feb 2021 17:05:28 +0000 (02:05 +0900)] 
network: drop unnecessary family setting

It is already set in sd_rtnl_message_new_nexthop().

3 years agoman: fix indentation
Yu Watanabe [Sun, 14 Feb 2021 05:49:46 +0000 (14:49 +0900)] 
man: fix indentation

3 years agoresolved: paranoia — ensure DNS reply came over stream we sent it to
Lennart Poettering [Tue, 10 Nov 2020 17:45:28 +0000 (18:45 +0100)] 
resolved: paranoia — ensure DNS reply came over stream we sent it to

3 years agoAdding an explanation for CONFIG_NET requirement (#18600)
heretoenhance [Tue, 16 Feb 2021 16:26:51 +0000 (16:26 +0000)] 
Adding an explanation for CONFIG_NET requirement (#18600)

* README: replace CONFIG_NET with CONFIG_UNIX in requirements list

3 years agonetlink: fix assertions
Yu Watanabe [Mon, 15 Feb 2021 00:15:06 +0000 (09:15 +0900)] 
netlink: fix assertions

3 years agonetlink: add nexthop related types 18629/head
Yu Watanabe [Sun, 14 Feb 2021 17:38:28 +0000 (02:38 +0900)] 
netlink: add nexthop related types

3 years agosd-netlink: add RTA_NH_ID attribute support
Yu Watanabe [Thu, 4 Feb 2021 14:32:12 +0000 (23:32 +0900)] 
sd-netlink: add RTA_NH_ID attribute support

3 years agoRename unit_times_free to unit_times_free_array 18616/head
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 16:09:00 +0000 (17:09 +0100)] 
Rename unit_times_free to unit_times_free_array

It frees the whole array and the type is UnitTimes not UnitTime.

3 years agoRename strbuf_cleanup to strbuf_free
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 16:05:42 +0000 (17:05 +0100)] 
Rename strbuf_cleanup to strbuf_free

It frees the whole object.

3 years agofuzz-systemctl-parse-argv: call static destuctors
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 13:27:26 +0000 (14:27 +0100)] 
fuzz-systemctl-parse-argv: call static destuctors

With all the preparatory work in previous PRs, we can now call static destructors
repeatedly without issue. We need to do it here so that global variables allocated
during parsing are properly freed.

3 years agosystemctl: use free_and_replace on global variable
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 13:19:36 +0000 (14:19 +0100)] 
systemctl: use free_and_replace on global variable

In normal usage we cannot set it multiple times, but from a fuzzer we
may. Doing it this way is nicer anyway.

3 years agotree-wide: reset the cleaned-up variable in cleanup functions
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 13:18:30 +0000 (14:18 +0100)] 
tree-wide: reset the cleaned-up variable in cleanup functions

If the cleanup function returns the appropriate type, use that to reset the
variable. For other functions (usually the foreign ones which return void), add
an explicit value to reset to.

This causes a bit of code churn, but I think it might be worth it. In a
following patch static destructors will be called from a fuzzer, and this
change allows them to be called multiple times. But I think such a change might
help with detecting unitialized code reuse too. We hit various bugs like this,
and things are more obvious when a pointer has been set to NULL.

I was worried whether this change increases text size, but it doesn't seem to:

-Dbuildtype=debug:
before "tree-wide: return NULL from freeing functions":
-rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0*
-rwxrwxr-x 1 zbyszek zbyszek 4494520 Feb 16 15:06 build/systemd*
after "tree-wide: return NULL from freeing functions":
-rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0*
-rwxrwxr-x 1 zbyszek zbyszek 4494576 Feb 16 15:10 build/systemd*
now:
-rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0*
-rwxrwxr-x 1 zbyszek zbyszek 4494640 Feb 16 15:15 build/systemd*

-Dbuildtype=release:
before "tree-wide: return NULL from freeing functions":
-rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0*
-rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:09 build-rawhide/systemd*
after "tree-wide: return NULL from freeing functions":
-rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0*
-rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:10 build-rawhide/systemd*
now:
-rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0*
-rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:16 build-rawhide/systemd*

I would expect that the compiler would be able to elide the setting of a
variable if the variable is never used again. And this seems to be the case:
in optimized builds there is no change in size whatsoever. And the change in
size in unoptimized build is negligible.

Something strange is happening with size of libsystemd: it's bigger in
optimized builds. Something to figure out, but unrelated to this patch.

3 years agotree-wide: return NULL from freeing functions
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 12:48:04 +0000 (13:48 +0100)] 
tree-wide: return NULL from freeing functions

I started working on this because I wanted to change how
DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's
nice to make make things more consistent and predictable.

3 years agoresolved: reduce indentation level a bit
Lennart Poettering [Wed, 11 Nov 2020 20:02:06 +0000 (21:02 +0100)] 
resolved: reduce indentation level a bit

3 years agoresolved: let's preferably route reverse lookups for local subnets to matching interfaces
Lennart Poettering [Mon, 9 Nov 2020 21:22:56 +0000 (22:22 +0100)] 
resolved: let's preferably route reverse lookups for local subnets to matching interfaces

Let's preferably route traffic for reverse lookups to LLMNR/mDNS/DNS on
the matching interface if the IP address is in the local subnet. Also,
if looking up an IP address of our own host, let's avoid doing
LLMNR/mDNS at all.

This is useful if "~." is a routing domain to DNS, as it means, local
reverse lookups still go to LLMNR/mDNS, too.

Fixes: #16243 #10081
3 years agonamespace: store and use original MountEntry paths when prefixing 18620/head
Luca Boccassi [Thu, 28 Jan 2021 17:02:33 +0000 (17:02 +0000)] 
namespace: store and use original MountEntry paths when prefixing

Some paths (eg: mount_tmpfs) simply assumed that prefixing always
happens and it always stores the original path in path_const, and
the prefixed path in path_malloc.
But if a MountEntry is set up in a helper function and thus uses
only _malloc struct members, this assumption doesn't hold and there's
a crash.

Refactor so that prefixing is done with a helper which stores the
original path in a separate struct member, and accessing it also
uses a helper which does the right thing.

3 years agoMountImages: actually support optional paths
Luca Boccassi [Thu, 28 Jan 2021 13:25:41 +0000 (13:25 +0000)] 
MountImages: actually support optional paths

ENOENT did not cause an image mount to be skipped, fix it

3 years agonetworkd: make network_config_section_free() inline
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 13:14:41 +0000 (14:14 +0100)] 
networkd: make network_config_section_free() inline

3 years agoresolved: make dns_transaction_gc return a pointer
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 13:10:28 +0000 (14:10 +0100)] 
resolved: make dns_transaction_gc return a pointer

_gc() does cleanup if it is possible. So far it returned a bool to
signal if it succeeded (false on success). When working on the resolved
code I had to look at the definition every time, because the (arguably
reversed) calling convention is unobvious. So let's return a pointer
(non-NULL: gc has not been done, NULL: gc has been done).

This fits nicely with the standard to return a pointer from all free
functions obviously.

3 years agonetworkd-ndisc: drop confused freepp function
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 12:57:43 +0000 (13:57 +0100)] 
networkd-ndisc: drop confused freepp function

The function to cleanup IPv6Token was defined using freep, i.e. the macro
generated a freepp function. The correct way would be to do something like
  #define ipv6_token_free mfree
  DEFINE_TRIVIAL_CLEANUP_FUNC(IPv6Token *, ipv6_token_free);
which would create ipv6_token_freep().
But since the cleanup function is unused, let's just drop it.

3 years agocoredump: add typedef for struct
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 12:51:58 +0000 (13:51 +0100)] 
coredump: add typedef for struct

3 years agobasic/capability-util: add missing initialization
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 12:50:08 +0000 (13:50 +0100)] 
basic/capability-util: add missing initialization

There was no error, because the pointer is unconditionally set below.

3 years agoanalyze: use typedefs for structs and inline iterator variable decls
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 12:36:59 +0000 (13:36 +0100)] 
analyze: use typedefs for structs and inline iterator variable decls

3 years agoresolved: log process info of clients requesting resolution via D-Bus
Lennart Poettering [Mon, 9 Nov 2020 21:20:16 +0000 (22:20 +0100)] 
resolved: log process info of clients requesting resolution via D-Bus

Let's make things more debuggable: when debug logging is on, let's
say which client is asking for our services.

This is helpful for easily figuring out which local process might
interfere with your debugging sessions by issuing additional requests
while you try to debug a request (I am looking at you, geoclue!).

3 years agoMerge pull request #18617 from poettering/resolved-confidential
Lennart Poettering [Tue, 16 Feb 2021 12:40:46 +0000 (13:40 +0100)] 
Merge pull request #18617 from poettering/resolved-confidential

resolved: tell clients which source a response is from, and whether it was never sent via unencrypted transports

3 years agoresolved: propagate source where an RR from back to client 18617/head
Lennart Poettering [Tue, 10 Nov 2020 22:34:40 +0000 (23:34 +0100)] 
resolved: propagate source where an RR from back to client

This is extremely useful when debugging stuff: knowing whether a result
was cached, came from network, or was synthesized.

3 years agoresolved: add "confidential" flag for replies passed to clients
Lennart Poettering [Tue, 10 Nov 2020 17:06:19 +0000 (18:06 +0100)] 
resolved: add "confidential" flag for replies passed to clients

Let's introduce a new flag that indicates whether the response was
acquired in "confidential" mode, i.e. via encrypted DNS-over-TLS, or
synthesized locally.

Fixes: #12859
3 years agoresolved: replace "answer_authenticated" bool by uint64_t query_flags field
Lennart Poettering [Tue, 10 Nov 2020 16:14:16 +0000 (17:14 +0100)] 
resolved: replace "answer_authenticated" bool by uint64_t query_flags field

Let's use the same flags type we use for client communication, i.e.
instead of "bool answer_authenticated", let's use "uint64_t
answer_query_flags", with the SD_RESOLVED_AUTHENTICATED flag.

This is mostly just search/replace, i.e. a refactoring, no change in
behaviour.

This becomes useful once in a later commit SD_RESOLVED_CONFIDENTIAL is
added to indicate resolution that either were encrypted (DNS-over-TLS)
or never left the local system.

3 years agoMerge pull request #18611 from poettering/ifname-validate-tighter
Lennart Poettering [Tue, 16 Feb 2021 08:52:32 +0000 (09:52 +0100)] 
Merge pull request #18611 from poettering/ifname-validate-tighter

make ifname validation tighter

3 years agoMerge pull request #18603 from poettering/socket-graveyard
Lennart Poettering [Tue, 16 Feb 2021 08:51:41 +0000 (09:51 +0100)] 
Merge pull request #18603 from poettering/socket-graveyard

resolved: keep udp sockets until we receive a reply or timeout

3 years agoresolvectl: clarify IDNA and search path logic in combination with "resolvectl query...
Lennart Poettering [Fri, 6 Nov 2020 19:10:40 +0000 (20:10 +0100)] 
resolvectl: clarify IDNA and search path logic in combination with "resolvectl query --type="

When low-level RR resolution is requested from "resolvectl query" via
"--type=" or "--class=" no search domain logic is applied and no IDNA
translation.

Explain this in detail in the documentation, and also mentions this when
users attempt to resolve single-label names or names with international
characters in the output.

I believe the current behaviour is correct, but it is indeed surprising.
Hence the documentation and output improvement.

Fixes: #11325 #10737
3 years agofuzz-systemctl-parse-argv: avoid "leak" of bus object
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 07:48:37 +0000 (08:48 +0100)] 
fuzz-systemctl-parse-argv: avoid "leak" of bus object

Memory sanitizer would report leaked memory from --boot-load-entry=help.

Maybe we should disable all bus connections from the fuzzer? It seems not
appropriate to communicate with logind. OTOH, in a real fuzzing environment
this call should just fail, so maybe that's OK.

3 years agoMerge pull request #18571 from bluca/portable_dbus_doc
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 07:30:27 +0000 (08:30 +0100)] 
Merge pull request #18571 from bluca/portable_dbus_doc

portable: use helpers for DBUS registration and document DBUS interface

3 years agoMerge pull request #18481 from keszybz/rpm-restart-post-trans
Zbigniew Jędrzejewski-Szmek [Tue, 16 Feb 2021 07:25:49 +0000 (08:25 +0100)] 
Merge pull request #18481 from keszybz/rpm-restart-post-trans

Restart units after the rpm transaction

3 years agojournalctl: rotation is not a reason to warn, but certainly noteworthy
Lennart Poettering [Mon, 15 Feb 2021 22:31:54 +0000 (23:31 +0100)] 
journalctl: rotation is not a reason to warn, but certainly noteworthy

Downgrade the phrasing, since it is a bit misleading.

Fixes: #18465
3 years agoMerge pull request #18579 from keszybz/fix-fragment-id-crash
Lennart Poettering [Mon, 15 Feb 2021 22:35:25 +0000 (23:35 +0100)] 
Merge pull request #18579 from keszybz/fix-fragment-id-crash

Fix fragment id crash

3 years agoresolved: close UDP socket when we received a network error on it 18603/head
Lennart Poettering [Fri, 6 Nov 2020 13:31:56 +0000 (14:31 +0100)] 
resolved: close UDP socket when we received a network error on it

3 years agoresolved: instead of closing DNS UDP transaction fds right-away, add them to a socket...
Lennart Poettering [Fri, 6 Nov 2020 12:32:53 +0000 (13:32 +0100)] 
resolved: instead of closing DNS UDP transaction fds right-away, add them to a socket "graveyard"

The "socket graveyard" shall contain sockets we have sent a question out
of, but not received a reply. If we'd close thus sockets immediately
when we are not interested anymore, we'd trigger ICMP port unreachable
messages once we after all *do* get a reply. Let's avoid that, by
leaving the fds open for a bit longer, until a timeout is reached or a
reply datagram received.

Fixes: #17421
3 years agoMerge pull request #18605 from poettering/suppress-repeated-stub
Lennart Poettering [Mon, 15 Feb 2021 22:06:37 +0000 (23:06 +0100)] 
Merge pull request #18605 from poettering/suppress-repeated-stub

resolved: filter repeated stub queries

3 years agosocket-util: tighten parsing of ifnames 18611/head
Lennart Poettering [Mon, 15 Feb 2021 21:49:36 +0000 (22:49 +0100)] 
socket-util: tighten parsing of ifnames

Numeric ifnames should be acceptable only if that's enabled by flag, and
refused otherwise. Hence, let's parse as ifindex first, and if that
works decide. Finally, let's refuse any numeric ifnames that are not
valid ifindexs, but look like them.

3 years agosocket-util: fix indentation
Lennart Poettering [Mon, 15 Feb 2021 21:49:24 +0000 (22:49 +0100)] 
socket-util: fix indentation

3 years agoportabled: add DBUS documentation 18571/head
Luca Boccassi [Fri, 12 Feb 2021 16:35:38 +0000 (16:35 +0000)] 
portabled: add DBUS documentation

3 years agoportabled: use SD_BUS_METHOD_WITH_ARGS
Luca Boccassi [Fri, 12 Feb 2021 21:49:17 +0000 (21:49 +0000)] 
portabled: use SD_BUS_METHOD_WITH_ARGS

3 years agoportabled: use service_parse_argv/bus_add_implementation
Luca Boccassi [Fri, 12 Feb 2021 16:35:20 +0000 (16:35 +0000)] 
portabled: use service_parse_argv/bus_add_implementation

Remove some boilerplate and allow introspection

3 years agoresolved: don't redundantly switch DNS servers because of transaction failures
Lennart Poettering [Thu, 5 Nov 2020 16:00:20 +0000 (17:00 +0100)] 
resolved: don't redundantly switch DNS servers because of transaction failures

When a transaction fails and we decide to switch DNS servers, don#t do
so unconditionally. Check if the current DNS server is still the same as
when the transaction was initiated. And if not, do not do anything.

That should reduce the number of redundant DNS server switches if many
parallel transactions fail simultaneously (which is pretty likely if
DNSSEC is on).

Fixes: #17040
3 years agoresolved: reuse check for link-local IP address lookups
Lennart Poettering [Mon, 9 Nov 2020 17:37:13 +0000 (18:37 +0100)] 
resolved: reuse check for link-local IP address lookups

Let's reuse accept_link_local_reverse_lookups() at one more place, where
we check for the list of link local reverase address domains. Since we
don't actually accept the domains here (but rather the opposite, not
accept), let's rename the function a bit more generically with accept_ →
match_.

While we are at it invert the if branches, to make things more easily
understandable: filter out the unwatnted stuff and have the "all good"
state as main codepath.

3 years agoMerge pull request #18604 from poettering/resolved-minor-tweaks
Zbigniew Jędrzejewski-Szmek [Mon, 15 Feb 2021 20:18:34 +0000 (21:18 +0100)] 
Merge pull request #18604 from poettering/resolved-minor-tweaks

two minor resolved tweaks

3 years agorpm: restart services in %posttrans 18481/head
Zbigniew Jędrzejewski-Szmek [Sun, 31 Jan 2021 11:11:36 +0000 (12:11 +0100)] 
rpm: restart services in %posttrans

This fixes a long-standing issue in packaging scriptlets: daemon-reload
was moved to the end of the transaction, but restarting services was still
straightaway after package installation.

https://bugzilla.redhat.com/show_bug.cgi?id=1614751

Note that daemon-reload is called twice. This wouldn't be hardly noticable,
except that now a bunch of units (at least in Fedora) generate very verbose
warnings about deprecated features. So we get those warnings twice…

reload-or-restart --needing-restart is also called twice, but the second call
is usually a noop, because the first clears the flag for restarted units. The
second call is necessary for the case where we only uninstall packages, and the
%transfiletriggerpostun trigger fires, but not the %transfiletriggerin
scriptlet.

Also note that this assumes that units are marked only for restart if paths
under @systemunitdir@ or /etc/systemd/system have been touched. I would prefer
make the trigger that does 'restart --needing-restart' fire always, but it
seems rpm doesn't have such functionality. (Except as a %transfiletrigger that
would trigger on "/*" to catch all transactions, but that seems ineffiecient
and ugly.)

3 years agorpm: order sysctl/sysusers/tmpfiles execution before package scriptlets
Zbigniew Jędrzejewski-Szmek [Fri, 5 Feb 2021 16:03:43 +0000 (17:03 +0100)] 
rpm: order sysctl/sysusers/tmpfiles execution before package scriptlets

P>1000000 is *before* "normal" scriptlets, P<1000000 is *after*. I think it
makes sense to do stuff like execution of sysctl/sysusers/tmpfiles configuration
before package scriptlets. I think that was the intent, but a single digit got
dropped ;(

Also, let's reorder the scriptlets in the file to match execution order, to
make it easier to see what is going on.

Most of those may happen in any order, but there are some exceptions:
tmpfiles should be after sysusers,
udevadm --reload should be after hwdb.

3 years agorpm: simplify daemon-reload trigger
Zbigniew Jędrzejewski-Szmek [Sun, 31 Jan 2021 13:24:46 +0000 (14:24 +0100)] 
rpm: simplify daemon-reload trigger

The trigger was initially written to use %transfiletriggerun instead
of %transfiletriggerpostun because the latter would not fire. It turned
out to a buffer overread in rpm that since has been long fixed:
https://bugzilla.redhat.com/show_bug.cgi?id=1284645
https://github.com/rpm-software-management/rpm/commit/f6521c50f6836374a0f7995f8f393aaf36e178ea

3 years agorpm: sync the shell version of triggers.systemd with the lua version
Zbigniew Jędrzejewski-Szmek [Sun, 31 Jan 2021 16:56:11 +0000 (17:56 +0100)] 
rpm: sync the shell version of triggers.systemd with the lua version

Note that this goes both ways: in particular the lua version had udev
scriptlets in the wrong package, fixed in
https://src.fedoraproject.org/rpms/systemd/c/3c9433d7cf4afc8d76660402f6c3d9d991596b83.

Add missing "|| :" so the scriptlets never fail.

3 years agorpm: pull in the alternative trigger implementation in sh
Zbigniew Jędrzejewski-Szmek [Sun, 31 Jan 2021 16:30:49 +0000 (17:30 +0100)] 
rpm: pull in the alternative trigger implementation in sh

From https://src.fedoraproject.org/rpms/systemd/blob/master/f/triggers.systemd.

In 12dde791d519bc80d5cca4ab6f088763cd481015 scriptlets were converted to lua.
This is not only faster and cleaner, but also avoids a nasty dependency loop:
rpm implements the lua scripting internally, so we don't need a working shell
for the scriplets. This is nice and all, but unfortunately ostree wants to
capture scriptlets and execute them at a later time and does not support lua.
So in Fedora we ended up with a revert back to a shell-based implementation
[1]. At the time I hoped this would only be a temporary workaround, but three
years later I think it's fair to assume that this will not happen any time
soon. But carrying the upstream lua version and the downstream sh version is
error prone. So let's import the other version into our tree too so that they
can be kept in sync.

[1] https://src.fedoraproject.org/rpms/systemd/c/8e6b39457b3e2660793821e0524855226e33e306

3 years agoMove rpm stuff into a separate src/rpm/ directory
Zbigniew Jędrzejewski-Szmek [Sun, 31 Jan 2021 16:16:32 +0000 (17:16 +0100)] 
Move rpm stuff into a separate src/rpm/ directory

It is only of interest to rpm-based distros, we can move it out of src/core/
which is pretty busy.

3 years agosystemctl: add "reload-or-restart --marked"
Zbigniew Jędrzejewski-Szmek [Fri, 5 Feb 2021 12:54:33 +0000 (13:54 +0100)] 
systemctl: add "reload-or-restart --marked"

This is almost equivalent to 'busctl call-method org.freedesktop.systemd1
/org/freedesktop/systemd1 org.freedesktop.systemd1.Manager EnqueueMarkedJobs',
but waits for the jobs to finish.

3 years agosystemctl: reduce scope of iterator variables
Zbigniew Jędrzejewski-Szmek [Fri, 5 Feb 2021 10:33:48 +0000 (11:33 +0100)] 
systemctl: reduce scope of iterator variables

3 years agocore: wrap long lines
Zbigniew Jędrzejewski-Szmek [Sat, 30 Jan 2021 18:53:58 +0000 (19:53 +0100)] 
core: wrap long lines

3 years agocore: add EnqueueMarkedJobs method to reload/restart marked units
Zbigniew Jędrzejewski-Szmek [Sat, 30 Jan 2021 18:44:15 +0000 (19:44 +0100)] 
core: add EnqueueMarkedJobs method to reload/restart marked units

We support two return types for methods that start jobs. EnqueueJob support the
full-monty mode with affected jobs. I didn't do this here, since it seems
unlikely to be used. In the common case there'd be a huge list of jobs and
affected jobs. EnqueueMarkedJobs() just returns a list of jobs that we can wait
upon.

The name of the method is generic in case we decide to add something other than
just reload/restart later on.

When errors occur, resource errors are treated as fatal, but for other error
types we queue up other jobs, and only return an error at the end. The
assumption is that the caller will ignore the result error anyway, so it's
better to try to reload/restart as much as possible.

3 years agocore: allow Markers to be set using set-property
Zbigniew Jędrzejewski-Szmek [Sat, 6 Feb 2021 10:39:55 +0000 (11:39 +0100)] 
core: allow Markers to be set using set-property

3 years agocore/dbus-unit: reduce scope of iterator variables
Zbigniew Jędrzejewski-Szmek [Fri, 12 Feb 2021 09:25:13 +0000 (10:25 +0100)] 
core/dbus-unit: reduce scope of iterator variables

3 years agocore: add Unit.Markers property
Zbigniew Jędrzejewski-Szmek [Sat, 30 Jan 2021 15:58:19 +0000 (16:58 +0100)] 
core: add Unit.Markers property

The property is never set by systemd, only reset after a stop or restart or
reload. It may externally be set to mark the unit for a later restart/reload.

I wasn't sure whether to configure the property only for the types where this
makes sense (Service, Swap, etc). But Restart() method is defined on the unit,
and also having this always under the same property name is more convenient.

3 years agoMerge pull request #18593 from keszybz/fuzz-more-systemctl-paths
Luca Boccassi [Mon, 15 Feb 2021 19:13:58 +0000 (19:13 +0000)] 
Merge pull request #18593 from keszybz/fuzz-more-systemctl-paths

Fuzz more systemctl paths

3 years agoRevert "ci: build on Fedora ELN as well"
Frantisek Sumsal [Mon, 15 Feb 2021 18:58:31 +0000 (19:58 +0100)] 
Revert "ci: build on Fedora ELN as well"

This reverts commit 58bc1735fed62bc7426187a80d166369569e799a.

The ELN composes are quite unstable and take a while to refresh. Let's
drop them again and revisit this once they get more mature to reduce
the CI noise.

3 years agoFix micmute hotkey on HP EliteBook Folio G1
RussianNeuroMancer [Mon, 15 Feb 2021 07:57:29 +0000 (15:57 +0800)] 
Fix micmute hotkey on HP EliteBook Folio G1

Desktop environments expect f20 hotkey instead of micmute

3 years agoupdate TODO
Lennart Poettering [Mon, 15 Feb 2021 18:23:05 +0000 (19:23 +0100)] 
update TODO

3 years agoresolved: filter repeated stub queries 18605/head
Lennart Poettering [Fri, 6 Nov 2020 16:30:58 +0000 (17:30 +0100)] 
resolved: filter repeated stub queries

Let's suppress repeated stub queries coming in, to minimize resource
usage. Many DNS clients are pretty aggressive regarding repeating DNS
requests, hence let's find them and suppress the follow-ups should we
need more time to fulfill the queries.

3 years agoresolved: allow DNS_PACKET_DATA() argument to be const
Lennart Poettering [Fri, 6 Nov 2020 16:30:32 +0000 (17:30 +0100)] 
resolved: allow DNS_PACKET_DATA() argument to be const

3 years agoresolved: allow DNS_PACKET_DATA() argument to be const 18604/head
Lennart Poettering [Fri, 6 Nov 2020 16:30:32 +0000 (17:30 +0100)] 
resolved: allow DNS_PACKET_DATA() argument to be const

3 years agoresolved: move mdns event sources close to the fds
Lennart Poettering [Fri, 6 Nov 2020 13:51:55 +0000 (14:51 +0100)] 
resolved: move mdns event sources close to the fds

3 years agorlimit-util: log when falling back setting limit
Pierre Dubouilh [Sun, 14 Feb 2021 23:16:30 +0000 (00:16 +0100)] 
rlimit-util: log when falling back setting limit

3 years agoMerge pull request #18580 from keszybz/signal-list
Lennart Poettering [Mon, 15 Feb 2021 13:37:03 +0000 (14:37 +0100)] 
Merge pull request #18580 from keszybz/signal-list

Add systemctl --signal=list

3 years agotest: install binaries from local d/control file
Luca Boccassi [Sun, 14 Feb 2021 19:29:42 +0000 (19:29 +0000)] 
test: install binaries from local d/control file

The source package in the apt cache might be older than the
packaging from salsa.debian.org/systemd-team/systemd so it might not
list all the current binary packages.
This is currently the case for systemd-timesyncd, so TEST-30 fails.

Simply grep the control file rather than using apt-cache when iterating
over the packages contents.

3 years agohwdb: add resolution for Waltop/MEDION batteryless graphics tablet (v:172f p:0505)
Florian Hülsmann [Sun, 14 Feb 2021 20:05:22 +0000 (21:05 +0100)] 
hwdb: add resolution for Waltop/MEDION batteryless graphics tablet (v:172f p:0505)

3 years agotree-wide: fix typo
Yu Watanabe [Mon, 15 Feb 2021 06:47:17 +0000 (15:47 +0900)] 
tree-wide: fix typo

3 years agofuzz-systemctl-parse-argv: add argv[0] values to corpus 18593/head
Zbigniew Jędrzejewski-Szmek [Mon, 15 Feb 2021 08:58:54 +0000 (09:58 +0100)] 
fuzz-systemctl-parse-argv: add argv[0] values to corpus

3 years agosystemctl: use argv[0] not program_invocation_short_name for arg dispatch
Zbigniew Jędrzejewski-Szmek [Mon, 15 Feb 2021 08:54:14 +0000 (09:54 +0100)] 
systemctl: use argv[0] not program_invocation_short_name for arg dispatch

The immediate motivation is to allow fuzz-systemctl-parse-argv to cover also
the other code paths. p_i_s_n is not getting set (and it probably shouldn't),
so the fuzzer would only cover the paths for ./systemctl, and not ./reboot,
etc. Looking at argv[0] instead, which is passed as part of the fuzzer data,
fixes that.

But I think in general it's more correct to look at argv[0] here: after all we
have all the information available through local variables and shouldn't go out
of our way to look at a global.

3 years agotest-parse-argument: add a test for the three parse_*_argument() functions 18580/head
Zbigniew Jędrzejewski-Szmek [Sun, 14 Feb 2021 12:35:32 +0000 (13:35 +0100)] 
test-parse-argument: add a test for the three parse_*_argument() functions

This mostly tests the return values and that the xsprintf
buffers are big enough.

3 years agoMove and rename parse_json_argument() function
Zbigniew Jędrzejewski-Szmek [Sun, 14 Feb 2021 10:45:01 +0000 (11:45 +0100)] 
Move and rename parse_json_argument() function

json.[ch] is a very generic implementation, and cmdline argument parsing
doesn't fit there.

3 years agoMove and rename parse_path_argument() function
Zbigniew Jędrzejewski-Szmek [Sun, 14 Feb 2021 10:39:48 +0000 (11:39 +0100)] 
Move and rename parse_path_argument() function

This fits better in shared/, and the new parse-argument.c file is a good home
for it.

3 years agobasic/signal-util: drop unneeded extra byte from buffer
Zbigniew Jędrzejewski-Szmek [Sun, 14 Feb 2021 15:02:47 +0000 (16:02 +0100)] 
basic/signal-util: drop unneeded extra byte from buffer

DECIMAL_STR_MAX() already returns +1 for NULL, so no need to do it
a second time.

3 years agosystemctl,loginctl,machinectl: add --signal=list
Zbigniew Jędrzejewski-Szmek [Sat, 13 Feb 2021 15:03:03 +0000 (16:03 +0100)] 
systemctl,loginctl,machinectl: add --signal=list

This lists numerical signal values:
$ systemctl --signal list
SIGNAL NAME
1      SIGHUP
2      SIGINT
3      SIGQUIT
...
62     SIGRTMIN+28
63     SIGRTMIN+29
64     SIGRTMIN+30

This is useful when trying to kill e.g. systemd with a specific signal number
using kill. kill doesn't accept our fancy signal names like RTMIN+4, so one
would have to calculate that value somehow. Doing
  systemctl --signal list | grep -F RTMIN+4
is a nice way of doing that.

3 years agoci: switch back to meson-0.56.2
Evgeny Vereshchagin [Mon, 15 Feb 2021 03:48:03 +0000 (03:48 +0000)] 
ci: switch back to meson-0.56.2

It seems there is another meson (0.57.0) regression preventing clang from
building systemd with --optimization=3 -Db_lto=true

By analogy with https://github.com/google/oss-fuzz/pull/5199 let's just switch
to 0.56.2 for the time being

3 years agoMerge pull request #18588 from poettering/refuse-loops
Yu Watanabe [Mon, 15 Feb 2021 02:10:32 +0000 (11:10 +0900)] 
Merge pull request #18588 from poettering/refuse-loops

resolved: try hard to never enter packet loops between resolved's stub and resolved's client

3 years agoMerge pull request #18587 from poettering/rr-count-workaround
Yu Watanabe [Mon, 15 Feb 2021 01:55:10 +0000 (10:55 +0900)] 
Merge pull request #18587 from poettering/rr-count-workaround

two fixes for handling misformed packets more gracefully.

3 years agoresolvectl: add support for various new flags
Lennart Poettering [Tue, 3 Nov 2020 19:08:51 +0000 (20:08 +0100)] 
resolvectl: add support for various new flags