Commit graph

67524 commits

Author SHA1 Message Date
Yu Watanabe f9edbb80e9 sd-dhcp-client: split out client_parse_message()
No functional change, just refactoring and preparation for later
commits.
2023-09-23 01:38:21 +09:00
Yu Watanabe db849df5a1 sd-dhcp-client: introduce dhcp_lease_unref_and_replace() 2023-09-23 01:38:21 +09:00
Yu Watanabe 8fc725052a sd-dhcp-client: do not set fallback subnet mask if it is already set 2023-09-23 01:38:21 +09:00
Yu Watanabe 2ff1e23036 sd-dhcp-client: split out client_enter_requesting()
No functional change, just refactoring and preparation for later
commits.
2023-09-23 01:38:21 +09:00
Yu Watanabe 525717b87c sd-dhcp-client: split out client_enter_bound()
No functional change, just refactoring and preparation for later
commits.
2023-09-23 01:38:21 +09:00
Yu Watanabe 6197db53ba sd-ndisc: make sd_ndisc return time values in usec
This also introduces sd_ndisc_router_get_lifetime_timestamp() and
friends that return timestamp rather than timespan.
2023-09-23 01:34:56 +09:00
Mike Yuan e504e46515 btrfs-util: fix one memory leak
Follow-up for efb6a76a2a
2023-09-23 00:13:06 +08:00
RoepLuke c9bb40b133 Add recommended initramfs regeneration
I recently tried adding a FIDO2-Device as an unlocking method to the LUKS2 partition containing my Fedora install.
When trying to do this, I stumbled upon the here edited man files detailing how to do this.
I however could not unlock my partition with my FIDO2-Device after editing /etc/crypttab and rebooting.
As I found out after a while, I needed to regenerate / update my currently running / used initramfs (https://unix.stackexchange.com/a/705809).
This would have most likely solved itself for me with the next kernel update install (as far as I understand).
So I propose changing the files edited here to recommend or at least inform the user about this.
2023-09-22 16:02:44 +01:00
Daan De Meyer 021b0ff405 repart: Don't fail on boot if we can't find the root block device
When booting from virtiofs, we won't be able to find a root block
device. Let's gracefully handle this similar to how we don't fail
if we can't find a GPT partition table.
2023-09-22 16:01:12 +01:00
Luca Boccassi 8bf1d14112
Merge pull request #29282 from YHNdnzj/hibernate-resume-meson
hibernate-resume: minor follow-up for meson and header file
2023-09-22 15:46:09 +01:00
Mike Yuan 17ad085993
hibernate-resume: add missing #pragma once 2023-09-22 21:03:48 +08:00
Mike Yuan 3494a8b904
hibernate-resume: break lines in meson.build files() 2023-09-22 21:02:55 +08:00
Zbigniew Jędrzejewski-Szmek a0fe45a93f
Merge pull request #29224 from keszybz/netdev-config-parsing
Use a helper to simplify parsing of ranges in netdev config and related changes
2023-09-22 14:29:47 +02:00
Daan De Meyer fc5473b737 mkosi: Don't skip initrd dependency when building a directory image
mkosi now supports booting directory images in qemu using virtiofs.
However, until distribution kernels build the virtiofs driver directly
into the kernel, we need an initrd to make this work, so make sure to
pull in the initrd preset when building a directory image that could be
bootable to make this work.
2023-09-22 13:52:02 +02:00
Zbigniew Jędrzejewski-Szmek f75921c7fd netdev/wireguard: define iterator variable in the loop 2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 117843fe95 network: make DEFINE_NETDEV_CAST() assert on input and output
The macro used to return NULL if input was NULL or had the wrong type. Now
it asserts that input is nonnull and it has the expected type.

There are a few places where a missing or mismatched type was OK, but in a
majority of places, we would do both of the asserts. In various places we'd
only do one, but that was by ommission/mistake. So moving the asserts into the
macro allows us to save some lines.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 6c9935ba87 network/netdev: align tables 2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 6fded8dced network/netdev: fix resetting of 'inherit' field
We have two fields: inherit and ttl, and ttl is ignored if inherit is true.
Setting TTL=inherit and later TTL=n would not work because we didn't unset
inherit.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek af14281d2c network: refusing parsing negative flow labels
The docs for FlowLabel= said that the range is 0..1048575, but the code did not
reject negative numbers.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek a893c121ed network/fou-tunnel: simplify parsing of protocol number
Previously, we would call parse_ip_protocol(), which internally calls
safe_atoi(), and then call safe_atou(). This isn't terrible, but it's also
slightly confusing. Use parse_ip_protocol_full() to avoid the second call.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 1b2733b412 shared/ip-procotol-list: generalize and rework parse_ip_protocol()
Optionally, accept protocols that don't have a known name.
Avoid any allocations in the common case.
Return more granular error codes: -ERANGE for negative values,
-EOPNOTSUPP if the protocol is a valid number, but we don't know
the protocol, and -EINVAL only if it's not a numerical string.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 04c2a002e6 network/vxlan: avoid unneccesary temporary variables
parse_ip_port_range() DTRT and only sets the output on success.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 257cebb67a network/netdev: use ASSERT_PTR() more, adjust indentation 2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 851cdffd1b network: use a common helper to parse bounded ranges
This compresses repetetive code and makes it easier to add new options
in networkd. The formatting of error messages becomes uniform. The
error message always specifies the rvalue literally, instead of using
a "descriptive name". This makes the message much easier to handle for
the user.

I opted to add just one parser, and wrap it with inline functions to proxy
the type. This is less verbose than copying functions for each type
separately, and the compiler should be able to get rid of the inline wrapper
almost entirely.

asserts are reordered to use the same order as the parameter list.
This makes the code easier to read.

No functional change intended, apart from the difference in error message
formatting.
2023-09-22 08:16:47 +02:00
Jordan Rome 71e5a35a5b Add mkosi.conf to gitignore 2023-09-22 08:14:10 +02:00
Adam Williamson 537c00c984 find_legacy_keymap: extend variant match bonus again
If the column is "-" and the X context variant specifer only
contains commas, we should also give the match bonus. The variant
string is supposed to be a comma-separated list as long as the
list of layouts, so it's quite natural for consumers to be written
in such a way that they pass a string only containing commas if
there are multiple layouts and no variants. anaconda is a real
world case that does this.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2023-09-22 08:07:12 +02:00
Yu Watanabe c650d4cdef sd-journal: refuse entry objects with an empty boot ID
Otherwise, e.g. sd_journal_get_monotonic_usec() return an empty boot ID
when called for such a broken entry object.

Such a broken object may be stored when the system was not cleanly shutdown.

Fixes #29167.
2023-09-22 08:05:53 +02:00
Yu Watanabe 3231f624e6 sd-ndisc: rename function arguments for storing results 2023-09-22 02:17:31 +09:00
Mike Yuan 1365355d14 elf2efi: fix a typo 2023-09-21 19:16:11 +02:00
Luca Boccassi 8ae3c292e3 meson: relax ukify requirements
Installing ukify.py doesn't require a working UEFI architecture, but
only that the bootloader option is enabled (and python3). On Debian
Arch: all packages (like python scripts) can theorethically be built
on any builder with any architecture, so there's no guarantee that
it will actually be an EFI-enabled architecture to do that package build.

Relax the requirement to check only for the ukify config option.
2023-09-21 18:15:57 +02:00
Zbigniew Jędrzejewski-Szmek 67bc612cbc systemctl: link to all non-man-page files in help
For file:// links, we urlify the link so that the user can click and either
open the file in a editor or some viewer. The detection is chosen via some
mechanism implemented by the terminal emulator. This seems too DTRT for text
files and PDFs, which should cover the majority of realistic cases. If the file
is not viable, the terminal emulator will say
  "Could not open file://…. No application is registered to view this file type."
or similar.

For all other links, which are primarily http:// and https://, we just show the
link, letting the terminal handle the hyperlinking. The user can then ctrl-click
and open the file it their browser. If we tried to open the files automatically,
we'd would need to open many pages, and we'd need to figure out what browser to
use, etc. When the user picks whether to open the file, this leads to a nicer
user experience.

Man pages are separated by an empty line from preceding in and following output.
In my testing, this makes the output easier to read. A bit of explicit flushing
is needed to make sure that various outputs are not interleaved.

Fixes https://github.com/systemd/systemd/issues/29061.
2023-09-21 18:09:48 +02:00
Tomasz Świątek eb5e1fe7e8
hwdb: Bush tablet rotation support (#29268) 2023-09-22 00:13:00 +09:00
Zbigniew Jędrzejewski-Szmek 44fcb9a7e7 meson: do not explicitly specify ownership of /var/log/journal/
In 9289e093ae we started using install_emptydir().

When running unprivileged, 'DESTDIR=… meson install -C build --quiet --no-rebuild'
would emit two warnings:
  '…/var/log/journal': Unable to set owner 'root' and group 'root': Operation not permitted, ignoring...
  '…/var/log/journal/remote': Unable to set owner 'root' and group 'root': Operation not permitted, ignoring...

Those were the only two install_emptydir()s that specified ownership.
Let's drop the user/group specification to get rid of the warning.

When installing as root, we will create a root-owned directory anyway.
When not running as root, we cannot create a root-owned directory.
So this specification only makes a difference if we are running as root,
and the directory already existed, and was not owned by root. In that case,
I think it's actually better to leave the existing modification in place.
(E.g. maybe the admin chgrp'ed the ownership for whatever reason. We might
just as well leave that in place.)
2023-09-21 14:06:44 +01:00
Luca Boccassi 45ad128d36
Merge pull request #29253 from yuwata/sd-radv-use-usec_t
sd-radv: use usec_t
2023-09-21 14:06:28 +01:00
Yu Watanabe 60415c1360 network: split out link_get_address_states()
No functional change, just refactoring and preparation for later
commits.
2023-09-21 11:31:43 +01:00
Luca Boccassi 76859a9785
Merge pull request #29252 from yuwata/sd-dhcp6-client-use-usec_t
sd-dhcp6-client: use usec t
2023-09-21 11:30:02 +01:00
Yu Watanabe afb81a0c05 sd-event: drop unnecessary call of sd_event_now() when requested relative time is zero 2023-09-21 11:03:37 +02:00
Yu Watanabe 511d96d3b7 sd-dhcp-client: use unaligned_be32_sec_to_usec()
Note, previously, we set 1 second if the time value is zero.
But the adjustment is dropped now, as for the lifetime we have explicit
check that the message has non-zero lifetime, and for T1 and T2 we have
better adjustment in client_set_lease_timeouts().
2023-09-21 09:52:03 +01:00
Adam Williamson ca831de170 keyboard-model-map: correct sk-qwerty entry
qwerty here is a variant, not an option.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2023-09-21 09:47:50 +01:00
Yu Watanabe d08ff4506c sd-device: include missing alloc-util.h
unref_and_replace_full() is defined in alloc-util.h.
2023-09-21 14:28:55 +08:00
Luca Boccassi 2cb170376a
Merge pull request #29235 from yuwata/sd-journal-reset-saved-direction-on-seek
sd-journal: reset saved direction on seek
2023-09-20 22:06:01 +01:00
Yu Watanabe 8ff992d1a2 test-ndisc-ra: add tests for recently added functions 2023-09-21 04:01:24 +09:00
Yu Watanabe eca280c8c0 sd-radv: make sd_radv always take timespan in usec 2023-09-21 04:01:14 +09:00
Yu Watanabe 394fac52d0 sd-dhcp6-client: introduce sd_dhcp6_lease_get_t1() and friends 2023-09-21 03:59:00 +09:00
Yu Watanabe 9132cbd5ad sd-dhcp6-client: use be32_sec_to_usec() at more places 2023-09-21 03:59:00 +09:00
Yu Watanabe d8ec95c7ff sd-dhcp6-client: rework IA_NA or IA_PD getters
This splits sd_dhcp6_lease_get_address() into small pieces,
and introduce FOREACH_DHCP6_ADDRESS() macro.
Also, the lifetimes provided by _get_address_lifetime() are now in usec,
and _get_address_lifetime_timestamp() provides timestamp.

The same change is also applied for IA_PD.
2023-09-21 03:59:00 +09:00
Yu Watanabe fb70992d39 sd-dhcp6-client: introduce sd_dhcp6_lease_has_pd_prefix() and friend
No functional change, just refactoring.
2023-09-21 03:59:00 +09:00
Yu Watanabe 4aa33df845 sd-journal: also clear saved direction on seek
Otherwise, sd_journal_previous() -> real_journal_next(DIRECTION_UP) ->
next_beyond_location() wrongly handles that previously we hit EOF of
the file, and returns 0 without finding a matching entry.

Fixes #29216.
2023-09-21 01:59:21 +09:00
Yu Watanabe 45689fd265 test: add more testcases for seeking journal entries
This is mostly for issue #29216.
2023-09-21 01:58:43 +09:00
Yu Watanabe 836809d179 test: check return value of sd_journal_next() and friends 2023-09-21 01:57:55 +09:00