env: ${{ matrix.env }}
steps:
- name: Repository checkout
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: ${{ format('Build check ({0}-{1}-{2}-{3})', env.COMPILER, env.COMPILER_VERSION, env.LINKER, env.CRYPTOLIB) }}
run: sudo -E .github/workflows/build_test.sh
path: ./out/artifacts
- name: Upload Sarif
if: always() && steps.build.outcome == 'success'
- uses: github/codeql-action/upload-sarif@0ba4244466797eb048eb91a6cd43d5c03ca8bd05
+ uses: github/codeql-action/upload-sarif@00e563ead9f72a8461b24876bee2d0c2e8bd2ee8
with:
# Path to SARIF file relative to the root of the repository
sarif_file: cifuzz-sarif/results.sarif
steps:
- name: Checkout repository
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Initialize CodeQL
- uses: github/codeql-action/init@0ba4244466797eb048eb91a6cd43d5c03ca8bd05
+ uses: github/codeql-action/init@00e563ead9f72a8461b24876bee2d0c2e8bd2ee8
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql-config.yml
- run: sudo -E .github/workflows/unit_tests.sh SETUP
- name: Autobuild
- uses: github/codeql-action/autobuild@0ba4244466797eb048eb91a6cd43d5c03ca8bd05
+ uses: github/codeql-action/autobuild@00e563ead9f72a8461b24876bee2d0c2e8bd2ee8
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@0ba4244466797eb048eb91a6cd43d5c03ca8bd05
+ uses: github/codeql-action/analyze@00e563ead9f72a8461b24876bee2d0c2e8bd2ee8
COVERITY_SCAN_NOTIFICATION_EMAIL: "${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}"
steps:
- name: Repository checkout
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
# Reuse the setup phase of the unit test script to avoid code duplication
- name: Install build dependencies
run: sudo -E .github/workflows/unit_tests.sh SETUP
core.exportVariable('pr_number', pr_number);
- name: Repository checkout
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
fetch-depth: 0
steps:
- name: Repository checkout
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
fetch-depth: 0
steps:
- name: Repository checkout
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
fetch-depth: 0
template: [ bug_report.yml, feature_request.yml ]
steps:
- - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Parse issue form
uses: stefanbuck/github-issue-parser@c1a559d78bfb8dd05216dab9ffd2b91082ff5324
steps:
- name: Repo checkout
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
# We need a full repo clone
fetch-depth: 0
SYSTEMD_LOG_LEVEL: debug
steps:
- - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- - uses: systemd/mkosi@0af3f8a35c3be0e54b20234be7ab478d25bcc740
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: systemd/mkosi@cb5974d013f7c4c2a45f67c9ae990767e32e9034
- name: Configure
run: |
+ # We configure ExtraSearchPaths=build/ so make sure build/ exists.
+ mkdir build/
+
tee mkosi.conf <<- EOF
[Distribution]
Distribution=${{ matrix.distro }}
Release=${{ matrix.release }}
+ EOF
+ tee mkosi.conf.d/99-ci.conf <<- EOF
[Content]
Environment=CI_BUILD=1
SLOW_TESTS=true
- [Output]
+ [Host]
KernelCommandLineExtra=systemd.unit=mkosi-check-and-shutdown.service
systemd.journald.max_level_console=debug
# udev's debug log output is very verbose, so up it to info in CI.
udev.log_level=info
# Root device can take a long time to appear, so let's bump the timeout.
systemd.default_device_timeout_sec=180
-
- [Host]
- ExtraSearchPaths=!*
QemuVsock=yes
Ephemeral=yes
EOF
+ # TODO: Remove once archlinux-keyring is updated in ppa:michel-slm/kernel-utils.
+ tee mkosi.conf.d/11-arch-keyring.conf <<- EOF
+ [Match]
+ Distribution=arch
+
+ [Distribution]
+ RepositoryKeyCheck=no
+ EOF
+
# For erofs, we have to install linux-modules-extra-azure, but that doesn't match the running kernel
# version, so we can't load the erofs module. squashfs is a builtin module so we use that instead.
-meson==1.2.0 \
- --hash=sha256:10c0364edc67a1b3146f405800b300f0535f42b8736e79c744a8029a855b7c6b \
- --hash=sha256:1c0b634fe6b6a7072e398647f1bf392048577068a5c92ae44d04085dab0ded6f
+meson==1.2.1 \
+ --hash=sha256:08f83fc17513e99cd6e82c7554c1f58af70425211887f8f9c7363b2a90209462 \
+ --hash=sha256:b1db3a153087549497ee52b1c938d2134e0338214fe14f7efd16fecd57b639f5
ninja==1.11.1 \
--hash=sha256:1c474326e11fba3f8c2582715d79216292e327d3335367c0e87e9647a002cc4a \
--hash=sha256:3329b4b7c1694730772522a3ba0ba40fd15c012476ed3e1c9f0fd9e76190394e \
steps:
- name: Checkout code
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
persist-credentials: false
cryptolib: gcrypt
steps:
- name: Repository checkout
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Install build dependencies
run: |
# Drop XDG_* stuff from /etc/environment, so we don't get the user
by default when combined with --scope, will be changed in a future
release to be enabled by default.
+ * "systemctl switch-root" is now restricted to initrd transtions only.
+ Transitions between real systems should be done with "systemctl soft-reboot"
+ instead.
+
Device Management:
* udev will now create symlinks to loopback block devices in the
idea, and specifically works around the fact the autofs ignores busy by mount
namespaces)
-* refuse using the switch-root operation without /etc/initrd-release. Now
- that we have a concept of userspace reboot, we can clearly say: switch-root
- is for transitioning from initrd to host (or initrd to next initrd), while
- userspace reboot is for switching host to next version of the host.
-
* mount most file systems with a restrictive uidmap. e.g. mount /usr/ with a
uidmap that blocks out anything outside 0…1000 (i.e. system users) and similar.
aforementioned journald subscription varlink service, to enable
activation-by-message id and similar.
+* .service with invalid Sockets= starts successfully.
+
* landlock: lock down RuntimeDirectory= via landlock, so that services lose
ability to write anywehere else below /run/. Similar for
StateDirectory=. Benefit would be clear delegation via unit files: services
executes is implementation-defined, but typically has the effect of
reverting the system's state and configuration to vendor defaults.
---d9ec5e95e4b646aaaea2fd05214edbda
-Subject: Exiting PID 1...
+-- d9ec5e95e4b646aaaea2fd05214edbda
+Subject: Container init crashed
Defined-By: systemd
Support: %SUPPORT_URL%
-When systemd crashes, we want to either freeze or exit or reboot.
-For containers we choose the option of exiting.
+Container init has crashed and exited.
The details of the crash can be obtained from the container manager.
-To fix:
-Check the container manager for details.
-
-- 3ed0163e868a4417ab8b9e210407a96c
-Subject: Failed to reboot
+Subject: System reboot failed after crash
Defined-By: systemd
Support: %SUPPORT_URL%
Reboot has failed when systemd attempted to reboot after a crash.
-- 645c735537634ae0a32b15a7c6cba7d4
-Subject: Freezing execution
+Subject: Init execution froze
Defined-By: systemd
Support: %SUPPORT_URL%
-Freezing execution after fatal error.
+Systemd froze execution after fatal error.
-- 5addb3a06a734d3396b794bf98fb2d01
-Subject: Caught <signal>, not dumping core
+Subject: Init received fatal signal while coredump is disabled
Defined-By: systemd
Support: %SUPPORT_URL%
-In the instance of a crash arising from corrupted memory. The signal caught is propagated, but the core is not dumped.
+Systemd received fatal signal, but core dumping is disabled.
-- 5c9e98de4ab94c6a9d04d0ad793bd903
-Subject: Caught <signal>, cannot fork for core dump
+Subject: Init received fatal signal but fork failed
Defined-By: systemd
Support: %SUPPORT_URL%
+Systemd received fatal signal, but failed to fork to dump the core.
+
-- 5e6f1f5e4db64a0eaee3368249d20b94
-Subject: Caught <signal> from unknown sender process
+Subject: Init received fatal signal from unknown sender process
Defined-By: systemd
Support: %SUPPORT_URL%
-- 83f84b35ee264f74a3896a9717af34cb
-Subject: Caught <signal> from our own process
+Subject: Init received fatal signal from our own process
Defined-By: systemd
Support: %SUPPORT_URL%
-- 3a73a98baf5b4b199929e3226c0be783
-Subject: Caught <signal> from <PID>
+Subject: Init received fatal signal from other process
Defined-By: systemd
Support: %SUPPORT_URL%
-- 2ed18d4f78ca47f0a9bc25271c26adb4
-Subject: Caught <signal>, waitpid() failed
+Subject: Init received fatal signal but waitpid() failed
Defined-By: systemd
Support: %SUPPORT_URL%
+Systemd received fatal signal, but waitpid() failed when
+trying to dump the core.
+
-- 56b1cd96f24246c5b607666fda952356
-Subject: Caught <signal>, coredump failed (child <PID>, code=<code>, status=<status>.
+Subject: Init received fatal signal but coredump failed
Defined-By: systemd
Support: %SUPPORT_URL%
-- 4ac7566d4d7548f4981f629a28f0f829
-Subject: Caught <signal>, dumped core as pid <PID>
+Subject: Init received fatal signal and dumped core
Defined-By: systemd
Support: %SUPPORT_URL%
-- 38e8b1e039ad469291b18b44c553a5b7
-Subject: Failed to fork off crash shell
-
+Subject: Init failed to fork crash shell
Defined-By: systemd
Support: %SUPPORT_URL%
+Systemd crashed and failed to fork off crash shell.
+
-- 872729b47dbe473eb768ccecd477beda
-Subject: execle() failed
+Subject: Crash shell failed to execute
Defined-By: systemd
Support: %SUPPORT_URL%
+Systemd crashed and failed to spawn crash shell.
+
-- 658a67adc1c940b3b3316e7e8628834a
-Subject: Failed to load SELinux policy.
+Subject: Manager failed to load SELinux policy
Defined-By: systemd
Support: %SUPPORT_URL%
-- e6f456bd92004d9580160b2207555186
-Subject: Battery level critically low. Please connect your charger or the system will power off in 10 seconds.
+Subject: Battery level critically low, waiting for charger
Defined-By: systemd
Support: %SUPPORT_URL%
+Battery level is critically low. Please connect your charger
+or the system will power off in 10 seconds.
+
-- 267437d33fdd41099ad76221cc24a335
-Subject: Battery level critically low, powering off.
+Subject: Battery level critically low, powering off
Defined-By: systemd
Support: %SUPPORT_URL%
-- 79e05b67bc4545d1922fe47107ee60c5
-Subject: Failed to run main loop
+Subject: Manager failed to run main loop
Defined-By: systemd
Support: %SUPPORT_URL%
-- dbb136b10ef4457ba47a795d62f108c9
-Subject: Failed to determine <XDG_DIR> path
+Subject: User manager failed to determine $XDG_RUNTIME_DIR path
Defined-By: systemd
Support: %SUPPORT_URL%
-- ed158c2df8884fa584eead2d902c1032
-Subject: Failed to drop capability bounding set of usermode helpers
+Subject: Init failed to drop capability bounding set of usermode helpers
Defined-By: systemd
Support: %SUPPORT_URL%
-- 42695b500df048298bee37159caa9f2e
-Subject: Failed to drop capability bounding set
+Subject: Init failed to drop capability bounding set
Defined-By: systemd
Support: %SUPPORT_URL%
-- bfc2430724ab44499735b4f94cca9295
-Subject: Failed to disable new privileges
+Subject: User manager failed to disable new privileges
Defined-By: systemd
Support: %SUPPORT_URL%
-- 59288af523be43a28d494e41e26e4510
-Subject: Failed to start default target <target>
+Subject: Manager failed to start default target
Defined-By: systemd
Support: %SUPPORT_URL%
-- 689b4fcc97b4486ea5da92db69c9e314
-Subject: Failed to isolate default target <target>
+Subject: Manager failed to isolate default target
Defined-By: systemd
Support: %SUPPORT_URL%
-- 5ed836f1766f4a8a9fc5da45aae23b29
-Subject: Failed to allocate fd set
+Subject: Manager failed to collect passed file descriptors
Defined-By: systemd
Support: %SUPPORT_URL%
-- 6a40fbfbd2ba4b8db02fb40c9cd090d7
-Subject: Failed to fix up PID1 environment
+Subject: Init failed to fix up environment variables
Defined-By: systemd
Support: %SUPPORT_URL%
Support: %SUPPORT_URL%
-- d67fa9f847aa4b048a2ae33535331adb
-Subject: Failed to write Smack onlycap list
+Subject: Manager failed to write Smack onlycap list
Defined-By: systemd
Support: %SUPPORT_URL%
Support: %SUPPORT_URL%
-- d18e0339efb24a068d9c1060221048c2
-Subject: Failed to fork off valgrind helper
+Subject: Init failed to fork off valgrind helper
Defined-By: systemd
Support: %SUPPORT_URL%
sensor:modalias:acpi:SMO8500*:dmi:*:rvnReeder:rnA8iW-Rev.A:*
ACCEL_MOUNT_MATRIX=1, 0, 0; 0, -1, 0; 0, 0, 1
+#########################################
+# RCA
+#########################################
+sensor:modalias:acpi:KIOX000A*:dmi:*:svnRCA:pnW101SA23T1:*
+ ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1
+
#########################################
# Schneider
#########################################
''],
['sd_id128_get_machine',
'3',
- ['sd_id128_get_boot',
+ ['sd_id128_get_app_specific',
+ 'sd_id128_get_boot',
'sd_id128_get_boot_app_specific',
'sd_id128_get_invocation',
'sd_id128_get_machine_app_specific'],
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_id128_equal()</function> was added in version 252.</para>
+ <para><function>sd_id128_in_set()</function> was added in version 252.</para>
+ <para><function>sd_id128_in_set_sentinel()</function> was added in version 252.</para>
+ <para><function>sd_id128_in_setv()</function> was added in version 252.</para>
+ <para><function>sd_id128_is_allf()</function> was added in version 252.</para>
+ <para><function>sd_id128_is_null()</function> was added in version 252.</para>
+ <para><function>sd_id128_string_equal()</function> was added in version 252.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<para>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_add_match()</function> was added in version 231.</para>
+ <para><function>sd_bus_add_match_async()</function> was added in version 237.</para>
+ <para><function>sd_bus_match_signal()</function> was added in version 237.</para>
+ <para><function>sd_bus_match_signal_async()</function> was added in version 237.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_add_node_enumerator()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_add_fallback()</function> was added in version 246.</para>
+ <para><function>sd_bus_add_fallback_vtable()</function> was added in version 246.</para>
+ <para><function>sd_bus_add_filter()</function> was added in version 246.</para>
+ <para><function>sd_bus_add_object()</function> was added in version 246.</para>
+ <para><function>sd_bus_add_object_vtable()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_add_object_manager()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_attach_event()</function> was added in version 240.</para>
+ <para><function>sd_bus_detach_event()</function> was added in version 240.</para>
+ <para><function>sd_bus_get_event()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_call()</function> was added in version 246.</para>
+ <para><function>sd_bus_call_async()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
</example>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_call_method()</function> was added in version 246.</para>
+ <para><function>sd_bus_call_method_async()</function> was added in version 246.</para>
+ <para><function>sd_bus_call_method_asyncv()</function> was added in version 246.</para>
+ <para><function>sd_bus_call_methodv()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_can_send()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_close()</function> was added in version 240.</para>
+ <para><function>sd_bus_flush()</function> was added in version 240.</para>
+ <para><function>sd_bus_default_flush_close()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_creds_get_audit_login_uid()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_audit_session_id()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_cgroup()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_cmdline()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_comm()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_exe()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_gid()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_owner_uid()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_pid()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_selinux_context()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_session()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_slice()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_tid()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_tid_comm()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_unique_name()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_unit()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_user_unit()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_well_known_names()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_has_bounding_cap()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_has_effective_cap()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_has_inheritable_cap()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_has_permitted_cap()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_description()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_egid()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_euid()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_fsgid()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_fsuid()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_ppid()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_sgid()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_suid()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_supplementary_gids()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_tty()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_uid()</function> was added in version 220.</para>
+ <para><function>sd_bus_creds_get_user_slice()</function> was added in version 223.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_creds_get_mask()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_new_from_pid()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_ref()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_unref()</function> was added in version 209.</para>
+ <para><function>sd_bus_creds_get_augmented_mask()</function> was added in version 223.</para>
+ <para><function>sd_bus_creds_unrefp()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_default()</function> was added in version 220.</para>
+ <para><function>sd_bus_default_system()</function> was added in version 220.</para>
+ <para><function>sd_bus_default_user()</function> was added in version 220.</para>
+ <para><function>sd_bus_open()</function> was added in version 220.</para>
+ <para><function>sd_bus_open_system()</function> was added in version 220.</para>
+ <para><function>sd_bus_open_system_machine()</function> was added in version 220.</para>
+ <para><function>sd_bus_open_system_remote()</function> was added in version 220.</para>
+ <para><function>sd_bus_open_user()</function> was added in version 220.</para>
+ <para><function>sd_bus_open_system_with_description()</function> was added in version 240.</para>
+ <para><function>sd_bus_open_user_with_description()</function> was added in version 240.</para>
+ <para><function>sd_bus_open_with_description()</function> was added in version 240.</para>
+ <para><function>sd_bus_open_user_machine()</function> was added in version 248.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_emit_interfaces_added()</function> was added in version 246.</para>
+ <para><function>sd_bus_emit_interfaces_added_strv()</function> was added in version 246.</para>
+ <para><function>sd_bus_emit_interfaces_removed()</function> was added in version 246.</para>
+ <para><function>sd_bus_emit_interfaces_removed_strv()</function> was added in version 246.</para>
+ <para><function>sd_bus_emit_object_added()</function> was added in version 246.</para>
+ <para><function>sd_bus_emit_object_removed()</function> was added in version 246.</para>
+ <para><function>sd_bus_emit_properties_changed()</function> was added in version 246.</para>
+ <para><function>sd_bus_emit_properties_changed_strv()</function> was added in version 246.</para>
+ <para><function>sd_bus_emit_signal()</function> was added in version 246.</para>
+ <para><function>sd_bus_emit_signalv()</function> was added in version 246.</para>
+ <para><function>sd_bus_emit_signal_to()</function> was added in version 253.</para>
+ <para><function>sd_bus_emit_signal_tov()</function> was added in version 253.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_enqueue_for_read()</function> was added in version 245.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_error_copy()</function> was added in version 209.</para>
+ <para><function>sd_bus_error_free()</function> was added in version 209.</para>
+ <para><function>sd_bus_error_get_errno()</function> was added in version 209.</para>
+ <para><function>sd_bus_error_has_name()</function> was added in version 209.</para>
+ <para><function>sd_bus_error_is_set()</function> was added in version 209.</para>
+ <para><function>sd_bus_error_set()</function> was added in version 209.</para>
+ <para><function>sd_bus_error_set_const()</function> was added in version 209.</para>
+ <para><function>sd_bus_error_set_errno()</function> was added in version 209.</para>
+ <para><function>sd_bus_error_set_errnof()</function> was added in version 209.</para>
+ <para><function>sd_bus_error_setf()</function> was added in version 209.</para>
+ <para><function>sd_bus_error_set_errnofv()</function> was added in version 223.</para>
+ <para><function>sd_bus_error_move()</function> was added in version 240.</para>
+ <para><function>sd_bus_error_has_names_sentinel()</function> was added in version 247.</para>
+ <para><function>sd_bus_error_setfv()</function> was added in version 252.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_error_add_map()</function> was added in version 223.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_current_handler()</function> was added in version 246.</para>
+ <para><function>sd_bus_get_current_message()</function> was added in version 246.</para>
+ <para><function>sd_bus_get_current_slot()</function> was added in version 246.</para>
+ <para><function>sd_bus_get_current_userdata()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_fd()</function> was added in version 231.</para>
+ <para><function>sd_bus_get_events()</function> was added in version 240.</para>
+ <para><function>sd_bus_get_timeout()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
</refsect2>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_n_queued_read()</function> was added in version 238.</para>
+ <para><function>sd_bus_get_n_queued_write()</function> was added in version 238.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_name_creds()</function> was added in version 246.</para>
+ <para><function>sd_bus_get_owner_creds()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_name_machine_id()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_interface_name_is_valid()</function> was added in version 246.</para>
+ <para><function>sd_bus_member_name_is_valid()</function> was added in version 246.</para>
+ <para><function>sd_bus_object_path_is_valid()</function> was added in version 246.</para>
+ <para><function>sd_bus_service_name_is_valid()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_is_open()</function> was added in version 237.</para>
+ <para><function>sd_bus_is_ready()</function> was added in version 237.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_list_names()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_at_end()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_get_cookie()</function> was added in version 209.</para>
+ <para><function>sd_bus_message_get_reply_cookie()</function> was added in version 209.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_get_monotonic_usec()</function> was added in version 209.</para>
+ <para><function>sd_bus_message_get_realtime_usec()</function> was added in version 209.</para>
+ <para><function>sd_bus_message_get_seqnum()</function> was added in version 209.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_get_signature()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_has_signature()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_is_empty()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_get_type()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_is_method_call()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_is_method_error()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_is_signal()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_get_creds()</function> was added in version 246.</para>
+ <para><function>sd_bus_message_get_errno()</function> was added in version 246.</para>
+ <para><function>sd_bus_message_get_error()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_get_bus()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_new()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_ref()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_unref()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_unrefp()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
</example>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_new_method_call()</function> was added in version 246.</para>
+ <para><function>sd_bus_message_new_method_return()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
fd_copy = fcntl(fd, FD_DUPFD_CLOEXEC, 3);</programlisting>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_read()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_readv()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_peek_type()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
</refsect2>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_read_array()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
</refsect2>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_read_basic()</function> was added in version 231.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
</refsect2>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_read_strv()</function> was added in version 246.</para>
+ <para><function>sd_bus_message_read_strv_extend()</function> was added in version 252.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_rewind()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_seal()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_sensitive()</function> was added in version 245.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_set_destination()</function> was added in version 237.</para>
+ <para><function>sd_bus_message_set_sender()</function> was added in version 237.</para>
+ <para><function>sd_bus_message_get_destination()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_get_interface()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_get_member()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_get_path()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_get_sender()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_get_auto_start()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_get_expect_reply()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_set_auto_start()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_set_expect_reply()</function> was added in version 240.</para>
+ <para><function>sd_bus_message_get_allow_interactive_authorization()</function> was added in version 246.</para>
+ <para><function>sd_bus_message_set_allow_interactive_authorization()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_message_skip()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_negotiate_creds()</function> was added in version 212.</para>
+ <para><function>sd_bus_negotiate_fds()</function> was added in version 212.</para>
+ <para><function>sd_bus_negotiate_timestamp()</function> was added in version 212.</para>
+ <para><function>sd_bus_get_creds_mask()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_new()</function> was added in version 209.</para>
+ <para><function>sd_bus_ref()</function> was added in version 209.</para>
+ <para><function>sd_bus_unref()</function> was added in version 209.</para>
+ <para><function>sd_bus_unrefp()</function> was added in version 229.</para>
+ <para><function>sd_bus_flush_close_unref()</function> was added in version 240.</para>
+ <para><function>sd_bus_flush_close_unrefp()</function> was added in version 240.</para>
+ <para><function>sd_bus_close_unref()</function> was added in version 241.</para>
+ <para><function>sd_bus_close_unrefp()</function> was added in version 241.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_path_decode()</function> was added in version 211.</para>
+ <para><function>sd_bus_path_encode()</function> was added in version 211.</para>
+ <para><function>sd_bus_path_decode_many()</function> was added in version 227.</para>
+ <para><function>sd_bus_path_encode_many()</function> was added in version 227.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_process()</function> was added in version 231.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_query_sender_creds()</function> was added in version 246.</para>
+ <para><function>sd_bus_query_sender_privilege()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_release_name()</function> was added in version 209.</para>
+ <para><function>sd_bus_request_name()</function> was added in version 209.</para>
+ <para><function>sd_bus_release_name_async()</function> was added in version 237.</para>
+ <para><function>sd_bus_request_name_async()</function> was added in version 237.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_send()</function> was added in version 246.</para>
+ <para><function>sd_bus_send_to()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_address()</function> was added in version 246.</para>
+ <para><function>sd_bus_set_address()</function> was added in version 246.</para>
+ <para><function>sd_bus_set_exec()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_close_on_exit()</function> was added in version 240.</para>
+ <para><function>sd_bus_set_close_on_exit()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_connected_signal()</function> was added in version 237.</para>
+ <para><function>sd_bus_set_connected_signal()</function> was added in version 237.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_allow_interactive_authorization()</function> was added in version 240.</para>
+ <para><function>sd_bus_get_description()</function> was added in version 240.</para>
+ <para><function>sd_bus_set_allow_interactive_authorization()</function> was added in version 240.</para>
+ <para><function>sd_bus_set_anonymous()</function> was added in version 240.</para>
+ <para><function>sd_bus_set_description()</function> was added in version 240.</para>
+ <para><function>sd_bus_set_trusted()</function> was added in version 240.</para>
+ <para><function>sd_bus_get_scope()</function> was added in version 246.</para>
+ <para><function>sd_bus_get_tid()</function> was added in version 246.</para>
+ <para><function>sd_bus_get_unique_name()</function> was added in version 246.</para>
+ <para><function>sd_bus_is_anonymous()</function> was added in version 246.</para>
+ <para><function>sd_bus_is_trusted()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_exit_on_disconnect()</function> was added in version 246.</para>
+ <para><function>sd_bus_set_exit_on_disconnect()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_set_fd()</function> was added in version 248.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_method_call_timeout()</function> was added in version 246.</para>
+ <para><function>sd_bus_set_method_call_timeout()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_property()</function> was added in version 246.</para>
+ <para><function>sd_bus_get_property_string()</function> was added in version 246.</para>
+ <para><function>sd_bus_get_property_strv()</function> was added in version 246.</para>
+ <para><function>sd_bus_get_property_trivial()</function> was added in version 246.</para>
+ <para><function>sd_bus_set_property()</function> was added in version 246.</para>
+ <para><function>sd_bus_set_propertyv()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_sender()</function> was added in version 237.</para>
+ <para><function>sd_bus_set_sender()</function> was added in version 237.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_bus_id()</function> was added in version 246.</para>
+ <para><function>sd_bus_is_bus_client()</function> was added in version 246.</para>
+ <para><function>sd_bus_is_monitor()</function> was added in version 246.</para>
+ <para><function>sd_bus_is_server()</function> was added in version 246.</para>
+ <para><function>sd_bus_set_bus_client()</function> was added in version 246.</para>
+ <para><function>sd_bus_set_monitor()</function> was added in version 246.</para>
+ <para><function>sd_bus_set_server()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_get_watch_bind()</function> was added in version 237.</para>
+ <para><function>sd_bus_set_watch_bind()</function> was added in version 237.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_slot_get_bus()</function> was added in version 246.</para>
+ <para><function>sd_bus_slot_get_current_handler()</function> was added in version 246.</para>
+ <para><function>sd_bus_slot_get_current_message()</function> was added in version 246.</para>
+ <para><function>sd_bus_slot_get_current_userdata()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_slot_ref()</function> was added in version 240.</para>
+ <para><function>sd_bus_slot_unref()</function> was added in version 240.</para>
+ <para><function>sd_bus_slot_unrefp()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_slot_get_description()</function> was added in version 240.</para>
+ <para><function>sd_bus_slot_set_description()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_slot_get_destroy_callback()</function> was added in version 239.</para>
+ <para><function>sd_bus_slot_set_destroy_callback()</function> was added in version 239.</para>
+ <para><function>sd_bus_track_get_destroy_callback()</function> was added in version 239.</para>
+ <para><function>sd_bus_track_set_destroy_callback()</function> was added in version 239.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_slot_get_floating()</function> was added in version 239.</para>
+ <para><function>sd_bus_slot_set_floating()</function> was added in version 239.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_slot_get_userdata()</function> was added in version 240.</para>
+ <para><function>sd_bus_slot_set_userdata()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_start()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_track_add_name()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_add_sender()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_contains()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_count()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_count_name()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_count_sender()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_first()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_next()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_remove_name()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_remove_sender()</function> was added in version 232.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_track_get_bus()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_get_recursive()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_get_userdata()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_new()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_ref()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_set_recursive()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_set_userdata()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_unref()</function> was added in version 232.</para>
+ <para><function>sd_bus_track_unrefp()</function> was added in version 232.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_bus_wait()</function> was added in version 240.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_device_get_devname()</function> was added in version 251.</para>
+ <para><function>sd_device_get_devnum()</function> was added in version 251.</para>
+ <para><function>sd_device_get_devpath()</function> was added in version 251.</para>
+ <para><function>sd_device_get_devtype()</function> was added in version 251.</para>
+ <para><function>sd_device_get_diskseq()</function> was added in version 251.</para>
+ <para><function>sd_device_get_driver()</function> was added in version 251.</para>
+ <para><function>sd_device_get_ifindex()</function> was added in version 251.</para>
+ <para><function>sd_device_get_subsystem()</function> was added in version 251.</para>
+ <para><function>sd_device_get_sysname()</function> was added in version 251.</para>
+ <para><function>sd_device_get_sysnum()</function> was added in version 251.</para>
+ <para><function>sd_device_get_syspath()</function> was added in version 251.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<function>sd_device_unref()</function> always returns <constant>NULL</constant>.
</para>
</refsect1>
+<refsect1>
+ <title>History</title>
+ <para><function>sd_device_ref()</function> was added in version 251.</para>
+ <para><function>sd_device_unref()</function> was added in version 251.</para>
+ <para><function>sd_device_unrefp()</function> was added in version 251.</para>
+ </refsect1>
</refentry>
</example>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_add_child()</function> was added in version 217.</para>
+ <para><function>sd_event_source_get_child_pid()</function> was added in version 217.</para>
+ <para><function>sd_event_add_child_pidfd()</function> was added in version 245.</para>
+ <para><function>sd_event_source_get_child_pidfd()</function> was added in version 245.</para>
+ <para><function>sd_event_source_get_child_pidfd_own()</function> was added in version 245.</para>
+ <para><function>sd_event_source_get_child_process_own()</function> was added in version 245.</para>
+ <para><function>sd_event_source_send_child_signal()</function> was added in version 245.</para>
+ <para><function>sd_event_source_set_child_pidfd_own()</function> was added in version 245.</para>
+ <para><function>sd_event_source_set_child_process_own()</function> was added in version 245.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_add_defer()</function> was added in version 217.</para>
+ <para><function>sd_event_add_exit()</function> was added in version 217.</para>
+ <para><function>sd_event_add_post()</function> was added in version 217.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_add_inotify()</function> was added in version 239.</para>
+ <para><function>sd_event_source_get_inotify_mask()</function> was added in version 239.</para>
+ <para><function>sd_event_add_inotify_fd()</function> was added in version 250.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_add_io()</function> was added in version 229.</para>
+ <para><function>sd_event_source_get_io_events()</function> was added in version 229.</para>
+ <para><function>sd_event_source_get_io_fd()</function> was added in version 229.</para>
+ <para><function>sd_event_source_get_io_revents()</function> was added in version 229.</para>
+ <para><function>sd_event_source_set_io_events()</function> was added in version 229.</para>
+ <para><function>sd_event_source_set_io_fd()</function> was added in version 229.</para>
+ <para><function>sd_event_source_get_io_fd_own()</function> was added in version 239.</para>
+ <para><function>sd_event_source_set_io_fd_own()</function> was added in version 239.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_add_memory_pressure()</function> was added in version 254.</para>
+ <para><function>sd_event_source_set_memory_pressure_period()</function> was added in version 254.</para>
+ <para><function>sd_event_source_set_memory_pressure_type()</function> was added in version 254.</para>
+ <para><function>sd_event_trim_memory()</function> was added in version 254.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_add_signal()</function> was added in version 217.</para>
+ <para><function>sd_event_source_get_signal()</function> was added in version 217.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_add_time()</function> was added in version 213.</para>
+ <para><function>sd_event_source_get_time()</function> was added in version 213.</para>
+ <para><function>sd_event_source_get_time_accuracy()</function> was added in version 213.</para>
+ <para><function>sd_event_source_get_time_clock()</function> was added in version 213.</para>
+ <para><function>sd_event_source_set_time()</function> was added in version 213.</para>
+ <para><function>sd_event_source_set_time_accuracy()</function> was added in version 213.</para>
+ <para><function>sd_event_add_time_relative()</function> was added in version 247.</para>
+ <para><function>sd_event_source_set_time_relative()</function> was added in version 247.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_exit()</function> was added in version 229.</para>
+ <para><function>sd_event_get_exit_code()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_get_fd()</function> was added in version 217.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_default()</function> was added in version 213.</para>
+ <para><function>sd_event_new()</function> was added in version 213.</para>
+ <para><function>sd_event_ref()</function> was added in version 213.</para>
+ <para><function>sd_event_unref()</function> was added in version 213.</para>
+ <para><function>sd_event_get_tid()</function> was added in version 229.</para>
+ <para><function>sd_event_unrefp()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_now()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_loop()</function> was added in version 220.</para>
+ <para><function>sd_event_run()</function> was added in version 220.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_set_signal_exit()</function> was added in version 252.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_get_watchdog()</function> was added in version 229.</para>
+ <para><function>sd_event_set_watchdog()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_get_event()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_get_pending()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_get_description()</function> was added in version 229.</para>
+ <para><function>sd_event_source_set_description()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_get_destroy_callback()</function> was added in version 239.</para>
+ <para><function>sd_event_source_set_destroy_callback()</function> was added in version 239.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_get_enabled()</function> was added in version 229.</para>
+ <para><function>sd_event_source_set_enabled()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_get_exit_on_failure()</function> was added in version 247.</para>
+ <para><function>sd_event_source_set_exit_on_failure()</function> was added in version 247.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_get_floating()</function> was added in version 244.</para>
+ <para><function>sd_event_source_set_floating()</function> was added in version 244.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_set_prepare()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_get_priority()</function> was added in version 229.</para>
+ <para><function>sd_event_source_set_priority()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_get_ratelimit()</function> was added in version 248.</para>
+ <para><function>sd_event_source_is_ratelimited()</function> was added in version 248.</para>
+ <para><function>sd_event_source_set_ratelimit()</function> was added in version 248.</para>
+ <para><function>sd_event_source_set_ratelimit_expire_callback()</function> was added in version 250.</para>
+ <para><function>sd_event_source_leave_ratelimit()</function> was added in version 254.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_get_userdata()</function> was added in version 229.</para>
+ <para><function>sd_event_source_set_userdata()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_source_ref()</function> was added in version 229.</para>
+ <para><function>sd_event_source_unref()</function> was added in version 229.</para>
+ <para><function>sd_event_source_unrefp()</function> was added in version 229.</para>
+ <para><function>sd_event_source_disable_unref()</function> was added in version 243.</para>
+ <para><function>sd_event_source_disable_unrefp()</function> was added in version 243.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_event_dispatch()</function> was added in version 220.</para>
+ <para><function>sd_event_prepare()</function> was added in version 220.</para>
+ <para><function>sd_event_wait()</function> was added in version 220.</para>
+ <para><function>sd_event_get_state()</function> was added in version 229.</para>
+ <para><function>sd_event_get_iteration()</function> was added in version 231.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_get_machine_names()</function> was added in version 203.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
</example>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>SD_HWDB_FOREACH_PROPERTY()</function> was added in version 246.</para>
+ <para><function>sd_hwdb_enumerate()</function> was added in version 246.</para>
+ <para><function>sd_hwdb_get()</function> was added in version 246.</para>
+ <para><function>sd_hwdb_seek()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_hwdb_new()</function> was added in version 246.</para>
+ <para><function>sd_hwdb_ref()</function> was added in version 246.</para>
+ <para><function>sd_hwdb_unref()</function> was added in version 246.</para>
+ <para><function>sd_hwdb_new_from_path()</function> was added in version 252.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<refnamediv>
<refname>sd_id128_get_machine</refname>
+ <refname>sd_id128_get_app_specific</refname>
<refname>sd_id128_get_machine_app_specific</refname>
<refname>sd_id128_get_boot</refname>
<refname>sd_id128_get_boot_app_specific</refname>
<paramdef>sd_id128_t *<parameter>ret</parameter></paramdef>
</funcprototype>
+ <funcprototype>
+ <funcdef>int <function>sd_id128_get_app_specific</function></funcdef>
+ <paramdef>sd_id128_t <parameter>base</parameter></paramdef>
+ <paramdef>sd_id128_t <parameter>app_id</parameter></paramdef>
+ <paramdef>sd_id128_t *<parameter>ret</parameter></paramdef>
+ </funcprototype>
+
<funcprototype>
<funcdef>int <function>sd_id128_get_machine_app_specific</function></funcdef>
<paramdef>sd_id128_t <parameter>app_id</parameter></paramdef>
ID from this machine ID, in an irreversible (cryptographically secure) way. To make this easy
<function>sd_id128_get_machine_app_specific()</function> is provided, see below.</para>
+ <para><function>sd_id128_get_app_specific()</function> returns a machine ID that is a combination of the
+ <parameter>base</parameter> and <parameter>app_id</parameter> parameters. Internally, this function
+ calculates HMAC-SHA256 of the <parameter>app_id</parameter> parameter keyed by the
+ <parameter>base</parameter> parameter, and truncates this result to fit in
+ <structname>sd_id128_t</structname> and turns it into a valid Variant 1 Version 4 UUID, in accordance
+ with <ulink url="https://tools.ietf.org/html/rfc4122">RFC 4122</ulink>. Neither of the two input
+ parameters can be calculated from the output parameter <parameter>ret</parameter>.</para>
+
<para><function>sd_id128_get_machine_app_specific()</function> is similar to
- <function>sd_id128_get_machine()</function>, but retrieves a machine ID that is specific to the application that is
- identified by the indicated application ID. It is recommended to use this function instead of
- <function>sd_id128_get_machine()</function> when passing an ID to untrusted environments, in order to make sure
- that the original machine ID may not be determined externally. This way, the ID used by the application remains
- stable on a given machine, but cannot be easily correlated with IDs used in other applications on the same
- machine. The application-specific ID should be generated via a tool like <command>systemd-id128 new</command>,
- and may be compiled into the application. This function will return the same application-specific ID for each
- combination of machine ID and application ID. Internally, this function calculates HMAC-SHA256 of the application
- ID, keyed by the machine ID.</para>
+ <function>sd_id128_get_machine()</function>, but retrieves a machine ID that is specific to the
+ application that is identified by the indicated application ID. It is recommended to use this function
+ instead of <function>sd_id128_get_machine()</function> when passing an ID to untrusted environments, in
+ order to make sure that the original machine ID may not be determined externally. This way, the ID used
+ by the application remains stable on a given machine, but cannot be easily correlated with IDs used in
+ other applications on the same machine. The application-specific ID should be generated via a tool like
+ <command>systemd-id128 new</command>, and may be compiled into the application. This function will return
+ the same application-specific ID for each combination of machine ID and application ID. Internally, this
+ function calls <function>sd_id128_get_app_specific()</function> with the result from
+ <function>sd_id128_get_machine()</function> and the <parameter>app_id</parameter> parameter.</para>
<para><function>sd_id128_get_boot()</function> returns the boot ID of the executing kernel. This reads and parses
the <filename>/proc/sys/kernel/random/boot_id</filename> file exposed by the kernel. It is randomly generated early
derive an application specific ID using <function>sd_id128_get_boot_app_specific()</function>, see below.</para>
<para><function>sd_id128_get_boot_app_specific()</function> is analogous to
- <function>sd_id128_get_machine_app_specific()</function> but returns an ID that changes between boots. Some
- machines may be used for a long time without rebooting, hence the boot ID may remain constant for a long time, and
- has properties similar to the machine ID during that time.</para>
+ <function>sd_id128_get_machine_app_specific()</function>, but returns an ID that changes between
+ boots. Some machines may be used for a long time without rebooting, hence the boot ID may remain constant
+ for a long time, and has properties similar to the machine ID during that time.</para>
<para><function>sd_id128_get_invocation()</function> returns the invocation ID of the currently executed
service. In its current implementation, this tries to read and parse the following:
<term><constant>-ENXIO</constant></term>
<listitem><para>Returned by <function>sd_id128_get_invocation()</function> if no invocation ID is
- set.</para>
+ set. Also returned by <function>sd_id128_get_app_specific()</function>,
+ <function>sd_id128_get_machine_app_specific()</function>, and
+ <function>sd_id128_get_boot_app_specific()</function> when the <parameter>app_id</parameter>
+ parameter is all zeros.</para>
<xi:include href="version-info.xml" xpointer="v242"/></listitem>
</varlistentry>
</example>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_id128_get_boot()</function> was added in version 187.</para>
+ <para><function>sd_id128_get_machine()</function> was added in version 187.</para>
+ <para><function>sd_id128_get_invocation()</function> was added in version 232.</para>
+ <para><function>sd_id128_get_machine_app_specific()</function> was added in version 233.</para>
+ <para><function>sd_id128_get_boot_app_specific()</function> was added in version 240.</para>
+ <para><function>sd_id128_get_app_specific()</function> was added in version 255.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_id128_randomize()</function> was added in version 187.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_id128_from_string()</function> was added in version 187.</para>
+ <para><function>sd_id128_to_string()</function> was added in version 187.</para>
+ <para><function>sd_id128_uuid_string()</function> was added in version 251.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
to check the file descriptor type and where it is bound to.</para>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_is_special()</function> was added in version 209.</para>
+ <para><function>sd_is_socket_sockaddr()</function> was added in version 233.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<para>
}</programlisting>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_add_disjunction()</function> was added in version 187.</para>
+ <para><function>sd_journal_add_match()</function> was added in version 187.</para>
+ <para><function>sd_journal_flush_matches()</function> was added in version 187.</para>
+ <para><function>sd_journal_add_conjunction()</function> was added in version 202.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<programlisting><xi:include href="journal-enumerate-fields.c" parse="text" /></programlisting>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>SD_JOURNAL_FOREACH_FIELD()</function> was added in version 229.</para>
+ <para><function>sd_journal_enumerate_fields()</function> was added in version 229.</para>
+ <para><function>sd_journal_restart_fields()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_get_catalog()</function> was added in version 196.</para>
+ <para><function>sd_journal_get_catalog_for_message_id()</function> was added in version 196.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_get_cursor()</function> was added in version 187.</para>
+ <para><function>sd_journal_test_cursor()</function> was added in version 195.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_get_cutoff_monotonic_usec()</function> was added in version 187.</para>
+ <para><function>sd_journal_get_cutoff_realtime_usec()</function> was added in version 187.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
…</programlisting>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>SD_JOURNAL_FOREACH_DATA()</function> was added in version 187.</para>
+ <para><function>sd_journal_enumerate_data()</function> was added in version 187.</para>
+ <para><function>sd_journal_get_data()</function> was added in version 187.</para>
+ <para><function>sd_journal_restart_data()</function> was added in version 187.</para>
+ <para><function>sd_journal_get_data_threshold()</function> was added in version 196.</para>
+ <para><function>sd_journal_set_data_threshold()</function> was added in version 196.</para>
+ <para><function>sd_journal_enumerate_available_data()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<programlisting><xi:include href="journal-iterate-poll.c" parse="text" /></programlisting>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_get_fd()</function> was added in version 187.</para>
+ <para><function>sd_journal_process()</function> was added in version 187.</para>
+ <para><function>sd_journal_wait()</function> was added in version 187.</para>
+ <para><function>sd_journal_reliable_fd()</function> was added in version 196.</para>
+ <para><function>sd_journal_get_events()</function> was added in version 201.</para>
+ <para><function>sd_journal_get_timeout()</function> was added in version 201.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_get_monotonic_usec()</function> was added in version 187.</para>
+ <para><function>sd_journal_get_realtime_usec()</function> was added in version 187.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_get_seqnum()</function> was added in version 254.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_get_usage()</function> was added in version 190.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_has_persistent_files()</function> was added in version 229.</para>
+ <para><function>sd_journal_has_runtime_files()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<para>
<programlisting><xi:include href="journal-iterate-foreach.c" parse="text" /></programlisting>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>SD_JOURNAL_FOREACH()</function> was added in version 187.</para>
+ <para><function>SD_JOURNAL_FOREACH_BACKWARDS()</function> was added in version 187.</para>
+ <para><function>sd_journal_next()</function> was added in version 187.</para>
+ <para><function>sd_journal_next_skip()</function> was added in version 187.</para>
+ <para><function>sd_journal_previous()</function> was added in version 187.</para>
+ <para><function>sd_journal_previous_skip()</function> was added in version 187.</para>
+ <para><function>sd_journal_step_one()</function> was added in version 254.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_close()</function> was added in version 187.</para>
+ <para><function>sd_journal_open()</function> was added in version 187.</para>
+ <para><function>sd_journal_open_directory()</function> was added in version 187.</para>
+ <para><function>sd_journal_open_files()</function> was added in version 205.</para>
+ <para><function>sd_journal_open_directory_fd()</function> was added in version 230.</para>
+ <para><function>sd_journal_open_files_fd()</function> was added in version 230.</para>
+ <para><function>sd_journal_open_namespace()</function> was added in version 245.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_print()</function> was added in version 187.</para>
+ <para><function>sd_journal_printv()</function> was added in version 187.</para>
+ <para><function>sd_journal_send()</function> was added in version 187.</para>
+ <para><function>sd_journal_sendv()</function> was added in version 187.</para>
+ <para><function>sd_journal_perror()</function> was added in version 188.</para>
+ <para><function>sd_journal_perror_with_location()</function> was added in version 246.</para>
+ <para><function>sd_journal_print_with_location()</function> was added in version 246.</para>
+ <para><function>sd_journal_printv_with_location()</function> was added in version 246.</para>
+ <para><function>sd_journal_send_with_location()</function> was added in version 246.</para>
+ <para><function>sd_journal_sendv_with_location()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<programlisting><xi:include href="journal-iterate-unique.c" parse="text" /></programlisting>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>SD_JOURNAL_FOREACH_UNIQUE()</function> was added in version 195.</para>
+ <para><function>sd_journal_enumerate_unique()</function> was added in version 195.</para>
+ <para><function>sd_journal_query_unique()</function> was added in version 195.</para>
+ <para><function>sd_journal_restart_unique()</function> was added in version 195.</para>
+ <para><function>sd_journal_enumerate_available_unique()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_seek_cursor()</function> was added in version 187.</para>
+ <para><function>sd_journal_seek_head()</function> was added in version 187.</para>
+ <para><function>sd_journal_seek_monotonic_usec()</function> was added in version 187.</para>
+ <para><function>sd_journal_seek_realtime_usec()</function> was added in version 187.</para>
+ <para><function>sd_journal_seek_tail()</function> was added in version 187.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<programlisting><xi:include href="journal-stream-fd.c" parse="text" /></programlisting>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_journal_stream_fd()</function> was added in version 187.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
</variablelist>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_listen_fds_with_names()</function> was added in version 227.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_login_monitor_get_events()</function> was added in version 201.</para>
+ <para><function>sd_login_monitor_get_timeout()</function> was added in version 201.</para>
+ <para><function>sd_login_monitor_unrefp()</function> was added in version 229.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_machine_get_class()</function> was added in version 217.</para>
+ <para><function>sd_machine_get_ifindices()</function> was added in version 217.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
</example>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_pid_notify()</function> was added in version 219.</para>
+ <para><function>sd_pid_notify_with_fds()</function> was added in version 219.</para>
+ <para><function>sd_pid_notifyf()</function> was added in version 219.</para>
+ <para><function>sd_notify_barrier()</function> was added in version 246.</para>
+ <para><function>sd_pid_notify_barrier()</function> was added in version 254.</para>
+ <para><function>sd_pid_notifyf_with_fds()</function> was added in version 254.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<para>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_path_lookup()</function> was added in version 246.</para>
+ <para><function>sd_path_lookup_strv()</function> was added in version 246.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<citerefentry><refentrytitle>getsid</refentrytitle><manvolnum>2</manvolnum></citerefentry>.</para>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_peer_get_cgroup()</function> was added in version 236.</para>
+ <para><function>sd_peer_get_machine_name()</function> was added in version 236.</para>
+ <para><function>sd_peer_get_owner_uid()</function> was added in version 236.</para>
+ <para><function>sd_peer_get_session()</function> was added in version 236.</para>
+ <para><function>sd_peer_get_slice()</function> was added in version 236.</para>
+ <para><function>sd_peer_get_unit()</function> was added in version 236.</para>
+ <para><function>sd_peer_get_user_slice()</function> was added in version 236.</para>
+ <para><function>sd_peer_get_user_unit()</function> was added in version 236.</para>
+ <para><function>sd_pid_get_cgroup()</function> was added in version 236.</para>
+ <para><function>sd_pid_get_machine_name()</function> was added in version 236.</para>
+ <para><function>sd_pid_get_owner_uid()</function> was added in version 236.</para>
+ <para><function>sd_pid_get_session()</function> was added in version 236.</para>
+ <para><function>sd_pid_get_slice()</function> was added in version 236.</para>
+ <para><function>sd_pid_get_unit()</function> was added in version 236.</para>
+ <para><function>sd_pid_get_user_slice()</function> was added in version 236.</para>
+ <para><function>sd_pid_get_user_unit()</function> was added in version 236.</para>
+ <para><function>sd_pidfd_get_cgroup()</function> was added in version 253.</para>
+ <para><function>sd_pidfd_get_machine_name()</function> was added in version 253.</para>
+ <para><function>sd_pidfd_get_owner_uid()</function> was added in version 253.</para>
+ <para><function>sd_pidfd_get_session()</function> was added in version 253.</para>
+ <para><function>sd_pidfd_get_slice()</function> was added in version 253.</para>
+ <para><function>sd_pidfd_get_unit()</function> was added in version 253.</para>
+ <para><function>sd_pidfd_get_user_slice()</function> was added in version 253.</para>
+ <para><function>sd_pidfd_get_user_unit()</function> was added in version 253.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<para>In the past, <function>sd_seat_can_multi_session()</function> was used to check whether the seat
supports multiple sessions. All seats support that now, so that function has been deprecated and always
returns true.</para>
+ <para><function>sd_seat_can_graphical()</function> was added in version 186.</para>
+ <para><function>sd_seat_can_tty()</function> was added in version 186.</para>
</refsect1>
<refsect1>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_session_get_state()</function> was added in version 186.</para>
+ <para><function>sd_session_get_tty()</function> was added in version 198.</para>
+ <para><function>sd_session_get_vt()</function> was added in version 207.</para>
+ <para><function>sd_session_get_remote_host()</function> was added in version 209.</para>
+ <para><function>sd_session_get_remote_user()</function> was added in version 209.</para>
+ <para><function>sd_session_is_remote()</function> was added in version 209.</para>
+ <para><function>sd_session_get_desktop()</function> was added in version 217.</para>
+ <para><function>sd_session_get_leader()</function> was added in version 254.</para>
+ <para><function>sd_session_get_start_time()</function> was added in version 254.</para>
+ <para><function>sd_session_get_username()</function> was added in version 254.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<xi:include href="libsystemd-pkgconfig.xml" />
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_uid_get_display()</function> was added in version 213.</para>
+ <para><function>sd_uid_get_login_time()</function> was added in version 254.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
</variablelist>
</refsect1>
+ <refsect1>
+ <title>History</title>
+ <para><function>sd_watchdog_enabled()</function> was added in version 209.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<para>
<arg choice="opt" rep="repeat">OPTIONS</arg>
<arg choice="plain">invocation-id</arg>
</cmdsynopsis>
+
+ <cmdsynopsis>
+ <command>systemd-id128</command>
+ <arg choice="opt" rep="repeat">OPTIONS</arg>
+ <arg choice="plain">show</arg>
+ <arg choice="opt" rep="repeat">NAME|UUID</arg>
+ </cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<para>With <command>boot-id</command>, the identifier of the current boot will be
printed.</para>
- <para>Both <command>machine-id</command> and <command>boot-id</command> may be combined
- with the <option>--app-specific=<replaceable>app-id</replaceable></option> switch to
- generate application-specific IDs. See
- <citerefentry><refentrytitle>sd_id128_get_machine</refentrytitle><manvolnum>3</manvolnum></citerefentry>
- for the discussion when this is useful.</para>
-
<para>With <command>invocation-id</command>, the identifier of the current service invocation
will be printed. This is available in systemd services. See
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
<para>With <command>show</command>, well-known IDs are printed (for now, only GPT partition type UUIDs),
along with brief identifier strings. When no arguments are specified, all known IDs are shown. When
- arguments are specified, they must be the identifiers or ID values of one or more known IDs, which are
- then printed. Combine with <option>--uuid</option> to list the IDs in UUID style, i.e. the way GPT
- partition type UUIDs are usually shown.</para>
+ arguments are specified, they may be the identifiers or ID values of one or more known IDs, which are
+ then printed with their name, or arbitrary IDs, which are then printed with a placeholder name. Combine
+ with <option>--uuid</option> to list the IDs in UUID style, i.e. the way GPT partition type UUIDs are
+ usually shown.</para>
+
+ <para><command>machine-id</command>, <command>boot-id</command>, and <command>show</command> may be
+ combined with the <option>--app-specific=<replaceable>app-id</replaceable></option> switch to generate
+ application-specific IDs. See
+ <citerefentry><refentrytitle>sd_id128_get_machine</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ for the discussion when this is useful. Support for <command>show --app-specific=</command> was added in
+ version 255.</para>
</refsect1>
<refsect1>
<xi:include href="version-info.xml" xpointer="v240"/></listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>-P</option></term>
+ <term><option>--value</option></term>
+
+ <listitem><para>Only print the value. May be combined with
+ <option>-u</option>/<option>--uuid</option>.</para>
+
+ <xi:include href="version-info.xml" xpointer="v255"/></listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>-a <replaceable>app-id</replaceable></option></term>
<term><option>--app-specific=<replaceable>app-id</replaceable></option></term>
- <listitem><para>With this option, an identifier that is the result of hashing the
- application identifier <replaceable>app-id</replaceable> and the machine identifier will be
- printed. The <replaceable>app-id</replaceable> argument must be a valid sd-id128 string
- identifying the application.</para>
+ <listitem><para>With this option, identifiers will be printed that are the result of hashing the
+ application identifier <replaceable>app-id</replaceable> and another ID. The
+ <replaceable>app-id</replaceable> argument must be a valid sd-id128 string identifying the
+ application. When used with <command>machine-id</command>, the other ID will be the machine ID as
+ described in
+ <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>, when
+ used with <command>boot-id</command>, the other ID will be the boot ID, and when used with
+ <command>show</command>, the other ID or IDs should be specified via the positional arguments.</para>
<xi:include href="version-info.xml" xpointer="v240"/>
</listitem>
<refsect1>
<title>Exit status</title>
- <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
+ <para>On success 0 is returned, and a non-zero failure code otherwise.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Examples</title>
+
+ <example>
+ <title>Show a well-known UUID</title>
+ <programlisting>
+$ systemd-id128 show -P user-home
+773f91ef66d449b5bd83d683bf40ad16
+
+$ systemd-id128 show -Pu user-home
+773f91ef-66d4-49b5-bd83-d683bf40ad16
+
+$ systemd-id128 show 773f91ef-66d4-49b5-bd83-d683bf40ad16
+NAME ID
+user-home 773f91ef66d449b5bd83d683bf40ad16
+ </programlisting>
+ </example>
+
+ <example>
+ <title>Generate an application-specific UUID</title>
+
+ <programlisting>
+$ systemd-id128 machine-id -u
+3a9d668b-4db7-4939-8a4a-5e78a03bffb7
+
+$ systemd-id128 new -u
+1fb8f24b-02df-458d-9659-cc8ace68e28a
+
+$ systemd-id128 --app=1fb8f24b-02df-458d-9659-cc8ace68e28a
+47b82cb1-5339-43da-b2a6-1c350aef1bd1
+
+$ systemd-id128 -Pu show 3a9d668b-4db7-4939-8a4a-5e78a03bffb7 --app=1fb8f24b-02df-458d-9659-cc8ace68e28a
+47b82cb1-5339-43da-b2a6-1c350aef1bd1
+ </programlisting>
+
+ <para>On a given machine with the ID 3a9d668b-4db7-4939-8a4a-5e78a03bffb7, for the application
+ 1fb8f24b-02df-458d-9659-cc8ace68e28a, we generate an application-specific machine ID. If we want to
+ later recreate the same calculation on a different machine, we need to specify both IDs explicitly.
+ </para>
+ </example>
</refsect1>
<refsect1>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>UsePREF64=</varname></term>
+ <listitem>
+ <para>When true, the IPv6 PREF64 (or NAT64) prefixes received in the Router Advertisement will be recorded
+ and made available to client programs and displayed in the <command>networkctl</command> status output per-link.
+ See <ulink url="https://tools.ietf.org/html/rfc8781">RFC 8781</ulink>. Defaults to false.</para>
+
+ <xi:include href="version-info.xml" xpointer="v255"/>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><varname>UseAutonomousPrefix=</varname></term>
<listitem>
3600 seconds (one hour).</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>HomeAgent=</varname></term>
+
+ <listitem><para>Takes a boolean. Specifies that IPv6 router advertisements which indicates to hosts that
+ the router acts as a Home Agent and includes a Home Agent Option. Defaults to false. See
+ <ulink url="https://tools.ietf.org/html/rfc6275">RFC 6275</ulink> for further details.</para>
+
+ <xi:include href="version-info.xml" xpointer="v255"/>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>HomeAgentLifetimeSec=</varname></term>
+
+ <listitem><para>Takes a timespan. Specifies the lifetime of the Home Agent. An integer the default unit of seconds,
+ in the range 1…65535. Defaults to the value set to <varname>RouterLifetimeSec=</varname>.</para>
+
+ <xi:include href="version-info.xml" xpointer="v255"/>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>HomeAgentPreference=</varname></term>
+
+ <listitem><para>Configures IPv6 Home Agent preference. Takes an integer in the range 0…65535.
+ Defaults to 0.</para>
+
+ <xi:include href="version-info.xml" xpointer="v255"/>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
Distribution=|centos
[Host]
-QemuMem=3G
+@QemuMem=3G
Distribution=centos
[Distribution]
-Release=9
+@Release=9
Repositories=epel
epel-next
hyperscale-packages-main
Distribution=debian
[Distribution]
-Release=testing
+@Release=testing
Distribution=fedora
[Distribution]
-Release=38
+@Release=38
Distribution=opensuse
[Distribution]
-Release=tumbleweed
+@Release=tumbleweed
MKOSI_UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1
[Host]
-Incremental=yes
-QemuMem=2G
+@Incremental=yes
+@QemuMem=2G
ExtraSearchPaths=build/
# Make sure we don't trigger systemd-firstboot prompting for the root password.
Credentials=passwd.plaintext-password.root=
Distribution=ubuntu
[Distribution]
-Release=jammy
+@Release=jammy
Repositories=universe
[Content]
Bootable=no
CleanPackageMetadata=no
+
+Packages=
Packages=
kmod
less
BaseTrees=../../mkosi.output/base
ExtraTrees=../../mkosi.output/base-systemd
MakeInitrd=yes
+Bootable=no
+BuildPackages=
+
+Packages=
Packages=
+ gzip
systemd
udev
gcc # Sanitizer libraries
gdb
grep
+ gzip
kbd
kexec-tools
less
xfsprogs
zsh
+BuildPackages=
+
[Validation]
SecureBoot=yes
SignExpectedPcr=yes
# systemctl(1) completion -*- shell-script -*-
+# vi: ft=sh
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
} | sort -u )
}
-__get_failed_units () { __systemctl $1 list-units "$2*" \
- | { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; }
-__get_enabled_units () { __systemctl $1 list-unit-files "$2*" \
- | { while read -r a b c ; do [[ $b == "enabled" ]] && echo " $a"; done; }; }
-__get_disabled_units () { __systemctl $1 list-unit-files "$2*" \
- | { while read -r a b c ; do [[ $b == "disabled" ]] && echo " $a"; done; }; }
-__get_masked_units () { __systemctl $1 list-unit-files "$2*" \
- | { while read -r a b c ; do [[ $b == "masked" ]] && echo " $a"; done; }; }
-__get_all_unit_files () { { __systemctl $1 list-unit-files "$2*"; } | { while read -r a b; do echo " $a"; done; }; }
+__get_failed_units() { __systemctl $1 list-units "$2*" \
+ | while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }
+__get_enabled_units() { __systemctl $1 list-unit-files "$2*" \
+ | while read -r a b c ; do [[ $b == "enabled" ]] && echo " $a"; done; }
+__get_disabled_units() { __systemctl $1 list-unit-files "$2*" \
+ | while read -r a b c ; do [[ $b == "disabled" ]] && echo " $a"; done; }
+__get_masked_units() { __systemctl $1 list-unit-files "$2*" \
+ | while read -r a b c ; do [[ $b == "masked" ]] && echo " $a"; done; }
+__get_all_unit_files() { __systemctl $1 list-unit-files "$2*" | while read -r a b; do echo " $a"; done; }
__get_machines() {
- local a b
- { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
- { while read a b; do echo " $a"; done; } | \
- sort -u
+ local a
+
+ while read a _; do
+ echo " $a"
+ done < <(machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null | sort -u; echo ".host")
}
_systemctl () {
local -A OPTS=(
[STANDALONE]='--all -a --reverse --after --before --defaults --force -f --full -l --global
- --help -h --no-ask-password --no-block --legend=no --no-pager --no-reload --no-wall --now
- --quiet -q --system --user --version --runtime --recursive -r --firmware-setup
- --show-types --plain --failed --value --fail --dry-run --wait --no-warn'
- [ARG]='--host -H --kill-whom --property -p --signal -s --type -t --state --job-mode --root
- --preset-mode -n --lines -o --output -M --machine --message --timestamp --check-inhibitors'
+ --help -h --no-ask-password --no-block --legend=no --no-pager --no-reload --no-wall --now
+ --quiet -q --system --user --version --runtime --recursive -r --firmware-setup
+ --show-types --plain --failed --value --fail --dry-run --wait --no-warn --with-dependencies
+ --show-transaction -T --mkdir --marked --read-only'
+ [ARG]='--host -H --kill-whom --property -p -P --signal -s --type -t --state --job-mode --root
+ --preset-mode -n --lines -o --output -M --machine --message --timestamp --check-inhibitors --what
+ --image --boot-loader-menu --boot-loader-entry --reboot-argument --drop-in'
)
if __contains_word "--user" ${COMP_WORDS[*]}; then
--host|-H)
comps=$(compgen -A hostname)
;;
- --property|-p)
+ --property|-p|-P)
comps=$(__systemd_properties)
;;
--preset-mode)
--check-inhibitors)
comps='auto yes no'
;;
+ --what)
+ comps='configuration state cache logs runtime all'
+ ;;
+ --image)
+ comps=$(compgen -A file -- "$cur")
+ compopt -o filenames
+ ;;
+ --boot-loader-entry)
+ comps=$(systemctl --boot-loader-entry=help 2>/dev/null)
+ ;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
[REENABLABLE_UNITS]='reenable'
[FAILED_UNITS]='reset-failed'
[STARTABLE_UNITS]='start'
- [STOPPABLE_UNITS]='stop condstop kill try-restart condrestart'
+ [STOPPABLE_UNITS]='stop condstop kill try-restart condrestart freeze thaw'
[ISOLATABLE_UNITS]='isolate'
[RELOADABLE_UNITS]='reload condreload try-reload-or-restart force-reload'
[RESTARTABLE_UNITS]='restart reload-or-restart'
char *strrep(const char *s, unsigned n);
+#define strrepa(s, n) \
+ ({ \
+ char *_d_, *_p_; \
+ size_t _len_ = strlen(s) * n; \
+ _p_ = _d_ = newa(char, _len_ + 1); \
+ for (unsigned _i_ = 0; _i_ < n; _i_++) \
+ _p_ = stpcpy(_p_, s); \
+ *_p_ = 0; \
+ _d_; \
+ })
+
int split_pair(const char *s, const char *sep, char **l, char **r);
int free_and_strdup(char **p, const char *s);
LOG_MESSAGE("Caught <%s>, waitpid() failed: %m", signal_to_string(sig)),
"MESSAGE_ID=" SD_MESSAGE_CRASH_WAITPID_FAILED_STR);
else if (status.si_code != CLD_DUMPED) {
- const char *s = status.si_code == CLD_EXITED
- ? exit_status_to_string(status.si_status, EXIT_STATUS_LIBC)
- : signal_to_string(status.si_status);
+ const char *s = status.si_code == CLD_EXITED ?
+ exit_status_to_string(status.si_status, EXIT_STATUS_LIBC) :
+ signal_to_string(status.si_status);
log_struct(LOG_EMERG,
LOG_MESSAGE("Caught <%s>, core dump failed (child "PID_FMT", code=%s, status=%i/%s).",
- signal_to_string(sig),
- pid,
- sigchld_code_to_string(status.si_code),
- status.si_status, strna(s)),
+ signal_to_string(sig),
+ pid,
+ sigchld_code_to_string(status.si_code),
+ status.si_status,
+ strna(s)),
"MESSAGE_ID=" SD_MESSAGE_CRASH_COREDUMP_FAILED_STR);
} else
log_struct(LOG_EMERG,
LOG_MESSAGE("Caught <%s>, dumped core as pid "PID_FMT".",
- signal_to_string(sig), pid),
+ signal_to_string(sig), pid),
"MESSAGE_ID=" SD_MESSAGE_CRASH_COREDUMP_PID_STR);
}
}
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
+#include "initrd-util.h"
#include "install.h"
#include "log.h"
#include "manager-dump.h"
if (!path_is_valid(root))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
"New root directory must be a valid path.");
+
if (!path_is_absolute(root))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
"New root path '%s' is not absolute.", root);
- if (path_equal(root, "/"))
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
- "New root directory cannot be the old root directory.");
- }
- /* Safety check */
- if (isempty(init)) {
- r = path_is_os_tree(root);
+ r = path_is_root(root);
if (r < 0)
return sd_bus_error_set_errnof(error, r,
- "Failed to determine whether root path '%s' contains an OS tree: %m",
+ "Failed to check if new root directory '%s' is the same as old root: %m",
root);
- if (r == 0)
+ if (r > 0)
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
- "Specified switch root path '%s' does not seem to be an OS tree. os-release file is missing.",
- root);
- } else {
+ "New root directory cannot be the old root directory.");
+ }
+
+ /* Safety check */
+ if (!in_initrd())
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
+ "Not in initrd, refusing switch-root operation.");
+
+ r = path_is_os_tree(root);
+ if (r < 0)
+ return sd_bus_error_set_errnof(error, r,
+ "Failed to determine whether root path '%s' contains an OS tree: %m",
+ root);
+ if (r == 0)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
+ "Specified switch root path '%s' does not seem to be an OS tree. os-release file is missing.",
+ root);
+
+ if (!isempty(init)) {
if (!path_is_valid(init))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
"Path to init binary '%s' is not a valid path.", init);
return 0;
}
-static int set_machine_id(const char *m) {
- sd_id128_t t;
- assert(m);
-
- if (sd_id128_from_string(m, &t) < 0)
- return -EINVAL;
-
- if (sd_id128_is_null(t))
- return -EINVAL;
-
- arg_machine_id = t;
- return 0;
-}
-
static int parse_proc_cmdline_item(const char *key, const char *value, void *data) {
int r;
if (proc_cmdline_value_missing(key, value))
return 0;
- r = set_machine_id(value);
+ r = id128_from_string_nonzero(value, &arg_machine_id);
if (r < 0)
log_warning_errno(r, "MachineID '%s' is not valid, ignoring: %m", value);
break;
case ARG_MACHINE_ID:
- r = set_machine_id(optarg);
+ r = id128_from_string_nonzero(optarg, &arg_machine_id);
if (r < 0)
return log_error_errno(r, "MachineID '%s' is not valid: %m", optarg);
break;
r = switch_root(/* new_root= */ switch_root_dir,
/* old_root_after= */ NULL,
/* flags= */ (objective == MANAGER_SWITCH_ROOT ? SWITCH_ROOT_DESTROY_OLD_ROOT : 0) |
- (objective == MANAGER_SOFT_REBOOT ? SWITCH_ROOT_SKIP_RECURSIVE_RUN : 0));
+ (objective == MANAGER_SOFT_REBOOT ? 0 : SWITCH_ROOT_RECURSIVE_RUN));
if (r < 0)
log_error_errno(r, "Failed to switch root, trying to continue: %m");
}
#include "uki.h"
const char* const unified_sections[_UNIFIED_SECTION_MAX + 1] = {
+ /* These section names must fit in 8ch (excluding any trailing NUL) as per PE spec for executables:
+ * https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#section-table-section-headers
+ * (Note that PE *object* files may have longer section names (via indirection in the string table) but
+ * this is not allowed for PE *executables*, which UKIs are.) */
[UNIFIED_SECTION_LINUX] = ".linux",
[UNIFIED_SECTION_OSREL] = ".osrel",
[UNIFIED_SECTION_CMDLINE] = ".cmdline",
static Id128PrettyPrintMode arg_mode = ID128_PRINT_ID128;
static sd_id128_t arg_app = {};
+static bool arg_value = false;
static int verb_new(int argc, char **argv, void *userdata) {
return id128_print_new(arg_mode);
}
static int show_one(Table **table, const char *name, sd_id128_t uuid, bool first) {
+ sd_id128_t u;
int r;
+ assert(table);
+
+ if (sd_id128_is_null(arg_app))
+ u = uuid;
+ else
+ assert_se(sd_id128_get_app_specific(uuid, arg_app, &u) == 0);
+
if (arg_mode == ID128_PRINT_PRETTY) {
_cleanup_free_ char *id = NULL;
ascii_strupper(id);
- r = id128_pretty_print_sample(id, uuid);
+ r = id128_pretty_print_sample(id, u);
if (r < 0)
return r;
if (!first)
puts("");
return 0;
+ }
- } else {
- if (!*table) {
- *table = table_new("name", "id");
- if (!*table)
- return log_oom();
- table_set_width(*table, 0);
- }
+ if (arg_value)
+ return id128_pretty_print(u, arg_mode);
- return table_add_many(*table,
- TABLE_STRING, name,
- arg_mode == ID128_PRINT_ID128 ? TABLE_ID128 : TABLE_UUID,
- uuid);
+ if (!*table) {
+ *table = table_new("name", "id");
+ if (!*table)
+ return log_oom();
+ table_set_width(*table, 0);
}
+
+ return table_add_many(*table,
+ TABLE_STRING, name,
+ arg_mode == ID128_PRINT_ID128 ? TABLE_ID128 : TABLE_UUID,
+ u);
}
static int verb_show(int argc, char **argv, void *userdata) {
" machine-id Print the ID of current machine\n"
" boot-id Print the ID of current boot\n"
" invocation-id Print the ID of current invocation\n"
- " show [NAME] Print one or more well-known GPT partition type IDs\n"
+ " show [NAME|UUID] Print one or more UUIDs\n"
" help Show this help\n"
"\nOptions:\n"
" -h --help Show this help\n"
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "pretty", no_argument, NULL, 'p' },
+ { "value", no_argument, NULL, 'P' },
{ "app-specific", required_argument, NULL, 'a' },
{ "uuid", no_argument, NULL, 'u' },
{},
assert(argc >= 0);
assert(argv);
- while ((c = getopt_long(argc, argv, "hpa:u", options, NULL)) >= 0)
+ while ((c = getopt_long(argc, argv, "hpa:uP", options, NULL)) >= 0)
switch (c) {
case 'h':
case 'p':
arg_mode = ID128_PRINT_PRETTY;
+ arg_value = false;
+ break;
+
+ case 'P':
+ arg_value = true;
+ if (arg_mode == ID128_PRINT_PRETTY)
+ arg_mode = ID128_PRINT_ID128;
break;
case 'a':
- r = sd_id128_from_string(optarg, &arg_app);
+ r = id128_from_string_nonzero(optarg, &arg_app);
+ if (r == -ENXIO)
+ return log_error_errno(r, "Application ID cannot be all zeros.");
if (r < 0)
return log_error_errno(r, "Failed to parse \"%s\" as application-ID: %m", optarg);
break;
default_noarg:
arg_lines = 10;
+ arg_lines_oldest = false;
return 0;
}
log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Realtime clock jumped backwards relative to last journal entry, rotating.", f->path);
return true;
- case -EREMOTE: /* Boot ID different from the one of the last entry */
- log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Boot ID changed since last record, rotating.", f->path);
- return true;
-
- case -ENOTNAM: /* Monotonic time (CLOCK_MONOTONIC) jumped backwards relative to last journal entry */
- log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Monotonic clock jumped backwards relative to last journal entry, rotating.", f->path);
+ case -ENOTNAM: /* Monotonic time (CLOCK_MONOTONIC) jumped backwards relative to last journal entry with the same boot ID */
+ log_ratelimit_info_errno(
+ r,
+ JOURNAL_LOG_RATELIMIT,
+ "%s: Monotonic clock jumped backwards relative to last journal entry with the same boot ID, rotating.",
+ f->path);
return true;
case -EILSEQ: /* seqnum ID last used in the file doesn't match the one we'd passed when writing an entry to it */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "sd-dhcp-client.h"
+
extern const struct hash_ops dhcp_option_hash_ops;
+
+int dhcp_client_set_state_callback(
+ sd_dhcp_client *client,
+ sd_dhcp_client_callback_t cb,
+ void *userdata);
+int dhcp_client_get_state(sd_dhcp_client *client);
#include "sd-dhcp-client.h"
+#include "dhcp-client-internal.h"
#include "dhcp-protocol.h"
#include "ether-addr-util.h"
#include "network-common.h"
size_t size;
} DHCPServerData;
-extern const struct hash_ops dhcp_option_hash_ops;
-
typedef struct sd_dhcp_client sd_dhcp_client;
int dhcp_network_bind_raw_socket(
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "dhcp-protocol.h"
+#include "string-table.h"
+
+static const char* const dhcp_state_table[_DHCP_STATE_MAX] = {
+ [DHCP_STATE_STOPPED] = "stopped",
+ [DHCP_STATE_INIT] = "initialization",
+ [DHCP_STATE_SELECTING] = "selecting",
+ [DHCP_STATE_INIT_REBOOT] = "init-reboot",
+ [DHCP_STATE_REBOOTING] = "rebooting",
+ [DHCP_STATE_REQUESTING] = "requesting",
+ [DHCP_STATE_BOUND] = "bound",
+ [DHCP_STATE_RENEWING] = "renewing",
+ [DHCP_STATE_REBINDING] = "rebinding",
+};
+
+DEFINE_STRING_TABLE_LOOKUP_TO_STRING(dhcp_state, DHCPState);
};
enum DHCPState {
- DHCP_STATE_STOPPED = 0,
- DHCP_STATE_INIT = 1,
- DHCP_STATE_SELECTING = 2,
- DHCP_STATE_INIT_REBOOT = 3,
- DHCP_STATE_REBOOTING = 4,
- DHCP_STATE_REQUESTING = 5,
- DHCP_STATE_BOUND = 6,
- DHCP_STATE_RENEWING = 7,
- DHCP_STATE_REBINDING = 8,
+ DHCP_STATE_STOPPED,
+ DHCP_STATE_INIT,
+ DHCP_STATE_SELECTING,
+ DHCP_STATE_INIT_REBOOT,
+ DHCP_STATE_REBOOTING,
+ DHCP_STATE_REQUESTING,
+ DHCP_STATE_BOUND,
+ DHCP_STATE_RENEWING,
+ DHCP_STATE_REBINDING,
+ _DHCP_STATE_MAX,
+ _DHCP_STATE_INVALID = -EINVAL,
};
typedef enum DHCPState DHCPState;
DHCP_FQDN_FLAG_E = (1 << 2),
DHCP_FQDN_FLAG_N = (1 << 3),
};
+
+const char *dhcp_state_to_string(DHCPState s) _const_;
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "sd-dhcp6-client.h"
+
+int dhcp6_client_set_state_callback(
+ sd_dhcp6_client *client,
+ sd_dhcp6_client_callback_t cb,
+ void *userdata);
+int dhcp6_client_get_state(sd_dhcp6_client *client);
#include "sd-dhcp6-client.h"
#include "dhcp-identifier.h"
+#include "dhcp6-client-internal.h"
#include "dhcp6-option.h"
#include "dhcp6-protocol.h"
#include "ether-addr-util.h"
sd_dhcp6_client_callback_t callback;
void *userdata;
+ sd_dhcp6_client_callback_t state_callback;
+ void *state_userdata;
bool send_release;
/* Ignore machine-ID when generating DUID. See dhcp_identifier_set_duid_en(). */
#include "alloc-util.h"
#include "fd-util.h"
#include "fuzz.h"
-#include "icmp6-util.h"
+#include "icmp6-util-unix.h"
#include "ndisc-internal.h"
#include "socket-util.h"
-static int test_fd[2] = PIPE_EBADF;
-
-int icmp6_bind_router_solicitation(int index) {
- assert_se(socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) >= 0);
- return test_fd[0];
-}
-
-int icmp6_bind_router_advertisement(int index) {
- return -ENOSYS;
-}
-
-int icmp6_receive(int fd, void *iov_base, size_t iov_len,
- struct in6_addr *dst, triple_timestamp *timestamp) {
- assert_se(read(fd, iov_base, iov_len) == (ssize_t) iov_len);
-
- if (timestamp)
- triple_timestamp_get(timestamp);
-
- return 0;
-}
-
-int icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr) {
- return 0;
-}
-
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
struct ether_addr mac_addr = {
.ether_addr_octet = {'A', 'B', 'C', '1', '2', '3'}
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include <netinet/ip6.h>
+#include <unistd.h>
+
+#include "fd-util.h"
+#include "icmp6-util-unix.h"
+
+send_ra_t send_ra_function = NULL;
+int test_fd[2] = PIPE_EBADF;
+
+static struct in6_addr dummy_link_local = {
+ .s6_addr = {
+ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x12, 0x34, 0x56, 0xff, 0xfe, 0x78, 0x9a, 0xbc,
+ },
+};
+
+int icmp6_bind_router_solicitation(int ifindex) {
+ if (socketpair(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) < 0)
+ return -errno;
+
+ return test_fd[0];
+}
+
+int icmp6_bind_router_advertisement(int ifindex) {
+ return test_fd[1];
+}
+
+int icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr) {
+ if (!send_ra_function)
+ return 0;
+
+ return send_ra_function(0);
+}
+
+int icmp6_receive(
+ int fd,
+ void *iov_base,
+ size_t iov_len,
+ struct in6_addr *ret_sender,
+ triple_timestamp *ret_timestamp) {
+
+ assert_se(read (fd, iov_base, iov_len) == (ssize_t) iov_len);
+
+ if (ret_timestamp)
+ triple_timestamp_get(ret_timestamp);
+
+ if (ret_sender)
+ *ret_sender = dummy_link_local;
+
+ return 0;
+}
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "icmp6-util.h"
+
+typedef int (*send_ra_t)(uint8_t flags);
+
+extern send_ra_t send_ra_function;
+extern int test_fd[2];
return 0;
}
-int icmp6_receive(int fd, void *buffer, size_t size, struct in6_addr *ret_dst,
- triple_timestamp *ret_timestamp) {
+int icmp6_receive(
+ int fd,
+ void *buffer,
+ size_t size,
+ struct in6_addr *ret_sender,
+ triple_timestamp *ret_timestamp) {
/* This needs to be initialized with zero. See #20741. */
CMSG_BUFFER_TYPE(CMSG_SPACE(sizeof(int)) + /* ttl */
sa.in6.sin6_family == AF_INET6) {
addr = sa.in6.sin6_addr;
- if (!in6_addr_is_link_local(&addr))
+ if (!in6_addr_is_link_local(&addr) && !in6_addr_is_null(&addr))
return -EADDRNOTAVAIL;
} else if (msg.msg_namelen > 0)
}
}
- if (!triple_timestamp_is_set(&t))
- triple_timestamp_get(&t);
+ if (ret_timestamp) {
+ if (triple_timestamp_is_set(&t))
+ *ret_timestamp = t;
+ else
+ triple_timestamp_get(ret_timestamp);
+ }
- *ret_dst = addr;
- *ret_timestamp = t;
+ if (ret_sender)
+ *ret_sender = addr;
return 0;
}
int icmp6_bind_router_solicitation(int ifindex);
int icmp6_bind_router_advertisement(int ifindex);
int icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr);
-int icmp6_receive(int fd, void *buffer, size_t size, struct in6_addr *ret_dst,
- triple_timestamp *ret_timestamp);
+int icmp6_receive(
+ int fd,
+ void *buffer,
+ size_t size,
+ struct in6_addr *ret_sender,
+ triple_timestamp *ret_timestamp);
'dhcp-network.c',
'dhcp-option.c',
'dhcp-packet.c',
+ 'dhcp-protocol.c',
'dhcp6-network.c',
'dhcp6-option.c',
'dhcp6-protocol.c',
'icmp6-util.c',
'lldp-neighbor.c',
'lldp-network.c',
+ 'ndisc-protocol.c',
'ndisc-router.c',
'network-common.c',
'network-internal.c',
'sources' : files('test-lldp-rx.c'),
},
network_test_template + {
- 'sources' : files('test-ndisc-ra.c'),
+ 'sources' : files(
+ 'test-ndisc-ra.c',
+ 'icmp6-util-unix.c',
+ ),
},
network_test_template + {
- 'sources' : files('test-ndisc-rs.c'),
+ 'sources' : files(
+ 'test-ndisc-rs.c',
+ 'icmp6-util-unix.c',
+ ),
},
network_test_template + {
'sources' : files('test-sd-dhcp-lease.c'),
'sources' : files('fuzz-lldp-rx.c'),
},
network_fuzz_template + {
- 'sources' : files('fuzz-ndisc-rs.c'),
+ 'sources' : files(
+ 'fuzz-ndisc-rs.c',
+ 'icmp6-util-unix.c',
+ ),
},
]
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "ndisc-protocol.h"
+
+static const uint8_t prefix_length_code_to_prefix_length[_PREFIX_LENGTH_CODE_MAX] = {
+ [PREFIX_LENGTH_CODE_96] = 96,
+ [PREFIX_LENGTH_CODE_64] = 64,
+ [PREFIX_LENGTH_CODE_56] = 56,
+ [PREFIX_LENGTH_CODE_48] = 48,
+ [PREFIX_LENGTH_CODE_40] = 40,
+ [PREFIX_LENGTH_CODE_32] = 32,
+};
+
+int pref64_plc_to_prefix_length(uint16_t plc, uint8_t *ret) {
+ plc &= PREF64_PLC_MASK;
+ if (plc >= _PREFIX_LENGTH_CODE_MAX)
+ return -EINVAL;
+
+ if (ret)
+ *ret = prefix_length_code_to_prefix_length[plc];
+ return 0;
+}
+
+int pref64_prefix_length_to_plc(uint8_t prefixlen, uint8_t *ret) {
+ assert(ret);
+
+ for (size_t i = 0; i < ELEMENTSOF(prefix_length_code_to_prefix_length); i++)
+ if (prefix_length_code_to_prefix_length[i] == prefixlen) {
+ *ret = i;
+ return 0;
+ }
+
+ return -EINVAL;
+}
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "time-util.h"
+
+/* RFC 8781: PREF64 or (NAT64 prefix) */
+#define PREF64_SCALED_LIFETIME_MASK 0xfff8
+#define PREF64_PLC_MASK 0x0007
+#define PREF64_MAX_LIFETIME_USEC (65528 * USEC_PER_SEC)
+
+typedef enum PrefixLengthCode {
+ PREFIX_LENGTH_CODE_96,
+ PREFIX_LENGTH_CODE_64,
+ PREFIX_LENGTH_CODE_56,
+ PREFIX_LENGTH_CODE_48,
+ PREFIX_LENGTH_CODE_40,
+ PREFIX_LENGTH_CODE_32,
+ _PREFIX_LENGTH_CODE_MAX,
+ _PREFIX_LENGTH_CODE_INVALID = -EINVAL,
+} PrefixLengthCode;
+
+/* rfc8781: section 4 - Scaled Lifetime: 13-bit unsigned integer. PREFIX_LEN (Prefix Length Code): 3-bit unsigned integer */
+struct nd_opt_prefix64_info {
+ uint8_t type;
+ uint8_t length;
+ uint16_t lifetime_and_plc;
+ uint8_t prefix[12];
+} __attribute__((__packed__));
+
+int pref64_plc_to_prefix_length(uint16_t plc, uint8_t *ret);
+int pref64_prefix_length_to_plc(uint8_t prefixlen, uint8_t *ret);
#include "memory-util.h"
#include "missing_network.h"
#include "ndisc-internal.h"
+#include "ndisc-protocol.h"
#include "ndisc-router.h"
#include "strv.h"
return 0;
}
+static bool pref64_option_verify(const struct nd_opt_prefix64_info *p, size_t length) {
+ uint16_t lifetime_and_plc;
+
+ assert(p);
+
+ if (length != sizeof(struct nd_opt_prefix64_info))
+ return false;
+
+ lifetime_and_plc = be16toh(p->lifetime_and_plc);
+ if (pref64_plc_to_prefix_length(lifetime_and_plc, NULL) < 0)
+ return false;
+
+ return true;
+}
+
int ndisc_router_parse(sd_ndisc *nd, sd_ndisc_router *rt) {
struct nd_router_advert *a;
const uint8_t *p;
"DNSSL option has invalid size.");
break;
- }
+ case SD_NDISC_OPTION_PREF64: {
+ if (!pref64_option_verify((struct nd_opt_prefix64_info *) p, length))
+ log_ndisc_errno(nd, SYNTHETIC_ERRNO(EBADMSG),
+ "PREF64 prefix has invalid prefix length.");
+ break;
+ }}
p += length, left -= length;
}
return 0;
}
+
+static int get_pref64_prefix_info(sd_ndisc_router *rt, struct nd_opt_prefix64_info **ret) {
+ struct nd_opt_prefix64_info *ri;
+ size_t length;
+ int r;
+
+ assert(rt);
+ assert(ret);
+
+ r = sd_ndisc_router_option_is_type(rt, SD_NDISC_OPTION_PREF64);
+ if (r < 0)
+ return r;
+ if (r == 0)
+ return -EMEDIUMTYPE;
+
+ length = NDISC_ROUTER_OPTION_LENGTH(rt);
+ if (length != sizeof(struct nd_opt_prefix64_info))
+ return -EBADMSG;
+
+ ri = (struct nd_opt_prefix64_info *) ((uint8_t*) NDISC_ROUTER_RAW(rt) + rt->rindex);
+ if (!pref64_option_verify(ri, length))
+ return -EBADMSG;
+
+ *ret = ri;
+ return 0;
+}
+
+int sd_ndisc_router_prefix64_get_prefix(sd_ndisc_router *rt, struct in6_addr *ret_addr) {
+ struct nd_opt_prefix64_info *pi;
+ struct in6_addr a = {};
+ unsigned prefixlen;
+ int r;
+
+ assert_return(rt, -EINVAL);
+ assert_return(ret_addr, -EINVAL);
+
+ r = get_pref64_prefix_info(rt, &pi);
+ if (r < 0)
+ return r;
+
+ r = sd_ndisc_router_prefix64_get_prefixlen(rt, &prefixlen);
+ if (r < 0)
+ return r;
+
+ memcpy(&a, pi->prefix, sizeof(pi->prefix));
+ in6_addr_mask(&a, prefixlen);
+ /* extra safety check for refusing malformed prefix. */
+ if (memcmp(&a, pi->prefix, sizeof(pi->prefix)) != 0)
+ return -EBADMSG;
+
+ *ret_addr = a;
+ return 0;
+}
+
+int sd_ndisc_router_prefix64_get_prefixlen(sd_ndisc_router *rt, unsigned *ret) {
+ struct nd_opt_prefix64_info *pi;
+ uint16_t lifetime_prefix_len;
+ uint8_t prefix_len;
+ int r;
+
+ assert_return(rt, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ r = get_pref64_prefix_info(rt, &pi);
+ if (r < 0)
+ return r;
+
+ lifetime_prefix_len = be16toh(pi->lifetime_and_plc);
+ pref64_plc_to_prefix_length(lifetime_prefix_len, &prefix_len);
+
+ *ret = prefix_len;
+ return 0;
+}
+
+int sd_ndisc_router_prefix64_get_lifetime_sec(sd_ndisc_router *rt, uint16_t *ret) {
+ struct nd_opt_prefix64_info *pi;
+ uint16_t lifetime_prefix_len;
+ int r;
+
+ assert_return(rt, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ r = get_pref64_prefix_info(rt, &pi);
+ if (r < 0)
+ return r;
+
+ lifetime_prefix_len = be16toh(pi->lifetime_and_plc);
+
+ *ret = lifetime_prefix_len & PREF64_SCALED_LIFETIME_MASK;
+ return 0;
+}
Copyright © 2017 Intel Corporation. All rights reserved.
***/
+#include <netinet/icmp6.h>
+
#include "sd-radv.h"
#include "list.h"
+#include "ndisc-protocol.h"
#include "network-common.h"
#include "sparse-endian.h"
#include "time-util.h"
/* Pref64 option type (RFC8781, section 4) */
#define RADV_OPT_PREF64 38
+/* rfc6275 7.4 Neighbor Discovery Home Agent Lifetime.
+ * The default value is the same as the Router Lifetime
+ * The maximum value corresponds to 18.2 hours. value of 0 MUST NOT be used.*/
+#define RADV_MAX_HOME_AGENT_LIFETIME_USEC (65535 * USEC_PER_SEC)
+
enum RAdvState {
RADV_STATE_IDLE = 0,
RADV_STATE_ADVERTISING = 1,
size_t n_rdnss;
struct sd_radv_opt_dns *rdnss;
struct sd_radv_opt_dns *dnssl;
+
+ /* Mobile IPv6 extension: Home Agent Info. */
+ struct nd_opt_home_agent_info home_agent;
};
#define radv_prefix_opt__contents { \
usec_t valid_until;
};
-/* rfc8781: section 4 - Scaled Lifetime: 13-bit unsigned integer. PLC (Prefix Length Code): 3-bit unsigned integer */
-#define radv_pref64_prefix_opt__contents { \
- uint8_t type; \
- uint8_t length; \
- uint16_t lifetime_and_plc; \
- uint8_t prefix[12]; \
-}
-
-struct radv_pref64_prefix_opt radv_pref64_prefix_opt__contents;
-
-struct radv_pref64_prefix_opt__packed radv_pref64_prefix_opt__contents _packed_;
-assert_cc(sizeof(struct radv_pref64_prefix_opt) == sizeof(struct radv_pref64_prefix_opt__packed));
-
struct sd_radv_pref64_prefix {
unsigned n_ref;
- struct radv_pref64_prefix_opt opt;
+ struct nd_opt_prefix64_info opt;
struct in6_addr in6_addr;
uint8_t prefixlen;
sd_event_source *timeout_expire;
sd_dhcp_client_callback_t callback;
void *userdata;
+ sd_dhcp_client_callback_t state_callback;
+ void *state_userdata;
sd_dhcp_lease *lease;
usec_t start_delay;
int ip_service_type;
return 0;
}
+int dhcp_client_set_state_callback(
+ sd_dhcp_client *client,
+ sd_dhcp_client_callback_t cb,
+ void *userdata) {
+
+ assert_return(client, -EINVAL);
+
+ client->state_callback = cb;
+ client->state_userdata = userdata;
+
+ return 0;
+}
+
int sd_dhcp_client_set_callback(
sd_dhcp_client *client,
sd_dhcp_client_callback_t cb,
return 0;
}
+int sd_dhcp_client_get_lease_timestamp(sd_dhcp_client *client, uint64_t *timestamp) {
+ assert_return(client, -EINVAL);
+
+ if (!IN_SET(client->state, DHCP_STATE_BOUND, DHCP_STATE_RENEWING, DHCP_STATE_REBINDING))
+ return -ENODATA;
+
+ if(timestamp)
+ *timestamp = client->request_sent;
+
+ return 0;
+}
+
int sd_dhcp_client_set_service_type(sd_dhcp_client *client, int type) {
assert_return(client, -EINVAL);
assert_return(!sd_dhcp_client_is_running(client), -EBUSY);
return 0;
}
+static void client_set_state(sd_dhcp_client *client, DHCPState state) {
+ assert(client);
+
+ if (client->state == state)
+ return;
+
+ log_dhcp_client(client, "State changed: %s -> %s",
+ dhcp_state_to_string(client->state), dhcp_state_to_string(state));
+
+ client->state = state;
+
+ if (client->state_callback)
+ client->state_callback(client, state, client->state_userdata);
+}
+
+int dhcp_client_get_state(sd_dhcp_client *client) {
+ assert_return(client, -EINVAL);
+
+ return client->state;
+}
+
static int client_notify(sd_dhcp_client *client, int event) {
assert(client);
client->attempt = 0;
- client->state = DHCP_STATE_STOPPED;
+ client_set_state(client, DHCP_STATE_STOPPED);
client->xid = 0;
client->lease = sd_dhcp_lease_unref(client->lease);
case DHCP_STATE_REBOOTING:
case DHCP_STATE_BOUND:
case DHCP_STATE_STOPPED:
+ default:
return -EINVAL;
}
case DHCP_STATE_INIT:
r = client_send_discover(client);
if (r >= 0) {
- client->state = DHCP_STATE_SELECTING;
+ client_set_state(client, DHCP_STATE_SELECTING);
client->attempt = 0;
} else if (client->attempt >= client->max_attempts)
goto error;
goto error;
if (client->state == DHCP_STATE_INIT_REBOOT)
- client->state = DHCP_STATE_REBOOTING;
+ client_set_state(client, DHCP_STATE_REBOOTING);
client->request_sent = time_now;
break;
break;
case DHCP_STATE_STOPPED:
+ default:
r = -EINVAL;
goto error;
}
client->receive_message = sd_event_source_disable_unref(client->receive_message);
client->fd = safe_close(client->fd);
- client->state = DHCP_STATE_REBINDING;
+ client_set_state(client, DHCP_STATE_REBINDING);
client->attempt = 0;
r = dhcp_network_bind_raw_socket(client->ifindex, &client->link, client->xid,
DHCP_CLIENT_DONT_DESTROY(client);
if (client->lease)
- client->state = DHCP_STATE_RENEWING;
+ client_set_state(client, DHCP_STATE_RENEWING);
else if (client->state != DHCP_STATE_INIT)
- client->state = DHCP_STATE_INIT_REBOOT;
+ client_set_state(client, DHCP_STATE_INIT_REBOOT);
client->attempt = 0;
return client_initialize_time_events(client);
if (r < 0)
goto error;
- client->state = DHCP_STATE_REQUESTING;
+ client_set_state(client, DHCP_STATE_REQUESTING);
client->attempt = 0;
r = event_reset_time(client->event, &client->timeout_resend,
client->receive_message = sd_event_source_disable_unref(client->receive_message);
client->fd = safe_close(client->fd);
- client->state = DHCP_STATE_BOUND;
+ client_set_state(client, DHCP_STATE_BOUND);
client->attempt = 0;
client->last_addr = client->lease->address;
client->start_delay = 0;
client->attempt = 1;
- client->state = DHCP_STATE_RENEWING;
+ client_set_state(client, DHCP_STATE_RENEWING);
return client_initialize_time_events(client);
}
the client MAY issue a DHCPREQUEST to try to reclaim the current
address. */
if (client->last_addr && !client->anonymize)
- client->state = DHCP_STATE_INIT_REBOOT;
+ client_set_state(client, DHCP_STATE_INIT_REBOOT);
r = client_start(client);
if (r >= 0)
DHCP_CLIENT_DONT_DESTROY(client);
client_stop(client, SD_DHCP_CLIENT_EVENT_STOP);
- client->state = DHCP_STATE_STOPPED;
return 0;
}
return 0;
}
+int dhcp6_client_set_state_callback(
+ sd_dhcp6_client *client,
+ sd_dhcp6_client_callback_t cb,
+ void *userdata) {
+
+ assert_return(client, -EINVAL);
+
+ client->state_callback = cb;
+ client->state_userdata = userdata;
+
+ return 0;
+}
+
int sd_dhcp6_client_set_ifindex(sd_dhcp6_client *client, int ifindex) {
assert_return(client, -EINVAL);
assert_return(!sd_dhcp6_client_is_running(client), -EBUSY);
dhcp6_state_to_string(client->state), dhcp6_state_to_string(state));
client->state = state;
+
+ if (client->state_callback)
+ client->state_callback(client, state, client->state_userdata);
+}
+
+int dhcp6_client_get_state(sd_dhcp6_client *client) {
+ assert_return(client, -EINVAL);
+
+ return client->state;
}
static void client_notify(sd_dhcp6_client *client, int event) {
if (r < 0)
switch (r) {
case -EADDRNOTAVAIL:
- log_ndisc(nd, "Received RA from non-link-local address %s. Ignoring.",
- IN6_ADDR_TO_STRING(&rt->address));
+ log_ndisc(nd, "Received RA from neither link-local nor null address. Ignoring.");
return 0;
case -EMULTIHOP:
return 0;
}
+ /* The function icmp6_receive() accepts the null source address, but RFC 4861 Section 6.1.2 states
+ * that hosts MUST discard messages with the null source address. */
+ if (in6_addr_is_null(&rt->address))
+ log_ndisc(nd, "Received RA from null address. Ignoring.");
+
(void) event_source_disable(nd->timeout_event_source);
(void) ndisc_handle_datagram(nd, rt);
return 0;
if (ra->dnssl)
iov[msg.msg_iovlen++] = IOVEC_MAKE(ra->dnssl, ra->dnssl->length * 8);
+ if (FLAGS_SET(ra->flags, ND_RA_FLAG_HOME_AGENT)) {
+ ra->home_agent.nd_opt_home_agent_info_type = ND_OPT_HOME_AGENT_INFO;
+ ra->home_agent.nd_opt_home_agent_info_len = 1;
+
+ /* 0 means to place the current Router Lifetime value */
+ if (ra->home_agent.nd_opt_home_agent_info_lifetime == 0)
+ ra->home_agent.nd_opt_home_agent_info_lifetime = adv.nd_ra_router_lifetime;
+
+ iov[msg.msg_iovlen++] = IOVEC_MAKE(&ra->home_agent, sizeof(ra->home_agent));
+ }
+
if (sendmsg(ra->fd, &msg, 0) < 0)
return -errno;
if (r < 0)
switch (r) {
case -EADDRNOTAVAIL:
- log_radv(ra, "Received RS from non-link-local address %s. Ignoring",
- IN6_ADDR_TO_STRING(&src));
+ log_radv(ra, "Received RS from neither link-local nor null address. Ignoring");
return 0;
case -EMULTIHOP:
return 0;
}
+ /* TODO: if the sender address is null, check that the message does not have the source link-layer
+ * address option. See RFC 4861 Section 6.1.1. */
+
const char *addr = IN6_ADDR_TO_STRING(&src);
r = radv_send(ra, &src, ra->lifetime_usec);
return 0;
}
+int sd_radv_set_home_agent_information(sd_radv *ra, int home_agent) {
+ assert_return(ra, -EINVAL);
+
+ if (ra->state != RADV_STATE_IDLE)
+ return -EBUSY;
+
+ SET_FLAG(ra->flags, ND_RA_FLAG_HOME_AGENT, home_agent);
+
+ return 0;
+}
+
+int sd_radv_set_home_agent_preference(sd_radv *ra, uint16_t preference) {
+ assert_return(ra, -EINVAL);
+
+ if (ra->state != RADV_STATE_IDLE)
+ return -EBUSY;
+
+ ra->home_agent.nd_opt_home_agent_info_preference = htobe16(preference);
+
+ return 0;
+}
+
+int sd_radv_set_home_agent_lifetime(sd_radv *ra, uint16_t lifetime) {
+ assert_return(ra, -EINVAL);
+
+ if (ra->state != RADV_STATE_IDLE)
+ return -EBUSY;
+
+ ra->home_agent.nd_opt_home_agent_info_lifetime = htobe16(lifetime);
+
+ return 0;
+}
+
int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p) {
sd_radv_prefix *found = NULL;
int r;
uint16_t pref64_lifetime;
uint8_t prefixlen_code;
+ int r;
assert_return(p, -EINVAL);
assert_return(prefix, -EINVAL);
- switch (prefixlen) {
- case 96:
- prefixlen_code = 0;
- break;
- case 64:
- prefixlen_code = 1;
- break;
- case 56:
- prefixlen_code = 2;
- break;
- case 48:
- prefixlen_code = 3;
- break;
- case 40:
- prefixlen_code = 4;
- break;
- case 32:
- prefixlen_code = 5;
- break;
- default:
- log_radv(NULL, "Unsupported PREF64 prefix length %u. Valid lengths are 32, 40, 48, 56, 64 and 96", prefixlen);
- return -EINVAL;
- }
+ r = pref64_prefix_length_to_plc(prefixlen, &prefixlen_code);
+ if (r < 0)
+ return log_radv_errno(NULL, r, "Unsupported PREF64 prefix length %u. Valid lengths are 32, 40, 48, 56, 64 and 96", prefixlen);
if (lifetime_usec == USEC_INFINITY || DIV_ROUND_UP(lifetime_usec, 8 * USEC_PER_SEC) >= UINT64_C(1) << 13)
return -EINVAL;
#include "alloc-util.h"
#include "hexdecoct.h"
-#include "icmp6-util.h"
+#include "icmp6-util-unix.h"
#include "socket-util.h"
#include "strv.h"
#include "tests.h"
};
static bool test_stopped;
-static int test_fd[2];
static struct {
struct in6_addr address;
unsigned char prefixlen;
assert_se(!ra);
}
-int icmp6_bind_router_solicitation(int ifindex) {
- return -ENOSYS;
-}
-
-int icmp6_bind_router_advertisement(int ifindex) {
- assert_se(ifindex == 42);
-
- return test_fd[1];
-}
-
-int icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr) {
-
- return 0;
-}
-
-int icmp6_receive(int fd, void *iov_base, size_t iov_len,
- struct in6_addr *dst, triple_timestamp *timestamp) {
- assert_se(read (fd, iov_base, iov_len) == (ssize_t)iov_len);
-
- if (timestamp)
- triple_timestamp_get(timestamp);
-
- return 0;
-}
-
static int radv_recv(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
sd_radv *ra = userdata;
unsigned char buf[168];
#include "alloc-util.h"
#include "fd-util.h"
#include "hexdecoct.h"
-#include "icmp6-util.h"
+#include "icmp6-util-unix.h"
#include "socket-util.h"
#include "strv.h"
#include "ndisc-internal.h"
};
static bool verbose = false;
-static int test_fd[2];
static sd_ndisc *test_timeout_nd;
-typedef int (*send_ra_t)(uint8_t flags);
-static send_ra_t send_ra_function;
-
static void router_dump(sd_ndisc_router *rt) {
struct in6_addr addr;
uint8_t hop_limit;
assert_se(rt);
log_info("--");
- assert_se(sd_ndisc_router_get_address(rt, &addr) == -ENODATA);
+ assert_se(sd_ndisc_router_get_address(rt, &addr) >= 0);
+ log_info("Sender: %s", IN6_ADDR_TO_STRING(&addr));
assert_se(sd_ndisc_router_get_timestamp(rt, CLOCK_REALTIME, &t) >= 0);
log_info("Timestamp: %s", FORMAT_TIMESTAMP(t));
}
}
-int icmp6_bind_router_solicitation(int ifindex) {
- assert_se(ifindex == 42);
-
- if (socketpair(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) < 0)
- return -errno;
-
- return test_fd[0];
-}
-
-int icmp6_bind_router_advertisement(int ifindex) {
- return -ENOSYS;
-}
-
-int icmp6_receive(int fd, void *iov_base, size_t iov_len,
- struct in6_addr *dst, triple_timestamp *timestamp) {
- assert_se(read (fd, iov_base, iov_len) == (ssize_t)iov_len);
-
- if (timestamp)
- triple_timestamp_get(timestamp);
-
- return 0;
-}
-
static int send_ra(uint8_t flags) {
uint8_t advertisement[] = {
0x86, 0x00, 0xde, 0x83, 0x40, 0xc0, 0x00, 0xb4,
return 0;
}
-int icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr) {
- if (!send_ra_function)
- return 0;
-
- return send_ra_function(0);
-}
-
static void test_callback(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router *rt, void *userdata) {
sd_event *e = userdata;
static unsigned idx = 0;
sd_journal_step_one;
sd_session_get_leader;
} LIBSYSTEMD_253;
+
+LIBSYSTEMD_255 {
+global:
+ sd_id128_get_app_specific;
+} LIBSYSTEMD_254;
#include "string-util.h"
#include "sync-util.h"
+int id128_from_string_nonzero(const char *s, sd_id128_t *ret) {
+ sd_id128_t t;
+ int r;
+
+ assert(ret);
+
+ r = sd_id128_from_string(ASSERT_PTR(s), &t);
+ if (r < 0)
+ return r;
+
+ if (sd_id128_is_null(t))
+ return -ENXIO;
+
+ *ret = t;
+ return 0;
+}
+
bool id128_is_valid(const char *s) {
size_t l;
ID128_REFUSE_NULL = 1 << 3, /* Refuse all zero ID with -ENOMEDIUM. */
} Id128Flag;
+int id128_from_string_nonzero(const char *s, sd_id128_t *ret);
+
int id128_read_fd(int fd, Id128Flag f, sd_id128_t *ret);
int id128_read_at(int dir_fd, const char *path, Id128Flag f, sd_id128_t *ret);
static inline int id128_read(const char *path, Id128Flag f, sd_id128_t *ret) {
return 0;
}
-static int get_app_specific(sd_id128_t base, sd_id128_t app_id, sd_id128_t *ret) {
- uint8_t hmac[SHA256_DIGEST_SIZE];
- sd_id128_t result;
+_public_ int sd_id128_get_app_specific(sd_id128_t base, sd_id128_t app_id, sd_id128_t *ret) {
+ assert_cc(sizeof(sd_id128_t) < SHA256_DIGEST_SIZE); /* Check that we don't need to pad with zeros. */
+ union {
+ uint8_t hmac[SHA256_DIGEST_SIZE];
+ sd_id128_t result;
+ } buf;
- assert(ret);
+ assert_return(ret, -EINVAL);
+ assert_return(!sd_id128_is_null(app_id), -ENXIO);
- hmac_sha256(&base, sizeof(base), &app_id, sizeof(app_id), hmac);
+ hmac_sha256(&base, sizeof(base), &app_id, sizeof(app_id), buf.hmac);
/* Take only the first half. */
- memcpy(&result, hmac, MIN(sizeof(hmac), sizeof(result)));
-
- *ret = id128_make_v4_uuid(result);
+ *ret = id128_make_v4_uuid(buf.result);
return 0;
}
if (r < 0)
return r;
- return get_app_specific(id, app_id, ret);
+ return sd_id128_get_app_specific(id, app_id, ret);
}
_public_ int sd_id128_get_boot_app_specific(sd_id128_t app_id, sd_id128_t *ret) {
if (r < 0)
return r;
- return get_app_specific(id, app_id, ret);
+ return sd_id128_get_app_specific(id, app_id, ret);
}
if (journal_file_writable(f) && header_size != sizeof(Header))
return -EPROTONOSUPPORT;
+ /* Don't write to journal files without the new boot ID update behavior guarantee. */
+ if (journal_file_writable(f) && !JOURNAL_HEADER_TAIL_ENTRY_BOOT_ID(f->header))
+ return -EPROTONOSUPPORT;
+
if (JOURNAL_HEADER_SEALED(f->header) && !JOURNAL_HEADER_CONTAINS(f->header, n_entry_arrays))
return -EBADMSG;
"timestamp %" PRIu64 ", refusing entry.",
ts->realtime, le64toh(f->header->tail_entry_realtime));
- if (!sd_id128_is_null(f->header->tail_entry_boot_id) && boot_id) {
-
- if (!sd_id128_equal(f->header->tail_entry_boot_id, *boot_id))
- return log_debug_errno(SYNTHETIC_ERRNO(EREMOTE),
- "Boot ID to write is different from previous boot id, refusing entry.");
-
- if (ts->monotonic < le64toh(f->header->tail_entry_monotonic))
- return log_debug_errno(SYNTHETIC_ERRNO(ENOTNAM),
- "Monotonic timestamp %" PRIu64 " smaller than previous monotonic "
- "timestamp %" PRIu64 ", refusing entry.",
- ts->monotonic, le64toh(f->header->tail_entry_monotonic));
- }
+ if ((!boot_id || sd_id128_equal(*boot_id, f->header->tail_entry_boot_id)) &&
+ ts->monotonic < le64toh(f->header->tail_entry_monotonic))
+ return log_debug_errno(
+ SYNTHETIC_ERRNO(ENOTNAM),
+ "Monotonic timestamp %" PRIu64
+ " smaller than previous monotonic timestamp %" PRIu64
+ " while having the same boot ID, refusing entry.",
+ ts->monotonic,
+ le64toh(f->header->tail_entry_monotonic));
}
if (seqnum_id) {
colors_enabled() * OUTPUT_COLOR;
}
-static int get_session_path(sd_bus *bus, const char *session_id, sd_bus_error *error, char **path) {
- _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
- char *ans;
- int r;
-
- assert(bus);
- assert(session_id);
- assert(error);
- assert(path);
-
- r = bus_call_method(bus, bus_login_mgr, "GetSession", error, &reply, "s", session_id);
- if (r < 0)
- return r;
-
- r = sd_bus_message_read(reply, "o", &ans);
- if (r < 0)
- return r;
-
- ans = strdup(ans);
- if (!ans)
- return -ENOMEM;
-
- *path = ans;
- return 0;
-}
-
static int show_table(Table *table, const char *word) {
int r;
return show_table(table, "seats");
}
-static int show_unit_cgroup(sd_bus *bus, const char *interface, const char *unit, pid_t leader) {
- _cleanup_free_ char *cgroup = NULL;
+static int show_unit_cgroup(
+ sd_bus *bus,
+ const char *unit,
+ pid_t leader,
+ const char *prefix) {
+
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_free_ char *cgroup = NULL;
unsigned c;
int r;
assert(bus);
assert(unit);
+ assert(prefix);
r = show_cgroup_get_unit_path_and_warn(bus, unit, &cgroup);
if (r < 0)
c = columns();
if (c > 18)
c -= 18;
- else
- c = 0;
- r = unit_show_processes(bus, unit, cgroup, "\t\t ", c, get_output_flags(), &error);
+ r = unit_show_processes(bus, unit, cgroup, prefix, c, get_output_flags(), &error);
if (r == -EBADR) {
-
if (arg_transport == BUS_TRANSPORT_REMOTE)
return 0;
if (cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, cgroup) != 0 && leader <= 0)
return 0;
- show_cgroup_and_extra(SYSTEMD_CGROUP_CONTROLLER, cgroup, "\t\t ", c, &leader, leader > 0, get_output_flags());
+ show_cgroup_and_extra(SYSTEMD_CGROUP_CONTROLLER, cgroup, prefix, c, &leader, leader > 0, get_output_flags());
} else if (r < 0)
return log_error_errno(r, "Failed to dump process list: %s", bus_error_message(&error, r));
return sd_bus_message_exit_container(m);
}
-static int print_session_status_info(sd_bus *bus, const char *path, bool *new_line) {
+static int mark_session(char **sessions, const char *target_session) {
+ assert(sessions);
+ assert(target_session);
+
+ STRV_FOREACH(i, sessions)
+ if (streq(*i, target_session)) {
+ _cleanup_free_ char *marked = NULL;
+
+ marked = strjoin("*", target_session);
+ if (!marked)
+ return log_oom();
+
+ return free_and_replace(*i, marked);
+ }
+
+ return 0;
+}
+
+static int print_session_status_info(sd_bus *bus, const char *path) {
static const struct bus_properties_map map[] = {
{ "Id", "s", NULL, offsetof(SessionStatusInfo, id) },
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
+ _cleanup_(table_unrefp) Table *table = NULL;
SessionStatusInfo i = {};
int r;
if (r < 0)
return log_error_errno(r, "Could not get properties: %s", bus_error_message(&error, r));
- if (*new_line)
- printf("\n");
-
- *new_line = true;
+ table = table_new_vertical();
+ if (!table)
+ return log_oom();
- printf("%s - ", strna(i.id));
+ if (dual_timestamp_is_set(&i.timestamp)) {
+ r = table_add_cell(table, NULL, TABLE_FIELD, "Since");
+ if (r < 0)
+ return table_log_add_error(r);
- if (i.name)
- printf("%s (" UID_FMT ")\n", i.name, i.uid);
- else
- printf(UID_FMT "\n", i.uid);
+ r = table_add_cell_stringf(table, NULL, "%s; %s",
+ FORMAT_TIMESTAMP(i.timestamp.realtime),
+ FORMAT_TIMESTAMP_RELATIVE_MONOTONIC(i.timestamp.monotonic));
+ if (r < 0)
+ return table_log_add_error(r);
+ }
- if (dual_timestamp_is_set(&i.timestamp))
- printf("\t Since: %s; %s\n",
- FORMAT_TIMESTAMP(i.timestamp.realtime),
- FORMAT_TIMESTAMP_RELATIVE_MONOTONIC(i.timestamp.monotonic));
+ r = table_add_many(table,
+ TABLE_FIELD, "State",
+ TABLE_STRING, i.state);
+ if (r < 0)
+ return table_log_add_error(r);
if (i.leader > 0) {
- _cleanup_free_ char *t = NULL;
+ _cleanup_free_ char *name = NULL;
- printf("\t Leader: " PID_FMT, i.leader);
+ (void) get_process_comm(i.leader, &name);
- (void) get_process_comm(i.leader, &t);
- if (t)
- printf(" (%s)", t);
+ r = table_add_cell(table, NULL, TABLE_FIELD, "Leader");
+ if (r < 0)
+ return table_log_add_error(r);
- printf("\n");
+ r = table_add_cell_stringf(table, NULL, PID_FMT "%s%s%s",
+ i.leader,
+ !isempty(name) ? " (" : "",
+ strempty(name),
+ !isempty(name) ? ")" : "");
+ if (r < 0)
+ return table_log_add_error(r);
}
- if (!isempty(i.seat)) {
- printf("\t Seat: %s", i.seat);
-
- if (i.vtnr > 0)
- printf("; vc%u", i.vtnr);
+ r = table_add_cell(table, NULL, TABLE_FIELD, "Seat");
+ if (r < 0)
+ return table_log_add_error(r);
- printf("\n");
- }
+ if (i.vtnr > 0)
+ r = table_add_cell_stringf(table, NULL, "%s; vc%u", i.seat, i.vtnr);
+ else
+ r = table_add_cell(table, NULL, TABLE_STRING, i.seat);
+ if (r < 0)
+ return table_log_add_error(r);
if (i.tty)
- printf("\t TTY: %s\n", i.tty);
+ r = table_add_many(table,
+ TABLE_FIELD, "TTY",
+ TABLE_STRING, i.tty);
else if (i.display)
- printf("\t Display: %s\n", i.display);
+ r = table_add_many(table,
+ TABLE_FIELD, "Display",
+ TABLE_STRING, i.display);
+ else
+ r = 0;
+ if (r < 0)
+ return table_log_add_error(r);
+
+ r = table_add_cell(table, NULL, TABLE_FIELD, "Remote");
+ if (r < 0)
+ return table_log_add_error(r);
if (i.remote_host && i.remote_user)
- printf("\t Remote: %s@%s\n", i.remote_user, i.remote_host);
+ r = table_add_cell_stringf(table, NULL, "%s@%s", i.remote_user, i.remote_host);
else if (i.remote_host)
- printf("\t Remote: %s\n", i.remote_host);
+ r = table_add_cell(table, NULL, TABLE_STRING, i.remote_host);
else if (i.remote_user)
- printf("\t Remote: user %s\n", i.remote_user);
- else if (i.remote)
- printf("\t Remote: Yes\n");
+ r = table_add_cell_stringf(table, NULL, "user %s", i.remote_user);
+ else
+ r = table_add_cell(table, NULL, TABLE_BOOLEAN, &i.remote);
+ if (r < 0)
+ return table_log_add_error(r);
if (i.service) {
- printf("\t Service: %s", i.service);
+ r = table_add_many(table,
+ TABLE_FIELD, "Service",
+ TABLE_STRING, i.service);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
- if (i.type)
- printf("; type %s", i.type);
+ if (i.type) {
+ r = table_add_many(table,
+ TABLE_FIELD, "Type",
+ TABLE_STRING, i.type);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
- if (i.class)
- printf("; class %s", i.class);
+ if (i.class) {
+ r = table_add_many(table,
+ TABLE_FIELD, "Class",
+ TABLE_STRING, i.class);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
- printf("\n");
- } else if (i.type) {
- printf("\t Type: %s", i.type);
+ if (!isempty(i.desktop)) {
+ r = table_add_many(table,
+ TABLE_FIELD, "Desktop",
+ TABLE_STRING, i.desktop);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
- if (i.class)
- printf("; class %s", i.class);
+ r = table_add_cell(table, NULL, TABLE_FIELD, "Idle");
+ if (r < 0)
+ return table_log_add_error(r);
- printf("\n");
- } else if (i.class)
- printf("\t Class: %s\n", i.class);
+ if (i.idle_hint && dual_timestamp_is_set(&i.idle_hint_timestamp))
+ r = table_add_cell_stringf(table, NULL, "%s since %s (%s)",
+ yes_no(i.idle_hint),
+ FORMAT_TIMESTAMP(i.idle_hint_timestamp.realtime),
+ FORMAT_TIMESTAMP_RELATIVE_MONOTONIC(i.idle_hint_timestamp.monotonic));
+ else
+ r = table_add_cell(table, NULL, TABLE_BOOLEAN, &i.idle_hint);
+ if (r < 0)
+ return table_log_add_error(r);
- if (!isempty(i.desktop))
- printf("\t Desktop: %s\n", i.desktop);
+ if (i.scope) {
+ r = table_add_many(table,
+ TABLE_FIELD, "Unit",
+ TABLE_STRING, i.scope);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
- if (i.state)
- printf("\t State: %s\n", i.state);
+ /* We don't use the table to show the header, in order to make the width of the column stable. */
+ printf("%s%s - %s (" UID_FMT ")%s\n", ansi_highlight(), i.id, i.name, i.uid, ansi_normal());
- if (i.idle_hint && dual_timestamp_is_set(&i.idle_hint_timestamp))
- printf("\t Idle: %s since %s (%s)\n",
- yes_no(i.idle_hint),
- FORMAT_TIMESTAMP(i.idle_hint_timestamp.realtime),
- FORMAT_TIMESTAMP_RELATIVE_MONOTONIC(i.idle_hint_timestamp.monotonic));
- else
- printf("\t Idle: %s\n", yes_no(i.idle_hint));
+ r = table_print(table, NULL);
+ if (r < 0)
+ return table_log_print_error(r);
if (i.scope) {
- printf("\t Unit: %s\n", i.scope);
- show_unit_cgroup(bus, "org.freedesktop.systemd1.Scope", i.scope, i.leader);
+ show_unit_cgroup(bus, i.scope, i.leader, /* prefix = */ strrepa(" ", STRLEN("Display: ")));
if (arg_transport == BUS_TRANSPORT_LOCAL)
show_journal_by_unit(
return 0;
}
-static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line) {
+static int print_user_status_info(sd_bus *bus, const char *path) {
static const struct bus_properties_map map[] = {
{ "Name", "s", NULL, offsetof(UserStatusInfo, name) },
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
_cleanup_(user_status_info_done) UserStatusInfo i = {};
+ _cleanup_(table_unrefp) Table *table = NULL;
int r;
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, BUS_MAP_BOOLEAN_AS_BOOL, &error, &m, &i);
if (r < 0)
return log_error_errno(r, "Could not get properties: %s", bus_error_message(&error, r));
- if (*new_line)
- printf("\n");
-
- *new_line = true;
+ table = table_new_vertical();
+ if (!table)
+ return log_oom();
- if (i.name)
- printf("%s (%"PRIu32")\n", i.name, i.uid);
- else
- printf("%"PRIu32"\n", i.uid);
+ if (dual_timestamp_is_set(&i.timestamp)) {
+ r = table_add_cell(table, NULL, TABLE_FIELD, "Since");
+ if (r < 0)
+ return table_log_add_error(r);
- if (dual_timestamp_is_set(&i.timestamp))
- printf("\t Since: %s; %s\n",
- FORMAT_TIMESTAMP(i.timestamp.realtime),
- FORMAT_TIMESTAMP_RELATIVE_MONOTONIC(i.timestamp.monotonic));
+ r = table_add_cell_stringf(table, NULL, "%s; %s",
+ FORMAT_TIMESTAMP(i.timestamp.realtime),
+ FORMAT_TIMESTAMP_RELATIVE_MONOTONIC(i.timestamp.monotonic));
+ if (r < 0)
+ return table_log_add_error(r);
+ }
- if (!isempty(i.state))
- printf("\t State: %s\n", i.state);
+ r = table_add_many(table,
+ TABLE_FIELD, "State",
+ TABLE_STRING, i.state);
+ if (r < 0)
+ return table_log_add_error(r);
if (!strv_isempty(i.sessions)) {
- printf("\tSessions:");
+ _cleanup_strv_free_ char **sessions = TAKE_PTR(i.sessions);
- STRV_FOREACH(l, i.sessions)
- printf(" %s%s",
- streq_ptr(*l, i.display) ? "*" : "",
- *l);
+ r = mark_session(sessions, i.display);
+ if (r < 0)
+ return r;
- printf("\n");
+ r = table_add_many(table,
+ TABLE_FIELD, "Sessions",
+ TABLE_STRV_WRAPPED, sessions);
+ if (r < 0)
+ return table_log_add_error(r);
}
- printf("\t Linger: %s\n", yes_no(i.linger));
+ r = table_add_many(table,
+ TABLE_FIELD, "Linger",
+ TABLE_BOOLEAN, i.linger);
+ if (r < 0)
+ return table_log_add_error(r);
if (i.slice) {
- printf("\t Unit: %s\n", i.slice);
- show_unit_cgroup(bus, "org.freedesktop.systemd1.Slice", i.slice, 0);
-
- show_journal_by_unit(
- stdout,
- i.slice,
- NULL,
- arg_output,
- 0,
- i.timestamp.monotonic,
- arg_lines,
- 0,
- get_output_flags() | OUTPUT_BEGIN_NEWLINE,
- SD_JOURNAL_LOCAL_ONLY,
- true,
- NULL);
+ r = table_add_many(table,
+ TABLE_FIELD, "Unit",
+ TABLE_STRING, i.slice);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
+
+ printf("%s%s (" UID_FMT ")%s\n", ansi_highlight(), i.name, i.uid, ansi_normal());
+
+ r = table_print(table, NULL);
+ if (r < 0)
+ return table_log_print_error(r);
+
+ if (i.slice) {
+ show_unit_cgroup(bus, i.slice, /* leader = */ 0, /* prefix = */ strrepa(" ", STRLEN("Sessions: ")));
+
+ if (arg_transport == BUS_TRANSPORT_LOCAL)
+ show_journal_by_unit(
+ stdout,
+ i.slice,
+ NULL,
+ arg_output,
+ 0,
+ i.timestamp.monotonic,
+ arg_lines,
+ 0,
+ get_output_flags() | OUTPUT_BEGIN_NEWLINE,
+ SD_JOURNAL_LOCAL_ONLY,
+ true,
+ NULL);
}
return 0;
}
-static int print_seat_status_info(sd_bus *bus, const char *path, bool *new_line) {
+static int print_seat_status_info(sd_bus *bus, const char *path) {
static const struct bus_properties_map map[] = {
{ "Id", "s", NULL, offsetof(SeatStatusInfo, id) },
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
_cleanup_(seat_status_info_done) SeatStatusInfo i = {};
+ _cleanup_(table_unrefp) Table *table = NULL;
int r;
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, 0, &error, &m, &i);
if (r < 0)
return log_error_errno(r, "Could not get properties: %s", bus_error_message(&error, r));
- if (*new_line)
- printf("\n");
-
- *new_line = true;
-
- printf("%s\n", strna(i.id));
+ table = table_new_vertical();
+ if (!table)
+ return log_oom();
if (!strv_isempty(i.sessions)) {
- printf("\tSessions:");
+ _cleanup_strv_free_ char **sessions = TAKE_PTR(i.sessions);
- STRV_FOREACH(l, i.sessions) {
- if (streq_ptr(*l, i.active_session))
- printf(" *%s", *l);
- else
- printf(" %s", *l);
- }
+ r = mark_session(sessions, i.active_session);
+ if (r < 0)
+ return r;
- printf("\n");
+ r = table_add_many(table,
+ TABLE_FIELD, "Sessions",
+ TABLE_STRV_WRAPPED, sessions);
+ if (r < 0)
+ return table_log_add_error(r);
}
if (arg_transport == BUS_TRANSPORT_LOCAL) {
- unsigned c;
+ r = table_add_many(table,
+ TABLE_FIELD, "Devices",
+ TABLE_EMPTY);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
+
+ printf("%s%s%s\n", ansi_highlight(), i.id, ansi_normal());
+
+ r = table_print(table, NULL);
+ if (r < 0)
+ return table_log_print_error(r);
- c = columns();
+ if (arg_transport == BUS_TRANSPORT_LOCAL) {
+ unsigned c = columns();
if (c > 21)
c -= 21;
- else
- c = 0;
- printf("\t Devices:\n");
-
- show_sysfs(i.id, "\t\t ", c, get_output_flags());
+ show_sysfs(i.id, strrepa(" ", STRLEN("Sessions:")), c, get_output_flags());
}
return 0;
return 0;
}
-static int show_properties(sd_bus *bus, const char *path, bool *new_line) {
+static int show_properties(sd_bus *bus, const char *path) {
int r;
assert(bus);
assert(path);
- assert(new_line);
-
- if (*new_line)
- printf("\n");
-
- *new_line = true;
r = bus_print_all_properties(
bus,
return 0;
}
+static int get_bus_path_by_id(
+ sd_bus *bus,
+ const char *type,
+ const char *method,
+ const char *id,
+ char **ret) {
+
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
+ _cleanup_free_ char *p = NULL;
+ const char *path;
+ int r;
+
+ assert(bus);
+ assert(type);
+ assert(STR_IN_SET(type, "session", "seat"));
+ assert(method);
+ assert(id);
+ assert(ret);
+
+ r = bus_call_method(bus, bus_login_mgr, method, &error, &reply, "s", id);
+ if (r < 0)
+ return log_error_errno(r, "Failed to get path for %s '%s': %s", type, id, bus_error_message(&error, r));
+
+ r = sd_bus_message_read(reply, "o", &path);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ p = strdup(path);
+ if (!p)
+ return log_oom();
+
+ *ret = TAKE_PTR(p);
+ return 0;
+}
+
static int show_session(int argc, char *argv[], void *userdata) {
- bool properties, new_line = false;
sd_bus *bus = ASSERT_PTR(userdata);
+ bool properties;
int r;
- _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- _cleanup_free_ char *path = NULL;
assert(argv);
if (argc <= 1) {
/* If no argument is specified inspect the manager itself */
if (properties)
- return show_properties(bus, "/org/freedesktop/login1", &new_line);
+ return show_properties(bus, "/org/freedesktop/login1");
- return print_session_status_info(bus, "/org/freedesktop/login1/session/auto", &new_line);
+ return print_session_status_info(bus, "/org/freedesktop/login1/session/auto");
}
- for (int i = 1; i < argc; i++) {
- r = get_session_path(bus, argv[i], &error, &path);
+ for (int i = 1, first = true; i < argc; i++, first = false) {
+ _cleanup_free_ char *path = NULL;
+
+ r = get_bus_path_by_id(bus, "session", "GetSession", argv[i], &path);
if (r < 0)
- return log_error_errno(r, "Failed to get session path: %s", bus_error_message(&error, r));
+ return r;
+
+ if (!first)
+ putchar('\n');
if (properties)
- r = show_properties(bus, path, &new_line);
+ r = show_properties(bus, path);
else
- r = print_session_status_info(bus, path, &new_line);
-
+ r = print_session_status_info(bus, path);
if (r < 0)
return r;
}
}
static int show_user(int argc, char *argv[], void *userdata) {
- bool properties, new_line = false;
sd_bus *bus = ASSERT_PTR(userdata);
+ bool properties;
int r;
assert(argv);
if (argc <= 1) {
/* If no argument is specified inspect the manager itself */
if (properties)
- return show_properties(bus, "/org/freedesktop/login1", &new_line);
+ return show_properties(bus, "/org/freedesktop/login1");
- return print_user_status_info(bus, "/org/freedesktop/login1/user/self", &new_line);
+ return print_user_status_info(bus, "/org/freedesktop/login1/user/self");
}
- for (int i = 1; i < argc; i++) {
+ for (int i = 1, first = true; i < argc; i++, first = false) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- _cleanup_(sd_bus_message_unrefp) sd_bus_message * reply = NULL;
- const char *path = NULL;
+ _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
+ const char *path;
uid_t uid;
r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL, 0);
if (r < 0)
return bus_log_parse_error(r);
+ if (!first)
+ putchar('\n');
+
if (properties)
- r = show_properties(bus, path, &new_line);
+ r = show_properties(bus, path);
else
- r = print_user_status_info(bus, path, &new_line);
-
+ r = print_user_status_info(bus, path);
if (r < 0)
return r;
}
}
static int show_seat(int argc, char *argv[], void *userdata) {
- bool properties, new_line = false;
sd_bus *bus = ASSERT_PTR(userdata);
+ bool properties;
int r;
assert(argv);
if (argc <= 1) {
/* If no argument is specified inspect the manager itself */
if (properties)
- return show_properties(bus, "/org/freedesktop/login1", &new_line);
+ return show_properties(bus, "/org/freedesktop/login1");
- return print_seat_status_info(bus, "/org/freedesktop/login1/seat/auto", &new_line);
+ return print_seat_status_info(bus, "/org/freedesktop/login1/seat/auto");
}
- for (int i = 1; i < argc; i++) {
- _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- _cleanup_(sd_bus_message_unrefp) sd_bus_message * reply = NULL;
- const char *path = NULL;
+ for (int i = 1, first = true; i < argc; i++, first = false) {
+ _cleanup_free_ char *path = NULL;
- r = bus_call_method(bus, bus_login_mgr, "GetSeat", &error, &reply, "s", argv[i]);
+ r = get_bus_path_by_id(bus, "seat", "GetSeat", argv[i], &path);
if (r < 0)
- return log_error_errno(r, "Failed to get seat: %s", bus_error_message(&error, r));
+ return r;
- r = sd_bus_message_read(reply, "o", &path);
- if (r < 0)
- return bus_log_parse_error(r);
+ if (!first)
+ putchar('\n');
if (properties)
- r = show_properties(bus, path, &new_line);
+ r = show_properties(bus, path);
else
- r = print_seat_status_info(bus, path, &new_line);
-
+ r = print_seat_status_info(bus, path);
if (r < 0)
return r;
}
return 0;
}
-static int attach_device(Manager *m, const char *seat, const char *sysfs) {
+static int attach_device(Manager *m, const char *seat, const char *sysfs, sd_bus_error *error) {
_cleanup_(sd_device_unrefp) sd_device *d = NULL;
_cleanup_free_ char *rule = NULL, *file = NULL;
const char *id_for_seat;
r = sd_device_new_from_syspath(&d, sysfs);
if (r < 0)
- return r;
+ return sd_bus_error_set_errnof(error, r, "Failed to open device '%s': %m", sysfs);
if (sd_device_has_current_tag(d, "seat") <= 0)
- return -ENODEV;
+ return sd_bus_error_set_errnof(error, ENODEV, "Device '%s' lacks 'seat' udev tag.", sysfs);
if (sd_device_get_property_value(d, "ID_FOR_SEAT", &id_for_seat) < 0)
- return -ENODEV;
+ return sd_bus_error_set_errnof(error, ENODEV, "Device '%s' lacks 'ID_FOR_SEAT' udev property.", sysfs);
if (asprintf(&file, "/etc/udev/rules.d/72-seat-%s.rules", id_for_seat) < 0)
return -ENOMEM;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
- r = attach_device(m, seat, sysfs);
+ r = attach_device(m, seat, sysfs, error);
if (r < 0)
return r;
'networkd-dhcp-server-bus.c',
'networkd-dhcp-server-static-lease.c',
'networkd-dhcp-server.c',
+ 'networkd-dhcp4-bus.c',
'networkd-dhcp4.c',
+ 'networkd-dhcp6-bus.c',
'networkd-dhcp6.c',
'networkd-ipv4acd.c',
'networkd-ipv4ll.c',
}
if (comma) {
- r = sd_id128_from_string(comma + 1, &secret_key);
+ r = id128_from_string_nonzero(comma + 1, &secret_key);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
- "Failed to parse secret key in %s=, ignoring assignment: %s",
- lvalue, rvalue);
- return 0;
- }
- if (sd_id128_is_null(secret_key)) {
- log_syntax(unit, LOG_WARNING, filename, line, 0,
- "Secret key in %s= cannot be null, ignoring assignment: %s",
+ r == -ENXIO ? "Secret key in %s= cannot be null, ignoring assignment: %s"
+ : "Failed to parse secret key in %s=, ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
#include "bus-error.h"
#include "bus-locator.h"
#include "dhcp-identifier.h"
-#include "dhcp-internal.h"
+#include "dhcp-client-internal.h"
#include "dhcp6-internal.h"
#include "escape.h"
#include "hexdecoct.h"
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "sd-dhcp-client.h"
+
+#include "alloc-util.h"
+#include "bus-common-errors.h"
+#include "bus-util.h"
+#include "dhcp-client-internal.h"
+#include "dhcp-protocol.h"
+#include "networkd-dhcp4-bus.h"
+#include "networkd-link-bus.h"
+#include "networkd-manager.h"
+#include "string-table.h"
+#include "strv.h"
+
+static int property_get_dhcp_client_state(
+ sd_bus *bus,
+ const char *path,
+ const char *interface,
+ const char *property,
+ sd_bus_message *reply,
+ void *userdata,
+ sd_bus_error *error) {
+
+ Link *l = ASSERT_PTR(userdata);
+ sd_dhcp_client *c;
+
+ assert(reply);
+
+ c = l->dhcp_client;
+ if (!c)
+ return sd_bus_message_append(reply, "s", "disabled");
+
+ return sd_bus_message_append(reply, "s", dhcp_state_to_string(dhcp_client_get_state(c)));
+}
+
+static int dhcp_client_emit_changed(Link *link, const char *property, ...) {
+ _cleanup_free_ char *path = NULL;
+ char **l;
+
+ assert(link);
+
+ if (sd_bus_is_ready(link->manager->bus) <= 0)
+ return 0;
+
+ path = link_bus_path(link);
+ if (!path)
+ return log_oom();
+
+ l = strv_from_stdarg_alloca(property);
+
+ return sd_bus_emit_properties_changed_strv(
+ link->manager->bus,
+ path,
+ "org.freedesktop.network1.DHCPv4Client",
+ l);
+}
+
+int dhcp_client_callback_bus(sd_dhcp_client *c, int event, void *userdata) {
+ Link *l = ASSERT_PTR(userdata);
+
+ return dhcp_client_emit_changed(l, "State", NULL);
+}
+
+static const sd_bus_vtable dhcp_client_vtable[] = {
+ SD_BUS_VTABLE_START(0),
+
+ SD_BUS_PROPERTY("State", "s", property_get_dhcp_client_state, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
+
+ SD_BUS_VTABLE_END
+};
+
+const BusObjectImplementation dhcp_client_object = {
+ "/org/freedesktop/network1/link",
+ "org.freedesktop.network1.DHCPv4Client",
+ .fallback_vtables = BUS_FALLBACK_VTABLES({dhcp_client_vtable, link_object_find}),
+ .node_enumerator = link_node_enumerator,
+};
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "sd-dhcp-client.h"
+
+#include "networkd-link-bus.h"
+
+extern const BusObjectImplementation dhcp_client_object;
+
+int dhcp_client_callback_bus(sd_dhcp_client *client, int event, void *userdata);
#include "network-internal.h"
#include "networkd-address.h"
#include "networkd-dhcp-prefix-delegation.h"
+#include "networkd-dhcp4-bus.h"
#include "networkd-dhcp4.h"
#include "networkd-ipv4acd.h"
#include "networkd-link.h"
if (r < 0)
return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set request flag for broadcast: %m");
+ r = dhcp_client_set_state_callback(link->dhcp_client, dhcp_client_callback_bus, link);
+ if (r < 0)
+ return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set state change callback: %m");
+
if (link->mtu > 0) {
r = sd_dhcp_client_set_mtu(link->dhcp_client, link->mtu);
if (r < 0)
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "alloc-util.h"
+#include "bus-common-errors.h"
+#include "bus-util.h"
+#include "dhcp6-client-internal.h"
+#include "dhcp6-protocol.h"
+#include "networkd-dhcp6-bus.h"
+#include "networkd-link-bus.h"
+#include "networkd-manager.h"
+#include "string-table.h"
+#include "strv.h"
+
+static int property_get_dhcp6_client_state(
+ sd_bus *bus,
+ const char *path,
+ const char *interface,
+ const char *property,
+ sd_bus_message *reply,
+ void *userdata,
+ sd_bus_error *error) {
+
+ Link *l = ASSERT_PTR(userdata);
+ sd_dhcp6_client *c;
+
+ assert(reply);
+
+ c = l->dhcp6_client;
+ if (!c)
+ return sd_bus_message_append(reply, "s", "disabled");
+
+ return sd_bus_message_append(reply, "s", dhcp6_state_to_string(dhcp6_client_get_state(c)));
+}
+
+static int dhcp6_client_emit_changed(Link *link, const char *property, ...) {
+ _cleanup_free_ char *path = NULL;
+ char **l;
+
+ assert(link);
+
+ if (sd_bus_is_ready(link->manager->bus) <= 0)
+ return 0;
+
+ path = link_bus_path(link);
+ if (!path)
+ return log_oom();
+
+ l = strv_from_stdarg_alloca(property);
+
+ return sd_bus_emit_properties_changed_strv(
+ link->manager->bus,
+ path,
+ "org.freedesktop.network1.DHCPv6Client",
+ l);
+}
+
+void dhcp6_client_callback_bus(sd_dhcp6_client *c, int event, void *userdata) {
+ Link *l = ASSERT_PTR(userdata);
+
+ dhcp6_client_emit_changed(l, "State", NULL);
+}
+
+static const sd_bus_vtable dhcp6_client_vtable[] = {
+ SD_BUS_VTABLE_START(0),
+
+ SD_BUS_PROPERTY("State", "s", property_get_dhcp6_client_state, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
+
+ SD_BUS_VTABLE_END
+};
+
+const BusObjectImplementation dhcp6_client_object = {
+ "/org/freedesktop/network1/link",
+ "org.freedesktop.network1.DHCPv6Client",
+ .fallback_vtables = BUS_FALLBACK_VTABLES({dhcp6_client_vtable, link_object_find}),
+ .node_enumerator = link_node_enumerator,
+};
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "sd-dhcp6-client.h"
+
+#include "networkd-link-bus.h"
+
+extern const BusObjectImplementation dhcp6_client_object;
+
+void dhcp6_client_callback_bus(sd_dhcp6_client *client, int event, void *userdata);
#include "sd-dhcp6-client.h"
+#include "dhcp6-client-internal.h"
#include "hashmap.h"
#include "hostname-setup.h"
#include "hostname-util.h"
#include "networkd-address.h"
#include "networkd-dhcp-prefix-delegation.h"
+#include "networkd-dhcp6-bus.h"
#include "networkd-dhcp6.h"
#include "networkd-link.h"
#include "networkd-manager.h"
if (r < 0)
return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set callback: %m");
+ r = dhcp6_client_set_state_callback(client, dhcp6_client_callback_bus, link);
+ if (r < 0)
+ return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to set state change callback: %m");
+
r = sd_dhcp6_client_set_prefix_delegation(client, link->network->dhcp6_use_pd_prefix);
if (r < 0)
return log_link_debug_errno(link, r, "DHCPv6 CLIENT: Failed to %s requesting prefixes to be delegated: %m",
#include "netif-util.h"
#include "networkd-address.h"
#include "networkd-dhcp-common.h"
+#include "networkd-dhcp-prefix-delegation.h"
#include "networkd-json.h"
#include "networkd-link.h"
#include "networkd-manager.h"
return json_variant_merge_objectb(v, JSON_BUILD_OBJECT(JSON_BUILD_PAIR_STRING("CaptivePortal", captive_portal)));
}
+static int pref64_append_json(Link *link, JsonVariant **v) {
+ _cleanup_(json_variant_unrefp) JsonVariant *array = NULL, *w = NULL;
+ NDiscPREF64 *i;
+ int r;
+
+ assert(link);
+ assert(v);
+
+ if (!link->network || !link->network->ipv6_accept_ra_use_pref64)
+ return 0;
+
+ SET_FOREACH(i, link->ndisc_pref64) {
+ r = json_variant_append_arrayb(&array,
+ JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR_IN6_ADDR_NON_NULL("Prefix", &i->prefix),
+ JSON_BUILD_PAIR_UNSIGNED("PrefixLength", i->prefix_len),
+ JSON_BUILD_PAIR_FINITE_USEC("LifetimeUSec", i->lifetime_usec),
+ JSON_BUILD_PAIR_IN6_ADDR_NON_NULL("ConfigProvider", &i->router)));
+ if (r < 0)
+ return r;
+ }
+
+ r = json_append_one(&w, "PREF64", array);
+ if (r < 0)
+ return r;
+
+ return json_append_one(v, "NDisc", w);
+}
+
static int dhcp_server_offered_leases_append_json(Link *link, JsonVariant **v) {
_cleanup_(json_variant_unrefp) JsonVariant *array = NULL;
DHCPLease *lease;
static int dhcp6_client_lease_append_json(Link *link, JsonVariant **v) {
_cleanup_(json_variant_unrefp) JsonVariant *w = NULL;
+ uint64_t lease_timestamp_usec;
int r;
assert(link);
if (!link->dhcp6_lease)
return 0;
+ r = sd_dhcp6_lease_get_timestamp(link->dhcp6_lease, CLOCK_BOOTTIME, &lease_timestamp_usec);
+ if (r < 0)
+ return 0;
+
r = json_build(&w, JSON_BUILD_OBJECT(
- JSON_BUILD_PAIR_FINITE_USEC("T1", link->dhcp6_lease->lifetime_t1),
- JSON_BUILD_PAIR_FINITE_USEC("T2", link->dhcp6_lease->lifetime_t2)));
+ JSON_BUILD_PAIR_FINITE_USEC("Timeout1USec",
+ link->dhcp6_lease->lifetime_t1 + lease_timestamp_usec),
+ JSON_BUILD_PAIR_FINITE_USEC("Timeout2USec",
+ link->dhcp6_lease->lifetime_t2 + lease_timestamp_usec),
+ JSON_BUILD_PAIR_FINITE_USEC("LeaseTimestampUSec",
+ lease_timestamp_usec)));
if (r < 0)
return r;
return json_append_one(v, "Lease", w);
}
+static int dhcp6_client_pd_append_json(Link *link, JsonVariant **v) {
+ _cleanup_(json_variant_unrefp) JsonVariant *array = NULL;
+ struct in6_addr prefix;
+ uint32_t lifetime_preferred, lifetime_valid;
+ uint8_t prefix_len;
+ uint64_t lease_timestamp_usec;
+ int r;
+
+ assert(link);
+ assert(link->network);
+ assert(v);
+
+ if (!link->network->dhcp6_use_pd_prefix || !link->dhcp6_lease || !dhcp6_lease_has_pd_prefix(link->dhcp6_lease))
+ return 0;
+
+ sd_dhcp6_lease_reset_pd_prefix_iter(link->dhcp6_lease);
+
+ r = sd_dhcp6_lease_get_timestamp(link->dhcp6_lease, CLOCK_BOOTTIME, &lease_timestamp_usec);
+ if (r < 0)
+ return 0;
+
+ while (sd_dhcp6_lease_get_pd(link->dhcp6_lease, &prefix, &prefix_len, &lifetime_preferred, &lifetime_valid) >= 0) {
+ r = json_variant_append_arrayb(&array, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR_IN6_ADDR("Prefix", &prefix),
+ JSON_BUILD_PAIR_UNSIGNED("PrefixLength", prefix_len),
+ JSON_BUILD_PAIR_FINITE_USEC("PreferredLifetimeUSec",
+ sec_to_usec(lifetime_preferred, lease_timestamp_usec)),
+ JSON_BUILD_PAIR_FINITE_USEC("ValidLifetimeUSec",
+ sec_to_usec(lifetime_valid, lease_timestamp_usec))));
+ if (r < 0)
+ return r;
+ }
+
+ return json_append_one(v, "Prefixes", array);
+}
+
static int dhcp6_client_append_json(Link *link, JsonVariant **v) {
_cleanup_(json_variant_unrefp) JsonVariant *w = NULL;
int r;
if (r < 0)
return r;
+ r = dhcp6_client_pd_append_json(link, &w);
+ if (r < 0)
+ return r;
+
return json_append_one(v, "DHCPv6Client", w);
}
+static int dhcp_client_lease_append_json(Link *link, JsonVariant **v) {
+ _cleanup_(json_variant_unrefp) JsonVariant *w = NULL;
+ uint32_t t1, t2;
+ uint64_t lease_timestamp_usec;
+ int r;
+
+ assert(link);
+ assert(v);
+
+ if (!link->dhcp_client || !link->dhcp_lease)
+ return 0;
+
+ r = sd_dhcp_lease_get_t1(link->dhcp_lease, &t1);
+ if (r < 0)
+ return 0;
+
+ r = sd_dhcp_lease_get_t2(link->dhcp_lease, &t2);
+ if (r < 0)
+ return 0;
+
+ r = sd_dhcp_client_get_lease_timestamp(link->dhcp_client, &lease_timestamp_usec);
+ if (r < 0)
+ return 0;
+
+ r = json_build(&w, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR_FINITE_USEC("Timeout1USec",
+ sec_to_usec(t1, lease_timestamp_usec)),
+ JSON_BUILD_PAIR_FINITE_USEC("Timeout2USec",
+ sec_to_usec(t2, lease_timestamp_usec)),
+ JSON_BUILD_PAIR_FINITE_USEC("LeaseTimestampUSec", lease_timestamp_usec)));
+ if (r < 0)
+ return r;
+
+ return json_append_one(v, "Lease", w);
+}
+
+static int dhcp_client_pd_append_json(Link *link, JsonVariant **v) {
+ _cleanup_(json_variant_unrefp) JsonVariant *addresses = NULL, *array = NULL;
+ uint8_t ipv4masklen, sixrd_prefixlen;
+ struct in6_addr sixrd_prefix;
+ const struct in_addr *br_addresses;
+ size_t n_br_addresses = 0;
+ int r;
+
+ assert(link);
+ assert(link->network);
+ assert(v);
+
+ if (!link->network->dhcp_use_6rd || !link->dhcp_lease || !dhcp4_lease_has_pd_prefix(link->dhcp_lease))
+ return 0;
+
+ r = sd_dhcp_lease_get_6rd(link->dhcp_lease, &ipv4masklen, &sixrd_prefixlen, &sixrd_prefix, &br_addresses, &n_br_addresses);
+ if (r < 0)
+ return r;
+
+ FOREACH_ARRAY(br_address, br_addresses, n_br_addresses) {
+ r = json_variant_append_arrayb(&addresses, JSON_BUILD_IN4_ADDR(br_address));
+ if (r < 0)
+ return r;
+ }
+
+ r = json_build(&array, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR_IN6_ADDR("Prefix", &sixrd_prefix),
+ JSON_BUILD_PAIR_UNSIGNED("PrefixLength", sixrd_prefixlen),
+ JSON_BUILD_PAIR_UNSIGNED("IPv4MaskLength", ipv4masklen),
+ JSON_BUILD_PAIR_VARIANT_NON_NULL("BorderRouters", addresses)));
+ if (r < 0)
+ return r;
+
+ return json_append_one(v, "6rdPrefix", array);
+}
+
+static int dhcp_client_append_json(Link *link, JsonVariant **v) {
+ _cleanup_(json_variant_unrefp) JsonVariant *w = NULL;
+ int r;
+
+ assert(link);
+ assert(v);
+
+ if (!link->dhcp_client)
+ return 0;
+
+ r = dhcp_client_lease_append_json(link, &w);
+ if (r < 0)
+ return r;
+
+ r = dhcp_client_pd_append_json(link, &w);
+ if (r < 0)
+ return r;
+
+ return json_append_one(v, "DHCPv4Client", w);
+}
+
int link_build_json(Link *link, JsonVariant **ret) {
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
_cleanup_free_ char *type = NULL, *flags = NULL;
if (r < 0)
return r;
+ r = pref64_append_json(link, &v);
+ if (r < 0)
+ return r;
+
r = addresses_append_json(link->addresses, &v);
if (r < 0)
return r;
if (r < 0)
return r;
+ r = dhcp_client_append_json(link, &v);
+ if (r < 0)
+ return r;
+
r = dhcp6_client_append_json(link, &v);
if (r < 0)
return r;
(!link->dhcp_server || sd_dhcp_server_is_in_relay_mode(link->dhcp_server)))
return 0;
+ if (streq(interface, "org.freedesktop.network1.DHCPv4Client") && !link->dhcp_client)
+ return 0;
+
+ if (streq(interface, "org.freedesktop.network1.DHCPv6Client") && !link->dhcp6_client)
+ return 0;
+
*found = link;
return 1;
Set *ndisc_rdnss;
Set *ndisc_dnssl;
Set *ndisc_captive_portals;
+ Set *ndisc_pref64;
unsigned ndisc_messages;
bool ndisc_configured:1;
#include "bus-message-util.h"
#include "bus-polkit.h"
#include "networkd-dhcp-server-bus.h"
+#include "networkd-dhcp4-bus.h"
+#include "networkd-dhcp6-bus.h"
#include "networkd-json.h"
#include "networkd-link-bus.h"
#include "networkd-link.h"
"/org/freedesktop/network1",
"org.freedesktop.network1.Manager",
.vtables = BUS_VTABLES(manager_vtable),
- .children = BUS_IMPLEMENTATIONS(&dhcp_server_object, &link_object, &network_object),
+ .children = BUS_IMPLEMENTATIONS(&dhcp_server_object, &dhcp_client_object,
+ &dhcp6_client_object, &link_object, &network_object),
};
if (r < 0)
return log_link_warning_errno(link, r, "Failed to get router address from RA: %m");
+ /* RFC 4861 section 4.2. states that the lifetime in the message header should be used only for the
+ * default gateway, but the captive portal option does not have a lifetime field, hence, we use the
+ * main lifetime for the portal. */
r = sd_ndisc_router_get_lifetime(rt, &lifetime_sec);
if (r < 0)
return log_link_warning_errno(link, r, "Failed to get lifetime of RA message: %m");
if (!in_charset(captive_portal, URI_VALID))
return log_link_warning_errno(link, SYNTHETIC_ERRNO(EBADMSG), "Received invalid captive portal, ignoring.");
- exist = set_get(link->ndisc_captive_portals, &(NDiscCaptivePortal) { .captive_portal = captive_portal });
+ if (lifetime_usec == 0) {
+ /* Drop the portal with zero lifetime. */
+ ndisc_captive_portal_free(set_remove(link->ndisc_captive_portals,
+ &(NDiscCaptivePortal) {
+ .captive_portal = captive_portal,
+ }));
+ return 0;
+ }
+
+ exist = set_get(link->ndisc_captive_portals,
+ &(NDiscCaptivePortal) {
+ .captive_portal = captive_portal,
+ });
if (exist) {
/* update existing entry */
exist->router = router;
return 1;
}
+static void ndisc_pref64_hash_func(const NDiscPREF64 *x, struct siphash *state) {
+ assert(x);
+
+ siphash24_compress(&x->prefix_len, sizeof(x->prefix_len), state);
+ siphash24_compress(&x->prefix, sizeof(x->prefix), state);
+}
+
+static int ndisc_pref64_compare_func(const NDiscPREF64 *a, const NDiscPREF64 *b) {
+ int r;
+
+ assert(a);
+ assert(b);
+
+ r = CMP(a->prefix_len, b->prefix_len);
+ if (r != 0)
+ return r;
+
+ return memcmp(&a->prefix, &b->prefix, sizeof(a->prefix));
+}
+
+DEFINE_PRIVATE_HASH_OPS_WITH_KEY_DESTRUCTOR(
+ ndisc_pref64_hash_ops,
+ NDiscPREF64,
+ ndisc_pref64_hash_func,
+ ndisc_pref64_compare_func,
+ mfree);
+
+static int ndisc_router_process_pref64(Link *link, sd_ndisc_router *rt) {
+ _cleanup_free_ NDiscPREF64 *new_entry = NULL;
+ usec_t lifetime_usec, timestamp_usec;
+ struct in6_addr a, router;
+ uint16_t lifetime_sec;
+ unsigned prefix_len;
+ NDiscPREF64 *exist;
+ int r;
+
+ assert(link);
+ assert(link->network);
+ assert(rt);
+
+ if (!link->network->ipv6_accept_ra_use_pref64)
+ return 0;
+
+ r = sd_ndisc_router_get_address(rt, &router);
+ if (r < 0)
+ return log_link_warning_errno(link, r, "Failed to get router address from RA: %m");
+
+ r = sd_ndisc_router_prefix64_get_prefix(rt, &a);
+ if (r < 0)
+ return log_link_warning_errno(link, r, "Failed to get pref64 prefix: %m");
+
+ r = sd_ndisc_router_prefix64_get_prefixlen(rt, &prefix_len);
+ if (r < 0)
+ return log_link_warning_errno(link, r, "Failed to get pref64 prefix length: %m");
+
+ r = sd_ndisc_router_prefix64_get_lifetime_sec(rt, &lifetime_sec);
+ if (r < 0)
+ return log_link_warning_errno(link, r, "Failed to get pref64 prefix lifetime: %m");
+
+ r = sd_ndisc_router_get_timestamp(rt, CLOCK_BOOTTIME, ×tamp_usec);
+ if (r < 0)
+ return log_link_warning_errno(link, r, "Failed to get RA timestamp: %m");
+
+ lifetime_usec = sec16_to_usec(lifetime_sec, timestamp_usec);
+
+ if (lifetime_usec == 0) {
+ free(set_remove(link->ndisc_pref64,
+ &(NDiscPREF64) {
+ .prefix = a,
+ .prefix_len = prefix_len
+ }));
+ return 0;
+ }
+
+ exist = set_get(link->ndisc_pref64,
+ &(NDiscPREF64) {
+ .prefix = a,
+ .prefix_len = prefix_len
+ });
+ if (exist) {
+ /* update existing entry */
+ exist->router = router;
+ exist->lifetime_usec = lifetime_usec;
+ return 0;
+ }
+
+ new_entry = new(NDiscPREF64, 1);
+ if (!new_entry)
+ return log_oom();
+
+ *new_entry = (NDiscPREF64) {
+ .router = router,
+ .lifetime_usec = lifetime_usec,
+ .prefix = a,
+ .prefix_len = prefix_len,
+ };
+
+ r = set_ensure_put(&link->ndisc_pref64, &ndisc_pref64_hash_ops, new_entry);
+ if (r < 0)
+ return log_oom();
+
+ assert(r > 0);
+ TAKE_PTR(new_entry);
+
+ return 0;
+}
+
static int ndisc_router_process_options(Link *link, sd_ndisc_router *rt) {
size_t n_captive_portal = 0;
int r;
if (r > 0)
n_captive_portal++;
break;
+ case SD_NDISC_OPTION_PREF64:
+ r = ndisc_router_process_pref64(link, rt);
+ break;
}
if (r < 0 && r != -EBADMSG)
return r;
}
}
-static int ndisc_drop_outdated(Link *link, usec_t timestamp_usec, const struct in6_addr *router) {
+static int ndisc_drop_outdated(Link *link, usec_t timestamp_usec) {
bool updated = false;
NDiscDNSSL *dnssl;
NDiscRDNSS *rdnss;
if (route->lifetime_usec >= timestamp_usec)
continue; /* the route is still valid */
- if (router && !in6_addr_equal(&route->provider.in6, router))
- continue;
-
k = route_remove_and_drop(route);
if (k < 0)
r = log_link_warning_errno(link, k, "Failed to remove outdated SLAAC route, ignoring: %m");
if (address->lifetime_valid_usec >= timestamp_usec)
continue; /* the address is still valid */
- if (router && !in6_addr_equal(&address->provider.in6, router))
- continue;
-
k = address_remove_and_drop(address);
if (k < 0)
r = log_link_warning_errno(link, k, "Failed to remove outdated SLAAC address, ignoring: %m");
if (rdnss->lifetime_usec >= timestamp_usec)
continue; /* the DNS server is still valid */
- if (router && !in6_addr_equal(&rdnss->router, router))
- continue;
-
free(set_remove(link->ndisc_rdnss, rdnss));
updated = true;
}
if (dnssl->lifetime_usec >= timestamp_usec)
continue; /* the DNS domain is still valid */
- if (router && !in6_addr_equal(&dnssl->router, router))
- continue;
-
free(set_remove(link->ndisc_dnssl, dnssl));
updated = true;
}
if (cp->lifetime_usec >= timestamp_usec)
continue; /* the captive portal is still valid */
- if (router && !in6_addr_equal(&cp->router, router))
- continue;
-
ndisc_captive_portal_free(set_remove(link->ndisc_captive_portals, cp));
updated = true;
}
assert_se(sd_event_now(link->manager->event, CLOCK_BOOTTIME, &now_usec) >= 0);
- (void) ndisc_drop_outdated(link, now_usec, NULL);
+ (void) ndisc_drop_outdated(link, now_usec);
(void) ndisc_setup_expire(link);
return 0;
}
}
static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
- uint16_t router_lifetime_sec;
struct in6_addr router;
usec_t timestamp_usec;
int r;
log_link_debug(link, "Received RA without timestamp, ignoring.");
return 0;
}
-
- r = ndisc_drop_outdated(link, timestamp_usec, NULL);
if (r < 0)
return r;
- r = sd_ndisc_router_get_lifetime(rt, &router_lifetime_sec);
+ r = ndisc_drop_outdated(link, timestamp_usec);
if (r < 0)
- return log_link_warning_errno(link, r, "Failed to get lifetime of RA message: %m");
-
- /* https://datatracker.ietf.org/doc/html/rfc4861
- * Router Lifetime: A Lifetime of 0 indicates that the router is not a default router
- * and SHOULD NOT appear on the default router list.
- */
- if (router_lifetime_sec == 0) {
- log_link_debug(link, "Received RA with lifetime = 0, dropping configurations.");
-
- r = ndisc_drop_outdated(link, USEC_INFINITY, &router);
- if (r < 0)
- log_link_warning_errno(link, r, "Failed to process RA with zero lifetime, ignoring: %m");
-
- return 0;
- }
+ return r;
r = ndisc_start_dhcp6_client(link, rt);
if (r < 0)
link->ndisc_rdnss = set_free(link->ndisc_rdnss);
link->ndisc_dnssl = set_free(link->ndisc_dnssl);
link->ndisc_captive_portals = set_free(link->ndisc_captive_portals);
+ link->ndisc_pref64 = set_free(link->ndisc_pref64);
}
static const char* const ipv6_accept_ra_start_dhcp6_client_table[_IPV6_ACCEPT_RA_START_DHCP6_CLIENT_MAX] = {
char *captive_portal;
} NDiscCaptivePortal;
+typedef struct NDiscPREF64 {
+ struct in6_addr router;
+ /* This is an absolute point in time, and NOT a timespan/duration.
+ * Must be specified with CLOCK_BOOTTIME. */
+ usec_t lifetime_usec;
+ uint8_t prefix_len;
+ struct in6_addr prefix;
+} NDiscPREF64;
+
static inline char* NDISC_DNSSL_DOMAIN(const NDiscDNSSL *n) {
return ((char*) n) + ALIGN(sizeof(NDiscDNSSL));
}
IPv6AcceptRA.UseRoutePrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_route_prefix)
IPv6AcceptRA.UseAutonomousPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_autonomous_prefix)
IPv6AcceptRA.UseOnLinkPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_onlink_prefix)
+IPv6AcceptRA.UsePREF64, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_pref64)
IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_dns)
IPv6AcceptRA.UseDomains, config_parse_ipv6_accept_ra_use_domains, 0, offsetof(Network, ipv6_accept_ra_use_domains)
IPv6AcceptRA.UseMTU, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_mtu)
IPv6SendRA.Domains, config_parse_radv_search_domains, 0, 0
IPv6SendRA.DNSLifetimeSec, config_parse_sec, 0, offsetof(Network, router_dns_lifetime_usec)
IPv6SendRA.UplinkInterface, config_parse_uplink, 0, 0
+IPv6SendRA.HomeAgent, config_parse_bool, 0, offsetof(Network, router_home_agent_information)
+IPv6SendRA.HomeAgentLifetimeSec, config_parse_router_home_agent_lifetime, 0, offsetof(Network, home_agent_lifetime_usec)
+IPv6SendRA.HomeAgentPreference, config_parse_uint16, 0, offsetof(Network, router_home_agent_preference)
IPv6Prefix.Prefix, config_parse_prefix, 0, 0
IPv6Prefix.OnLink, config_parse_prefix_boolean, 0, 0
IPv6Prefix.AddressAutoconfiguration, config_parse_prefix_boolean, 0, 0
OrderedSet *router_search_domains;
int router_uplink_index;
char *router_uplink_name;
+ /* Mobile IPv6 Home Agent */
+ bool router_home_agent_information;
+ uint16_t router_home_agent_preference;
+ usec_t home_agent_lifetime_usec;
/* DHCP Prefix Delegation support */
int dhcp_pd;
bool ipv6_accept_ra_use_icmp6_ratelimit;
bool ipv6_accept_ra_quickack;
bool ipv6_accept_ra_use_captive_portal;
+ bool ipv6_accept_ra_use_pref64;
bool active_slave;
bool primary_slave;
DHCPUseDomains ipv6_accept_ra_use_domains;
if (r < 0)
return log_link_debug_errno(link, r, "Could not set RA Domains: %m");
+ r = sd_radv_set_home_agent_information(link->radv, link->network->router_home_agent_information);
+ if (r < 0)
+ return r;
+
+ r = sd_radv_set_home_agent_preference(link->radv, link->network->router_home_agent_preference);
+ if (r < 0)
+ return r;
+
+ r = sd_radv_set_home_agent_lifetime(link->radv, DIV_ROUND_UP(link->network->home_agent_lifetime_usec, USEC_PER_SEC));
+ if (r < 0)
+ return r;
+
return 0;
}
return 0;
}
+
+int config_parse_router_home_agent_lifetime(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ usec_t usec, *home_agent_lifetime_usec = ASSERT_PTR(data);
+ int r;
+
+ assert(filename);
+ assert(section);
+ assert(lvalue);
+ assert(rvalue);
+
+ if (isempty(rvalue)) {
+ *home_agent_lifetime_usec = 0;
+ return 0;
+ }
+
+ r = parse_sec(rvalue, &usec);
+ if (r < 0) {
+ log_syntax(unit, LOG_WARNING, filename, line, r,
+ "Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
+ return 0;
+ }
+
+ if (usec == USEC_INFINITY || usec == 0 ||
+ DIV_ROUND_UP(usec, USEC_PER_SEC) > RADV_MAX_HOME_AGENT_LIFETIME_USEC) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0,
+ "Invalid %s= must be in the range 1…%s, ignoring: %s", lvalue,
+ FORMAT_TIMESPAN(RADV_MAX_HOME_AGENT_LIFETIME_USEC, USEC_PER_SEC), rvalue);
+ return 0;
+ }
+
+ *home_agent_lifetime_usec = usec;
+ return 0;
+}
CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix_lifetime);
CONFIG_PARSER_PROTOTYPE(config_parse_pref64_prefix);
CONFIG_PARSER_PROTOTYPE(config_parse_pref64_prefix_lifetime);
+CONFIG_PARSER_PROTOTYPE(config_parse_router_home_agent_lifetime);
break;
case ARG_UUID:
- r = sd_id128_from_string(optarg, &arg_uuid);
- if (r < 0)
- return log_error_errno(r, "Invalid UUID: %s", optarg);
-
- if (sd_id128_is_null(arg_uuid))
+ r = id128_from_string_nonzero(optarg, &arg_uuid);
+ if (r == -ENXIO)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Machine UUID may not be all zeroes.");
+ if (r < 0)
+ return log_error_errno(r, "Invalid UUID: %s", optarg);
arg_settings_mask |= SETTING_MACHINE_ID;
break;
if (r < 0)
return log_error_errno(r, "Failed to get current GPT disk label UUID: %m");
- r = sd_id128_from_string(disk_uuid_string, &disk_uuid);
- if (r < 0)
- return log_error_errno(r, "Failed to parse current GPT disk label UUID: %m");
-
- if (sd_id128_is_null(disk_uuid)) {
+ r = id128_from_string_nonzero(disk_uuid_string, &disk_uuid);
+ if (r == -ENXIO) {
r = derive_uuid(context->seed, "disk-uuid", &disk_uuid);
if (r < 0)
return log_error_errno(r, "Failed to acquire disk GPT uuid: %m");
r = fdisk_set_disklabel_id(c);
if (r < 0)
return log_error_errno(r, "Failed to set GPT disk label: %m");
- }
+ } else if (r < 0)
+ return log_error_errno(r, "Failed to parse current GPT disk label UUID: %m");
r = fdisk_get_partitions(c, &t);
if (r < 0)
if (FLAGS_SET(flags, ASK_PASSWORD_ECHO))
(void) loop_write(ttyfd, passphrase + codepoint, n, false);
else
- (void) loop_write(ttyfd, "*", 1, false);
+ (void) loop_write(
+ ttyfd,
+ special_glyph(SPECIAL_GLYPH_BULLET),
+ SIZE_MAX,
+ false);
codepoint = p;
}
}
#include "fileio.h"
#include "fs-util.h"
#include "hostname-util.h"
+#include "id128-util.h"
#include "in-addr-util.h"
#include "log.h"
#include "macro.h"
void *data,
void *userdata) {
- sd_id128_t t, *result = data;
+ sd_id128_t *result = data;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
- r = sd_id128_from_string(rvalue, &t);
- if (r < 0) {
+ r = id128_from_string_nonzero(rvalue, result);
+ if (r == -ENXIO)
+ log_syntax(unit, LOG_WARNING, filename, line, r, "128-bit ID/UUID is all 0, ignoring: %s", rvalue);
+ else if (r < 0)
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 128-bit ID/UUID, ignoring: %s", rvalue);
- return 0;
- }
-
- if (sd_id128_is_null(t)) {
- log_syntax(unit, LOG_WARNING, filename, line, 0, "128-bit ID/UUID is all 0, ignoring: %s", rvalue);
- return 0;
- }
- *result = t;
return 0;
}
else if (d->type == TABLE_TIMESTAMP_DATE)
ret = format_timestamp_style(p, FORMAT_TIMESTAMP_MAX, d->timestamp, TIMESTAMP_DATE);
else if (d->type == TABLE_TIMESTAMP_RELATIVE_MONOTONIC)
- ret = format_timestamp_relative_full(p, FORMAT_TIMESTAMP_RELATIVE_MAX,
- d->timestamp, CLOCK_MONOTONIC,
- /* implicit_left = */ false);
+ ret = format_timestamp_relative_monotonic(p, FORMAT_TIMESTAMP_RELATIVE_MAX, d->timestamp);
else
ret = format_timestamp_relative_full(p, FORMAT_TIMESTAMP_RELATIVE_MAX,
d->timestamp, CLOCK_REALTIME,
#include "terminal-util.h"
int id128_pretty_print_sample(const char *name, sd_id128_t id) {
- _cleanup_free_ char *man_link = NULL, *mod_link = NULL;
- const char *on, *off;
- unsigned i;
+ _cleanup_free_ char *man_link = NULL, *mod_link = NULL;
- on = ansi_highlight();
- off = ansi_normal();
+ const char *on = ansi_highlight(),
+ *off = ansi_normal();
if (terminal_urlify("man:systemd-id128(1)", "systemd-id128(1)", &man_link) < 0)
return log_oom();
on, SD_ID128_FORMAT_VAL(id), off,
man_link,
on, name);
- for (i = 0; i < 16; i++)
- printf("%02x%s", id.bytes[i], i != 15 ? "," : "");
+ for (size_t i = 0; i < 16; i++)
+ printf("%02x%s", id.bytes[i], i < 15 ? "," : "");
printf(")%s\n\n", off);
printf("As Python constant:\n"
const char *old_root_after, /* path below the new root, where to place the old root after the transition; may be NULL to unmount it */
SwitchRootFlags flags) {
- /* Stuff mounted below /run we don't save on soft reboot, as it might have lost its relevance, i.e.
- * credentials, removable media and such, we rather want that the new boot mounts this fresh.
- * But on the switch from initrd we do use MS_REC, as it is expected that mounts set up in /run
- * are maintained. */
- unsigned long run_mount_flags = MS_BIND|(!FLAGS_SET(flags, SWITCH_ROOT_SKIP_RECURSIVE_RUN) ? MS_REC : 0);
- struct {
+ /* Stuff mounted below /run/ we don't save on soft reboot, as it might have lost its relevance, i.e.
+ * credentials, removable media and such, we rather want that the new boot mounts this fresh. But on
+ * the switch from initrd we do use MS_REC, as it is expected that mounts set up in /run/ are
+ * maintained. */
+ static const struct {
const char *path;
- unsigned long mount_flags;
- bool skip_if_run_is_rec; /* For child mounts of /run, if it's moved recursively no need to handle */
+ unsigned long mount_flags; /* Flags to apply if SWITCH_ROOT_RECURSIVE_RUN is unset */
+ unsigned long mount_flags_recursive_run; /* Flags to apply if SWITCH_ROOT_RECURSIVE_RUN is set (0 if shall be skipped) */
} transfer_table[] = {
- { "/dev", MS_BIND|MS_REC, false }, /* Recursive, because we want to save the original /dev/shm + /dev/pts and similar */
- { "/sys", MS_BIND|MS_REC, false }, /* Similar, we want to retain various API VFS, or the cgroupv1 /sys/fs/cgroup/ tree */
- { "/proc", MS_BIND|MS_REC, false }, /* Similar */
- { "/run", run_mount_flags, false }, /* Recursive except on soft reboot, see above */
- { SYSTEM_CREDENTIALS_DIRECTORY, MS_BIND, true }, /* Credentials passed into the system should survive */
- { ENCRYPTED_SYSTEM_CREDENTIALS_DIRECTORY, MS_BIND, true }, /* Similar */
- { "/run/host", MS_BIND|MS_REC, true }, /* Host supplied hierarchy should also survive */
+ { "/dev", MS_BIND|MS_REC, MS_BIND|MS_REC }, /* Recursive, because we want to save the original /dev/shm/ + /dev/pts/ and similar */
+ { "/sys", MS_BIND|MS_REC, MS_BIND|MS_REC }, /* Similar, we want to retain various API VFS, or the cgroupv1 /sys/fs/cgroup/ tree */
+ { "/proc", MS_BIND|MS_REC, MS_BIND|MS_REC }, /* Similar */
+ { "/run", MS_BIND, MS_BIND|MS_REC }, /* Recursive except on soft reboot, see above */
+ { SYSTEM_CREDENTIALS_DIRECTORY, MS_BIND, 0 /* skip! */ }, /* Credentials passed into the system should survive */
+ { ENCRYPTED_SYSTEM_CREDENTIALS_DIRECTORY, MS_BIND, 0 /* skip! */ }, /* Similar */
+ { "/run/host", MS_BIND|MS_REC, 0 /* skip! */ }, /* Host supplied hierarchy should also survive */
};
_cleanup_close_ int old_root_fd = -EBADF, new_root_fd = -EBADF;
FOREACH_ARRAY(transfer, transfer_table, ELEMENTSOF(transfer_table)) {
_cleanup_free_ char *chased = NULL;
+ unsigned long mount_flags;
- if (transfer->skip_if_run_is_rec && !FLAGS_SET(flags, SWITCH_ROOT_SKIP_RECURSIVE_RUN))
+ mount_flags = FLAGS_SET(flags, SWITCH_ROOT_RECURSIVE_RUN) ? transfer->mount_flags_recursive_run : transfer->mount_flags;
+ if (mount_flags == 0) /* skip if zero */
continue;
if (access(transfer->path, F_OK) < 0) {
if (r > 0) /* If it is already mounted, then do nothing */
continue;
- r = mount_nofollow_verbose(LOG_ERR, transfer->path, chased, NULL, transfer->mount_flags, NULL);
+ r = mount_nofollow_verbose(LOG_ERR, transfer->path, chased, NULL, mount_flags, NULL);
if (r < 0)
return r;
}
if (r < 0) {
log_debug_errno(r, "Pivoting root file system failed, moving mounts instead: %m");
+ if (resolved_old_root_after) {
+ r = mount_nofollow_verbose(LOG_ERR, "/", resolved_old_root_after, NULL, MS_BIND|MS_REC, NULL);
+ if (r < 0)
+ return r;
+ }
+
/* If we have to use MS_MOVE let's first try to get rid of *all* mounts we can, with the
* exception of the path we want to switch to, plus everything leading to it and within
* it. This is necessary because unlike pivot_root() just moving the mount to the root via
* MS_MOVE won't magically unmount anything below it. Once the chroot() succeeds the mounts
* below would still be around but invisible to us, because not accessible via
* /proc/self/mountinfo. Hence, let's clean everything up first, as long as we still can. */
- if (!FLAGS_SET(flags, SWITCH_ROOT_SKIP_RECURSIVE_UMOUNT))
- (void) umount_recursive_full(NULL, MNT_DETACH, STRV_MAKE(new_root));
+ (void) umount_recursive_full(NULL, MNT_DETACH, STRV_MAKE(new_root));
if (mount(".", "/", NULL, MS_MOVE, NULL) < 0)
return log_error_errno(errno, "Failed to move %s to /: %m", new_root);
SWITCH_ROOT_DESTROY_OLD_ROOT = 1 << 0, /* rm -rf old root when switching – under the condition
* that it is backed by non-persistent tmpfs/ramfs/… */
SWITCH_ROOT_DONT_SYNC = 1 << 1, /* don't call sync() immediately before switching root */
- SWITCH_ROOT_SKIP_RECURSIVE_RUN = 1 << 2, /* move /run without MS_REC */
- SWITCH_ROOT_SKIP_RECURSIVE_UMOUNT = 1 << 3, /* do not umount recursively on move */
+ SWITCH_ROOT_RECURSIVE_RUN = 1 << 2, /* move /run/ with MS_REC from old to new root */
} SwitchRootFlags;
int switch_root(const char *new_root, const char *old_root_after, SwitchRootFlags flags);
* Disable sync() during switch-root, we after all sync'ed here plenty, and a dumb sync (as opposed
* to the "smart" sync() we did here that looks at progress parameters) would defeat much of our
* efforts here. As the new root will be /run/initramfs/, it is not necessary to mount /run/
- * recursively. Also, do not umount filesystems before MS_MOVE, as that should be done by ourself. */
+ * recursively. */
return switch_root(
/* new_root= */ "/run/initramfs",
/* old_root_after= */ "/oldroot",
- /* flags= */ SWITCH_ROOT_DONT_SYNC |
- SWITCH_ROOT_SKIP_RECURSIVE_RUN |
- SWITCH_ROOT_SKIP_RECURSIVE_UMOUNT);
+ /* flags= */ SWITCH_ROOT_DONT_SYNC);
}
/* Read the following fields from /proc/meminfo:
log_debug_errno(r, "Failed to %s %s, ignoring: %s", job_type, name, bus_error_message(error, r));
return 0;
- } else
- log_error_errno(r, "Failed to %s %s: %s", job_type, name, bus_error_message(error, r));
+ }
+
+ log_error_errno(r, "Failed to %s %s: %s", job_type, name, bus_error_message(error, r));
if (!sd_bus_error_has_names(error, BUS_ERROR_NO_SUCH_UNIT,
BUS_ERROR_UNIT_MASKED,
#include "bus-error.h"
#include "bus-locator.h"
#include "chase.h"
+#include "fd-util.h"
+#include "initrd-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "proc-cmdline.h"
if (argc >= 2) {
root = argv[1];
+
if (!path_is_valid(root))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid root path: %s", root);
+
if (!path_is_absolute(root))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Root path is not absolute: %s", root);
- if (path_equal(root, "/"))
+
+ r = path_is_root(root);
+ if (r < 0)
+ return log_error_errno(r, "Failed to check if switch-root directory '%s' is current root: %m", root);
+ if (r > 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Cannot switch to current root directory: %s", root);
} else
root = "/sysroot";
+ if (!in_initrd())
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Not in initrd, refusing switch-root operation.");
+
if (argc >= 3)
init = argv[2];
else {
int sd_dhcp_client_send_release(sd_dhcp_client *client);
int sd_dhcp_client_send_decline(sd_dhcp_client *client);
int sd_dhcp_client_send_renew(sd_dhcp_client *client);
+int sd_dhcp_client_get_lease_timestamp(sd_dhcp_client *client, uint64_t *timestamp);
sd_dhcp_client *sd_dhcp_client_ref(sd_dhcp_client *client);
sd_dhcp_client *sd_dhcp_client_unref(sd_dhcp_client *client);
int sd_id128_get_boot(sd_id128_t *ret);
int sd_id128_get_invocation(sd_id128_t *ret);
+int sd_id128_get_app_specific(sd_id128_t base, sd_id128_t app_id, sd_id128_t *ret);
int sd_id128_get_machine_app_specific(sd_id128_t app_id, sd_id128_t *ret);
int sd_id128_get_boot_app_specific(sd_id128_t app_id, sd_id128_t *ret);
#define SD_MESSAGE_FACTORY_RESET SD_ID128_MAKE(c1,4a,af,76,ec,28,4a,5f,a1,f1,05,f8,8d,fb,06,1c)
#define SD_MESSAGE_FACTORY_RESET_STR SD_ID128_MAKE_STR(c1,4a,af,76,ec,28,4a,5f,a1,f1,05,f8,8d,fb,06,1c)
-#define SD_MESSAGE_CRASH_EXIT SD_ID128_MAKE(d9,ec,5e,95,e4,b6,46,aa,ae,a2,fd,05,21,4e,db,da)
-#define SD_MESSAGE_CRASH_EXIT_STR SD_ID128_MAKE_STR(d9,ec,5e,95,e4,b6,46,aa,ae,a2,fd,05,21,4e,db,da)
-#define SD_MESSAGE_CRASH_FAILED SD_ID128_MAKE(3e,d0,16,3e,86,8a,44,17,ab,8b,9e,21,04,07,a9,6c)
-#define SD_MESSAGE_CRASH_FAILED_STR SD_ID128_MAKE_STR(3e,d0,16,3e,86,8a,44,17,ab,8b,9e,21,04,07,a9,6c)
-#define SD_MESSAGE_CRASH_FREEZE SD_ID128_MAKE(64,5c,73,55,37,63,4a,e0,a3,2b,15,a7,c6,cb,a7,d4)
-#define SD_MESSAGE_CRASH_FREEZE_STR SD_ID128_MAKE_STR(64,5c,73,55,37,63,4a,e0,a3,2b,15,a7,c6,cb,a7,d4)
+#define SD_MESSAGE_CRASH_EXIT SD_ID128_MAKE(d9,ec,5e,95,e4,b6,46,aa,ae,a2,fd,05,21,4e,db,da)
+#define SD_MESSAGE_CRASH_EXIT_STR SD_ID128_MAKE_STR(d9,ec,5e,95,e4,b6,46,aa,ae,a2,fd,05,21,4e,db,da)
+#define SD_MESSAGE_CRASH_FAILED SD_ID128_MAKE(3e,d0,16,3e,86,8a,44,17,ab,8b,9e,21,04,07,a9,6c)
+#define SD_MESSAGE_CRASH_FAILED_STR SD_ID128_MAKE_STR(3e,d0,16,3e,86,8a,44,17,ab,8b,9e,21,04,07,a9,6c)
+#define SD_MESSAGE_CRASH_FREEZE SD_ID128_MAKE(64,5c,73,55,37,63,4a,e0,a3,2b,15,a7,c6,cb,a7,d4)
+#define SD_MESSAGE_CRASH_FREEZE_STR SD_ID128_MAKE_STR(64,5c,73,55,37,63,4a,e0,a3,2b,15,a7,c6,cb,a7,d4)
#define SD_MESSAGE_CRASH_NO_COREDUMP SD_ID128_MAKE(5a,dd,b3,a0,6a,73,4d,33,96,b7,94,bf,98,fb,2d,01)
#define SD_MESSAGE_CRASH_NO_COREDUMP_STR SD_ID128_MAKE_STR(5a,dd,b3,a0,6a,73,4d,33,96,b7,94,bf,98,fb,2d,01)
SD_NDISC_OPTION_RDNSS = 25,
SD_NDISC_OPTION_FLAGS_EXTENSION = 26,
SD_NDISC_OPTION_DNSSL = 31,
- SD_NDISC_OPTION_CAPTIVE_PORTAL = 37
+ SD_NDISC_OPTION_CAPTIVE_PORTAL = 37,
+ SD_NDISC_OPTION_PREF64 = 38
};
/* Route preference, RFC 4191, Section 2.1 */
/* Specific option access: SD_NDISC_OPTION_CAPTIVE_PORTAL */
int sd_ndisc_router_captive_portal_get_uri(sd_ndisc_router *rt, const char **uri, size_t *size);
+/* Specific option access: SD_NDISC_OPTION_PREF64 */
+int sd_ndisc_router_prefix64_get_prefix(sd_ndisc_router *rt, struct in6_addr *ret_addr);
+int sd_ndisc_router_prefix64_get_prefixlen(sd_ndisc_router *rt, unsigned *ret);
+int sd_ndisc_router_prefix64_get_lifetime_sec(sd_ndisc_router *rt, uint16_t *ret);
+
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc, sd_ndisc_unref);
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc_router, sd_ndisc_router_unref);
sd_radv_pref64_prefix *sd_radv_pref64_prefix_ref(sd_radv_pref64_prefix *ra);
sd_radv_pref64_prefix *sd_radv_pref64_prefix_unref(sd_radv_pref64_prefix *ra);
+/* Mobile IPv6 extension: Home Agent Info. */
+int sd_radv_set_home_agent_information(sd_radv *ra, int home_agent);
+int sd_radv_set_home_agent_preference(sd_radv *ra, uint16_t preference);
+int sd_radv_set_home_agent_lifetime(sd_radv *ra, uint16_t lifetime);
+
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv, sd_radv_unref);
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv_prefix, sd_radv_prefix_unref);
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv_route_prefix, sd_radv_route_prefix_unref);
#define ID128_WALDI SD_ID128_MAKE(01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10)
#define STR_WALDI "0102030405060708090a0b0c0d0e0f10"
#define UUID_WALDI "01020304-0506-0708-090a-0b0c0d0e0f10"
+#define STR_NULL "00000000000000000000000000000000"
TEST(id128) {
sd_id128_t id, id2;
assert_se(sd_id128_from_string("01020304-0506-0708-090a0b0c0d0e0f10", &id) < 0);
assert_se(sd_id128_from_string("010203040506-0708-090a-0b0c0d0e0f10", &id) < 0);
+ assert_se(id128_from_string_nonzero(STR_WALDI, &id) == 0);
+ assert_se(id128_from_string_nonzero(STR_NULL, &id) == -ENXIO);
+ assert_se(id128_from_string_nonzero("01020304-0506-0708-090a-0b0c0d0e0f101", &id) < 0);
+ assert_se(id128_from_string_nonzero("01020304-0506-0708-090a-0b0c0d0e0f10-", &id) < 0);
+ assert_se(id128_from_string_nonzero("01020304-0506-0708-090a0b0c0d0e0f10", &id) < 0);
+ assert_se(id128_from_string_nonzero("010203040506-0708-090a-0b0c0d0e0f10", &id) < 0);
+
assert_se(id128_is_valid(STR_WALDI));
assert_se(id128_is_valid(UUID_WALDI));
assert_se(!id128_is_valid(""));
assert_se(lseek(fd, 0, SEEK_SET) == 0);
assert_se(id128_read_fd(fd, ID128_FORMAT_ANY, NULL) == -EUCLEAN);
+ /* build/systemd-id128 -a f03daaeb1c334b43a732172944bf772e show 51df0b4bc3b04c9780e299b98ca373b8 */
+ assert_se(sd_id128_get_app_specific(SD_ID128_MAKE(51,df,0b,4b,c3,b0,4c,97,80,e2,99,b9,8c,a3,73,b8),
+ SD_ID128_MAKE(f0,3d,aa,eb,1c,33,4b,43,a7,32,17,29,44,bf,77,2e), &id) >= 0);
+ assert_se(sd_id128_equal(id, SD_ID128_MAKE(1d,ee,59,54,e7,5c,4d,6f,b9,6c,c6,c0,4c,a1,8a,86)));
+
if (sd_booted() > 0 && sd_id128_get_machine(NULL) >= 0) {
assert_se(sd_id128_get_machine_app_specific(SD_ID128_MAKE(f0,3d,aa,eb,1c,33,4b,43,a7,32,17,29,44,bf,77,2e), &id) >= 0);
assert_se(sd_id128_get_machine_app_specific(SD_ID128_MAKE(f0,3d,aa,eb,1c,33,4b,43,a7,32,17,29,44,bf,77,2e), &id2) >= 0);
assert_se(sd_id128_get_machine_app_specific(SD_ID128_MAKE(51,df,0b,4b,c3,b0,4c,97,80,e2,99,b9,8c,a3,73,b8), &id2) >= 0);
assert_se(!sd_id128_equal(id, id2));
}
+
+ /* Check return values */
+ assert_se(sd_id128_get_app_specific(SD_ID128_ALLF, SD_ID128_NULL, &id) == -ENXIO);
+ assert_se(sd_id128_get_app_specific(SD_ID128_NULL, SD_ID128_ALLF, &id) == 0);
}
TEST(sd_id128_get_invocation) {
TEST(strrep) {
_cleanup_free_ char *one = NULL, *three = NULL, *zero = NULL;
+ char *onea, *threea;
+
one = strrep("waldo", 1);
three = strrep("waldo", 3);
zero = strrep("waldo", 0);
assert_se(streq(one, "waldo"));
assert_se(streq(three, "waldowaldowaldo"));
assert_se(streq(zero, ""));
+
+ onea = strrepa("waldo", 1);
+ threea = strrepa("waldo", 3);
+
+ assert_se(streq(onea, "waldo"));
+ assert_se(streq(threea, "waldowaldowaldo"));
}
TEST(string_has_cc) {
self.assertIn('DHCPREPLY(veth-peer)', output)
self.assertNotIn('rapid-commit', output)
+ def test_dhcp_client_ipv6_dbus_status(self):
+ def get_dbus_dhcp6_client_state(IF):
+ out = subprocess.check_output(['busctl', 'call', 'org.freedesktop.network1',
+ '/org/freedesktop/network1', 'org.freedesktop.network1.Manager',
+ 'GetLinkByName', 's', IF])
+
+ assert out.startswith(b'io ')
+ out = out.strip()
+ assert out.endswith(b'"')
+ out = out.decode()
+ linkPath = out[:-1].split('"')[1]
+
+ print(f"Found {IF} link path: {linkPath}")
+
+ out = subprocess.check_output(['busctl', 'get-property', 'org.freedesktop.network1',
+ linkPath, 'org.freedesktop.network1.DHCPv6Client', 'State'])
+ assert out.startswith(b's "')
+ out = out.strip()
+ assert out.endswith(b'"')
+ return out[3:-1].decode()
+
+ copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client-ipv6-only.network')
+
+ start_networkd()
+ self.wait_online(['veth-peer:carrier'])
+
+ # Note that at this point the DHCPv6 client has not been started because no RA (with managed
+ # bit set) has yet been recieved and the configuration does not include WithoutRA=true
+ state = get_dbus_dhcp6_client_state('veth99')
+ print(f"State = {state}")
+ self.assertEqual(state, 'stopped')
+
+ start_dnsmasq()
+ self.wait_online(['veth99:routable', 'veth-peer:routable'])
+
+ state = get_dbus_dhcp6_client_state('veth99')
+ print(f"State = {state}")
+ self.assertEqual(state, 'bound')
+
def test_dhcp_client_ipv6_only_with_custom_client_identifier(self):
copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client-ipv6-only-custom-client-identifier.network')
self.teardown_nftset('addr4', 'network4', 'ifindex')
+ def test_dhcp_client_ipv4_dbus_status(self):
+ def get_dbus_dhcp4_client_state(IF):
+ out = subprocess.check_output(['busctl', 'call', 'org.freedesktop.network1',
+ '/org/freedesktop/network1', 'org.freedesktop.network1.Manager',
+ 'GetLinkByName', 's', IF])
+
+ assert out.startswith(b'io ')
+ out = out.strip()
+ assert out.endswith(b'"')
+ out = out.decode()
+ linkPath = out[:-1].split('"')[1]
+
+ print(f"Found {IF} link path: {linkPath}")
+
+ out = subprocess.check_output(['busctl', 'get-property', 'org.freedesktop.network1',
+ linkPath, 'org.freedesktop.network1.DHCPv4Client', 'State'])
+ assert out.startswith(b's "')
+ out = out.strip()
+ assert out.endswith(b'"')
+ return out[3:-1].decode()
+
+ copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client-ipv4-only.network')
+
+ start_networkd()
+ self.wait_online(['veth-peer:carrier'])
+
+ state = get_dbus_dhcp4_client_state('veth99')
+ print(f"State = {state}")
+ self.assertEqual(state, 'selecting')
+
+ start_dnsmasq('--dhcp-option=option:dns-server,192.168.5.6,192.168.5.7',
+ '--dhcp-option=option:domain-search,example.com',
+ '--dhcp-alternate-port=67,5555',
+ ipv4_range='192.168.5.110,192.168.5.119')
+ self.wait_online(['veth99:routable', 'veth-peer:routable'])
+ self.wait_address('veth99', r'inet 192.168.5.11[0-9]*/24', ipv='-4')
+
+ state = get_dbus_dhcp4_client_state('veth99')
+ print(f"State = {state}")
+ self.assertEqual(state, 'bound')
+
def test_dhcp_client_ipv4_use_routes_gateway(self):
first = True
for (routes, gateway, dns_and_ntp_routes, classless) in itertools.product([True, False], repeat=4):
tear_down_common()
def test_dhcp6pd(self):
+ def get_dbus_dhcp6_prefix(IF):
+ # busctl call org.freedesktop.network1 /org/freedesktop/network1 org.freedesktop.network1.Manager GetLinkByName s IF
+ out = subprocess.check_output(['busctl', 'call', 'org.freedesktop.network1',
+ '/org/freedesktop/network1', 'org.freedesktop.network1.Manager',
+ 'GetLinkByName', 's', IF])
+
+ assert out.startswith(b'io ')
+ out = out.strip()
+ assert out.endswith(b'"')
+ out = out.decode()
+ linkPath = out[:-1].split('"')[1]
+
+ print(f"Found {IF} link path: {linkPath}")
+
+ out = subprocess.check_output(['busctl', 'call', 'org.freedesktop.network1',
+ linkPath, 'org.freedesktop.network1.Link', 'Describe'])
+ assert out.startswith(b's "')
+ out = out.strip()
+ assert out.endswith(b'"')
+ json_raw = out[2:].decode()
+ check_json(json_raw)
+ description = json.loads(json_raw) # Convert from escaped sequences to json
+ check_json(description)
+ description = json.loads(description) # Now parse the json
+
+ self.assertIn('DHCPv6Client', description.keys())
+ self.assertIn('Prefixes', description['DHCPv6Client'])
+
+ prefixInfo = description['DHCPv6Client']['Prefixes']
+
+ return prefixInfo
+
copy_network_unit('25-veth.netdev', '25-dhcp6pd-server.network', '25-dhcp6pd-upstream.network',
'25-veth-downstream-veth97.netdev', '25-dhcp-pd-downstream-veth97.network', '25-dhcp-pd-downstream-veth97-peer.network',
'25-veth-downstream-veth98.netdev', '25-dhcp-pd-downstream-veth98.network', '25-dhcp-pd-downstream-veth98-peer.network',
self.wait_online(['veth99:routable', 'test1:routable', 'dummy98:routable', 'dummy99:degraded',
'veth97:routable', 'veth97-peer:routable', 'veth98:routable', 'veth98-peer:routable'])
+ # Check DBus assigned prefix information to veth99
+ prefixInfo = get_dbus_dhcp6_prefix('veth99')
+
+ self.assertEqual(len(prefixInfo), 1)
+ prefixInfo = prefixInfo[0]
+
+ self.assertIn('Prefix', prefixInfo.keys())
+ self.assertIn('PrefixLength', prefixInfo.keys())
+ self.assertIn('PreferredLifetimeUSec', prefixInfo.keys())
+ self.assertIn('ValidLifetimeUSec', prefixInfo.keys())
+
+ self.assertEqual(prefixInfo['Prefix'][0:6], [63, 254, 5, 1, 255, 255])
+ self.assertEqual(prefixInfo['PrefixLength'], 56)
+ self.assertGreater(prefixInfo['PreferredLifetimeUSec'], 0)
+ self.assertGreater(prefixInfo['ValidLifetimeUSec'], 0)
+
print('### ip -6 address show dev veth-peer scope global')
output = check_output('ip -6 address show dev veth-peer scope global')
print(output)
self.assertIn(f'via ::10.0.0.1 dev {tunnel_name}', output)
def test_dhcp4_6rd(self):
+ def get_dbus_dhcp_6rd_prefix(IF):
+ out = subprocess.check_output(['busctl', 'call', 'org.freedesktop.network1',
+ '/org/freedesktop/network1', 'org.freedesktop.network1.Manager',
+ 'GetLinkByName', 's', IF])
+
+ assert out.startswith(b'io ')
+ out = out.strip()
+ assert out.endswith(b'"')
+ out = out.decode()
+ linkPath = out[:-1].split('"')[1]
+
+ print(f"Found {IF} link path: {linkPath}")
+
+ out = subprocess.check_output(['busctl', 'call', 'org.freedesktop.network1',
+ linkPath, 'org.freedesktop.network1.Link', 'Describe'])
+ assert out.startswith(b's "')
+ out = out.strip()
+ assert out.endswith(b'"')
+ json_raw = out[2:].decode()
+ check_json(json_raw)
+ description = json.loads(json_raw) # Convert from escaped sequences to json
+ check_json(description)
+ description = json.loads(description) # Now parse the json
+
+ self.assertIn('DHCPv4Client', description.keys())
+ self.assertIn('6rdPrefix', description['DHCPv4Client'].keys())
+
+ prefixInfo = description['DHCPv4Client']['6rdPrefix']
+ self.assertIn('Prefix', prefixInfo.keys())
+ self.assertIn('PrefixLength', prefixInfo.keys())
+ self.assertIn('IPv4MaskLength', prefixInfo.keys())
+ self.assertIn('BorderRouters', prefixInfo.keys())
+
+ return prefixInfo
+
copy_network_unit('25-veth.netdev', '25-dhcp4-6rd-server.network', '25-dhcp4-6rd-upstream.network',
'25-veth-downstream-veth97.netdev', '25-dhcp-pd-downstream-veth97.network', '25-dhcp-pd-downstream-veth97-peer.network',
'25-veth-downstream-veth98.netdev', '25-dhcp-pd-downstream-veth98.network', '25-dhcp-pd-downstream-veth98-peer.network',
self.wait_online(['veth99:routable', 'test1:routable', 'dummy98:routable', 'dummy99:degraded',
'veth97:routable', 'veth97-peer:routable', 'veth98:routable', 'veth98-peer:routable'])
+ # Check the DBus interface for assigned prefix information
+ prefixInfo = get_dbus_dhcp_6rd_prefix('veth99')
+
+ self.assertEqual(prefixInfo['Prefix'], [32,1,13,184,0,0,0,0,0,0,0,0,0,0,0,0]) # 2001:db8::
+ self.assertEqual(prefixInfo['PrefixLength'], 32)
+ self.assertEqual(prefixInfo['IPv4MaskLength'], 8)
+ self.assertEqual(prefixInfo['BorderRouters'], [[10,0,0,1]])
+
# Test case for a downstream which appears later
check_output('ip link add dummy97 type dummy')
self.wait_online(['dummy97:routable'])
systemd-id128 --help
systemd-id128 help
systemd-id128 show
-systemd-id128 show --pretty | tail -n10
+systemd-id128 show --pretty | tail
+systemd-id128 show --value | tail
systemd-id128 show 4f68bce3e8cd4db196e7fbcaf984b709 # root-x86-64
systemd-id128 show --pretty 4f68bce3e8cd4db196e7fbcaf984b709
+systemd-id128 show root-x86-64
+systemd-id128 show --pretty root-x86-64
+[[ "$(systemd-id128 show 4f68bce3e8cd4db196e7fbcaf984b709)" = "$(systemd-id128 show root-x86-64)" ]]
+[[ "$(systemd-id128 show 4f68bce3-e8cd-4db1-96e7-fbcaf984b709)" = "$(systemd-id128 show root-x86-64)" ]]
+
+systemd-id128 show root-x86-64 --app-specific=4f68bce3e8cd4db196e7fbcaf984b709
+systemd-id128 show --pretty root-x86-64 --app-specific=4f68bce3e8cd4db196e7fbcaf984b709
+[[ "$(systemd-id128 show root-x86-64 --app-specific=4f68bce3e8cd4db196e7fbcaf984b709 -P)" = "8ee5535e7cb14c249e1d28b8dfbb939c" ]]
[[ "$(systemd-id128 new | wc -c)" -eq 33 ]]
systemd-id128 new -p
Description=User Database Manager
Documentation=man:systemd-userdbd.service(8)
Requires=systemd-userdbd.socket
-After=systemd-userdbd.socket
+After=systemd-userdbd.socket systemd-remount-fs.service
Before=sysinit.target
DefaultDependencies=no