]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 weeks agoIntroduce several more helper functions to read sysfs attributes and use them where...
Yu Watanabe [Sun, 17 May 2026 22:26:44 +0000 (07:26 +0900)] 
Introduce several more helper functions to read sysfs attributes and use them where applicable (#41065)

Let's not use sd_device_get_sysattr_value() unless the result is
sanitized, escaped, or filtered.

4 weeks agoApply "ruff format" and "ruff check --fix" for all python scripts (#40758)
Yu Watanabe [Sun, 17 May 2026 22:26:11 +0000 (07:26 +0900)] 
Apply "ruff format" and "ruff check --fix" for all python scripts (#40758)

4 weeks agohwdb: Add keymap for Lenovo 15IRX9 (#42141)
RiskoZS [Sun, 17 May 2026 20:28:52 +0000 (16:28 -0400)] 
hwdb: Add keymap for Lenovo 15IRX9 (#42141)

This adds a mapping for the Fn+F9 key (used to launch Lenovo Vantage
on Windows) on the Lenovo LOQ 15IRX9 gaming laptop.

4 weeks agodhcp-client: clear overloaded sname/file fields after parsing
Luca Boccassi [Sun, 17 May 2026 17:22:20 +0000 (18:22 +0100)] 
dhcp-client: clear overloaded sname/file fields after parsing

When SD_DHCP_OPTION_OVERLOAD indicates that the sname and/or file header
fields are overloaded with extra DHCP options, dhcp_message_parse() merges
those options into message->options but leaves the raw bytes untouched in
the header. As a result, dhcp_message_build() emits the header (including
the overloaded bytes) verbatim, and the next parse re-parses those bytes,
appending duplicate entries to the options map (each tag's iov list grows).
Subsequent builds then differ from the first, breaking the parse/build
roundtrip.

This was caught by fuzz-dhcp-client, which asserts that two consecutive
build calls produce identical output.

Zero out the overloaded fields after parsing them, since their content has
already been merged into the options map. This makes the roundtrip
idempotent and avoids re-emitting stale overloaded data in the rebuilt
header. The JSON build/parse path was already correct (it omits sname/file
from the JSON when the overload bit is set), so only the binary path needed
fixing.

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

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
4 weeks agoudev-builtin-input-id: drop unused value 41065/head
Yu Watanabe [Thu, 12 Mar 2026 05:37:37 +0000 (14:37 +0900)] 
udev-builtin-input-id: drop unused value

4 weeks agotree-wide: use device_get_sysattr_unsigned() and friends
Yu Watanabe [Wed, 11 Mar 2026 22:07:12 +0000 (07:07 +0900)] 
tree-wide: use device_get_sysattr_unsigned() and friends

4 weeks agoudev-builtin-usb_id: make set_usb_iftype() and friends return const char*
Yu Watanabe [Sun, 17 May 2026 16:10:17 +0000 (01:10 +0900)] 
udev-builtin-usb_id: make set_usb_iftype() and friends return const char*

4 weeks agoudev-builtin-usb_id: use device_get_sysattr_unsigned() and friends
Yu Watanabe [Wed, 11 Mar 2026 22:06:00 +0000 (07:06 +0900)] 
udev-builtin-usb_id: use device_get_sysattr_unsigned() and friends

This also fix the parser of bInterfaceClass from safe_atoi() to
safe_atou_full() as it is unsigned hex.

4 weeks agosd-device: also add device_get_sysattr_streq()
Yu Watanabe [Thu, 12 Mar 2026 00:53:13 +0000 (09:53 +0900)] 
sd-device: also add device_get_sysattr_streq()

4 weeks agosd-device: also add device_get_sysattr_u8() and _u16()
Yu Watanabe [Thu, 12 Mar 2026 00:48:22 +0000 (09:48 +0900)] 
sd-device: also add device_get_sysattr_u8() and _u16()

4 weeks agosd-device: use macro to define device_get_sysattr_int() and friends
Yu Watanabe [Thu, 12 Mar 2026 00:26:29 +0000 (09:26 +0900)] 
sd-device: use macro to define device_get_sysattr_int() and friends

4 weeks agotest: add test cases for device_get_sysattr_int() and friends
Yu Watanabe [Thu, 12 Mar 2026 00:19:34 +0000 (09:19 +0900)] 
test: add test cases for device_get_sysattr_int() and friends

4 weeks agosd-device: rename argument names for storing result
Yu Watanabe [Thu, 12 Mar 2026 00:00:10 +0000 (09:00 +0900)] 
sd-device: rename argument names for storing result

When a function takes only one argument for storing result, the argument
is not necessary to be named as ret_xyz, but ret should be enough.

4 weeks agotree-wide: use device_get_sysattr_safe_string()
Yu Watanabe [Wed, 11 Mar 2026 22:00:06 +0000 (07:00 +0900)] 
tree-wide: use device_get_sysattr_safe_string()

The obtained strings are passed to another function, e,g, handled as a
path and opened, printed to the terminal, written to a file, saved to
udev database as udev property, exposed through DBus, passed to logger,
and so on. Hence, these should not contain any malicious characters.

4 weeks agoudev-builtin-net_id: quote strings in log messages
Yu Watanabe [Sun, 17 May 2026 15:52:29 +0000 (00:52 +0900)] 
udev-builtin-net_id: quote strings in log messages

4 weeks agoudev-builtin-net_id: use EINVAL when we get unexpected sysattr value
Yu Watanabe [Fri, 13 Mar 2026 20:40:14 +0000 (05:40 +0900)] 
udev-builtin-net_id: use EINVAL when we get unexpected sysattr value

The results are completely ignored or only checked if it is negative or
not. Hence, this does not change anything.

4 weeks agoudev: drop redundant checks
Yu Watanabe [Wed, 11 Mar 2026 22:16:46 +0000 (07:16 +0900)] 
udev: drop redundant checks

This partially reverts 16325b35fa6ecb25f66534a562583ce3b96d52f3,
as bad characters are already filtered.

4 weeks agoRevert "udev-builtin-net-id: print cescaped bad attributes"
Yu Watanabe [Wed, 11 Mar 2026 22:14:44 +0000 (07:14 +0900)] 
Revert "udev-builtin-net-id: print cescaped bad attributes"

This reverts commit 7c4047957ef58744ecfad6d277f7c45d430f6d70.

This is not necessary, as bad characters are already filtered.

4 weeks agoudev: use device_get_sysattr_safe_string() in device_get_sysattr_value_filtered()
Yu Watanabe [Wed, 11 Mar 2026 22:09:44 +0000 (07:09 +0900)] 
udev: use device_get_sysattr_safe_string() in device_get_sysattr_value_filtered()

Then, renamed to device_get_sysattr_safe_string_filtered().

4 weeks agosd-device: use device_get_sysattr_safe_string()
Yu Watanabe [Wed, 11 Mar 2026 20:44:51 +0000 (05:44 +0900)] 
sd-device: use device_get_sysattr_safe_string()

The read value are exposed by sd_device_get_subsystem() and friends.
Hence, it is better to filter invalid characters.
Of course, these should be always safe unless the kernel is buggy.
But, just for safety.

Note, even if uevent file contains invalid characters, then
device_read_uevent_file() should succeed without parsing the contents.
The caller should fail later with a proper error code if a necessary
field is unset. E.g. sd_device_get_ifindex() should still return -ENOENT
even when uevent file contains an invalid characters.

4 weeks agosd-device: introduce device_get_sysattr_safe_string()
Yu Watanabe [Wed, 11 Mar 2026 20:39:42 +0000 (05:39 +0900)] 
sd-device: introduce device_get_sysattr_safe_string()

This introduce a helper function that verifies read sysattr value.
Some sysattr value may come from firmware, and kernel may expose unsafe
string. The introduced function should be used when we use the result as
a string.

4 weeks agostring-util: introduce STRING_ALLOW_NEWLINES switch for string_is_safe()
Yu Watanabe [Sun, 17 May 2026 15:18:23 +0000 (00:18 +0900)] 
string-util: introduce STRING_ALLOW_NEWLINES switch for string_is_safe()

This also make StringSafeFlags defined in basic-forward.h so other
headers can use the enum.

4 weeks agoemacs: add settings for Python modes 40758/head
Jörg Behrmann [Tue, 24 Feb 2026 17:08:30 +0000 (18:08 +0100)] 
emacs: add settings for Python modes

Both python-mode and python-ts-mode are shipped by Emacs nowadays, with the
latter being the more modern tree-sitter-based one. Even though they are
similar, the newer one doesn't automatically take the older ones settings.

4 weeks agoci/linter: show diffs for ruff check when possible
Jörg Behrmann [Tue, 24 Feb 2026 17:03:54 +0000 (18:03 +0100)] 
ci/linter: show diffs for ruff check when possible

4 weeks agoci/linter: run ruff for all python scripts
Yu Watanabe [Thu, 19 Feb 2026 19:19:19 +0000 (04:19 +0900)] 
ci/linter: run ruff for all python scripts

4 weeks agoproxy-echo: apply "ruff check --fix"
Yu Watanabe [Sun, 17 May 2026 17:51:35 +0000 (02:51 +0900)] 
proxy-echo: apply "ruff check --fix"

4 weeks agofake-report-server: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Sun, 17 May 2026 17:49:29 +0000 (02:49 +0900)] 
fake-report-server: apply "ruff format" and "ruff check --fix"

4 weeks agofake-imds: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Sun, 17 May 2026 17:48:35 +0000 (02:48 +0900)] 
fake-imds: apply "ruff format" and "ruff check --fix"

4 weeks agomerge-bpf-compdb: apply "ruff format"
Yu Watanabe [Sun, 17 May 2026 17:47:09 +0000 (02:47 +0900)] 
merge-bpf-compdb: apply "ruff format"

4 weeks agoxml_helper: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:12:42 +0000 (02:12 +0900)] 
xml_helper: apply "ruff format"

4 weeks agoupdate-man-rules: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:12:28 +0000 (02:12 +0900)] 
update-man-rules: apply "ruff format"

4 weeks agoupdate-dbus-docs: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:12:16 +0000 (02:12 +0900)] 
update-dbus-docs: apply "ruff format" and "ruff check --fix"

4 weeks agosync-docs: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:12:00 +0000 (02:12 +0900)] 
sync-docs: apply "ruff format" and "ruff check --fix"

4 weeks agomeson-render-jinja2: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:11:46 +0000 (02:11 +0900)] 
meson-render-jinja2: apply "ruff format"

4 weeks agomeson-extract-unit-files: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:11:31 +0000 (02:11 +0900)] 
meson-extract-unit-files: apply "ruff format"

4 weeks agomake-man-index: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:11:19 +0000 (02:11 +0900)] 
make-man-index: apply "ruff format"

4 weeks agomake-directive-index: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:11:03 +0000 (02:11 +0900)] 
make-directive-index: apply "ruff format"

4 weeks agolist-discoverable-partitions: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:10:48 +0000 (02:10 +0900)] 
list-discoverable-partitions: apply "ruff format"

4 weeks agogenerate-gperfs: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:10:14 +0000 (02:10 +0900)] 
generate-gperfs: apply "ruff format"

4 weeks agogdb-sd_dump_hashmaps: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:10:00 +0000 (02:10 +0900)] 
gdb-sd_dump_hashmaps: apply "ruff format" and "ruff check --fix"

4 weeks agofind-unused-library-symbols: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:09:45 +0000 (02:09 +0900)] 
find-unused-library-symbols: apply "ruff format" and "ruff check --fix"

4 weeks agofetch-mkosi: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:09:19 +0000 (02:09 +0900)] 
fetch-mkosi: apply "ruff format" and "ruff check --fix"

This also makes CONFIG is closed when not necessary.

4 weeks agofetch-distro: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:09:04 +0000 (02:09 +0900)] 
fetch-distro: apply "ruff format"

4 weeks agoelf2efi: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:08:46 +0000 (02:08 +0900)] 
elf2efi: apply "ruff format" and "ruff check --fix"

4 weeks agodump-auxv: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:07:28 +0000 (02:07 +0900)] 
dump-auxv: apply "ruff format"

4 weeks agodbus-exporter: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:06:56 +0000 (02:06 +0900)] 
dbus-exporter: apply "ruff format" and "ruff check --fix"

4 weeks agocheck-version-history: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:04:33 +0000 (02:04 +0900)] 
check-version-history: apply "ruff format" and "ruff check --fix"

4 weeks agocheck-efi-alignment: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:04:20 +0000 (02:04 +0900)] 
check-efi-alignment: apply "ruff format"

4 weeks agocatalog-report: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:03:56 +0000 (02:03 +0900)] 
catalog-report: apply "ruff format"

4 weeks agoanalyze-dump-sort: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:03:44 +0000 (02:03 +0900)] 
analyze-dump-sort: apply "ruff format"

4 weeks agoTEST-69-SHUTDOWN: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:03:17 +0000 (02:03 +0900)] 
TEST-69-SHUTDOWN: apply "ruff format"

4 weeks agotest-udev: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:02:48 +0000 (02:02 +0900)] 
test-udev: apply "ruff format" and "ruff check --fix"

4 weeks agotest-tmpfiles: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:02:36 +0000 (02:02 +0900)] 
test-tmpfiles: apply "ruff format" and "ruff check --fix"

This also dropped unnecessary existence check for subprocess.run.

4 weeks agotest-shutdown: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:02:20 +0000 (02:02 +0900)] 
test-shutdown: apply "ruff format"

4 weeks agotest-network: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:02:04 +0000 (02:02 +0900)] 
test-network: apply "ruff format" and "ruff check --fix"

4 weeks agotest-network: drop old ip command support
Yu Watanabe [Sat, 21 Feb 2026 20:25:49 +0000 (05:25 +0900)] 
test-network: drop old ip command support

4 weeks agotest-network: assume the test is running with newer udevd
Yu Watanabe [Sat, 21 Feb 2026 20:15:44 +0000 (05:15 +0900)] 
test-network: assume the test is running with newer udevd

4 weeks agotest-network: drop old kernel support and workaround for fixed kernel bug
Yu Watanabe [Fri, 20 Feb 2026 19:40:36 +0000 (04:40 +0900)] 
test-network: drop old kernel support and workaround for fixed kernel bug

- l3mdev in fib rules is supported since
https://github.com/torvalds/linux/commit/96c63fa7393d0a346acfe5a91e0c7d4c7782641b (v4.8).
- uid range in fib rules is supported since
https://github.com/torvalds/linux/commit/622ec2c9d52405973c9f1ca5116eb1c393adfc7d (v4.10).
- port range and ip proto in fib rules is supported since
https://github.com/torvalds/linux/commit/bfff4862653bb96001ab57c1edd6d03f48e5f035 (v4.17).
- interface alternative name is supported since
https://github.com/torvalds/linux/commit/36fbf1e52bd3ff8a5cb604955eedfc9350c2e6cc (v5.5).
- SRIOV on netdevsim is supported since
https://github.com/torvalds/linux/commit/79579220566cd33fe3b15ce8249c57e10251b258 (4.16).
- nexthop is supported since
https://github.com/torvalds/linux/commit/65ee00a9409f751188a8cdc0988167858eb4a536 (v5.3).
- bridge MDB entries on bridge master is supported since
https://github.com/torvalds/linux/commit/1bc844ee0faa1b92e3ede00bdd948021c78d7088 (v5.4).

4 weeks agosys-script: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Wed, 25 Feb 2026 15:40:08 +0000 (00:40 +0900)] 
sys-script: apply "ruff format" and "ruff check --fix"

4 weeks agosd-script: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:00:40 +0000 (02:00 +0900)] 
sd-script: apply "ruff format" and "ruff check --fix"

4 weeks agorun-unit-tests: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 17:00:21 +0000 (02:00 +0900)] 
run-unit-tests: apply "ruff format"

4 weeks agorule-syntax-check: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 16:59:51 +0000 (01:59 +0900)] 
rule-syntax-check: apply "ruff format" and "ruff check --fix"

4 weeks agonetworkd-test: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 16:59:13 +0000 (01:59 +0900)] 
networkd-test: apply "ruff format" and "ruff check --fix"

4 weeks agoTEST-04-JOURNAL: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 16:58:16 +0000 (01:58 +0900)] 
TEST-04-JOURNAL: apply "ruff format"

4 weeks agogenerate-directives: apply "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:42:27 +0000 (02:42 +0900)] 
generate-directives: apply "ruff check --fix"

4 weeks agocreate-sys-script: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 16:57:35 +0000 (01:57 +0900)] 
create-sys-script: apply "ruff format" and "ruff check --fix"

4 weeks agotest_ukify: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 16:56:52 +0000 (01:56 +0900)] 
test_ukify: apply "ruff format"

Also drops unnecessary noqa attribute for importing pefile.

4 weeks agogenerate-syscall-list: apply "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 17:35:03 +0000 (02:35 +0900)] 
generate-syscall-list: apply "ruff check --fix"

4 weeks agogenerate-dns_type: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 16:56:07 +0000 (01:56 +0900)] 
generate-dns_type: apply "ruff format" and "ruff check --fix"

4 weeks agoethtool-link-mode: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 16:55:31 +0000 (01:55 +0900)] 
ethtool-link-mode: apply "ruff format"

4 weeks agolog-generator: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 16:54:49 +0000 (01:54 +0900)] 
log-generator: apply "ruff format" and "ruff check --fix"

4 weeks agogenerate-syscall: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 16:54:24 +0000 (01:54 +0900)] 
generate-syscall: apply "ruff format" and "ruff check --fix"

Also, this makes opened files closed when not necessary.

4 weeks agofuzz-bootspec: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 16:53:29 +0000 (01:53 +0900)] 
fuzz-bootspec: apply "ruff format"

This also replaces open().read() with Path().read_text().

Co-authored-by: Jörg Behrmann <behrmann@physik.fu-berlin.de>
4 weeks agofilesystem-sets: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 16:52:37 +0000 (01:52 +0900)] 
filesystem-sets: apply "ruff format" and "ruff check --fix"

4 weeks agoman/notify-example: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 16:50:59 +0000 (01:50 +0900)] 
man/notify-example: apply "ruff format"

4 weeks agoman/check-os-release: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 16:50:19 +0000 (01:50 +0900)] 
man/check-os-release: apply "ruff format"

4 weeks agoman/check-os-release-simple: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 16:49:47 +0000 (01:49 +0900)] 
man/check-os-release-simple: apply "ruff format"

4 weeks agoman/90-rearrange-path: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 16:48:59 +0000 (01:48 +0900)] 
man/90-rearrange-path: apply "ruff format" and "ruff check --fix"

4 weeks agohwdb/parse_hwdb: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 16:48:13 +0000 (01:48 +0900)] 
hwdb/parse_hwdb: apply "ruff format" and "ruff check --fix"

4 weeks agohwdb/ids_parser: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Fri, 20 Feb 2026 18:29:00 +0000 (03:29 +0900)] 
hwdb/ids_parser: apply "ruff format" and "ruff check --fix"

4 weeks agohwdb/acpi-update: apply "ruff format"
Yu Watanabe [Thu, 19 Feb 2026 16:47:18 +0000 (01:47 +0900)] 
hwdb/acpi-update: apply "ruff format"

4 weeks agoycm: apply "ruff format" and "ruff check --fix"
Yu Watanabe [Thu, 19 Feb 2026 16:43:03 +0000 (01:43 +0900)] 
ycm: apply "ruff format" and "ruff check --fix"

4 weeks agoruff: do not warn about too long line and lambda assignment
Yu Watanabe [Sat, 21 Feb 2026 19:36:23 +0000 (04:36 +0900)] 
ruff: do not warn about too long line and lambda assignment

4 weeks agoruff: use single quotes for multiline strings
Yu Watanabe [Fri, 20 Feb 2026 21:14:53 +0000 (06:14 +0900)] 
ruff: use single quotes for multiline strings

4 weeks agosd-device: use string_is_safe() at one more place
Yu Watanabe [Sun, 17 May 2026 16:17:42 +0000 (01:17 +0900)] 
sd-device: use string_is_safe() at one more place

4 weeks agosd-device: logs about refused property
Yu Watanabe [Wed, 11 Mar 2026 20:19:25 +0000 (05:19 +0900)] 
sd-device: logs about refused property

Follow-up for a62cd5a153ffe18c27aff02685ed75c5bc4509a2.

4 weeks agonetworkctl: introduce 'dhcp-lease' command to dump acquired DHCP lease (#42137)
Yu Watanabe [Sun, 17 May 2026 16:28:11 +0000 (01:28 +0900)] 
networkctl: introduce 'dhcp-lease' command to dump acquired DHCP lease (#42137)

4 weeks agosd-dhcp-client: use dhcp_message_send_{udp,raw}() and update BPF code (#42138)
Yu Watanabe [Sun, 17 May 2026 16:26:55 +0000 (01:26 +0900)] 
sd-dhcp-client: use dhcp_message_send_{udp,raw}() and update BPF code (#42138)

4 weeks agosd-dhcp-client: drop unused data in sd_dhcp_client 42138/head
Yu Watanabe [Sun, 3 May 2026 05:50:13 +0000 (14:50 +0900)] 
sd-dhcp-client: drop unused data in sd_dhcp_client

With the previous commit, now sd_dhcp_client.link is not used anymore.
Let's drop it.

4 weeks agodhcp-client-send: move/update BPF code and socket initialization from dhcp-network.c
Yu Watanabe [Sat, 2 May 2026 18:24:41 +0000 (03:24 +0900)] 
dhcp-client-send: move/update BPF code and socket initialization from dhcp-network.c

- BPF code now supports the case when IP header has IP packet options,
- also set socket priority to UDP socket.

Co-developed-by: Google Gemini Pro
4 weeks agodhcp-client-send: use dhcp_message_send_{udp,raw}()
Yu Watanabe [Mon, 4 May 2026 07:19:17 +0000 (16:19 +0900)] 
dhcp-client-send: use dhcp_message_send_{udp,raw}()

4 weeks agoNEWS: mention new 'networkctl dhcp-lease' command 42137/head
Yu Watanabe [Sun, 17 May 2026 12:03:39 +0000 (21:03 +0900)] 
NEWS: mention new 'networkctl dhcp-lease' command

4 weeks agonetworkctl: add dhcp-lease verb to dump DHCP lease
Yu Watanabe [Thu, 16 Apr 2026 17:58:52 +0000 (02:58 +0900)] 
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
```

4 weeks agodhcp: cleanups for sd-dhcp-lease.c and rewrite test-dhcp-client (#42135)
Yu Watanabe [Sun, 17 May 2026 11:12:37 +0000 (20:12 +0900)] 
dhcp: cleanups for sd-dhcp-lease.c and rewrite test-dhcp-client (#42135)

4 weeks agodhcp-message-dump: introduce dump_dhcp_message()
Yu Watanabe [Fri, 17 Apr 2026 19:31:37 +0000 (04:31 +0900)] 
dhcp-message-dump: introduce dump_dhcp_message()

It dumps DHCP messages in a human friendly format.
It will be used in networkctl in a later commit.

4 weeks agoci/alpine: do not install util-linux-login
Yu Watanabe [Sat, 16 May 2026 18:20:45 +0000 (03:20 +0900)] 
ci/alpine: do not install util-linux-login

For some reasons, after util-linux is bumped from 2.41.4-r0 to 2.42-r0,
the 'su' command from util-linux-login seems to not correctly run commands in
https://github.com/jirutka/setup-alpine/blob/v1.4.1/alpine.sh
and causes the following spurious failure:
```
2026-05-15T21:19:15.6539432Z ##[group]Set up user runner
2026-05-15T21:19:15.6981963Z /bin/sh: line 0: ��: not found
2026-05-15T21:19:15.6982503Z /bin/sh: line 1: ␡ELF␂␁␁␃: not found
2026-05-15T21:19:15.6985788Z /bin/sh: line 10: ␒␐␆␒B␈␒�␄␒y␄␒�␁␒␞␇␒:␁␒�␃␒�␄␒@␁␒9␈␒?␆␒␚␈␒x: not found
2026-05-15T21:19:15.7010731Z /bin/sh: line 33: can't open ␂␒-␂␒�: no such file
2026-05-15T21:19:15.7016026Z /bin/sh: line 33: syntax error: unexpected word (expecting ")")
2026-05-15T21:19:15.7049583Z
2026-05-15T21:19:15.7050199Z ␛[1;31mError occurred at line 338:␛[0m
2026-05-15T21:19:15.7050830Z   335 |  echo 'permit nopass keepenv $SUDO_USER' | tee /etc/doas.d/root.conf
2026-05-15T21:19:15.7051287Z   336 |  fi
2026-05-15T21:19:15.7051549Z   337 | SHELL
2026-05-15T21:19:15.7052039Z ␛[1;31m> 338 | abin/"$INPUT_SHELL_NAME" --root /.setup.sh␛[0m
2026-05-15T21:19:15.7052506Z   339 |
2026-05-15T21:19:15.7052796Z   340 | rm .setup.sh
2026-05-15T21:19:15.7053172Z   341 | endgroup
2026-05-15T21:19:15.7096322Z ##[error]Error occurred at line 338: abin/"$INPUT_SHELL_NAME" --root /.setup.sh (see the job log for more information)
2026-05-15T21:19:15.7101400Z ##[error]Process completed with exit code 1.
```
Let's not install the package. It seems no command provided by the
package is used.

4 weeks agofuzz-dhcp-client: externally set socket fd, rather than override functions 42135/head
Yu Watanabe [Wed, 15 Apr 2026 19:43:12 +0000 (04:43 +0900)] 
fuzz-dhcp-client: externally set socket fd, rather than override functions

4 weeks agotest-dhcp-client: add test cases for discover attempt counter
Yu Watanabe [Wed, 15 Apr 2026 23:39:56 +0000 (08:39 +0900)] 
test-dhcp-client: add test cases for discover attempt counter

4 weeks agotest-dhcp-client: add test cases for IPv6-only mode
Yu Watanabe [Tue, 14 Apr 2026 18:57:10 +0000 (03:57 +0900)] 
test-dhcp-client: add test cases for IPv6-only mode

4 weeks agotest-dhcp-client: add test case for BOOTP client mode
Yu Watanabe [Mon, 27 Apr 2026 05:39:26 +0000 (14:39 +0900)] 
test-dhcp-client: add test case for BOOTP client mode