Commit graph

70086 commits

Author SHA1 Message Date
Yu Watanabe eabc38daa8 TODO: drop implemented feature 2024-01-10 04:33:55 +09:00
Yu Watanabe d26319be92 test: add test for [Link] Property= and friends 2024-01-10 04:33:55 +09:00
Yu Watanabe 046286e863 udev/net: introduce [Link] Property=, ImportProperty=, and UnsetProperty= settings
The applied order is equivalent to Environment=, PassEnvironment=, and
UnsetEnvironment= for [Service] or so.
2024-01-10 04:33:51 +09:00
Yu Watanabe 513ca8b6f0 udev: split out check that udev property can be updated 2024-01-10 04:27:41 +09:00
Yu Watanabe 3e00171dcd udev/net: split out udev property assignment logic
No functional change, just refactoring.
2024-01-10 04:27:41 +09:00
Yu Watanabe 0c3af33e19 udev/net: do not set unapplied .link file name to ID_NET_LINK_FILE
Instead, import already assigned value from the udev database.
Then, return the builtin earlier.
2024-01-10 04:27:41 +09:00
Yu Watanabe ac36406277 udev-builtin-path_id: drop redundant debugging logs
The function udev_builtin_add_property() internally logs the failure.
2024-01-10 04:27:26 +09:00
Yu Watanabe 50a0379d5d udev/builtin: introduce udev_builtin_import_property() helper function
This is not used in this commit, but will be used later commits.
2024-01-10 04:11:08 +09:00
Yu Watanabe 12b1e04073 man: fix indentation 2024-01-10 03:50:32 +09:00
Lennart Poettering 84960b7f3c
Merge pull request #30844 from keszybz/rename-uid-alloc-range
Rename uid-alloc-range.[ch] files
2024-01-09 18:51:35 +01:00
Lennart Poettering d16d05d2d3 nspawn: drop empty #if/#endif section
Follow-up for adb29d588e
2024-01-09 16:06:30 +01:00
Daan De Meyer 8c018edb0a mkosi: Update to latest
The mkosi github action doesn't set up the host machine for building
full images anymore. Instead, only sufficient packages are installed
to be able to build tools trees so we configure a fedora tools tree
to build the actual images.
2024-01-09 14:58:34 +00:00
Luca Boccassi b4a85f75b0
Merge pull request #30843 from keszybz/test-relative-paths
Use relative paths in test units
2024-01-09 12:23:35 +00:00
Lennart Poettering bed41c4084
Merge pull request #30833 from poettering/hostnamed-varlink
hostnamed: add simple varlink interface
2024-01-09 12:38:58 +01:00
Lennart Poettering bf543ba624 update TODO 2024-01-09 12:34:33 +01:00
Luca Boccassi c3f4d9f9a4
Merge pull request #30842 from aafeijoo-suse/analyze-q-man-help-fix
analyze: minor fixes
2024-01-09 10:40:19 +00:00
Lennart Poettering 11f4f647d3
Merge pull request #30826 from YHNdnzj/networkd-wireguard-credential
networkd/wireguard: support network.wireguard.* credentials
2024-01-09 11:26:11 +01:00
Zbigniew Jędrzejewski-Szmek 67953523d1 TEST-07: minor simplification 2024-01-09 11:18:11 +01:00
Zbigniew Jędrzejewski-Szmek 8e1ac16bc6 src/basic: rename uid-alloc-range.[ch] to uid-classification.[ch]
We had both uid-range.h and uid-alloc-range.h. The latter now contains helpers
like {uid,gid}_is_{system,dynamic,container}(), uid_for_system_journal(), so
the existing name is outdated. I think the uid-range.[ch] should stay separate
because it has a bunch of helpers for parsing and printing of uid ranges. So
let's rename as in $subject to better reflect the contents of the file and make
the two sets of files harder to confuse.
2024-01-09 11:15:00 +01:00
Zbigniew Jędrzejewski-Szmek eb7d7d14fb src/basic: "UidRange" → "UIDRange"
We don't "uncapitalize" parts of an already-capitalized name when concatenating
words. In particular, we had UidRange in basic/uid-range.h and UGIDAllocationRange
in basic/uid-alloc-range.h, which is annoying.
2024-01-09 11:15:00 +01:00
Zbigniew Jędrzejewski-Szmek 63403f07b0 tests: use relative paths in ExecStart= and friends
We want to retain *some* of the full paths in order to test more code paths.
But the default should be to use the command name only. This makes the tests
less visually cluttered.
2024-01-09 11:14:16 +01:00
Lennart Poettering 77986df63c hostnamed: always include VSockCID property in describe JSON
that way clients can distinguish whether there is no cid or whether
hostnamed doesn't support it nicely, by just looking if the prop exists
(but is null) or not.

This is similar how we already handle all other props in the JSON
record.
2024-01-09 10:46:25 +01:00
Lennart Poettering 0a6598bb38 hostnamed: add simple Varlink API, too 2024-01-09 10:46:25 +01:00
Lennart Poettering 09c7bead29 testsuite-71: reset startlimit counter manually
The test cases will call quite a lot of "systemctl stop
systemd-hostnamed", hence let's make sure we reset the start limit
counter each time, to not make this eventually fail.

(At other places we disabled the start limit counter, but here I opted
for resetting it manually via 'systemctl reset-failed', to test another
facet of the mechanism)
2024-01-09 10:46:01 +01:00
Lennart Poettering 5ee5b1659a id128-util: do not expose product UUID when running in a container
When we run in a container we should show our own system's info, not the
hosts hence suppress this info in that case.

This matches the behaviour of most other calls in hostnamed to expose
system properties.
2024-01-09 10:46:01 +01:00
Lennart Poettering 96520e8b0c hostnamed: move bus and event loop object into Context object
It's a bit weird to keep this separate in particular as the polkit
object is already part of the context.
2024-01-09 10:46:01 +01:00
Lennart Poettering aefaeebef3 hostnamed: port to sd_event_set_signal_exit() 2024-01-09 10:46:01 +01:00
Antonio Alvarez Feijoo ca02969379
analyze: man and --help fixes
man:
- `verify` requires an argument
- `security` does not require an argument
- `fdstore` requires an argument
- `image-policy` requires an argument

`--help` text:
- missing `image-policy` command
- `cat-config` requires NAME or PATH
2024-01-09 10:11:59 +01:00
Antonio Alvarez Feijoo 7c0e0bbb6b
analyze: fix -q option
Follow-up to 52117f5af8
2024-01-09 09:05:50 +01:00
Mike Yuan fa724cd52c
networkd/wireguard: support network.wireguard.* credentials
Closes #26702
2024-01-09 15:25:30 +08:00
AtariDreams d7d6195953
cocci: merge mfree.cocci and mfree_return.cocci (#30838)
It makes sense that these should be one file instead of two, as they both involve mfree()
2024-01-09 12:24:37 +09:00
AtariDreams 5ba46b99f7
simplify bitwise checking (#30722)
Some of these checks before bitwise operations are redundant and compilers
do not always recognize them, so let's simplify the code to make the intentions
clearer.
2024-01-09 10:18:10 +09:00
Yu Watanabe 35716eed55
Merge pull request #30837 from poettering/varlink-over-ssh
varlink: add "ssh:" transport for talking to remote servers
2024-01-09 10:14:03 +09:00
Lennart Poettering fc1f05ebab socket-util: modernize socknameinfo_pretty() a bit 2024-01-09 10:00:21 +09:00
Lennart Poettering 8759bc9541 discover-image: don't accidentally set /run/systemd/nspawn/ access mode too strict
mkdir_p() uses the specified access mode for all dirs that are missing,
hence if we call it on /run/systemd/nspawn/locking and
/run/systemd/nspawn/ doesn't exist yet, we#d create it 0700 here. But
that was never the intention, and all other code creating that dir sets
the mode to 0755. Fix this here to match the rest.
2024-01-09 09:58:26 +09:00
Lennart Poettering bcb1bb379e sd-bus: also intrepret $SYSTEMD_SSH env var
To make things symmetric to the $SYSTEMD_SSH logic that the varlink
transport supports, let's also honour such a variable in sd-bus when
picking ssh transport.
2024-01-08 23:24:51 +01:00
Lennart Poettering a1bb30de7f varlink: add "ssh:" transport
This uses openssh 9.4's -W support for AF_UNIX. Unfortunately older versions
don't work with this, and I couldn#t figure a way that would work for
older versions too, would not be racy and where we'd still could keep
track of the forked off ssh process.

Unfortunately, on older versions -W will just hang (because it tries to
resolve the AF_UNIX path as regular host name), which sucks, but hopefully this
issue will go away sooner or later on its own, as distributions update.

Fedora is still stuck at 9.3 at the time of posting this (even on
Fedora), even though 9.4, 9.5, 9.6 have all already been released by
now.

Example:
        varlinkctl call -j ssh:root@somehost:/run/systemd/io.systemd.Credentials io.systemd.Credentials.Encrypt '{"text":"foobar"}'
2024-01-08 23:24:45 +01:00
Lennart Poettering 07dca3c4b0 varlink: turn off O_NONBLOCK in exec: transport
If we invoke our own varlink implementation we'll turn on O_NONBLOCK
right-away again, hence there is little point in turning it off,
however, I generally think we probably should always path this fd as
blocking, since that is the default after all, and invoked processes
might want to use it like that.

Or to see this differently: I think the varlink fd passed for activation
in many ways is similar to and as fundamental as stdin/stderr/stdout,
hence should probably be synchronous by default.
2024-01-08 23:24:39 +01:00
Lennart Poettering 3b1e80f7cb process-util: turn off O_NONBLOCK on stdio fds when rearranging fds
We often create our fds O_NONBLOCK, but when we want to invoke some
program with them as stdin/stdout/stderr we really should turn it off
again.
2024-01-08 23:23:42 +01:00
Lennart Poettering b20e9dc515 env-util: add new setenvf() helper
And convert some pieces of code over.
2024-01-08 23:22:58 +01:00
Mike Yuan bdd2036e81 hexdecoct: make unbase64mem and unhexmem always use SIZE_MAX 2024-01-09 03:59:15 +09:00
Antonio Alvarez Feijoo 7f13af72f8 tmpfiles: fix memory leak in arg_exclude_prefixes
When using the `--image` or `-E` options, `arg_exclude_prefixes` is extended via
the `exclude_default_prefixes` function, which calls `strv_extend_strv`, adding
values using `strdup` that must be freed on exit.

Also changing `arg_include_prefixes` to use the same model, although there is no
leak here.
2024-01-08 19:08:42 +01:00
Lennart Poettering 4bcd606815 bus-polkit: fix memory leak
We need to destroy the hashmap entry keyed by the varlink object in case
this is a varlink request.

Follow-up for: d04c1a1c8e
2024-01-08 19:06:13 +01:00
Cristian Rodríguez aafaafb6f7 timesync: IPTOS_LOWDELAY --> IPTOS_DSCP_EF
Deprecated IPTOS_LOWDELAY is ignored by most of today's
network equipment that only ever care about DSCP.

Use the DSCP found in other NTP implementations and set the appropiate
TCLASS for IPv6.
2024-01-09 00:31:58 +09:00
Yu Watanabe e701439998 virt: fix detection of avx2 and friends
To get the CPUID with EAX=7, we need explicitly set 0 to ECX.

From Intel® Architecture Instruction Set Extensions Programming
Reference and Related Specifications,
===
Leaf 07H output depends on the initial value in ECX.
If ECX contains an invalid sub leaf index, EAX/EBX/ECX/EDX return 0
===

Fixes #30822.
2024-01-08 16:04:17 +01:00
Lennart Poettering c9f096969a
Merge pull request #30827 from poettering/network-generator-creds
network-generator: pick up .netdev/.link/.network configuration via c…
2024-01-08 15:02:02 +01:00
Lennart Poettering a0e66913c9
Merge pull request #30787 from poettering/hostnamed-cid
hostnamed: expose AF_VSOCK CID among hostnamed/hostnamectl info
2024-01-08 14:36:57 +01:00
Lennart Poettering 1a30285590 network-generator: pick up .netdev/.link/.network configuration via credentials
To me this is the last major basic functionality that couldn't be
configured via credentials: the network.

We do not invent any new format for this, but simply copy relevant creds
1:1 into /run/systemd/network/ to open up the full functionality of
networkd to VM hosts.
2024-01-08 12:59:08 +01:00
Lennart Poettering 19b8e712d8 hostnamed: expose local AF_VSOCK CID among other host info
This is a host identifier of major relevance, since it is how you
connect to this system if it is a VM, hence expose this nicely.
2024-01-08 10:30:41 +01:00
Lennart Poettering d3109d8de0 socket-util: add helper for querying the local AF_VSOCK CID 2024-01-08 10:26:34 +01:00