1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00
Commit Graph

36753 Commits

Author SHA1 Message Date
Yu Watanabe
c4165dac88 network: wireguard: warn about invalid allowed IP addresses
But handle them gracefully. Otherwise, when the route to the address is
being configured, kernel refuse the route.

Note that kernel's wireguard module handle e.g. 192.168.10.3/24 as
192.168.10.0/24.

Fixes #21929.

(cherry picked from commit af670fc635)
2022-01-04 16:22:19 +01:00
Yu Watanabe
17227e81ab nss-systemd: fix required buffer size calculation
This also fixes the pointer assigned to the gr_mem element of struct group.

Fixes a bug introduced by 47fd7fa6c6.

Fixes #21935.

(cherry picked from commit 1e65eb8f9b)
2022-01-04 16:22:08 +01:00
Yu Watanabe
747b4f1ff8 sysusers: use filename if /proc is not mounted
During system install, /proc may not be mounted yet.

Fixes RHBZ#2036217 (https://bugzilla.redhat.com/show_bug.cgi?id=2036217).

(cherry picked from commit b78d7f2468)
2022-01-04 16:22:02 +01:00
Luca Boccassi
b59615dc76 systemd-run: ensure error logs suggest to use '--user' when appropriate
Before:

$ systemd-run --service-type=notify --user false
Job for run-rc3fe52ee6ddd4a6eaaf1a20e0a949cdf.service failed because the control process exited with error code.
See "systemctl status run-rc3fe52ee6ddd4a6eaaf1a20e0a949cdf.service" and "journalctl -xeu run-rc3fe52ee6ddd4a6eaaf1a20e0a949cdf.service" for details.

After:

$ systemd-run --service-type=notify --user false
Job for run-r7791e380a7b6400ea01d6a0e5a458b23.service failed because the control process exited with error code.
See "systemctl --user status run-r7791e380a7b6400ea01d6a0e5a458b23.service" and "journalctl --user -xeu run-r7791e380a7b6400ea01d6a0e5a458b23.service" for details.

Fixes https://github.com/systemd/systemd/issues/21933

(cherry picked from commit 466f2351bb)
2022-01-04 16:21:55 +01:00
Luca Boccassi
0c4fe2e3dc dbus-wait-for-jobs: add extra_args to bus_wait_for_jobs_one()
And pass it through to bus_wait_for_jobs()

(cherry picked from commit 86980de64b)
2022-01-04 16:21:54 +01:00
Jan Janssen
c926189767 boot: Introduce helper macros for offset checking
This fixes a subtle sizeof overflow on 32bit machines.

(cherry picked from commit aa1d0f2587)
2022-01-04 16:21:14 +01:00
Jan Janssen
d6d97abd78 boot: Reject unaligned data
The data seems to be properly aligned in real BCD stores, so it
should be fine to just reject bad ones.

Fixes: #21917
(cherry picked from commit 1cadb35fd6)
2022-01-04 16:21:10 +01:00
Yu Watanabe
f85856c00d manager: always close idle pipe when sending ready notification
This fixes a bug introduced by 6d93265955.

The commit makes several functions skipped if the manager is already
in finished state, as
> In manager_check_finished(), more steps are skipped if MANAGER_IS_FINISHED().
> Those steps are idempotent, but no need to waste cycles trying to do them
> more than once.

However, the idle pipe may be re-opened after manager is finished:
manager_dispatch_run_queue() -> manager_watch_idle_pipe().
So, the closing the pipe is not idempotent here.

Fixes #21889.

(cherry picked from commit 9c1b17c3dc)
2022-01-04 16:18:55 +01:00
ksa678491784
202b1448aa stub: Do not assume having DeviceHandle
(cherry picked from commit 5204355861)
2022-01-04 16:18:09 +01:00
Yu Watanabe
1690672140 network: ndisc: ignore route prefix to ::/0
Fixes #21912.

(cherry picked from commit 80bfc3b901)
2022-01-04 16:18:07 +01:00
Yu Watanabe
f47d962bb1 unti-file: fix symlinked drop-in directory handling
This fixes a bug introduced by 95ef0eaf0d.

Fixes #21920.

(cherry picked from commit 7f304b8561)
2022-01-04 16:17:26 +01:00
Luca Boccassi
8b29809c11 core: do not touch /run/systemd/systemd-units-load from user session instances
Follow-up for: 15b9243c0d
Fixes: https://github.com/systemd/systemd/issues/21911

(cherry picked from commit 4b3ad81bfa)
2022-01-04 16:15:31 +01:00
Jan Janssen
630da18817 boot: Fix name length comparison
(cherry picked from commit 2198a77391)
2022-01-04 16:14:18 +01:00
Jan Janssen
a4e4c3377d boot: Fix off-by-one offset sanity checks
(cherry picked from commit c3c5b93a0c)
2022-01-04 16:14:18 +01:00
Jan Janssen
0c7ef2c166 boot: Fix off-by-one NUL-termination
(cherry picked from commit fab8275646)
2022-01-04 16:14:18 +01:00
Luca Boccassi
93ddabc26a chrattr-util: return EOPNOTSUPP from chrattr_full if no other failure was observed
When chattr_full tries to apply flags one-by-one, and one fails,
record which errno was returned. But record EOPNOTSUPP(&friends)
only if no other error is observed, and return it only in that case
(otherwise keep returning ENOANO), so that callers can respond
appropriately to EOPNOTSUPP vs more relevant errors.
For example, this lets tmpfiles.d log at debug level when a filesystem
flag cannot be applied because the filesystem does not support it,
but at warning level if something else went wrong when applying it.
Restores logging behaviour of tmpfiles.d to pre-250.

Follow-up for: c1631ee124

Fixes: https://github.com/systemd/systemd/issues/21901
(cherry picked from commit 7c3b51c469)
2022-01-04 16:13:27 +01:00
Mike Gilbert
4d889024ef random-util: use ssize_t for getrandom return value
This matches the prototype provided by glibc.

(cherry picked from commit 289b41aae7)
2022-01-04 16:10:10 +01:00
Yu Watanabe
9bcf483b11 meson: fix build with -Dcryptolib=openssl -Ddns-over-tls=false
Previously, when -Ddns-over-tls=false, libopenssl was missing in the
dependency of resolved.
Also, this drops libgpg_error when it is not necessary.

Replaces #21878.
2021-12-24 15:23:39 +00:00
Yu Watanabe
0764e3a327 missing-syscall: define all MOUNT_ATTR_* if missing
Fixes #21876.
2021-12-24 10:12:25 +00:00
Yu Watanabe
558ad6bd38
analyze: fix segfault when malloc() fails (#21874)
Fixes #21872.

log_syntax_callback sets 's', a.k.a. '*userdata', to POINTER_MAX to signal allocation failure.
If the error does not cause immediate failure of the program, and log_syntax_callback is called
again, it would try to use 's' as a pointer to a set and fail badly.
2021-12-23 21:03:16 +01:00
Zbigniew Jędrzejewski-Szmek
10c8c32f13
Merge pull request #21869 from yuwata/sd-journal-fix-segfault
sd-journal: fix segfault
2021-12-23 20:07:41 +01:00
Zbigniew Jędrzejewski-Szmek
90c8234e0c src/basic: adjust grammar in comments 2021-12-23 13:49:43 +01:00
Zbigniew Jędrzejewski-Szmek
a49a3564b5 shared: re-wrap comment 2021-12-23 13:49:12 +01:00
Zbigniew Jędrzejewski-Szmek
68cdeab343 hostname: use _cleanup_ in one more place 2021-12-23 13:49:12 +01:00
Yu Watanabe
39dfc0de05 sd-journal: fix segfault when match_new() fails
Fixes #21867.
2021-12-23 21:45:32 +09:00
Yu Watanabe
418cce628c sd-journal: free incomplete match on failure 2021-12-23 21:35:29 +09:00
Jan Janssen
e628944b11 boot: Use correct handle to find TextInputEx protocol
LibLocateProtocol will return the protocol for the first device that
supports it. But it may not actually come from the ConIn device that
we want to use here.

This should be the root cause of what was previously considered just
broken firmware. If you ask the wrong device to return some key, of
course it will never provide one.

This changes the way we handle input yet again in light of this new
knowledge and because using the correct TextInputEx with fallback to
ConIn can actually create double input in some cases.

Since we are now confident that we get the right TextInputEx, we can
use that exclusively, only falling back to ConIn if the console input
device does not support the better interface (the spec is pretty clear
that it must support it, though).

Because some firmware is broken, we still need to provide a fallback
to the previously used TextInputEx thats overrides ConIn/ConInEx if
it is functional.
2021-12-23 12:39:48 +01:00
Ludwig Nussel
a9c97bbbfb machined: set TTYPath for container shell
TTYPath is needed for proper utmp registration of the shell to
receive wall messages.
2021-12-23 11:27:56 +01:00
Yu Watanabe
8f7a0fcbec meson: fix typo 2021-12-23 17:01:55 +09:00
Luca Boccassi
741c4c8da9 analyze: do not connect to DBUS with --offline
Co-authored-by: Lucas Werkmeister <mail@lucaswerkmeister.de>
2021-12-23 09:44:42 +09:00
Luca Boccassi
743814d7a2
Merge pull request #21858 from yuwata/fix-test-home
test: workaround for TEST-46-HOMED
2021-12-22 16:14:53 +00:00
Jan Janssen
2ef28d054d boot: Use -fvisibility=hidden instead of -fwhole-program
It's functionally the same for sd-boot, but using visibilty
is generally preferred over whole-program.
2021-12-23 00:26:25 +09:00
Yu Watanabe
367649ee66 home: update log message
The ratelimit hits even when the all previous attempts are successfull.
2021-12-22 17:29:30 +09:00
Yu Watanabe
5bdeedb342 test: add test for errno-list.[ch] 2021-12-22 15:29:55 +09:00
Yu Watanabe
95d88436ea errno-name: drop aliases defined for specific arch
In kernel's arch/parisc/include/uapi/asm/errno.h, ECANCELLED and
EREFUSED are defined as aliases of ECANCELED and ECONNREFUSED,
respectively. Let's drop them.

Fixes #21844.
2021-12-22 15:29:55 +09:00
Yu Watanabe
c99d5efc2d
Merge pull request #21857 from loongarch64/dev-pr1
LoongArch: dmi, virt detection and testcase
2021-12-22 15:20:20 +09:00
Jan Janssen
a3aff1c47f test,static-destruct: Use retain attribute to prevent linker garbage collection
Fixes: #21847
2021-12-22 12:14:08 +09:00
Xiaotian Wu
646b01121a test: add LoongArch 64bit testcase 2021-12-22 11:07:56 +08:00
Xiaotian Wu
eebbd595f0 virt: add detection for LoongArch 64bit 2021-12-22 11:07:55 +08:00
Xiaotian Wu
ff6d286902 dmi: add LoongArch 64bit support 2021-12-22 11:07:54 +08:00
Jan Janssen
e67e6691e5 boot: Fix armhf build failure
Fixes: #21842
2021-12-21 16:34:51 +00:00
Daan De Meyer
9519b41e52 shared: Remove remaining usages of GPT_ROOT_NATIVE, GPT_USR_NATIVE from dissect-image.c
Follow-up for 49ae9d91f9

Fixes #21843
2021-12-21 13:47:07 +00:00
Scott Worley
77ec2816c6 timedatectl: Uniform commas in NTPMessage output 2021-12-21 09:46:19 +09:00
Daan De Meyer
94c5a83c6e journal: Handle partially read HashItem's when punching holes 2021-12-21 02:29:57 +09:00
Zbigniew Jędrzejewski-Szmek
8ef114c692 nss-resolve: expose various source-disablement settings as variables
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2006761:
> systemd-resolved always (reverse)-resolves the host's IP addresses and FQDN.
> This can be harmful when an application (for instance, a DNS zone manager) is
> installed on the same server instance.  That application would expect
> NXDOMAIN to be returned if the current server's IP does not belong in an
> already managed reverse zone.

This allows clients of nss-resolve to use the same config options that are
available through the dbus api and as command-line options to resolvectl.

The man page text is is mostly copied directly from
c6f20515ab.
2021-12-21 02:28:52 +09:00
Tom Yan
d8daed09f3 repart: use real disk start/end for bar production
Partitions are not always within our aligned scope. Bar printing
involves foreign partitions as well.

Fixes #21817.
2021-12-20 14:50:08 +01:00
Yu Watanabe
30df858f43 journal-remote: use MHD_HTTP_CONTENT_TOO_LARGE as MHD_HTTP_PAYLOAD_TOO_LARGE is deprecated since 0.9.74 2021-12-20 14:30:24 +01:00
Zbigniew Jędrzejewski-Szmek
c6f20515ab man: describe flags for record resolving 2021-12-20 10:56:14 +01:00
Daan De Meyer
3e6357de9d
Merge pull request #21807 from keszybz/bootcls-no-autodetect
Use KERNEL_INSTALL_MACHINE_ID and KERNEL_INSTALL_LAYOUT with bootctl install
2021-12-20 10:43:18 +01:00
Mike Gilbert
9a723ed6e8 basic: add a size check to format timex members properly
As of glibc-2.34, the size of members in struct timex varies depending on
the _TIME_BITS macro.

Fixes: https://github.com/systemd/systemd/issues/21826
2021-12-20 12:36:59 +09:00
Yu Watanabe
b9f27a0567 sd-radv: do not use goto for non-error-handling cases
Follow-up for 059d7b6eae.

The comment https://github.com/systemd/systemd/pull/21814#discussion_r771842132
suggests to introduce new helper, but it is used only one place.
Let's not add such, but simply replace the goto with a flag.
2021-12-19 12:23:14 +00:00
Daan De Meyer
73b3314bfd
Merge pull request #21818 from bluca/path_trigger_limit
path unit: add TriggerLimitBurst= and TriggerLimitIntervalSec=
2021-12-19 12:42:11 +01:00
Nishal Kulkarni
a6293b0541 logind: Use new macros
Migrate logind to use the new macros to declare a D-Bus method or signal.
Replaced SD_BUS_METHOD_WITH_NAMES with SD_BUS_METHOD_WITH_ARGS.
Replaced SD_BUS_SIGNAL_WITH_NAMES with SD_BUS_SIGNAL_WITH_ARGS.
2021-12-19 09:14:07 +09:00
Yu Watanabe
ecb0be874d
Merge pull request #21814 from yuwata/network-dhcp-pd-fixes
network: several fixes for DHCP prefix delegation
2021-12-19 08:52:08 +09:00
Luca Boccassi
47dba9fb09 path unit: add TriggerLimitBurst= and TriggerLimitIntervalSec=
Given there's now a default for these settings, also allow users to configure
them, matching socket units
2021-12-18 23:17:53 +00:00
Luca Boccassi
5cfe61f2de
Merge pull request #21808 from DaanDeMeyer/path-trigger-limit
core: Add trigger limit for path units
2021-12-18 16:56:05 +00:00
Daan De Meyer
aaae822b37 core: Add trigger limit for path units
When conditions fail on a service unit, a path unit can cause
PID 1 to busy loop as it keeps trying to activate the service unit.
To avoid this from happening, add a trigger limit to the path unit,
identical to the trigger limit we have for socket units.

Initially, let's start with a high limit and not make it configurable.
If needed, we can add properties to configure the rate limit similar
to the ones we have for socket units.
2021-12-18 11:26:25 +01:00
Nishal Kulkarni
9a8141662e homed: Use new SD_BUS_METHOD_WITH_ARGS macro
Migrate homed to use the new macros to declare a D-Bus method.
Replaced `SD_BUS_METHOD_WITH_NAMES` with `SD_BUS_METHOD_WITH_ARGS`
2021-12-18 11:57:57 +09:00
Yu Watanabe
897f720602 sd-dhcp-client: add log message when a message is received 2021-12-18 10:09:07 +09:00
Yu Watanabe
fe87807eaa network: dhcp-pd: do not stack 6rd sit tunnel 2021-12-18 10:09:07 +09:00
Yu Watanabe
42e7ce69e4 network: route: update expiration timer in link_request_route() 2021-12-18 10:09:07 +09:00
Yu Watanabe
d0f17cfda6 network: route: do not drop unreachable route on reconfiguring downstream interface
Previously, when a downstream is reconfigured, the unreachable route
was removed as there is no corresponding static config in .network
files.
2021-12-18 10:09:07 +09:00
Yu Watanabe
277521a1ac network: dhcp-pd: fix condition in dhcp_pd_prefix_lost() 2021-12-18 10:09:07 +09:00
Yu Watanabe
059d7b6eae sd-radv: send RA when prefix is updated 2021-12-18 10:09:07 +09:00
Frantisek Sumsal
c0a2e0cc24 network: a couple of tweaks suggested by Coccinelle 2021-12-18 08:36:07 +09:00
Yu Watanabe
14dd873b88 network: dhcp4: pass IPServiceType=none to dhcp client
Follow-up for b55093ce88.
2021-12-18 08:35:42 +09:00
Yu Watanabe
a00fd2a553
Merge pull request #21800 from keszybz/net-id-debugging
Add more debugging info to udev builtin net_id
2021-12-18 08:35:08 +09:00
Daan De Meyer
40f41f34d4 Revert "core: Propagate condition failed state to triggering units."
This reverts commit 12ab94a1e4.
2021-12-17 19:39:29 +01:00
Zbigniew Jędrzejewski-Szmek
edee65a6a4 udev/net_id: add debug logging for construction of device names
I think this makes it much easier to figure out what information sources
were used to generate the names, and why certain names were not generated.

On my laptop:

Using default interface naming scheme 'v250'.
ID_NET_NAMING_SCHEME=v250
wwp0s20f0u2i12: addr_assign_type=3, MAC address is not permanent.
wwp0s20f0u2i12: Parsing slot information from sysname "0000:00:14.0": success
wwp0s20f0u2i12: dev_port=0
wwp0s20f0u2i12: PCI path identifier: domain=0 bus=0 slot=20 func=0 phys_port= dev_port=0 → p0s20f0
wwp0s20f0u2i12: USB name identifier: ports=2 config=1 interface=12 → u2i12
ID_NET_NAME_PATH=wwp0s20f0u2i12

Using default interface naming scheme 'v250'.
ID_NET_NAMING_SCHEME=v250
ID_NET_NAME_MAC=en54ee75cb1dc0
enp0s31f6: MAC address identifier: hw_addr=54:ee:75:cb:1d:c0 → 54ee75cb1dc0
ID_OUI_FROM_DATABASE=Wistron InfoComm(Kunshan)Co.,Ltd.
enp0s31f6: Parsing slot information from sysname "0000:00:1f.6": success
enp0s31f6: dev_port=0
enp0s31f6: PCI path identifier: domain=0 bus=0 slot=31 func=6 phys_port= dev_port=0 → p0s31f6
ID_NET_NAME_PATH=enp0s31f6

Using default interface naming scheme 'v250'.
ID_NET_NAMING_SCHEME=v250
ID_NET_NAME_MAC=en0050b6856d36
hub0: MAC address identifier: hw_addr=00:50:b6:85:6d:36 → 0050b6856d36
ID_OUI_FROM_DATABASE=GOOD WAY IND. CO., LTD.
hub0: Parsing slot information from sysname "0000:00:14.0": success
hub0: dev_port=0
hub0: PCI path identifier: domain=0 bus=0 slot=20 func=0 phys_port= dev_port=0 → p0s20f0
hub0: USB name identifier: ports=4.1.3 config=2 interface=0 → u4u1u3c2
ID_NET_NAME_PATH=enp0s20f0u4u1u3c2

Using default interface naming scheme 'v250'.
ID_NET_NAMING_SCHEME=v250
wlp4s0: addr_assign_type=3, MAC address is not permanent.
wlp4s0: Parsing slot information from sysname "0000:04:00.0": success
wlp4s0: dev_port=0
wlp4s0: PCI path identifier: domain=0 bus=4 slot=0 func=0 phys_port= dev_port=0 → p4s0
ID_NET_NAME_PATH=wlp4s0
2021-12-17 19:07:42 +01:00
Zbigniew Jędrzejewski-Szmek
1ff493d5c1 bootctl: deprecate --make-machine-id-directory=auto
Now that kernel-install creates the machine-id directory, we don't need to do
this is 'bootctl install', and in fact it's better not to do this since it
might never be necessary. So let's change the default behaviour to 'no'.

I kept support for 'auto' to maintain backwards compatibility, even though the
default was changed. Previous behaviour can be requested by specifying
--make-machine-id-directory=auto.
2021-12-17 18:48:08 +01:00
Zbigniew Jędrzejewski-Szmek
47fb161e3a bootctl: write KERNEL_INSTALL_LAYOUT=bls and KERNEL_INSTALL_MACHINE_ID=…
This is a natural extension of d6bce6e224: if we are installing sd-boot, we
want to use the sd-boot layout, so let's write the appropriate
KERNEL_INSTALL_LAYOUT setting. Effectively, if we do 'booctl install',
kernel-install will not autodetect the layout anymore.

And 357376d0bb added support for KERNEL_INSTALL_MACHINE_ID. We need to support
it here too. We both read it, so that we create the right directories, and also
write it if it wasn't written yet and we created some directories using it, so
that kernel-install that is executed later knows the machine-id that matches
the directories we crated.

The code is changed in some places to fail if we can't figure out the current
status. When installing the boot loader it's probably better not to guess.
2021-12-17 18:47:53 +01:00
наб
641e2124de kernel-install: replace 00-entry-directory with K_I_LAYOUT in k-i
341890de86 made "bootctl install" create
ESP\MID, in preparation of cf73f65089 that
followed it and created 00-entry-directory.install to make ESP\MID\KVER
if ESP\MID existed ‒ this meant that "bootctl install" followed by
"kernel-install $(uname -r) /boot/vml*$(uname -r) /boot/ini*$(uname -r)"
actually installed the kernel correctly.

Later, 31e57550b5 reverted the first
commit, meaning, that now running those two commands first installs
sd-boot, but then does nothing. Everything appears to work right,
nothing errors out, but no changes are actually done. To the untrained
eye (all of them), even running with -v appears to work:
all the hooks are run, as is depmod, but, again, nothing happens.

This is horrible. Nothing in either manpage suggests what to do
(nor should it, really), but the user is left with a bootloader that
appears fully funxional, since nothing suggests a failure in the output,
but with an unbootable machine, /no way to boot it/, even if they drop
to an EFI shell, since the boot bundle isn't present on the ESP,
and no real recourse even if they boot into a recovery system,
apart from installing like GRUB or whatever.

00- is purely instrumentation for 90-,
and separating one from the other has led to downstream dissatisfaxion
(indeed, the last mentioned commit cited cited exactly that as the
 reversion reason), while creating $ENTRY_DIR_ABS is only required
for bootloaders using the BLS, and shouldn't itself toggle anything.

To that end, introduce an /{e,l}/k/install.conf file that allows
overriding the detected layout, and detect it as "bls" if
$BOOT_ROOT/$MACHINE_ID ($ENTRY_DIR_ABS/..) exists, otherwise "other" ‒
if a user wishes to select a different bootloader,
like GRUB, they (or, indeed, the postinst script) can specify
layout=grub. This disables 90- and $ENTRY_DIR_ABS manipulation.
2021-12-17 14:57:56 +01:00
Zbigniew Jędrzejewski-Szmek
3c1af24182 udev/net_id: use STRLEN() to make code clearer
The code was correct, but looked suspicious: we were comparing
strlen(x) with sizeof(y), with looks like an off-by-one. But we actually
want x to be one longer than y, so that's fine. Let's use STRLEN() to
make this more obvious.

While at it, drop unnecessary "_" prefix.
2021-12-17 11:45:55 +01:00
Zbigniew Jędrzejewski-Szmek
be0586610e udev/net_id: fix signedness in format string
Both variables are unsigned. In practice those numbers cannot be large
enough to become negative, but let's use the correct type anyway.
2021-12-17 11:45:55 +01:00
Yu Watanabe
21feba0a5c network: dhcp: logs received 6rd option
Addresses https://github.com/systemd/systemd/pull/21625#issuecomment-996109051.
2021-12-17 09:47:11 +00:00
Yu Watanabe
616f51c16d boot: fix typo 2021-12-17 04:11:41 +09:00
Yu Watanabe
d9338387d9
Merge pull request #21786 from keszybz/dirent-work
Make FOREACH_DIRENT and FOREACH_DIRENT_ALL declare the iterator variables
2021-12-17 04:07:35 +09:00
Yu Watanabe
8a20a8438f network: route: link_drop_foreign_routes() must be called only for managed interfaces 2021-12-17 00:14:30 +09:00
Yu Watanabe
f974f17ae7 networkd: check the existence of the route 2021-12-17 00:13:42 +09:00
Yu Watanabe
a71c5c44f7 network: address: minor optimization for link_drop_foreign_addresses()
link_address_is_dynamic() is costful in general. Call it only when
KeepConfiguration= is set.

Note, it is not necessary to check link->network in the loop, as we have
the assertion for that in the beginning of the function.
2021-12-16 22:43:18 +09:00
Yu Watanabe
9e86dba94b network: drop IPv6LL addresses manually configured in .network file 2021-12-16 22:43:18 +09:00
Zbigniew Jędrzejewski-Szmek
0c0bb433db
Merge pull request #21757 from DaanDeMeyer/boot-id
kernel-install: Introduce KERNEL_INSTALL_MACHINE_ID in /etc/machine-info
2021-12-16 13:47:17 +01:00
Daan De Meyer
357376d0bb kernel-install: Introduce KERNEL_INSTALL_MACHINE_ID in /etc/machine-info
If KERNEL_INSTALL_MACHINE_ID is defined in /etc/machine-info, prefer it
over the machine ID from /etc/machine-id. If a machine ID is defined in
neither /etc/machine-info nor in /etc/machine-id, generate a new UUID
and try to write it to /etc/machine-info as KERNEL_INSTALL_MACHINE_ID
and use it as the machine ID if writing it to /etc/machine-info succeeds.

In practice, this means we have a more robust fallback if there's no
machine ID in /etc/machine-id than just using "Default" and allows
image builders to force kernel-install to use KERNEL_INSTALL_MACHINE_ID
by simply writing it to /etc/machine-info themselves.
2021-12-16 12:24:42 +01:00
Zbigniew Jędrzejewski-Szmek
1c9b72f38e
Merge pull request #20559 from tomty89/stub_check_in_get
resolved: filter stub listeners in manager_get_dns_server()
2021-12-16 12:18:53 +01:00
Zbigniew Jędrzejewski-Szmek
c01543fdd5 meson: drop three more single-use convenience libraries
The way that the cryptsetup plugins were built was unnecessarilly complicated.
We would build three static libraries that would then be linked into dynamic
libraries. No need to do this.

While at it, let's use a convenience library to avoid compiling the shared code
more than once.

We want the output .so files to be located in the main build directory,
like with all consumable build artifacts, so we need to maintain the split
between src/cryptsetup/cryptsetup-token/meson.build and the main meson.build
file.

AFAICT, the build artifacts are the same: exported and undefined symbols are
identical. There is a tiny difference in size, but I think it might be caused
by a different build directory name.
2021-12-16 11:51:40 +01:00
Zbigniew Jędrzejewski-Szmek
3a4524116a meson: drop convenience library that was only used in one place
It doesn't make much sense to do this, the result is very similar to including
to objects directly in the output binary without going through an intermediate
target.

The linkage of test-libudev was rather strange too: udev_link_with is used to
allow udev to be linked to a static version of libshared, so that udev is not
linked to libshared.so. But here we were using both, defeating the purpose of
udev_link_with. I don't think it matters what the test is linked to, so let's
use the non-static linkage to save space.
2021-12-16 11:09:51 +01:00
Zbigniew Jędrzejewski-Szmek
03f7ddf0bf meson: stop building out convenience libraries by default
The meson default for static_library() are:
build_by_default=true, install=false. We never interact with the
static libraries, and we only care about them as a stepping-stone towards
the installable executables or libraries. Thus let's only build them if
they are a dependency of something else we are building.

While at it, let's drop install:false, since this appears to be the default.

This change would have fixed the issue with lib_import_common failing
to build too: we wouldn't attempt to build it.

In practice this changes very little, because we generally only declare static
libraries where there's something in the default target that will make use of
them. But it seems to be a better pattern to set build_by_default to false.
2021-12-16 11:01:08 +01:00
Zbigniew Jędrzejewski-Szmek
b93f018f57 meson: don't compile import sources four times
Use a 'convenience library' to do the compilation once and then link the
objects into all the files that need it. Those files are small, so this probably
doesn't matter too much for speed, but has the advantage that we don't get the
same error four times if something goes wrong.

The library is conditionalized in the same way importd itself, because we
cannot build it without the deps.
2021-12-16 10:54:46 +01:00
Zbigniew Jędrzejewski-Szmek
67cb0d4725
Merge pull request #21766 from yuwata/network-generator-name-policy
network-generator: support setting NamePolicy=
2021-12-16 09:34:01 +01:00
Luca Boccassi
58f62d7079
Merge pull request #21784 from DaanDeMeyer/issue-21675
journal: Hole punching improvements
2021-12-15 22:38:00 +00:00
Zbigniew Jędrzejewski-Szmek
af3b864d76 Define FOREACH_DIRENT through FOREACH_DIRENT_ALL
As in the previous commit, 'de' is used as the iterator variable name.
2021-12-15 22:50:00 +01:00
Yu Watanabe
2b3a8e2830 network: route: update comment 2021-12-15 20:07:17 +00:00
Daan De Meyer
24040269ee journal: Stop reading in increments of block size during hole punching
Let's not try to be overly clever here. This code path is not overly
performance sensitive and we should avoid trying to outsmart the kernel
without proper benchmarking.
2021-12-15 18:24:29 +01:00
Daan De Meyer
d951ac5578 journal: Use 16kb buffer during hole punching
Let's use the same buffer size as used in as copy.h.
2021-12-15 18:22:17 +01:00
Daan De Meyer
cdbba44878 journal: Correctly advance offset when iterating hash table entries
pread() is not guaranteed to completely fill up the given buffer with
data which we assumed until now. Instead, only increment the offset by
the number of bytes that were actually read.
2021-12-15 18:21:19 +01:00
Daan De Meyer
a2799cc556 journal: Add a minimum hole size for hole punching
Let's not bother punching extremely small holes to avoid unnecessary
file fragmentation.
2021-12-15 18:17:22 +01:00
Yu Watanabe
79463de533 test: add testcases for net.ifname-policy= kernel command line argument 2021-12-16 01:55:37 +09:00
Yu Watanabe
a4c9bf2e51 network-generator: support to set NamePolicy= through kernel command line argument
Closes #16296.
2021-12-16 01:55:37 +09:00
Yu Watanabe
ff516b4341 udev: move NamePolicy to netif-naming-scheme.[ch] 2021-12-16 01:55:37 +09:00
Yu Watanabe
eb3e86ae2c network-generator: support MAC address longer or shorter than ETH_ALEN 2021-12-16 01:55:37 +09:00