Commit Graph
100 Commits
Author SHA1 Message Date
Yu Watanabe 8e91738fe9 libsystemd-network: do not trigger assertion by sd_*_is_running() with NULL
If systemd is built with developer mode, previously they trigger
hard assertions. Even built with release mode, we should not log about
that. Let's silently accept NULL and return false.

Prompted by https://github.com/systemd/systemd/pull/32166#issuecomment-2044710151.
2024-04-10 22:53:55 +01:00
Yu Watanabe cd226becd8 Merge pull request #32189 from mrc0mmand/test-tweaks
Another batch of assorted test tweaks
2024-04-10 16:57:00 +09:00
Yu Watanabe f8e15d6d98 Merge pull request #32191 from yuwata/network-persistent-storage-follow-ups
network: follow-ups for persistent storage
2024-04-10 16:54:39 +09:00
Yu Watanabe a0430b0d95 test-network: add test case for ndisc MTU option 2024-04-10 12:24:33 +09:00
Yu Watanabe 8c9ef90b19 network/ndisc: set IPv6 MTU through sysctl
Closes #31496.
2024-04-10 12:22:43 +09:00
Yu Watanabe fb71748e4f network/sysctl: round IPv6 MTU with the current device MTU rather than the maximum MTU
Otherwise, writing IPv6 MTU may fail.

This also makes link_set_ipv6_mtu() take log level about rounding IPv6 MTU,
and downgrade the log level from LOG_WARNING -> LOG_INFO, as we usually
use LOG_WARNING for per-interface critical failure.
2024-04-10 12:15:33 +09:00
Yu Watanabe eb426caae7 network: always set IPv6 MTU when we detect the device MTU is changed
Then, we can keep the IPv6 MTU even if the device MTU is changed by an
external tool, e.g. 'ip link set' command.
2024-04-10 12:15:33 +09:00
Yu Watanabe d4386dd1c8 network/setlink: adjust requested MTU when it is ready to set
This should not change any effective behavior.
Just for safety, and making the logic consistent with others, e.g.
setting master ifindex.
2024-04-10 12:15:33 +09:00
Yu Watanabe 11a150bc43 po: update Japanese translation 2024-04-10 07:07:34 +09:00
Yu Watanabe 4d97f7deeb network/varlink: fix error cause
Follow-up for e1254d0616.

Addresses https://github.com/systemd/systemd/pull/31811#discussion_r1557552244.
2024-04-10 04:59:43 +09:00
Yu Watanabe fb6f98ae63 network: open persistent directory without O_PATH
Addresses https://github.com/systemd/systemd/pull/31811#discussion_r1557549629.
2024-04-10 04:59:43 +09:00
Yu Watanabe ce4ed0ad99 test-network: add test case for regenerating prefix stable address on conflict
For issue #31605.
2024-04-10 04:36:03 +09:00
Yu Watanabe e14679ff76 network/address-generation: regenerate IPv6 prefix stable address on conflict
If a generated address with IPv6Token=prefixstable conflicts with the
one on another node or interface, let's generate another address and try
to assign it.

This improves support of RFC 7217.

Fixes #31605.
2024-04-10 04:36:03 +09:00
Yu Watanabe d4dae4c243 network/dhcp6: return earlier if no lease acquired
Previously, even If an interface has not acquired a DHCPv6 lease,
networkd logs a misleading message:
===
Apr 09 10:44:57 systemd-networkd[3970750]: veth99: DHCPv6 lease lost
===
The function should do nothing when no lease acquired. Let's return
earlier and suppress the log message.
2024-04-09 09:39:36 +02:00
Yu Watanabe 0ac03e004c network/address-generation: make generate_stable_private_address() optionally take the previously generated address
Currently, the argument is not used yet. The new argument will be used later
for regenerating prefix stable address on conflict.
2024-04-09 12:06:32 +09:00
Yu Watanabe e700e48257 network/address-generation: also provide used tokens when generating address
Then, assign the token to the corresponding Address object.
2024-04-09 12:06:32 +09:00
Yu Watanabe e39bb29100 network/address: make Address object optionally take reference to IPv6Token
Currently, the element is unused. Preparation for later commits.
2024-04-09 12:06:32 +09:00
Yu Watanabe ffafb56125 network/address-generation: expose IPv6Token and introduce new/ref/unref functions for the type
No functional change. Preparation for later commits.
2024-04-09 12:06:32 +09:00
Yu Watanabe 43d184682d network/ndisc: allow to call ndisc_request_address() without sd_ndisc_router object
Preparation for later commits.
2024-04-09 12:06:32 +09:00
Yu Watanabe b03565bc17 network/dhcp-pd: split out dhcp_pd_request_address_one()
No functional change. Preparation for later commit.
2024-04-09 12:06:32 +09:00
Yu Watanabe c848a0eef6 Merge pull request #31997 from yuwata/network-ndisc-zero-lifetime
network: fixlets for zero lifetime
2024-04-09 07:52:28 +09:00
Yu Watanabe 6952ebae3b tree-wide: drop several remaining license headers
And downgrade the license of utf8.c to LGPL-2.0-or-later, to follow the
original license.
2024-04-08 10:14:50 +02:00
Yu Watanabe caaf95985f mountfsd: fix typo
Follow-up for 702a52f4b5.
2024-04-08 09:22:06 +09:00
Yu Watanabe 1ea9151e6c nsresourced: fix typo
Follow-up for 8aee931e7a.
2024-04-08 09:20:20 +09:00
Yu Watanabe a1952a5c79 dissect: fix typo
Follow-up for 9444e54e56.
2024-04-08 09:17:53 +09:00
Yu Watanabe 693a28d748 nspawn: fix typo
Follow-up for 0af7e29434.
2024-04-08 09:12:08 +09:00
Yu Watanabe 9dcdf16b25 test-network: add test cases for Redirect and Neighbor Advertisement message handling 2024-04-05 06:22:42 +09:00
Yu Watanabe 447fe37ee3 test: introduce a test executable to send NDisc message 2024-04-05 06:22:19 +09:00
Yu Watanabe 6df0059441 network/ndisc: add basic support for Redirect message
Closes #31438.
2024-04-05 05:57:54 +09:00
Yu Watanabe 44e8cf303b sd-ndisc: add basic support of Redirect message
This makes sd-ndisc support Redirect message defined in RFC 4861.
2024-04-05 05:57:14 +09:00
Yu Watanabe b03d7291d5 network/ndisc: remember the latest RA from the default router
The remembered RA will be used later. Preparation for later commits.
2024-04-05 05:55:06 +09:00
Yu Watanabe 36ca167220 Merge pull request #31373 from yuwata/network-neighbor-advertisement
network: add basic support of neighbor advertisement
2024-04-05 05:54:12 +09:00
Yu Watanabe e17e438ede udevadm-test: also show security labels if specified
Follow-up for 03b6879f4d.
2024-04-04 21:30:26 +01:00
Yu Watanabe 9990552f9a backlight: fix detection of multiple graphic cards
Follow-up for e0504dd011.

Hopefully, devices in PCI subsystem have some properties, thus have
their udev database file. But, that may not be true. Here, we only read
sysattrs of enumerated devices, hence it is not necessary to check if
the device is initialized or not.
2024-04-04 21:29:57 +01:00
Yu Watanabe f7cb6801a2 udev: do not update sysattr and sysctl value on testing
Follow-up for 089bef6631.
2024-04-04 21:29:30 +01:00
Yu Watanabe 6a363a838a udevadm-test: insert missing line break
Addresses post-merge comment:
https://github.com/systemd/systemd/commit/03b6879f4d45c49264708aef872fd05af30ddcf0#r140587790
2024-04-04 20:10:28 +02:00
Yu Watanabe 87a33c0740 netowrk/ndisc: drop NDisc configurations when received NA without Router flag
Closes #28421.
2024-04-05 02:16:03 +09:00
Yu Watanabe ecab9b6040 test-ndisc: add basic tests for Neighbor Advertisement handling 2024-04-05 02:16:03 +09:00
Yu Watanabe 696eb2b8de sd-ndisc: add basic support of Neighbor Advertisement message
This adds basic support of receiving and parsing Neighbor Advertisement
message defined in RFC 4861.
2024-04-05 02:16:03 +09:00
Yu Watanabe 405be62f05 tree-wide: refuse enumerated device with ID_PROCESSING=1
When enumerated devices are being processed by udevd, we will receive
corresponding uevents later. So, we should not process devices in that
case.
2024-04-05 01:49:20 +09:00
Yu Watanabe 54e6172550 tree-wide: use device_is_processed() more 2024-04-05 01:49:20 +09:00
Yu Watanabe 3df2b4557a udev-util: rename device_is_processing() -> device_is_processed()
And make it also check the existence of the udev database.
2024-04-05 01:48:59 +09:00
Yu Watanabe 8c27f1ba4a vmspawn: fix error code 2024-04-04 04:42:55 +09:00
Yu Watanabe 94ad70989f man/example: also build example code with C90
Unfortunately, sd-bus-vtable.h, sd-journal.h, and sd-id128.h
have variadic macro and inline initialization of sub-object, these are
not supported in C90. So, we need to silence some errors.
2024-04-04 03:23:20 +09:00
Yu Watanabe 2893a1089e Merge pull request #32072 from YHNdnzj/no-ellipsize
core/manager: use cellescape and don't be too aggressive
2024-04-04 02:44:59 +09:00
Yu Watanabe 3a6bee0510 Merge pull request #32043 from YHNdnzj/resume-clear-efi
units: introduce systemd-hibernate-clear.service that clears stale HibernateLocation EFI variable
2024-04-04 02:43:00 +09:00
Yu Watanabe 040cb66458 man/examples: set _GNU_SOURCE in source, rather than by compile option
Addresses https://github.com/systemd/systemd/pull/32057#issuecomment-2034408569.
2024-04-04 02:30:29 +09:00
Yu Watanabe e98d4c3599 man/meson: add simple build test for example code 2024-04-03 17:58:39 +09:00
Yu Watanabe e10409ad55 sd-bus-vtable: add dummy macro to support compile without GNU extension
If SD_BUS_METHOD_WITH_ARGS() is set with SD_BUS_NO_ARGS and/or SD_BUS_NO_RESULT,
then it introduces
_SD_VARARGS_FOREACH_EVEN(_SD_ECHO, NULL)
    -> _SD_VARARGS_FOREACH_SEQ(_01, …, _50, NULL)
Hence, the variadic argument `...` in _SD_VARARGS_FOREACH_SEQ() has no
argument, but it is not allowed if built without GNU extension, e.g. -std=c11.

Let's introduce one more unused dummy argument to support such situation.
2024-04-03 17:58:39 +09:00
Yu Watanabe 2548ce6a30 man/examples: fix sd- header path 2024-04-03 17:58:39 +09:00
Yu Watanabe e84f70e16d man/examples: use strerror() instead of %m 2024-04-03 17:58:35 +09:00
Yu Watanabe 06d0dcc009 man/example: fix build failure of hwdb-usb-device.c
STRLEN() and xsprintf() is our internal macros.
2024-04-03 17:44:41 +09:00
Yu Watanabe c099e8f21f Merge pull request #32060 from YHNdnzj/timespec-minor-cleanup
Minor cleanup for timespec/efivars
2024-04-03 13:48:56 +09:00
Yu Watanabe dcc6256593 git-contrib: use 'git shortlog' command
Also, this drops Weblate (again) and dependabot from the contributers list.

Moreover, this makes the contributers sorted by git command, rather
than sort command. Then, the authors are sorted by their first name, e.g.
- before
Xiaotian Wu, Yuri Chornoivan, Yu Watanabe, Zbigniew Jędrzejewski-Szmek,
- after
Xiaotian Wu, Yu Watanabe, Yuri Chornoivan, Zbigniew Jędrzejewski-Szmek,

Suggested-by: Matteo Croce <teknoraver@meta.com>
2024-04-03 10:07:54 +09:00
Yu Watanabe ffeb6a2e3b Merge pull request #32059 from bluca/doc
Docs and TODO fixes
2024-04-03 09:15:15 +09:00
Yu Watanabe 03b6879f4d udevadm-test: prettify test results 2024-03-29 12:44:11 +00:00
Yu Watanabe 0966933b3d unit-def: append trailing comma for the last entry 2024-03-29 13:53:01 +09:00
Yu Watanabe 17f6b64038 core: align table 2024-03-29 13:51:15 +09:00
Yu Watanabe fee6510667 Merge pull request #31998 from yuwata/udev-event-mode
udev: make udevadm test and test-builtin not destructive
2024-03-29 11:31:58 +09:00
Yu Watanabe 089bef6631 udev: make udevadm test and test-builtin not destructive
Previously, 'udevadm test' performs not only processing udev rules,
but made several destructive change on the system; updating udev
database, device node permission, devlinks, network interface
properties, and so on.

Similary, 'udevadm test-builtin' may perform something destructive,
especially by 'keyboard', 'kmod', and 'net_setup_link' builtins.

Let's make these commands and test executables not change device
configurations.
2024-03-29 09:33:07 +09:00
Yu Watanabe adfc608578 Merge pull request #31986 from YHNdnzj/suspend-mem-mode
sleep: add SleepMemMode= setting for configuring /sys/power/mem_sleep
2024-03-29 09:30:54 +09:00
Yu Watanabe e4c7dc9418 test: disable IPv6AcceptRA= for test network interfaces with static address
This hopefully improves test performance.
2024-03-28 12:37:45 +00:00
Yu Watanabe ff944339f3 ndisc-option: allow to set valid time of options
When an option is delegated from an upstream server, its lifetime
may be limited by a time. Such functionality will be used later by
sd-radv.

This also remove 'offset' argument from the option setter
ndisc_option_set_xyz(), and make it update existing option.
See comments in ndisc_option_add_link_layer_address() for more details.
2024-03-28 12:34:09 +00:00
Yu Watanabe af41f9f8ad journalctl-filter: use add_match_boot_id() instead of add_match_this_boot()
The function add_match_this_boot() calls sd_journal_add_conjunction(),
hence, we cannot specify multiple devices in the extra match arguments,
e.g., "journalctl /dev/sda /dev/sdb" shows no entry.
2024-03-28 12:28:17 +00:00
Yu Watanabe a7541703b9 udev-event: split out update_clone()
No functional change, preparation for later commits.
2024-03-28 14:49:34 +09:00
Yu Watanabe 12a9241bf2 network/radv: allow to announce prefix and route information with zero lifetime
Setting zero lifetime for prefix or route information option is valid,
and is used for announcing the prefix or route is invalidated.

Fixes #26239.
2024-03-28 13:28:58 +09:00
Yu Watanabe b3ea82afbe network/ndisc: remove routes if lifetime is zero
Fixes #31979.
2024-03-28 13:28:58 +09:00
Yu Watanabe c98c0ba4c5 network/ndisc: NDisc Route option with 0 prefixlength is valid
Fixes #31606.
2024-03-28 13:28:58 +09:00
Yu Watanabe 2a4fb037cb Merge pull request #31989 from mrc0mmand/test-loop-dev-check
test: check for /dev/loop-control when checking lodev availability
2024-03-28 11:19:32 +09:00
Yu Watanabe 74158eec0e Merge pull request #31963 from yuwata/journalctl-authenticate-cleanups
journalctl-authenticate: several cleanups
2024-03-28 11:19:21 +09:00
Yu Watanabe bc91875ae5 test-network: add test cases for PersistLeases=no 2024-03-28 11:16:17 +09:00
Yu Watanabe 38b4ecf789 network: make [DHCPServer] in networkd.conf work
Follow-up for a3ed665a29.

Fixes https://github.com/systemd/systemd/pull/31977#discussion_r1542196572.
2024-03-28 11:15:53 +09:00
Yu Watanabe 1fadd9a357 network: fix typo
Follow-up for a3ed665a29.
2024-03-28 10:38:04 +09:00
Yu Watanabe 5e4aad5e96 Merge pull request #31985 from DaanDeMeyer/mkosi
mkosi: Copy built packages to output directory
2024-03-28 10:21:34 +09:00
Yu Watanabe a128119a1d timedate: fix typo
Follow-up for 3a51e31be9.
2024-03-28 09:55:11 +09:00
Yu Watanabe 66a0fdcaa5 journalctl-authenticate: return earlier if we are not on a TTY
No functional change, just refactoring.
2024-03-28 09:40:34 +09:00
Yu Watanabe ef277c961f journalctl-authenticate: use open_tmpfile_linkable() and link_tmpfile()
This also
- use path_join(),
- rename variables to more descriptive names.
2024-03-28 09:38:10 +09:00
Yu Watanabe 2dac05e62b journalctl-authenticate: drop unnecessary safe_close()
Follow-up for 7560fffcd2.

Addresses https://github.com/systemd/systemd/pull/31879#discussion_r1539063239.
2024-03-28 09:36:29 +09:00
Yu Watanabe 4c56862170 journalctl-authenticate: use is_dir() and refuse symlink for /var/log/journal
I am not sure it is explicitly documented that /var/log/journal should
be a directory, rather than a symlink to a directory, but the current
code of journald seems not to support symlinked directory well. Let's
refuse that at least here and now.
2024-03-28 09:36:29 +09:00
Yu Watanabe a3ed665a29 network/dhcp-server: introduce PersistLeases= setting
Requested at https://github.com/systemd/systemd/pull/31772#issuecomment-2000053357.
2024-03-27 13:21:15 +00:00
Yu Watanabe 95d3570b47 sd-ndisc-router: introduce sd_ndisc_router_set_sender_address()
Currently this is not used, but will be used later to modify the sender
address.
2024-03-27 13:13:12 +00:00
Yu Watanabe 9f3587ae44 ndisc-option: add HomeAgent option support
Currently, these are not used, but will be used later in sd-radv.
2024-03-27 13:12:30 +00:00
Yu Watanabe 93998559f8 Merge pull request #31789 from jsitnicki/socket-pass-fds-to-exec
Pass socket FDs to all ExecXYZ= commands in socket unit but ExecStartPre=
2024-03-27 10:18:13 +09:00
Yu Watanabe 193134de54 home: fix typo
Follow-up for 5ec87d577f.
2024-03-27 04:07:51 +09:00
Yu Watanabe d30d0b04ae Merge pull request #31951 from bluca/resolve_reload
resolved: support reloading configuration at runtime
2024-03-27 02:37:52 +09:00
Yu Watanabe 18640f8211 Merge pull request #31959 from YHNdnzj/execute-pass-fds
core/execute: check if EXEC_PASS_FDS is set if got exec_params.fds
2024-03-27 02:37:23 +09:00
Yu Watanabe 5c7292fa80 Merge pull request #31960 from YHNdnzj/capsule-followup
Some follow-ups for capsule
2024-03-27 02:34:43 +09:00
Yu Watanabe 0aad30d4b5 logs-show: read the current boot ID if nothing specified for add_match_boot_id()
No functional change, just refactoring.
2024-03-26 23:54:46 +09:00
Yu Watanabe 8e976dc920 sd-id128: move get_boot_id_for_machine() to id128-util.c
And rename it to id128_get_boot_for_machine().

This also splits out id128_get_boot() from sd_id128_get_boot(), and
make id128_get_boot_for_machine() use it.
2024-03-26 23:54:46 +09:00
Yu Watanabe 96a7f3fc75 journalctl-filter: several cleanups for add_matches()
- split it into small pieces to reduce indentation,
- return earlier if no filter specified,
- use journal_add_matchf() and journal_add_match_pair(),
  chase_and_stat(), is_symlink(), and sd_device_new_from_devname(),
- replace sd_device_get_devname() + stat() with sd_device_get_devnum(),
- refuse to install filter by path with --root, --image, or --machine
  at least now, as previously it has not worked anyway.
2024-03-26 23:51:47 +09:00
Yu Watanabe bb59f34c21 journalctl-filter: add missing sd_journal_add_conjunction()
Otherwise, if --facility= is specified with extra matches with '+',
the facility filter will not be applied to the specified filter after '+'.
2024-03-26 23:51:47 +09:00
Yu Watanabe 22f2b5566d journalctl-filter: several trivial cleanups
- declare iterator in loop,
- use journal_add_match_pair() and journal_add_matchf(),
- log failures in the caller.
2024-03-26 23:51:47 +09:00
Yu Watanabe 5d53eef97b journalctl-filter: modernize add_units()
- add missing assertions,
- use set_ensure_consume() and strv_consume(),
- use string_hash_ops_free and _cleanup_set_free_,
- use strv_fnmatch_full(),
- replace unused counter with a boolean flag,
- return earlier if no unit filtering is requested.
2024-03-26 23:51:46 +09:00
Yu Watanabe 17c512f1cc Merge pull request #31879 from yuwata/journalctl-split
journalctl: split journalctl.c into small pieces
2024-03-26 23:45:20 +09:00
Yu Watanabe 073f438365 ndisc-option: sort options in sent message
To make the sent message reproducible.
2024-03-26 13:58:36 +00:00
Yu Watanabe 846efaf532 sd-ndisc-protocol: list up all known options
See below for more details:
https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-5
2024-03-26 13:53:42 +00:00
Yu Watanabe 2129240447 journalctl-show: split out seek_journal()
No functional change, just refactoring.
2024-03-26 22:25:24 +09:00
Yu Watanabe ade2db83fe journalctl: split journalctl.c into small pieces
And introduces per-action functions.
No functional change, just refactoring.
2024-03-26 22:24:24 +09:00
Yu Watanabe adc8a60b88 journalctl: use correct type for flags
This also moves its declaration, as it is not changed in the loop.
2024-03-26 22:21:13 +09:00
Yu Watanabe dc586975b2 journalctl: merge three if blocks for seeking to the initial position
No functional change, just refactoring.
2024-03-26 22:21:13 +09:00