Commit Graph
478 Commits
Author SHA1 Message Date
Yu Watanabe 0965c5d719 catalog-report: apply "ruff format" 2026-05-18 02:44:46 +09:00
Yu Watanabe ce9b618e46 analyze-dump-sort: apply "ruff format" 2026-05-18 02:44:46 +09:00
Yu Watanabe 6cbf8222ca networkctl: add dhcp-lease verb to dump DHCP lease
This shows the DHCP message of an acquired DHCP lease.
Example:
```
$ networkctl dhcp-lease eth0
Header:
              KEY VALUE
   Hardware Type: ETHER
Hardware Address: 41:42:43:31:32:33
  Client Address: 192.0.2.123
  Server Address: 192.0.2.1

Options:
CODE NAME               DATA
   1 subnet mask        255.255.255.0
   3 router             192.0.2.1
   6 domain name server 192.0.2.1
  12 hostname           test-node
  15 domain name        lan
  28 broadcast address  192.0.2.255
  42 NTP server         192.0.2.11
                        192.0.2.12
  51 lease time         1d
  53 message type       5
  54 server identifier  192.0.2.1
  58 renewal time       11h 5min 38s
  59 rebinding time     20h 5min 38s
 119 domain search      hoge.example.com
                        foo.example.com
```
2026-05-17 21:02:20 +09:00
Michael Vogt 3c6a713836 tools: run check-coccinelle.sh with (updated) parsing_hacks.h
This commit runs the check-coccinelle checker scripts with the
parsing_hacks.h. Because this was missing before there were some
issues that did not get flagged.

While at it it also adds some missing cleanup attributes and
iterators to get better results. Its a bit sad that there is no
(easy/obvious) way to detect when new things are needed for
parsing_hacks.h
2026-04-11 21:15:12 +02:00
Michael Vogt 777d9c10ad coccinelle: add checks for pointer access without NULL check
The fix in 8f1751a111 made me wonder if we could automatically detect
when pointers are accessed but when this might not be safe. Systemd
is already using a lot of `assert(dst)` and this change now forces
us to use them.

So this commit (ab)uses coccinelle to flag any pointer parameter
dereference not preceded by assert(param), ASSERT_PTR(param), or an
explicit NULL check. It adds integration into meson as a new "coccinelle"
test suite (just like clang-tidy) and is run in CI. The check is not
perfect but seems a reasonable heuristic.

For this RFC commit it is scoped to a subset, it excludes 25 dirs right
now and includes around 100. About 300 warnings left. Busywork that I am
happy to do if there is agreement that it is worth it.

With this in place we would have caught the bug from 8f1751a111 in CI:
```
FAIL: check-pointer-deref.cocci found issues in systemd/src/boot:
diff -u -p systemd/src/boot/measure.c /tmp/nothing/measure.c
--- systemd/src/boot/measure.c
+++ /tmp/nothing/measure.c
@@ -312,7 +312,6 @@ EFI_STATUS tpm_log_tagged_event(
         if (err != EFI_SUCCESS)
                 return err;

-        *ret_measured = true;
         return EFI_SUCCESS;
 }
```

This also adds a new POINTER_MAY_BE_NULL() for the cases when the
called function will do the NULL check (like `iovec_is_set()`).
2026-03-26 18:13:17 +01:00
Daan De Meyer 59a83c37bf ci: Simplify musl build setup
No need to setup symlink farms, we can just use the host's /usr/include
now.
2026-02-19 20:04:06 +01:00
Zbigniew Jędrzejewski-Szmek a6b328fd95 elf2efi: modernize typing annotations
We still need Union and Optional as long as compat with Python 3.9
is needed.
2026-02-19 15:34:10 +01:00
Zbigniew Jędrzejewski-Szmek 3c7bb0c37b elf2efi: make mypy-clean 2026-02-19 15:34:10 +01:00
Zbigniew Jędrzejewski-Szmek 528a939c89 elf2efi: import whole module, not individual symbols
When reading the code, it was hard to figure out if the given name was
imported or a local class. And the renaming of imports also made it
harder to look things up online. Arguably, the deeply nested import
structure and inconsistent naming in elftools is partially to blame:
there is just no good way to make this look nice. But anyway, let's use
the usual style of importing the module and using names prefixed with
the module path so that the origin of imported names is clear.

elfutils.elf.elffile is importered separately, because a) it needs to be
imported separately anyway bxecause the module does lazy imports
internally, a) the name already indicates the origin, c) is used in
quite a few places so the shorter name is nice.
2026-02-19 15:34:10 +01:00
Yu Watanabe 08719d0e78 Revert "tools: make update-dbus-docs compatible with Python 3.7"
This reverts commit 668b3a42fe.

Now we require Python 3.9 or newer.
2026-02-18 18:47:15 +09:00
Oleksandr AndrushchenkoandYu Watanabe f8a4c3d375 network: add ModemManager support
[Match]
Name=wwan*

[Network]
LLDP=no
LinkLocalAddressing=no
IPv6AcceptRA=no

[ModemManager]
SimpleConnectPropertie]s=apn=internet ip-type=ipv4 allow-roaming=no pin=1111 operator-id=25503
RouteMetric=200
UseGateway=yes

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2026-02-16 13:22:21 +09:00
Daan De Meyer 5ae7db99bf tools: Fix changelog generation (again)
Using --first-parent --no-merges seems to exclude not just the merge
commits but all the commits from the merge as well. Let's use only
--no-merges to get just the commits without merges.
2026-02-14 16:04:55 +01:00
Lennart Poettering e2f23b6deb man: document new varlinkctl feature 2026-02-09 10:54:18 +01:00
Daan De Meyer 7bb0bd400f fetch-mkosi: Shorten commit message title
Currently github truncates the message so let's make it a little shorter
so it's not truncated.
2026-02-05 10:53:09 +01:00
Yu Watanabe 966c29ae59 tools: add script that checks external links in docs
Generated by GitHub Copilot, and manually adjusted.
2026-01-31 01:11:05 +09:00
Yu Watanabe 2553c53730 tools: drop unnecessary sys/capability.h header
After 9b414a38fa (#39425), the header is
not required. And after b295c166f9, the
header is not installed in CI environments.
2026-01-02 08:46:05 +01:00
Yu Watanabe 6d2c9c2203 tools: show each command to make it easier to debug 2026-01-02 08:46:05 +01:00
Yu Watanabe fe3c790f71 tools: allow to run setup-musl-build.sh for already set up directory 2026-01-02 08:46:05 +01:00
Luca Boccassi 9463b3b51c man: document version for BindNetworkInterface instead of using ignore list
The ignore list is for older stuff, all new interfaces must be documented
with a version.

Follow-up for c1c787651b
2025-12-24 19:25:21 +01:00
Luiz Amaral c1c787651b Add support for binding a unit to a network iface 2025-12-24 07:37:58 +01:00
Luca Boccassi 2791af18e4 tools: use -f in mkosi summary in fetch-distro.py
$ ./tools/fetch-distro.py -u fedora
+ mkosi --json -d fedora summary
‣ Ignoring --distribution from the CLI. Run with -f to rebuild the image with this setting

Follow-up for 35f6e5c327
2025-12-19 11:35:21 +00:00
q66 3d64cb9a54 vcs-tag.sh: use portable sed argument order 2025-12-08 21:35:28 +01:00
Yu Watanabe 929ce35f8d meson: rework include_directories() and finding of tools (#39956)
This is a cleanup in preparation for later additions.
2025-12-02 20:07:37 +09:00
Zbigniew Jędrzejewski-Szmek 322f6adbcd meson: add tools/meson.build
Previously, we looked for scripts in the tools/ directory ad hoc,
wherever they were needed. Let's do those checks in one place.
The main meson.build file is shrunk somewhat, which is always nice.
2025-12-01 16:18:11 +01:00
Daan De Meyer fb514c2f8f mkosi: Rework how the pkgenv environment variables are set
Instead of including distribution specific files in the subimages,
let's have one common mkosi.pkgenv/ directory that handles all the
matching which is then included in the subimages.

This gives us more control on exactly how we do the matching.
2025-11-25 11:02:34 +01:00
Daan De Meyer 7336f2c748 meson: Still build libshared even if libmount is disabled
Currently, if the libmount feature is disabled, we don't build
libshared and as a result skip building every other executable as
well. Among other things, this makes our nodeps CI builds kind of
pointless since hardly any code will be compiled.

Let's improve on the situation by making libmount properly optional
in libshared. Then, we only skip building the executables that
actually need libmount.
2025-11-24 13:09:41 +01:00
Daan De Meyer 3f0fc93219 tools: Add script to detect unused symbols in libshared
Symbols exported by libshared can't get pruned by the linker, so
every unused exported symbol is effectively dead code we ship to users
for no good reason. Let's add a script to analyze how many such symbols
we have.

We also add a meson test to run the script on all of our binaries.
Since it detects unused symbols and still has a few false positives,
don't enable the test by default similar to the clang-tidy tests.

The script was 100% vibe coded by Github Copilot with Claude Sonnet 4.5
as the model.

Current results are (without the unused symbols list):

Analysis of libsystemd-shared-259.so
======================================================================
Total exported symbols: 4830
  (excluding public API symbols starting with 'sd_')
Used symbols: 4672
Unused symbols: 158
Usage rate: 96.7%
2025-11-19 13:14:15 +01:00
Zbigniew Jędrzejewski-Szmek 31d3b96293 musl: split out script to setup build
This makes it easier to set up a local build with musl:
$ tools/setup-musl-build.sh build-meson
$ ninja -C build-meson
2025-11-17 17:02:23 +01:00
Masanari Iida 036100d745 systemd-logind: Add signal section in man systemd-logind
This patch adds signal setion in man systemd-logind
2025-11-12 08:45:55 +09:00
Yu WatanabeandEvgeny Vereshchagin a736d4ec9c oss-fuzz: install libcrypt-dev in i386 image
This is preparation for bumping base image of oss-fuzz to Ubuntu 24.04.

Closes #39395.

Co-authored-by: Evgeny Vereshchagin <evvers@ya.ru>
2025-11-10 10:45:42 +09:00
Yu Watanabe 9b414a38fa tree-wide: drop unused libcap dependencies 2025-10-24 01:52:59 +09:00
Zbigniew Jędrzejewski-Szmek 675bfef837 Stop specifying license for generated file, instead mark as generated
I exclude generated files from license check, and I noticed
that this file was marked with a license header, which doesn't
make much sense, it is not copyrightable.
2025-10-04 18:13:27 +02:00
Jörg Behrmann 1dcbb0b4ca tools: ignore root element explicitly in check-version-history
Currently these messages (broken for length)

    2025-08-20T12:04:15.9609277Z
    /home/runner/work/systemd/systemd/tools/check-version-history.py:26:
    FutureWarning: This search incorrectly ignores the root element, and will be fixed in a future version.
    If you rely on the current behaviour, change it to './/funcprototype/funcdef/function'

can be seen in CI output. So let's apply the suggestion.
2025-08-25 14:38:00 +02:00
Jörg Behrmann 09a89190bb man: add note about extending machine-info to man page 2025-08-25 14:38:00 +02:00
Zbigniew Jędrzejewski-Szmek 8aedfd979f tools: make all .py program files executable
All those files are standalone programs that can be executed directly.
Some .py files were marked executable, others weren't, probably accidentally.
Mark them all as executable in preparation for subsequent changes.
2025-07-25 12:33:13 +02:00
Zbigniew Jędrzejewski-Szmek 0bf9bbecae tools: consistently use #!/usr/bin/env python3
It's ugly, but it's better to be consistently ugly.
2025-07-25 12:33:13 +02:00
Luca Boccassi 6235121abf netdev-util: allow setting local address based on dhcp-pd addresses as well (#38211)
This extends the functionality introduced in #21648 to allow using
addresses chosen from a delegated prefix as well as the existing
SLAAC/LL/DHCP functionality.
2025-07-17 14:14:49 +01:00
Sam James e65455fead elf2efi: ignore .sframe
SFrames are a new format for stack unwinding information. Ignore it if
preset as is done for .eh_frame.
2025-07-16 14:57:30 +02:00
Linus Heckemann 8a7a33ab1e vcs-tag.sh: use more compatible shebang 2025-07-14 13:56:07 +02:00
Yu Watanabe e58ba80a40 units: drop runlevel[0-6].target 2025-07-13 05:49:09 +09:00
Yu Watanabe 8ba48d4bf8 core,initctl,systemctl: kill /dev/initctl support
This also kills support for controlling system state through
/sbin/init, initctl, and telinit.
2025-07-13 05:38:14 +09:00
Yu Watanabe af925f7eb3 systemctl: kill SysV compat 'runlevel' command 2025-07-13 05:38:13 +09:00
Yu Watanabe 2b912d2066 tree-wide: several cleanups for generating symbol lists and gperf files
- pass our system include directories to make generators use our libc
  wrappers and latest kernel headers,
- include relevant headers in generated gperf file,
- use files() rather than find_program(), as the result of
  find_program() cannot be passed to 'input' of custom_target(),
- move generate-bpf-delegate-configs.py to src/core/, as it is only used
  by libcore.
2025-07-11 13:05:42 +09:00
Matteo Croce ea9826eb94 core: add options to delegate BPFFS token creation
Add four new options BPFDelegate{Commands,Maps,Programs,Attachments}=
in order to delegate to a BPFFS instance the permission to create tokens.

The value is a list of options taken from:
https://github.com/torvalds/linux/blob/v6.14/include/uapi/linux/bpf.h#L922-L1121
The special value "any" means to allow every possible values.

More informations about BPF tokens here:
https://lwn.net/Articles/947173/
2025-07-08 22:35:29 +02:00
Lennart Poettering 7478fbb0af core: fixes for RandomizedOffsetSec= feature (#37981)
Fixes: #37870
Follow-up for: #36437
2025-06-26 22:58:22 +02:00
Lennart Poettering 99fd08224f man: add proper version info for RandomizedOffsetUSec
Follow-up for: #36437
Fixes: #37870
2025-06-26 17:28:49 +02:00
Daan De Meyer 1095865d26 tools: Fix fetch-mkosi changelog generation 2025-06-26 13:28:15 +02:00
Lennart Poettering 279962a9e8 core/timer: Introduce RandomOffsetSec= knob (#36437)
This is like RandomDelaySec, but it doesn't reset whenever the manager
restarts.

Fixes https://github.com/systemd/systemd/issues/21166
2025-06-17 16:05:12 +02:00
Daan De Meyer d1ee3889cf meson: Add libmount feature
Let's reduce the dependencies required to build just libsystemd by
making libmount optional. The meson disabler feature makes this quite
trivial.
2025-06-05 14:51:03 +02:00
Yu Watanabe 0436240dd2 udevadm: allow to specify device by device ID (#37636) 2025-06-02 18:02:36 +09:00