Commit Graph
66345 Commits
Author SHA1 Message Date
Yu Watanabe 0bf67ba2d4 test: update comment to make it consistent with the condition
Follow-up for 6425dec88b.
2023-07-31 15:48:54 +01:00
Luca Boccassi 26172880f2 Merge pull request #28599 from keszybz/two-compilation-fixes
Two compilation fixes
2023-07-31 15:37:59 +01:00
Zbigniew Jędrzejewski-Szmek 6425dec88b tests: skip static asserts on old clang versions
We declare clang >= 10 is supported. The workaround is easy enough, so let's
just do that. Fixes #28598. With Debian clang version 11.0.1-2:

[267/384] Compiling C object test-bitfield.p/src_test_test-bitfield.c.o
FAILED: test-bitfield.p/src_test_test-bitfield.c.o
clang -Itest-bitfield.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fcolor-diagnostics -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Warray-bounds -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=undef -Wfloat-equal -Winit-self -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wunused-function -Wwrite-strings '-Wno-error=#warnings' -Wno-string-plus-int -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Wno-typedef-redefinition -Wno-gnu-variable-sized-type-not-at-end -Werror=shadow -fno-strict-aliasing -fvisibility=hidden -fno-omit-frame-pointer -include config.h -DTEST_CODE=1 -MD -MQ test-bitfield.p/src_test_test-bitfield.c.o -MF test-bitfield.p/src_test_test-bitfield.c.o.d -o test-bitfield.p/src_test_test-bitfield.c.o -c ../src/test/test-bitfield.c
../src/test/test-bitfield.c:216:9: error: static_assert failed due to requirement '__builtin_constant_p(({
    static_assert(sizeof(unsigned char) <= sizeof(unsigned long long), "sizeof(uint8_t) <= sizeof(unsigned long long)");
    static_assert(__builtin_choose_expr(__builtin_constant_p(1), 1, 0) < (int)(sizeof(unsigned char) * 8), "__builtin_choose_expr(__builtin_constant_p(1), 1, 0) < (int)(sizeof(uint8_t) * 8)");
    __builtin_choose_expr(__builtin_constant_p(1), ((unsigned char)1) << (1), ({
        int __unique_prefix__i751 = (1);
        do {
            if ((__builtin_expect(!!(!(__unique_prefix__i751 < (int)sizeof(unsigned char) * 8)), 0)))
                log_assert_failed("UNIQ_T(_i, 751) < (int)sizeof(uint8_t) * 8", (&"../src/test/test-bitfield.c"[(sizeof ("..") - sizeof(const char)) + 1]), 216, __func__);
        } while (0);
        ((unsigned char)1) << __unique_prefix__i751;
    }));
}))' "__builtin_constant_p(INDEX_TO_MASK(uint8_t, 1))"
        assert_cc(__builtin_constant_p(INDEX_TO_MASK(uint8_t, 1)));
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/fundamental/macro-fundamental.h:109:25: note: expanded from macro 'assert_cc'
                        ^             ~~~~
/usr/include/assert.h:143:24: note: expanded from macro 'static_assert'
                       ^
...
2023-07-31 14:15:24 +02:00
Zbigniew Jędrzejewski-Szmek 7f4b3dc043 gpt-auto-generator: fix warnings about unused func when !ENABLE_EFI 2023-07-31 14:04:55 +02:00
Luca Boccassi b173b8186f Merge pull request #28596 from keszybz/doc-updates
Two documentation updates
2023-07-31 11:11:11 +01:00
Zbigniew Jędrzejewski-Szmek 377d3a31e6 man/systemd.service: advise Type=exec instead of Type=simple
The descriptions of various options are reworked: first say what protocol
actually is, i.e. describe what type of notification the manager waits
for. Only after that describe various steps and things the service should
do. Also, apply some paragraph breaks.

Instead of recommending Type=simple, recommend Type=exec. Say explicitly that
Type=simple, Type=forking are not recommended. Type=simple ignores failure in a
way that doesn't make any sense except as a historical accident. We introduced
'exec' instead of changing 'simple' to keep backwards-compatiblity, but
'simple' is not very useful. 'forking' works, but is inefficient: correctly
programming the interface requires a lot of work, and at runtime, the
additional one or two forks are just a waste of CPU resources. Furthermore, we
now understand that because of COW traps, they may also increase memory
requirements. There is really no reason to use 'forking', except if it's
already implemented and the code cannot be changed to use 'notify'.

Also, remove the recommendations to use Type=simple to avoid delaying boot. In
most cases, if the service can support notifications about startup, those
should be done.

Overall, for new services, "notify", "notify-reload", and "dbus" are the
types that make sense.
2023-07-31 11:23:36 +02:00
Zbigniew Jędrzejewski-Szmek 02f7f8aa4f systemd-battery-check: provide more debug logs
The logs would give no hint about the answer to most interesting question: why
we decided to return true or false from the program. If we find batteries
that are low or uncertain, log at info level.
2023-07-31 10:06:04 +01:00
Daan De Meyer 7e5bf8981f Merge pull request #28474 from yuwata/chase-fix
chase: handle ".." more carefully
2023-07-31 10:46:19 +02:00
Zbigniew Jędrzejewski-Szmek ffe7ddb9bc NEWS: fix misstatement
We don't have type 'ready'.
2023-07-31 09:15:35 +02:00
Luca Boccassi fcd71b62be Merge pull request #28595 from medhefgo/elf2efi-fixes
elf2efi: Fixes
2023-07-31 00:07:28 +01:00
Luca Boccassi e3d0ccb959 Merge pull request #28269 from yuwata/udev-builtin-net_id-cleanups-part1
udev: cleanups and several fixes for net_id builtin
2023-07-30 23:56:54 +01:00
Luca Boccassi 6c0ac118d2 Merge pull request #28567 from yuwata/meson-versiondep
meson:  cleanups for version dependency
2023-07-30 23:40:51 +01:00
Jan Janssen d0bbe32485 stub: Also reserve sections for EFI stub
The stub image may not have enough sections to cause enough PE header
space to be free for later expansion. Given that the stub is guaranteed
to be expanded we should always reserve enough sections for it.

This also bumps the reservation to 15. It doesn't add more space
compared to current builds but it more closely reflects the amount of
sections that a UKI could have in total if all optional sections are
used.

Fixes: #28593
2023-07-30 21:31:38 +02:00
Jan Janssen ee91e06a58 elf2efi: Fix header size calculation
The PE header size calculation failed to take the PE magic and coff
header size into account, which will lead to header truncation if we are
writing only 5 sections.
2023-07-30 21:31:38 +02:00
Yu Watanabe 23c5ea76f9 Merge pull request #28573 from yuwata/network-address-next-part2
network: make Address object more consistent with assigned address
2023-07-31 04:14:16 +09:00
Yu Watanabe d19704cd21 test-network: add testcase for overriding Address.RouteMetric=
For issue #25843.
2023-07-31 02:31:17 +09:00
Yu Watanabe 7e18f9b487 network/address: also save/update priority of prefix route
Strictly speaking, this is not necessary, but let's make the managed
Address objects more consistent with the kernel's addresses.
2023-07-31 02:31:05 +09:00
Yu Watanabe b33dd04ebe network/address: introduce address_get_harder() and use it where appropriate
With the previous change, now Address objects under requesting are not
owned by Link object, hence we need to also search corresponding Address
object in the request queue.
2023-07-31 02:31:00 +09:00
Yu Watanabe 0a0c2672db network/address: do not add Address object to Link on requesting
Then, all addresses managed by a link really exist (unless the kernel
silently removes addresses).
By this change, now Address objects managed by Link and owned by Request
are decoupled, and always requested settings will be applied.

Fixes #25843.
2023-07-31 02:31:00 +09:00
Yu Watanabe 3c283289ae network/address: make Address object more consistent with assigned address
This makes `manager_rtnl_process_address()`
- first read minimal information to get managed Address object,
- then update the managed Address object directly.

Previously, we updated the Address object managed by Link partially,
e.g. peer address did not updated.
This makes the managed Address object more consistent with the assigned
address.
2023-07-31 02:30:43 +09:00
Yu Watanabe da59599d3d network: fix typo
Follow-up for bbeceaf295.
2023-07-31 02:08:43 +09:00
Kiran Vemula bc837621a3 resolved: added show-server-state verb and DumpStatistics varlink method
Added show-server-state verb to resolvectl
Added DumpStatistics and ResetStatistics  methods to varlink
2023-07-31 02:02:03 +09:00
Yu Watanabe e2aee7ed90 Merge pull request #28591 from yuwata/network-neighbor-next
network/neighbor: follow the kernel's way how to manage neighbors
2023-07-31 01:42:39 +09:00
Yu Watanabe 86d1f7c974 Merge pull request #28575 from yuwata/network-address-next-part3
network: check specified address settings in more detail
2023-07-31 00:59:31 +09:00
Yu Watanabe 8b52860b86 Merge pull request #28572 from yuwata/network-ipv4acd
network: split-out sd_ipv4acd object management from Address object
2023-07-31 00:58:54 +09:00
Frantisek Sumsal a3d610998a tmpfiles.d: adjust /dev/vfio/vfio access mode
kmod-static-nodes.service sets the mode to 0600, but we want it
to be 0666 as specified in 50-udev-default.rules.

Resolves: #28588
2023-07-31 00:58:01 +09:00
Yu Watanabe 2ede355908 test-network: add tests for several invalid neighbor settings, and overriding settings
This also makes the checks stricter.
2023-07-31 00:40:03 +09:00
Yu Watanabe 5d098f5d36 network/neighbor: do not add Neighbor object to Link on requesting
Then, all neighbors managed by a link really exist (unless the kernel
silently removes neighbors).
2023-07-31 00:39:59 +09:00
Luca Boccassi 167338529b Merge pull request #28428 from ldv-alt/ERRNO_IS
treewide: cleanup use of ERRNO_IS_*(r)
2023-07-30 16:31:16 +01:00
Yu Watanabe aa9626ee3b network/neighbor: follow the way how kernel distinguish neighbor settings
The kernel manages neighbors by the destination address, and the
LinkLayerAddress is mutable. Let's manage neighbors in the same way, and
dedup settings.
2023-07-31 00:00:07 +09:00
Yu Watanabe bbeceaf295 network/neighbor: skip to request neighbors with unmatching link layer address length 2023-07-31 00:00:07 +09:00
Yu Watanabe 5385e5f940 network/ipv4acd: split out sd_ipv4acd management from Address to Link
Then, we can start IPv4ACD without adding corresponding Address object
to Link.

Hopefully, no functional change, just refactoring and preparation for
later commits.
2023-07-30 23:16:41 +09:00
Yu Watanabe 9701be563a in-addr-util: introduce PTR_TO_IN4_ADDR() and IN4_ADDR_TO_PTR()
These should be useful when an IPv4 address is used as a key of a
hashmap.
2023-07-30 23:15:53 +09:00
Yu Watanabe 626d653a90 sd-ipv4acd: introduce sd_ipv4acd_is_bound() 2023-07-30 23:15:53 +09:00
Yu Watanabe 722ac24651 network/ipv4acd: drop unused argument 2023-07-30 23:15:53 +09:00
Yu Watanabe 262ac7fcf2 network/ipv4acd: use IN4_ADDR_TO_STRING() 2023-07-30 23:15:40 +09:00
Yu Watanabe b1179a5d0b network/address: ignore address settings with unsupported flags 2023-07-30 22:53:49 +09:00
Yu Watanabe d9e2afc033 network/address: drop IPv6 settings when the kernel does not support IPv6 2023-07-30 22:53:15 +09:00
Susant Sahani f141b2c053 network: ndisc - Honour CurHopLimit
RFC4861 Neighbor Discovery – Sections 4.2 and 6.3.4

From section 4.2. Router Advertisement Message Format:

Cur Hop Limit        8-bit unsigned integer.  The default value that
                     should be placed in the Hop Count field of the IP
                     header for outgoing IP packets.  A value of zero
                     means unspecified (by this router).
2023-07-30 14:37:21 +01:00
Yu Watanabe 1a1f4a8092 network/address: merge address_needs_to_set_broadcast() with address_get_broadcast()
No functional change, preparation for later commits.
2023-07-30 14:33:23 +01:00
Luca Boccassi 9dabe36cb0 Merge pull request #28574 from yuwata/network-queue-next
network/queue: preparations
2023-07-30 14:27:43 +01:00
Luca Boccassi 1665bbbddf Merge pull request #28571 from yuwata/network-address-next-part1
network: several trivial cleanups
2023-07-30 14:01:53 +01:00
Yu Watanabe 4d4d7910d9 network/neighbor: drop IPv6 settings when the kernel does not support IPv6 2023-07-30 13:57:13 +01:00
Yu Watanabe 754252f923 network: rename sd_netlink_message* req -> m
This also merges neighbor_configure_message() with neighbor_configure().
2023-07-30 13:55:18 +01:00
Yu Watanabe 22b906dd96 Merge pull request #28564 from YHNdnzj/gpt-auto-kill-more-duplicate
gpt-auto: don't mount ESP if there's an fstab entry for it
2023-07-30 08:59:50 +09:00
Yu Watanabe 0c491d0f34 meson: use kwargs to declare efi binaries
No functional change, just refactoring.
2023-07-30 08:57:55 +09:00
Frantisek Sumsal 9fe4e68cab analyze: fix pcrs verb output without TPM support
If we don't have TPM support then `alg` is NULL and passing this to
table_new() means we'd get a table with only two columns instead of
three, leading up to a very confusing output:

$ build/systemd-analyze pcrs
System lacks full TPM2 support, not showing PCR state.
                 NR NAME
                  0 platform-code
                  - 1
    platform-config -
                  2 external-code
                  - 3
    external-config -
                  4 boot-loader-code
                  - 5
 boot-loader-config -
                  6 -
                  - 7
...

Let's name the header in this case with a simple dash, as it's going
to be hidden anyway, to make the table nice again:

$ build/systemd-analyze pcrs
System lacks full TPM2 support, not showing PCR state.
NR NAME
 0 platform-code
 1 platform-config
 2 external-code
 3 external-config
 4 boot-loader-code
 5 boot-loader-config
 6 -
 7 secure-boot-policy
...
2023-07-30 08:57:37 +09:00
Yu Watanabe 40c7d3c713 meson: unconditionally add version dependency for all executables and libraries
Otherwise, we can easily forget the dependency.
No functional change, just refactoring.
2023-07-30 05:36:22 +09:00
Yu Watanabe bdb577f545 tree-wide: drop unnecessary inclusion of version.h 2023-07-30 04:56:38 +09:00
Yu Watanabe 4122d68682 boot: always set SBAT_DISTRO_VERSION 2023-07-30 04:54:47 +09:00