]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agoMerge pull request #16947 from keszybz/socket-parsing-rework
Lennart Poettering [Thu, 10 Sep 2020 14:47:37 +0000 (16:47 +0200)] 
Merge pull request #16947 from keszybz/socket-parsing-rework

Socket parsing rework

3 years agoMerge pull request #17003 from yuwata/conf-parser-downgrade-log-level
Zbigniew Jędrzejewski-Szmek [Thu, 10 Sep 2020 13:43:29 +0000 (15:43 +0200)] 
Merge pull request #17003 from yuwata/conf-parser-downgrade-log-level

tree-wide: downgrade log level in conf-parsers

3 years agosd-netlink: add MDB types
Daniel Mack [Wed, 9 Sep 2020 12:06:20 +0000 (14:06 +0200)] 
sd-netlink: add MDB types

These are used to configure multicast membership entries of bridge ports.

3 years agoMerge pull request #16986 from yuwata/network-fix-routing-policy-rule-issue-16784
Lennart Poettering [Thu, 10 Sep 2020 12:50:38 +0000 (14:50 +0200)] 
Merge pull request #16986 from yuwata/network-fix-routing-policy-rule-issue-16784

network: fix routing policy rule issue

3 years agofs-util,tmpfiles: fix error handling of fchmod_opath()
Lennart Poettering [Wed, 9 Sep 2020 18:35:33 +0000 (20:35 +0200)] 
fs-util,tmpfiles: fix error handling of fchmod_opath()

When 4dfaa528d45 was first commited its callers relied on `errno` instead of the
return value for error reporting. Which worked fine, since internally
under all conditions base were set — even if ugly and not inline with
our coding style. Things then got broken in
f8606626ed3c2582e06543550d58fe9886cdca5f where suddenly additional
syscalls might end up being done in the function, thus corrupting `errno`.

3 years agosystemd-user: move pam snippet default location to /usr/lib/pam.d
Lennart Poettering [Wed, 9 Sep 2020 16:55:35 +0000 (18:55 +0200)] 
systemd-user: move pam snippet default location to /usr/lib/pam.d

3 years agobootctl: don't accidentally propagate errors in "bootctl status"
Lennart Poettering [Wed, 9 Sep 2020 21:04:17 +0000 (23:04 +0200)] 
bootctl: don't accidentally propagate errors in "bootctl status"

Fixes: #16989
3 years agotest-network: update tests for issue #16784 16986/head
Yu Watanabe [Tue, 8 Sep 2020 20:09:58 +0000 (05:09 +0900)] 
test-network: update tests for issue #16784

3 years agonetwork: replace FRA_IFNAME -> FRA_IIFNAME
Yu Watanabe [Tue, 8 Sep 2020 20:05:08 +0000 (05:05 +0900)] 
network: replace FRA_IFNAME -> FRA_IIFNAME

No functional change, as FRA_IFNAME is an alias of FRA_IIFNAME.

3 years agonetwork: also process RTM_NEWRULE or RTM_DELRULE message which does not contain src...
Yu Watanabe [Tue, 8 Sep 2020 19:59:39 +0000 (04:59 +0900)] 
network: also process RTM_NEWRULE or RTM_DELRULE message which does not contain src and dst addresses

Fixes #16784.

3 years agonetwork: fix the default mask for FirewallMark=
Yu Watanabe [Tue, 8 Sep 2020 19:45:54 +0000 (04:45 +0900)] 
network: fix the default mask for FirewallMark=

And always send FRA_FWMASK if FirewallMark= is set.

C.f. https://github.com/torvalds/linux/commit/b8964ed9fa727109c9084abc807652ebfb681c18

Partially fixes #16784.

3 years agonetwork: do not assign return value if the parse_fwmark_fwmask() fails
Yu Watanabe [Tue, 8 Sep 2020 19:26:49 +0000 (04:26 +0900)] 
network: do not assign return value if the parse_fwmark_fwmask() fails

This also removes redundant logs, and makes input string not copied if
it does not contain '/'.

3 years agonetwork: add debug log for removing routing policy rules
Yu Watanabe [Tue, 8 Sep 2020 18:50:08 +0000 (03:50 +0900)] 
network: add debug log for removing routing policy rules

3 years agonetwork: also logs priority of routing policy rules
Yu Watanabe [Tue, 8 Sep 2020 18:49:14 +0000 (03:49 +0900)] 
network: also logs priority of routing policy rules

3 years agonetwork: update log message for rtnl messages
Yu Watanabe [Tue, 8 Sep 2020 18:12:38 +0000 (03:12 +0900)] 
network: update log message for rtnl messages

3 years agocore: downgrade error level and ignore several non-critical errors 17003/head
Yu Watanabe [Thu, 10 Sep 2020 07:24:31 +0000 (16:24 +0900)] 
core: downgrade error level and ignore several non-critical errors

3 years agohomed: downgrade log level
Yu Watanabe [Thu, 10 Sep 2020 06:21:43 +0000 (15:21 +0900)] 
homed: downgrade log level

3 years agojournal: downgrade log level
Yu Watanabe [Thu, 10 Sep 2020 06:20:35 +0000 (15:20 +0900)] 
journal: downgrade log level

3 years agologin: downgrade log level if the error will be ignored
Yu Watanabe [Thu, 10 Sep 2020 06:18:26 +0000 (15:18 +0900)] 
login: downgrade log level if the error will be ignored

3 years agonspawn: downgrade log level if the error will be ignored
Yu Watanabe [Thu, 10 Sep 2020 06:16:14 +0000 (15:16 +0900)] 
nspawn: downgrade log level if the error will be ignored

3 years agorepart: downgrade log level
Yu Watanabe [Thu, 10 Sep 2020 06:08:13 +0000 (15:08 +0900)] 
repart: downgrade log level

3 years agoresolve: downgrade error level when the error will be ignored
Yu Watanabe [Thu, 10 Sep 2020 06:06:29 +0000 (15:06 +0900)] 
resolve: downgrade error level when the error will be ignored

3 years agoresolve: check DNSSD service name template before assigning it
Yu Watanabe [Thu, 10 Sep 2020 06:05:19 +0000 (15:05 +0900)] 
resolve: check DNSSD service name template before assigning it

3 years agoconf-parser: logs about OOM error
Yu Watanabe [Thu, 10 Sep 2020 05:14:19 +0000 (14:14 +0900)] 
conf-parser: logs about OOM error

3 years agoconf-parser: use SYNTHETIC_ERRNO() at one more place
Yu Watanabe [Thu, 10 Sep 2020 05:13:56 +0000 (14:13 +0900)] 
conf-parser: use SYNTHETIC_ERRNO() at one more place

3 years agotimesync: downgrade error level when the error will be ignored
Yu Watanabe [Thu, 10 Sep 2020 05:13:26 +0000 (14:13 +0900)] 
timesync: downgrade error level when the error will be ignored

3 years agoxdg-autostart-generator: downgrade error level when the error will be ignored
Yu Watanabe [Thu, 10 Sep 2020 05:07:56 +0000 (14:07 +0900)] 
xdg-autostart-generator: downgrade error level when the error will be ignored

3 years agovlan: downgrade error level if the error will be ignored
Yu Watanabe [Thu, 10 Sep 2020 04:52:27 +0000 (13:52 +0900)] 
vlan: downgrade error level if the error will be ignored

3 years agoethtool: downgrade log level when the error will be ignored
Yu Watanabe [Thu, 10 Sep 2020 04:50:10 +0000 (13:50 +0900)] 
ethtool: downgrade log level when the error will be ignored

3 years agonetwork: slightly update log message
Yu Watanabe [Thu, 10 Sep 2020 04:43:47 +0000 (13:43 +0900)] 
network: slightly update log message

3 years agonetwork do not ignore OOM error in config_parse_macsec_key_id()
Yu Watanabe [Thu, 10 Sep 2020 04:40:50 +0000 (13:40 +0900)] 
network do not ignore OOM error in config_parse_macsec_key_id()

3 years agonetwork: use _cleanup_ attribute at one more place
Yu Watanabe [Thu, 10 Sep 2020 04:39:01 +0000 (13:39 +0900)] 
network: use _cleanup_ attribute at one more place

3 years agonetwork: do not ignore OOM error in wireguard_decode_key_and_warn()
Yu Watanabe [Thu, 10 Sep 2020 04:38:31 +0000 (13:38 +0900)] 
network: do not ignore OOM error in wireguard_decode_key_and_warn()

3 years agonetwork: unify config_parse_wireguard_public_key() and config_parse_wireguard_preshar...
Yu Watanabe [Thu, 10 Sep 2020 04:37:02 +0000 (13:37 +0900)] 
network: unify config_parse_wireguard_public_key() and config_parse_wireguard_preshared_key()

3 years agoudev: fix indentation
Yu Watanabe [Thu, 10 Sep 2020 04:11:17 +0000 (13:11 +0900)] 
udev: fix indentation

Follow-up for 90e30d767a32dc93c9ee94ad8b8d665eecf79e96.

3 years agoMerge pull request #17000 from poettering/network-fixlets
Zbigniew Jędrzejewski-Szmek [Wed, 9 Sep 2020 22:51:16 +0000 (00:51 +0200)] 
Merge pull request #17000 from poettering/network-fixlets

network: a bunch of unimportant cleanups across the board

3 years agoMinor simplification in sockaddr_un_set_path() 16947/head
Zbigniew Jędrzejewski-Szmek [Wed, 9 Sep 2020 21:57:59 +0000 (23:57 +0200)] 
Minor simplification in sockaddr_un_set_path()

3 years agoUse sockaddr_un_set_path() in socket_address_parse()
Zbigniew Jędrzejewski-Szmek [Wed, 9 Sep 2020 21:49:51 +0000 (23:49 +0200)] 
Use sockaddr_un_set_path() in socket_address_parse()

Two functional changes:
- "/" is now refused. The test is adjusted.
- The trailing NUL is *not* included in the returned size for abstract size. The
  comments in sockaddr_un_set_path() indicate that this is the right thing to do,
  and the code in socket_address_parse() wasn't doing that.

3 years agoshared/socket-netlink: set output in socket_address_parse_netlink() only on success
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 19:25:11 +0000 (21:25 +0200)] 
shared/socket-netlink: set output in socket_address_parse_netlink() only on success

3 years agoAllow interface scopes to be specified in ListenStream=
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 13:33:25 +0000 (15:33 +0200)] 
Allow interface scopes to be specified in ListenStream=

Closes #12624.

The formatting in systemd.socket.xml is updated a bit.

Currently in_addr_port_ifindex_name_to_string() always prints the ifindex
numerically. This is not super useful since the interface numbers are
semi-random. Should we use interface names in preference?

3 years agoresolved: drop duplicated check
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 19:14:36 +0000 (21:14 +0200)] 
resolved: drop duplicated check

The same conditional appears a few lines down.

3 years agoshared: don't unconditionally set SOCK_STREAM as type in socket_address_parse()
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 21:51:21 +0000 (23:51 +0200)] 
shared: don't unconditionally set SOCK_STREAM as type in socket_address_parse()

We would set .type to a fake value. All real callers (outside of tests)
immediately overwrite .type with a proper value after calling
socket_address_parse(). So let's not set it and adjust the few places
that relied on it being set to the fake value.

socket_address_parse() is modernized to only set the output argument on
success.

3 years agoshared: make socket_address_parse use the generic parser for IPv[46] addresses
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 11:01:13 +0000 (13:01 +0200)] 
shared: make socket_address_parse use the generic parser for IPv[46] addresses

One special syntax is not supported anymore: "iface:port" would be parsed as an
interface name plus numerical port, equivalent to "[::]%iface:port". This was
added in 542563babda, but was undocumented, and we had no tests for it. It seems
that this actually wasn't doing anything useful, because the kernel only uses the
scope identifier for link-local addresses.

3 years agoGet rid of in_addr_port_from_string_auto() again
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 15:12:06 +0000 (17:12 +0200)] 
Get rid of in_addr_port_from_string_auto() again

With the commit "shared/socket-netlink: only allow ifindex if explicitly supported"
this helper is not necessary anymore.

3 years agoshared: check interface name validity in in_addr_port_ifindex_name_from_string_auto()
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 13:38:46 +0000 (15:38 +0200)] 
shared: check interface name validity in in_addr_port_ifindex_name_from_string_auto()

We don't try to resolve invalid ifnames as all. A different return
code is used. This difference will be verified later in test_socket_address_parse()
when socket_address_parse() is converted to use
in_addr_port_ifindex_name_from_string_auto().

3 years agobasic: show interface scope in sockaddr_pretty()
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 13:20:31 +0000 (15:20 +0200)] 
basic: show interface scope in sockaddr_pretty()

If the interface scope is specified, this changes the meaning of the address
quite significantly. Let's show the IPv6 scope_id if present.

Sadly we don't even have a test for sockaddr_pretty() output :(
This will be implicitly tested through socket_address_parse() later on.

3 years agobasic: convert ifname_valid_full() to take flags and allow numeric interfaces
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 12:59:21 +0000 (14:59 +0200)] 
basic: convert ifname_valid_full() to take flags and allow numeric interfaces

3 years agoshared/socket-netlink: only allow ifindex if explicitly supported
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 08:05:12 +0000 (10:05 +0200)] 
shared/socket-netlink: only allow ifindex if explicitly supported

Instead of ignoring ifindex if not wanted, refuse it is the caller
does not allow it.

3 years agotest-socket-netlink: print the proper expected string
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 10:58:30 +0000 (12:58 +0200)] 
test-socket-netlink: print the proper expected string

We would use the return value from the tested function to decide
what to print as "expected", which is confusing when something is wrong
with the tested function.

3 years agotest-in-addr-util: add log headers
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 14:55:10 +0000 (16:55 +0200)] 
test-in-addr-util: add log headers

3 years agoresolved: unify the two functions to create main stubs
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 14:45:58 +0000 (16:45 +0200)] 
resolved: unify the two functions to create main stubs

There is a small functional difference: IP_TTL==1 is now also set for the UDP
socket. I assume that it wasn't set by mistake.

3 years agoresolved: unify the two functions to create extra stubs
Zbigniew Jędrzejewski-Szmek [Thu, 3 Sep 2020 14:14:54 +0000 (16:14 +0200)] 
resolved: unify the two functions to create extra stubs

There is a minor functional change:
IPV6_FREEBIND is set of IPv6 sockets, not IP_FREEBIND. This was missed in
af8b1384, but I noticed only after the merging the two functions.

And a not-so-minor functional chagnge:
7216a3b5dcde36245 changed manager_dns_stub_tcp_fd_extra() to return the fd even
if the source was already initialized, but it didn't do the same change for
manager_dns_stub_udp_fd_extra(), so it would return 0 in that case. But
0354029bf572489b uses manager_dns_stub_udp_fd_extra() when preparing to call
manager_send(), and will pass 0 as the fd in that case. For both socket types
fd is now always returned.

3 years agoresolve: move handler functions higher
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2020 14:29:44 +0000 (16:29 +0200)] 
resolve: move handler functions higher

No functional change, preparation for subsequent refactoring.

3 years agoethtool-util: don't pass error value that isn't used to log_syntax 17000/head
Lennart Poettering [Wed, 9 Sep 2020 21:41:49 +0000 (23:41 +0200)] 
ethtool-util: don't pass error value that isn't used to log_syntax

3 years agonetwork: don't fail on various config parse errors
Lennart Poettering [Wed, 9 Sep 2020 21:06:40 +0000 (23:06 +0200)] 
network: don't fail on various config parse errors

We typically don't fail on config parse errors (to maximize compat),
let's not do this in these cases either.

3 years agotree-wide: prefer AF_xyz over PF_xyz
Lennart Poettering [Wed, 9 Sep 2020 21:05:19 +0000 (23:05 +0200)] 
tree-wide: prefer AF_xyz over PF_xyz

This really doesn't matter given that AF_xyz and PF_xyz are equivalent
in all ways, but we almost always use AF_xyz, hence stick to it
universally and convert the remaining PF_ to AF_

3 years agoman: document that sd_bus_message_close_container() may only be called at end of...
Lennart Poettering [Wed, 9 Sep 2020 16:56:24 +0000 (18:56 +0200)] 
man: document that sd_bus_message_close_container() may only be called at end of container

Prompted-by: https://lists.freedesktop.org/archives/systemd-devel/2020-September/045264.html
3 years agoMerge pull request #16985 from poettering/resolve-dns-stub-extra-fixlets
Zbigniew Jędrzejewski-Szmek [Wed, 9 Sep 2020 20:03:31 +0000 (22:03 +0200)] 
Merge pull request #16985 from poettering/resolve-dns-stub-extra-fixlets

resolved: dns stub listener extra fixes

3 years agoMerge pull request #16997 from poettering/foreach-word-followup
Zbigniew Jędrzejewski-Szmek [Wed, 9 Sep 2020 20:00:27 +0000 (22:00 +0200)] 
Merge pull request #16997 from poettering/foreach-word-followup

fix two coverity issues

3 years agocryptsetup: Fix null pointer dereference (#16987)
Mikael Szreder [Wed, 9 Sep 2020 19:26:21 +0000 (21:26 +0200)] 
cryptsetup: Fix null pointer dereference (#16987)

cryptsetup: Fix null pointer dereference

Fix null pointer dereference in the pkcs11 related code of systemd-cryptsetup

3 years agotree-wide: copy hardlinks wherever we deal with possibly large OS-style trees 16933/head
Lennart Poettering [Tue, 1 Sep 2020 21:04:29 +0000 (23:04 +0200)] 
tree-wide: copy hardlinks wherever we deal with possibly large OS-style trees

Fixes: #7382
3 years agocopy: optionally, reproduce hardlinks from source in destination
Lennart Poettering [Tue, 1 Sep 2020 21:00:14 +0000 (23:00 +0200)] 
copy: optionally, reproduce hardlinks from source in destination

This is useful for duplicating trees that contain hardlinks: we keep
track of potential hardlinks and try to reproduce them within the
destination tree. (We do not hardlink between source and destination!).

This is useful for trees like ostree images which heavily use hardlinks
and which are otherwise exploded into separate copies of all files when
we duplicate the trees.

3 years agosd-login: fix memory leak 16997/head
Lennart Poettering [Wed, 9 Sep 2020 17:38:04 +0000 (19:38 +0200)] 
sd-login: fix memory leak

Fixes: CID1432652
3 years agosocket: fix copy/paste error
Lennart Poettering [Wed, 9 Sep 2020 17:37:38 +0000 (19:37 +0200)] 
socket: fix copy/paste error

Fixes: CID1432653
3 years agologind: fix merge issue
Lennart Poettering [Wed, 9 Sep 2020 17:17:31 +0000 (19:17 +0200)] 
logind: fix merge issue

The two PRs #16664 and #16635 individually passed CI, but when combined
cannot build. Since both are merged now, let's fix that.

3 years agologin: Add KEY_RESTART handling
Robert Marko [Fri, 14 Aug 2020 11:10:18 +0000 (13:10 +0200)] 
login: Add KEY_RESTART handling

KEY_RESTART is widely used in Linux to indicate device reboot.
So lets handle it in the same fashion as KEY_POWER.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
3 years agologind.conf: document UserStopDelaySec in logind.conf
Franck Bui [Wed, 9 Sep 2020 08:49:12 +0000 (10:49 +0200)] 
logind.conf: document UserStopDelaySec in logind.conf

3 years agoMerge pull request #16635 from keszybz/do-not-for-each-word
Lennart Poettering [Wed, 9 Sep 2020 15:43:38 +0000 (17:43 +0200)] 
Merge pull request #16635 from keszybz/do-not-for-each-word

Drop FOREACH_WORD

3 years agoMerge pull request #16972 from wusto/ambient-and-keep-caps-corrections
Lennart Poettering [Wed, 9 Sep 2020 15:09:42 +0000 (17:09 +0200)] 
Merge pull request #16972 from wusto/ambient-and-keep-caps-corrections

Ambient capabilities documenation and keep-caps usage corrections

3 years agosystemctl: list unit introspection verbs first, modification second
Zbigniew Jędrzejewski-Szmek [Wed, 9 Sep 2020 09:19:38 +0000 (11:19 +0200)] 
systemctl: list unit introspection verbs first, modification second

The list was rather ad hoc, with "reset-failed" sandwiched between
"help" and "list-dependencies". Since a person will usually either want
to introspect state in various ways or modify state in a certain way, let's
put all the introspection commands together and all the ones that actually
have an effect second.

3 years agoMerge pull request #16984 from yuwata/make-log_xxx_error-void
Lennart Poettering [Wed, 9 Sep 2020 14:28:51 +0000 (16:28 +0200)] 
Merge pull request #16984 from yuwata/make-log_xxx_error-void

Make log_xxx_error() or friends return void

3 years agoMerge pull request #16982 from yuwata/socket-buffer-size
Lennart Poettering [Wed, 9 Sep 2020 14:28:21 +0000 (16:28 +0200)] 
Merge pull request #16982 from yuwata/socket-buffer-size

Fixes for socket buffer size

3 years agocore: fix set keep caps for ambient capabilities 16972/head
Tobias Kaufmann [Fri, 31 Jul 2020 08:57:39 +0000 (10:57 +0200)] 
core: fix set keep caps for ambient capabilities

The securebit keep-caps retains the capabilities in the permitted set
over an UID change (ambient capabilities are cleared though).

Setting the keep-caps securebit after the uid change and before execve
doesn't make sense as it is cleared during execve and there is no
additional user ID change after this point.

Altough the documentation (man 7 capabilities) is ambigious, keep-caps
is reset during execve although keep-caps-locked is set. After execve
only keep-caps-locked is set and keep-caps is cleared.

3 years agocore: fix comments on ambient capabilities
Tobias Kaufmann [Fri, 31 Jul 2020 08:57:15 +0000 (10:57 +0200)] 
core: fix comments on ambient capabilities

The comments on the code for ambient capabilities was wrong/outdated.

3 years agoRename strv_split_extract() to strv_split_full() 16635/head
Zbigniew Jędrzejewski-Szmek [Mon, 3 Aug 2020 15:52:01 +0000 (17:52 +0200)] 
Rename strv_split_extract() to strv_split_full()

Now that _full() is gone, we can rename _extract() to have the usual suffix
we use for the more featureful version.

3 years agoRemove FOREACH_WORD and friends
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 13:04:26 +0000 (15:04 +0200)] 
Remove FOREACH_WORD and friends

3 years agotree-wide: replace strv_split_full() with strv_split_extract() everywhere
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 14:21:14 +0000 (16:21 +0200)] 
tree-wide: replace strv_split_full() with strv_split_extract() everywhere

Behaviour is not identical, as shown by the tests in test-strv.
The combination of EXTRACT_UNQUOTE without EXTRACT_RELAX only appears in
the test, so it doesn't seem particularly important. OTOH, the difference
in handling of squished parameters could make a difference. New behaviour
is what both bash and python do, so I think we can ignore this corner case.

This change has the following advantages:
- the duplication of code paths that do a very similar thing is removed
- extract_one_word() / strv_split_extract() return a proper error code.

3 years agotest-string-util: stop testing FOREACH_WORD
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 13:07:23 +0000 (15:07 +0200)] 
test-string-util: stop testing FOREACH_WORD

3 years agoshared/fstab-util: replace FOREACH_WORD_SEPARATOR() with open-coded loop
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 12:40:23 +0000 (14:40 +0200)] 
shared/fstab-util: replace FOREACH_WORD_SEPARATOR() with open-coded loop

The tricky part here is that the function is not allowed to fail in this code
path. Initially, I wanted to change the return value to allow it to fail, but
this cascades through all the places where fstab_test_option() and friends are
used; updating all those sites would be a lot of work. And since quoting is not
allowed here, a simple loop with strcspn() is easy to do.

3 years agoshared/fstab-util: use free_and_str[n]dup()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 12:27:14 +0000 (14:27 +0200)] 
shared/fstab-util: use free_and_str[n]dup()

No functional change. I'm keeping this separate to make review easier.

3 years agoUse extract_first_word() in generated conf parsers
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 10:07:49 +0000 (12:07 +0200)] 
Use extract_first_word() in generated conf parsers

3 years agonspawn: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:57:03 +0000 (11:57 +0200)] 
nspawn: use extract_first_word()

3 years agogetty-generator: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:47:03 +0000 (11:47 +0200)] 
getty-generator: use extract_first_word()

3 years agosd-journal: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:38:08 +0000 (11:38 +0200)] 
sd-journal: use extract_first_word()

3 years agodelta: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:28:11 +0000 (11:28 +0200)] 
delta: use extract_first_word()

3 years agocryptsetup: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:23:44 +0000 (11:23 +0200)] 
cryptsetup: use extract_first_word()

3 years agocore/load-fragment: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 09:19:25 +0000 (11:19 +0200)] 
core/load-fragment: use extract_first_word()

This is much nicer, and also fixes a potential overflow when we used
'word' in log_error() as if it was a NUL-terminated string.

3 years agoLet sd_machine_get_ifindices() omit the output param too
Zbigniew Jędrzejewski-Szmek [Thu, 30 Jul 2020 11:08:52 +0000 (13:08 +0200)] 
Let sd_machine_get_ifindices() omit the output param too

Nowadays we do that almost everywhere, let's also do it here.

3 years agoRewrite sd_machine_get_ifindices() to avoid FOREACH_WORD()
Zbigniew Jędrzejewski-Szmek [Thu, 30 Jul 2020 10:56:51 +0000 (12:56 +0200)] 
Rewrite sd_machine_get_ifindices() to avoid FOREACH_WORD()

If we fail to parse the index, the failure is propogated as -EUNCLEAN.
(-EINVAL would be confused with invalid args to the function itself.)

3 years agoFix output value of sd_seat_get_sessions() and drop FOREACH_WORD use
Zbigniew Jędrzejewski-Szmek [Thu, 30 Jul 2020 10:43:07 +0000 (12:43 +0200)] 
Fix output value of sd_seat_get_sessions() and drop FOREACH_WORD use

sd_seat_get_sessions() would return 0 in the 'n_uids' (now 'ret_n_uids') output
parameter when 'uid' (now 'ret_uids') was passed as NULL.

While at it, drop FOREACH_WORD() use.

Also use any whitespace as separator. In practice this shouldn't matter, since
logind always uses spaces, but it seems nicer to not specify this explicitly,
and the default is more flexible.

3 years agosd-device: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Wed, 29 Jul 2020 10:09:08 +0000 (12:09 +0200)] 
sd-device: use extract_first_word()

3 years agobasic/cgroup-util: port over to string_contains_word()
Zbigniew Jędrzejewski-Szmek [Wed, 29 Jul 2020 10:01:21 +0000 (12:01 +0200)] 
basic/cgroup-util: port over to string_contains_word()

3 years agologind: use extract_first_word()
Zbigniew Jędrzejewski-Szmek [Wed, 29 Jul 2020 09:47:38 +0000 (11:47 +0200)] 
logind: use extract_first_word()

3 years agoudev: warn if failed to set buffer size for device monitor 16982/head
Yu Watanabe [Tue, 8 Sep 2020 21:46:54 +0000 (06:46 +0900)] 
udev: warn if failed to set buffer size for device monitor

3 years agonetwork: increase receive buffer size for device monitor
Yu Watanabe [Tue, 8 Sep 2020 14:28:22 +0000 (23:28 +0900)] 
network: increase receive buffer size for device monitor

If networkd creates huge amount of netdevs, then the buffer of device
monitor becomes easily flowed.

Hopefully fixes #16865.

3 years agonetwork: do not start device monitor if /sys is read-only
Yu Watanabe [Tue, 8 Sep 2020 14:26:28 +0000 (23:26 +0900)] 
network: do not start device monitor if /sys is read-only

Follow-up for bf331d87171b7750d1c72ab0b140a240c0cf32c3.

3 years agonetwork: honor the buffer size specified in networkd.socket
Yu Watanabe [Tue, 8 Sep 2020 15:33:11 +0000 (00:33 +0900)] 
network: honor the buffer size specified in networkd.socket

3 years agocore/socket: use fd_set_{rcv,snd}buf()
Yu Watanabe [Tue, 8 Sep 2020 15:25:23 +0000 (00:25 +0900)] 
core/socket: use fd_set_{rcv,snd}buf()

3 years agosd-device-monitor: use fd_set_rcvbuf()
Yu Watanabe [Tue, 8 Sep 2020 15:22:21 +0000 (00:22 +0900)] 
sd-device-monitor: use fd_set_rcvbuf()

3 years agoutil: introduce fd_set_{snd,rcv}buf()
Yu Watanabe [Tue, 8 Sep 2020 16:12:38 +0000 (01:12 +0900)] 
util: introduce fd_set_{snd,rcv}buf()