]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 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.

4 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

4 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

4 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

4 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.

4 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)

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

4 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.

4 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.

4 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.

4 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.

4 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.

4 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

4 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

4 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.

4 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

4 years agoMerge pull request #18563 from poettering/nss-resolve-no-valid
Yu Watanabe [Mon, 15 Feb 2021 01:43:49 +0000 (10:43 +0900)] 
Merge pull request #18563 from poettering/nss-resolve-no-valid

timesyncd: for off dnssec in resolved

4 years agoresolved: refuse sending packets to our own stub listeners 18588/head
Lennart Poettering [Thu, 5 Nov 2020 15:27:55 +0000 (16:27 +0100)] 
resolved: refuse sending packets to our own stub listeners

A previous commit made sure that when one of our own packets is looped
back to us, we ignore it. But let's go one step further, and refuse
operation if we notice the server we talk to is our own. This way we
won't generate unnecessary traffic and can return a cleaner error.

Fixes: #17413
4 years agoresolved: refuse packets looped back to us
Lennart Poettering [Thu, 5 Nov 2020 14:40:53 +0000 (15:40 +0100)] 
resolved: refuse packets looped back to us

Fixes: #17413
4 years agoresolved: rename manager_our_packet() → manager_packet_from_local_address()
Lennart Poettering [Thu, 5 Nov 2020 14:54:47 +0000 (15:54 +0100)] 
resolved: rename manager_our_packet() → manager_packet_from_local_address()

Let's be more precise in naming this function, after all this doesn#t
actually check if the packet is really ours, but just that the source IP
address is a local one. Hence name it that way.

(This is preparation to add a helper that checks if packet belongs to
local transaction later on)

4 years agoresolved: tweak answer reserve/clone logic a bit
Lennart Poettering [Thu, 5 Nov 2020 13:11:30 +0000 (14:11 +0100)] 
resolved: tweak answer reserve/clone logic a bit

Let's add some overflow checks. Also, if 0 records are reserved, use
this as indication that a copy shall be done and do not grow the answer
beyond the current size.

4 years agoresolved: gracefully handle trailing packet garbage 18587/head
Lennart Poettering [Tue, 10 Nov 2020 13:52:25 +0000 (14:52 +0100)] 
resolved: gracefully handle trailing packet garbage

Similar to the previous commit: if we see trailing garbage in a DNS
packet, let's assume EDNS is borked too, and suppress it.

4 years agoresolved: gracefully handle with packets with too large RR count
Lennart Poettering [Tue, 10 Nov 2020 13:48:13 +0000 (14:48 +0100)] 
resolved: gracefully handle with packets with too large RR count

Apparently, there are plenty routers in place that report an incorrect
RR count in the packets: they declare more RRs than are actually
included.

Let's accept these responses, but let's downgrade them to baseline, i.e.
let's suppress OPT in this case: if they don't even get the RR count
right, let's operate on the absolute baseline, and not bother with
anything fancier such as EDNS.

Prompted-by: https://github.com/systemd/systemd/issues/12841#issuecomment-724063973
Fixes: #3980
Most likely fixes: #12841

4 years agoresolved: if request on stub has AD set, respond with valid AD even if DO is not set
Lennart Poettering [Thu, 5 Nov 2020 10:30:42 +0000 (11:30 +0100)] 
resolved: if request on stub has AD set, respond with valid AD even if DO is not set

Fixes: #6434
4 years agounits: turn off DNSSEC validation when timesyncd resolves hostnames 18563/head
Lennart Poettering [Thu, 5 Nov 2020 10:20:32 +0000 (11:20 +0100)] 
units: turn off DNSSEC validation when timesyncd resolves hostnames

We have a chicken and egg problem: validation of DNSSEC signatures
doesn't work without a correct clock, but to set the correct clock we
need to contact NTP servers which requires resolving a hostname, which
would normally require DNSSEC validation.

Let's break the cycle by excluding NTP hostname resolution from
validation for now.

Of course, this leaves NTP traffic unprotected. To cover that we need
NTPSEC support, which we can add later.

Fixes: #5873 #15607
4 years agonss-resolve: allow turning off validation via env var
Lennart Poettering [Thu, 5 Nov 2020 10:18:20 +0000 (11:18 +0100)] 
nss-resolve: allow turning off validation via env var

4 years agoMerge pull request #18565 from poettering/randomize-answers
Luca Boccassi [Sun, 14 Feb 2021 19:35:54 +0000 (19:35 +0000)] 
Merge pull request #18565 from poettering/randomize-answers

resolved: randomize order in local query replies

4 years agohwdb: Add accel orientation quirk for Reeder A8iW Tablet
Ardy [Sat, 13 Feb 2021 16:13:20 +0000 (19:13 +0300)] 
hwdb: Add accel orientation quirk for Reeder A8iW Tablet

Add a quirk to fix the accelerometer orientation on the
Reeder A8iW tablet.

4 years agosystemctl,loginctl,machinectl: use a shared helper for arg_signal
Zbigniew Jędrzejewski-Szmek [Sat, 13 Feb 2021 14:55:10 +0000 (15:55 +0100)] 
systemctl,loginctl,machinectl: use a shared helper for arg_signal

I seems frivolous to yet another two -util.[ch] files, but the helper
should be in shared/ and it doesn't seem to fit anywhere else.

4 years agoresolved: randomize RR order in answers each time we get something from the cache 18565/head
Lennart Poettering [Thu, 5 Nov 2020 13:10:40 +0000 (14:10 +0100)] 
resolved: randomize RR order in answers each time we get something from the cache

This allows some minimal, crappy load balancing.

Fixes: #16297
4 years agoanswer: minor refactor – move link local check into RR code
Lennart Poettering [Thu, 5 Nov 2020 12:34:22 +0000 (13:34 +0100)] 
answer: minor refactor – move link local check into RR code

4 years agoanswer: add helper for randomizing RR of answers
Lennart Poettering [Thu, 5 Nov 2020 12:33:52 +0000 (13:33 +0100)] 
answer: add helper for randomizing RR of answers

4 years agorandom-util: add random_u64_range() that acquires a random number from a certain...
Lennart Poettering [Wed, 11 Nov 2020 13:44:35 +0000 (14:44 +0100)] 
random-util: add random_u64_range() that acquires a random number from a certain range, unbiased

So far we have been quite sloppy with this and ignored modulus and range
bias. Let's do something about, and add the option to do better.

4 years agosystemctl: inline iterator declarations
Zbigniew Jędrzejewski-Szmek [Sun, 14 Feb 2021 10:50:08 +0000 (11:50 +0100)] 
systemctl: inline iterator declarations

4 years agobasic/string-table: inline the iterator declaration
Zbigniew Jędrzejewski-Szmek [Sat, 13 Feb 2021 15:08:04 +0000 (16:08 +0100)] 
basic/string-table: inline the iterator declaration

4 years agoNEWS: add a note about no longer probind mmcblk*boot*
Luca Boccassi [Sat, 13 Feb 2021 16:05:51 +0000 (16:05 +0000)] 
NEWS: add a note about no longer probind mmcblk*boot*

4 years agoNEWS: fix typo: as → at
Ansgar Burchardt [Sat, 13 Feb 2021 15:04:55 +0000 (16:04 +0100)] 
NEWS: fix typo: as → at

4 years agono blkid for mmcblk[0-9]boot[0-9]
Alan Perry [Sat, 13 Feb 2021 03:08:28 +0000 (19:08 -0800)] 
no blkid for mmcblk[0-9]boot[0-9]

Don't run blkid on mmcblk[0-9]boot[0-9] devices because they contain
bootloaders or boot parameters, and not partitions or file systems.

4 years agoMerge pull request #18401 from anitazha/oomdxattr
Zbigniew Jędrzejewski-Szmek [Sat, 13 Feb 2021 09:00:31 +0000 (10:00 +0100)] 
Merge pull request #18401 from anitazha/oomdxattr

oomd: implement avoid/omit support for cgroups

4 years agoAdded Trekstor Yourbook C11B to 60-sensor.hwdb
Nick [Fri, 12 Feb 2021 16:57:26 +0000 (16:57 +0000)] 
Added Trekstor Yourbook C11B to 60-sensor.hwdb

Added the Trekstor Yourbook C11B which is equivalent to Trekstor Primebook C11B.

4 years agoudev: make net_setup_link builtin quiet when link vanishes while we operate on it
Lennart Poettering [Fri, 12 Feb 2021 20:16:27 +0000 (21:16 +0100)] 
udev: make net_setup_link builtin quiet when link vanishes while we operate on it

Fixes: #16175
4 years agocore: slightly improve error message on load errors
Lennart Poettering [Fri, 12 Feb 2021 22:39:49 +0000 (23:39 +0100)] 
core: slightly improve error message on load errors

Let's be a bit more helpful when refusing jobs on units that failed to
load properly. We already have explicit D-Bus errors for the error
conditions that are common and expected (such as "not found"), but for
the rest we so far generate a fairly cryptic message.

Let's try to be friendlier towards users and suggest what to do on such
errors.

Fixes: #16487
4 years agoMerge pull request #18555 from yuwata/network-address-set-flag-on-remove
Yu Watanabe [Sat, 13 Feb 2021 08:44:58 +0000 (17:44 +0900)] 
Merge pull request #18555 from yuwata/network-address-set-flag-on-remove

network: address: also set IFA_FLAGS on remove

4 years agoMerge pull request #18455 from yuwata/network-change-link-state-only-when-new-address...
Yu Watanabe [Sat, 13 Feb 2021 08:43:27 +0000 (17:43 +0900)] 
Merge pull request #18455 from yuwata/network-change-link-state-only-when-new-address-or-route-will-be-assigned

network: change link state only when new address or route will be assigned

4 years agoNEWS: mention new systemctl verb and fix typo
Luca Boccassi [Fri, 12 Feb 2021 23:34:35 +0000 (23:34 +0000)] 
NEWS: mention new systemctl verb and fix typo

4 years agoman: document ManagedOOMPreference= 18401/head
Anita Zhang [Fri, 29 Jan 2021 01:35:17 +0000 (17:35 -0800)] 
man: document ManagedOOMPreference=

4 years agooom: add unit file settings for oomd avoid/omit xattrs
Anita Zhang [Thu, 28 Jan 2021 10:31:44 +0000 (02:31 -0800)] 
oom: add unit file settings for oomd avoid/omit xattrs

4 years agoMerge pull request #18568 from keszybz/v248-prep
Lennart Poettering [Fri, 12 Feb 2021 20:43:31 +0000 (21:43 +0100)] 
Merge pull request #18568 from keszybz/v248-prep

Start preparing for v238-rc1

4 years agoresolved: never route DNSSEC traffic to LLMNR/mDNS
Lennart Poettering [Tue, 3 Nov 2020 19:07:02 +0000 (20:07 +0100)] 
resolved: never route DNSSEC traffic to LLMNR/mDNS

LLMNR/mDNS don't support DNSSEC, hence there's no point in routing any
lookups asking for DNSSEC there.

This speeds up looking up DNSSEC RRs for top-level domains, since we
don't have to wait for LLMNR to complete.

4 years agoNEWS: start preparing for v248 18568/head
Zbigniew Jędrzejewski-Szmek [Fri, 12 Feb 2021 17:50:41 +0000 (18:50 +0100)] 
NEWS: start preparing for v248

4 years agohwdb: update for v248
Zbigniew Jędrzejewski-Szmek [Fri, 12 Feb 2021 15:15:53 +0000 (16:15 +0100)] 
hwdb: update for v248

As usual, it seems to be additions and updates, no major removals.

4 years agosyscall-tables: add missing preposition and fix file name path
Zbigniew Jędrzejewski-Szmek [Fri, 12 Feb 2021 15:29:26 +0000 (16:29 +0100)] 
syscall-tables: add missing preposition and fix file name path

I added an extension in 1f6f8cc8039a204609ddab79791ef22ee6340da0 but
forgot to fix the consumer script.

4 years agoMerge pull request #18558 from poettering/have-tpm2
Lennart Poettering [Fri, 12 Feb 2021 14:49:20 +0000 (15:49 +0100)] 
Merge pull request #18558 from poettering/have-tpm2

ask the uefi firmware if TPM2 support is available

4 years agotest-network: merge test_address_static and test_address_preferred_lifetime_zero_ipv6 18555/head
Yu Watanabe [Fri, 12 Feb 2021 06:01:20 +0000 (15:01 +0900)] 
test-network: merge test_address_static and test_address_preferred_lifetime_zero_ipv6

4 years agonetwork: address: do not set IFA_F_PERMANENT flag
Yu Watanabe [Fri, 12 Feb 2021 05:44:42 +0000 (14:44 +0900)] 
network: address: do not set IFA_F_PERMANENT flag

The flag is automatically set by kernel when the valid lifetime is
infinite. Note that the flag in netlink message for IPv4 address is
ignored. See set_ifa_lifetime() in kernel's net/ipv4/devinet.c.
But the flag is honored for IPv6 address. And if the flag is set with
finite valid lifetime, the address will not removed automatically by
the kernel.

4 years agonetwork: address: also set IFA_FLAGS on remove
Yu Watanabe [Thu, 11 Feb 2021 17:56:43 +0000 (02:56 +0900)] 
network: address: also set IFA_FLAGS on remove

If an address is assigned with IFA_F_MANAGETEMPADDR, then the flag must
be also set on remove. Otherwise, temporary addresses will not be
removed. See also inet6_rtm_deladdr() in kernel's net/ipv6/addrconf.c.

Fixes #13218.

4 years agonetwork: dhcp6: change link state into "configuring" only when a new address or route... 18455/head
Yu Watanabe [Wed, 3 Feb 2021 16:00:59 +0000 (01:00 +0900)] 
network: dhcp6: change link state into "configuring" only when a new address or route will be assigned

4 years agonetwork: ndisc: change link state into "configuring" only when a new address or route...
Yu Watanabe [Wed, 3 Feb 2021 16:00:42 +0000 (01:00 +0900)] 
network: ndisc: change link state into "configuring" only when a new address or route will be assigned

4 years agonetwork: dhcp6: fix condtion check
Yu Watanabe [Wed, 3 Feb 2021 15:52:28 +0000 (00:52 +0900)] 
network: dhcp6: fix condtion check

4 years agonetwork: set return value at the end of the function
Yu Watanabe [Wed, 3 Feb 2021 15:44:03 +0000 (00:44 +0900)] 
network: set return value at the end of the function

The later netlink_call_async() call may fail. We should not touch the
return value when the function failed.

4 years agonetwork: make address_configure() or friends return 1 when the address is new
Yu Watanabe [Wed, 3 Feb 2021 15:40:08 +0000 (00:40 +0900)] 
network: make address_configure() or friends return 1 when the address is new

4 years agoMerge pull request #18544 from yuwata/tree-wide-use-error-in-xxx_from_string
Zbigniew Jędrzejewski-Szmek [Fri, 12 Feb 2021 11:16:23 +0000 (12:16 +0100)] 
Merge pull request #18544 from yuwata/tree-wide-use-error-in-xxx_from_string

tree-wide: use error in xxx_from_string()

4 years agoMerge pull request #18554 from yuwata/network-address-set-NLM_F_REPLACE-flag-automati...
Yu Watanabe [Fri, 12 Feb 2021 04:47:58 +0000 (13:47 +0900)] 
Merge pull request #18554 from yuwata/network-address-set-NLM_F_REPLACE-flag-automatically

network: automatically set NLM_F_REPLACE flag

4 years agocondition: if spelunking through /sys/class/tpmrm doesn't work ask EFI if TPM2 exists 18558/head
Lennart Poettering [Thu, 11 Feb 2021 22:12:46 +0000 (23:12 +0100)] 
condition: if spelunking through /sys/class/tpmrm doesn't work ask EFI if TPM2 exists

This makes ConditionSecurity=tpm2 work reliably during early boot: if
Linux doesn't know about the TPM2 then maybe the firmware does.

4 years agobootctl: show whether the firmware has TPM2 support
Lennart Poettering [Thu, 11 Feb 2021 22:11:56 +0000 (23:11 +0100)] 
bootctl: show whether the firmware has TPM2 support

4 years agoefi-loader: add efi_has_tpm2() helper
Lennart Poettering [Thu, 11 Feb 2021 22:10:07 +0000 (23:10 +0100)] 
efi-loader: add efi_has_tpm2() helper

The helper checks if the UEFI firmware is hooked up to a TPM2 chip. This
is useful to know in trusted boot scenarios, in particular during early
boot in auto-enroll scenarios where we want to know whether TPM2 is
available or not, and the Linux drivers are not loaded yet, and where it
might or not be worth waiting for it.

4 years agoefivars: debug log if we fail to detect whether /sys/firmware/efi/ exists
Lennart Poettering [Thu, 11 Feb 2021 22:09:54 +0000 (23:09 +0100)] 
efivars: debug log if we fail to detect whether /sys/firmware/efi/ exists

4 years agotree-wide: use free_and_strdup_warn() 18544/head
Yu Watanabe [Wed, 10 Feb 2021 20:48:10 +0000 (05:48 +0900)] 
tree-wide: use free_and_strdup_warn()

4 years agonetwork: automatically set NLM_F_REPLACE flag 18554/head
Yu Watanabe [Tue, 9 Feb 2021 16:20:37 +0000 (01:20 +0900)] 
network: automatically set NLM_F_REPLACE flag

The difference between sd_rtnl_message_new_addr() and
sd_rtnl_message_new_addr_update() is only whether NLM_F_REPLACE flag
will be set or not.

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

This makes address_configure() judge whether we should use the flag or
not.

4 years agonetwork: address: also logs preferred lifetime
Yu Watanabe [Tue, 9 Feb 2021 15:50:24 +0000 (00:50 +0900)] 
network: address: also logs preferred lifetime

4 years agotree-wide: propagate error in xxx_from-string()
Yu Watanabe [Wed, 10 Feb 2021 20:21:42 +0000 (05:21 +0900)] 
tree-wide: propagate error in xxx_from-string()

4 years agonetwork: dhcp: use string table
Yu Watanabe [Wed, 10 Feb 2021 20:06:19 +0000 (05:06 +0900)] 
network: dhcp: use string table

4 years agostring-table: introduce DEFINE_STRING_TABLE_LOOKUP_FROM_STRING()
Yu Watanabe [Wed, 10 Feb 2021 20:19:18 +0000 (05:19 +0900)] 
string-table: introduce DEFINE_STRING_TABLE_LOOKUP_FROM_STRING()

4 years agonetwork: route: use _WITH_FALLBACK macros
Yu Watanabe [Wed, 10 Feb 2021 19:52:42 +0000 (04:52 +0900)] 
network: route: use _WITH_FALLBACK macros

4 years agonetworkd: lldp: use string table
Yu Watanabe [Wed, 10 Feb 2021 19:34:14 +0000 (04:34 +0900)] 
networkd: lldp: use string table

4 years agostring-table: introduce DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN()
Yu Watanabe [Wed, 10 Feb 2021 19:42:33 +0000 (04:42 +0900)] 
string-table: introduce DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN()

4 years agotree-wide: use error codes in xxx_from_string()
Yu Watanabe [Wed, 10 Feb 2021 19:21:46 +0000 (04:21 +0900)] 
tree-wide: use error codes in xxx_from_string()

4 years agoconf-parser: use return codes in xxx_from_string()
Yu Watanabe [Wed, 10 Feb 2021 18:27:22 +0000 (03:27 +0900)] 
conf-parser: use return codes in xxx_from_string()

Follow-up for #11484.

4 years agoMerge pull request #18550 from keszybz/coverity-inspired-fixes
Luca Boccassi [Thu, 11 Feb 2021 15:44:25 +0000 (15:44 +0000)] 
Merge pull request #18550 from keszybz/coverity-inspired-fixes

Coverity inspired fixes

4 years agoMerge pull request #17902 from bugaevc/fix-container-detection
Zbigniew Jędrzejewski-Szmek [Thu, 11 Feb 2021 11:56:01 +0000 (12:56 +0100)] 
Merge pull request #17902 from bugaevc/fix-container-detection

improve container detection

4 years agohomework: fix unitialized variable 18550/head
Zbigniew Jędrzejewski-Szmek [Thu, 11 Feb 2021 11:00:09 +0000 (12:00 +0100)] 
homework: fix unitialized variable

Coverity CID#1444703.

4 years agohomework: reduce scope of iterator variables
Zbigniew Jędrzejewski-Szmek [Thu, 11 Feb 2021 10:59:22 +0000 (11:59 +0100)] 
homework: reduce scope of iterator variables

4 years agobasic/locale-util: reduce variable scope
Zbigniew Jędrzejewski-Szmek [Thu, 11 Feb 2021 08:55:01 +0000 (09:55 +0100)] 
basic/locale-util: reduce variable scope

4 years agofsck: make sure we don't read an unitialized variable
Zbigniew Jędrzejewski-Szmek [Thu, 11 Feb 2021 08:50:49 +0000 (09:50 +0100)] 
fsck: make sure we don't read an unitialized variable

This use on %n was completely unnecessary: fprintf returns the number of
characters written. And the issue was that if fprintf failed for whatever
reason, it would not process the %n and m would be unitialized. Rework the
code a bit to simplify it.

Coverity CID#1444708.

4 years agosd-journal: add forgotten unmap in error path
Zbigniew Jędrzejewski-Szmek [Thu, 11 Feb 2021 08:35:52 +0000 (09:35 +0100)] 
sd-journal: add forgotten unmap in error path

Bug introduced in 4b5bc5396c090ee41c45cab9052372d296c4a2f4 :(

Coverity CID#1444709.

4 years agoshared/generator: add missing initializer
Zbigniew Jędrzejewski-Szmek [Thu, 11 Feb 2021 08:23:22 +0000 (09:23 +0100)] 
shared/generator: add missing initializer

Coverity CID#1444710.

4 years agoudev: add assert to make coverity happy
Zbigniew Jędrzejewski-Szmek [Thu, 11 Feb 2021 08:17:46 +0000 (09:17 +0100)] 
udev: add assert to make coverity happy

Coverity says:
CID 1446387 (#1 of 1): Bad bit shift operation (BAD_SHIFT)
8. negative_shift: In expression 1U << (int)cmd, shifting by a negative amount
has undefined behavior. The shift amount, cmd, is -22.

I don't think there's any issue, unless we forget to set token->data
appropriately. Let's add an assert.

4 years agoMerge pull request #18545 from poettering/netlink-seqno-fix
Zbigniew Jędrzejewski-Szmek [Thu, 11 Feb 2021 07:24:39 +0000 (08:24 +0100)] 
Merge pull request #18545 from poettering/netlink-seqno-fix

sd-netlink seqnum fixes

4 years agonetworkd: add UseFQDN option for DHCPv6
Vinnie Magro [Fri, 29 Jan 2021 00:24:34 +0000 (16:24 -0800)] 
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.

4 years agoMerge pull request #17823 from poettering/resolved-just-bypass
Zbigniew Jędrzejewski-Szmek [Wed, 10 Feb 2021 23:10:25 +0000 (00:10 +0100)] 
Merge pull request #17823 from poettering/resolved-just-bypass

resolved: just the dnssec bypass logic

4 years agosd-netlink: spread out sequence numbers a bit 18545/head
Lennart Poettering [Wed, 10 Feb 2021 22:05:51 +0000 (23:05 +0100)] 
sd-netlink: spread out sequence numbers a bit

An (imperfect) fix for #14760.

This makes collisions unlikely, but still theoretically possible.

Fixes: #14760
4 years agosd-netlink: reduce indentation levels a bit
Lennart Poettering [Wed, 10 Feb 2021 17:12:58 +0000 (18:12 +0100)] 
sd-netlink: reduce indentation levels a bit

4 years agosd-netlink: use getsockopt_int() where appropriate
Lennart Poettering [Wed, 10 Feb 2021 17:11:20 +0000 (18:11 +0100)] 
sd-netlink: use getsockopt_int() where appropriate

4 years agosd-netlink: revamp message serial handling
Lennart Poettering [Wed, 10 Feb 2021 16:59:46 +0000 (17:59 +0100)] 
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.

4 years agotmpfiles: explicitly say we need /proc/ to run
Lennart Poettering [Wed, 10 Feb 2021 16:11:34 +0000 (17:11 +0100)] 
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
4 years agonetwork: use SD_BUS_METHOD_WITH_ARGS() macro
Yu Watanabe [Wed, 10 Feb 2021 16:32:01 +0000 (01:32 +0900)] 
network: use SD_BUS_METHOD_WITH_ARGS() macro

4 years agocore: improve log message when unit deactivates cleanly
Lennart Poettering [Wed, 10 Feb 2021 15:15:20 +0000 (16:15 +0100)] 
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.)

4 years agoMerge pull request #18440 from bluca/portable_upgrade
Lennart Poettering [Wed, 10 Feb 2021 20:26:14 +0000 (21:26 +0100)] 
Merge pull request #18440 from bluca/portable_upgrade

portable: add 'reattach' verb and DBUS interface

4 years agotmpfiles: v/q/Q: Add env var to skip check for rootfs in subvolume
Adrian Vovk [Tue, 9 Feb 2021 21:20:32 +0000 (16:20 -0500)] 
tmpfiles: v/q/Q: Add env var to skip check for rootfs in subvolume

4 years agovirt: detect cgroups namespaces 17902/head
Sergey Bugaev [Sun, 20 Dec 2020 11:43:01 +0000 (14:43 +0300)] 
virt: detect cgroups namespaces

detect_container() is now able to detect if we're running in a cgroup namespace.