1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-26 14:04:03 +03:00

66972 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
12455d6e87
Merge pull request #28918 from yuwata/network-dhcp-custom-duid
network/dhcp: allow to specify custom duid type
2023-08-24 15:45:07 +02:00
Lennart Poettering
6b0651df60 gpt: move basic header/partition structure of GPT into common code
This way we can use it at other places too, not just when dissecting
images.
2023-08-24 15:25:38 +02:00
Lennart Poettering
24ae45cb65 alloc-util: add free_many() helper
We often free an array of things. Let's create a common helper for this,
and port some potential users over. (Not all, too lazy for that for
now).
2023-08-24 15:04:33 +02:00
Lennart Poettering
e0e1f4f7a2 fundamental: rename tpm-pcr.h → tpm2-pcr.h
I always found it confusing that most of our TPM related definitions are
in tpm2-util.h, but the PCR names in tpm-pcr.h, without the "2". Let's
fix that and make this systematic, in particular as the definitions in
the file all start with TPM2_ already.

No code flow changes, just some renaming.
2023-08-24 13:40:37 +02:00
Lennart Poettering
46c5a1383a fundemental: split out UKI defines into its own header
The UKI sections have little to do with the PCRs, hence give them their
own header.
2023-08-24 13:40:37 +02:00
Lennart Poettering
2099cd6289 tpm2: unify symbolic name infra for PCRs
We so far maintained two places for symboic names for PCRs. One in
tpm2-util.h and one in tpm-pcr.h.

Let's unify this into one, i.e. move the full list from tpm2-util.h into
tpm-pcr.h, replacing the short list placed so far there.

Systematically prefix the definitions with TPM2_ or tpm2_, to follow how
we do this for all other defines in this context.

No change in behaviour, just unification of tables.
2023-08-24 13:40:37 +02:00
Lennart Poettering
a16e19c61d
Merge pull request #28946 from poettering/json-variant-append-arrayb
add json_variant_append_arrayb() helper + more related
2023-08-24 13:37:10 +02:00
Lennart Poettering
f5fc7732b0 json: add json_variant_set_fieldb() helper
Let's a "b" helper for json_variant_set_field() that combines
json_build() with json_variant_set_field(), similar to the
json_variant_merge_objectb(), json_variant_append_arrayb().
2023-08-24 13:20:39 +02:00
Lennart Poettering
e931768eb4 json: rename json_append() → json_variant_merge_objectb()
json_append() is a useful wrapper around json_variant_merge(). However,
I think the naming sould be cleaned up a bit of both functions.

I thinker "merge" is the better word than "append", since it does
decidedly more than just append: it replaces existing fields of the same
name, hence "merge" sounds more appropriate. This is as opposed to the
similar operations for arrays, where no such override logic is applied
and we really just append, hence those functions are called "append"
already.

To make clearer that "merge" is about objects, and "append" about
arrays, also include "object" in the name.

Also, include "json_variant" in the name, like we do for almost all
other functions in the JSON API that take a JSON object as primary
input, and hence are kinda object methods.

Finally, let's follow the logic that helpers that combine json_build()
with some other operation get suffixed with "b" like we already have in
some cases.

Hence:

json_variant_merge() → json_variant_merge_object()
       json_append() → json_variant_merge_objectb()

This mirrors nicely the existing:
                       json_variant_append_array()
                       json_vairant_append_arrayb()

This also drops the variant of json_append() that takes a va_arg
parameter (i.e. json_appendv()). We have no user of that so far, and
given the nature as a helper function only I don#t see that happening,
and if it happens after all it's trivial to bring back.
2023-08-24 13:20:39 +02:00
Lennart Poettering
c91f581c47 tree-wide: use json_variant_append_arrayb() at many places 2023-08-24 13:19:52 +02:00
Lennart Poettering
3218794f1c json: add json_variant_append_arrayb() helper 2023-08-24 13:19:52 +02:00
Lennart Poettering
ba091282e5 utf8: automatically determine length of string if SIZE_MAX is specified
Let's make utf8_to_utf16() and utf16_to_utf8() a bit nicer to use by
adding shortcuts for common cases.

This is particularly relevant for utf16_to_utf8() since the
multiplication with 2 is easy to forget.
2023-08-24 13:19:12 +02:00
Yu Watanabe
6df82d128c network/ndisc: use the first captive portal in each RA
To handle malicious RA packets gracefully.

Also prompted by https://github.com/systemd/systemd/pull/28285#issuecomment-1627585140.
2023-08-24 20:01:08 +09:00
Yu Watanabe
bf943a9d49 network/ndisc: do not store too many captive portals provided through RA
Prompted by https://github.com/systemd/systemd/pull/28285#issuecomment-1627585140.
2023-08-24 19:59:34 +09:00
Susant Sahani
e448fcd01a test-network: re-add test for custom client identifier 2023-08-24 19:55:31 +09:00
Yu Watanabe
80500bb5d4 network/dhcp: make DUIDType= take an arbitrary integer
Closes #26745.
2023-08-24 19:55:27 +09:00
Yu Watanabe
2da796cabb dhcp: DUID-EN identifier has variable length
Also make `array[0]` -> `array[]`.

See RFC 8415, section 11.3.
2023-08-24 19:52:35 +09:00
Yu Watanabe
9291496011 network/dhcp: fix maximal DUID data size
The maximum DUID size is 128, but that includes type specified.
Hence, the maximal data size is 126.
2023-08-24 19:50:37 +09:00
Yu Watanabe
53488ea352 network: introduce per DUID type setters
No functional change, just refactoring.
2023-08-24 19:50:36 +09:00
Yu Watanabe
6ed69be98a Revert "network: DHCP6 client- Allow to send manual DUID"
This reverts commits 89e73ce86fb115c2e319bf9f28b63efad2975495 and
543d2a4d45ba199a62c87b3bf69dfd4ff55abf0c.

The commit assign "custom" to fixed DUID type 5. When making DUID fully
configurable, the type number should be also configurable. Also, the
fully custom DUID should be acceptable for DHCPv4.
2023-08-24 19:50:36 +09:00
Daan De Meyer
b56ee69233 hostname: Make sure we pass error to bus_verify_polkit_async()
Fixes #28943
2023-08-24 11:23:01 +02:00
Zbigniew Jędrzejewski-Szmek
c9c4e599fc
Merge pull request #24175 from medhefgo/meson-feature
meson: Use feature options
2023-08-24 11:19:55 +02:00
Zbigniew Jędrzejewski-Szmek
c31ba5cfe9 meson: use 'sh' variable everywhere
We went back-and-forth a bit on this. Very old meson would print a message
about detecting the program if a quoted argument was used, leading to a lot of
noise. So we started to convert various places to use the variable, but then it
turned out that meson < 0.56.2 doesn't handle this correctly and we reverted to
using strings everywhere in 7c22f07cbd86b39e78990057687e5509fa299672. Then at
some point we stopped supporting old meson and over time we started using the
variable in various places again, somewhat inconsistently. Then most calls to
'sh' were removed in 9289e093ae6fd5484f9119e1ee07d1dffe37cd10 when
install_emptydir() builtin started being used.

Now meson allows either the string or variable to be used, and doesn't print a
message if the string is used. Let's use the variable everywhere. For 'sh', we
could do either, but for other variables, we _do_ want the detection to happen,
for example for git, find, awk, which might not be installed and we want to
detect that early, before we start the build. It would be ugly to use quotes
for some programs, but not for others. Also, a string is still refused for
test(), so we couldn't use the string version even if we didn't care about
detection.
2023-08-24 11:17:50 +02:00
Daan De Meyer
799cd3100b repart: Make verity example more useful
Add Minimize= so the size gets calculated correctly and add a verity
signature partition as well for completeness.
2023-08-24 10:43:11 +02:00
Frantisek Sumsal
9541addff0 test: use the correct file name when restoring the original fstab 2023-08-24 07:54:13 +00:00
Daan De Meyer
1ffa5cfb38 repart: Add partno to output 2023-08-23 15:12:23 +02:00
Daan De Meyer
9f643be929 mkosi: Drop fedora workaround
Seems the key issues got resolved so let's drop the workaround.
2023-08-23 15:10:46 +02:00
Jan Janssen
2d7c857d9c meson: Simplify efi test/fuzz definitions 2023-08-23 14:58:04 +02:00
Jan Janssen
7f9a0d6d74 meson: Drop skip-deps option
Now that we use meson feature options for our dependencies, we can just
rely on '--auto-features=disabled' to do the same. One benefit of this
is that specific features can still be force-enabled by overriding it
with the appropriate '-Dfeature=enabled' flag.

The two remaining uses for skip-deps can simply rely on their default
logic that sets the value to 'no' when the dependency is disabled.
2023-08-23 14:57:49 +02:00
Jan Janssen
1e73a64a7a meson: Convert more options to meson features
The semantics for libidn2 and pwquality have changed slightly: We will
pick a preferred one if both are enabled instead of making it an error.
2023-08-23 14:45:02 +02:00
Jan Janssen
847e5585b6 meson: Convert bpf-framework to meson feature 2023-08-23 14:45:02 +02:00
Jan Janssen
40e9c4e45d meson: Convert options to meson features (require)
These options use requre() to conveniently express their dependency
requirements.
2023-08-23 14:45:02 +02:00
Jan Janssen
101b59433b meson: Convert dbus to meson feature
Also, there is no need to conditionalize the get_variable() calls
because not-found dependencies will just return the passed default value
if provided.
2023-08-23 14:45:02 +02:00
Jan Janssen
a0c9ac9ae4 meson: Convert options to meson features (find_library fallback)
This uses a two-step approach to make sure we can fall back to
find_library(), while also skipping the detection if the features are
explicitly disabled.
2023-08-23 14:45:02 +02:00
Jan Janssen
9ee80846f8 meson: Convert fidsk to meson feature
By making this a disabler dependency, we can slightly simplify the code
and it als fixes the build for -Dfdisk=disabled as we failed to create a
fallback empty libshared_fdisk variable.
2023-08-23 14:45:02 +02:00
Jan Janssen
43abc59a27 meson: Use feature options
By using meson features we can replace the handcrafted dependency
auto-detection by just passing the value from get_option directly to the
required arg for dependency, find_library etc.
'auto' features make the dependency optional, 'enabled' requires it
while 'disabled' features will skip detection entirely.

Any skipped or not found dependency will just be a no-op when passed to
build steps and therefore we can also skip the creation of empty vars.

The use of skip_deps for these is dropped here as meson provides a way
to disable all optional features in one go by passing
'-Dauto_features=disabled'.
2023-08-23 14:45:02 +02:00
Susant Sahani
b26c345279 network: radv - Allow to send hop limit 2023-08-23 14:06:14 +09:00
Yu Watanabe
244f518f1d
Merge pull request #28764 from yuwata/core-namespace
core/namespace: cleanups
2023-08-23 12:43:29 +09:00
Nandakumar Raghavan
a2fc6f2d59 networkd: Add T1 and T2 DHCPv6 options to expose in dbus API
Include T1 and T2 DHCPv6 options to expose in dbus API.
Introduced new field DHCPv6lease where these options are
added. This will be added to the JSON output when we query
org.freedesktop.network1.Manager object.
2023-08-23 12:43:09 +09:00
Yu Watanabe
856532ef01
Merge pull request #28926 from yuwata/bsod-cleanups
bsod: several cleanups
2023-08-23 12:41:53 +09:00
Susant Sahani
fdc4c67c2a
network/radv: allow to configure the time between retransmitted Neighbor Solicitation (#28888) 2023-08-23 12:37:44 +09:00
Yu Watanabe
14c5c43985
Merge pull request #28496 from ssahani/ndisc-28426
network: ndisc - Also fill router preference
2023-08-23 12:36:45 +09:00
Susant Sahani
4ccd48cb26 network: ndisc - drop routes of lifetime 0
A Lifetime of 0 indicates that the router is not a default router anymore
and associated default route should be discarded from host's routing table.

https://datatracker.ietf.org/doc/html/rfc4861
```
Router Lifetime
     16-bit unsigned integer.  The lifetime associated
     with the default router in units of seconds.  The
     field can contain values up to 65535 and receivers
     should handle any value, while the sending rules in
     Section 6 limit the lifetime to 9000 seconds.  A
     Lifetime of 0 indicates that the router is not a
     default router and SHOULD NOT appear on the default
     router list.  The Router Lifetime applies only to
     the router's usefulness as a default router; it
     does not apply to information contained in other
     message fields or options.  Options that need time
     limits for their information include their own
     lifetime fields.

```
2023-08-22 21:28:11 +05:30
Yu Watanabe
51bf9b1ac3 core/namespace: do not return 1 unnecessarily
The caller of this function apply_mounts() -> apply_one_mount() only
checks if the return value is negative or not.
2023-08-22 23:22:34 +09:00
Yu Watanabe
cc45ff17a4 core/namespace: add missing string table entries 2023-08-22 23:22:32 +09:00
Yu Watanabe
2b60ce545c mount-util: drop unused remount_and_move_sub_mounts() 2023-08-22 23:21:43 +09:00
Yu Watanabe
553e366086 core/namespace: reimplement mount_private_sysfs() in the same logic to mount private procfs
Previously, mount_private_sysfs() was implemented by using open_tree()
and move_mount() to keep submounts. But these syscalls are slightly new
and supported since kernel version 5.2.

We already do the same thing for /proc/, but without the new syscalls.
Let's use the same logic to mount private procfs. Then, we can mount
new instance of sysfs with older kernels.
2023-08-22 23:21:43 +09:00
Yu Watanabe
cc7e2dff7e core/namespace: use ERRNO_IS_NEG_PRIVILEGE()
Also, this makes mount_procfs() always return the last failure in mount(),
and slightly reduces indentation by returning earlier.
2023-08-22 23:21:43 +09:00
Zbigniew Jędrzejewski-Szmek
88328d997a
Merge pull request #28787 from yuwata/credential-next
core: do not leak mount for credentials directory if possible
2023-08-22 16:21:00 +02:00
Yu Watanabe
c3c885a771 bsod: several cleanups
- add reference to the service unit in the man page,
- fix several indentation and typos,
- replace '(uint64_t) -1' with 'UINT64_MAX',
- drop unnecessary 'continue'.
2023-08-22 23:20:14 +09:00